@economic/taco 2.30.0 → 2.30.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +4 -5
  2. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
  3. package/dist/esm/packages/taco/src/components/Menu/components/Trigger.js +9 -7
  4. package/dist/esm/packages/taco/src/components/Menu/components/Trigger.js.map +1 -1
  5. package/dist/esm/packages/taco/src/components/Select2/Select2.js +3 -1
  6. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  7. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js +2 -2
  8. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js.map +1 -1
  9. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js +1 -1
  10. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js.map +1 -1
  11. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js +1 -1
  12. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js.map +1 -1
  13. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js +1 -1
  14. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js.map +1 -1
  15. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +5 -4
  16. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
  17. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  18. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js +45 -12
  19. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
  20. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js +5 -5
  21. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js.map +1 -1
  22. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js +7 -3
  23. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js.map +1 -1
  24. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js +1 -2
  25. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js.map +1 -1
  26. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +1 -1
  27. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
  28. package/dist/esm/packages/taco/src/utils/dom.js +4 -1
  29. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  30. package/dist/primitives/Table/types.d.ts +6 -7
  31. package/dist/primitives/Table/useTableDataLoader.d.ts +5 -4
  32. package/dist/primitives/Table/useTableManager/listeners/useTableSearchListener.d.ts +2 -1
  33. package/dist/taco.cjs.development.js +85 -44
  34. package/dist/taco.cjs.development.js.map +1 -1
  35. package/dist/taco.cjs.production.min.js +1 -1
  36. package/dist/taco.cjs.production.min.js.map +1 -1
  37. package/dist/utils/dom.d.ts +1 -0
  38. 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,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,qBAAqB,CAAC;EACzF,MAAMC,UAAU,GAAGC,kBAAkB,CAAQ5B,OAAO,CAAC6B,gBAAgB,EAAEnC,KAAK,CAACiC,UAAU,EAAEjC,KAAK,CAACoC,gBAAgB,CAAC;EACh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AC;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,MAA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AAQ;MACRG,MAAM;MACN2D,MAAM;MACNxD,QAAQ;MACRO,UAAU,EAAEA,UAAiB;MAC7BJ,SAAS;MACTQ,QAAQ,EAAEA,QAAe;MACzBI,OAAO;MACPI,OAAO,EAAEA,OAAc;MACvBI,YAAY,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,EAAEpF,KAAK,CAACkG,cAAc,CAAC;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;;;;"}
@@ -72,6 +72,9 @@ function isElementInteractive(element) {
72
72
  }
73
73
  return ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT', 'LABEL', 'OPTION'].includes(element.tagName) && !element.hidden && !element.disabled && !element.readOnly;
74
74
  }
75
+ function isElementInsideTable3OrReport(element) {
76
+ return !!(element !== null && element !== void 0 && element.closest('[data-taco^=table]'));
77
+ }
75
78
 
