@economic/taco 2.30.0 → 2.30.2

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/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js +2 -2
  2. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js.map +1 -1
  3. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js +1 -1
  4. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js.map +1 -1
  5. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js +1 -1
  6. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js.map +1 -1
  7. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js +1 -1
  8. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js.map +1 -1
  9. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  10. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js +45 -12
  11. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
  12. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js +7 -3
  13. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js.map +1 -1
  14. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js +1 -2
  15. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js.map +1 -1
  16. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +1 -1
  17. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
  18. package/dist/primitives/Table/types.d.ts +6 -7
  19. package/dist/primitives/Table/useTableDataLoader.d.ts +5 -4
  20. package/dist/primitives/Table/useTableManager/listeners/useTableSearchListener.d.ts +2 -1
  21. package/dist/taco.cjs.development.js +59 -23
  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":"useTableManager.js","sources":["../../../../../../../../src/primitives/Table/useTableManager/useTableManager.ts"],"sourcesContent":["import { useReactTable, TableMeta as ReactTableMeta, RowData, getCoreRowModel } from '@tanstack/react-table';\nimport {\n TableColumnAlignment,\n TableColumnClassNameHandler,\n TableColumnDataType,\n TableColumnMenu,\n TableColumnRenderer,\n TableColumnRendererControl,\n TableFilterComparator,\n TableProps,\n} from '../types';\nimport { useReactTableInitialState, configureReactTableOptions, mapTableChildrenToColumns } from './util/setup';\nimport { getTableFeaturePreset } from './util/presets';\nimport { useTableColumnFreezing } from './features/useTableColumnFreezing';\nimport { useTableColumnOrdering } from './features/useTableColumnOrdering';\nimport { useTableFooter } from './features/useTableFooter';\nimport { useTableFontSize } from './features/useTableFontSize';\nimport { useTablePrinting } from './features/useTablePrinting';\nimport { useTableRowActions } from './features/useTableRowActions';\nimport { useTableRowActive } from './features/useTableRowActive';\nimport { useTableRowClick } from './features/useTableRowClick';\nimport { useTableRowExpansion } from './features/useTableRowExpansion';\nimport { useTableRowGoto } from './features/useTableRowGoto';\nimport { useTableRowGroups } from './features/useTableRowGroups';\nimport { useTableRowHeight } from './features/useTableRowHeight';\nimport { useTableRowSelection } from './features/useTableRowSelection';\nimport { useTableSearch } from './features/useTableSearch';\nimport { useTableServerLoading } from './features/useTableServerLoading';\nimport { useTableSettings } from './features/useTableSettings';\nimport { useTableDataListener } from './listeners/useTableDataListener';\nimport { useTableFilterListener } from './listeners/useTableFilterListener';\nimport { useTableFontSizeListener } from './listeners/useTableFontSizeListener';\nimport { useTableRowHeightListener } from './listeners/useTableRowHeightListener';\nimport { useTableRowSelectionListener } from './listeners/useTableRowSelectionListener';\nimport { useTableSearchListener } from './listeners/useTableSearchListener';\nimport { useTableSettingsListener } from './listeners/useTableSettingsListener';\nimport { useTableShortcutsListener } from './listeners/useTableShortcutsListener';\nimport { useTableSortingListener } from './listeners/useTableSortingListener';\nimport { useTableServerLoadingListener } from './listeners/useTableServerLoadingListener';\nimport { useTableManagerInternalColumns } from './types';\nimport { useTableRowDrag } from './features/useTableRowDrag';\nimport { useTableRowDrop } from './features/useTableRowDrop';\n\n/*\n EDITING THIS FILE? READ ME FIRST!\n\n This is a shared, common hook for multiple tables. It's feature set is specifically chosen to support features\n common across those tables. If you are adding a new feature or changing an existing one, before writing any code\n in this file ask yourself the question - is this specific to a given table, or is it common to all of them.\n If you are unsure, ask your team first.\n*/\n\ndeclare module '@tanstack/table-core' {\n interface TableMeta<TData extends RowData> {\n columnFreezing: ReturnType<typeof useTableColumnFreezing>;\n columnOrdering: ReturnType<typeof useTableColumnOrdering>;\n fontSize: ReturnType<typeof useTableFontSize>;\n footer: ReturnType<typeof useTableFooter>;\n length: number;\n printing: ReturnType<typeof useTablePrinting>;\n rowActions: ReturnType<typeof useTableRowActions>;\n rowActive: ReturnType<typeof useTableRowActive>;\n rowClick: ReturnType<typeof useTableRowClick>;\n rowDrag: ReturnType<typeof useTableRowDrag>;\n rowDrop: ReturnType<typeof useTableRowDrop>;\n rowExpansion: ReturnType<typeof useTableRowExpansion>;\n rowGoto: ReturnType<typeof useTableRowGoto>;\n rowGroups: ReturnType<typeof useTableRowGroups>;\n rowHeight: ReturnType<typeof useTableRowHeight>;\n rowIdentityColumnId?: string;\n rowSelection: ReturnType<typeof useTableRowSelection>;\n search: ReturnType<typeof useTableSearch>;\n server: ReturnType<typeof useTableServerLoading>;\n }\n\n interface ColumnMeta<TData extends RowData, TValue> {\n align?: TableColumnAlignment;\n className?: TableColumnClassNameHandler<TData>;\n control?: TableColumnRendererControl<TData>;\n dataType?: TableColumnDataType;\n defaultWidth?: number;\n enableOrdering?: boolean;\n enablePrinting?: boolean;\n enableSearch?: boolean;\n enableTruncate?: boolean;\n filters?: TableFilterComparator[];\n header: string;\n headerClassName?: string;\n menu?: TableColumnMenu;\n renderer?: TableColumnRenderer<TValue, TData>;\n tooltip?: string;\n }\n}\n\nexport function useTableManager<TType = unknown, TMeta = {}>(\n props: TableProps<TType>,\n meta?: Partial<ReactTableMeta<TType>> & TMeta,\n internalColumns?: useTableManagerInternalColumns<TType>\n) {\n // CSS.escape would be best here, but it doesn't seem to work very well\n const safeId = props.id.replace('.', '_');\n // configure table options, merging props with presets\n const options = getTableFeaturePreset(props);\n\n // load any persisted table settings and merge them with any defaults\n const [settings, setSettings] = useTableSettings(\n options.enableSaveSettings,\n safeId,\n props.defaultSettings,\n props.onChangeSettings\n );\n\n // configure common custom features\n const columnFreezing = useTableColumnFreezing(options.enableColumnFreezing);\n const columnOrdering = useTableColumnOrdering(options.enableColumnOrdering);\n const fontSize = useTableFontSize(options.enableFontSize, settings.fontSize);\n const footer = useTableFooter(options.enableFooter);\n const printing = useTablePrinting(options.enablePrinting, safeId);\n const rowActive = useTableRowActive(options.enableRowActive, props.defaultRowActiveIndex);\n const rowActions = useTableRowActions<TType>(options.enableRowActions, props.rowActions, props.rowActionsLength);\n const rowClick = useTableRowClick<TType>(options.enableRowClick, props.onRowClick);\n const rowDrag = useTableRowDrag<TType>(options.enableRowDrag, props.onRowDrag);\n const rowDrop = useTableRowDrop<TType>(options.enableRowDrop, props.onRowDrop);\n const rowExpansion = useTableRowExpansion<TType>(options.enableRowExpansion, props.rowExpansionRenderer);\n const rowGoto = useTableRowGoto(options.enableRowGoto, props.onRowGoto);\n const rowGroups = useTableRowGroups(props.rowActionsForGroup);\n const rowHeight = useTableRowHeight(options.enableRowHeight, settings.rowHeight);\n const rowSelection = useTableRowSelection(options.enableRowSelection);\n const search = useTableSearch(options.enableSearch, settings.excludeUnmatchedRecordsInSearch);\n const server = useTableServerLoading(props.loadPage, props.loadAll, props.pageSize);\n\n // TODO: memoise\n // convert jsx column components into valid table columns\n const { columns, ...defaultState } = mapTableChildrenToColumns<TType>(props, settings, options, internalColumns);\n\n // configure initial table state\n const initialState = useReactTableInitialState<TType>(props, columns, settings, defaultState);\n\n // ensure data is always valid\n const data = props.data ?? [];\n const length = props.length ?? data.length;\n\n // create a react-table instance\n const instance = useReactTable<TType>({\n data,\n columns,\n // configure initial table state\n initialState,\n getCoreRowModel: getCoreRowModel<TType>(),\n // configure react-table built-in features\n ...configureReactTableOptions<TType>(options, props),\n // settings that can be toggled by the user, and therefore require our own state\n enableGlobalFilter: search.enableGlobalFilter,\n // custom context\n meta: {\n // spread features from specific implementations\n ...meta,\n columnFreezing,\n columnOrdering,\n fontSize,\n footer,\n length,\n printing,\n rowActions: rowActions as any, // no other way around ReturnType<typeof X> not supporting generics\n rowActive,\n rowClick: rowClick as any, // no other way around ReturnType<typeof X> not supporting generics\n rowDrag,\n rowDrop: rowDrop as any, // no other way around ReturnType<typeof X> not supporting generics\n rowExpansion: rowExpansion as any, // no other way around ReturnType<typeof X> not supporting generics\n rowIdentityColumnId: props.rowIdentityColumnId,\n rowGoto,\n rowGroups: rowGroups as any, // no other way around ReturnType<typeof X> not supporting generics\n rowHeight,\n rowSelection,\n search,\n server,\n } as ReactTableMeta<TType> & TMeta,\n });\n\n // state listeners - we have these so that we don't have to control state outside the table\n useTableDataListener(instance);\n useTableFilterListener(instance, props.onChangeFilter);\n useTableFontSizeListener(instance);\n useTableRowHeightListener(instance);\n useTableRowSelectionListener(instance, props.onRowSelect);\n useTableSearchListener(instance);\n useTableServerLoadingListener(instance, server.loadPage);\n useTableSettingsListener(instance, setSettings);\n useTableShortcutsListener(instance, props.shortcuts);\n useTableSortingListener(instance, props.onChangeSort);\n\n return {\n id: safeId,\n instance,\n meta: (instance.options.meta ?? {}) as ReactTableMeta<TType> & TMeta,\n state: instance.getState(),\n };\n}\n"],"names":["useTableManager","props","meta","internalColumns","safeId","id","replace","options","getTableFeaturePreset","settings","setSettings","useTableSettings","enableSaveSettings","defaultSettings","onChangeSettings","columnFreezing","useTableColumnFreezing","enableColumnFreezing","columnOrdering","useTableColumnOrdering","enableColumnOrdering","fontSize","useTableFontSize","enableFontSize","footer","useTableFooter","enableFooter","printing","useTablePrinting","enablePrinting","rowActive","useTableRowActive","enableRowActive","defaultRowActiveIndex","rowActions","useTableRowActions","enableRowActions","rowActionsLength","rowClick","useTableRowClick","enableRowClick","onRowClick","rowDrag","useTableRowDrag","enableRowDrag","onRowDrag","rowDrop","useTableRowDrop","enableRowDrop","onRowDrop","rowExpansion","useTableRowExpansion","enableRowExpansion","rowExpansionRenderer","rowGoto","useTableRowGoto","enableRowGoto","onRowGoto","rowGroups","useTableRowGroups","rowActionsForGroup","rowHeight","useTableRowHeight","enableRowHeight","rowSelection","useTableRowSelection","enableRowSelection","search","useTableSearch","enableSearch","excludeUnmatchedRecordsInSearch","server","useTableServerLoading","loadPage","loadAll","pageSize","columns","defaultState","mapTableChildrenToColumns","initialState","useReactTableInitialState","data","_props$data","length","_props$length","instance","useReactTable","getCoreRowModel","configureReactTableOptions","enableGlobalFilter","rowIdentityColumnId","useTableDataListener","useTableFilterListener","onChangeFilter","useTableFontSizeListener","useTableRowHeightListener","useTableRowSelectionListener","onRowSelect","useTableSearchListener","useTableServerLoadingListener","useTableSettingsListener","useTableShortcutsListener","shortcuts","useTableSortingListener","onChangeSort","_instance$options$met","state","getState"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SA8FgBA,eAAeA,CAC3BC,KAAwB,EACxBC,IAA6C,EAC7CC,eAAuD;;;EAGvD,MAAMC,MAAM,GAAGH,KAAK,CAACI,EAAE,CAACC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC;;EAEzC,MAAMC,OAAO,GAAGC,qBAAqB,CAACP,KAAK,CAAC;;EAG5C,MAAM,CAACQ,QAAQ,EAAEC,WAAW,CAAC,GAAGC,gBAAgB,CAC5CJ,OAAO,CAACK,kBAAkB,EAC1BR,MAAM,EACNH,KAAK,CAACY,eAAe,EACrBZ,KAAK,CAACa,gBAAgB,CACzB;;EAGD,M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AY,EAAEA,YAAmB;MACjCwC,mBAAmB,EAAEzF,KAAK,CAACyF,mBAAmB;MAC9CpC,OAAO;MACPI,SAAS,EAAEA,SAAgB;MAC3BG,SAAS;MACTG,YAAY;MACZG,MAAM;MACNI;;GAEP,CAAC;;EAGFoB,oBAAoB,CAACN,QAAQ,CAAC;EAC9BO,sBAAsB,CAACP,QAAQ,EAAEpF,KAAK,CAAC4F,cAAc,CAAC;EACtDC,wBAAwB,CAACT,QAAQ,CAAC;EAClCU,yBAAyB,CAACV,QAAQ,CAAC;EACnCW,4BAA4B,CAACX,QAAQ,EAAEpF,KAAK,CAACgG,WAAW,CAAC;EACzDC,sBAAsB,CAACb,QAAQ,CAAC;EAChCc,6BAA6B,CAACd,QAAQ,EAAEd,MAAM,CAACE,QAAQ,CAAC;EACxD2B,wBAAwB,CAACf,QAAQ,EAAE3E,WAAW,CAAC;EAC/C2F,yBAAyB,CAAChB,QAAQ,EAAEpF,KAAK,CAACqG,SAAS,CAAC;EACpDC,uBAAuB,CAAClB,QAAQ,EAAEpF,KAAK,CAACuG,YAAY,CAAC;EAErD,OAAO;IACHnG,EAAE,EAAED,MAAM;IACViF,QAAQ;IACRnF,IAAI,GAAAuG,qBAAA,GAAGpB,QAAQ,CAAC9E,OAAO,CAACL,IAAI,cAAAuG,qBAAA,cAAAA,qBAAA,GAAI,EAAoC;IACpEC,KAAK,EAAErB,QAAQ,CAACsB,QAAQ;GAC3B;AACL;;;;"}
1
+ {"version":3,"file":"useTableManager.js","sources":["../../../../../../../../src/primitives/Table/useTableManager/useTableManager.ts"],"sourcesContent":["import { useReactTable, TableMeta as ReactTableMeta, RowData, getCoreRowModel } from '@tanstack/react-table';\nimport {\n TableColumnAlignment,\n TableColumnClassNameHandler,\n TableColumnDataType,\n TableColumnMenu,\n TableColumnRenderer,\n TableColumnRendererControl,\n TableFilterComparator,\n TableProps,\n} from '../types';\nimport { useReactTableInitialState, configureReactTableOptions, mapTableChildrenToColumns } from './util/setup';\nimport { getTableFeaturePreset } from './util/presets';\nimport { useTableColumnFreezing } from './features/useTableColumnFreezing';\nimport { useTableColumnOrdering } from './features/useTableColumnOrdering';\nimport { useTableFooter } from './features/useTableFooter';\nimport { useTableFontSize } from './features/useTableFontSize';\nimport { useTablePrinting } from './features/useTablePrinting';\nimport { useTableRowActions } from './features/useTableRowActions';\nimport { useTableRowActive } from './features/useTableRowActive';\nimport { useTableRowClick } from './features/useTableRowClick';\nimport { useTableRowExpansion } from './features/useTableRowExpansion';\nimport { useTableRowGoto } from './features/useTableRowGoto';\nimport { useTableRowGroups } from './features/useTableRowGroups';\nimport { useTableRowHeight } from './features/useTableRowHeight';\nimport { useTableRowSelection } from './features/useTableRowSelection';\nimport { useTableSearch } from './features/useTableSearch';\nimport { useTableServerLoading } from './features/useTableServerLoading';\nimport { useTableSettings } from './features/useTableSettings';\nimport { useTableDataListener } from './listeners/useTableDataListener';\nimport { useTableFilterListener } from './listeners/useTableFilterListener';\nimport { useTableFontSizeListener } from './listeners/useTableFontSizeListener';\nimport { useTableRowHeightListener } from './listeners/useTableRowHeightListener';\nimport { useTableRowSelectionListener } from './listeners/useTableRowSelectionListener';\nimport { useTableSearchListener } from './listeners/useTableSearchListener';\nimport { useTableSettingsListener } from './listeners/useTableSettingsListener';\nimport { useTableShortcutsListener } from './listeners/useTableShortcutsListener';\nimport { useTableSortingListener } from './listeners/useTableSortingListener';\nimport { useTableServerLoadingListener } from './listeners/useTableServerLoadingListener';\nimport { useTableManagerInternalColumns } from './types';\nimport { useTableRowDrag } from './features/useTableRowDrag';\nimport { useTableRowDrop } from './features/useTableRowDrop';\n\n/*\n EDITING THIS FILE? READ ME FIRST!\n\n This is a shared, common hook for multiple tables. It's feature set is specifically chosen to support features\n common across those tables. If you are adding a new feature or changing an existing one, before writing any code\n in this file ask yourself the question - is this specific to a given table, or is it common to all of them.\n If you are unsure, ask your team first.\n*/\n\ndeclare module '@tanstack/table-core' {\n interface TableMeta<TData extends RowData> {\n columnFreezing: ReturnType<typeof useTableColumnFreezing>;\n columnOrdering: ReturnType<typeof useTableColumnOrdering>;\n fontSize: ReturnType<typeof useTableFontSize>;\n footer: ReturnType<typeof useTableFooter>;\n length: number;\n printing: ReturnType<typeof useTablePrinting>;\n rowActions: ReturnType<typeof useTableRowActions>;\n rowActive: ReturnType<typeof useTableRowActive>;\n rowClick: ReturnType<typeof useTableRowClick>;\n rowDrag: ReturnType<typeof useTableRowDrag>;\n rowDrop: ReturnType<typeof useTableRowDrop>;\n rowExpansion: ReturnType<typeof useTableRowExpansion>;\n rowGoto: ReturnType<typeof useTableRowGoto>;\n rowGroups: ReturnType<typeof useTableRowGroups>;\n rowHeight: ReturnType<typeof useTableRowHeight>;\n rowIdentityColumnId?: string;\n rowSelection: ReturnType<typeof useTableRowSelection>;\n search: ReturnType<typeof useTableSearch>;\n server: ReturnType<typeof useTableServerLoading>;\n }\n\n interface ColumnMeta<TData extends RowData, TValue> {\n align?: TableColumnAlignment;\n className?: TableColumnClassNameHandler<TData>;\n control?: TableColumnRendererControl<TData>;\n dataType?: TableColumnDataType;\n defaultWidth?: number;\n enableOrdering?: boolean;\n enablePrinting?: boolean;\n enableSearch?: boolean;\n enableTruncate?: boolean;\n filters?: TableFilterComparator[];\n header: string;\n headerClassName?: string;\n menu?: TableColumnMenu;\n renderer?: TableColumnRenderer<TValue, TData>;\n tooltip?: string;\n }\n}\n\nexport function useTableManager<TType = unknown, TMeta = {}>(\n props: TableProps<TType>,\n meta?: Partial<ReactTableMeta<TType>> & TMeta,\n internalColumns?: useTableManagerInternalColumns<TType>\n) {\n // CSS.escape would be best here, but it doesn't seem to work very well\n const safeId = props.id.replace('.', '_');\n // configure table options, merging props with presets\n const options = getTableFeaturePreset(props);\n\n // load any persisted table settings and merge them with any defaults\n const [settings, setSettings] = useTableSettings(\n options.enableSaveSettings,\n safeId,\n props.defaultSettings,\n props.onChangeSettings\n );\n\n // configure common custom features\n const columnFreezing = useTableColumnFreezing(options.enableColumnFreezing);\n const columnOrdering = useTableColumnOrdering(options.enableColumnOrdering);\n const fontSize = useTableFontSize(options.enableFontSize, settings.fontSize);\n const footer = useTableFooter(options.enableFooter);\n const printing = useTablePrinting(options.enablePrinting, safeId);\n const rowActive = useTableRowActive(options.enableRowActive, props.defaultRowActiveIndex);\n const rowActions = useTableRowActions<TType>(options.enableRowActions, props.rowActions, props.rowActionsLength);\n const rowClick = useTableRowClick<TType>(options.enableRowClick, props.onRowClick);\n const rowDrag = useTableRowDrag<TType>(options.enableRowDrag, props.onRowDrag);\n const rowDrop = useTableRowDrop<TType>(options.enableRowDrop, props.onRowDrop);\n const rowExpansion = useTableRowExpansion<TType>(options.enableRowExpansion, props.rowExpansionRenderer);\n const rowGoto = useTableRowGoto(options.enableRowGoto, props.onRowGoto);\n const rowGroups = useTableRowGroups(props.rowActionsForGroup);\n const rowHeight = useTableRowHeight(options.enableRowHeight, settings.rowHeight);\n const rowSelection = useTableRowSelection(options.enableRowSelection);\n const search = useTableSearch(options.enableSearch, settings.excludeUnmatchedRecordsInSearch);\n const server = useTableServerLoading(props.loadPage, props.loadAll, props.pageSize);\n\n // TODO: memoise\n // convert jsx column components into valid table columns\n const { columns, ...defaultState } = mapTableChildrenToColumns<TType>(props, settings, options, internalColumns);\n\n // configure initial table state\n const initialState = useReactTableInitialState<TType>(props, columns, settings, defaultState);\n\n // ensure data is always valid\n const data = props.data ?? [];\n const length = props.length ?? data.length;\n\n // create a react-table instance\n const instance = useReactTable<TType>({\n data,\n columns,\n // configure initial table state\n initialState,\n getCoreRowModel: getCoreRowModel<TType>(),\n // configure react-table built-in features\n ...configureReactTableOptions<TType>(options, props),\n // settings that can be toggled by the user, and therefore require our own state\n enableGlobalFilter: search.enableGlobalFilter,\n // custom context\n meta: {\n // spread features from specific implementations\n ...meta,\n columnFreezing,\n columnOrdering,\n fontSize,\n footer,\n length,\n printing,\n rowActions: rowActions as any, // no other way around ReturnType<typeof X> not supporting generics\n rowActive,\n rowClick: rowClick as any, // no other way around ReturnType<typeof X> not supporting generics\n rowDrag,\n rowDrop: rowDrop as any, // no other way around ReturnType<typeof X> not supporting generics\n rowExpansion: rowExpansion as any, // no other way around ReturnType<typeof X> not supporting generics\n rowIdentityColumnId: props.rowIdentityColumnId,\n rowGoto,\n rowGroups: rowGroups as any, // no other way around ReturnType<typeof X> not supporting generics\n rowHeight,\n rowSelection,\n search,\n server,\n } as ReactTableMeta<TType> & TMeta,\n });\n\n // state listeners - we have these so that we don't have to control state outside the table\n useTableDataListener(instance);\n useTableFilterListener(instance, props.onChangeFilter);\n useTableFontSizeListener(instance);\n useTableRowHeightListener(instance);\n useTableRowSelectionListener(instance, props.onRowSelect);\n useTableSearchListener(instance, props.onChangeSearch);\n useTableServerLoadingListener(instance, server.loadPage);\n useTableSettingsListener(instance, setSettings);\n useTableShortcutsListener(instance, props.shortcuts);\n useTableSortingListener(instance, props.onChangeSort);\n\n return {\n id: safeId,\n instance,\n meta: (instance.options.meta ?? {}) as ReactTableMeta<TType> & TMeta,\n state: instance.getState(),\n };\n}\n"],"names":["useTableManager","props","meta","internalColumns","safeId","id","replace","options","getTableFeaturePreset","settings","setSettings","useTableSettings","enableSaveSettings","defaultSettings","onChangeSettings","columnFreezing","useTableColumnFreezing","enableColumnFreezing","columnOrdering","useTableColumnOrdering","enableColumnOrdering","fontSize","useTableFontSize","enableFontSize","footer","useTableFooter","enableFooter","printing","useTablePrinting","enablePrinting","rowActive","useTableRowActive","enableRowActive","defaultRowActiveIndex","rowActions","useTableRowActions","enableRowActions","rowActionsLength","rowClick","useTableRowClick","enableRowClick","onRowClick","rowDrag","useTableRowDrag","enableRowDrag","onRowDrag","rowDrop","useTableRowDrop","enableRowDrop","onRowDrop","rowExpansion","useTableRowExpansion","enableRowExpansion","rowExpansionRenderer","rowGoto","useTableRowGoto","enableRowGoto","onRowGoto","rowGroups","useTableRowGroups","rowActionsForGroup","rowHeight","useTableRowHeight","enableRowHeight","rowSelection","useTableRowSelection","enableRowSelection","search","useTableSearch","enableSearch","excludeUnmatchedRecordsInSearch","server","useTableServerLoading","loadPage","loadAll","pageSize","columns","defaultState","mapTableChildrenToColumns","initialState","useReactTableInitialState","data","_props$data","length","_props$length","instance","useReactTable","getCoreRowModel","configureReactTableOptions","enableGlobalFilter","rowIdentityColumnId","useTableDataListener","useTableFilterListener","onChangeFilter","useTableFontSizeListener","useTableRowHeightListener","useTableRowSelectionListener","onRowSelect","useTableSearchListener","onChangeSearch","useTableServerLoadingListener","useTableSettingsListener","useTableShortcutsListener","shortcuts","useTableSortingListener","onChangeSort","_instance$options$met","state","getState"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SA8FgBA,eAAeA,CAC3BC,KAAwB,EACxBC,IAA6C,EAC7CC,eAAuD;;;EAGvD,MAAMC,MAAM,GAAGH,KAAK,CAACI,EAAE,CAACC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC;;EAEzC,MAAMC,OAAO,GAAGC,qBAAqB,CAACP,KAAK,CAAC;;EAG5C,MAAM,CAACQ,QAAQ,EAAEC,WAAW,CAAC,GAAGC,gBAAgB,CAC5CJ,OAAO,CAACK,kBAAkB,EAC1BR,MAAM,EACNH,KAAK,CAACY,eAAe,EACrBZ,KAAK,CAACa,gBAAgB,CACzB;;EAGD,MAAMC,cAAc,GAAGC,sBAAsB,CAACT,OAAO,CAACU,oBAAoB,CAAC;EAC3E,MAAMC,cAAc,GAAGC,sBAAsB,CAACZ,OAAO,CAACa,oBAAoB,CAAC;EAC3E,MAAMC,QAAQ,GAAGC,gBAAgB,CAACf,OAAO,CAACgB,cAAc,EAAEd,QAAQ,CAACY,QAAQ,CAAC;EAC5E,MAAMG,MAAM,GAAGC,cAAc,CAAClB,OAAO,CAACmB,YAAY,CAAC;EACnD,MAAMC,QAAQ,GAAGC,gBAAgB,CAACrB,OAAO,CAACsB,cAAc,EAAEzB,MAAM,CAAC;EACjE,MAAM0B,SAAS,GAAGC,iBAAiB,CAACxB,OAAO,CAACyB,eAAe,EAAE/B,KAAK,CAACgC,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C;EACtDC,6BAA6B,CAACf,QAAQ,EAAEd,MAAM,CAACE,QAAQ,CAAC;EACxD4B,wBAAwB,CAAChB,QAAQ,EAAE3E,WAAW,CAAC;EAC/C4F,yBAAyB,CAACjB,QAAQ,EAAEpF,KAAK,CAACsG,SAAS,CAAC;EACpDC,uBAAuB,CAACnB,QAAQ,EAAEpF,KAAK,CAACwG,YAAY,CAAC;EAErD,OAAO;IACHpG,EAAE,EAAED,MAAM;IACViF,QAAQ;IACRnF,IAAI,GAAAwG,qBAAA,GAAGrB,QAAQ,CAAC9E,OAAO,CAACL,IAAI,cAAAwG,qBAAA,cAAAA,qBAAA,GAAI,EAAoC;IACpEC,KAAK,EAAEtB,QAAQ,CAACuB,QAAQ;GAC3B;AACL;;;;"}
@@ -3,7 +3,6 @@ import { ColumnFilter as ReactTableColumnFilter, ColumnFiltersState as ReactTabl
3
3
  import { FontSize, FontSizes, ValueOf } from '../../types';
4
4
  import { MenuProps } from '../../components/Menu/Menu';
5
5
  import { MenuItemProps } from '../../components/Menu/components/Item';
6
- declare type TODO = any;
7
6
  export declare type TableRef = HTMLTableElement & {
8
7
  instance: {
9
8
  resetFiltering: () => void;
@@ -81,15 +80,16 @@ export declare type TableShortcutHandlerObject<TType = unknown> = {
81
80
  meta?: boolean;
82
81
  shift?: boolean;
83
82
  };
84
- export declare type TableFilterHandler = (filters: TableColumnFilter[]) => void;
83
+ export declare type TableFilterHandler = (filters: TableColumnFilter[]) => void | Promise<void>;
85
84
  export declare type TableFontSize = keyof typeof FontSizes;
86
85
  export declare type TablePreset = 'complex' | 'list' | 'simple';
87
86
  export declare type TableRowExpansionRenderer<TType = unknown> = (row: TType) => (() => JSX.Element) | null;
88
87
  export declare type TableScrollToIndexHandler = (index: number, options?: {
89
88
  align: 'start' | 'center' | 'end' | 'auto';
90
89
  }) => void;
91
- export declare type TableServerLoadPageHandler = (pageIndex: number, sorting: TableColumnSort[], filters: TableColumnFilter[], search: string | undefined) => Promise<void>;
92
- export declare type TableServerLoadAllHandler = (sorting: TableColumnSort[], filters: TableColumnFilter[], search: string | undefined) => Promise<void>;
90
+ export declare type TableSearchHandler = (search: string | undefined) => void | Promise<void>;
91
+ export declare type TableServerLoadPageHandler = (pageIndex: number, sorting: TableColumnSort[], filters: TableColumnFilter[]) => Promise<void>;
92
+ export declare type TableServerLoadAllHandler = (sorting: TableColumnSort[], filters: TableColumnFilter[]) => Promise<void>;
93
93
  export declare enum TableServerLoadAllState {
94
94
  Incomplete = 0,
95
95
  Loading = 1,
@@ -97,7 +97,7 @@ export declare enum TableServerLoadAllState {
97
97
  }
98
98
  export declare type TableSettingsHandler = (settings: TableSettings) => void | Promise<void>;
99
99
  export declare type TableShortcuts<TType = unknown> = Record<string, TableShortcutHandlerFn<TType> | TableShortcutHandlerObject<TType>>;
100
- export declare type TableSortHandler = (sorting: TableColumnSort[]) => void;
100
+ export declare type TableSortHandler = (sorting: TableColumnSort[]) => void | Promise<void>;
101
101
  export declare type TableCustomSettingsRenderer = (props: TableSettings) => React.ReactElement<MenuItemProps>[];
102
102
  export declare type TableEmptyStateRenderer = () => JSX.Element | null;
103
103
  export declare type TableSettings = {
@@ -172,7 +172,7 @@ export declare type TableCommonProps<TType = unknown> = TableFeatureProps & {
172
172
  onRowGoto?: TableRowGotoHandler;
173
173
  onRowSelect?: TableRowSelectHandler<TType>;
174
174
  onChangeFilter?: TableFilterHandler;
175
- onChangeSearch?: TODO;
175
+ onChangeSearch?: TableSearchHandler;
176
176
  onChangeSettings?: TableSettingsHandler;
177
177
  onChangeSort?: TableSortHandler;
178
178
  };
@@ -374,4 +374,3 @@ export declare type TableTexts = {
374
374
  tooltip: string;
375
375
  };
376
376
  };
377
- export {};
@@ -1,10 +1,10 @@
1
- import { TableColumnFilter, TableColumnSort, TableFilterHandler, TableServerLoadPageHandler, TableServerLoadAllHandler, TableSortHandler } from './types';
1
+ import { TableColumnFilter, TableColumnSort, TableFilterHandler, TableServerLoadPageHandler, TableServerLoadAllHandler, TableSortHandler, TableSearchHandler } from './types';
2
2
  export declare const DEFAULT_PAGE_SIZE = 100;
3
- export declare type useTableDataPageFetcher<TType = unknown> = (pageIndex: number, pageSize: number, sorting: TableColumnSort[], filters: TableColumnFilter[], search: string | undefined) => Promise<{
3
+ export declare type useTableDataPageFetcher<TType = unknown> = (pageIndex: number, pageSize: number, sorting: TableColumnSort[], filters: TableColumnFilter[]) => Promise<{
4
4
  data: TType[];
5
5
  length: number;
6
6
  }>;
7
- export declare type useTableDataAllFetcher<TType = unknown> = (sorting: TableColumnSort[], filters: TableColumnFilter[], search: string | undefined) => Promise<{
7
+ export declare type useTableDataAllFetcher<TType = unknown> = (sorting: TableColumnSort[], filters: TableColumnFilter[]) => Promise<{
8
8
  data: TType[];
9
9
  length: number;
10
10
  }>;
@@ -17,7 +17,8 @@ export declare type useTableDataLoaderValues<TType = unknown> = {
17
17
  loadAll: TableServerLoadAllHandler;
18
18
  loadPage: TableServerLoadPageHandler;
19
19
  onChangeFilter: TableFilterHandler;
20
+ onChangeSearch: TableSearchHandler;
20
21
  onChangeSort: TableSortHandler;
21
22
  pageSize: number;
22
23
  };
23
- export declare function useTableDataLoader<TType = unknown>(fetch: useTableDataPageFetcher<TType>, fetchAll: useTableDataAllFetcher<TType>, options?: useTableDataLoaderOptions): [useTableDataLoaderValues<TType>, () => void];
24
+ export declare function useTableDataLoader<TType = unknown>(fetchPage: useTableDataPageFetcher<TType>, fetchAll: useTableDataAllFetcher<TType>, options?: useTableDataLoaderOptions): [useTableDataLoaderValues<TType>, () => void];
@@ -1,2 +1,3 @@
1
1
  import { Table as ReactTable } from '@tanstack/react-table';
2
- export declare function useTableSearchListener<TType = unknown>(table: ReactTable<TType>): void;
2
+ import { TableSearchHandler } from '../../types';
3
+ export declare function useTableSearchListener<TType = unknown>(table: ReactTable<TType>, onChangeSearch?: TableSearchHandler): void;
@@ -10638,7 +10638,7 @@ function _finallyRethrows(body, finalizer) {
10638
10638
  }
10639
10639
 
10640
10640
  const DEFAULT_PAGE_SIZE = 100;
10641
- function useTableDataLoader(fetch, fetchAll, options = {
10641
+ function useTableDataLoader(fetchPage, fetchAll, options = {
10642
10642
  pageSize: DEFAULT_PAGE_SIZE
10643
10643
  }) {
10644
10644
  const {
@@ -10654,11 +10654,11 @@ function useTableDataLoader(fetch, fetchAll, options = {
10654
10654
  const _lastUsedFilters = React__default.useRef([]);
10655
10655
  const _lastUsedSearch = React__default.useRef();
10656
10656
  const _forceReset = React__default.useRef(false);
10657
- const loadPage = function (pageIndex, sorting, filters, search) {
10657
+ const loadPage = function (pageIndex, sorting, filters) {
10658
10658
  try {
10659
10659
  let reset = false;
10660
10660
  // sorting or filters changed, reset everything
10661
- if (_forceReset.current || search !== _lastUsedSearch.current || JSON.stringify(sorting) !== JSON.stringify(_lastUsedSorting.current) || JSON.stringify(filters) !== JSON.stringify(_lastUsedFilters.current)) {
10661
+ if (_forceReset.current || JSON.stringify(sorting) !== JSON.stringify(_lastUsedSorting.current) || JSON.stringify(filters) !== JSON.stringify(_lastUsedFilters.current)) {
10662
10662
  _pendingPageRequests.current = {};
10663
10663
  // nuke the dataset so that we "start again" after sorting
10664
10664
  reset = true;
@@ -10674,11 +10674,9 @@ function useTableDataLoader(fetch, fetchAll, options = {
10674
10674
  _lastUsedSorting.current = sorting;
10675
10675
  // set the filters so we can track if it changed between loads
10676
10676
  _lastUsedFilters.current = filters;
10677
- // set the search so we can track if it changed between loads
10678
- _lastUsedSearch.current = search;
10679
10677
  const _temp = _finallyRethrows(function () {
10680
10678
  return _catch(function () {
10681
- return Promise.resolve(fetch(pageIndex, pageSize, sorting, filters, search)).then(function (response) {
10679
+ return Promise.resolve(fetchPage(pageIndex, pageSize, sorting, filters)).then(function (response) {
10682
10680
  // update state, here we do some "magic" to support "load in place"
10683
10681
  setData(currentData => {
10684
10682
  let nextData;
@@ -10707,10 +10705,14 @@ function useTableDataLoader(fetch, fetchAll, options = {
10707
10705
  return Promise.reject(e);
10708
10706
  }
10709
10707
  };
10710
- const loadAll = function (sorting, filters, search) {
10708
+ const loadAll = function (sorting, filters) {
10711
10709
  try {
10710
+ // set the sorting so we can track if it changed between loads
10711
+ _lastUsedSorting.current = sorting;
10712
+ // set the filters so we can track if it changed between loads
10713
+ _lastUsedFilters.current = filters;
10712
10714
  const _temp2 = _catch(function () {
10713
- return Promise.resolve(fetchAll(sorting, filters, search)).then(function (response) {
10715
+ return Promise.resolve(fetchAll(sorting, filters)).then(function (response) {
10714
10716
  length.current = response.length;
10715
10717
  setData(() => {
10716
10718
  let nextData;
@@ -10732,22 +10734,52 @@ function useTableDataLoader(fetch, fetchAll, options = {
10732
10734
  const invalidate = function () {
10733
10735
  try {
10734
10736
  _forceReset.current = true;
10735
- return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current, _lastUsedSearch.current);
10737
+ return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current);
10736
10738
  } catch (e) {
10737
10739
  return Promise.reject(e);
10738
10740
  }
10739
10741
  };
10740
- // we reset the page to 0 whenever sorting, filtering or search changes
10742
+ // search works client side - it fetches all then works client side - so these handlers are a little "weird"
10743
+ // if a search is currently "active", we need to re load all because
10741
10744
  const handleSort = function (sorting) {
10742
10745
  try {
10743
- return loadPage(0, sorting, _lastUsedFilters.current, _lastUsedSearch.current);
10746
+ // set the sorting so we can track if it changed between loads
10747
+ _lastUsedSorting.current = sorting;
10748
+ if (_lastUsedSearch.current) {
10749
+ // we're searching, which means we need to refetch all with the correct sorting applied
10750
+ loadAll(sorting, _lastUsedFilters.current);
10751
+ } else {
10752
+ // reset the page to 0 whenever sorting
10753
+ loadPage(0, sorting, _lastUsedFilters.current);
10754
+ }
10755
+ return Promise.resolve();
10744
10756
  } catch (e) {
10745
10757
  return Promise.reject(e);
10746
10758
  }
10747
10759
  };
10748
10760
  const handleFilter = function (filters) {
10749
10761
  try {
10750
- return loadPage(0, _lastUsedSorting.current, filters, _lastUsedSearch.current);
10762
+ // set the filters so we can track if it changed between loads
10763
+ _lastUsedFilters.current = filters;
10764
+ if (_lastUsedSearch.current) {
10765
+ // we're searching, which means we need to refetch all with the correct sorting applied
10766
+ loadAll(_lastUsedSorting.current, filters);
10767
+ } else {
10768
+ // reset the page to 0 whenever sorting
10769
+ loadPage(0, _lastUsedSorting.current, filters);
10770
+ }
10771
+ return Promise.resolve();
10772
+ } catch (e) {
10773
+ return Promise.reject(e);
10774
+ }
10775
+ };
10776
+ const handleSearch = function (search) {
10777
+ try {
10778
+ // set the search so we can track if it changed between loads
10779
+ _lastUsedSearch.current = search || undefined;
10780
+ // search works client side, and focusing the search field triggers a load of all so we don't actually
10781
+ // want to load anything when search gets changed, we just store the value for other handlers
10782
+ return Promise.resolve();
10751
10783
  } catch (e) {
10752
10784
  return Promise.reject(e);
10753
10785
  }
@@ -10758,6 +10790,7 @@ function useTableDataLoader(fetch, fetchAll, options = {
10758
10790
  loadAll,
10759
10791
  loadPage,
10760
10792
  onChangeFilter: handleFilter,
10793
+ onChangeSearch: handleSearch,
10761
10794
  onChangeSort: handleSort,
10762
10795
  pageSize
10763
10796
  }, invalidate];
@@ -11048,14 +11081,18 @@ function resetHighlightedColumnIndexes(value, table) {
11048
11081
  return firstRowIndex;
11049
11082
  }
11050
11083
 
11051
- function useTableSearchListener(table) {
11084
+ function useTableSearchListener(table, onChangeSearch) {
11052
11085
  const meta = table.options.meta;
11053
11086
  // recalculates highlighted indexes whenever something important changes
11054
11087
  React__default.useEffect(() => {
11055
11088
  if (meta.search.isEnabled) {
11056
- resetHighlightedColumnIndexes(table.getState().globalFilter, table);
11089
+ const query = table.getState().globalFilter;
11090
+ resetHighlightedColumnIndexes(query, table);
11091
+ if (typeof onChangeSearch === 'function') {
11092
+ onChangeSearch(query);
11093
+ }
11057
11094
  }
11058
- }, [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)]);
11095
+ }, [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), onChangeSearch]);
11059
11096
  }
11060
11097
 
11061
11098
  function useTableSettingsListener(table, onChangeSettings) {
@@ -11141,11 +11178,10 @@ function useTableSortingListener(table, onSort) {
11141
11178
  function useTableServerLoadingListener(table, loadPage) {
11142
11179
  const sorting = table.getState().sorting;
11143
11180
  const columnFilters = table.getState().columnFilters;
11144
- const search = table.getState().globalFilter;
11145
11181
  // trigger load of the first page on mount
11146
11182
  React__default.useEffect(() => {
11147
11183
  if (loadPage) {
11148
- loadPage(0, sorting, columnFilters, search);
11184
+ loadPage(0, sorting, columnFilters);
11149
11185
  }
11150
11186
  }, []);
11151
11187
  }
@@ -11246,7 +11282,7 @@ function useTableManager(props, meta, internalColumns) {
11246
11282
  useTableFontSizeListener(instance);
11247
11283
  useTableRowHeightListener(instance);
11248
11284
  useTableRowSelectionListener(instance, props.onRowSelect);
11249
- useTableSearchListener(instance);
11285
+ useTableSearchListener(instance, props.onChangeSearch);
11250
11286
  useTableServerLoadingListener(instance, server.loadPage);
11251
11287
  useTableSettingsListener(instance, setSettings);
11252
11288
  useTableShortcutsListener(instance, props.shortcuts);
@@ -11544,7 +11580,7 @@ function RowWithServerLoading(props) {
11544
11580
  React__default.useEffect(() => {
11545
11581
  if (inView) {
11546
11582
  var _tableMeta$server$loa, _tableMeta$server;
11547
- (_tableMeta$server$loa = (_tableMeta$server = tableMeta.server).loadPage) === null || _tableMeta$server$loa === void 0 ? void 0 : _tableMeta$server$loa.call(_tableMeta$server, pageIndex, table.getState().sorting, table.getState().columnFilters, table.getState().globalFilter);
11583
+ (_tableMeta$server$loa = (_tableMeta$server = tableMeta.server).loadPage) === null || _tableMeta$server$loa === void 0 ? void 0 : _tableMeta$server$loa.call(_tableMeta$server, pageIndex, table.getState().sorting, table.getState().columnFilters);
11548
11584
  }
11549
11585
  }, [inView]);
11550
11586
  const groupedCellCount = (_table$getState$group = (_table$getState = table.getState()) === null || _table$getState === void 0 ? void 0 : _table$getState.grouping.length) !== null && _table$getState$group !== void 0 ? _table$getState$group : 0;
@@ -12014,7 +12050,7 @@ function Header$4(context) {
12014
12050
  const _temp = function () {
12015
12051
  if (tableMeta.server.loadAllIfNeeded) {
12016
12052
  // don't pass the search query because we need all data - not filtered data
12017
- return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {});
12053
+ return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
12018
12054
  }
12019
12055
  }();
12020
12056
  // load all data if that is possible
@@ -12088,7 +12124,7 @@ function Cell$3(context) {
12088
12124
  const _temp3 = function () {
12089
12125
  if (tableMeta.server.loadAllIfNeeded && selectedRows.some(row => row.original === undefined)) {
12090
12126
  // don't pass the search query because we need all data - not filtered data
12091
- return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {});
12127
+ return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
12092
12128
  }
12093
12129
  }();
12094
12130
  return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
@@ -13439,7 +13475,7 @@ function Search$1(props) {
13439
13475
  const _temp = function () {
13440
13476
  if (tableMeta.server.loadAllIfNeeded) {
13441
13477
  // don't pass the search query because we need all data - not filtered data
13442
- return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {});
13478
+ return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
13443
13479
  }
13444
13480
  }();
13445
13481
  // load all data if that is possible
@@ -15487,7 +15523,7 @@ function Print$1(props) {
15487
15523
  const _temp2 = function () {
15488
15524
  if (tableMeta.server.isEnabled && tableMeta.server.loadAllIfNeeded) {
15489
15525
  const _temp = _catch(function () {
15490
- return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {});
15526
+ return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
15491
15527
  }, function (error) {
15492
15528
  const errorMessage = `${texts.table.print.error}: ${error}`;
15493
15529
  console.error(errorMessage);