@economic/taco 2.46.9 → 2.47.0-server-2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. package/dist/components/Report/Report.d.ts +1 -1
  2. package/dist/components/SearchInput2/SearchInput2.d.ts +2 -0
  3. package/dist/components/Table3/components/Row/Editing/CreateNewRow.d.ts +1 -2
  4. package/dist/components/Table3/components/Row/Editing/TemporaryRow.d.ts +1 -0
  5. package/dist/components/Table3/features/useEditingState.d.ts +11 -11
  6. package/dist/components/Table3/features/useTableEditing.d.ts +13 -13
  7. package/dist/components/Table3/util/editing.d.ts +3 -0
  8. package/dist/esm/index.css +2 -2
  9. package/dist/esm/node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js +17 -17
  10. package/dist/esm/node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js.map +1 -1
  11. package/dist/esm/packages/taco/src/charts/components/Donut/Legend.js +1 -0
  12. package/dist/esm/packages/taco/src/charts/components/Donut/Legend.js.map +1 -1
  13. package/dist/esm/packages/taco/src/charts/components/Legend.js +1 -0
  14. package/dist/esm/packages/taco/src/charts/components/Legend.js.map +1 -1
  15. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +6 -3
  16. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
  17. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js +1 -1
  18. package/dist/esm/packages/taco/src/components/Table3/Table3.js +14 -4
  19. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  20. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js +1 -1
  21. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
  22. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +14 -9
  23. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
  24. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js +2 -4
  25. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js.map +1 -1
  26. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js +5 -4
  27. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js.map +1 -1
  28. package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js +32 -51
  29. package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js.map +1 -1
  30. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +5 -3
  31. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
  32. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js +15 -12
  33. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js.map +1 -1
  34. package/dist/esm/packages/taco/src/components/Table3/util/editing.js +9 -1
  35. package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
  36. package/dist/esm/packages/taco/src/index.js +1 -0
  37. package/dist/esm/packages/taco/src/index.js.map +1 -1
  38. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +2 -1
  39. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
  40. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js +4 -0
  41. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js.map +1 -1
  42. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js +7 -4
  43. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js.map +1 -1
  44. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js +7 -2
  45. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js.map +1 -1
  46. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Summary.js +7 -5
  47. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Summary.js.map +1 -1
  48. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js +24 -22
  49. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js.map +1 -1
  50. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/Row.js +41 -4
  51. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/Row.js.map +1 -1
  52. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js +3 -1
  53. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js.map +1 -1
  54. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js +26 -3
  55. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js.map +1 -1
  56. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableGlobalShortcuts.js +1 -1
  57. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableGlobalShortcuts.js.map +1 -1
  58. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +36 -9
  59. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
  60. package/dist/esm/packages/taco/src/primitives/Table/Core/useTable.js +1 -1
  61. package/dist/esm/packages/taco/src/primitives/Table/Core/useTable.js.map +1 -1
  62. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  63. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js +5 -7
  64. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
  65. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader2.js +249 -0
  66. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader2.js.map +1 -0
  67. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js +1 -1
  68. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js.map +1 -1
  69. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowExpansion.js +2 -1
  70. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowExpansion.js.map +1 -1
  71. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js +3 -2
  72. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js.map +1 -1
  73. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableServerLoading.js +4 -2
  74. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableServerLoading.js.map +1 -1
  75. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFilterListener.js +3 -1
  76. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFilterListener.js.map +1 -1
  77. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.js +4 -4
  78. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.js.map +1 -1
  79. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js +14 -13
  80. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js.map +1 -1
  81. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js +7 -3
  82. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js.map +1 -1
  83. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +4 -4
  84. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
  85. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js +4 -1
  86. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js.map +1 -1
  87. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js +7 -1
  88. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js.map +1 -1
  89. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +6 -0
  90. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  91. package/dist/hooks/useLazyDebouncedEffect.d.ts +2 -0
  92. package/dist/index.css +2 -2
  93. package/dist/index.d.ts +1 -0
  94. package/dist/primitives/Table/Core/Table.d.ts +1 -0
  95. package/dist/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.d.ts +2 -2
  96. package/dist/primitives/Table/Core/components/Row/Row.d.ts +2 -0
  97. package/dist/primitives/Table/Core/features/useTableRenderer.d.ts +1 -1
  98. package/dist/primitives/Table/types.d.ts +11 -6
  99. package/dist/primitives/Table/useTableDataLoader2.d.ts +23 -0
  100. package/dist/primitives/Table/useTableManager/features/useTableRowExpansion.d.ts +2 -1
  101. package/dist/primitives/Table/useTableManager/features/useTableSearch.d.ts +4 -2
  102. package/dist/primitives/Table/useTableManager/features/useTableServerLoading.d.ts +3 -1
  103. package/dist/primitives/Table/useTableManager/listeners/useTableSearchListener.d.ts +1 -2
  104. package/dist/primitives/Table/useTableManager/util/columns.d.ts +2 -1
  105. package/dist/taco.cjs.development.js +607 -229
  106. package/dist/taco.cjs.development.js.map +1 -1
  107. package/dist/taco.cjs.production.min.js +1 -1
  108. package/dist/taco.cjs.production.min.js.map +1 -1
  109. package/package.json +2 -3
@@ -1 +1 @@
1
- {"version":3,"file":"useTableServerLoading.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/features/useTableServerLoading.ts"],"sourcesContent":["import React from 'react';\nimport { TableServerLoadAllHandler, TableServerLoadAllState, TableServerLoadPageHandler } from '../../types';\nimport { DEFAULT_PAGE_SIZE } from '../../useTableDataLoader';\n\nexport function useTableServerLoading(\n loadPage?: TableServerLoadPageHandler,\n loadAll?: TableServerLoadAllHandler,\n pageSize = DEFAULT_PAGE_SIZE\n) {\n const isEnabled = !!loadPage && !!loadAll;\n const [isReady, setReady] = React.useState(false);\n const [loadAllStatus, setLoadedStatus] = React.useState<TableServerLoadAllState>(TableServerLoadAllState.Incomplete);\n\n let _loadPage: TableServerLoadPageHandler | undefined;\n let _loadAll: TableServerLoadAllHandler | undefined;\n let _loadAllIfNeeded: TableServerLoadAllHandler | undefined;\n\n if (typeof loadPage === 'function') {\n _loadPage = async (...args) => {\n if (typeof loadPage === 'function') {\n await loadPage(...args);\n setReady(true);\n }\n };\n }\n\n if (typeof loadAll === 'function') {\n _loadAll = async (...args) => {\n if (typeof loadAll === 'function') {\n setLoadedStatus(TableServerLoadAllState.Loading);\n await loadAll(...args);\n setLoadedStatus(TableServerLoadAllState.Completed);\n setReady(true);\n }\n };\n\n _loadAllIfNeeded = async (...args) => {\n if (loadAllStatus === TableServerLoadAllState.Incomplete) {\n await _loadAll?.(...args);\n }\n };\n }\n\n return {\n isEnabled,\n isReady,\n loadPage: _loadPage,\n loadAll: _loadAll,\n loadAllIfNeeded: _loadAllIfNeeded,\n loadAllStatus,\n pageSize,\n };\n}\n"],"names":["useTableServerLoading","loadPage","loadAll","pageSize","DEFAULT_PAGE_SIZE","isEnabled","isReady","setReady","React","useState","loadAllStatus","setLoadedStatus","TableServerLoadAllState","Incomplete","_loadPage","_loadAll","_loadAllIfNeeded","args","Promise","resolve","then","_temp","e","reject","Loading","Completed","_temp2","_loadAll2","_temp3","loadAllIfNeeded"],"mappings":";;;;SAIgBA,qBAAqBA,CACjCC,QAAqC,EACrCC,OAAmC,EACnCC,QAAQ,GAAGC,iBAAiB;EAE5B,MAAMC,SAAS,GAAG,CAAC,CAACJ,QAAQ,IAAI,CAAC,CAACC,OAAO;EACzC,MAAM,CAACI,OAAO,EAAEC,QAAQ,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;EACjD,MAAM,CAACC,aAAa,EAAEC,eAAe,CAAC,GAAGH,cAAK,CAACC,QAAQ,CAA0BG,uBAAuB,CAACC,UAAU,CAAC;EAEpH,IAAIC,SAAiD;EACrD,IAAIC,QAA+C;EACnD,IAAIC,gBAAuD;EAE3D,IAAI,OAAOf,QAAQ,KAAK,UAAU,EAAE;IAChCa,SA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AAA,CAAAK,MAAA,CAAAD,CAAA;;;;EAGL,OAAO;IACHjB,SAAS;IACTC,OAAO;IACPL,QAAQ,EAAEa,SAAS;IACnBZ,OAAO,EAAEa,QAAQ;IACjBc,eAAe,EAAEb,gBAAgB;IACjCN,aAAa;IACbP;GACH;AACL;;;;"}
1
+ {"version":3,"file":"useTableServerLoading.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/features/useTableServerLoading.ts"],"sourcesContent":["import React from 'react';\nimport { TableServerLoadAllHandler, TableServerLoadAllState, TableServerLoadPageHandler } from '../../types';\nimport { DEFAULT_PAGE_SIZE } from '../../useTableDataLoader';\n\nexport function useTableServerLoading(\n loadPage?: TableServerLoadPageHandler,\n loadAll?: TableServerLoadAllHandler,\n pages?: number[],\n pageSize = DEFAULT_PAGE_SIZE,\n _experimentalDataLoader2 = false\n) {\n const isEnabled = !!loadPage && !!loadAll;\n const [isReady, setReady] = React.useState(false);\n const [loadAllStatus, setLoadedStatus] = React.useState<TableServerLoadAllState>(TableServerLoadAllState.Incomplete);\n\n let _loadPage: TableServerLoadPageHandler | undefined;\n let _loadAll: TableServerLoadAllHandler | undefined;\n let _loadAllIfNeeded: TableServerLoadAllHandler | undefined;\n\n if (typeof loadPage === 'function') {\n _loadPage = async (...args) => {\n if (typeof loadPage === 'function') {\n await loadPage(...args);\n setReady(true);\n }\n };\n }\n\n if (typeof loadAll === 'function') {\n _loadAll = async (...args) => {\n if (typeof loadAll === 'function') {\n setLoadedStatus(TableServerLoadAllState.Loading);\n await loadAll(...args);\n setLoadedStatus(TableServerLoadAllState.Completed);\n setReady(true);\n }\n };\n\n _loadAllIfNeeded = async (...args) => {\n if (loadAllStatus === TableServerLoadAllState.Incomplete) {\n await _loadAll?.(...args);\n }\n };\n }\n\n return {\n pages,\n isEnabled,\n isReady,\n loadPage: _loadPage,\n loadAll: _loadAll,\n loadAllIfNeeded: _loadAllIfNeeded,\n loadAllStatus,\n pageSize,\n _experimentalDataLoader2,\n };\n}\n"],"names":["useTableServerLoading","loadPage","loadAll","pages","pageSize","DEFAULT_PAGE_SIZE","_experimentalDataLoader2","isEnabled","isReady","setReady","React","useState","loadAllStatus","setLoadedStatus","TableServerLoadAllState","Incomplete","_loadPage","_loadAll","_loadAllIfNeeded","args","Promise","resolve","then","_temp","e","reject","Loading","Completed","_temp2","_loadAll2","_temp3","loadAllIfNeeded"],"mappings":";;;;SAIgBA,qBAAqBA,CACjCC,QAAqC,EACrCC,OAAmC,EACnCC,KAAgB,EAChBC,QAAQ,GAAGC,iBAAiB,EAC5BC,wBAAwB,GAAG,KAAK;EAEhC,MAAMC,SAAS,GAAG,CAAC,CAACN,QAAQ,IAAI,CAAC,CAACC,OAAO;EACzC,MAAM,CAACM,OAAO,EAAEC,QAAQ,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;EACjD,MAAM,CAACC,aAAa,EAAEC,eAAe,CAAC,GAAGH,cAAK,CAACC,QAAQ,CAA0BG,uBAAuB,CAACC,UAAU,CAAC;EAEpH,IAAIC,SAAiD;EACrD,IAAIC,QAA+C;EACnD,IAAIC,gBAAuD;EAE3D,IAAI,OAAOjB,QAAQ,KAAK,UAAU,EAAE;IAChCe,SAAS,aAAU,GAAGG,IAAI;MAAA;;cAClB,OAAOlB,QAAQ,KAAK,UAAU;YAAA,OAAAmB,OAAA,CAAAC,OAAA,CACxBpB,QAAQ,CAAC,GAAGkB,IAAI,CAAC,EAAAG,IAAA;cACvBb,QAAQ,CAAC,IAAI,CAAC;;;;QAAC,OAAAW,OAAA,CAAAC,OAAA,CAAAE,KAAA,IAAAA,KAAA,CAAAD,IAAA,GAAAC,KAAA,CAAAD,IAAA;OAEtB,QAAAE,CAAA;QAAA,OAAAJ,OAAA,CAAAK,MAAA,CAAAD,CAAA;;;;EAGL,IAAI,OAAOtB,OAAO,KAAK,UAAU,EAAE;IAC/Be,QAAQ,aAAU,GAAGE,IAAI;MAAA;;cACjB,OAAOjB,OAAO,KAAK,UAAU;YAC7BW,eAAe,CAACC,uBAAuB,CAACY,OAAO,CAAC;YAAC,OAAAN,OAAA,CAAAC,OAAA,CAC3CnB,OAAO,CAAC,GAAGiB,IAAI,CAAC,EAAAG,IAAA;cACtBT,eAAe,CAACC,uBAAuB,CAACa,SAAS,CAAC;cAClDlB,QAAQ,CAAC,IAAI,CAAC;;;;QAAC,OAAAW,OAAA,CAAAC,OAAA,CAAAO,MAAA,IAAAA,MAAA,CAAAN,IAAA,GAAAM,MAAA,CAAAN,IAAA;OAEtB,QAAAE,CAAA;QAAA,OAAAJ,OAAA,CAAAK,MAAA,CAAAD,CAAA;;;IAEDN,gBAAgB,aAAU,GAAGC,IAAI;MAAA;;cACzBP,aAAa,KAAKE,uBAAuB,CAACC,UAAU;YAAA,IAAAc,SAAA;YAAA,OAAAT,OAAA,CAAAC,OAAA,EAAAQ,SAAA,GAC9CZ,QAAQ,cAAAY,SAAA,uBAARA,SAAA,CAAW,GAAGV,IAAI,CAAC,EAAAG,IAAA;;;QAAA,OAAAF,OAAA,CAAAC,OAAA,CAAAS,MAAA,IAAAA,MAAA,CAAAR,IAAA,GAAAQ,MAAA,CAAAR,IAAA;OAEhC,QAAAE,CAAA;QAAA,OAAAJ,OAAA,CAAAK,MAAA,CAAAD,CAAA;;;;EAGL,OAAO;IACHrB,KAAK;IACLI,SAAS;IACTC,OAAO;IACPP,QAAQ,EAAEe,SAAS;IACnBd,OAAO,EAAEe,QAAQ;IACjBc,eAAe,EAAEb,gBAAgB;IACjCN,aAAa;IACbR,QAAQ;IACRE;GACH;AACL;;;;"}
@@ -1,3 +1,4 @@
1
+ import { getHiddenColumns } from '../util/columns.js';
1
2
  import { useLazyEffect } from '../../../../hooks/useLazyEffect.js';