76
- export { getIndexOfFirstChildOverflowingParent, getNextFocussableElement, hasFocusableElement, isElementInsideOrTriggeredFromContainer, isElementInsideOverlay, isElementInteractive, isSiblingElementInsideSameParentOverlay };
79
+ export { getIndexOfFirstChildOverflowingParent, getNextFocussableElement, hasFocusableElement, isElementInsideOrTriggeredFromContainer, isElementInsideOverlay, isElementInsideTable3OrReport, isElementInteractive, isSiblingElementInsideSameParentOverlay };
77
80
  //# sourceMappingURL=dom.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dom.js","sources":["../../../../../../src/utils/dom.ts"],"sourcesContent":["// taken from react-aria\nconst FOCUSABLE_ELEMENTS = [\n 'input:not([disabled]):not([type=hidden])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n 'button:not([disabled])',\n 'a[href]',\n 'area[href]',\n 'summary',\n 'iframe',\n 'object',\n 'embed',\n 'audio[controls]',\n 'video[controls]',\n '[contenteditable]',\n '[tabindex]:not([tabindex=\"-1\"]):not([disabled])',\n 'details:not([disabled])',\n 'summary:not(:disabled)',\n];\n\nexport const hasFocusableElement = (element: HTMLElement | null) => {\n if (!element) {\n return null;\n }\n\n return !!element.querySelector(FOCUSABLE_ELEMENTS.join(','));\n};\n\nexport const isOverflowing = (element: HTMLElement | null) =>\n element !== null ? element.scrollWidth > element.offsetWidth : false;\n\nexport const getIndexOfFirstChildOverflowingParent = (element: HTMLElement, overscan = 0) => {\n let index = 0;\n let boundaryChildIndex: number | null = null;\n const clientRect = element.getBoundingClientRect();\n\n for (const child of Array.from(element.children)) {\n const right = child.getBoundingClientRect().right - clientRect.left;\n const width = clientRect.width - overscan;\n\n if (right > width) {\n boundaryChildIndex = index;\n break;\n }\n index++;\n }\n\n return boundaryChildIndex;\n};\n\nexport const getNextFocussableElement = (currentElement: HTMLElement | null) => {\n if (!currentElement) {\n return null;\n }\n\n const focussableElements = [...document.querySelectorAll<HTMLElement>(FOCUSABLE_ELEMENTS.join(','))];\n const currentElementIndex = focussableElements.indexOf(currentElement);\n\n // If the currentElement is not in the focussable elements list or it is the last element\n if (currentElementIndex !== -1 && currentElementIndex === focussableElements.length - 1) {\n return null;\n }\n\n return focussableElements[currentElementIndex + 1];\n};\n\nconst getOverlaySelector = (element: Element | null) => {\n switch (element?.getAttribute('role')) {\n case 'dialog':\n return `[aria-controls='${element.id}']`;\n\n case 'menu':\n return `#${element.getAttribute('aria-labelledby')}`;\n\n default:\n return undefined;\n }\n};\n\nexport function isElementInsideOrTriggeredFromContainer(element: Element | null, container: Element | null) {\n const selector = getOverlaySelector(element) ?? getOverlaySelector(element?.closest('[role=dialog],[role=menu]') ?? null);\n\n if (selector) {\n if (container?.querySelector(selector)) {\n return true;\n }\n\n const elementInDocument = document.querySelector(selector);\n\n // if the element does exist, see if it is itself connected to somethng that was triggered from the container\n if (elementInDocument) {\n return isElementInsideOrTriggeredFromContainer(elementInDocument, container);\n }\n\n return false;\n }\n\n return !!container?.contains(element);\n}\n\nexport function isElementInsideOverlay(element: Element | null) {\n return !!element?.closest('[role=dialog],[role=menu]');\n}\n\nexport function isSiblingElementInsideSameParentOverlay(element: Element | null, sibling: Element | null) {\n return !!element?.closest('[role=dialog],[role=menu]')?.contains(sibling);\n}\n\nexport function isElementInteractive(element: Element | null) {\n if (!element) {\n return false;\n }\n\n return (\n ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT', 'LABEL', 'OPTION'].includes(element.tagName) &&\n !(element as HTMLElement).hidden &&\n !(element as HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | HTMLButtonElement).disabled &&\n !(element as HTMLInputElement | HTMLTextAreaElement).readOnly\n );\n}\n"],"names":["FOCUSABLE_ELEMENTS","hasFocusableElement","element","querySelector","join","getIndexOfFirstChildOverflowingParent","overscan","index","boundaryChildIndex","clientRect","getBoundingClientRect","child","Array","from","children","right","left","width","getNextFocussableElement","currentElement","focussableElements","document","querySelectorAll","currentElementIndex","indexOf","length","getOverlaySelector","getAttribute","id","undefined","isElementInsideOrTriggeredFromContainer","container","selector","_getOverlaySelector","_element$closest","closest","elementInDocument","contains","isElementInsideOverlay","isSiblingElementInsideSameParentOverlay","sibling","_element$closest2","isElementInteractive","includes","tagName","hidden","disabled","readOnly"],"mappings":"AAAA;AACA,MAAMA,kBAAkB,GAAG,CACvB,0CAA0C,EAC1C,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,SAAS,EACT,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,iDAAiD,EACjD,yBAAyB,EACzB,wBAAwB,CAC3B;MAEYC,mBAAmB,GAAIC,OAA2B;EAC3D,IAAI,CAACA,OAAO,EAAE;IACV,OAAO,IAAI;;EAGf,OAAO,CAAC,CAACA,OAAO,CAACC,aAAa,CAACH,kBAAkB,CAACI,IAAI,CAAC,GAAG,CAAC,CAAC;AAChE;MAKaC,qCAAqC,GAAGA,CAACH,OAAoB,EAAEI,QAAQ,GAAG,CAAC;EACpF,IAAIC,KAAK,GAAG,CAAC;EACb,IAAIC,kBAAkB,GAAkB,IAAI;EAC5C,MAAMC,UAAU,GAAGP,OAAO,CAACQ,qBAAqB,EAAE;EAElD,KAAK,MAAMC,KAAK,IAAIC,KAAK,CAACC,IAAI,CAACX,OAAO,CAACY,QAAQ,CAAC,EAAE;IAC9C,MAAMC,KAAK,GAAGJ,KAAK,CAACD,qBAAqB,EAAE,CAACK,KAAK,GAAGN,UAAU,CAACO,IAAI;IACnE,MAAMC,KAAK,GAAGR,UAAU,CAACQ,KAAK,GAAGX,QAAQ;IAEzC,IAAIS,KAAK,GAAGE,KAAK,EAAE;MACfT,kBAAkB,GAAGD,KAAK;MAC1B;;IAEJA,KAAK,EAAE;;EAGX,OAAOC,kBAAkB;AAC7B;MAEaU,wBA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D,IAAII,iBAAiB,EAAE;MACnB,OAAON,uCAAuC,CAACM,iBAAiB,EAAEL,SAAS,CAAC;;IAGhF,OAAO,KAAK;;EAGhB,OAAO,CAAC,EAACA,SAAS,aAATA,SAAS,eAATA,SAAS,CAAEM,QAAQ,CAACnC,OAAO,CAAC;AACzC;SAEgBoC,sBAAsBA,CAACpC,OAAuB;EAC1D,OAAO,CAAC,EAACA,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEiC,OAAO,CAAC,2BAA2B,CAAC;AAC1D;SAEgBI,uCAAuCA,CAACrC,OAAuB,EAAEsC,OAAuB;;EACpG,OAAO,CAAC,EAACtC,OAAO,aAAPA,OAAO,gBAAAuC,iBAAA,GAAPvC,OAAO,CAAEiC,OAAO,CAAC,2BAA2B,CAAC,cAAAM,iBAAA,eAA7CA,iBAAA,CAA+CJ,QAAQ,CAACG,OAAO,CAAC;AAC7E;SAEgBE,oBAAoBA,CAACxC,OAAuB;EACxD,IAAI,CAACA,OAAO,EAAE;IACV,OAAO,KAAK;;EAGhB,OACI,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAACyC,QAAQ,CAACzC,OAAO,CAAC0C,OAAO,CAAC,IAC3F,CAAE1C,OAAuB,CAAC2C,MAAM,IAChC,CAAE3C,OAA0F,CAAC4C,QAAQ,IACrG,CAAE5C,OAAkD,CAAC6C,QAAQ;AAErE;;;;"}
