{"version":3,"file":"render-hooks.mjs","sources":["../../../../../src/components/Table/TableNG/render-hooks.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport {\n  type CSSProperties,\n  type Dispatch,\n  type JSX,\n  type Key,\n  type ReactNode,\n  type RefObject,\n  type SetStateAction,\n  useCallback,\n  useMemo,\n} from 'react';\n\nimport {\n  DataHoverClearEvent,\n  DataHoverEvent,\n  FALLBACK_COLOR,\n  type DataFrame,\n  type Field,\n  FieldType,\n  type GrafanaTheme2,\n  getDisplayProcessor,\n  formattedValueToString,\n  type TimeRange,\n} from '@grafana/data';\nimport { t } from '@grafana/i18n';\nimport {\n  Cell,\n  type CellRendererProps,\n  type DataGridHandle,\n  type RenderCellProps,\n  type RenderRowProps,\n  Row,\n} from '@grafana/react-data-grid';\nimport {\n  FieldColorModeId,\n  TableCellDisplayMode,\n  TableCellTooltipPlacement,\n  type TableFooterOptions,\n} from '@grafana/schema';\n\nimport { type PanelContext } from '../../PanelChrome';\n\nimport { AutoCellRenderer, getCellRenderer, getCellSpecificStyles } from './Cells/renderers';\nimport { getCellMenuOptions } from './cellMenuOptions';\nimport { HeaderCell } from './components/HeaderCell';\nimport { SummaryCell } from './components/SummaryCell';\nimport { TableCellActions } from './components/TableCellActions';\nimport { TableCellTooltip } from './components/TableCellTooltip';\nimport { CELL_HORIZONTAL_CHROME, OVERFLOW_CELL_CLASS, TABLE } from './constants';\nimport {\n  getCellActionStyles,\n  getDefaultCellStyles,\n  getHeaderCellStyles,\n  getColumnSettleStyles,\n  getLinkStyles,\n  getMaxHeightCellStyles,\n  getTooltipStyles,\n  getJustifyContent,\n  IS_SAFARI_26,\n} from './styles';\nimport {\n  type CellRootRenderer,\n  type FilterType,\n  type FromFieldsResult,\n  type GetActionsFunctionLocal,\n  type InspectCellProps,\n  type NestedRowEntry,\n  type TableCellStyleOptions,\n  type TableFilterActionCallback,\n  type TableRow,\n  type TableSummaryRow,\n  type TypographyCtx,\n  type TextWrapFallback,\n  type TableWarning,\n} from './types';\nimport {\n  type ApplyFilterResult,\n  canFieldBeColorized,\n  displayJsonValue,\n  getAlignment,\n  getApplyToRowBgFn,\n  type getCellColorInlineStylesFactory,\n  getCellOptions,\n  getDisplayName,\n  getSummaryCellTextAlign,\n  isCellInspectEnabled,\n  isSortableField,\n  parseStyleJson,\n  predicateByName,\n  rendersAsJson,\n  shouldTextOverflow,\n  shouldTextWrap,\n} from './utils';\n\n// -----------------------------------------------------------------------------\n// useDataGridRows\n// -----------------------------------------------------------------------------\n\n/**\n * @internal\n * Memoized renderer for the `renderRow` prop on DataGrid. Applies aria attributes and\n * shared-crosshair event handlers.\n */\nexport function useDataGridRows(\n  fields: Field[],\n  panelContext: PanelContext,\n  expandedRows: Set<string>,\n  enableSharedCrosshair: boolean,\n  getStableKey: (rowIdx: number) => string\n): (key: Key, props: RenderRowProps<TableRow, TableSummaryRow>) => ReactNode {\n  return useMemo(\n    () =>\n      // eslint-disable-next-line react/display-name\n      (key: Key, props: RenderRowProps<TableRow, TableSummaryRow>): ReactNode => {\n        const { row } = props;\n        const rowIdx = row.__index;\n        const isExpanded = expandedRows.has(getStableKey(rowIdx));\n\n        // Don't render non-expanded child rows\n        if (row.__depth === 1) {\n          if (!isExpanded) {\n            return null;\n          }\n          return <Row key={key} aria-level={row.__index + 1} aria-expanded={isExpanded} {...props} />;\n        }\n\n        const handlers: Partial<typeof props> = {};\n        if (enableSharedCrosshair) {\n          const timeField = fields.find((f) => f.type === FieldType.time);\n          if (timeField) {\n            handlers.onMouseEnter = () => {\n              panelContext.eventBus.publish(\n                new DataHoverEvent({\n                  point: {\n                    time: timeField?.values[rowIdx],\n                  },\n                })\n              );\n            };\n            handlers.onMouseLeave = () => {\n              panelContext.eventBus.publish(new DataHoverClearEvent());\n            };\n          }\n        }\n\n        return <Row key={key} {...props} {...handlers} />;\n      },\n    [fields, panelContext, expandedRows, enableSharedCrosshair, getStableKey]\n  );\n}\n\n// -----------------------------------------------------------------------------\n// useColumnBuilderFromFields\n// -----------------------------------------------------------------------------\n\nexport interface ColumnBuildConfig {\n  wrapFallback?: TextWrapFallback;\n  nestedWrapFallback?: TextWrapFallback;\n  disableKeyboardEvents?: boolean;\n  hoverOverflow?: boolean;\n  disableSanitizeHtml?: boolean;\n  hasColumnSidebar?: boolean;\n  reorderable?: boolean;\n  filter: FilterType;\n  /**\n   * Inline-start padding the grid's first column takes on top of the usual cell padding (see the\n   * `firstColumnInset` style, applied under `noPanelPadding`). It comes out of the cell's content\n   * box, so it has to be taken off the width handed to width-driven cells. Only set by callers\n   * whose first column is a field column: a nested table's first column is the expander, which\n   * carries the inset itself.\n   */\n  firstColumnExtraPadding?: number;\n  lastColumnExtraPadding?: number;\n  frozenColumns: number;\n  getCellActions: GetActionsFunctionLocal;\n  getCellColorInlineStyles: ReturnType<typeof getCellColorInlineStylesFactory>;\n  getTextColorForBackground: (color: string) => string;\n  gridRef: RefObject<DataGridHandle | null>;\n  maxRowHeight?: number;\n  numFrozenColsFullyInView: number;\n  onCellFilterAdded?: TableFilterActionCallback;\n  onHideColumn?: (displayName: string) => void;\n  canHideColumn?: boolean;\n  onOpenColumnPanel?: (columnKey: string) => void;\n  onFieldAddToAssistant?: (frame: DataFrame, field: Field) => void;\n  onCellAddToAssistant?: (frame: DataFrame, field: Field, rowIndex: number) => void;\n  rowHeight: NonNullable<CSSProperties['height']> | ((row: TableRow) => number);\n  rowHeightFn: (row: TableRow) => number;\n  setFilter: Dispatch<SetStateAction<FilterType>>;\n  setInspectCell: Dispatch<SetStateAction<InspectCellProps | null>>;\n  settlingColumnKeys?: ReadonlySet<string>;\n  showTypeIcons?: boolean;\n  tableRefreshEnabled?: boolean;\n  jsonSyntaxHighlightingEnabled?: boolean;\n  theme: GrafanaTheme2;\n  timeRange?: TimeRange;\n  typographyCtx: TypographyCtx;\n}\n\nexport type FromFieldsFn = (\n  fields: Field[],\n  widths: number[],\n  frame: DataFrame,\n  rawRows: TableRow[],\n  visibleRows: TableRow[],\n  lastColumnExtraPadding?: number\n) => FromFieldsResult;\n\n/**\n * Returns a copy of `fields` with the table's cell-type-specific display processors attached — the\n * Pill mappings override and the JSON pretty-printer. These are derived on fresh field objects\n * rather than mutated onto the caller's fields: the column builder used to attach them by mutating\n * the shared field objects mid-render, which leaked into other consumers of the data frame and made\n * any display-dependent measurement order-sensitive (widths could shift once the builder had run,\n * e.g. on sort). Fields that need neither processor are returned by reference, unchanged.\n */\nexport function prepareFieldsForDisplay(fields: Field[], theme: GrafanaTheme2): Field[] {\n  return fields.map((field) => {\n    const cellType = getCellOptions(field).type;\n    let prepared = field;\n\n    // Pill cells with value mappings: use the single fixed-color calculator so mappings win over the\n    // default thresholds mode (a hack), then recompute the display for that adjusted config.\n    if (cellType === TableCellDisplayMode.Pill && (field.config.mappings?.length ?? 0 > 0)) {\n      prepared = {\n        ...field,\n        config: {\n          ...field.config,\n          color: {\n            ...field.config.color,\n            mode: FieldColorModeId.Fixed,\n            fixedColor: field.config.color?.fixedColor ?? FALLBACK_COLOR,\n          },\n        },\n      };\n      prepared.display = getDisplayProcessor({ field: prepared, theme });\n    }\n\n    // JSONView cells, and `other` fields left on the default cell type, render their value as\n    // pretty-printed JSON. Copy first (if the Pill branch above didn't already) so the original\n    // field object is never mutated.\n    if (rendersAsJson(field, cellType)) {\n      prepared = prepared === field ? { ...field } : prepared;\n      prepared.display = displayJsonValue(prepared);\n    }\n\n    return prepared;\n  });\n}\n\n/**\n * Builds column definitions and cell root renderers from a set of fields.\n * Internal: callers should use `useColumnBuilderFromFields`, which memoizes the\n * per-call closure and resolves `resolvedFilterResult` (flat → top-level filterResult,\n * nested → per-parent via `parentIndex`).\n */\nfunction buildColumnsFromFields(\n  fields: Field[],\n  widths: number[],\n  frame: DataFrame,\n  rawRows: TableRow[],\n  visibleRows: TableRow[],\n  resolvedFilterResult: ApplyFilterResult,\n  config: ColumnBuildConfig\n): FromFieldsResult {\n  const {\n    wrapFallback,\n    theme,\n    getCellColorInlineStyles,\n    getTextColorForBackground,\n    rowHeight,\n    rowHeightFn,\n    filter,\n    setFilter,\n    setInspectCell,\n    gridRef,\n    getCellActions,\n    onCellFilterAdded,\n    onHideColumn,\n    canHideColumn = false,\n    onOpenColumnPanel,\n    onFieldAddToAssistant,\n    onCellAddToAssistant,\n    frozenColumns,\n    numFrozenColsFullyInView,\n    maxRowHeight,\n    disableKeyboardEvents,\n    hoverOverflow = true,\n    disableSanitizeHtml,\n    hasColumnSidebar,\n    reorderable = false,\n    settlingColumnKeys,\n    showTypeIcons,\n    tableRefreshEnabled,\n    jsonSyntaxHighlightingEnabled,\n    timeRange,\n    firstColumnExtraPadding = 0,\n    lastColumnExtraPadding = 0,\n    typographyCtx,\n  } = config;\n\n  // Resolve the apply-to-row background function against this frame's own fields.\n  // Nested tables are independent frames: their apply-to-row coloring must read from\n  // the nested field's own values at the nested row's local `__index`, not from the\n  // parent frame. Deriving it here (rather than passing a single top-level closure via\n  // config) keeps `applyToRowBgFn(row.__index)` correct for both flat and nested rows.\n  const applyToRowBgFn = getApplyToRowBgFn(frame.fields, getCellColorInlineStyles) ?? undefined;\n\n  // Attach cell-type display processors up front, on copies, instead of mutating fields in the loop.\n  const preparedFields = prepareFieldsForDisplay(fields, theme);\n\n  const result: FromFieldsResult = {\n    columns: [],\n    cellRootRenderers: {},\n  };\n\n  const fieldFooters: Array<TableFooterOptions | undefined> = [];\n  let isFieldUniformFooter = true;\n  let firstFooterReducers: string[] | undefined;\n  for (const field of fields) {\n    const footer = field.config?.custom?.footer;\n    const reducers: string[] | undefined = footer?.reducers;\n\n    fieldFooters.push(footer);\n\n    // if reducers are undefined or empty on the footer, don't retain them for comparison.\n    if (reducers === undefined || reducers.length === 0) {\n      continue;\n    }\n\n    // first time we encounter a viable footer config, store it and move on.\n    if (firstFooterReducers === undefined) {\n      firstFooterReducers = reducers;\n      continue;\n    }\n\n    // for all other viable footer configs, check to see if the reducers match the first one we encountered.\n    if (reducers.length !== firstFooterReducers.length || reducers.some((r, idx) => firstFooterReducers?.[idx] !== r)) {\n      isFieldUniformFooter = false;\n      break;\n    }\n  }\n\n  // Caller resolves whether to use the top-level or per-parent filter result.\n  const parentIndex = visibleRows[0]?.__parentIndex;\n  const { crossFilterRows, crossFilterTailRows } = resolvedFilterResult;\n\n  let lastRowIdx = -1;\n  // shared when whole row will be styled by a single cell's color\n  let rowCellStyle: Partial<CSSProperties> = {\n    color: undefined,\n    background: undefined,\n  };\n\n  for (let i = 0; i < preparedFields.length; i++) {\n    const field = preparedFields[i];\n    const cellOptions = getCellOptions(field);\n    const cellType = cellOptions.type;\n\n    // For some cells, \"aligning\" the cell will mean aligning the inline contents of the cell with\n    // the text-align css property, and for others, we'll use justify-content to align the cell\n    // contents with flexbox. We always just get both and provide both when styling the cell.\n    const textAlign = getAlignment(field);\n    const justifyContent = getJustifyContent(textAlign);\n    const displayName = getDisplayName(field);\n    const headerCellClass = clsx(\n      getHeaderCellStyles(theme, tableRefreshEnabled ? 'flex-start' : justifyContent),\n      settlingColumnKeys?.has(displayName) && getColumnSettleStyles(theme, tableRefreshEnabled)\n    );\n    const CellType = getCellRenderer(field, cellOptions);\n\n    const wrappingDisabled = wrapFallback?.disabledFields.has(displayName) ?? false;\n    const fieldWarnings: TableWarning[] = [];\n    if (wrappingDisabled) {\n      fieldWarnings.push({\n        id: 'wrapping-disabled',\n        message: t(\n          'grafana-ui.table.wrapping-disabled-warning',\n          'Text wrapping is disabled for this column because a value is too long. Use Inspect value to view the full content.'\n        ),\n      });\n    }\n    const cellInspect = wrappingDisabled || isCellInspectEnabled(field);\n    const showFilters = Boolean(field.config.filterable && onCellFilterAdded != null);\n    const showAssistant = Boolean(tableRefreshEnabled && onCellAddToAssistant != null);\n    const columnCellMenuOptions = getCellMenuOptions({ cellInspect, showFilters, hasAssistantAction: showAssistant });\n    const isTextCell = CellType === AutoCellRenderer || rendersAsJson(field, cellType);\n    const width = widths[i];\n    const contentWidth =\n      width -\n      CELL_HORIZONTAL_CHROME -\n      (i === 0 ? firstColumnExtraPadding : 0) -\n      (i === fields.length - 1 ? lastColumnExtraPadding : 0);\n\n    // helps us avoid string cx and emotion per-cell\n    const cellActionClassName = clsx('table-cell-actions', getCellActionStyles(theme, textAlign, tableRefreshEnabled));\n\n    const shouldOverflow =\n      !wrappingDisabled &&\n      !IS_SAFARI_26 &&\n      typeof rowHeight !== 'string' &&\n      (shouldTextOverflow(field) || Boolean(maxRowHeight));\n    const textWidthCache = new Map<string, number>();\n    const textWrap = !wrappingDisabled && (typeof rowHeight === 'string' || shouldTextWrap(field));\n    const canBeColorized = canFieldBeColorized(cellType, applyToRowBgFn);\n    const fieldAppliesToRow =\n      cellOptions.type === TableCellDisplayMode.ColorBackground && cellOptions.applyToRow === true;\n    const cellStyleOptions: TableCellStyleOptions = {\n      tableRefreshEnabled,\n      textAlign,\n      textWrap,\n      shouldOverflow,\n      hoverOverflow,\n      maxHeight: maxRowHeight,\n    };\n\n    const defaultCellStyles = getDefaultCellStyles(theme, cellStyleOptions);\n    const cellSpecificStyles = getCellSpecificStyles(cellType, field, theme, cellStyleOptions);\n    const linkStyles = getLinkStyles(theme, canBeColorized);\n    const cellParentStyles = clsx(defaultCellStyles, linkStyles);\n    const maxHeightClassName = maxRowHeight ? getMaxHeightCellStyles(theme, cellStyleOptions) : undefined;\n    const styleFieldValue = field.config.custom?.styleField;\n    const styleField = styleFieldValue ? frame.fields.find(predicateByName(styleFieldValue)) : undefined;\n    const styleFieldName = styleField ? getDisplayName(styleField) : undefined;\n    const hasValidStyleField = Boolean(styleFieldName);\n\n    // TODO: in future extend this to ensure a non-classic color scheme is set with AutoCell\n\n    // this fires first\n    const renderCellRoot: CellRootRenderer = (\n      key: Key,\n      props: CellRendererProps<TableRow, TableSummaryRow>\n    ): ReactNode => {\n      const rowIdx = props.row.__index;\n\n      // meh, this should be cached by the renderRow() call?\n      if (rowIdx !== lastRowIdx) {\n        lastRowIdx = rowIdx;\n\n        rowCellStyle.color = undefined;\n        rowCellStyle.background = undefined;\n\n        // generate shared styles for whole row\n        if (applyToRowBgFn != null) {\n          rowCellStyle = { ...rowCellStyle, ...applyToRowBgFn(rowIdx) };\n        }\n      }\n\n      let style: CSSProperties = { ...rowCellStyle };\n      // When this field itself opts into applyToRow, it defers to the shared row color\n      // (chosen from the first such field) rather than painting its own color over it.\n      if (canBeColorized && !fieldAppliesToRow) {\n        const value = props.row[props.column.key];\n        const displayValue = field.display!(value); // this fires here to get colors, then again to get rendered value?\n        const cellColorStyles = getCellColorInlineStyles(cellOptions, displayValue, applyToRowBgFn != null);\n        Object.assign(style, cellColorStyles);\n      }\n      if (hasValidStyleField) {\n        style = { ...style, ...parseStyleJson(props.row[styleFieldName!]) };\n      }\n      const value = props.row[props.column.key];\n      const formattedValue = shouldOverflow ? formattedValueToString(field.display!(value)) : '';\n      const oversized = isTextCell && formattedValue.length > TABLE.MAX_WRAP_TEXT_LENGTH;\n      let measuredWidth = textWidthCache.get(formattedValue);\n      if (!oversized && measuredWidth == null && formattedValue !== '') {\n        measuredWidth = typographyCtx.measureWidth(formattedValue);\n        textWidthCache.set(formattedValue, measuredWidth);\n      }\n      const hasOverflow =\n        shouldOverflow &&\n        !oversized &&\n        (maxRowHeight != null || rendersAsJson(field, cellType) || (measuredWidth ?? 0) > contentWidth);\n\n      return (\n        <Cell\n          key={key}\n          {...props}\n          className={clsx(\n            props.className,\n            cellParentStyles,\n            hasOverflow && OVERFLOW_CELL_CLASS,\n            cellSpecificStyles != null && maxRowHeight == null ? cellSpecificStyles : ''\n          )}\n          style={style}\n        />\n      );\n    };\n\n    result.cellRootRenderers[displayName] = renderCellRoot;\n\n    let wrapCellContent: (\n      props: RenderCellProps<TableRow, TableSummaryRow>,\n      content: JSX.Element,\n      warnings: TableWarning[]\n    ) => JSX.Element = (_props, content) => content;\n\n    const renderCellContent = (props: RenderCellProps<TableRow, TableSummaryRow>): JSX.Element => {\n      const rowIdx = props.row.__index;\n      const value = props.row[props.column.key];\n      // Only rendered text cells need this check; fixed-height tables still avoid scanning values.\n      const oversized =\n        isTextCell &&\n        (!cellInspect || (hoverOverflow && shouldOverflow)) &&\n        (field.display ? formattedValueToString(field.display(value)) : String(value ?? '')).length >\n          TABLE.MAX_WRAP_TEXT_LENGTH;\n      const inspect = cellInspect || oversized;\n      const cellMenuOptions =\n        inspect === cellInspect\n          ? columnCellMenuOptions\n          : getCellMenuOptions({ cellInspect: inspect, showFilters, hasAssistantAction: showAssistant });\n      const cellWarnings: TableWarning[] = [];\n      if (hoverOverflow && shouldOverflow && oversized) {\n        cellWarnings.push({\n          id: 'hover-expansion-disabled',\n          message: t(\n            'grafana-ui.table.hover-expansion-disabled-warning',\n            'Content is too long to expand on hover. Use Inspect value to view the full content.'\n          ),\n        });\n      }\n      // TODO: it would be nice to get rid of passing height down as a prop. but this value\n      // is cached so the cost of calling for every cell is low.\n      // NOTE: some cell types still require a height to be passed down, so that's why string-based\n      // cell types are going to just pass down the max cell height as a numeric height for those cells.\n      const height = rowHeightFn(props.row);\n\n      const actionProps = tableRefreshEnabled\n        ? {\n            tableRefreshEnabled: true as const,\n            groups: cellMenuOptions,\n            onAddToAssistant: showAssistant ? () => onCellAddToAssistant?.(frame, field, rowIdx) : undefined,\n          }\n        : { tableRefreshEnabled: false as const, cellInspect: inspect, showFilters };\n\n      let cellResult = (\n        <>\n          <CellType\n            cellOptions={cellOptions}\n            frame={frame}\n            field={field}\n            height={height}\n            rowIdx={rowIdx}\n            theme={theme}\n            value={value}\n            width={contentWidth}\n            timeRange={timeRange}\n            cellInspect={inspect}\n            showFilters={showFilters}\n            getActions={getCellActions}\n            disableSanitizeHtml={disableSanitizeHtml}\n            jsonSyntaxHighlightingEnabled={jsonSyntaxHighlightingEnabled}\n            tableRefreshEnabled={tableRefreshEnabled}\n            getTextColorForBackground={getTextColorForBackground}\n          />\n          {cellMenuOptions.length > 0 && (\n            <TableCellActions\n              {...actionProps}\n              field={field}\n              value={value}\n              displayName={displayName}\n              className={cellActionClassName}\n              setInspectCell={setInspectCell}\n              onCellFilterAdded={onCellFilterAdded}\n            />\n          )}\n        </>\n      );\n\n      if (maxRowHeight != null) {\n        cellResult = <div className={clsx(maxHeightClassName, cellSpecificStyles)}>{cellResult}</div>;\n      }\n\n      return wrapCellContent(props, cellResult, cellWarnings);\n    };\n\n    const tooltipFieldName = field.config.custom?.tooltip?.field;\n    if (tooltipFieldName || (isTextCell && hoverOverflow && shouldOverflow)) {\n      // The tooltip field is usually hidden, so it's not part of `preparedFields`. Run it through the\n      // same preparation so the tooltip formats its value exactly like a rendered cell would.\n      const rawTooltipField = tooltipFieldName ? frame.fields.find(predicateByName(tooltipFieldName)) : undefined;\n      const tooltipField = rawTooltipField ? prepareFieldsForDisplay([rawTooltipField], theme)[0] : field;\n      const tooltipDisplayName = getDisplayName(tooltipField);\n      const tooltipCellOptions = getCellOptions(tooltipField);\n      const tooltipFieldRenderer = getCellRenderer(tooltipField, tooltipCellOptions);\n\n      const tooltipCellStyleOptions = {\n        tableRefreshEnabled,\n        textAlign: getAlignment(tooltipField),\n        // tooltips are free-floating overlays that should reveal the full value, so we\n        // always wrap their content and never inherit the per-row cell-height clamp\n        // (which would line-clamp/cut off the content).\n        textWrap: true,\n        shouldOverflow: false,\n        hoverOverflow: true,\n      } satisfies TableCellStyleOptions;\n      const tooltipCanBeColorized = canFieldBeColorized(tooltipCellOptions.type, applyToRowBgFn);\n      const tooltipDefaultStyles = getDefaultCellStyles(theme, tooltipCellStyleOptions);\n      const tooltipSpecificStyles = getCellSpecificStyles(\n        tooltipCellOptions.type,\n        tooltipField,\n        theme,\n        tooltipCellStyleOptions\n      );\n      const tooltipLinkStyles = getLinkStyles(theme, tooltipCanBeColorized);\n      const tooltipClasses = getTooltipStyles(theme, textAlign);\n\n      const placement = field.config.custom?.tooltip?.placement ?? TableCellTooltipPlacement.Auto;\n      const tooltipWidth =\n        placement === TableCellTooltipPlacement.Left || placement === TableCellTooltipPlacement.Right\n          ? tooltipField.config.custom?.width\n          : width;\n\n      const tooltipProps = {\n        showFieldContent: Boolean(rawTooltipField),\n        cellOptions: tooltipCellOptions,\n        classes: tooltipClasses,\n        className: clsx(tooltipClasses.tooltipContent, tooltipDefaultStyles, tooltipSpecificStyles, tooltipLinkStyles),\n        data: frame,\n        disableSanitizeHtml,\n        jsonSyntaxHighlightingEnabled,\n        tableRefreshEnabled,\n        field: tooltipField,\n        getActions: getCellActions,\n        getTextColorForBackground,\n        gridRef,\n        placement,\n        renderer: tooltipFieldRenderer,\n        theme,\n        width: tooltipWidth,\n      } satisfies Partial<React.ComponentProps<typeof TableCellTooltip>>;\n\n      wrapCellContent = (props, content, warnings): JSX.Element => {\n        if (!rawTooltipField && warnings.length === 0) {\n          return content;\n        }\n        // cached so we don't care about multiple calls.\n        const tooltipHeight = rowHeightFn(props.row);\n        let tooltipStyle: CSSProperties = { ...rowCellStyle };\n        if (tooltipCanBeColorized) {\n          const tooltipDisplayValue = tooltipField.display!(props.row[tooltipDisplayName]);\n          const tooltipCellColorStyles = getCellColorInlineStyles(\n            tooltipCellOptions,\n            tooltipDisplayValue,\n            applyToRowBgFn != null\n          );\n          Object.assign(tooltipStyle, tooltipCellColorStyles);\n        }\n\n        return (\n          <TableCellTooltip\n            {...tooltipProps}\n            warnings={warnings}\n            height={tooltipHeight}\n            rowIdx={props.row.__index}\n            style={tooltipStyle}\n          >\n            {content}\n          </TableCellTooltip>\n        );\n      };\n    }\n\n    result.columns.push({\n      field,\n      key: displayName,\n      name: displayName,\n      width,\n      headerCellClass,\n      frozen: Math.min(frozenColumns, numFrozenColsFullyInView) > i,\n      resizable: field.config.custom?.resizable,\n      sortable: isSortableField(field),\n      draggable: reorderable,\n      renderCell: renderCellContent,\n      renderHeaderCell: ({ column, sortDirection }) => (\n        <HeaderCell\n          warnings={fieldWarnings}\n          column={column}\n          rows={rawRows}\n          field={field}\n          filter={filter}\n          setFilter={setFilter}\n          disableKeyboardEvents={disableKeyboardEvents}\n          direction={sortDirection}\n          showTypeIcons={showTypeIcons}\n          parentIndex={parentIndex}\n          crossFilterRows={crossFilterRows}\n          crossFilterTailRows={crossFilterTailRows}\n          tableRefreshEnabled={tableRefreshEnabled}\n          hasColumnSidebar={hasColumnSidebar}\n          onHideColumn={onHideColumn ? () => onHideColumn(displayName) : undefined}\n          canHideColumn={canHideColumn}\n          onOpenColumnPanel={onOpenColumnPanel}\n          onAddToAssistant={onFieldAddToAssistant ? () => onFieldAddToAssistant(frame, field) : undefined}\n          selectFirstCell={() => {\n            gridRef.current?.setActivePosition({ rowIdx: 0, idx: 0 });\n          }}\n        />\n      ),\n      renderSummaryCell: () => (\n        <SummaryCell\n          rows={visibleRows}\n          footers={fieldFooters}\n          field={field}\n          colIdx={i}\n          textAlign={getSummaryCellTextAlign(textAlign, cellType)}\n          rowLabel={isFieldUniformFooter && i === 0}\n          hideLabel={isFieldUniformFooter && i !== 0}\n        />\n      ),\n    });\n  }\n\n  return result;\n}\n\n/**\n * @internal\n * Memoized factory for the per-call `fromFields` function consumed by TableFlat / TableNested.\n * When `nestedRows` is provided, the filter result is resolved per-call from the parent index;\n * otherwise the top-level `filterResult` is used directly.\n */\nexport function useColumnBuilderFromFields(\n  filterResult: ApplyFilterResult,\n  config: ColumnBuildConfig,\n  nestedRows?: NestedRowEntry[]\n): FromFieldsFn {\n  return useCallback(\n    (fields, widths, frame, rawRows, visibleRows, lastColumnExtraPadding = 0) => {\n      const parentIndex = visibleRows[0]?.__parentIndex;\n      const resolvedFilterResult =\n        parentIndex == null || nestedRows == null ? filterResult : nestedRows[parentIndex].filterResult;\n      return buildColumnsFromFields(fields, widths, frame, rawRows, visibleRows, resolvedFilterResult, {\n        ...config,\n        wrapFallback: rawRows[0]?.__parentIndex != null ? config.nestedWrapFallback : config.wrapFallback,\n        lastColumnExtraPadding,\n      });\n    },\n    [filterResult, nestedRows, config]\n  );\n}\n"],"names":["value","_a"],"mappings":";;;;;;;;;;;;;;;;;;AAwGO,SAAS,eAAA,CACd,MAAA,EACA,YAAA,EACA,YAAA,EACA,uBACA,YAAA,EAC2E;AAC3E,EAAA,OAAO,OAAA;A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