@economic/taco 2.26.7 → 2.26.9
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/esm/index.css +4 -0
- package/dist/esm/packages/taco/src/components/Report/Report.js +11 -1
- package/dist/esm/packages/taco/src/components/Report/Report.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +11 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/DisplayCell.js +28 -4
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/DisplayCell.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js +17 -10
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +2 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
- package/dist/index.css +4 -0
- package/dist/primitives/Table/Core/components/Columns/Cell/BuiltIns/DisplayCell.d.ts +1 -1
- package/dist/primitives/Table/useTableManager/useTableManager.d.ts +2 -1
- package/dist/taco.cjs.development.js +68 -17
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +2 -2
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"setup.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/util/setup.ts"],"sourcesContent":["import React from 'react';\nimport {\n createColumnHelper,\n getExpandedRowModel,\n getFilteredRowModel,\n getGroupedRowModel,\n getSortedRowModel,\n TableOptions as ReactTableOptions,\n Row as ReactTableRow,\n Column as ReactTableColumn,\n ColumnDef as ReactTableColumnDef,\n ColumnPinningState as ReactTableColumnPinningState,\n ColumnSizingState as ReactTableColumnSizingState,\n ColumnSort as ReactTableColumnSort,\n TableState as ReactTableState,\n VisibilityState as ReactTableVisibilityState,\n} from '@tanstack/react-table';\nimport { useTableManagerInternalColumns, useTableManagerInternalColumn } from '../types';\nimport { TableColumnProps, TableFeatureProps, TableGroupProps, TableProps, TableSettings } from '../../types';\nimport { getSortingFn } from './sorting';\nimport { ensureOrdering, freezeUptoExternalColumn, getCellMinWidth, unfreezeAllExternalColumns } from './columns';\nimport { columnFilterFn, globalFilterFn } from './filtering';\n\n// mapping children to react-table columns\nfunction processChildren<TType>(\n child: React.ReactChild | React.ReactFragment | React.ReactPortal,\n columns: ReactTableColumnDef<TType>[],\n defaultSizing: ReactTableColumnSizingState,\n defaultSorting: ReactTableColumnSort[],\n defaultVisibility: ReactTableVisibilityState,\n settings: TableSettings,\n defaultRowGroupColumnId?: keyof TType\n): ReactTableColumnDef<TType>[] {\n const columnHelper = createColumnHelper<TType>();\n\n if (React.isValidElement<TableGroupProps>(child) && child.props.children) {\n const { children, id, header } = child.props;\n\n columns.push(\n columnHelper.group({\n id,\n header,\n columns: React.Children.toArray(children).reduce(\n (columns: ReactTableColumnDef<TType>[], child) =>\n processChildren<TType>(\n child,\n columns,\n defaultSizing,\n defaultSorting,\n defaultVisibility,\n settings,\n defaultRowGroupColumnId\n ),\n []\n ),\n // we don't want to let column groups be grouped/aggregrated\n enableGrouping: false,\n })\n );\n } else if (React.isValidElement<TableColumnProps<TType>>(child) && (child.props.accessor || child.props.id)) {\n const {\n id,\n accessor: accessorKey = id,\n // renderers\n renderer,\n aggregate,\n footer,\n header,\n // options\n aggregationFn,\n defaultHidden,\n defaultWidth,\n enableFiltering: enableColumnFilter = true,\n enableGrouping = false,\n enableHiding = true,\n enableOrdering = true,\n enablePrinting = true,\n enableResizing = true,\n enableSearch: enableGlobalFilter = true,\n enableSorting = true,\n enableTruncate = false,\n minWidth: minSize = getCellMinWidth(settings.fontSize),\n sort,\n sortFn,\n ...meta\n } = child.props;\n\n if (defaultHidden && enableHiding) {\n defaultVisibility[id] = false;\n }\n\n if (defaultWidth) {\n defaultSizing[id] = defaultWidth as any;\n }\n\n if (child.props.sort !== undefined) {\n defaultSorting.push({\n id,\n desc: sort === 'desc',\n });\n }\n\n const isGrouped = defaultRowGroupColumnId === id;\n\n const column: ReactTableColumnDef<TType, any> = {\n id,\n accessorKey,\n header: header,\n // features\n enableColumnFilter,\n enableGlobalFilter,\n enableGrouping,\n enableHiding: isGrouped ? false : enableHiding,\n enableResizing,\n enableSorting,\n // config - sizing\n minSize,\n // meta\n meta: {\n ...(meta as any),\n defaultWidth,\n enableOrdering: isGrouped ? false : enableOrdering,\n enablePrinting,\n enableTruncate,\n header,\n },\n };\n\n // renderers\n if (typeof renderer === 'function') {\n column.cell = info => renderer(info.getValue(), info.row.original);\n }\n\n if (typeof footer === 'function') {\n column.footer = info => footer(info.table.getRowModel().rows.map(row => row.original[id]));\n }\n\n // config - filtering\n if (enableColumnFilter) {\n column.filterFn = 'tacoFilter' as any;\n }\n\n // config - grouping/aggregation\n if (enableGrouping) {\n column.aggregationFn = aggregationFn;\n\n if (typeof aggregate === 'function') {\n column.aggregatedCell = info => aggregate(info.getValue(), info.row.original);\n }\n }\n\n // config - sorting\n if (enableSorting) {\n column.sortingFn = getSortingFn<TType>(child.props.dataType, sortFn);\n column.sortDescFirst = false;\n column.sortUndefined = 1;\n }\n\n columns.push(column);\n }\n\n return columns;\n}\n\nfunction createInternalColumn<TType = unknown>(\n id: string,\n column: useTableManagerInternalColumn<TType>,\n defaultSizing: ReactTableColumnSizingState\n) {\n if (column.size) {\n defaultSizing[id] = column.size;\n }\n\n return {\n id,\n accessorKey: id,\n header: column.header,\n cell: column.renderer,\n // features\n enableColumnFilter: false,\n enableGlobalFilter: false,\n enableGrouping: false,\n enableHiding: false,\n enableResizing: false,\n enableSorting: false,\n // config - sizing\n size: column.size,\n minSize: column.size,\n // meta\n meta: {\n ...(column.meta as any),\n enableOrdering: false,\n enablePrinting: false,\n enableTruncate: false,\n },\n } as ReactTableColumnDef<TType, any>;\n}\n\nexport function mapTableChildrenToColumns<TType = unknown>(\n props: TableProps<TType>,\n settings: TableSettings,\n options: TableFeatureProps,\n internalColumns?: useTableManagerInternalColumns<TType>\n) {\n const { children, defaultRowGroupColumnId } = props;\n const defaultSizing: ReactTableColumnSizingState = {};\n const defaultSorting: ReactTableColumnSort[] = [];\n const defaultVisibility: ReactTableVisibilityState = {};\n\n const columns = React.Children.toArray(children).reduce(\n (columns: ReactTableColumnDef<TType>[], child) =>\n processChildren<TType>(\n child,\n columns,\n defaultSizing,\n defaultSorting,\n defaultVisibility,\n settings,\n defaultRowGroupColumnId\n ),\n\n []\n );\n\n if (internalColumns) {\n if (options.enableRowExpansion && props.rowExpansionRenderer && internalColumns.rowExpansion) {\n const column = createInternalColumn<TType>('__expansion', internalColumns.rowExpansion, defaultSizing);\n columns.unshift(column);\n }\n\n if ((options.enableRowSelection || options.enableRowSelectionSingle) && internalColumns.rowSelection) {\n const column = createInternalColumn<TType>('__select', internalColumns.rowSelection, defaultSizing);\n columns.unshift(column);\n }\n\n if (options.enableRowActions && props.rowActions?.length && internalColumns.rowActions) {\n const column = createInternalColumn<TType>('__actions', internalColumns.rowActions, defaultSizing);\n columns.push(column);\n }\n\n if (options.enableRowDrag && props.onRowDrag && internalColumns.rowDrag) {\n const column = createInternalColumn<TType>('__drag', internalColumns.rowDrag, defaultSizing);\n columns.unshift(column);\n }\n }\n\n return { columns, defaultSizing, defaultSorting, defaultVisibility };\n}\n\nexport function configureReactTableOptions<TType = unknown>(options: TableFeatureProps, props: TableProps<TType>) {\n const enableRowSelection = options.enableRowSelection || options.enableRowSelectionSingle;\n const tableOptions: Partial<ReactTableOptions<TType>> = {\n defaultColumn: {\n enableColumnFilter: options.enableFiltering || true,\n enableGrouping: false,\n enableHiding: options.enableColumnHiding || true,\n enableResizing: options.enableColumnResizing || true,\n enableGlobalFilter: options.enableSearch || true,\n enableSorting: options.enableSorting || true,\n minSize: 1,\n // the default is 150, which is a bit random\n size: 1,\n },\n enableColumnFilters: options.enableFiltering ?? false,\n enableColumnResizing: options.enableColumnResizing ?? false,\n enableExpanding: options.enableRowExpansion ?? false,\n enableGrouping: true, // users can't customise row grouping, so it can just be always enabled and left to the defaultRowGroupColumnId prop\n enableHiding: options.enableColumnHiding ?? false,\n enablePinning: options.enableColumnFreezing ?? false,\n enableRowSelection: enableRowSelection ?? false,\n enableMultiRowSelection: options.enableRowSelectionSingle === true ? false : enableRowSelection,\n enableSorting: options.enableSorting ?? false,\n // models for default features\n getExpandedRowModel: getExpandedRowModel<TType>(),\n getGroupedRowModel: getGroupedRowModel<TType>(),\n groupedColumnMode: false,\n };\n\n if (tableOptions.enableColumnResizing) {\n tableOptions.columnResizeMode = 'onChange';\n }\n\n if (tableOptions.enableColumnFilters) {\n // enter controlled filter mode (controlled could be local state, but usually the server)\n if (props.onChangeFilter) {\n // tableOptions.manualFiltering = true;\n // we don't set it because it breaks global filtering (used for search, which is fully client side)\n //\n // tableOptions.onColumnFiltersChange = ...\n // we don't set this because it expects state to be maintained externally, and we don't want\n // consumers to control state outside the table. instead we have a listener that calls onFilter\n } else {\n tableOptions.getFilteredRowModel = getFilteredRowModel<TType>();\n tableOptions.filterFns = {\n tacoFilter: (row: ReactTableRow<TType>, columnId: string, filter: any) =>\n columnFilterFn(row.getValue(columnId), filter),\n };\n }\n }\n\n if (options.enableSearch) {\n // always set these because enableGlobalFilter can be toggled on and off by the user\n tableOptions.getFilteredRowModel = getFilteredRowModel<TType>();\n tableOptions.globalFilterFn = globalFilterFn;\n tableOptions.getColumnCanGlobalFilter = (column: ReactTableColumn<TType>) => column.columnDef.meta?.enableSearch ?? true;\n\n // enter controlled search mode (controlled could be local state, but usually the server)\n if (props.onChangeSearch) {\n // tableOptions.manualFiltering = true;\n // we don't set this because controlled search is not currently supported, search is always client side\n //\n // tableOptions.onGlobalFilterChange = ...\n // we don't set this because it expects state to be maintained externally, and we don't want\n // consumers to control state outside the table. instead we have a listener that calls onSearch.\n //\n // we also don't always filter when searching, we have the highlight functionality as the default\n // and filtering can be toggled by the user\n }\n }\n\n if (tableOptions.enableSorting) {\n // enter controlled sort mode (controlled could be local state, but usually the server)\n if (props.onChangeSort) {\n tableOptions.manualSorting = true;\n\n // tableOptions.onSortingChange = ...\n // we don't set this because it expects state to be maintained externally, and we don't want\n // consumers to control state outside the table. instead we have a listener that calls onSort\n } else {\n tableOptions.getSortedRowModel = getSortedRowModel();\n }\n }\n\n return tableOptions;\n}\n\nexport function useReactTableInitialState<TType = unknown>(\n props: TableProps<TType>,\n columns: ReactTableColumnDef<TType>[],\n persistedSettings: TableSettings,\n defaults: {\n defaultSizing: ReactTableColumnSizingState;\n defaultSorting: ReactTableColumnSort[];\n defaultVisibility: ReactTableVisibilityState;\n }\n): Partial<ReactTableState> {\n return React.useMemo(() => {\n const ignoreNotDefinedColumns = column => columns.find(definedColumn => definedColumn.id === column.id);\n\n const columnOrder = ensureOrdering<TType>(columns, persistedSettings.columnOrder ?? props.defaultSettings?.columnOrder);\n\n const columnPinning: ReactTableColumnPinningState =\n persistedSettings.columnPinning ?? props.defaultSettings?.columnPinning ?? {};\n\n // ensure internal columns are pinned\n if (!columnPinning?.left?.length) {\n if (props.defaultColumnFreezingIndex) {\n columnPinning.left = freezeUptoExternalColumn(props.defaultColumnFreezingIndex, columnOrder);\n } else {\n columnPinning.left = unfreezeAllExternalColumns(columnOrder);\n }\n }\n\n const state: Partial<ReactTableState> = {\n columnFilters: persistedSettings.columnFilters ?? props.defaultSettings?.columnFilters ?? [],\n columnOrder,\n columnPinning,\n columnSizing: persistedSettings.columnSizing ?? props.defaultSettings?.columnSizing ?? defaults.defaultSizing ?? {},\n columnVisibility:\n persistedSettings.columnVisibility ?? props.defaultSettings?.columnVisibility ?? defaults.defaultVisibility ?? {},\n globalFilter: persistedSettings.searchQuery ?? props.defaultSettings?.searchQuery,\n sorting: persistedSettings.sorting\n ? persistedSettings.sorting.filter(ignoreNotDefinedColumns)\n : props.defaultSettings?.sorting ?? defaults.defaultSorting,\n };\n\n if (persistedSettings.grouping?.length ?? props.defaultSettings?.grouping?.length ?? props.defaultRowGroupColumnId) {\n state.grouping = [props.defaultRowGroupColumnId as string];\n // row groups should (all) always be expanded by default\n state.expanded = true;\n }\n\n return state;\n }, []);\n}\n"],"names":["processChildren","child","columns","defaultSizing","defaultSorting","defaultVisibility","settings","defaultRowGroupColumnId","columnHelper","createColumnHelper","React","isValidElement","props","children","id","header","push","group","Children","toArray","reduce","enableGrouping","accessor","accessorKey","renderer","aggregate","footer","aggregationFn","defaultHidden","defaultWidth","enableFiltering","enableColumnFilter","enableHiding","enableOrdering","enablePrinting","enableResizing","enableSearch","enableGlobalFilter","enableSorting","enableTruncate","minWidth","minSize","getCellMinWidth","fontSize","sort","sortFn","meta","undefined","desc","isGrouped","column","cell","info","getValue","row","original","table","getRowModel","rows","map","filterFn","aggregatedCell","sortingFn","getSortingFn","dataType","sortDescFirst","sortUndefined","createInternalColumn","size","mapTableChildrenToColumns","options","internalColumns","_props$rowActions","enableRowExpansion","rowExpansionRenderer","rowExpansion","unshift","enableRowSelection","enableRowSelectionSingle","rowSelection","enableRowActions","rowActions","length","enableRowDrag","onRowDrag","rowDrag","configureReactTableOptions","tableOptions","defaultColumn","enableColumnHiding","enableColumnResizing","enableColumnFilters","_options$enableFilter","_options$enableColumn","enableExpanding","_options$enableRowExp","_options$enableColumn2","enablePinning","_options$enableColumn3","enableColumnFreezing","enableMultiRowSelection","_options$enableSortin","getExpandedRowModel","getGroupedRowModel","groupedColumnMode","columnResizeMode","onChangeFilter","getFilteredRowModel","filterFns","tacoFilter","columnId","filter","columnFilterFn","globalFilterFn","getColumnCanGlobalFilter","_column$columnDef$met","_column$columnDef$met2","columnDef","onChangeSort","manualSorting","getSortedRowModel","useReactTableInitialState","persistedSettings","defaults","useMemo","ignoreNotDefinedColumns","find","definedColumn","columnOrder","ensureOrdering","_persistedSettings$co","_props$defaultSetting","defaultSettings","columnPinning","_ref","_persistedSettings$co2","_props$defaultSetting2","_columnPinning$left","left","defaultColumnFreezingIndex","freezeUptoExternalColumn","unfreezeAllExternalColumns","state","columnFilters","_ref2","_persistedSettings$co3","_props$defaultSetting3","columnSizing","_ref3","_ref4","_persistedSettings$co4","_props$defaultSetting4","columnVisibility","_ref5","_ref6","_persistedSettings$co5","_props$defaultSetting5","globalFilter","_persistedSettings$se","searchQuery","_props$defaultSetting6","sorting","_props$defaultSetting7","_props$defaultSetting8","_ref7","_persistedSettings$gr","_persistedSettings$gr2","grouping","_props$defaultSetting9","_props$defaultSetting10","expanded"],"mappings":";;;;;;AAuBA;AACA,SAASA,eAAeA,CACpBC,KAAiE,EACjEC,OAAqC,EACrCC,aAA0C,EAC1CC,cAAsC,EACtCC,iBAA4C,EAC5CC,QAAuB,EACvBC,uBAAqC;EAErC,MAAMC,YAAY,GAAGC,kBAAkB,EAAS;EAEhD,kBAAIC,cAAK,CAACC,cAAc,CAAkBV,KAAK,CAAC,IAAIA,KAAK,CAACW,KAAK,CAACC,QAAQ,EAAE;IACtE,MAAM;MAAEA,QAAQ;MAAEC,EAAE;MAAEC;KAAQ,GAAGd,KAAK,CAACW,KAAK;IAE5CV,OAAO,CAACc,IAAI,CACRR,YAAY,CAACS,KAAK,CAAC;MACfH,EAAE;MACFC,MAAM;MACNb,OAAO,EAAEQ,cAAK,CAACQ,QAAQ,CAACC,OAAO,CAACN,QAAQ,CAAC,CAACO,MAAM,CAC5C,CAAClB,OAAqC,EAAED,KAAK,KACzCD,eAAe,CACXC,KAAK,EACLC,OAAO,EACPC,aAAa,EACbC,cAAc,EACdC,iBAAiB,EACjBC,QAAQ,EACRC,uBAAuB,CAC1B,EACL,EAAE,CACL;;MAEDc,cAAc,EAAE;KACnB,CAAC,CACL;GACJ,MAAM,kBAAIX,cA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,cAAAE,uBAAA,uBAA/BA,uBAAA,CAAiCvF,MAAM,cAAAkF,KAAA,cAAAA,KAAA,GAAIxJ,KAAK,CAACL,uBAAuB,EAAE;MAChHuI,KAAK,CAACyB,QAAQ,GAAG,CAAC3J,KAAK,CAACL,uBAAiC,CAAC;;MAE1DuI,KAAK,CAAC4B,QAAQ,GAAG,IAAI;;IAGzB,OAAO5B,KAAK;GACf,EAAE,EAAE,CAAC;AACV;;;;"}
|
1
|
+
{"version":3,"file":"setup.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/util/setup.ts"],"sourcesContent":["import React from 'react';\nimport {\n createColumnHelper,\n getExpandedRowModel,\n getFilteredRowModel,\n getGroupedRowModel,\n getSortedRowModel,\n TableOptions as ReactTableOptions,\n Row as ReactTableRow,\n Column as ReactTableColumn,\n ColumnDef as ReactTableColumnDef,\n ColumnPinningState as ReactTableColumnPinningState,\n ColumnSizingState as ReactTableColumnSizingState,\n ColumnSort as ReactTableColumnSort,\n TableState as ReactTableState,\n VisibilityState as ReactTableVisibilityState,\n} from '@tanstack/react-table';\nimport { useTableManagerInternalColumns, useTableManagerInternalColumn } from '../types';\nimport { TableColumnProps, TableFeatureProps, TableGroupProps, TableProps, TableSettings } from '../../types';\nimport { getSortingFn } from './sorting';\nimport { ensureOrdering, freezeUptoExternalColumn, getCellMinWidth, unfreezeAllExternalColumns } from './columns';\nimport { columnFilterFn, globalFilterFn } from './filtering';\n\n// mapping children to react-table columns\nfunction processChildren<TType>(\n child: React.ReactChild | React.ReactFragment | React.ReactPortal,\n columns: ReactTableColumnDef<TType>[],\n defaultSizing: ReactTableColumnSizingState,\n defaultSorting: ReactTableColumnSort[],\n defaultVisibility: ReactTableVisibilityState,\n settings: TableSettings,\n defaultRowGroupColumnId?: keyof TType\n): ReactTableColumnDef<TType>[] {\n const columnHelper = createColumnHelper<TType>();\n\n if (React.isValidElement<TableGroupProps>(child) && child.props.children) {\n const { children, id, header } = child.props;\n\n columns.push(\n columnHelper.group({\n id,\n header,\n columns: React.Children.toArray(children).reduce(\n (columns: ReactTableColumnDef<TType>[], child) =>\n processChildren<TType>(\n child,\n columns,\n defaultSizing,\n defaultSorting,\n defaultVisibility,\n settings,\n defaultRowGroupColumnId\n ),\n []\n ),\n // we don't want to let column groups be grouped/aggregrated\n enableGrouping: false,\n })\n );\n } else if (React.isValidElement<TableColumnProps<TType>>(child) && (child.props.accessor || child.props.id)) {\n const {\n id,\n accessor: accessorKey = id,\n // renderers\n renderer,\n aggregate,\n footer,\n header,\n // options\n aggregationFn,\n defaultHidden,\n defaultWidth,\n enableFiltering: enableColumnFilter = true,\n enableGrouping = false,\n enableHiding = true,\n enableOrdering = true,\n enablePrinting = true,\n enableResizing = true,\n enableSearch: enableGlobalFilter = true,\n enableSorting = true,\n enableTruncate = false,\n minWidth: minSize = getCellMinWidth(settings.fontSize),\n sort,\n sortFn,\n ...meta\n } = child.props;\n\n if (defaultHidden && enableHiding) {\n defaultVisibility[id] = false;\n }\n\n if (defaultWidth) {\n defaultSizing[id] = defaultWidth as any;\n }\n\n if (child.props.sort !== undefined) {\n defaultSorting.push({\n id,\n desc: sort === 'desc',\n });\n }\n\n const isGrouped = defaultRowGroupColumnId === id;\n\n const column: ReactTableColumnDef<TType, any> = {\n id,\n accessorKey,\n header: header,\n // features\n enableColumnFilter,\n enableGlobalFilter,\n enableGrouping,\n enableHiding: isGrouped ? false : enableHiding,\n enableResizing,\n enableSorting,\n // config - sizing\n minSize,\n // meta\n meta: {\n ...(meta as any),\n defaultWidth,\n enableOrdering: isGrouped ? false : enableOrdering,\n enablePrinting,\n enableTruncate,\n header,\n renderer,\n },\n };\n\n // renderers\n if (typeof renderer === 'function') {\n column.cell = info => renderer(info.getValue(), info.row.original);\n }\n\n if (typeof footer === 'function') {\n column.footer = info => footer(info.table.getRowModel().rows.map(row => row.original[id]));\n }\n\n // config - filtering\n if (enableColumnFilter) {\n column.filterFn = 'tacoFilter' as any;\n }\n\n // config - grouping/aggregation\n if (enableGrouping) {\n column.aggregationFn = aggregationFn;\n\n if (typeof aggregate === 'function') {\n column.aggregatedCell = info => aggregate(info.getValue(), info.row.original);\n }\n }\n\n // config - sorting\n if (enableSorting) {\n column.sortingFn = getSortingFn<TType>(child.props.dataType, sortFn);\n column.sortDescFirst = false;\n column.sortUndefined = 1;\n }\n\n columns.push(column);\n }\n\n return columns;\n}\n\nfunction createInternalColumn<TType = unknown>(\n id: string,\n column: useTableManagerInternalColumn<TType>,\n defaultSizing: ReactTableColumnSizingState\n) {\n if (column.size) {\n defaultSizing[id] = column.size;\n }\n\n return {\n id,\n accessorKey: id,\n header: column.header,\n cell: column.renderer,\n // features\n enableColumnFilter: false,\n enableGlobalFilter: false,\n enableGrouping: false,\n enableHiding: false,\n enableResizing: false,\n enableSorting: false,\n // config - sizing\n size: column.size,\n minSize: column.size,\n // meta\n meta: {\n ...(column.meta as any),\n enableOrdering: false,\n enablePrinting: false,\n enableTruncate: false,\n },\n } as ReactTableColumnDef<TType, any>;\n}\n\nexport function mapTableChildrenToColumns<TType = unknown>(\n props: TableProps<TType>,\n settings: TableSettings,\n options: TableFeatureProps,\n internalColumns?: useTableManagerInternalColumns<TType>\n) {\n const { children, defaultRowGroupColumnId } = props;\n const defaultSizing: ReactTableColumnSizingState = {};\n const defaultSorting: ReactTableColumnSort[] = [];\n const defaultVisibility: ReactTableVisibilityState = {};\n\n const columns = React.Children.toArray(children).reduce(\n (columns: ReactTableColumnDef<TType>[], child) =>\n processChildren<TType>(\n child,\n columns,\n defaultSizing,\n defaultSorting,\n defaultVisibility,\n settings,\n defaultRowGroupColumnId\n ),\n\n []\n );\n\n if (internalColumns) {\n if (options.enableRowExpansion && props.rowExpansionRenderer && internalColumns.rowExpansion) {\n const column = createInternalColumn<TType>('__expansion', internalColumns.rowExpansion, defaultSizing);\n columns.unshift(column);\n }\n\n if ((options.enableRowSelection || options.enableRowSelectionSingle) && internalColumns.rowSelection) {\n const column = createInternalColumn<TType>('__select', internalColumns.rowSelection, defaultSizing);\n columns.unshift(column);\n }\n\n if (options.enableRowActions && props.rowActions?.length && internalColumns.rowActions) {\n const column = createInternalColumn<TType>('__actions', internalColumns.rowActions, defaultSizing);\n columns.push(column);\n }\n\n if (options.enableRowDrag && props.onRowDrag && internalColumns.rowDrag) {\n const column = createInternalColumn<TType>('__drag', internalColumns.rowDrag, defaultSizing);\n columns.unshift(column);\n }\n }\n\n return { columns, defaultSizing, defaultSorting, defaultVisibility };\n}\n\nexport function configureReactTableOptions<TType = unknown>(options: TableFeatureProps, props: TableProps<TType>) {\n const enableRowSelection = options.enableRowSelection || options.enableRowSelectionSingle;\n const tableOptions: Partial<ReactTableOptions<TType>> = {\n defaultColumn: {\n enableColumnFilter: options.enableFiltering || true,\n enableGrouping: false,\n enableHiding: options.enableColumnHiding || true,\n enableResizing: options.enableColumnResizing || true,\n enableGlobalFilter: options.enableSearch || true,\n enableSorting: options.enableSorting || true,\n minSize: 1,\n // the default is 150, which is a bit random\n size: 1,\n },\n enableColumnFilters: options.enableFiltering ?? false,\n enableColumnResizing: options.enableColumnResizing ?? false,\n enableExpanding: options.enableRowExpansion ?? false,\n enableGrouping: true, // users can't customise row grouping, so it can just be always enabled and left to the defaultRowGroupColumnId prop\n enableHiding: options.enableColumnHiding ?? false,\n enablePinning: options.enableColumnFreezing ?? false,\n enableRowSelection: enableRowSelection ?? false,\n enableMultiRowSelection: options.enableRowSelectionSingle === true ? false : enableRowSelection,\n enableSorting: options.enableSorting ?? false,\n // models for default features\n getExpandedRowModel: getExpandedRowModel<TType>(),\n getGroupedRowModel: getGroupedRowModel<TType>(),\n groupedColumnMode: false,\n };\n\n if (tableOptions.enableColumnResizing) {\n tableOptions.columnResizeMode = 'onChange';\n }\n\n if (tableOptions.enableColumnFilters) {\n // enter controlled filter mode (controlled could be local state, but usually the server)\n if (props.onChangeFilter) {\n // tableOptions.manualFiltering = true;\n // we don't set it because it breaks global filtering (used for search, which is fully client side)\n //\n // tableOptions.onColumnFiltersChange = ...\n // we don't set this because it expects state to be maintained externally, and we don't want\n // consumers to control state outside the table. instead we have a listener that calls onFilter\n } else {\n tableOptions.getFilteredRowModel = getFilteredRowModel<TType>();\n tableOptions.filterFns = {\n tacoFilter: (row: ReactTableRow<TType>, columnId: string, filter: any) =>\n columnFilterFn(row.getValue(columnId), filter),\n };\n }\n }\n\n if (options.enableSearch) {\n // always set these because enableGlobalFilter can be toggled on and off by the user\n tableOptions.getFilteredRowModel = getFilteredRowModel<TType>();\n tableOptions.globalFilterFn = globalFilterFn;\n tableOptions.getColumnCanGlobalFilter = (column: ReactTableColumn<TType>) => column.columnDef.meta?.enableSearch ?? true;\n\n // enter controlled search mode (controlled could be local state, but usually the server)\n if (props.onChangeSearch) {\n // tableOptions.manualFiltering = true;\n // we don't set this because controlled search is not currently supported, search is always client side\n //\n // tableOptions.onGlobalFilterChange = ...\n // we don't set this because it expects state to be maintained externally, and we don't want\n // consumers to control state outside the table. instead we have a listener that calls onSearch.\n //\n // we also don't always filter when searching, we have the highlight functionality as the default\n // and filtering can be toggled by the user\n }\n }\n\n if (tableOptions.enableSorting) {\n // enter controlled sort mode (controlled could be local state, but usually the server)\n if (props.onChangeSort) {\n tableOptions.manualSorting = true;\n\n // tableOptions.onSortingChange = ...\n // we don't set this because it expects state to be maintained externally, and we don't want\n // consumers to control state outside the table. instead we have a listener that calls onSort\n } else {\n tableOptions.getSortedRowModel = getSortedRowModel();\n }\n }\n\n return tableOptions;\n}\n\nexport function useReactTableInitialState<TType = unknown>(\n props: TableProps<TType>,\n columns: ReactTableColumnDef<TType>[],\n persistedSettings: TableSettings,\n defaults: {\n defaultSizing: ReactTableColumnSizingState;\n defaultSorting: ReactTableColumnSort[];\n defaultVisibility: ReactTableVisibilityState;\n }\n): Partial<ReactTableState> {\n return React.useMemo(() => {\n const ignoreNotDefinedColumns = column => columns.find(definedColumn => definedColumn.id === column.id);\n\n const columnOrder = ensureOrdering<TType>(columns, persistedSettings.columnOrder ?? props.defaultSettings?.columnOrder);\n\n const columnPinning: ReactTableColumnPinningState =\n persistedSettings.columnPinning ?? props.defaultSettings?.columnPinning ?? {};\n\n // ensure internal columns are pinned\n if (!columnPinning?.left?.length) {\n if (props.defaultColumnFreezingIndex) {\n columnPinning.left = freezeUptoExternalColumn(props.defaultColumnFreezingIndex, columnOrder);\n } else {\n columnPinning.left = unfreezeAllExternalColumns(columnOrder);\n }\n }\n\n const state: Partial<ReactTableState> = {\n columnFilters: persistedSettings.columnFilters ?? props.defaultSettings?.columnFilters ?? [],\n columnOrder,\n columnPinning,\n columnSizing: persistedSettings.columnSizing ?? props.defaultSettings?.columnSizing ?? defaults.defaultSizing ?? {},\n columnVisibility:\n persistedSettings.columnVisibility ?? props.defaultSettings?.columnVisibility ?? defaults.defaultVisibility ?? {},\n globalFilter: persistedSettings.searchQuery ?? props.defaultSettings?.searchQuery,\n sorting: persistedSettings.sorting\n ? persistedSettings.sorting.filter(ignoreNotDefinedColumns)\n : props.defaultSettings?.sorting ?? defaults.defaultSorting,\n };\n\n if (persistedSettings.grouping?.length ?? props.defaultSettings?.grouping?.length ?? props.defaultRowGroupColumnId) {\n state.grouping = [props.defaultRowGroupColumnId as string];\n // row groups should (all) always be expanded by default\n state.expanded = true;\n }\n\n return state;\n }, []);\n}\n"],"names":["processChildren","child","columns","defaultSizing","defaultSorting","defaultVisibility","settings","defaultRowGroupColumnId","columnHelper","createColumnHelper","React","isValidElement","props","children","id","header","push","group","Children","toArray","reduce","enableGrouping","accessor","accessorKey","renderer","aggregate","footer","aggregationFn","defaultHidden","defaultWidth","enableFiltering","enableColumnFilter","enableHiding","enableOrdering","enablePrinting","enableResizing","enableSearch","enableGlobalFilter","enableSorting","enableTruncate","minWidth","minSize","getCellMinWidth","fontSize","sort","sortFn","meta","undefined","desc","isGrouped","column","cell","info","getValue","row","original","table","getRowModel","rows","map","filterFn","aggregatedCell","sortingFn","getSortingFn","dataType","sortDescFirst","sortUndefined","createInternalColumn","size","mapTableChildrenToColumns","options","internalColumns","_props$rowActions","enableRowExpansion","rowExpansionRenderer","rowExpansion","unshift","enableRowSelection","enableRowSelectionSingle","rowSelection","enableRowActions","rowActions","length","enableRowDrag","onRowDrag","rowDrag","configureReactTableOptions","tableOptions","defaultColumn","enableColumnHiding","enableColumnResizing","enableColumnFilters","_options$enableFilter","_options$enableColumn","enableExpanding","_options$enableRowExp","_options$enableColumn2","enablePinning","_options$enableColumn3","enableColumnFreezing","enableMultiRowSelection","_options$enableSortin","getExpandedRowModel","getGroupedRowModel","groupedColumnMode","columnResizeMode","onChangeFilter","getFilteredRowModel","filterFns","tacoFilter","columnId","filter","columnFilterFn","globalFilterFn","getColumnCanGlobalFilter","_column$columnDef$met","_column$columnDef$met2","columnDef","onChangeSort","manualSorting","getSortedRowModel","useReactTableInitialState","persistedSettings","defaults","useMemo","ignoreNotDefinedColumns","find","definedColumn","columnOrder","ensureOrdering","_persistedSettings$co","_props$defaultSetting","defaultSettings","columnPinning","_ref","_persistedSettings$co2","_props$defaultSetting2","_columnPinning$left","left","defaultColumnFreezingIndex","freezeUptoExternalColumn","unfreezeAllExternalColumns","state","columnFilters","_ref2","_persistedSettings$co3","_props$defaultSetting3","columnSizing","_ref3","_ref4","_persistedSettings$co4","_props$defaultSetting4","columnVisibility","_ref5","_ref6","_persistedSettings$co5","_props$defaultSetting5","globalFilter","_persistedSettings$se","searchQuery","_props$defaultSetting6","sorting","_props$defaultSetting7","_props$defaultSetting8","_ref7","_persistedSettings$gr","_persistedSettings$gr2","grouping","_props$defaultSetting9","_props$defaultSetting10","expanded"],"mappings":";;;;;;AAuBA;AACA,SAASA,eAAeA,CACpBC,KAAiE,EACjEC,OAAqC,EACrCC,aAA0C,EAC1CC,cAAsC,EACtCC,iBAA4C,EAC5CC,QAAuB,EACvBC,uBAAqC;EAErC,MAAMC,YAAY,GAAGC,kBAAkB,EAAS;EAEhD,kBAAIC,cAAK,CAACC,cAAc,CAAkBV,KAAK,CAAC,IAAIA,KAAK,CAACW,KAAK,CAACC,QAAQ,EAAE;IACtE,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iB,CAACuC,OAAO,CAAClD,MAAM,CAACc,uBAAuB,CAAC,IAAAqC,sBAAA,IAAAC,sBAAA,GACzDvJ,KAAK,CAACwH,eAAe,cAAA+B,sBAAA,uBAArBA,sBAAA,CAAuBF,OAAO,cAAAC,sBAAA,cAAAA,sBAAA,GAAIvC,QAAQ,CAACvH;KACpD;IAED,KAAAgK,KAAA,IAAAC,qBAAA,IAAAC,sBAAA,GAAI5C,iBAAiB,CAAC6C,QAAQ,cAAAD,sBAAA,uBAA1BA,sBAAA,CAA4BpF,MAAM,cAAAmF,qBAAA,cAAAA,qBAAA,IAAAG,sBAAA,GAAI5J,KAAK,CAACwH,eAAe,cAAAoC,sBAAA,wBAAAC,uBAAA,GAArBD,sBAAA,CAAuBD,QAAQ,cAAAE,uBAAA,uBAA/BA,uBAAA,CAAiCvF,MAAM,cAAAkF,KAAA,cAAAA,KAAA,GAAIxJ,KAAK,CAACL,uBAAuB,EAAE;MAChHuI,KAAK,CAACyB,QAAQ,GAAG,CAAC3J,KAAK,CAACL,uBAAiC,CAAC;;MAE1DuI,KAAK,CAAC4B,QAAQ,GAAG,IAAI;;IAGzB,OAAO5B,KAAK;GACf,EAAE,EAAE,CAAC;AACV;;;;"}
|
package/dist/index.css
CHANGED
@@ -635,6 +635,10 @@ table[data-taco^='table'] tr[data-row-dragged-over='true'] td {
|
|
635
635
|
@apply !bg-grey-100;
|
636
636
|
}
|
637
637
|
|
638
|
+
table[data-taco^='table'] tr:hover > td[data-cell-id='__actions'] {
|
639
|
+
@apply sticky;
|
640
|
+
}
|
641
|
+
|
638
642
|
table[data-taco^='table'] th {
|
639
643
|
/* layout */
|
640
644
|
@apply relative flex h-10 items-center justify-start px-[var(--table-cell-padding-x)];
|
@@ -1,3 +1,3 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { TableCellRendererProps } from '../../../../types';
|
3
|
-
export declare
|
3
|
+
export declare function DisplayCell<TType = unknown>(props: TableCellRendererProps<TType>): JSX.Element;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { TableMeta as ReactTableMeta, RowData } from '@tanstack/react-table';
|
2
|
-
import { TableColumnAlignment, TableColumnClassNameHandler, TableColumnDataType, TableColumnMenu, TableColumnRendererControl, TableFilterComparator, TableProps } from '../types';
|
2
|
+
import { TableColumnAlignment, TableColumnClassNameHandler, TableColumnDataType, TableColumnMenu, TableColumnRenderer, TableColumnRendererControl, TableFilterComparator, TableProps } from '../types';
|
3
3
|
import { useTableColumnFreezing } from './features/useTableColumnFreezing';
|
4
4
|
import { useTableColumnOrdering } from './features/useTableColumnOrdering';
|
5
5
|
import { useTableFooter } from './features/useTableFooter';
|
@@ -54,6 +54,7 @@ declare module '@tanstack/table-core' {
|
|
54
54
|
header: string;
|
55
55
|
headerClassName?: string;
|
56
56
|
menu?: TableColumnMenu;
|
57
|
+
renderer?: TableColumnRenderer<TValue, TData>;
|
57
58
|
tooltip?: string;
|
58
59
|
}
|
59
60
|
}
|
@@ -9594,7 +9594,8 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
|
|
9594
9594
|
enableOrdering: isGrouped ? false : enableOrdering,
|
9595
9595
|
enablePrinting,
|
9596
9596
|
enableTruncate,
|
9597
|
-
header
|
9597
|
+
header,
|
9598
|
+
renderer
|
9598
9599
|
}
|
9599
9600
|
};
|
9600
9601
|
// renderers
|
@@ -11490,7 +11491,7 @@ const renderer = {
|
|
11490
11491
|
renderer: Cell,
|
11491
11492
|
meta: {
|
11492
11493
|
align: 'right',
|
11493
|
-
className: /*#__PURE__*/cn('print:opacity-0 !px-0 !pr-1 overflow-hidden [table_&]:group-[[data-row-active="true"]]/row:sticky
|
11494
|
+
className: /*#__PURE__*/cn('print:opacity-0 !px-0 !pr-1 overflow-hidden [table_&]:group-[[data-row-active="true"]]/row:sticky right-0', 'group-[[data-row-active="true"][data-selected="false"]]/row:text-grey-200', 'group-[[data-row-selected="true"]]/row:text-blue-100', 'group-[[data-row-selected="false"]:hover]/row:text-grey-100'),
|
11494
11495
|
// TODO: remove when table3 is migrated, this satisfies the legacy table3 type
|
11495
11496
|
enableSearch: false,
|
11496
11497
|
header: ''
|
@@ -11892,6 +11893,7 @@ function useSearchHighlighting(cell, cellIndex, ref) {
|
|
11892
11893
|
}
|
11893
11894
|
|
11894
11895
|
function GroupedCell(props) {
|
11896
|
+
var _ref, _columnMeta$renderer, _columnMeta$renderer2;
|
11895
11897
|
const {
|
11896
11898
|
cell,
|
11897
11899
|
cellRef,
|
@@ -11899,6 +11901,7 @@ function GroupedCell(props) {
|
|
11899
11901
|
isHighlighted
|
11900
11902
|
} = props;
|
11901
11903
|
const tableMeta = cell.getContext().table.options.meta;
|
11904
|
+
const columnMeta = cell.column.columnDef.meta;
|
11902
11905
|
const attributes = getCellAttributes(cell, index, isHighlighted);
|
11903
11906
|
const {
|
11904
11907
|
isHovered,
|
@@ -11906,25 +11909,31 @@ function GroupedCell(props) {
|
|
11906
11909
|
} = React__default.useContext(RowContext);
|
11907
11910
|
const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;
|
11908
11911
|
const canShowActions = isActiveRow || isHovered && !tableMeta.rowActive.isHoverStatePaused;
|
11912
|
+
const colSpan = cell.row.getVisibleCells().filter(c => !isInternalColumn(c.column.id)).length - 1;
|
11913
|
+
const content = (_ref = (_columnMeta$renderer = (_columnMeta$renderer2 = columnMeta.renderer) === null || _columnMeta$renderer2 === void 0 ? void 0 : _columnMeta$renderer2.call(columnMeta, cell.getValue(), cell.row.original)) !== null && _columnMeta$renderer !== void 0 ? _columnMeta$renderer : cell.getValue()) !== null && _ref !== void 0 ? _ref : null;
|
11914
|
+
const subRows = cell.getContext().row.subRows.map(row => row.original);
|
11909
11915
|
return /*#__PURE__*/React__default.createElement(MemoedGroupedCell, Object.assign({}, attributes, {
|
11910
|
-
cell: cell,
|
11911
|
-
cellRef: cellRef,
|
11912
11916
|
canShowActions: canShowActions,
|
11917
|
+
cellRef: cellRef,
|
11918
|
+
colSpan: colSpan,
|
11913
11919
|
fontSize: tableMeta.fontSize.size,
|
11914
|
-
rowActions: tableMeta.rowGroups.rowActionsForGroup
|
11915
|
-
|
11920
|
+
rowActions: tableMeta.rowGroups.rowActionsForGroup,
|
11921
|
+
rowId: cell.row.id,
|
11922
|
+
subRows: subRows
|
11923
|
+
}), content);
|
11916
11924
|
}
|
11917
11925
|
const MemoedGroupedCell = /*#__PURE__*/React__default.memo(function MemoedGroupedCell(props) {
|
11918
11926
|
const {
|
11919
11927
|
canShowActions,
|
11920
|
-
cell,
|
11921
11928
|
cellRef,
|
11929
|
+
children,
|
11930
|
+
colSpan,
|
11922
11931
|
fontSize,
|
11923
11932
|
rowActions,
|
11933
|
+
rowId,
|
11934
|
+
subRows,
|
11924
11935
|
...attributes
|
11925
11936
|
} = props;
|
11926
|
-
const colSpan = cell.row.getVisibleCells().filter(c => !isInternalColumn(c.column.id)).length - 1;
|
11927
|
-
const subRows = cell.getContext().row.subRows.map(row => row.original);
|
11928
11937
|
return /*#__PURE__*/React__default.createElement("td", Object.assign({}, attributes, {
|
11929
11938
|
ref: cellRef,
|
11930
11939
|
style: {
|
@@ -11932,13 +11941,13 @@ const MemoedGroupedCell = /*#__PURE__*/React__default.memo(function MemoedGroupe
|
|
11932
11941
|
}
|
11933
11942
|
}), /*#__PURE__*/React__default.createElement("span", {
|
11934
11943
|
className: "grow"
|
11935
|
-
},
|
11944
|
+
}, children), rowActions !== null && rowActions !== void 0 && rowActions.length && canShowActions ? ( /*#__PURE__*/React__default.createElement(Actions$1, {
|
11936
11945
|
actions: rowActions,
|
11937
11946
|
actionsLength: 4,
|
11938
11947
|
data: subRows,
|
11939
11948
|
fontSize: fontSize,
|
11940
11949
|
isActiveRow: true,
|
11941
|
-
rowId:
|
11950
|
+
rowId: rowId
|
11942
11951
|
})) : null);
|
11943
11952
|
});
|
11944
11953
|
|
@@ -12080,7 +12089,7 @@ function useSetVirtualisedRowHeight(measureRow, rowEl, expansionEl, isExpanded)
|
|
12080
12089
|
}, [isExpanded, rowEl, expansionEl]);
|
12081
12090
|
}
|
12082
12091
|
|
12083
|
-
|
12092
|
+
function DisplayCell(props) {
|
12084
12093
|
const {
|
12085
12094
|
cell,
|
12086
12095
|
cellRef,
|
@@ -12088,15 +12097,37 @@ const DisplayCell = /*#__PURE__*/React__default.memo(function DisplayCell(props)
|
|
12088
12097
|
isHighlighted,
|
12089
12098
|
...cellAttributes
|
12090
12099
|
} = props;
|
12100
|
+
const {
|
12101
|
+
isHovered
|
12102
|
+
} = React__default.useContext(RowContext);
|
12091
12103
|
const columnMeta = cell.column.columnDef.meta;
|
12092
12104
|
const attributes = getCellAttributes(cell, index, isHighlighted);
|
12093
12105
|
const isTruncated = !!columnMeta.enableTruncate;
|
12094
|
-
|
12095
|
-
|
12106
|
+
let content;
|
12107
|
+
if (isInternalColumn(cell.column.id)) {
|
12108
|
+
content = reactTable.flexRender(cell.column.columnDef.cell, cell.getContext());
|
12109
|
+
} else {
|
12110
|
+
var _ref, _columnMeta$renderer, _columnMeta$renderer2;
|
12111
|
+
content = (_ref = (_columnMeta$renderer = (_columnMeta$renderer2 = columnMeta.renderer) === null || _columnMeta$renderer2 === void 0 ? void 0 : _columnMeta$renderer2.call(columnMeta, cell.getValue(), cell.row.original)) !== null && _columnMeta$renderer !== void 0 ? _columnMeta$renderer : cell.getValue()) !== null && _ref !== void 0 ? _ref : null;
|
12112
|
+
}
|
12113
|
+
return /*#__PURE__*/React__default.createElement(MemoedDisplayCell, Object.assign({}, cellAttributes, attributes, {
|
12114
|
+
cellRef: cellRef,
|
12115
|
+
isTruncated: isTruncated,
|
12116
|
+
key: `${cell.id}_${isHovered}`
|
12117
|
+
}), content);
|
12118
|
+
}
|
12119
|
+
const MemoedDisplayCell = /*#__PURE__*/React__default.memo(function MemoedDisplayCell(props) {
|
12120
|
+
const {
|
12121
|
+
cellRef,
|
12122
|
+
children,
|
12123
|
+
isTruncated,
|
12124
|
+
...cellAttributes
|
12125
|
+
} = props;
|
12126
|
+
return /*#__PURE__*/React__default.createElement("td", Object.assign({}, cellAttributes, {
|
12096
12127
|
ref: cellRef
|
12097
12128
|
}), isTruncated ? /*#__PURE__*/React__default.createElement("span", {
|
12098
12129
|
className: "truncate print:overflow-visible print:whitespace-normal"
|
12099
|
-
},
|
12130
|
+
}, children) : children);
|
12100
12131
|
});
|
12101
12132
|
|
12102
12133
|
const RENDERERS = {
|
@@ -15787,7 +15818,7 @@ function Column$1(_) {
|
|
15787
15818
|
function Group$3(_) {
|
15788
15819
|
return null;
|
15789
15820
|
}
|
15790
|
-
const
|
15821
|
+
const BaseReport = /*#__PURE__*/fixedForwardRef(function BaseReport(props, ref) {
|
15791
15822
|
const report = useReport(props, ref);
|
15792
15823
|
return /*#__PURE__*/React__default.createElement(Table, null, /*#__PURE__*/React__default.createElement(Table.Toolbar, {
|
15793
15824
|
table: report
|
@@ -15796,6 +15827,16 @@ const Report$1 = /*#__PURE__*/fixedForwardRef(function Report(props, ref) {
|
|
15796
15827
|
table: report
|
15797
15828
|
}));
|
15798
15829
|
});
|
15830
|
+
const Report$1 = /*#__PURE__*/fixedForwardRef(function Report(props, ref) {
|
15831
|
+
const stringifiedChildren = String(props.children);
|
15832
|
+
// we force a remount (using key) when the child columns change because there are too many places to add children as an effect
|
15833
|
+
// this is cheaper from a complexity perspective, and probably performance wise as well
|
15834
|
+
const key = React__default.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);
|
15835
|
+
return /*#__PURE__*/React__default.createElement(BaseReport, Object.assign({}, props, {
|
15836
|
+
key: key,
|
15837
|
+
ref: ref
|
15838
|
+
}));
|
15839
|
+
});
|
15799
15840
|
Report$1.Column = Column$1;
|
15800
15841
|
Report$1.Group = Group$3;
|
15801
15842
|
|
@@ -18509,7 +18550,7 @@ function Group$4(_) {
|
|
18509
18550
|
return null;
|
18510
18551
|
}
|
18511
18552
|
Group$4.displayName = 'Table3Group';
|
18512
|
-
const
|
18553
|
+
const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref) {
|
18513
18554
|
var _table3$meta$editing, _table3$meta$editing2;
|
18514
18555
|
const table3 = useTable3(props, ref);
|
18515
18556
|
const handleBlur = event => {
|
@@ -18538,6 +18579,16 @@ const Table3 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
|
18538
18579
|
table: table3
|
18539
18580
|
})));
|
18540
18581
|
});
|
18582
|
+
const Table3 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
18583
|
+
const stringifiedChildren = String(props.children);
|
18584
|
+
// we force a remount (using key) when the child columns change because there are too many places to add children as an effect
|
18585
|
+
// this is cheaper from a complexity perspective, and probably performance wise as well
|
18586
|
+
const key = React__default.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);
|
18587
|
+
return /*#__PURE__*/React__default.createElement(BaseTable3, Object.assign({}, props, {
|
18588
|
+
key: key,
|
18589
|
+
ref: ref
|
18590
|
+
}));
|
18591
|
+
});
|
18541
18592
|
Table3.Column = Column$3;
|
18542
18593
|
Table3.Group = Group$4;
|
18543
18594
|
|