1
+ {"version":3,"file":"dom.js","sources":["../../../../../../src/utils/dom.ts"],"sourcesContent":["// taken from react-aria\nconst FOCUSABLE_ELEMENTS = [\n 'input:not([disabled]):not([type=hidden])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n 'button:not([disabled])',\n 'a[href]',\n 'area[href]',\n 'summary',\n 'iframe',\n 'object',\n 'embed',\n 'audio[controls]',\n 'video[controls]',\n '[contenteditable]',\n '[tabindex]:not([tabindex=\"-1\"]):not([disabled])',\n 'details:not([disabled])',\n 'summary:not(:disabled)',\n];\n\nexport const hasFocusableElement = (element: HTMLElement | null) => {\n if (!element) {\n return null;\n }\n\n return !!element.querySelector(FOCUSABLE_ELEMENTS.join(','));\n};\n\nexport const isOverflowing = (element: HTMLElement | null) =>\n element !== null ? element.scrollWidth > element.offsetWidth : false;\n\nexport const getIndexOfFirstChildOverflowingParent = (element: HTMLElement, overscan = 0) => {\n let index = 0;\n let boundaryChildIndex: number | null = null;\n const clientRect = element.getBoundingClientRect();\n\n for (const child of Array.from(element.children)) {\n const right = child.getBoundingClientRect().right - clientRect.left;\n const width = clientRect.width - overscan;\n\n if (right > width) {\n boundaryChildIndex = index;\n break;\n }\n index++;\n }\n\n return boundaryChildIndex;\n};\n\nexport const getNextFocussableElement = (currentElement: HTMLElement | null) => {\n if (!currentElement) {\n return null;\n }\n\n const focussableElements = [...document.querySelectorAll<HTMLElement>(FOCUSABLE_ELEMENTS.join(','))];\n const currentElementIndex = focussableElements.indexOf(currentElement);\n\n // If the currentElement is not in the focussable elements list or it is the last element\n if (currentElementIndex !== -1 && currentElementIndex === focussableElements.length - 1) {\n return null;\n }\n\n return focussableElements[currentElementIndex + 1];\n};\n\nconst getOverlaySelector = (element: Element | null) => {\n switch (element?.getAttribute('role')) {\n case 'dialog':\n return `[aria-controls='${element.id}']`;\n\n case 'menu':\n return `#${element.getAttribute('aria-labelledby')}`;\n\n default:\n return undefined;\n }\n};\n\nexport function isElementInsideOrTriggeredFromContainer(element: Element | null, container: Element | null) {\n const selector = getOverlaySelector(element) ?? getOverlaySelector(element?.closest('[role=dialog],[role=menu]') ?? null);\n\n if (selector) {\n if (container?.querySelector(selector)) {\n return true;\n }\n\n const elementInDocument = document.querySelector(selector);\n\n // if the element does exist, see if it is itself connected to somethng that was triggered from the container\n if (elementInDocument) {\n return isElementInsideOrTriggeredFromContainer(elementInDocument, container);\n }\n\n return false;\n }\n\n return !!container?.contains(element);\n}\n\nexport function isElementInsideOverlay(element: Element | null) {\n return !!element?.closest('[role=dialog],[role=menu]');\n}\n\nexport function isSiblingElementInsideSameParentOverlay(element: Element | null, sibling: Element | null) {\n return !!element?.closest('[role=dialog],[role=menu]')?.contains(sibling);\n}\n\nexport function isElementInteractive(element: Element | null) {\n if (!element) {\n return false;\n }\n\n return (\n ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT', 'LABEL', 'OPTION'].includes(element.tagName) &&\n !(element as HTMLElement).hidden &&\n !(element as HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | HTMLButtonElement).disabled &&\n !(element as HTMLInputElement | HTMLTextAreaElement).readOnly\n );\n}\n\nexport function isElementInsideTable3OrReport(element: Element | null) {\n return !!element?.closest('[data-taco^=table]');\n}\n"],"names":["FOCUSABLE_ELEMENTS","hasFocusableElement","element","querySelector","join","getIndexOfFirstChildOverflowingParent","overscan","index","boundaryChildIndex","clientRect","getBoundingClientRect","child","Array","from","children","right","left","width","getNextFocussableElement","currentElement","focussableElements","document","querySelectorAll","currentElementIndex","indexOf","length","getOverlaySelector","getAttribute","id","undefined","isElementInsideOrTriggeredFromContainer","container","selector","_getOverlaySelector","_element$closest","closest","elementInDocument","contains","isElementInsideOverlay","isSiblingElementInsideSameParentOverlay","sibling","_element$closest2","isElementInteractive","includes","tagName","hidden","disabled","readOnly","isElementInsideTable3OrReport"],"mappings":"AAAA;AACA,MAAMA,kBAAkB,GAAG,CACvB,0CAA0C,EAC1C,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,SAAS,EACT,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,iDAAiD,EACjD,yBAAyB,EACzB,wBAAwB,CAC3B;MAEYC,mBAAmB,GAAIC,OAA2B;EAC3D,IAAI,CAACA,OAAO,EAAE;IACV,OAAO,IAAI;;EAGf,OAAO,CAAC,CAACA,OAAO,CAACC,aAAa,CAACH,kBAAkB,CAACI,IAAI,CAA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,OACI,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAACyC,QAAQ,CAACzC,OAAO,CAAC0C,OAAO,CAAC,IAC3F,CAAE1C,OAAuB,CAAC2C,MAAM,IAChC,CAAE3C,OAA0F,CAAC4C,QAAQ,IACrG,CAAE5C,OAAkD,CAAC6C,QAAQ;AAErE;SAEgBC,6BAA6BA,CAAC9C,OAAuB;EACjE,OAAO,CAAC,EAACA,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEiC,OAAO,CAAC,oBAAoB,CAAC;AACnD;;;;"}
@@ -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;
@@ -4122,6 +4122,9 @@ function isElementInteractive(element) {
4122
4122
  }