2
3
 
3
4
  // we use a listener, and not the internal "controlled" change handlers because we don't actually want consumers
@@ -7,7 +8,8 @@ function useTableFilterListener(table, onFilter) {
7
8
  const columnFilters = table.getState().columnFilters;
8
9
  useLazyEffect(() => {
9
10
  if (table.options.enableColumnFilters && typeof onFilter === 'function') {
10
- onFilter(columnFilters);
11
+ const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
12
+ onFilter(columnFilters, hiddenColumns);
11
13
  if (table.options.enableRowSelection) {
12
14
  table.resetRowSelection();
13
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useTableFilterListener.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/listeners/useTableFilterListener.ts"],"sourcesContent":["import { Table as ReactTable } from '@tanstack/react-table';\nimport { useLazyEffect } from '../../../../hooks/useLazyEffect';\nimport { TableFilterHandler } from '../../types';\n\n// we use a listener, and not the internal \"controlled\" change handlers because we don't actually want consumers\n// to control the state outside the table. this listener is really here to let the consumer make a server request\n// and provide the server with the filtering state, so that it can filter server side\nexport function useTableFilterListener<TType = unknown>(table: ReactTable<TType>, onFilter?: TableFilterHandler) {\n const columnFilters = table.getState().columnFilters;\n\n useLazyEffect(() => {\n if (table.options.enableColumnFilters && typeof onFilter === 'function') {\n onFilter(columnFilters);\n\n if (table.options.enableRowSelection) {\n table.resetRowSelection();\n }\n }\n }, [table.options.enableColumnFilters, columnFilters]);\n}\n"],"names":["useTableFilterListener","table","onFilter","columnFilters","getState","useLazyEffect","options","enableColumnFilters","enableRowSelection","resetRowSelection"],"mappings":";;AAIA;AACA;AACA;SACgBA,sBAAsBA,CAAkBC,KAAwB,EAAEC,QAA6B;EAC3G,MAAMC,aAAa,GAAGF,KAAK,CAACG,QAAQ,EAAE,CAACD,aAAa;EAEpDE,aAAa,CAAC;IACV,IAAIJ,KAAK,CAACK,OAAO,CAACC,mBAAmB,IAAI,OAAOL,QAAQ,KAAK,UAAU,EAAE;MACrEA,QAAQ,CAACC,aAAa,CAAC;MAEvB,IAAIF,KAAK,CAACK,OAAO,CAACE,kBAAkB,EAAE;QAClCP,KAAK,CAACQ,iBAAiB,EAAE;;;GAGpC,EAAE,CAACR,KAAK,CAACK,OAAO,CAACC,mBAAmB,EAAEJ,aAAa,CAAC,CAAC;AAC1D;;;;"}
1
+ {"version":3,"file":"useTableFilterListener.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/listeners/useTableFilterListener.ts"],"sourcesContent":["import { Table as ReactTable } from '@tanstack/react-table';\nimport { useLazyEffect } from '../../../../hooks/useLazyEffect';\nimport { TableFilterHandler } from '../../types';\nimport { getHiddenColumns } from '../util/columns';\n\n// we use a listener, and not the internal \"controlled\" change handlers because we don't actually want consumers\n// to control the state outside the table. this listener is really here to let the consumer make a server request\n// and provide the server with the filtering state, so that it can filter server side\nexport function useTableFilterListener<TType = unknown>(table: ReactTable<TType>, onFilter?: TableFilterHandler) {\n const columnFilters = table.getState().columnFilters;\n\n useLazyEffect(() => {\n if (table.options.enableColumnFilters && typeof onFilter === 'function') {\n const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);\n onFilter(columnFilters, hiddenColumns);\n\n if (table.options.enableRowSelection) {\n table.resetRowSelection();\n }\n }\n }, [table.options.enableColumnFilters, columnFilters]);\n}\n"],"names":["useTableFilterListener","table","onFilter","columnFilters","getState","useLazyEffect","options","enableColumnFilters","hiddenColumns","getHiddenColumns","columnVisibility","enableRowSelection","resetRowSelection"],"mappings":";;;AAKA;AACA;AACA;SACgBA,sBAAsBA,CAAkBC,KAAwB,EAAEC,QAA6B;EAC3G,MAAMC,aAAa,GAAGF,KAAK,CAACG,QAAQ,EAAE,CAACD,aAAa;EAEpDE,aAAa,CAAC;IACV,IAAIJ,KAAK,CAACK,OAAO,CAACC,mBAAmB,IAAI,OAAOL,QAAQ,KAAK,UAAU,EAAE;MACrE,MAAMM,aAAa,GAAGC,gBAAgB,CAACR,KAAK,CAACG,QAAQ,EAAE,CAACM,gBAAgB,CAAC;MACzER,QAAQ,CAACC,aAAa,EAAEK,aAAa,CAAC;MAEtC,IAAIP,KAAK,CAACK,OAAO,CAACK,kBAAkB,EAAE;QAClCV,KAAK,CAACW,iBAAiB,EAAE;;;GAGpC,EAAE,CAACX,KAAK,CAACK,OAAO,CAACC,mBAAmB,EAAEJ,aAAa,CAAC,CAAC;AAC1D;;;;"}
@@ -1,12 +1,12 @@
1
- import React__default from 'react';
2
1
  import { useLazyEffect } from '../../../../hooks/useLazyEffect.js';
3
2
 
4
3
  function useTableRowSelectionListener(table, onRowSelect) {
4
+ // note that the selected row model may not contain all rows in state when using server loading
5
5
  const rows = table.getSelectedRowModel().flatRows;
6
- const rowSelection = React__default.useMemo(() => rows.map(row => row.original), [rows]);
6
+ const state = table.getState().rowSelection;
7
7
  useLazyEffect(() => {
8
8
  if (table.options.enableRowSelection && typeof onRowSelect === 'function') {
9
- onRowSelect(rowSelection);
9
+ onRowSelect(rows.map(row => row.original), Object.keys(state));
10
10
  }
11
11
  /**
12
12
  * Casting to a boolean, since enableRowSelection can be a function,
@@ -14,7 +14,7 @@ function useTableRowSelectionListener(table, onRowSelect) {
14
14
  * we only need to know if selection was enabled or disabled, because enableRowSelection function
15
15
  * will be applied directly to particular rows.
16
16
  */
17
- }, [!!table.options.enableRowSelection, JSON.stringify(rowSelection)]);
17
+ }, [!!table.options.enableRowSelection, state]);
18
18
  }
19
19
 
20
20
  export { useTableRowSelectionListener };
@@ -1 +1 @@
1
- {"version":3,"file":"useTableRowSelectionListener.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.ts"],"sourcesContent":["import { Table as ReactTable } from '@tanstack/react-table';\nimport { useLazyEffect } from '../../../../hooks/useLazyEffect';\nimport { TableRowSelectHandler } from '../../types';\nimport React from 'react';\n\nexport function useTableRowSelectionListener<TType = unknown>(\n table: ReactTable<TType>,\n onRowSelect?: TableRowSelectHandler<TType>\n) {\n const rows = table.getSelectedRowModel().flatRows;\n const rowSelection = React.useMemo(() => rows.map(row => row.original), [rows]);\n\n useLazyEffect(() => {\n if (table.options.enableRowSelection && typeof onRowSelect === 'function') {\n onRowSelect(rowSelection);\n }\n /**\n * Casting to a boolean, since enableRowSelection can be a function,\n * and setting a function as depoendency will lead to infinity loop. And in case of row selection useEffect,\n * we only need to know if selection was enabled or disabled, because enableRowSelection function\n * will be applied directly to particular rows.\n */\n }, [!!table.options.enableRowSelection, JSON.stringify(rowSelection)]);\n}\n"],"names":["useTableRowSelectionListener","table","onRowSelect","rows","getSelectedRowModel","flatRows","rowSelection","React","useMemo","map","row","original","useLazyEffect","options","enableRowSelection","JSON","stringify"],"mappings":";;;SAKgBA,4BAA4BA,CACxCC,KAAwB,EACxBC,WAA0C;EAE1C,MAAMC,IAAI,GAAGF,KAAK,CAACG,mBAAmB,EAAE,CAACC,QAAQ;EACjD,MAAMC,YAAY,GAAGC,cAAK,CAACC,OAAO,CAAC,MAAML,IAAI,CAACM,GAAG,CAACC,GAAG,IAAIA,GAAG,CAACC,QAAQ,CAAC,EAAE,CAACR,IAAI,CAAC,CAAC;EAE/ES,aAAa,CAAC;IACV,IAAIX,KAAK,CAACY,OAAO,CAACC,kBAAkB,IAAI,OAAOZ,WAAW,KAAK,UAAU,EAAE;MACvEA,WAAW,CAACI,YAAY,CAAC;;;;;;;;GAQhC,EAAE,CAAC,CAAC,CAACL,KAAK,CAACY,OAAO,CAACC,kBAAkB,EAAEC,IAAI,CAACC,SAAS,CAACV,YAAY,CAAC,CAAC,CAAC;AAC1E;;;;"}
1
+ {"version":3,"file":"useTableRowSelectionListener.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.ts"],"sourcesContent":["import { Table as ReactTable } from '@tanstack/react-table';\nimport { useLazyEffect } from '../../../../hooks/useLazyEffect';\nimport { TableRowSelectHandler } from '../../types';\n\nexport function useTableRowSelectionListener<TType = unknown>(\n table: ReactTable<TType>,\n onRowSelect?: TableRowSelectHandler<TType>\n) {\n // note that the selected row model may not contain all rows in state when using server loading\n const rows = table.getSelectedRowModel().flatRows;\n const state = table.getState().rowSelection;\n\n useLazyEffect(() => {\n if (table.options.enableRowSelection && typeof onRowSelect === 'function') {\n onRowSelect(\n rows.map(row => row.original),\n Object.keys(state) as (keyof TType)[]\n );\n }\n /**\n * Casting to a boolean, since enableRowSelection can be a function,\n * and setting a function as depoendency will lead to infinity loop. And in case of row selection useEffect,\n * we only need to know if selection was enabled or disabled, because enableRowSelection function\n * will be applied directly to particular rows.\n */\n }, [!!table.options.enableRowSelection, state]);\n}\n"],"names":["useTableRowSelectionListener","table","onRowSelect","rows","getSelectedRowModel","flatRows","state","getState","rowSelection","useLazyEffect","options","enableRowSelection","map","row","original","Object","keys"],"mappings":";;SAIgBA,4BAA4BA,CACxCC,KAAwB,EACxBC,WAA0C;;EAG1C,MAAMC,IAAI,GAAGF,KAAK,CAACG,mBAAmB,EAAE,CAACC,QAAQ;EACjD,MAAMC,KAAK,GAAGL,KAAK,CAACM,QAAQ,EAAE,CAACC,YAAY;EAE3CC,aAAa,CAAC;IACV,IAAIR,KAAK,CAACS,OAAO,CAACC,kBAAkB,IAAI,OAAOT,WAAW,KAAK,UAAU,EAAE;MACvEA,WAAW,CACPC,IAAI,CAACS,GAAG,CAACC,GAAG,IAAIA,GAAG,CAACC,QAAQ,CAAC,EAC7BC,MAAM,CAACC,IAAI,CAACV,KAAK,CAAoB,CACxC;;;;;;;;GAQR,EAAE,CAAC,CAAC,CAACL,KAAK,CAACS,OAAO,CAACC,kBAAkB,EAAEL,KAAK,CAAC,CAAC;AACnD;;;;"}
@@ -1,31 +1,32 @@
1
- import React__default from 'react';
2
1
  import { useLocalization } from '../../../../components/Provider/Localization.js';
