@economic/taco 2.27.1 → 2.27.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (25) hide show
  1. package/dist/esm/index.css +9 -3
  2. package/dist/esm/packages/taco/src/components/Provider/Localization.js +3 -3
  3. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  4. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/TextareaWithAutosizing.js +1 -0
  5. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/TextareaWithAutosizing.js.map +1 -1
  6. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +7 -2
  7. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
  8. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/util.js +3 -7
  9. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/util.js.map +1 -1
  10. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleColumnFreezing.js +19 -6
  11. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleColumnFreezing.js.map +1 -1
  12. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFontSizeListener.js +9 -2
  13. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFontSizeListener.js.map +1 -1
  14. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js +15 -2
  15. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js.map +1 -1
  16. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +6 -2
  17. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  18. package/dist/index.css +9 -3
  19. package/dist/primitives/Table/Core/components/Columns/Cell/util.d.ts +0 -1
  20. package/dist/primitives/Table/useTableManager/util/settings.d.ts +2 -1
  21. package/dist/taco.cjs.development.js +76 -40
  22. package/dist/taco.cjs.development.js.map +1 -1
  23. package/dist/taco.cjs.production.min.js +1 -1
  24. package/dist/taco.cjs.production.min.js.map +1 -1
  25. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"settings.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/util/settings.ts"],"sourcesContent":["import { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\n\nexport function getSettings<TType = unknown>(table: ReactTable<TType>) {\n const meta = table.options.meta as ReactTableMeta<TType>;\n const state = table.getState();\n\n return {\n // commented out properties are here to highlight things we explicitly don't want them saved\n //columnFilters: table.options.enableColumnFilters ? state.columnFilters : undefined,\n columnOrder: meta.columnOrdering.isEnabled ? state.columnOrder : undefined,\n columnPinning: state.columnPinning,\n columnSizing: state.columnSizing,\n columnVisibility: table.options.enableHiding ? state.columnVisibility : undefined,\n excludeUnmatchedRecordsInSearch: table.options.enableGlobalFilter,\n fontSize: meta.fontSize.isEnabled ? meta.fontSize.size : undefined,\n //grouping: table.options.enableGrouping ? state.grouping : undefined,\n rowHeight: meta.rowHeight.isEnabled ? meta.rowHeight.height : undefined,\n //searchQuery: table.options.enableGlobalFilter ? state.globalFilter : undefined,\n sorting: state.sorting,\n };\n}\n"],"names":["getSettings","table","meta","options","state","getState","columnOrder","columnOrdering","isEnabled","undefined","columnPinning","columnSizing","columnVisibility","enableHiding","excludeUnmatchedRecordsInSearch","enableGlobalFilter","fontSize","size","rowHeight","height","sorting"],"mappings":"SAEgBA,WAAWA,CAAkBC,KAAwB;EACjE,MAAMC,IAAI,GAAGD,KAAK,CAACE,OAAO,CAACD,IAA6B;EACxD,MAAME,KAAK,GAAGH,KAAK,CAACI,QAAQ,EAAE;EAE9B,OAAO;;;IAGHC,WAAW,EAAEJ,IAAI,CAACK,cAAc,CAACC,SAAS,GAAGJ,KAAK,CAACE,WAAW,GAAGG,SAAS;IAC1EC,aAAa,EAAEN,KAAK,CAACM,aAAa;IAClCC,YAAY,EAAEP,KAAK,CAACO,YAAY;IAChCC,gBAAgB,EAAEX,KAAK,CAACE,OAAO,CAACU,YAAY,GAAGT,KAAK,CAACQ,gBAAgB,GAAGH,SAAS;IACjFK,+BAA+B,EAAEb,KAAK,CAACE,OAAO,CAACY,kBAAkB;IACjEC,QAAQ,EAAEd,IAAI,CAACc,QAAQ,CAACR,SAAS,GAAGN,IAAI,CAACc,QAAQ,CAACC,IAAI,GAAGR,SAAS;;IAElES,SAAS,EAAEhB,IAAI,CAACgB,SAAS,CAACV,SAAS,GAAGN,IAAI,CAACgB,SAAS,CAACC,MAAM,GAAGV,SAAS;;IAEvEW,OAAO,EAAEhB,KAAK,CAACgB;GAClB;AACL;;;;"}