4123
4123
  return ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT', 'LABEL', 'OPTION'].includes(element.tagName) && !element.hidden && !element.disabled && !element.readOnly;
4124
4124
  }
4125
+ function isElementInsideTable3OrReport(element) {
4126
+ return !!(element !== null && element !== void 0 && element.closest('[data-taco^=table]'));
4127
+ }
4125
4128
 
4126
4129
  function isPressingMetaKey(event) {
4127
4130
  return isMacOs() ? event.metaKey : event.ctrlKey;
@@ -5823,9 +5826,7 @@ const useCombobox = ({
5823
5826
  }
5824
5827
  };
5825
5828
  const handleInputKeyDown = event => {
5826
- var _inputRef$current;
5827
5829
  event.persist();
5828
- const insideTheTable = !!((_inputRef$current = inputRef.current) !== null && _inputRef$current !== void 0 && _inputRef$current.closest('table, [role="rowgroup"]'));
5829
5830
  if (!event.ctrlKey && !event.metaKey) {
5830
5831
  switch (event.key) {
5831
5832
  case 'Backspace':
@@ -5847,7 +5848,7 @@ const useCombobox = ({
5847
5848
  }
5848
5849
  case 'Enter':
5849
5850
  {
5850
- if (insideTheTable) {
5851
+ if (isElementInsideTable3OrReport(event.currentTarget)) {
5851
5852
  event.preventDefault();
5852
5853
  if (inline && !open) {
5853
5854
  setOpen(true);
@@ -5865,7 +5866,7 @@ const useCombobox = ({
5865
5866
  if (open) {
5866
5867
  event.preventDefault();
5867
5868
  } else {
5868
- if (!inline && buttonRef.current && !insideTheTable) {
5869
+ if (!inline && buttonRef.current && !isElementInsideTable3OrReport(event.currentTarget)) {
5869
5870
  buttonRef.current.click();
5870
5871
  }
5871
5872
  }
@@ -5885,7 +5886,7 @@ const useCombobox = ({
5885
5886
  listRef.current.dispatchEvent(createCustomKeyboardEvent(event));
5886
5887
  }
5887
5888
  if (inline && !open) {
5888
- if ((event.key === 'ArrowUp' || event.key === 'ArrowDown') && !insideTheTable) {
5889
+ if ((event.key === 'ArrowUp' || event.key === 'ArrowDown') && !isElementInsideTable3OrReport(event.currentTarget)) {
5889
5890
  event.preventDefault();
5890
5891
  const initialIndex = event.key === 'ArrowUp' ? data.length - 1 : 0;
5891
5892
  setCurrentIndex(currentIndex !== undefined ? currentIndex : initialIndex);
@@ -8194,12 +8195,13 @@ const Link$1 = /*#__PURE__*/React.forwardRef(function MenuLink(props, ref) {
8194
8195
  const Trigger$6 = /*#__PURE__*/React.forwardRef(function MenuTrigger(props, ref) {
8195
8196
  const menu = useCurrentMenu();
8196
8197
  const internalRef = useMergedRef(ref);
8197
- const preventArrowDownShortcut = event => {
8198
- var _internalRef$current;
8199
- const isRenderedInTable = !!((_internalRef$current = internalRef.current) !== null && _internalRef$current !== void 0 && _internalRef$current.closest('tbody'));
8200
- if (isRenderedInTable && event.key === 'ArrowDown') {
8201
- var _internalRef$current2, _internalRef$current3;
8202
- internalRef === null || internalRef === void 0 ? void 0 : (_internalRef$current2 = internalRef.current) === null || _internalRef$current2 === void 0 ? void 0 : (_internalRef$current3 = _internalRef$current2.parentNode) === null || _internalRef$current3 === void 0 ? void 0 : _internalRef$current3.dispatchEvent(createCustomKeyboardEvent(event));
8198
+ const handleKeyDown = event => {
8199
+ if (event.key === 'ArrowDown') {
8200
+ if (isElementInsideTable3OrReport(event.currentTarget)) {
8201
+ var _event$currentTarget$;
8202
+ event.preventDefault();
8203
+ (_event$currentTarget$ = event.currentTarget.parentNode) === null || _event$currentTarget$ === void 0 ? void 0 : _event$currentTarget$.dispatchEvent(createCustomKeyboardEvent(event));
8204
+ }
8203
8205
  }
8204
8206
  };
8205
8207
  React.useEffect(() => {
@@ -8210,7 +8212,7 @@ const Trigger$6 = /*#__PURE__*/React.forwardRef(function MenuTrigger(props, ref)
8210
8212
  return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Trigger, Object.assign({}, props, {
8211
8213
  asChild: true,
8212
8214
  ref: internalRef,
8213
- onKeyDown: preventArrowDownShortcut
8215
+ onKeyDown: handleKeyDown
8214
8216
  }));
8215
8217
  });
8216
8218
 
@@ -10418,11 +10420,11 @@ function useTableRowActive(isEnabled = false, initialRowActiveIndex) {
10418
10420
  const [rowActiveIndex, setRowActiveIndex] = React__default.useState(initialRowActiveIndex);
10419
10421
  const [rowHoverIndex, setRowHoverIndex] = React__default.useState(undefined);
10420
10422
  const [isHoverStatePaused, setHoverStatePaused] = useIsHoverStatePaused();
10421
- const move = (direction, length, scrollToIndex) => setRowActiveIndex(currentIndex => {
10422
- const nextIndex = currentIndex !== undefined ? getNextIndex(direction, currentIndex, length) : 0;
10423
- setTimeout(() => scrollToIndex(nextIndex), 1);
10424
- return nextIndex;
10425
- });
10423
+ const move = (direction, length, scrollToIndex) => {
10424
+ const nextIndex = rowActiveIndex !== undefined ? getNextIndex(direction, rowActiveIndex, length) : 0;
10425
+ scrollToIndex(nextIndex);
10426
+ setTimeout(() => setRowActiveIndex(nextIndex), 50);
10427
+ };
10426
10428
  const onKeyDown = React__default.useCallback((event, length, scrollToIndex) => {
10427
10429
  if (!isEnabled || event.defaultPrevented) {
10428
10430
  return;
@@ -10638,7 +10640,7 @@ function _finallyRethrows(body, finalizer) {
10638
10640
  }
10639
10641
 
10640
10642
  const DEFAULT_PAGE_SIZE = 100;
10641
- function useTableDataLoader(fetch, fetchAll, options = {
10643
+ function useTableDataLoader(fetchPage, fetchAll, options = {
10642
10644
  pageSize: DEFAULT_PAGE_SIZE
10643
10645
  }) {
10644
10646
  const {
@@ -10654,11 +10656,11 @@ function useTableDataLoader(fetch, fetchAll, options = {
10654
10656
  const _lastUsedFilters = React__default.useRef([]);
10655
10657
  const _lastUsedSearch = React__default.useRef();
10656
10658
  const _forceReset = React__default.useRef(false);
10657
- const loadPage = function (pageIndex, sorting, filters, search) {
10659
+ const loadPage = function (pageIndex, sorting, filters) {
10658
10660
  try {
10659
10661
  let reset = false;
10660
10662
  // 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)) {
10663
+ if (_forceReset.current || JSON.stringify(sorting) !== JSON.stringify(_lastUsedSorting.current) || JSON.stringify(filters) !== JSON.stringify(_lastUsedFilters.current)) {
10662
10664
  _pendingPageRequests.current = {};
10663
10665
  // nuke the dataset so that we "start again" after sorting
10664
10666
  reset = true;
@@ -10674,11 +10676,9 @@ function useTableDataLoader(fetch, fetchAll, options = {
10674
10676
  _lastUsedSorting.current = sorting;
10675
10677
  // set the filters so we can track if it changed between loads
10676
10678
  _lastUsedFilters.current = filters;
10677
- // set the search so we can track if it changed between loads
10678
- _lastUsedSearch.current = search;
10679
10679
  const _temp = _finallyRethrows(function () {
10680
10680
  return _catch(function () {
10681
- return Promise.resolve(fetch(pageIndex, pageSize, sorting, filters, search)).then(function (response) {
10681
+ return Promise.resolve(fetchPage(pageIndex, pageSize, sorting, filters)).then(function (response) {
10682
10682
  // update state, here we do some "magic" to support "load in place"
10683
10683
  setData(currentData => {
10684
10684
  let nextData;
@@ -10707,10 +10707,14 @@ function useTableDataLoader(fetch, fetchAll, options = {
10707
10707
  return Promise.reject(e);
10708
10708
  }
10709
10709
  };
10710
- const loadAll = function (sorting, filters, search) {
10710
+ const loadAll = function (sorting, filters) {
10711
10711
  try {
10712
+ // set the sorting so we can track if it changed between loads
10713
+ _lastUsedSorting.current = sorting;
10714
+ // set the filters so we can track if it changed between loads
10715
+ _lastUsedFilters.current = filters;
10712
10716
  const _temp2 = _catch(function () {
10713
- return Promise.resolve(fetchAll(sorting, filters, search)).then(function (response) {
10717
+ return Promise.resolve(fetchAll(sorting, filters)).then(function (response) {
10714
10718
  length.current = response.length;
10715
10719
  setData(() => {
10716
10720
  let nextData;
@@ -10732,22 +10736,52 @@ function useTableDataLoader(fetch, fetchAll, options = {
10732
10736
  const invalidate = function () {
10733
10737
  try {
10734
10738
  _forceReset.current = true;
10735
- return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current, _lastUsedSearch.current);
10739
+ return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current);
10736
10740
  } catch (e) {
10737
10741
  return Promise.reject(e);
10738
10742
  }
10739
10743
  };
10740
- // we reset the page to 0 whenever sorting, filtering or search changes
10744
+ // search works client side - it fetches all then works client side - so these handlers are a little "weird"
10745
+ // if a search is currently "active", we need to re load all because
10741
10746
  const handleSort = function (sorting) {
10742
10747
  try {
10743
- return loadPage(0, sorting, _lastUsedFilters.current, _lastUsedSearch.current);
10748
+ // set the sorting so we can track if it changed between loads
10749
+ _lastUsedSorting.current = sorting;
10750
+ if (_lastUsedSearch.current) {
10751
+ // we're searching, which means we need to refetch all with the correct sorting applied
10752
+ loadAll(sorting, _lastUsedFilters.current);
10753
+ } else {
10754
+ // reset the page to 0 whenever sorting
10755
+ loadPage(0, sorting, _lastUsedFilters.current);
10756
+ }
10757
+ return Promise.resolve();
10744
10758
  } catch (e) {
10745
10759
  return Promise.reject(e);
10746
10760
  }
10747
10761
  };
10748
10762
  const handleFilter = function (filters) {
10749
10763
  try {
10750
- return loadPage(0, _lastUsedSorting.current, filters, _lastUsedSearch.current);
10764
+ // set the filters so we can track if it changed between loads
10765
+ _lastUsedFilters.current = filters;
10766
+ if (_lastUsedSearch.current) {
10767
+ // we're searching, which means we need to refetch all with the correct sorting applied
10768
+ loadAll(_lastUsedSorting.current, filters);
10769
+ } else {
10770
+ // reset the page to 0 whenever sorting
10771
+ loadPage(0, _lastUsedSorting.current, filters);
10772
+ }
10773
+ return Promise.resolve();
10774
+ } catch (e) {
10775
+ return Promise.reject(e);
10776
+ }
10777
+ };
10778
+ const handleSearch = function (search) {
10779
+ try {
10780
+ // set the search so we can track if it changed between loads
10781
+ _lastUsedSearch.current = search || undefined;
10782
+ // search works client side, and focusing the search field triggers a load of all so we don't actually
10783
+ // want to load anything when search gets changed, we just store the value for other handlers
10784
+ return Promise.resolve();
10751
10785
  } catch (e) {
10752
10786
  return Promise.reject(e);
10753
10787
  }
@@ -10758,6 +10792,7 @@ function useTableDataLoader(fetch, fetchAll, options = {
10758
10792
  loadAll,
10759
10793
  loadPage,
10760
10794
  onChangeFilter: handleFilter,
10795
+ onChangeSearch: handleSearch,
10761
10796
  onChangeSort: handleSort,
10762
10797
  pageSize
10763
10798
  }, invalidate];
@@ -11048,14 +11083,18 @@ function resetHighlightedColumnIndexes(value, table) {
11048
11083
  return firstRowIndex;
11049
11084
  }
11050
11085
 
11051
- function useTableSearchListener(table) {
11086
+ function useTableSearchListener(table, onChangeSearch) {
11052
11087
  const meta = table.options.meta;
11053
11088
  // recalculates highlighted indexes whenever something important changes
11054
11089
  React__default.useEffect(() => {
11055
11090
  if (meta.search.isEnabled) {
11056
- resetHighlightedColumnIndexes(table.getState().globalFilter, table);
11091
+ const query = table.getState().globalFilter;
11092
+ resetHighlightedColumnIndexes(query, table);
11093
+ if (typeof onChangeSearch === 'function') {
11094
+ onChangeSearch(query);
11095
+ }
11057
11096
  }
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)]);
11097
+ }, [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
11098
  }
11060
11099
 
11061
11100
  function useTableSettingsListener(table, onChangeSettings) {
@@ -11141,11 +11180,10 @@ function useTableSortingListener(table, onSort) {
11141
11180
  function useTableServerLoadingListener(table, loadPage) {
11142
11181
  const sorting = table.getState().sorting;
11143
11182
  const columnFilters = table.getState().columnFilters;
11144
- const search = table.getState().globalFilter;
11145
11183
  // trigger load of the first page on mount
11146
11184
  React__default.useEffect(() => {
11147
11185
  if (loadPage) {
11148
- loadPage(0, sorting, columnFilters, search);
11186
+ loadPage(0, sorting, columnFilters);
11149
11187
  }
11150
11188
  }, []);
11151
11189
  }
@@ -11246,7 +11284,7 @@ function useTableManager(props, meta, internalColumns) {
11246
11284
  useTableFontSizeListener(instance);
11247
11285
  useTableRowHeightListener(instance);
11248
11286
  useTableRowSelectionListener(instance, props.onRowSelect);
11249
- useTableSearchListener(instance);
11287
+ useTableSearchListener(instance, props.onChangeSearch);
11250
11288
  useTableServerLoadingListener(instance, server.loadPage);
11251
11289
  useTableSettingsListener(instance, setSettings);
11252
11290
  useTableShortcutsListener(instance, props.shortcuts);
@@ -11544,7 +11582,7 @@ function RowWithServerLoading(props) {
11544
11582
  React__default.useEffect(() => {
11545
11583
  if (inView) {
11546
11584
  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);
11585
+ (_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
11586
  }
11549
11587
  }, [inView]);
11550
11588
  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;
@@ -11608,11 +11646,12 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex) {
11608
11646
  } = useRowHeightVirtualisation(table);
11609
11647
  // row groups
11610
11648
  const rangeExtractor = useRowGroupVirtualisation(table);
11611
- // account for thead and tfoot in the scroll area
11649
+ // account for thead and tfoot in the scroll area - both are always medium row height
11612
11650
  const scrollPaddingStart = ROW_HEIGHT_ESTIMATES.medium;
11613
11651
  // column groups offset the bottom padding :shrug:, multiplying by 1.5 ensures the bottom padding remains
11614
11652
  // consistent when there are groups and when there aren't. 1.5 is relatively arbitrary, but it gives alignment
11615
11653
  const scrollPaddingEnd = ROW_HEIGHT_ESTIMATES.medium * (table.getHeaderGroups().length > 1 ? 1.5 : 1);
11654
+ const scrollMargin = isTableRowGrouped ? 0 : scrollPaddingStart;
11616
11655
  const virtualiser = reactVirtual.useVirtualizer({
11617
11656
  count: rows.length,
11618
11657
  estimateSize,
@@ -11620,7 +11659,7 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex) {
11620
11659
  overscan: tableMeta.printing.isPrinting ? rows.length : undefined,
11621
11660
  rangeExtractor,
11622
11661
  // correctly sets top and bottom spacing for the scroll container - very sensitive, don't change
11623
- scrollMargin: isTableRowGrouped ? 0 : scrollPaddingStart,
11662
+ scrollMargin,
11624
11663
  // correctly sets the scroll padding offset, e.g. when keyboard navigating rows in the list
11625
11664
  scrollPaddingStart,
11626
11665
  scrollPaddingEnd: tableMeta.footer.isEnabled ? scrollPaddingEnd * 2 : scrollPaddingEnd
@@ -11649,7 +11688,7 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex) {
11649
11688
  // use row 1 not 0, because 0 might be sticky in grouped tables and it's start value will always be 0
11650
11689
  const paddingStartIndex = isTableRowGrouped && rows.length > 1 ? 1 : 0;
11651
11690
  // styling for offsetting rows - this "is" the virtualisation
11652
- const [paddingTop, paddingBottom] = virtualItems.length > 0 ? [Math.max(0, (_ref = ((_virtualItems$padding = virtualItems[paddingStartIndex]) === null || _virtualItems$padding === void 0 ? void 0 : _virtualItems$padding.start) - ((_virtualItems$padding2 = virtualItems[paddingStartIndex]) === null || _virtualItems$padding2 === void 0 ? void 0 : _virtualItems$padding2.size)) !== null && _ref !== void 0 ? _ref : 0), Math.max(0, (_ref2 = totalSize - ((_virtualItems = virtualItems[virtualItems.length - 1]) === null || _virtualItems === void 0 ? void 0 : _virtualItems.end)) !== null && _ref2 !== void 0 ? _ref2 : 0)] : [0, 0];
11691
+ const [paddingTop, paddingBottom] = virtualItems.length > 0 ? [Math.max(0, (_ref = ((_virtualItems$padding = virtualItems[paddingStartIndex]) === null || _virtualItems$padding === void 0 ? void 0 : _virtualItems$padding.start) - ((_virtualItems$padding2 = virtualItems[paddingStartIndex]) === null || _virtualItems$padding2 === void 0 ? void 0 : _virtualItems$padding2.size) - scrollMargin) !== null && _ref !== void 0 ? _ref : 0), Math.max(0, (_ref2 = totalSize - ((_virtualItems = virtualItems[virtualItems.length - 1]) === null || _virtualItems === void 0 ? void 0 : _virtualItems.end)) !== null && _ref2 !== void 0 ? _ref2 : 0)] : [0, 0];
11653
11692
  // ensure default active rows are scrolled to
11654
11693
  React__default.useEffect(() => {
11655
11694
  if (defaultRowActiveIndex) {
@@ -11664,7 +11703,7 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex) {
11664
11703
  let content = null;
11665
11704
  if (rows.length) {
11666
11705
  style = {
11667
- height: `${totalSize}px`,
11706
+ height: `${totalSize - scrollMargin}px`,
11668
11707
  paddingBottom,
11669
11708
  paddingTop
11670
11709
  };
@@ -12014,7 +12053,7 @@ function Header$4(context) {
12014
12053
  const _temp = function () {
12015
12054
  if (tableMeta.server.loadAllIfNeeded) {
12016
12055
  // 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 () {});
12056
+ return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
12018
12057
  }
12019
12058
  }();
12020
12059
  // load all data if that is possible
@@ -12088,7 +12127,7 @@ function Cell$3(context) {
12088
12127
  const _temp3 = function () {
12089
12128
  if (tableMeta.server.loadAllIfNeeded && selectedRows.some(row => row.original === undefined)) {
12090
12129
  // 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 () {});
12130
+ return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
12092
12131
  }
12093
12132
  }();
12094
12133
  return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
@@ -13439,7 +13478,7 @@ function Search$1(props) {
13439
13478
  const _temp = function () {
13440
13479
  if (tableMeta.server.loadAllIfNeeded) {
13441
13480
  // 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 () {});
13481
+ return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
13443
13482
  }
13444
13483
  }();
13445
13484
  // load all data if that is possible
@@ -15147,6 +15186,8 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
15147
15186
  var _listboxRef$current;
15148
15187
  if (open) {
15149
15188
  event.preventDefault();
15189
+ } else if (isElementInsideTable3OrReport(event.currentTarget)) {
15190
+ return;
15150
15191
  } else if (!event.ctrlKey && !event.metaKey && (event.key === 'ArrowDown' || /^[a-z0-9]$/i.test(event.key))) {
15151
15192
  setOpen(true);
15152
15193
  }
@@ -15487,7 +15528,7 @@ function Print$1(props) {
15487
15528
  const _temp2 = function () {
15488
15529
  if (tableMeta.server.isEnabled && tableMeta.server.loadAllIfNeeded) {
15489
15530
  const _temp = _catch(function () {
15490
- return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {});
15531
+ return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
15491
15532
  }, function (error) {
15492
15533
  const errorMessage = `${texts.table.print.error}: ${error}`;
15493
15534
  console.error(errorMessage);