3
2
  import { resetHighlightedColumnIndexes } from '../util/search.js';
3
+ import { getHiddenColumns } from '../util/columns.js';
4
+ import { useLazyEffect } from '../../../../hooks/useLazyEffect.js';
4
5
 
5
- function useTableSearchListener(table, onChangeSearch) {
6
+ function useTableSearchListener(table) {
6
7
  const meta = table.options.meta;
7
8
  const localization = useLocalization();
8
- const visibleColumns = table.getVisibleFlatColumns();
9
+ const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
10
+ const query = table.getState().globalFilter;
9
11
  // Need to re-run search when columns are getting shown/hidden.
10
- React__default.useEffect(() => {
11
- if (meta.search.isEnabled && visibleColumns.length > 0) {
12
- const currentFilter = table.getState().globalFilter;
12
+ useLazyEffect(() => {
13
+ if (meta.search.isEnabled) {
14
+ const currentFilter = query;
13
15
  requestAnimationFrame(() => {
14
16
  table.resetGlobalFilter();
15
17
  table.setGlobalFilter(currentFilter);
16
18
  });
19
+ if (meta.search.handleSearch && meta.search.enableGlobalFilter && query) {
20
+ meta.search.handleSearch(query, hiddenColumns);
21
+ }
17
22
  }
18
- }, [visibleColumns.length]);
23
+ }, [hiddenColumns.length]);
19
24
  // recalculates highlighted indexes whenever something important changes
20
- React__default.useEffect(() => {
25
+ useLazyEffect(() => {
21
26
  if (meta.search.isEnabled) {
22
- const query = table.getState().globalFilter;
23
27
  resetHighlightedColumnIndexes(query, table, localization);
24
- if (typeof onChangeSearch === 'function') {
25
- onChangeSearch(query);
26
- }
27
28
  }
28
- }, [meta.server.loadAllStatus, meta.search.isEnabled, meta.search.enableGlobalFilter, table.getRowModel().rows.length, table.getState().globalFilter, JSON.stringify(table.getState().sorting), onChangeSearch]);
29
+ }, [meta.server.loadAllStatus, meta.search.isEnabled, meta.search.enableGlobalFilter, table.getRowModel().rows.length, query, JSON.stringify(table.getState().sorting)]);
29
30
  }
30
31
 
31
32
  export { useTableSearchListener };
@@ -1 +1 @@
1
- {"version":3,"file":"useTableSearchListener.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/listeners/useTableSearchListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { resetHighlightedColumnIndexes } from '../util/search';\nimport { TableSearchHandler } from '../../types';\nimport { useLocalization } from '../../../../components/Provider/Localization';\n\nexport function useTableSearchListener<TType = unknown>(table: ReactTable<TType>, onChangeSearch?: TableSearchHandler) {\n const meta = table.options.meta as ReactTableMeta<TType>;\n const localization = useLocalization();\n\n const visibleColumns = table.getVisibleFlatColumns();\n\n // Need to re-run search when columns are getting shown/hidden.\n React.useEffect(() => {\n if (meta.search.isEnabled && visibleColumns.length > 0) {\n const currentFilter = table.getState().globalFilter;\n requestAnimationFrame(() => {\n table.resetGlobalFilter();\n table.setGlobalFilter(currentFilter);\n });\n }\n }, [visibleColumns.length]);\n\n // recalculates highlighted indexes whenever something important changes\n React.useEffect(() => {\n if (meta.search.isEnabled) {\n const query = table.getState().globalFilter;\n resetHighlightedColumnIndexes(query, table, localization);\n\n if (typeof onChangeSearch === 'function') {\n onChangeSearch(query);\n }\n }\n }, [\n meta.server.loadAllStatus,\n meta.search.isEnabled,\n meta.search.enableGlobalFilter,\n table.getRowModel().rows.length,\n table.getState().globalFilter,\n JSON.stringify(table.getState().sorting),\n onChangeSearch,\n ]);\n}\n"],"names":["useTableSearchListener","table","onChangeSearch","meta","options","localization","useLocalization","visibleColumns","getVisibleFlatColumns","React","useEffect","search","isEnabled","length","currentFilter","getState","globalFilter","requestAnimationFrame","resetGlobalFilter","setGlobalFilter","query","resetHighlightedColumnIndexes","server","loadAllStatus","enableGlobalFilter","getRowModel","rows","JSON","stringify","sorting"],"mappings":";;;;SAMgBA,sBAAsBA,CAAkBC,KAAwB,EAAEC,cAAmC;EACjH,MAAMC,IAAI,GAAGF,KAAK,CAACG,OAAO,CAACD,IAA6B;EACxD,MAAME,YAAY,GAAGC,eAAe,EAAE;EAEtC,MAAMC,cAAc,GAAGN,KAAK,CAACO,qBAAqB,EAAE;;EAGpDC,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIP,IAAI,CAACQ,MAAM,CAACC,SAAS,IAAIL,cAAc,CAACM,MAAM,GAAG,CAAC,EAAE;MACpD,MAAMC,aAAa,GAAGb,KAAK,CAACc,QAAQ,EAAE,CAACC,YAAY;MACnDC,qBAAqB,CAAC;QAClBhB,KAAK,CAACiB,iBAAiB,EAAE;QACzBjB,KAAK,CAACkB,eAAe,CAACL,aAAa,CAAC;OACvC,CAAC;;GAET,EAAE,CAACP,cAAc,CAACM,MAAM,CAAC,CAAC;;EAG3BJ,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIP,IAAI,CAACQ,MAAM,CAACC,SAAS,EAAE;MACvB,MAAMQ,KAAK,GAAGnB,KAAK,CAACc,QAAQ,EAAE,CAACC,YAAY;MAC3CK,6BAA6B,CAACD,KAAK,EAAEnB,KAAK,EAAEI,YAAY,CAAC;MAEzD,IAAI,OAAOH,cAAc,KAAK,UAAU,EAAE;QACtCA,cAAc,CAACkB,KAAK,CAAC;;;GAGhC,EAAE,CACCjB,IAAI,CAACmB,MAAM,CAACC,aAAa,EACzBpB,IAAI,CAACQ,MAAM,CAACC,SAAS,EACrBT,IAAI,CAACQ,MAAM,CAACa,kBAAkB,EAC9BvB,KAAK,CAACwB,WAAW,EAAE,CAACC,IAAI,CAACb,MAAM,EAC/BZ,KAAK,CAACc,QAAQ,EAAE,CAACC,YAAY,EAC7BW,IAAI,CAACC,SAAS,CAAC3B,KAAK,CAACc,QAAQ,EAAE,CAACc,OAAO,CAAC,EACxC3B,cAAc,CACjB,CAAC;AACN;;;;"}
1
+ {"version":3,"file":"useTableSearchListener.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/listeners/useTableSearchListener.ts"],"sourcesContent":["import { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { resetHighlightedColumnIndexes } from '../util/search';\nimport { useLocalization } from '../../../../components/Provider/Localization';\nimport { useLazyEffect } from '../../../../hooks/useLazyEffect';\nimport { getHiddenColumns } from '../util/columns';\n\nexport function useTableSearchListener<TType = unknown>(table: ReactTable<TType>) {\n const meta = table.options.meta as ReactTableMeta<TType>;\n const localization = useLocalization();\n const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);\n const query = table.getState().globalFilter;\n\n // Need to re-run search when columns are getting shown/hidden.\n useLazyEffect(() => {\n if (meta.search.isEnabled) {\n const currentFilter = query;\n requestAnimationFrame(() => {\n table.resetGlobalFilter();\n table.setGlobalFilter(currentFilter);\n });\n\n if (meta.search.handleSearch && meta.search.enableGlobalFilter && query) {\n meta.search.handleSearch(query, hiddenColumns);\n }\n }\n }, [hiddenColumns.length]);\n\n // recalculates highlighted indexes whenever something important changes\n useLazyEffect(() => {\n if (meta.search.isEnabled) {\n resetHighlightedColumnIndexes(query, table, localization);\n }\n }, [\n meta.server.loadAllStatus,\n meta.search.isEnabled,\n meta.search.enableGlobalFilter,\n table.getRowModel().rows.length,\n query,\n JSON.stringify(table.getState().sorting),\n ]);\n}\n"],"names":["useTableSearchListener","table","meta","options","localization","useLocalization","hiddenColumns","getHiddenColumns","getState","columnVisibility","query","globalFilter","useLazyEffect","search","isEnabled","currentFilter","requestAnimationFrame","resetGlobalFilter","setGlobalFilter","handleSearch","enableGlobalFilter","length","resetHighlightedColumnIndexes","server","loadAllStatus","getRowModel","rows","JSON","stringify","sorting"],"mappings":";;;;;SAMgBA,sBAAsBA,CAAkBC,KAAwB;EAC5E,MAAMC,IAAI,GAAGD,KAAK,CAACE,OAAO,CAACD,IAA6B;EACxD,MAAME,YAAY,GAAGC,eAAe,EAAE;EACtC,MAAMC,aAAa,GAAGC,gBAAgB,CAACN,KAAK,CAACO,QAAQ,EAAE,CAACC,gBAAgB,CAAC;EACzE,MAAMC,KAAK,GAAGT,KAAK,CAACO,QAAQ,EAAE,CAACG,YAAY;;EAG3CC,aAAa,CAAC;IACV,IAAIV,IAAI,CAACW,MAAM,CAACC,SAAS,EAAE;MACvB,MAAMC,aAAa,GAAGL,KAAK;MAC3BM,qBAAqB,CAAC;QAClBf,KAAK,CAACgB,iBAAiB,EAAE;QACzBhB,KAAK,CAACiB,eAAe,CAACH,aAAa,CAAC;OACvC,CAAC;MAEF,IAAIb,IAAI,CAACW,MAAM,CAACM,YAAY,IAAIjB,IAAI,CAACW,MAAM,CAACO,kBAAkB,IAAIV,KAAK,EAAE;QACrER,IAAI,CAACW,MAAM,CAACM,YAAY,CAACT,KAAK,EAAEJ,aAAa,CAAC;;;GAGzD,EAAE,CAACA,aAAa,CAACe,MAAM,CAAC,CAAC;;EAG1BT,aAAa,CAAC;IACV,IAAIV,IAAI,CAACW,MAAM,CAACC,SAAS,EAAE;MACvBQ,6BAA6B,CAACZ,KAAK,EAAET,KAAK,EAAEG,YAAY,CAAC;;GAEhE,EAAE,CACCF,IAAI,CAACqB,MAAM,CAACC,aAAa,EACzBtB,IAAI,CAACW,MAAM,CAACC,SAAS,EACrBZ,IAAI,CAACW,MAAM,CAACO,kBAAkB,EAC9BnB,KAAK,CAACwB,WAAW,EAAE,CAACC,IAAI,CAACL,MAAM,EAC/BX,KAAK,EACLiB,IAAI,CAACC,SAAS,CAAC3B,KAAK,CAACO,QAAQ,EAAE,CAACqB,OAAO,CAAC,CAC3C,CAAC;AACN;;;;"}
@@ -1,12 +1,16 @@
1
1
  import React__default from 'react';