1
+ {"version":3,"file":"settings.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/util/settings.ts"],"sourcesContent":["import { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { isInternalColumn } from './columns';\n\nexport function getSettings<TType = unknown>(table: ReactTable<TType>) {\n const meta = table.options.meta as ReactTableMeta<TType>;\n const state = table.getState();\n\n return {\n // commented out properties are here to highlight things we explicitly don't want them saved\n //columnFilters: table.options.enableColumnFilters ? state.columnFilters : undefined,\n columnOrder: meta.columnOrdering.isEnabled ? state.columnOrder : undefined,\n columnPinning: state.columnPinning,\n columnSizing: ignoreInternalColumns(state.columnSizing),\n columnVisibility: table.options.enableHiding ? state.columnVisibility : undefined,\n excludeUnmatchedRecordsInSearch: table.options.enableGlobalFilter,\n fontSize: meta.fontSize.isEnabled ? meta.fontSize.size : undefined,\n //grouping: table.options.enableGrouping ? state.grouping : undefined,\n rowHeight: meta.rowHeight.isEnabled ? meta.rowHeight.height : undefined,\n //searchQuery: table.options.enableGlobalFilter ? state.globalFilter : undefined,\n sorting: state.sorting,\n };\n}\n\nexport function ignoreInternalColumns(data: object) {\n return Object.keys(data).reduce((accum, key) => {\n if (isInternalColumn(key)) {\n return accum;\n }\n\n return {\n ...accum,\n [key]: data[key],\n };\n }, {});\n}\n"],"names":["getSettings","table","meta","options","state","getState","columnOrder","columnOrdering","isEnabled","undefined","columnPinning","columnSizing","ignoreInternalColumns","columnVisibility","enableHiding","excludeUnmatchedRecordsInSearch","enableGlobalFilter","fontSize","size","rowHeight","height","sorting","data","Object","keys","reduce","accum","key","isInternalColumn"],"mappings":";;SAGgBA,WAAWA,CAAkBC,KAAwB;EACjE,MAAMC,IAAI,GAAGD,KAAK,CAACE,OAAO,CAACD,IAA6B;EACxD,MAAME,KAAK,GAAGH,KAAK,CAACI,QAAQ,EAAE;EAE9B,OAAO;;;IAGHC,WAAW,EAAEJ,IAAI,CAACK,cAAc,CAACC,SAAS,GAAGJ,KAAK,CAACE,WAAW,GAAGG,SAAS;IAC1EC,aAAa,EAAEN,KAAK,CAACM,aAAa;IAClCC,YAAY,EAAEC,qBAAqB,CAACR,KAAK,CAACO,YAAY,CAAC;IACvDE,gBAAgB,EAAEZ,KAAK,CAACE,OAAO,CAACW,YAAY,GAAGV,KAAK,CAACS,gBAAgB,GAAGJ,SAAS;IACjFM,+BAA+B,EAAEd,KAAK,CAACE,OAAO,CAACa,kBAAkB;IACjEC,QAAQ,EAAEf,IAAI,CAACe,QAAQ,CAACT,SAAS,GAAGN,IAAI,CAACe,QAAQ,CAACC,IAAI,GAAGT,SAAS;;IAElEU,SAAS,EAAEjB,IAAI,CAACiB,SAAS,CAACX,SAAS,GAAGN,IAAI,CAACiB,SAAS,CAACC,MAAM,GAAGX,SAAS;;IAEvEY,OAAO,EAAEjB,KAAK,CAACiB;GAClB;AACL;SAEgBT,qBAAqBA,CAACU,IAAY;EAC9C,OAAOC,MAAM,CAACC,IAAI,CAACF,IAAI,CAAC,CAACG,MAAM,CAAC,CAACC,KAAK,EAAEC,GAAG;IACvC,IAAIC,gBAAgB,CAACD,GAAG,CAAC,EAAE;MACvB,OAAOD,KAAK;;IAGhB,OAAO;MACH,GAAGA,KAAK;MACR,CAACC,GAAG,GAAGL,IAAI,CAACK,GAAG;KAClB;GACJ,EAAE,EAAE,CAAC;AACV;;;;"}
@@ -3,6 +3,7 @@ import { getExpandedRowModel, getGroupedRowModel, getFilteredRowModel, getSorted
3
3
  import { getSortingFn } from './sorting.js';
4
4
  import { ensureOrdering, freezeUptoExternalColumn, unfreezeAllExternalColumns, getCellMinWidth } from './columns.js';
5
5
  import { columnFilterFn, globalFilterFn } from './filtering.js';
6
+ import { ignoreInternalColumns } from './settings.js';
6
7
 
7
8
  // mapping children to react-table columns
8
9
  function processChildren(child, columns, defaultSizing, defaultSorting, defaultVisibility, settings, defaultRowGroupColumnId) {
@@ -89,7 +90,10 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
89
90
  column.cell = info => renderer(info.getValue(), info.row.original);
90
91
  }
91
92
  if (typeof footer === 'function') {
92
- column.footer = info => footer(info.table.getRowModel().rows.map(row => row.original[id]));
93
+ column.footer = info => footer(info.table.getRowModel().rows.flatMap(row => {
94
+ var _row$original;
95
+ return ((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original[id]) !== undefined ? [row.original[id]] : [];
96
+ }));
93
97
  }
94
98
  // config - filtering
95
99
  if (enableColumnFilter) {
@@ -256,7 +260,7 @@ function useReactTableInitialState(props, columns, persistedSettings, defaults)
256
260
  columnFilters: (_ref2 = (_persistedSettings$co3 = persistedSettings.columnFilters) !== null && _persistedSettings$co3 !== void 0 ? _persistedSettings$co3 : (_props$defaultSetting3 = props.defaultSettings) === null || _props$defaultSetting3 === void 0 ? void 0 : _props$defaultSetting3.columnFilters) !== null && _ref2 !== void 0 ? _ref2 : [],
257
261
  columnOrder,
258
262
  columnPinning,
259
- columnSizing: (_ref3 = (_ref4 = (_persistedSettings$co4 = persistedSettings.columnSizing) !== null && _persistedSettings$co4 !== void 0 ? _persistedSettings$co4 : (_props$defaultSetting4 = props.defaultSettings) === null || _props$defaultSetting4 === void 0 ? void 0 : _props$defaultSetting4.columnSizing) !== null && _ref4 !== void 0 ? _ref4 : defaults.defaultSizing) !== null && _ref3 !== void 0 ? _ref3 : {},
263
+ columnSizing: ignoreInternalColumns((_ref3 = (_ref4 = (_persistedSettings$co4 = persistedSettings.columnSizing) !== null && _persistedSettings$co4 !== void 0 ? _persistedSettings$co4 : (_props$defaultSetting4 = props.defaultSettings) === null || _props$defaultSetting4 === void 0 ? void 0 : _props$defaultSetting4.columnSizing) !== null && _ref4 !== void 0 ? _ref4 : defaults.defaultSizing) !== null && _ref3 !== void 0 ? _ref3 : {}),
260
264
  columnVisibility: (_ref5 = (_ref6 = (_persistedSettings$co5 = persistedSettings.columnVisibility) !== null && _persistedSettings$co5 !== void 0 ? _persistedSettings$co5 : (_props$defaultSetting5 = props.defaultSettings) === null || _props$defaultSetting5 === void 0 ? void 0 : _props$defaultSetting5.columnVisibility) !== null && _ref6 !== void 0 ? _ref6 : defaults.defaultVisibility) !== null && _ref5 !== void 0 ? _ref5 : {},
261
265
  globalFilter: (_persistedSettings$se = persistedSettings.searchQuery) !== null && _persistedSettings$se !== void 0 ? _persistedSettings$se : (_props$defaultSetting6 = props.defaultSettings) === null || _props$defaultSetting6 === void 0 ? void 0 : _props$defaultSetting6.searchQuery,
262
266
  sorting: persistedSettings.sorting ? persistedSettings.sorting.filter(ignoreNotDefinedColumns) : (_props$defaultSetting7 = (_props$defaultSetting8 = props.defaultSettings) === null || _props$defaultSetting8 === void 0 ? void 0 : _props$defaultSetting8.sorting) !== null && _props$defaultSetting7 !== void 0 ? _props$defaultSetting7 : defaults.defaultSorting
@@ -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 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 (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","grouping","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,cAAK,CAACC,cAAc,CAA0BV,KAAK,CAAC,KAAKA,KAAK,CAACW,KAAK,CAACU,QAAQ,IAAIrB,KAAK,CAACW,KAAK,CAACE,EAAE,CAAC,EAAE;IACzG,MAAM;MACFA,EAAE;MACFQ,QAAQ,EAAEC,WAAW,GAAGT,EAAE;;MAE1BU,QAAQ;MACRC,SAAS;MACTC,MAAM;MACNX,MAAM;;MAENY,aAAa;MACbC,aAAa;MACbC,YAAY;MACZC,eAAe,EAAEC,kBAAkB,GAAG,IAAI;MAC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G,sBAAA,cAAAA,sBAAA,IAAAC,sBAAA,GAAIhJ,KAAK,CAACwH,eAAe,cAAAwB,sBAAA,uBAArBA,sBAAA,CAAuBJ,gBAAgB,cAAAE,KAAA,cAAAA,KAAA,GAAI/B,QAAQ,CAACtH,iBAAiB,cAAAoJ,KAAA,cAAAA,KAAA,GAAI,EAAE;MACrHI,YAAY,GAAAC,qBAAA,GAAEpC,iBAAiB,CAACqC,WAAW,cAAAD,qBAAA,cAAAA,qBAAA,IAAAE,sBAAA,GAAIpJ,KAAK,CAACwH,eAAe,cAAA4B,sBAAA,uBAArBA,sBAAA,CAAuBD,WAAW;MACjFE,OAAO,EAAEvC,iBAAiB,CAACuC,OAAO,GAC5BvC,iBAAiB,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,IAAIQ,KAAK,CAACL,uBAAuB,EAAE;MAC/BuI,KAAK,CAACsB,QAAQ,GAAG,CAACxJ,KAAK,CAACL,uBAAiC,CAAC;;MAE1DuI,KAAK,CAACuB,QAAQ,GAAG,IAAI;;IAGzB,OAAOvB,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';\nimport { ignoreInternalColumns } from './settings';\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 =>\n footer(\n info.table.getRowModel().rows.flatMap(row => (row.original?.[id] !== undefined ? [row.original[id]] : []))\n );\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: ignoreInternalColumns(\n persistedSettings.columnSizing ?? props.defaultSettings?.columnSizing ?? defaults.defaultSizing ?? {}\n ),\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 (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","flatMap","_row$original","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","ignoreInternalColumns","_ref3","_ref4","_persistedSettings$co4","_props$defaultSetting4","columnVisibility","_ref5","_ref6","_persistedSettings$co5","_props$defaultSetting5","globalFilter","_persistedSettings$se","searchQuery","_props$defaultSetting6","sorting","_props$defaultSetting7","_props$defaultSetting8","grouping","expanded"],"mappings":";;;;;;;AAwBA;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,cAAK,CAACC,cAAc,CAA0BV,KAAK,CAAC,KAAKA,KAAK,CAACW,KAAK,CAACU,QAAQ,IAAIrB,KAAK,CAACW,KAAK,CAACE,EAAE,CAAC,EAAE;IACzG,MAAM;MACFA,EAAE;MACFQ,QAAQ,EAAEC,WAAW,GAAGT,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[data-taco^='table'][data-table-row-height='short'] td {
667
667
  @apply min-h-[33px];
668
668
  }
669
669
 
670
- table[data-taco^='table'][data-table-row-height='medium'] td {
670
+ table[data-taco^='table'][data-table-row-height='medium'] td,
671
+ /* Footer should always have medium row height */
672
+ table[data-taco^='table'][data-table-row-height] tfoot td {
671
673
  @apply min-h-[41px];
672
674
  }
673
675
 
@@ -701,7 +703,11 @@ table[data-taco^='table'] td:not([data-cell-truncate='true']) {
701
703
 
702
704
  /* FOOTER */
703
705
  table[data-taco^='table'] tfoot td {
704
- @apply border-b-0 font-bold;
706
+ /*
707
+ * Since footer has sticky position, the top and bottom padding ensures that the inner content doesn't come over
708
+ * the border of the footer row.
709
+ */
710
+ @apply border-b-0 !py-1 font-bold;
705
711
  }
706
712
 
707
713
  table[data-taco^='table'] tfoot td:before {
@@ -894,7 +900,7 @@ table[data-taco^='table'][data-table-font-size='medium'] td [data-taco='Select2'
894
900
  }
895
901
 
896
902
  table[data-taco^='table'][data-table-font-size='medium'] td [data-taco='textarea'] {
897
- @apply !pr-[5px];
903
+ @apply !-mb-[8px] !pr-[5px];
898
904
  }
899
905
 
900
906
  table[data-taco^='table'][data-table-font-size='medium'] td[data-cell-truncate='true'] [data-taco='textarea'] {
@@ -12,7 +12,6 @@ export declare function getCellAttributes<TType = unknown>(cell: ReactTableCell<
12
12
  'data-cell-pinned': boolean | undefined;
13
13
  'data-cell-truncate': boolean | undefined;
14
14
  className: string | undefined;
15
- style: {};
16
15
  };
17
16
  export declare function useSearchHighlighting<TType = unknown>(cell: ReactTableCell<TType, unknown>, cellIndex: number, ref: React.RefObject<HTMLTableCellElement>): true | "current" | undefined;
18
17
  export declare function getCurrentRowCellElement(index: number, tableEl: HTMLElement): Element | null;
@@ -2,10 +2,11 @@ import { Table as ReactTable } from '@tanstack/react-table';
2
2
  export declare function getSettings<TType = unknown>(table: ReactTable<TType>): {
3
3
  columnOrder: import("@tanstack/react-table").ColumnOrderState | undefined;
4
4
  columnPinning: import("@tanstack/react-table").ColumnPinningState;
5
- columnSizing: Record<string, number>;
5
+ columnSizing: {};
6
6
  columnVisibility: Record<string, boolean> | undefined;
7
7
  excludeUnmatchedRecordsInSearch: boolean | undefined;
8
8
  fontSize: "small" | "medium" | "large" | undefined;
9
9
  rowHeight: "medium" | "short" | "tall" | "extra-tall" | undefined;
10
10
  sorting: import("@tanstack/react-table").SortingState;
11
11
  };
12
+ export declare function ignoreInternalColumns(data: object): {};
@@ -4572,12 +4572,12 @@ const defaultLocalisationTexts = {
4572
4572
  },
4573
4573
  validation: {
4574
4574
  alert: {
4575
- titleOne: '[COUNT] unsaved entry: ',
4576
- titlePlural: '[COUNT] unsaved entries: ',
4575
+ titleOne: '[COUNT] unsaved entry:',
4576
+ titlePlural: '[COUNT] unsaved entries:',
4577
4577
  messageOne: "[COLUMN] [ROW] is incomplete and hasn't been saved.",
4578
4578
  messagePlural: "[COLUMN] [ROW] are incomplete and haven't been saved.",
4579
4579
  messageRow: 'Row',
4580
- messageAnd: ' and '
4580
+ messageAnd: 'and'
4581
4581
  },
4582
4582
  resetFiltersDialog: {
4583
4583
  title: 'Row is hidden',
@@ -9523,6 +9523,36 @@ function globalFilterFn(row, columnId, searchQuery) {
9523
9523
  return false;
9524
9524
  }
9525
9525
 
9526
+ function getSettings(table) {
9527
+ const meta = table.options.meta;
9528
+ const state = table.getState();
9529
+ return {
9530
+ // commented out properties are here to highlight things we explicitly don't want them saved
9531
+ //columnFilters: table.options.enableColumnFilters ? state.columnFilters : undefined,
9532
+ columnOrder: meta.columnOrdering.isEnabled ? state.columnOrder : undefined,
9533
+ columnPinning: state.columnPinning,
9534
+ columnSizing: ignoreInternalColumns(state.columnSizing),
9535
+ columnVisibility: table.options.enableHiding ? state.columnVisibility : undefined,
9536
+ excludeUnmatchedRecordsInSearch: table.options.enableGlobalFilter,
9537
+ fontSize: meta.fontSize.isEnabled ? meta.fontSize.size : undefined,
9538
+ //grouping: table.options.enableGrouping ? state.grouping : undefined,
9539
+ rowHeight: meta.rowHeight.isEnabled ? meta.rowHeight.height : undefined,
9540
+ //searchQuery: table.options.enableGlobalFilter ? state.globalFilter : undefined,
9541
+ sorting: state.sorting
9542
+ };
9543
+ }
9544
+ function ignoreInternalColumns(data) {
9545
+ return Object.keys(data).reduce((accum, key) => {
9546
+ if (isInternalColumn(key)) {
9547
+ return accum;
9548
+ }
9549
+ return {
9550
+ ...accum,
9551
+ [key]: data[key]
9552
+ };
9553
+ }, {});
9554
+ }
9555
+
9526
9556
  // mapping children to react-table columns
9527
9557
  function processChildren(child, columns, defaultSizing, defaultSorting, defaultVisibility, settings, defaultRowGroupColumnId) {
9528
9558
  const columnHelper = reactTable.createColumnHelper();
@@ -9608,7 +9638,10 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
9608
9638
  column.cell = info => renderer(info.getValue(), info.row.original);
9609
9639
  }
9610
9640
  if (typeof footer === 'function') {
9611
- column.footer = info => footer(info.table.getRowModel().rows.map(row => row.original[id]));
9641
+ column.footer = info => footer(info.table.getRowModel().rows.flatMap(row => {
9642
+ var _row$original;
9643
+ return ((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original[id]) !== undefined ? [row.original[id]] : [];
9644
+ }));
9612
9645
  }
9613
9646
  // config - filtering
9614
9647
  if (enableColumnFilter) {
@@ -9775,7 +9808,7 @@ function useReactTableInitialState(props, columns, persistedSettings, defaults)
9775
9808
  columnFilters: (_ref2 = (_persistedSettings$co3 = persistedSettings.columnFilters) !== null && _persistedSettings$co3 !== void 0 ? _persistedSettings$co3 : (_props$defaultSetting3 = props.defaultSettings) === null || _props$defaultSetting3 === void 0 ? void 0 : _props$defaultSetting3.columnFilters) !== null && _ref2 !== void 0 ? _ref2 : [],
9776
9809
  columnOrder,
9777
9810
  columnPinning,
9778
- columnSizing: (_ref3 = (_ref4 = (_persistedSettings$co4 = persistedSettings.columnSizing) !== null && _persistedSettings$co4 !== void 0 ? _persistedSettings$co4 : (_props$defaultSetting4 = props.defaultSettings) === null || _props$defaultSetting4 === void 0 ? void 0 : _props$defaultSetting4.columnSizing) !== null && _ref4 !== void 0 ? _ref4 : defaults.defaultSizing) !== null && _ref3 !== void 0 ? _ref3 : {},
9811
+ columnSizing: ignoreInternalColumns((_ref3 = (_ref4 = (_persistedSettings$co4 = persistedSettings.columnSizing) !== null && _persistedSettings$co4 !== void 0 ? _persistedSettings$co4 : (_props$defaultSetting4 = props.defaultSettings) === null || _props$defaultSetting4 === void 0 ? void 0 : _props$defaultSetting4.columnSizing) !== null && _ref4 !== void 0 ? _ref4 : defaults.defaultSizing) !== null && _ref3 !== void 0 ? _ref3 : {}),
9779
9812
  columnVisibility: (_ref5 = (_ref6 = (_persistedSettings$co5 = persistedSettings.columnVisibility) !== null && _persistedSettings$co5 !== void 0 ? _persistedSettings$co5 : (_props$defaultSetting5 = props.defaultSettings) === null || _props$defaultSetting5 === void 0 ? void 0 : _props$defaultSetting5.columnVisibility) !== null && _ref6 !== void 0 ? _ref6 : defaults.defaultVisibility) !== null && _ref5 !== void 0 ? _ref5 : {},
9780
9813
  globalFilter: (_persistedSettings$se = persistedSettings.searchQuery) !== null && _persistedSettings$se !== void 0 ? _persistedSettings$se : (_props$defaultSetting6 = props.defaultSettings) === null || _props$defaultSetting6 === void 0 ? void 0 : _props$defaultSetting6.searchQuery,
9781
9814
  sorting: persistedSettings.sorting ? persistedSettings.sorting.filter(ignoreNotDefinedColumns) : (_props$defaultSetting7 = (_props$defaultSetting8 = props.defaultSettings) === null || _props$defaultSetting8 === void 0 ? void 0 : _props$defaultSetting8.sorting) !== null && _props$defaultSetting7 !== void 0 ? _props$defaultSetting7 : defaults.defaultSorting
@@ -10588,10 +10621,17 @@ function useTableFontSizeListener(table) {
10588
10621
  const previousFontSizeRef = React__default.useRef(meta.fontSize.size);
10589
10622
  useLazyEffect(() => {
10590
10623
  const cellWidthDifference = getCellWidthDifference(`${previousFontSizeRef.current}-${meta.fontSize.size}`);
10624
+ const globalMinSize = getCellMinWidth(meta.fontSize.size);
10591
10625
  table.setColumnSizing(sizes => {
10592
- const minColumnSize = getCellMinWidth(meta.fontSize.size);
10593
10626
  return Object.fromEntries(Object.entries(sizes).map(([columnName, prevColumnSize]) => {
10627
+ var _column$columnDef$min;
10628
+ const column = table.getColumn(columnName);
10629
+ if (isInternalColumn(columnName)) {
10630
+ var _column$getSize;
10631
+ return [columnName, (_column$getSize = column === null || column === void 0 ? void 0 : column.getSize()) !== null && _column$getSize !== void 0 ? _column$getSize : prevColumnSize];
10632
+ }
10594
10633
  // Prevents width value in the setting to go below the minColumnSize
10634
+ const minColumnSize = (_column$columnDef$min = column === null || column === void 0 ? void 0 : column.columnDef.minSize) !== null && _column$columnDef$min !== void 0 ? _column$columnDef$min : globalMinSize;
10595
10635
  const newSize = Math.max(minColumnSize, prevColumnSize + cellWidthDifference);
10596
10636
  return [columnName, newSize];
10597
10637
  }));
@@ -10705,25 +10745,6 @@ function useTableSearchListener(table) {
10705
10745
  }, [meta.server.loadAllStatus, meta.search.isEnabled, meta.search.enableGlobalFilter, table.getRowModel().rows.length, table.getState().globalFilter, JSON.stringify(table.getState().sorting), JSON.stringify(table.getState().columnVisibility)]);
10706
10746
  }
10707
10747
 
10708
- function getSettings(table) {
10709
- const meta = table.options.meta;
10710
- const state = table.getState();
10711
- return {
10712
- // commented out properties are here to highlight things we explicitly don't want them saved
10713
- //columnFilters: table.options.enableColumnFilters ? state.columnFilters : undefined,
10714
- columnOrder: meta.columnOrdering.isEnabled ? state.columnOrder : undefined,
10715
- columnPinning: state.columnPinning,
10716
- columnSizing: state.columnSizing,
10717
- columnVisibility: table.options.enableHiding ? state.columnVisibility : undefined,
10718
- excludeUnmatchedRecordsInSearch: table.options.enableGlobalFilter,
10719
- fontSize: meta.fontSize.isEnabled ? meta.fontSize.size : undefined,
10720
- //grouping: table.options.enableGrouping ? state.grouping : undefined,
10721
- rowHeight: meta.rowHeight.isEnabled ? meta.rowHeight.height : undefined,
10722
- //searchQuery: table.options.enableGlobalFilter ? state.globalFilter : undefined,
10723
- sorting: state.sorting
10724
- };
10725
- }
10726
-
10727
10748
  function useTableSettingsListener(table, onChangeSettings) {
10728
10749
  const meta = table.options.meta;
10729
10750
  const state = table.getState();
@@ -10992,16 +11013,23 @@ function useTableStyleGrid(tableId, table, fontSize) {
10992
11013
 
10993
11014
  function useTableStyleColumnFreezing(tableId, table) {
10994
11015
  const {
10995
- columnPinning
11016
+ columnPinning,
11017
+ columnSizing
10996
11018
  } = table.getState();
10997
11019
  const stylesheet = React__default.useMemo(() => {
10998
11020
  const styles = [];
10999
11021
  // might be a better way to get this information, but it wasn't obvious
11000
11022
  const all = table.getFlatHeaders().filter(column => !column.subHeaders.length).map(x => x.id);
11001
- const left = table.getLeftFlatHeaders().filter(column => !column.subHeaders.length).map(x => x.id);
11002
- const right = table.getRightFlatHeaders().filter(column => !column.subHeaders.length).map(x => x.id);
11023
+ const left = table.getLeftFlatHeaders().filter(column => !column.subHeaders.length);
11024
+ const right = table.getRightFlatHeaders().filter(column => !column.subHeaders.length);
11003
11025
  if (left.length) {
11004
- const index = all.indexOf(left[left.length - 1]);
11026
+ left.forEach(cell => {
11027
+ styles.push(`table[data-taco^='table']#${tableId} [data-cell-id="${cell.column.id}"] {
11028
+ left: ${cell.column.getStart(cell.column.getIsPinned())}px;
11029
+ }`);
11030
+ });
11031
+ const leftIds = left.map(x => x.id);
11032
+ const index = all.indexOf(leftIds[leftIds.length - 1]);
11005
11033
  // add right border, hide the header seperator and add shadow when scrolled
11006
11034
  // we have to be specific so that nested tables don't inherit the same css
11007
11035
  styles.push(`table[data-taco^='table']#${tableId} > thead > tr > th:nth-child(${index + 1}),
@@ -11019,14 +11047,20 @@ function useTableStyleColumnFreezing(tableId, table) {
11019
11047
  }`);
11020
11048
  }
11021
11049
  if (right.length) {
11022
- const index = all.indexOf(right[right.length - 1]);
11050
+ right.forEach(cell => {
11051
+ styles.push(`table[data-taco^='table']#${tableId} [data-cell-id="${cell.column.id}"] {
11052
+ right: ${cell.column.getStart(cell.column.getIsPinned())}px;
11053
+ }`);
11054
+ });
11055
+ const rightIds = right.map(x => x.id);
11056
+ const index = all.indexOf(rightIds[rightIds.length - 1]);
11023
11057
  styles.push(`table[data-taco^='table']#${tableId} > thead > tr > th:nth-child(${index + 1}):not([data-cell-id^="__"]),
11024
11058
  table[data-taco^='table']#${tableId} > tbody > tr > td:nth-child(${index + 1}):not([data-cell-id^="__"]) {
11025
11059
  border-left-width: 1px;
11026
11060
  }`);
11027
11061
  }
11028
11062
  return styles.join('\n');
11029
- }, [columnPinning]);
11063
+ }, [columnPinning, columnSizing]);
11030
11064
  return {
11031
11065
  stylesheet
11032
11066
  };
@@ -11847,20 +11881,16 @@ function useTable(props, externalRef, renderers, meta) {
11847
11881
  function getCellAttributes(cell, index, isHighlighted) {
11848
11882
  const columnMeta = cell.column.columnDef.meta;
11849
11883
  const isPinned = cell.column.getIsPinned();
11850
- const attributes = {
11884
+ // be careful adding new properties here, any objects will break cell memoisation (e.g. the style attribute)
11885
+ return {
11851
11886
  'data-cell-align': columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.align,
11852
11887
  'data-cell-highlighted': isHighlighted,
11853
11888
  'data-cell-id': cell.column.id,
11854
11889
  'data-cell-index': index,
11855
11890
  'data-cell-pinned': isPinned ? true : undefined,
11856
11891
  'data-cell-truncate': columnMeta.enableTruncate ? true : undefined,
11857
- className: typeof columnMeta.className === 'function' ? columnMeta.className(cell.row.original) : columnMeta.className,
11858
- style: {}
11892
+ className: typeof columnMeta.className === 'function' ? columnMeta.className(cell.row.original) : columnMeta.className
11859
11893
  };
11860
- if (isPinned) {
11861
- attributes.style[isPinned] = `${cell.column.getStart(isPinned)}px`;
11862
- }
11863
- return attributes;
11864
11894
  }
11865
11895
  function useSearchHighlighting(cell, cellIndex, ref) {
11866
11896
  const {
@@ -17968,6 +17998,7 @@ const TextareaWithAutosizing = /*#__PURE__*/React__default.forwardRef(function T
17968
17998
  };
17969
17999
  const handleFocus = event => {
17970
18000
  var _props$onFocus;
18001
+ toggleHeight();
17971
18002
  (_props$onFocus = props.onFocus) === null || _props$onFocus === void 0 ? void 0 : _props$onFocus.call(props, event);
17972
18003
  };
17973
18004
  const handleBlur = event => {
@@ -18453,9 +18484,13 @@ function Alert$1(props) {
18453
18484
  const tableMeta = table.options.meta;
18454
18485
  const [showFilterResetDialog, setShowFilterResetDialog] = React__default.useState(false);
18455
18486
  const pendingChangesWithErrors = tableMeta.editing.getErrors();
18487
+ const activeRow = React__default.useMemo(() => tableMeta.rowActive.rowActiveIndex ? table.getRowModel().rows[tableMeta.rowActive.rowActiveIndex] : undefined, [tableMeta.rowActive.rowActiveIndex]);
18456
18488
  // mark errors being rendered as seen
18457
18489
  React__default.useEffect(() => {
18458
18490
  pendingChangesWithErrors.forEach(error => {
18491
+ if (activeRow && error.rowId === activeRow.id) {
18492
+ return;
18493
+ }
18459
18494
  tableMeta.editing.setRowErrorsSeen(error.rowId);
18460
18495
  });
18461
18496
  }, [pendingChangesWithErrors]);
@@ -18481,7 +18516,8 @@ function Alert$1(props) {
18481
18516
  pendingChangesWithErrors.forEach((error, index) => {
18482
18517
  // if appropriate, concatenate the item with the text "and"
18483
18518
  if (pendingChangesWithErrors.length > 1 && index === pendingChangesWithErrors.length - 1) {
18484
- links.push(validationTexts.alert.messageAnd);
18519
+ // Add space before and after `messageAnd` text
18520
+ links.push(` ${validationTexts.alert.messageAnd} `);
18485
18521
  }
18486
18522
  const rowIndex = table.getRowModel().rows.findIndex(row => row.id === error.rowId);
18487
18523
  const handleClick = () => {
@@ -18539,7 +18575,7 @@ function Alert$1(props) {
18539
18575
  state: "error"
18540
18576
  }), /*#__PURE__*/React__default.createElement("span", {
18541
18577
  className: "font-bold"
18542
- }, title), message), /*#__PURE__*/React__default.createElement(FilterResetDialog, {
18578
+ }, title), "\u00A0", message), /*#__PURE__*/React__default.createElement(FilterResetDialog, {
18543
18579
  open: showFilterResetDialog !== false,
18544
18580
  onChange: () => setShowFilterResetDialog(false),
18545
18581
  onSubmit: handleResetFilters