2
+ import { getHiddenColumns } from '../util/columns.js';
2
3
 
3
4
  function useTableServerLoadingListener(table, loadPage) {
4
- const sorting = table.getState().sorting;
5
- const columnFilters = table.getState().columnFilters;
5
+ const meta = table.options.meta;
6
6
  // trigger load of the first page on mount
7
7
  React__default.useEffect(() => {
8
8
  if (loadPage) {
9
- loadPage(0, sorting, columnFilters);
9
+ const sorting = table.getState().sorting;
10
+ const columnFilters = table.getState().columnFilters;
11
+ const search = meta.search.enableGlobalFilter ? table.getState().globalFilter : undefined;
12
+ const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
13
+ loadPage(0, sorting, columnFilters, search, hiddenColumns);
10
14
  }
11
15
  }, []);
12
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useTableServerLoadingListener.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable } from '@tanstack/react-table';\nimport { TableServerLoadPageHandler } from '../../types';\n\nexport function useTableServerLoadingListener<TType = unknown>(table: ReactTable<TType>, loadPage?: TableServerLoadPageHandler) {\n const sorting = table.getState().sorting;\n const columnFilters = table.getState().columnFilters;\n\n // trigger load of the first page on mount\n React.useEffect(() => {\n if (loadPage) {\n loadPage(0, sorting, columnFilters);\n }\n }, []);\n}\n"],"names":["useTableServerLoadingListener","table","loadPage","sorting","getState","columnFilters","React","useEffect"],"mappings":";;SAIgBA,6BAA6BA,CAAkBC,KAAwB,EAAEC,QAAqC;EAC1H,MAAMC,OAAO,GAAGF,KAAK,CAACG,QAAQ,EAAE,CAACD,OAAO;EACxC,MAAME,aAAa,GAAGJ,KAAK,CAACG,QAAQ,EAAE,CAACC,aAAa;;EAGpDC,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIL,QAAQ,EAAE;MACVA,QAAQ,CAAC,CAAC,EAAEC,OAAO,EAAEE,aAAa,CAAC;;GAE1C,EAAE,EAAE,CAAC;AACV;;;;"}
1
+ {"version":3,"file":"useTableServerLoadingListener.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { TableServerLoadPageHandler } from '../../types';\nimport { getHiddenColumns } from '../util/columns';\n\nexport function useTableServerLoadingListener<TType = unknown>(table: ReactTable<TType>, loadPage?: TableServerLoadPageHandler) {\n const meta = table.options.meta as ReactTableMeta<TType>;\n\n // trigger load of the first page on mount\n React.useEffect(() => {\n if (loadPage) {\n const sorting = table.getState().sorting;\n const columnFilters = table.getState().columnFilters;\n const search = meta.search.enableGlobalFilter ? table.getState().globalFilter : undefined;\n const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);\n\n loadPage(0, sorting, columnFilters, search, hiddenColumns);\n }\n }, []);\n}\n"],"names":["useTableServerLoadingListener","table","loadPage","meta","options","React","useEffect","sorting","getState","columnFilters","search","enableGlobalFilter","globalFilter","undefined","hiddenColumns","getHiddenColumns","columnVisibility"],"mappings":";;;SAKgBA,6BAA6BA,CAAkBC,KAAwB,EAAEC,QAAqC;EAC1H,MAAMC,IAAI,GAAGF,KAAK,CAACG,OAAO,CAACD,IAA6B;;EAGxDE,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIJ,QAAQ,EAAE;MACV,MAAMK,OAAO,GAAGN,KAAK,CAACO,QAAQ,EAAE,CAACD,OAAO;MACxC,MAAME,aAAa,GAAGR,KAAK,CAACO,QAAQ,EAAE,CAACC,aAAa;MACpD,MAAMC,MAAM,GAAGP,IAAI,CAACO,MAAM,CAACC,kBAAkB,GAAGV,KAAK,CAACO,QAAQ,EAAE,CAACI,YAAY,GAAGC,SAAS;MACzF,MAAMC,aAAa,GAAGC,gBAAgB,CAACd,KAAK,CAACO,QAAQ,EAAE,CAACQ,gBAAgB,CAAC;MAEzEd,QAAQ,CAAC,CAAC,EAAEK,OAAO,EAAEE,aAAa,EAAEC,MAAM,EAAEI,aAAa,CAAC;;GAEjE,EAAE,EAAE,CAAC;AACV;;;;"}
@@ -56,13 +56,13 @@ function useTableManager(props, meta, internalColumns) {
56
56
  const rowClick = useTableRowClick(options.enableRowClick, props.onRowClick);
57
57
  const rowDrag = useTableRowDrag(options.enableRowDrag && !(meta !== null && meta !== void 0 && (_meta$editing = meta.editing) !== null && _meta$editing !== void 0 && _meta$editing.isEditing), props.onRowDrag);
58
58
  const rowDrop = useTableRowDrop(options.enableRowDrop, props.onRowDrop);
59
- const rowExpansion = useTableRowExpansion(options.enableRowExpansion, props.rowExpansionRenderer);
59
+ const rowExpansion = useTableRowExpansion(options.enableRowExpansion, options.enableRowExpansionAll, props.rowExpansionRenderer);
60
60
  const rowGoto = useTableRowGoto(options.enableRowGoto, props.onRowGoto);
61
61
  const rowGroups = useTableRowGroups(props.rowActionsForGroup);
62
62
  const rowHeight = useTableRowHeight(options.enableRowHeight, settings.rowHeight);
63
63
  const rowSelection = useTableRowSelection(!!options.enableRowSelection);
64
- const search = useTableSearch(options.enableSearch, settings.excludeUnmatchedRecordsInSearch);
65
- const server = useTableServerLoading(props.loadPage, props.loadAll, props.pageSize);
64
+ const search = useTableSearch(options.enableSearch, props.onChangeSearch, settings.excludeUnmatchedRecordsInSearch);
65
+ const server = useTableServerLoading(props.loadPage, props.loadAll, props.pages, props.pageSize, props._experimentalDataLoader2);
66
66
  // TODO: memoise
67
67
  // convert jsx column components into valid table columns
68
68
  const {
@@ -113,7 +113,7 @@ function useTableManager(props, meta, internalColumns) {
113
113
  useTableFontSizeListener(instance);
114
114
  useTableRowHeightListener(instance);
115
115
  useTableRowSelectionListener(instance, props.onRowSelect);
116
- useTableSearchListener(instance, props.onChangeSearch);
116
+ useTableSearchListener(instance);
117
117
  useTableServerLoadingListener(instance, server.loadPage);
118
118
  useTableSettingsListener(instance, setSettings);
119
119
  useTableShortcutsListener(instance, props.shortcuts);
@@ -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';\nimport { useLocalization } from '../../../components/Provider/Localization';\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 rowIdentityAccessor: keyof TData;\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 enableEditing?: boolean;\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\n// Placed this array outside the hook to avoid creating a new array reference on each hook re-render\nconst DEFAULT_EMPTY_ARRAY = [];\n\nexport function useTableManager<TType = unknown, TMeta = {}>(\n props: TableProps<TType>,\n meta?: Partial<ReactTableMeta<TType>> & TMeta,\n internalColumns?: useTableManagerInternalColumns<TType>\n) {\n const localization = useLocalization();\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 // ensure data is always valid\n const data = props.data ?? DEFAULT_EMPTY_ARRAY;\n const length = props.length ?? data.length;\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 && !meta?.editing?.isEditing, 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>(\n props,\n settings,\n options,\n internalColumns,\n localization\n );\n\n // configure initial table state\n const initialState = useReactTableInitialState<TType>(props, columns, settings, defaultState);\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, localization),\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 rowIdentityAccessor: props.rowIdentityAccessor,\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":["DEFAULT_EMPTY_ARRAY","useTableManager","props","meta","internalColumns","localization","useLocalization","safeId","id","replace","options","getTableFeaturePreset","settings","setSettings","useTableSettings","enableSaveSettings","defaultSettings","onChangeSettings","data","_props$data","length","_props$length","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","_meta$editing","editing","isEditing","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","instance","useReactTable","getCoreRowModel","configureReactTableOptions","enableGlobalFilter","rowIdentityAccessor","useTableDataListener","useTableFilterListener","onChangeFilter","useTableFontSizeListener","useTableRowHeightListener","useTableRowSelectionListener","onRowSelect","useTableSearchListener","onChangeSearch","useTableServerLoadingListener","useTableSettingsListener","useTableShortcutsListener","shortcuts","useTableSortingListener","onChangeSort","_instance$options$met","state","getState"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgGA;AACA,MAAMA,mBAAmB,GAAG,EAAE;SAEdC,eAAeA,CAC3BC,KAAwB,EACxBC,IAA6C,EAC7CC,eAAuD;;EAEvD,MAAMC,YAAY,GAAGC,eAAe,EAAE;;EAEtC,MAAMC,MAAM,GAAGL,KAAK,CAACM,EAAE,CAACC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC;;EAEzC,MAAMC,OAAO,GAAGC,qBAAqB,CAACT,KAAK,CAAC;;EAG5C,MAAM,CAACU,QAAQ,EAAEC,WAAW,CAAC,GAAGC,gBAAgB,CAC5CJ,OAAO,CAACK,kBAAkB,EAC1BR,MAAM,EACNL,KAAK,CAACc,eAAe,EACrBd,KAAK,CAACe,gBAAgB,CACzB;;EAGD,MAAMC,IAAI,IAAAC,WAAA,GAAGjB,KAAK,CAACgB,IAAI,cAAAC,WAAA,cAAAA,WAAA,GAAInB,mBAAmB;EAC9C,MAAMoB,MAAM,IAAAC,aAAA,GAAGnB,KAAK,CAACkB,MAAM,cAAAC,aAAA,cAAAA,aAAA,GAAIH,IAAI,CAACE,MAAM;;EAG1C,MAAME,cAAc,GAAGC,sBAAsB,CAACb,OAAO,CAACc,oBAAoB,CAAC;EAC3E,MAAMC,cAAc,GAAGC,sBAAsB,CAAChB,OAAO,CAACiB,oBAAoB,CAAC;EAC3E,MAAMC,QAAQ,GAAGC,gBAAgB,CAACnB,OAAO,CAACoB,cAAc,EAAElB,QAAQ,CAACgB,QAAQ,CAAC;EAC5E,MAAMG,MAAM,GAAGC,cAAc,CAACtB,OAAO,CAACuB,YAAY,CAAC;EACnD,MAAMC,QAAQ,GAAGC,gBAAgB,CAACzB,OAAO,CAAC0B,cAAc,EAAE7B,MAAM,CAAC;EACjE,MAAM8B,SAAS,GAAGC,iBAAiB,CAAC5B,OAAO,CAAC6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AAQ,CAAC;EACxDwB,wBAAwB,CAAChB,QAAQ,EAAE9E,WAAW,CAAC;EAC/C+F,yBAAyB,CAACjB,QAAQ,EAAEzF,KAAK,CAAC2G,SAAS,CAAC;EACpDC,uBAAuB,CAACnB,QAAQ,EAAEzF,KAAK,CAAC6G,YAAY,CAAC;EAErD,OAAO;IACHvG,EAAE,EAAED,MAAM;IACVoF,QAAQ;IACRxF,IAAI,GAAA6G,qBAAA,GAAGrB,QAAQ,CAACjF,OAAO,CAACP,IAAI,cAAA6G,qBAAA,cAAAA,qBAAA,GAAI,EAAoC;IACpEC,KAAK,EAAEtB,QAAQ,CAACuB,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';\nimport { useLocalization } from '../../../components/Provider/Localization';\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 rowIdentityAccessor: keyof TData;\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 enableEditing?: boolean;\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\n// Placed this array outside the hook to avoid creating a new array reference on each hook re-render\nconst DEFAULT_EMPTY_ARRAY = [];\n\nexport function useTableManager<TType = unknown, TMeta = {}>(\n props: TableProps<TType>,\n meta?: Partial<ReactTableMeta<TType>> & TMeta,\n internalColumns?: useTableManagerInternalColumns<TType>\n) {\n const localization = useLocalization();\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 // ensure data is always valid\n const data = props.data ?? DEFAULT_EMPTY_ARRAY;\n const length = props.length ?? data.length;\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 && !meta?.editing?.isEditing, props.onRowDrag);\n const rowDrop = useTableRowDrop<TType>(options.enableRowDrop, props.onRowDrop);\n const rowExpansion = useTableRowExpansion<TType>(\n options.enableRowExpansion,\n options.enableRowExpansionAll,\n props.rowExpansionRenderer\n );\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, props.onChangeSearch, settings.excludeUnmatchedRecordsInSearch);\n const server = useTableServerLoading(\n props.loadPage,\n props.loadAll,\n props.pages,\n props.pageSize,\n props._experimentalDataLoader2\n );\n\n // TODO: memoise\n // convert jsx column components into valid table columns\n const { columns, ...defaultState } = mapTableChildrenToColumns<TType>(\n props,\n settings,\n options,\n internalColumns,\n localization\n );\n\n // configure initial table state\n const initialState = useReactTableInitialState<TType>(props, columns, settings, defaultState);\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, localization),\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 rowIdentityAccessor: props.rowIdentityAccessor,\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":["DEFAULT_EMPTY_ARRAY","useTableManager","props","meta","internalColumns","localization","useLocalization","safeId","id","replace","options","getTableFeaturePreset","settings","setSettings","useTableSettings","enableSaveSettings","defaultSettings","onChangeSettings","data","_props$data","length","_props$length","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","_meta$editing","editing","isEditing","onRowDrag","rowDrop","useTableRowDrop","enableRowDrop","onRowDrop","rowExpansion","useTableRowExpansion","enableRowExpansion","enableRowExpansionAll","rowExpansionRenderer","rowGoto","useTableRowGoto","enableRowGoto","onRowGoto","rowGroups","useTableRowGroups","rowActionsForGroup","rowHeight","useTableRowHeight","enableRowHeight","rowSelection","useTableRowSelection","enableRowSelection","search","useTableSearch","enableSearch","onChangeSearch","excludeUnmatchedRecordsInSearch","server","useTableServerLoading","loadPage","loadAll","pages","pageSize","_experimentalDataLoader2","columns","defaultState","mapTableChildrenToColumns","initialState","useReactTableInitialState","instance","useReactTable","getCoreRowModel","configureReactTableOptions","enableGlobalFilter","rowIdentityAccessor","useTableDataListener","useTableFilterListener","onChangeFilter","useTableFontSizeListener","useTableRowHeightListener","useTableRowSelectionListener","onRowSelect","useTableSearchListener","useTableServerLoadingListener","useTableSettingsListener","useTableShortcutsListener","shortcuts","useTableSortingListener","onChangeSort","_instance$options$met","state","getState"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgGA;AACA,MAAMA,mBAAmB,GAAG,EAAE;SAEdC,eAAeA,CAC3BC,KAAwB,EACxBC,IAA6C,EAC7CC,eAAuD;;EAEvD,MAAMC,YAAY,GAAGC,eAAe,EAAE;;EAEtC,MAAMC,MAAM,GAAGL,KAAK,CAACM,EAAE,CAACC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC;;EAEzC,MAAMC,OAAO,GAAGC,qBAAqB,CAACT,KAAK,CAAC;;EAG5C,MAAM,CAACU,QAAQ,EAAEC,WAAW,CAAC,GAAGC,gBAAgB,CAC5CJ,OAAO,CAACK,kBAAkB,EAC1BR,MAAM,EACNL,KAAK,CAACc,eAAe,EACrBd,KAAK,CAACe,gBAAgB,CACzB;;EAGD,MAAMC,IAAI,IAAAC,WAAA,GAAGjB,KAAK,CAACgB,IAAI,cAAAC,WAAA,cAAAA,WAAA,GAAInB,mBAAmB;EAC9C,MAAMoB,MAAM,IAAAC,aAAA,GAAGnB,KAAK,CAACkB,MAAM,cAAAC,aAAA,cAAAA,aAAA,GAAIH,IAAI,CAACE,MAAM;;EAG1C,MAAME,cAAc,GAAGC,sBAAsB,CAACb,OAAO,CAACc,oBAAoB,CAAC;EAC3E,MAAMC,cAAc,GAAGC,sBAAsB,CAAChB,OAAO,CAACiB,oBAAoB,CAAC;EAC3E,MAAMC,QAAQ,GAAGC,gBAAgB,CAACnB,OAAO,CAACoB,cAAc,EAAElB,QAAQ,CAACgB,QAAQ,CAAC;EAC5E,MAAMG,MAAM,GAAGC,cAAc,CAACtB,OAAO,CAACuB,YAAY,CAAC;EACnD,MA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tDC,wBAAwB,CAACT,QAAQ,CAAC;EAClCU,yBAAyB,CAACV,QAAQ,CAAC;EACnCW,4BAA4B,CAACX,QAAQ,EAAE7F,KAAK,CAACyG,WAAW,CAAC;EACzDC,sBAAsB,CAACb,QAAQ,CAAC;EAChCc,6BAA6B,CAACd,QAAQ,EAAEZ,MAAM,CAACE,QAAQ,CAAC;EACxDyB,wBAAwB,CAACf,QAAQ,EAAElF,WAAW,CAAC;EAC/CkG,yBAAyB,CAAChB,QAAQ,EAAE7F,KAAK,CAAC8G,SAAS,CAAC;EACpDC,uBAAuB,CAAClB,QAAQ,EAAE7F,KAAK,CAACgH,YAAY,CAAC;EAErD,OAAO;IACH1G,EAAE,EAAED,MAAM;IACVwF,QAAQ;IACR5F,IAAI,GAAAgH,qBAAA,GAAGpB,QAAQ,CAACrF,OAAO,CAACP,IAAI,cAAAgH,qBAAA,cAAAA,qBAAA,GAAI,EAAoC;IACpEC,KAAK,EAAErB,QAAQ,CAACsB,QAAQ;GAC3B;AACL;;;;"}
@@ -102,6 +102,9 @@ function unfreezeAllExternalColumns(leftPinnedState) {
102
102
  function freezeUptoExternalColumn(index, columns) {
103
103
  return columns.slice(0, index + 1);
104
104
  }
105
+ function getHiddenColumns(columnVisibility = {}) {
106
+ return Object.keys(columnVisibility).filter(c => columnVisibility[c] === false);
107
+ }
105
108
 
106
- export { ensureOrdering, freezeUptoExternalColumn, getCellMinWidth, isCellHighlighted, isInternalColumn, unfreezeAllExternalColumns };
109
+ export { ensureOrdering, freezeUptoExternalColumn, getCellMinWidth, getHiddenColumns, isCellHighlighted, isInternalColumn, unfreezeAllExternalColumns };
107
110
  //# sourceMappingURL=columns.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"columns.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/util/columns.ts"],"sourcesContent":["import { ColumnDef as ReactTableColumnDef, GroupColumnDef as ReactTableGroupColumnDef } from '@tanstack/react-table';\nimport { FontSize, FontSizes } from '../../../../types';\nimport { TableColumnDataType } from '../../types';\nimport { isMatched } from './search';\nimport { Localization } from '../../../../components/Provider/Localization';\n\nexport function isInternalColumn(id: string | undefined) {\n return id?.startsWith('__');\n}\n\n// column widths\nexport const getCellMinWidth = (fontSize: FontSize = 'medium') => {\n switch (fontSize) {\n case FontSizes.small:\n return 57;\n\n case FontSizes.large:\n return 83;\n\n default:\n case FontSizes.medium:\n return 72;\n }\n};\n\n// highlighting\nexport function isCellHighlighted(\n query: string,\n value: unknown,\n dataType: TableColumnDataType | undefined,\n localization: Localization\n) {\n if (value === undefined || value === null) {\n return false;\n }\n\n return isMatched(query, value, dataType, localization);\n}\n\nfunction orderColumn<TType = unknown>(\n column: ReactTableColumnDef<TType>,\n { orderingDisabled, orderingEnabled }: { orderingDisabled: string[]; orderingEnabled: string[] }\n) {\n const groupedColumn = column as ReactTableGroupColumnDef<TType>;\n\n if (Array.isArray(groupedColumn.columns) && groupedColumn.columns.length > 0) {\n groupedColumn.columns.forEach((subcolumn: ReactTableColumnDef<TType>) =>\n orderColumn(subcolumn, { orderingDisabled, orderingEnabled })\n );\n } else {\n if (column.meta?.enableOrdering) {\n orderingEnabled.push(column.id as string);\n } else {\n orderingDisabled.push(column.id as string);\n }\n }\n}\n\n// ordering\nexport function ensureOrdering<TType = unknown>(\n columns: ReactTableColumnDef<TType>[],\n settingsOrder: string[] | undefined,\n pinnedOrder: string[] | undefined = [],\n internalColumnsPinnedToTheRight: string[] = ['__actions']\n): string[] {\n // internal columns come with a defined order\n const internalColumns = columns\n .filter(column => isInternalColumn(column.id) && !internalColumnsPinnedToTheRight.includes(String(column.id)))\n .map(column => column.id) as string[];\n\n // columns with ordering disabled should be moved to the front\n const orderingDisabled: string[] = [];\n let orderingEnabled: string[] = [];\n\n let orderedColumns = columns;\n\n // if settings is defined, make sure the columns that are actual children are sorted by it\n if (Array.isArray(settingsOrder)) {\n orderedColumns = columns.slice().sort(\n // the magic >>> 0 here ensures that columns that aren't found in settings, but are children, are pushed to the end\n (a, b) => (settingsOrder.indexOf(a.id as string) >>> 0) - (settingsOrder.indexOf(b.id as string) >>> 0)\n );\n }\n\n orderedColumns.forEach(column => {\n if (isInternalColumn(column.id)) {\n return;\n }\n\n orderColumn(column, { orderingDisabled, orderingEnabled });\n });\n\n if (settingsOrder && settingsOrder.length > 0) {\n const columnsAbsentInSettingsOrder: string[] = [];\n\n orderingEnabled = orderingEnabled\n .reduce((acc, column) => {\n const index = settingsOrder.indexOf(column);\n if (index > -1) {\n acc[index] = column;\n } else {\n columnsAbsentInSettingsOrder.push(column);\n }\n\n return acc;\n }, [] as string[])\n .filter(column => !!column)\n // Append absent columns at the end\n .concat(columnsAbsentInSettingsOrder);\n }\n\n // if pinned columns are defined, make sure they are sorted first, this ensures state matches the freezing \"upto\" behaviour\n if (Array.isArray(pinnedOrder)) {\n orderingEnabled.sort(\n // the magic >>> 0 here ensures that columns that aren't found in settings, but are children, are pushed to the end\n (a, b) => (pinnedOrder.indexOf(a as string) >>> 0) - (pinnedOrder.indexOf(b as string) >>> 0)\n );\n }\n\n const order = [...internalColumns, ...orderingDisabled, ...orderingEnabled];\n\n // actions should always be last, enforce that\n internalColumnsPinnedToTheRight.forEach(id => {\n if (columns.findIndex(column => column.id === id) > -1) {\n order.push(id);\n }\n });\n\n return order;\n}\n\n// freezing - we use the react-table pinning state, but that requires some mapping between them\nexport function unfreezeAllExternalColumns(leftPinnedState?: string[]): string[] {\n return leftPinnedState?.filter(id => isInternalColumn(id) && id !== '__actions') ?? [];\n}\n\nexport function freezeUptoExternalColumn(index: number, columns: string[]): string[] {\n return columns.slice(0, index + 1);\n}\n"],"names":["isInternalColumn","id","startsWith","getCellMinWidth","fontSize","FontSizes","small","large","medium","isCellHighlighted","query","value","dataType","localization","undefined","isMatched","orderColumn","column","orderingDisabled","orderingEnabled","groupedColumn","Array","isArray","columns","length","forEach","subcolumn","_column$meta","meta","enableOrdering","push","ensureOrdering","settingsOrder","pinnedOrder","internalColumnsPinnedToTheRight","internalColumns","filter","includes","String","map","orderedColumns","slice","sort","a","b","indexOf","columnsAbsentInSettingsOrder","reduce","acc","index","concat","order","findIndex","unfreezeAllExternalColumns","leftPinnedState","_leftPinnedState$filt","freezeUptoExternalColumn"],"mappings":";;;SAMgBA,gBAAgBA,CAACC,EAAsB;EACnD,OAAOA,EAAE,aAAFA,EAAE,uBAAFA,EAAE,CAAEC,UAAU,CAAC,IAAI,CAAC;AAC/B;AAEA;MACaC,eAAe,GAAGA,CAACC,WAAqB,QAAQ;EACzD,QAAQA,QAAQ;IACZ,KAAKC,SAAS,CAACC,KAAK;MAChB,OAAO,EAAE;IAEb,KAAKD,SAAS,CAACE,KAAK;MAChB,OAAO,EAAE;IAEb;IACA,KAAKF,SAAS,CAACG,MAAM;MACjB,OAAO,EAAE;;AAErB;AAEA;SACgBC,iBAAiBA,CAC7BC,KAAa,EACbC,KAAc,EACdC,QAAyC,EACzCC,YAA0B;EAE1B,IAAIF,KAAK,KAAKG,SAAS,IAAIH,KAAK,KAAK,IAAI,EAAE;IACvC,OAAO,KAAK;;EAGhB,OAAOI,SAAS,CAACL,KAAK,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,YAAY,CAAC;AAC1D;AAEA,SAASG,WAAWA,CAChBC,MAAkC,EAClC;EAAEC,gBAAgB;EAAEC;CAA4E;EAEhG,MAAMC,aAAa,GAAGH,MAAyC;EAE/D,IAAII,KAAK,CAACC,OAAO,CAACF,aAAa,CAACG,OAAO,CAAC,IAAIH,aAAa,CAACG,OAAO,CAACC,MAAM,GAAG,CAAC,EAAE;IAC1EJ,aAAa,CAACG,OAAO,CAACE,OAAO,CAAEC,SAAqC,IAChEV,WAAW,CAACU,SAAS,EAAE;MAAER,gBAAgB;MAAEC;KAAiB,CAAC,CAChE;GACJ,MAAM;IAAA,IAAAQ,YAAA;IACH,KAAAA,YAAA,GAAIV,MAAM,CAACW,IAAI,cAAAD,YAAA,eAAXA,YAAA,CAAaE,cAAc,EAAE;MAC7BV,eAAe,CAACW,IAAI,CAACb,M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,CAACP,KAAa,EAAE1B,OAAiB;EACrE,OAAOA,OAAO,CAACkB,KAAK,CAAC,CAAC,EAAEQ,KAAK,GAAG,CAAC,CAAC;AACtC;;;;"}
1
+ {"version":3,"file":"columns.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/util/columns.ts"],"sourcesContent":["import {\n ColumnDef as ReactTableColumnDef,\n GroupColumnDef as ReactTableGroupColumnDef,\n VisibilityState as ReactTableVisibilityState,\n} from '@tanstack/react-table';\nimport { FontSize, FontSizes } from '../../../../types';\nimport { TableColumnDataType } from '../../types';\nimport { isMatched } from './search';\nimport { Localization } from '../../../../components/Provider/Localization';\n\nexport function isInternalColumn(id: string | undefined) {\n return id?.startsWith('__');\n}\n\n// column widths\nexport const getCellMinWidth = (fontSize: FontSize = 'medium') => {\n switch (fontSize) {\n case FontSizes.small:\n return 57;\n\n case FontSizes.large:\n return 83;\n\n default:\n case FontSizes.medium:\n return 72;\n }\n};\n\n// highlighting\nexport function isCellHighlighted(\n query: string,\n value: unknown,\n dataType: TableColumnDataType | undefined,\n localization: Localization\n) {\n if (value === undefined || value === null) {\n return false;\n }\n\n return isMatched(query, value, dataType, localization);\n}\n\nfunction orderColumn<TType = unknown>(\n column: ReactTableColumnDef<TType>,\n { orderingDisabled, orderingEnabled }: { orderingDisabled: string[]; orderingEnabled: string[] }\n) {\n const groupedColumn = column as ReactTableGroupColumnDef<TType>;\n\n if (Array.isArray(groupedColumn.columns) && groupedColumn.columns.length > 0) {\n groupedColumn.columns.forEach((subcolumn: ReactTableColumnDef<TType>) =>\n orderColumn(subcolumn, { orderingDisabled, orderingEnabled })\n );\n } else {\n if (column.meta?.enableOrdering) {\n orderingEnabled.push(column.id as string);\n } else {\n orderingDisabled.push(column.id as string);\n }\n }\n}\n\n// ordering\nexport function ensureOrdering<TType = unknown>(\n columns: ReactTableColumnDef<TType>[],\n settingsOrder: string[] | undefined,\n pinnedOrder: string[] | undefined = [],\n internalColumnsPinnedToTheRight: string[] = ['__actions']\n): string[] {\n // internal columns come with a defined order\n const internalColumns = columns\n .filter(column => isInternalColumn(column.id) && !internalColumnsPinnedToTheRight.includes(String(column.id)))\n .map(column => column.id) as string[];\n\n // columns with ordering disabled should be moved to the front\n const orderingDisabled: string[] = [];\n let orderingEnabled: string[] = [];\n\n let orderedColumns = columns;\n\n // if settings is defined, make sure the columns that are actual children are sorted by it\n if (Array.isArray(settingsOrder)) {\n orderedColumns = columns.slice().sort(\n // the magic >>> 0 here ensures that columns that aren't found in settings, but are children, are pushed to the end\n (a, b) => (settingsOrder.indexOf(a.id as string) >>> 0) - (settingsOrder.indexOf(b.id as string) >>> 0)\n );\n }\n\n orderedColumns.forEach(column => {\n if (isInternalColumn(column.id)) {\n return;\n }\n\n orderColumn(column, { orderingDisabled, orderingEnabled });\n });\n\n if (settingsOrder && settingsOrder.length > 0) {\n const columnsAbsentInSettingsOrder: string[] = [];\n\n orderingEnabled = orderingEnabled\n .reduce((acc, column) => {\n const index = settingsOrder.indexOf(column);\n if (index > -1) {\n acc[index] = column;\n } else {\n columnsAbsentInSettingsOrder.push(column);\n }\n\n return acc;\n }, [] as string[])\n .filter(column => !!column)\n // Append absent columns at the end\n .concat(columnsAbsentInSettingsOrder);\n }\n\n // if pinned columns are defined, make sure they are sorted first, this ensures state matches the freezing \"upto\" behaviour\n if (Array.isArray(pinnedOrder)) {\n orderingEnabled.sort(\n // the magic >>> 0 here ensures that columns that aren't found in settings, but are children, are pushed to the end\n (a, b) => (pinnedOrder.indexOf(a as string) >>> 0) - (pinnedOrder.indexOf(b as string) >>> 0)\n );\n }\n\n const order = [...internalColumns, ...orderingDisabled, ...orderingEnabled];\n\n // actions should always be last, enforce that\n internalColumnsPinnedToTheRight.forEach(id => {\n if (columns.findIndex(column => column.id === id) > -1) {\n order.push(id);\n }\n });\n\n return order;\n}\n\n// freezing - we use the react-table pinning state, but that requires some mapping between them\nexport function unfreezeAllExternalColumns(leftPinnedState?: string[]): string[] {\n return leftPinnedState?.filter(id => isInternalColumn(id) && id !== '__actions') ?? [];\n}\n\nexport function freezeUptoExternalColumn(index: number, columns: string[]): string[] {\n return columns.slice(0, index + 1);\n}\n\nexport function getHiddenColumns(columnVisibility: ReactTableVisibilityState = {}) {\n return Object.keys(columnVisibility).filter(c => columnVisibility[c] === false);\n}\n"],"names":["isInternalColumn","id","startsWith","getCellMinWidth","fontSize","FontSizes","small","large","medium","isCellHighlighted","query","value","dataType","localization","undefined","isMatched","orderColumn","column","orderingDisabled","orderingEnabled","groupedColumn","Array","isArray","columns","length","forEach","subcolumn","_column$meta","meta","enableOrdering","push","ensureOrdering","settingsOrder","pinnedOrder","internalColumnsPinnedToTheRight","internalColumns","filter","includes","String","map","orderedColumns","slice","sort","a","b","indexOf","columnsAbsentInSettingsOrder","reduce","acc","index","concat","order","findIndex","unfreezeAllExternalColumns","leftPinnedState","_leftPinnedState$filt","freezeUptoExternalColumn","getHiddenColumns","columnVisibility","Object","keys","c"],"mappings":";;;SAUgBA,gBAAgBA,CAACC,EAAsB;EACnD,OAAOA,EAAE,aAAFA,EAAE,uBAAFA,EAAE,CAAEC,UAAU,CAAC,IAAI,CAAC;AAC/B;AAEA;MACaC,eAAe,GAAGA,CAACC,WAAqB,QAAQ;EACzD,QAAQA,QAAQ;IACZ,KAAKC,SAAS,CAACC,KAAK;MAChB,OAAO,EAAE;IAEb,KAAKD,SAAS,CAACE,KAAK;MAChB,OAAO,EAAE;IAEb;IACA,KAAKF,SAAS,CAACG,MAAM;MACjB,OAAO,EAAE;;AAErB;AAEA;SACgBC,iBAAiBA,CAC7BC,KAAa,EACbC,KAAc,EACdC,QAAyC,EACzCC,YAA0B;EAE1B,IAAIF,KAAK,KAAKG,SAAS,IAAIH,KAAK,KAAK,IAAI,EAAE;IACvC,OAAO,KAAK;;EAGhB,OAAOI,SAAS,CAACL,KAAK,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,YAAY,CAAC;AAC1D;AAEA,SAASG,WAAWA,CAChBC,MAAkC,EAClC;EAAEC,gB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AAIsB,OAAO,CAAC6B,SAAS,CAACnC,MAAM,IAAIA,MAAM,CAAChB,EAAE,KAAKA,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE;MACpDkD,KAAK,CAACrB,IAAI,CAAC7B,EAAE,CAAC;;GAErB,CAAC;EAEF,OAAOkD,KAAK;AAChB;AAEA;SACgBE,0BAA0BA,CAACC,eAA0B;;EACjE,QAAAC,qBAAA,GAAOD,eAAe,aAAfA,eAAe,uBAAfA,eAAe,CAAElB,MAAM,CAACnC,EAAE,IAAID,gBAAgB,CAACC,EAAE,CAAC,IAAIA,EAAE,KAAK,WAAW,CAAC,cAAAsD,qBAAA,cAAAA,qBAAA,GAAI,EAAE;AAC1F;SAEgBC,wBAAwBA,CAACP,KAAa,EAAE1B,OAAiB;EACrE,OAAOA,OAAO,CAACkB,KAAK,CAAC,CAAC,EAAEQ,KAAK,GAAG,CAAC,CAAC;AACtC;SAEgBQ,gBAAgBA,CAACC,mBAA8C,EAAE;EAC7E,OAAOC,MAAM,CAACC,IAAI,CAACF,gBAAgB,CAAC,CAACtB,MAAM,CAACyB,CAAC,IAAIH,gBAAgB,CAACG,CAAC,CAAC,KAAK,KAAK,CAAC;AACnF;;;;"}
@@ -7,6 +7,7 @@ const DEFAULT_PRESET = {
7
7
  enableColumnHiding: false,
8
8
  enableColumnResizing: false,
9
9
  enableRowExpansion: false,
10
+ enableRowExpansionAll: true,
10
11
  enableRowSelection: false,
11
12
  // custom -- common between all table types
12
13
  enableColumnOrdering: false,
@@ -33,6 +34,7 @@ const presets = {
33
34
  enableColumnHiding: true,
34
35
  enableColumnResizing: true,
35
36
  enableRowExpansion: true,
37
+ enableRowExpansionAll: true,
36
38
  enableRowSelection: true,
37
39
  // custom -- common between all table types
38
40
  enableColumnOrdering: true,
@@ -58,6 +60,7 @@ const presets = {
58
60
  enableColumnHiding: false,
59
61
  enableColumnResizing: false,
60
62
  enableRowExpansion: true,
63
+ enableRowExpansionAll: true,
61
64
  enableRowSelection: true,
62
65
  // custom -- common between all table types
63
66
  enableColumnOrdering: false,
@@ -83,6 +86,7 @@ const presets = {
83
86
  enableColumnHiding: false,
84
87
  enableColumnResizing: false,
85
88
  enableRowExpansion: true,
89
+ enableRowExpansionAll: true,
86
90
  enableRowSelection: false,
87
91
  // custom -- common between all table types
88
92
  enableColumnOrdering: false,
@@ -100,7 +104,7 @@ const presets = {
100
104
  }
101
105
  };
102
106
  function getTableFeaturePreset(props) {
103
- var _props$enableRowActio, _props$enableRowClick, _props$enableRowDrag, _props$enableRowDrop, _props$enableRowGoto, _props$enableRowExpan, _props$enableRowSelec, _props$enableFilterin, _props$enableSearch, _props$enableSorting, _props$enableColumnFr, _props$enableColumnHi, _props$enableColumnRe, _props$enableColumnOr, _props$enableFontSize, _props$enableFooter, _props$enablePrinting, _props$enableRowActiv, _props$rowActions, _props$enableRowHeigh, _props$enableSaveSett;
107
+ var _props$enableRowActio, _props$enableRowClick, _props$enableRowDrag, _props$enableRowDrop, _props$enableRowGoto, _props$enableRowExpan, _props$enableRowExpan2, _props$enableRowSelec, _props$enableFilterin, _props$enableSearch, _props$enableSorting, _props$enableColumnFr, _props$enableColumnHi, _props$enableColumnRe, _props$enableColumnOr, _props$enableFontSize, _props$enableFooter, _props$enablePrinting, _props$enableRowActiv, _props$rowActions, _props$enableRowHeigh, _props$enableSaveSett;
104
108
  const presetOptions = props.preset ? presets[props.preset] : DEFAULT_PRESET;
105
109
  const enableRowActions = (_props$enableRowActio = props.enableRowActions) !== null && _props$enableRowActio !== void 0 ? _props$enableRowActio : presetOptions.enableRowActions;
106
110
  const enableRowClick = (_props$enableRowClick = props.enableRowClick) !== null && _props$enableRowClick !== void 0 ? _props$enableRowClick : presetOptions.enableRowClick;
@@ -108,6 +112,7 @@ function getTableFeaturePreset(props) {
108
112
  const enableRowDrop = (_props$enableRowDrop = props.enableRowDrop) !== null && _props$enableRowDrop !== void 0 ? _props$enableRowDrop : presetOptions.enableRowDrop;
109
113
  const enableRowGoto = (_props$enableRowGoto = props.enableRowGoto) !== null && _props$enableRowGoto !== void 0 ? _props$enableRowGoto : presetOptions.enableRowGoto;
110
114
  const enableRowExpansion = (_props$enableRowExpan = props.enableRowExpansion) !== null && _props$enableRowExpan !== void 0 ? _props$enableRowExpan : presetOptions.enableRowExpansion;
115
+ const enableRowExpansionAll = (_props$enableRowExpan2 = props.enableRowExpansionAll) !== null && _props$enableRowExpan2 !== void 0 ? _props$enableRowExpan2 : presetOptions.enableRowExpansionAll;
111
116
  const enableRowSelection = (_props$enableRowSelec = props.enableRowSelection) !== null && _props$enableRowSelec !== void 0 ? _props$enableRowSelec : presetOptions.enableRowSelection;
112
117
  return {
113
118
  // react-table built-in
@@ -132,6 +137,7 @@ function getTableFeaturePreset(props) {
132
137
  enableRowDrag: enableRowDrag && !!props.onRowDrag,
133
138
  enableRowDrop: enableRowDrop && !!props.onRowDrop,
134
139
  enableRowGoto: enableRowGoto && !!props.onRowGoto,
140
+ enableRowExpansionAll: enableRowExpansion && enableRowExpansionAll && !!props.rowExpansionRenderer,
135
141
  enableRowHeight: (_props$enableRowHeigh = props.enableRowHeight) !== null && _props$enableRowHeigh !== void 0 ? _props$enableRowHeigh : presetOptions.enableRowHeight,
136
142
  enableSaveSettings: (_props$enableSaveSett = props.enableSaveSettings) !== null && _props$enableSaveSett !== void 0 ? _props$enableSaveSett : presetOptions.enableSaveSettings
137
143
  };
@@ -1 +1 @@
1
- {"version":3,"file":"presets.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/util/presets.ts"],"sourcesContent":["import { TableFeatureProps, TablePreset, TableProps } from '../../types';\n\nconst DEFAULT_PRESET: TableFeatureProps = {\n // react-table built-in\n enableFiltering: false,\n enableSearch: false,\n enableSorting: false,\n enableColumnFreezing: false,\n enableColumnHiding: false,\n enableColumnResizing: false,\n enableRowExpansion: false,\n enableRowSelection: false,\n\n // custom -- common between all table types\n enableColumnOrdering: false,\n enableFontSize: false,\n enableFooter: false,\n enablePrinting: false,\n enableRowActive: true,\n enableRowActions: true,\n enableRowClick: false,\n enableRowDrag: false,\n enableRowDrop: false,\n enableRowGoto: false,\n enableRowHeight: false,\n enableSaveSettings: false,\n};\n\nconst presets: Record<TablePreset, TableFeatureProps> = {\n // View/edit/create on page\n complex: {\n // react-table built-in\n enableFiltering: true,\n enableSearch: true,\n enableSorting: true,\n enableColumnFreezing: true,\n enableColumnHiding: true,\n enableColumnResizing: true,\n enableRowExpansion: true,\n enableRowSelection: true,\n\n // custom -- common between all table types\n enableColumnOrdering: true,\n enableFontSize: true,\n enableFooter: true,\n enablePrinting: true,\n enableRowActive: true,\n enableRowActions: true,\n enableRowClick: true,\n enableRowDrag: true,\n enableRowDrop: true,\n enableRowGoto: true,\n enableRowHeight: true,\n enableSaveSettings: true,\n },\n // View/create in dialog\n list: {\n // react-table built-in\n enableFiltering: false,\n enableSearch: true,\n enableSorting: true,\n enableColumnFreezing: false,\n enableColumnHiding: false,\n enableColumnResizing: false,\n enableRowExpansion: true,\n enableRowSelection: true,\n\n // custom -- common between all table types\n enableColumnOrdering: false,\n enableFontSize: false,\n enableFooter: false,\n enablePrinting: false,\n enableRowActive: true,\n enableRowActions: true,\n enableRowClick: true,\n enableRowDrag: false,\n enableRowDrop: false,\n enableRowGoto: false,\n enableRowHeight: false,\n enableSaveSettings: true,\n },\n // View in card or dialog\n simple: {\n // react-table built-in\n enableFiltering: false,\n enableSearch: false,\n enableSorting: true,\n enableColumnFreezing: false,\n enableColumnHiding: false,\n enableColumnResizing: false,\n enableRowExpansion: true,\n enableRowSelection: false,\n\n // custom -- common between all table types\n enableColumnOrdering: false,\n enableFontSize: false,\n enableFooter: false,\n enablePrinting: false,\n enableRowActive: true,\n enableRowActions: false,\n enableRowClick: true,\n enableRowDrag: false,\n enableRowDrop: false,\n enableRowGoto: false,\n enableRowHeight: false,\n enableSaveSettings: true,\n },\n};\n\nexport function getTableFeaturePreset<TType = unknown>(props: TableProps<TType>): TableFeatureProps<TType> {\n const presetOptions = props.preset ? presets[props.preset] : DEFAULT_PRESET;\n\n const enableRowActions = props.enableRowActions ?? presetOptions.enableRowActions;\n const enableRowClick = props.enableRowClick ?? presetOptions.enableRowClick;\n const enableRowDrag = props.enableRowDrag ?? presetOptions.enableRowDrag;\n const enableRowDrop = props.enableRowDrop ?? presetOptions.enableRowDrop;\n const enableRowGoto = props.enableRowGoto ?? presetOptions.enableRowGoto;\n const enableRowExpansion = props.enableRowExpansion ?? presetOptions.enableRowExpansion;\n const enableRowSelection = props.enableRowSelection ?? presetOptions.enableRowSelection;\n\n return {\n // react-table built-in\n enableFiltering: props.enableFiltering ?? presetOptions.enableFiltering,\n enableSearch: props.enableSearch ?? presetOptions.enableSearch,\n enableSorting: props.enableSorting ?? presetOptions.enableSorting,\n enableColumnFreezing: props.enableColumnFreezing ?? presetOptions.enableColumnFreezing,\n enableColumnHiding: props.enableColumnHiding ?? presetOptions.enableColumnHiding,\n enableColumnResizing: props.enableColumnResizing ?? presetOptions.enableColumnResizing,\n enableRowExpansion: enableRowExpansion && !!props.rowExpansionRenderer,\n enableRowSelection: !!props.onRowSelect && enableRowSelection,\n\n // custom -- common between all table types\n enableColumnOrdering: props.enableColumnOrdering ?? presetOptions.enableColumnOrdering,\n enableFontSize: props.enableFontSize ?? presetOptions.enableFontSize,\n enableFooter: props.enableFooter ?? presetOptions.enableFooter,\n enablePrinting: props.enablePrinting ?? presetOptions.enablePrinting,\n enableRowActive: props.enableRowActive ?? presetOptions.enableRowActive,\n enableRowActions: enableRowActions && !!props.rowActions?.length,\n // enableRowClick can be either function or boolean, that is why we need to pass exactly enableRowClick,\n // and not just result of the condition\n enableRowClick: enableRowClick && !!props.onRowClick ? enableRowClick : false,\n enableRowDrag: enableRowDrag && !!props.onRowDrag,\n enableRowDrop: enableRowDrop && !!props.onRowDrop,\n enableRowGoto: enableRowGoto && !!props.onRowGoto,\n enableRowHeight: props.enableRowHeight ?? presetOptions.enableRowHeight,\n enableSaveSettings: props.enableSaveSettings ?? presetOptions.enableSaveSettings,\n };\n}\n"],"names":["DEFAULT_PRESET","enableFiltering","enableSearch","enableSorting","enableColumnFreezing","enableColumnHiding","enableColumnResizing","enableRowExpansion","enableRowSelection","enableColumnOrdering","enableFontSize","enableFooter","enablePrinting","enableRowActive","enableRowActions","enableRowClick","enableRowDrag","enableRowDrop","enableRowGoto","enableRowHeight","enableSaveSettings","presets","complex","list","simple","getTableFeaturePreset","props","presetOptions","preset","_props$enableRowActio","_props$enableRowClick","_props$enableRowDrag","_props$enableRowDrop","_props$enableRowGoto","_props$enableRowExpan","_props$enableRowSelec","_props$enableFilterin","_props$enableSearch","_props$enableSorting","_props$enableColumnFr","_props$enableColumnHi","_props$enableColumnRe","rowExpansionRenderer","onRowSelect","_props$enableColumnOr","_props$enableFontSize","_props$enableFooter","_props$enablePrinting","_props$enableRowActiv","_props$rowActions","rowActions","length","onRowClick","onRowDrag","onRowDrop","onRowGoto","_props$enableRowHeigh","_props$enableSaveSett"],"mappings":"AAEA,MAAMA,cAAc,GAAsB;;EAEtCC,eAAe,EAAE,KAAK;EACtBC,YAAY,EAAE,KAAK;EACnBC,aAAa,EAAE,KAAK;EACpBC,oBAAoB,EAAE,KAAK;EAC3BC,kBAAkB,EAAE,KAAK;EACzBC,oBAAoB,EAAE,KAAK;EAC3BC,kBAAkB,EAAE,KAAK;EACzBC,kBAAkB,EAAE,KAAK;;EAGzBC,oBAAoB,EAAE,KAAK;EAC3BC,cAAc,EAAE,KAAK;EACrBC,YAAY,EAAE,KAAK;EACnBC,cAAc,EAAE,KAAK;EACrBC,eAAe,EAAE,IAAI;EACrBC,gBAAgB,EAAE,IAAI;EACtBC,cAAc,EAAE,KAAK;EACrBC,aAAa,EAAE,KAAK;EACpBC,aAAa,EAAE,KAAK;EACpBC,aAAa,EAAE,KAAK;EACpBC,eAAe,EAAE,KAAK;EACtBC,kBAAkB,EAAE;CACvB;AAED,MAAMC,OAAO,GAA2C;;EAEpDC,OAAO,EAAE;;IAELrB,eAAe,EAAE,IAAI;IACrBC,YAAY,EAA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K,CAACf,YAAY,cAAAmC,mBAAA,cAAAA,mBAAA,GAAInB,aAAa,CAAChB,YAAY;IAC9DC,cAAc,GAAAmC,qBAAA,GAAErB,KAAK,CAACd,cAAc,cAAAmC,qBAAA,cAAAA,qBAAA,GAAIpB,aAAa,CAACf,cAAc;IACpEC,eAAe,GAAAmC,qBAAA,GAAEtB,KAAK,CAACb,eAAe,cAAAmC,qBAAA,cAAAA,qBAAA,GAAIrB,aAAa,CAACd,eAAe;IACvEC,gBAAgB,EAAEA,gBAAgB,IAAI,CAAC,GAAAmC,iBAAA,GAACvB,KAAK,CAACwB,UAAU,cAAAD,iBAAA,eAAhBA,iBAAA,CAAkBE,MAAM;;;IAGhEpC,cAAc,EAAEA,cAAc,IAAI,CAAC,CAACW,KAAK,CAAC0B,UAAU,GAAGrC,cAAc,GAAG,KAAK;IAC7EC,aAAa,EAAEA,aAAa,IAAI,CAAC,CAACU,KAAK,CAAC2B,SAAS;IACjDpC,aAAa,EAAEA,aAAa,IAAI,CAAC,CAACS,KAAK,CAAC4B,SAAS;IACjDpC,aAAa,EAAEA,aAAa,IAAI,CAAC,CAACQ,KAAK,CAAC6B,SAAS;IACjDpC,eAAe,GAAAqC,qBAAA,GAAE9B,KAAK,CAACP,eAAe,cAAAqC,qBAAA,cAAAA,qBAAA,GAAI7B,aAAa,CAACR,eAAe;IACvEC,kBAAkB,GAAAqC,qBAAA,GAAE/B,KAAK,CAACN,kBAAkB,cAAAqC,qBAAA,cAAAA,qBAAA,GAAI9B,aAAa,CAACP;GACjE;AACL;;;;"}
1
+ {"version":3,"file":"presets.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/util/presets.ts"],"sourcesContent":["import { TableFeatureProps, TablePreset, TableProps } from '../../types';\n\nconst DEFAULT_PRESET: TableFeatureProps = {\n // react-table built-in\n enableFiltering: false,\n enableSearch: false,\n enableSorting: false,\n enableColumnFreezing: false,\n enableColumnHiding: false,\n enableColumnResizing: false,\n enableRowExpansion: false,\n enableRowExpansionAll: true,\n enableRowSelection: false,\n\n // custom -- common between all table types\n enableColumnOrdering: false,\n enableFontSize: false,\n enableFooter: false,\n enablePrinting: false,\n enableRowActive: true,\n enableRowActions: true,\n enableRowClick: false,\n enableRowDrag: false,\n enableRowDrop: false,\n enableRowGoto: false,\n enableRowHeight: false,\n enableSaveSettings: false,\n};\n\nconst presets: Record<TablePreset, TableFeatureProps> = {\n // View/edit/create on page\n complex: {\n // react-table built-in\n enableFiltering: true,\n enableSearch: true,\n enableSorting: true,\n enableColumnFreezing: true,\n enableColumnHiding: true,\n enableColumnResizing: true,\n enableRowExpansion: true,\n enableRowExpansionAll: true,\n enableRowSelection: true,\n\n // custom -- common between all table types\n enableColumnOrdering: true,\n enableFontSize: true,\n enableFooter: true,\n enablePrinting: true,\n enableRowActive: true,\n enableRowActions: true,\n enableRowClick: true,\n enableRowDrag: true,\n enableRowDrop: true,\n enableRowGoto: true,\n enableRowHeight: true,\n enableSaveSettings: true,\n },\n // View/create in dialog\n list: {\n // react-table built-in\n enableFiltering: false,\n enableSearch: true,\n enableSorting: true,\n enableColumnFreezing: false,\n enableColumnHiding: false,\n enableColumnResizing: false,\n enableRowExpansion: true,\n enableRowExpansionAll: true,\n enableRowSelection: true,\n\n // custom -- common between all table types\n enableColumnOrdering: false,\n enableFontSize: false,\n enableFooter: false,\n enablePrinting: false,\n enableRowActive: true,\n enableRowActions: true,\n enableRowClick: true,\n enableRowDrag: false,\n enableRowDrop: false,\n enableRowGoto: false,\n enableRowHeight: false,\n enableSaveSettings: true,\n },\n // View in card or dialog\n simple: {\n // react-table built-in\n enableFiltering: false,\n enableSearch: false,\n enableSorting: true,\n enableColumnFreezing: false,\n enableColumnHiding: false,\n enableColumnResizing: false,\n enableRowExpansion: true,\n enableRowExpansionAll: true,\n enableRowSelection: false,\n\n // custom -- common between all table types\n enableColumnOrdering: false,\n enableFontSize: false,\n enableFooter: false,\n enablePrinting: false,\n enableRowActive: true,\n enableRowActions: false,\n enableRowClick: true,\n enableRowDrag: false,\n enableRowDrop: false,\n enableRowGoto: false,\n enableRowHeight: false,\n enableSaveSettings: true,\n },\n};\n\nexport function getTableFeaturePreset<TType = unknown>(props: TableProps<TType>): TableFeatureProps<TType> {\n const presetOptions = props.preset ? presets[props.preset] : DEFAULT_PRESET;\n\n const enableRowActions = props.enableRowActions ?? presetOptions.enableRowActions;\n const enableRowClick = props.enableRowClick ?? presetOptions.enableRowClick;\n const enableRowDrag = props.enableRowDrag ?? presetOptions.enableRowDrag;\n const enableRowDrop = props.enableRowDrop ?? presetOptions.enableRowDrop;\n const enableRowGoto = props.enableRowGoto ?? presetOptions.enableRowGoto;\n const enableRowExpansion = props.enableRowExpansion ?? presetOptions.enableRowExpansion;\n const enableRowExpansionAll = props.enableRowExpansionAll ?? presetOptions.enableRowExpansionAll;\n const enableRowSelection = props.enableRowSelection ?? presetOptions.enableRowSelection;\n\n return {\n // react-table built-in\n enableFiltering: props.enableFiltering ?? presetOptions.enableFiltering,\n enableSearch: props.enableSearch ?? presetOptions.enableSearch,\n enableSorting: props.enableSorting ?? presetOptions.enableSorting,\n enableColumnFreezing: props.enableColumnFreezing ?? presetOptions.enableColumnFreezing,\n enableColumnHiding: props.enableColumnHiding ?? presetOptions.enableColumnHiding,\n enableColumnResizing: props.enableColumnResizing ?? presetOptions.enableColumnResizing,\n enableRowExpansion: enableRowExpansion && !!props.rowExpansionRenderer,\n enableRowSelection: !!props.onRowSelect && enableRowSelection,\n\n // custom -- common between all table types\n enableColumnOrdering: props.enableColumnOrdering ?? presetOptions.enableColumnOrdering,\n enableFontSize: props.enableFontSize ?? presetOptions.enableFontSize,\n enableFooter: props.enableFooter ?? presetOptions.enableFooter,\n enablePrinting: props.enablePrinting ?? presetOptions.enablePrinting,\n enableRowActive: props.enableRowActive ?? presetOptions.enableRowActive,\n enableRowActions: enableRowActions && !!props.rowActions?.length,\n // enableRowClick can be either function or boolean, that is why we need to pass exactly enableRowClick,\n // and not just result of the condition\n enableRowClick: enableRowClick && !!props.onRowClick ? enableRowClick : false,\n enableRowDrag: enableRowDrag && !!props.onRowDrag,\n enableRowDrop: enableRowDrop && !!props.onRowDrop,\n enableRowGoto: enableRowGoto && !!props.onRowGoto,\n enableRowExpansionAll: enableRowExpansion && enableRowExpansionAll && !!props.rowExpansionRenderer,\n enableRowHeight: props.enableRowHeight ?? presetOptions.enableRowHeight,\n enableSaveSettings: props.enableSaveSettings ?? presetOptions.enableSaveSettings,\n };\n}\n"],"names":["DEFAULT_PRESET","enableFiltering","enableSearch","enableSorting","enableColumnFreezing","enableColumnHiding","enableColumnResizing","enableRowExpansion","enableRowExpansionAll","enableRowSelection","enableColumnOrdering","enableFontSize","enableFooter","enablePrinting","enableRowActive","enableRowActions","enableRowClick","enableRowDrag","enableRowDrop","enableRowGoto","enableRowHeight","enableSaveSettings","presets","complex","list","simple","getTableFeaturePreset","props","presetOptions","preset","_props$enableRowActio","_props$enableRowClick","_props$enableRowDrag","_props$enableRowDrop","_props$enableRowGoto","_props$enableRowExpan","_props$enableRowExpan2","_props$enableRowSelec","_props$enableFilterin","_props$enableSearch","_props$enableSorting","_props$enableColumnFr","_props$enableColumnHi","_props$enableColumnRe","rowExpansionRenderer","onRowSelect","_props$enableColumnOr","_props$enableFontSize","_props$enableFooter","_props$enablePrinting","_props$enableRowActiv","_props$rowActions","rowActions","length","onRowClick","onRowDrag","onRowDrop","onRowGoto","_props$enableRowHeigh","_props$enableSaveSett"],"mappings":"AAEA,MAAMA,cAAc,GAAsB;;EAEtCC,eAAe,EAAE,KAAK;EACtBC,YAAY,EAAE,KAAK;EACnBC,aAAa,EAAE,KAAK;EACpBC,oBAAoB,EAAE,KAAK;EAC3BC,kBAAkB,EAAE,KAAK;EACzBC,oBAAoB,EAAE,KAAK;EAC3BC,kBAAkB,EAAE,KAAK;EACzBC,qBAAqB,EAAE,IAAI;EAC3BC,kBAAkB,EAAE,KAAK;;EAGzBC,oBAAoB,EAAE,KAAK;EAC3BC,cAAc,EAAE,KAAK;EACrBC,YAA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Aa,IAAI,CAAC,CAACQ,KAAK,CAAC8B,SAAS;IACjDjD,qBAAqB,EAAED,kBAAkB,IAAIC,qBAAqB,IAAI,CAAC,CAACmB,KAAK,CAACiB,oBAAoB;IAClGxB,eAAe,GAAAsC,qBAAA,GAAE/B,KAAK,CAACP,eAAe,cAAAsC,qBAAA,cAAAA,qBAAA,GAAI9B,aAAa,CAACR,eAAe;IACvEC,kBAAkB,GAAAsC,qBAAA,GAAEhC,KAAK,CAACN,kBAAkB,cAAAsC,qBAAA,cAAAA,qBAAA,GAAI/B,aAAa,CAACP;GACjE;AACL;;;;"}
@@ -258,6 +258,12 @@ function configureReactTableOptions(options, props, localization) {
258
258
  var _column$columnDef$met;
259
259
  return ((_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.enableSearch) !== false && column.getIsVisible();
260
260
  };
261
+ // enter controlled search mode (controlled could be local state, but usually the server)
262
+ if (props.onChangeSearch) {
263
+ if (props._experimentalDataLoader2) {
264
+ tableOptions.manualFiltering = true;
265
+ }
266
+ }
261
267
  }
262
268
  if (tableOptions.enableSorting) {
263
269
  // enter controlled sort mode (controlled could be local state, but usually the server)