@economic/taco 2.22.1 → 2.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. package/dist/components/OverflowGroup/OverflowGroup.d.ts +1 -1
  2. package/dist/components/Report/Report.d.ts +2 -0
  3. package/dist/components/Report/components/Body/EmptyStateBody.d.ts +7 -0
  4. package/dist/components/Report/components/Cell/util.d.ts +1 -1
  5. package/dist/components/Report/types.d.ts +2 -0
  6. package/dist/components/Report/useReport.d.ts +1 -0
  7. package/dist/components/Select2/components/Trigger.d.ts +1 -0
  8. package/dist/components/Truncate/Truncate.d.ts +2 -2
  9. package/dist/esm/index.css +73 -75
  10. package/dist/esm/packages/taco/src/components/Card/Card.js +6 -3
  11. package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
  12. package/dist/esm/packages/taco/src/components/Field/Field.js +4 -15
  13. package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
  14. package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js +2 -2
  15. package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js.map +1 -1
  16. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js +13 -6
  17. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
  18. package/dist/esm/packages/taco/src/components/Report/Report.js +9 -6
  19. package/dist/esm/packages/taco/src/components/Report/Report.js.map +1 -1
  20. package/dist/esm/packages/taco/src/components/Report/components/Body/EmptyStateBody.js +18 -0
  21. package/dist/esm/packages/taco/src/components/Report/components/Body/EmptyStateBody.js.map +1 -0
  22. package/dist/esm/packages/taco/src/components/Report/components/Cell/util.js +6 -2
  23. package/dist/esm/packages/taco/src/components/Report/components/Cell/util.js.map +1 -1
  24. package/dist/esm/packages/taco/src/components/Report/styles/useCssGridStylesheet.js +3 -2
  25. package/dist/esm/packages/taco/src/components/Report/styles/useCssGridStylesheet.js.map +1 -1
  26. package/dist/esm/packages/taco/src/components/Select2/Select2.js +1 -0
  27. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  28. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +9 -4
  29. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  30. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +2 -2
  31. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
  32. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +1 -0
  33. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js.map +1 -1
  34. package/dist/esm/packages/taco/src/components/Toast/Toaster.js +4 -3
  35. package/dist/esm/packages/taco/src/components/Toast/Toaster.js.map +1 -1
  36. package/dist/esm/packages/taco/src/components/Truncate/Truncate.js +34 -0
  37. package/dist/esm/packages/taco/src/components/Truncate/Truncate.js.map +1 -0
  38. package/dist/esm/packages/taco/src/index.js +1 -0
  39. package/dist/esm/packages/taco/src/index.js.map +1 -1
  40. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  41. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSettings.js +48 -6
  42. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSettings.js.map +1 -1
  43. package/dist/esm/packages/taco/src/primitives/Table/useTable/useTable.js +4 -1
  44. package/dist/esm/packages/taco/src/primitives/Table/useTable/useTable.js.map +1 -1
  45. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/presets.js +5 -5
  46. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/presets.js.map +1 -1
  47. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/search.js +14 -1
  48. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/search.js.map +1 -1
  49. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js +127 -3
  50. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
  51. package/dist/esm/packages/taco/src/utils/hooks/useTruncated.js +4 -4
  52. package/dist/esm/packages/taco/src/utils/hooks/useTruncated.js.map +1 -1
  53. package/dist/index.css +73 -75
  54. package/dist/index.d.ts +1 -0
  55. package/dist/primitives/Table/types.d.ts +13 -1
  56. package/dist/primitives/Table/useTable/features/useTableSettings.d.ts +2 -2
  57. package/dist/primitives/Table/useTable/useTable.d.ts +1 -0
  58. package/dist/taco.cjs.development.js +306 -71
  59. package/dist/taco.cjs.development.js.map +1 -1
  60. package/dist/taco.cjs.production.min.js +1 -1
  61. package/dist/taco.cjs.production.min.js.map +1 -1
  62. package/dist/utils/hooks/useTruncated.d.ts +1 -1
  63. package/package.json +2 -2
  64. package/types.json +8672 -8382
@@ -21,7 +21,7 @@ const DEFAULT_PRESET = {
21
21
  enableRowClick: false,
22
22
  enableRowGoto: false,
23
23
  enableRowHeight: false,
24
- enableSettings: false
24
+ enableSaveSettings: false
25
25
  };
26
26
  const presets = {
27
27
  lite: {
@@ -45,7 +45,7 @@ const presets = {
45
45
  enableRowClick: true,
46
46
  enableRowGoto: true,
47
47
  enableRowHeight: false,
48
- enableSettings: true
48
+ enableSaveSettings: true
49
49
  },
50
50
  complex: {
51
51
  // react-table built-in
@@ -68,11 +68,11 @@ const presets = {
68
68
  enableRowClick: true,
69
69
  enableRowGoto: true,
70
70
  enableRowHeight: true,
71
- enableSettings: true
71
+ enableSaveSettings: true
72
72
  }
73
73
  };
74
74
  function useTableFeaturePreset(props) {
75
- var _props$enableRowActio, _props$enableRowClick, _props$enableRowGoto, _props$enableRowExpan, _props$enableRowSelec, _props$enableRowSelec2, _props$enableFilterin, _props$enableSearch, _props$enableSorting, _props$enableColumnFr, _props$enableColumnHi, _props$enableColumnRe, _props$enableColumnOr, _props$enableFontSize, _props$enableFooter, _props$enablePrinting, _props$enableRowActiv, _props$rowActions2, _props$enableRowHeigh, _props$enableSettings;
75
+ var _props$enableRowActio, _props$enableRowClick, _props$enableRowGoto, _props$enableRowExpan, _props$enableRowSelec, _props$enableRowSelec2, _props$enableFilterin, _props$enableSearch, _props$enableSorting, _props$enableColumnFr, _props$enableColumnHi, _props$enableColumnRe, _props$enableColumnOr, _props$enableFontSize, _props$enableFooter, _props$enablePrinting, _props$enableRowActiv, _props$rowActions2, _props$enableRowHeigh, _props$enableSaveSett;
76
76
  const presetOptions = props.preset ? presets[props.preset] : DEFAULT_PRESET;
77
77
  const enableRowActions = (_props$enableRowActio = props.enableRowActions) !== null && _props$enableRowActio !== void 0 ? _props$enableRowActio : presetOptions.enableRowActions;
78
78
  const enableRowClick = (_props$enableRowClick = props.enableRowClick) !== null && _props$enableRowClick !== void 0 ? _props$enableRowClick : presetOptions.enableRowClick;
@@ -123,7 +123,7 @@ function useTableFeaturePreset(props) {
123
123
  enableRowClick: enableRowClick && !!props.onRowClick,
124
124
  enableRowGoto: enableRowGoto && !!props.onRowGoto,
125
125
  enableRowHeight: (_props$enableRowHeigh = props.enableRowHeight) !== null && _props$enableRowHeigh !== void 0 ? _props$enableRowHeigh : presetOptions.enableRowHeight,
126
- enableSettings: (_props$enableSettings = props.enableSettings) !== null && _props$enableSettings !== void 0 ? _props$enableSettings : presetOptions.enableSettings
126
+ enableSaveSettings: (_props$enableSaveSett = props.enableSaveSettings) !== null && _props$enableSaveSett !== void 0 ? _props$enableSaveSett : presetOptions.enableSaveSettings
127
127
  };
128
128
  }
129
129
 
@@ -1 +1 @@
1
- {"version":3,"file":"presets.js","sources":["../../../../../../../../../src/primitives/Table/useTable/util/presets.ts"],"sourcesContent":["import React from 'react';\nimport { TableFeatureProps, TablePreset, useTableProps } 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 enableRowSelectionSingle: 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: false,\n enableRowGoto: false,\n enableRowHeight: false,\n enableSettings: false,\n};\n\nconst presets: Record<TablePreset, TableFeatureProps> = {\n lite: {\n // react-table built-in\n enableFiltering: true,\n enableSearch: true,\n enableSorting: true,\n enableColumnFreezing: true,\n enableColumnHiding: false,\n enableColumnResizing: true,\n enableRowExpansion: true,\n enableRowSelection: true,\n enableRowSelectionSingle: false,\n\n // custom -- common between all table types\n enableColumnOrdering: false,\n enableFontSize: false,\n enableFooter: true,\n enablePrinting: false,\n enableRowActive: true,\n enableRowActions: true,\n enableRowClick: true,\n enableRowGoto: true,\n enableRowHeight: false,\n enableSettings: true,\n },\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 enableRowSelectionSingle: false,\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 enableRowGoto: true,\n enableRowHeight: true,\n enableSettings: true,\n },\n};\n\nexport function useTableFeaturePreset<TType = unknown>(props: useTableProps<TType>): TableFeatureProps {\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 enableRowGoto = props.enableRowGoto ?? presetOptions.enableRowGoto;\n const enableRowExpansion = props.enableRowExpansion ?? presetOptions.enableRowExpansion;\n const enableRowSelection = props.enableRowSelection ?? presetOptions.enableRowSelection;\n const enableRowSelectionSingle = props.enableRowSelectionSingle ?? presetOptions.enableRowSelectionSingle;\n\n // guard options that might be unintentionally broken\n React.useEffect(() => {\n if (enableRowActions && !props.rowActions?.length) {\n console.warn(\n `Table (id: ${props.id}) - Row actions is enabled but no \\`rowActions\\` has been provided. Provide one to enable row actions or set \\`enableRowActions\\` to \\`false\\`.`\n );\n }\n\n if (enableRowClick && !props.onRowClick) {\n console.warn(\n `Table (id: ${props.id}) - Row click is enabled but no \\`onRowClick\\` handler has been provided. Provide one to enable row click or set \\`enableRowClick\\` to \\`false\\`.`\n );\n }\n\n if (enableRowGoto && !props.onRowGoto) {\n console.warn(\n `Table (id: ${props.id}) - Row click is enabled but no \\`onRowGoto\\` handler has been provided. Provide one to enable row goto or set \\`enableRowGoto\\` to \\`false\\`.`\n );\n }\n\n if (enableRowExpansion && !props.rowExpansionRenderer) {\n console.warn(\n `Table (id: ${props.id}) - Row expansion is enabled but no \\`rowExpansionRenderer\\` has been provided. Provide one to enable row expansion or set \\`enableRowExpansion\\` to \\`false\\`.`\n );\n }\n\n if (enableRowSelection && !props.onRowSelect) {\n console.warn(\n `Table (id: ${props.id}) - Row selection is enabled but no \\`onRowSelect\\` handler has been provided. Provide one to enable row selection or set \\`enableRowSelection\\` to \\`false\\`.`\n );\n }\n\n if (enableRowSelectionSingle && !props.onRowSelect) {\n console.warn(\n `Table (id: ${props.id}) - Row selection (single) is enabled but no \\`onRowSelect\\` handler has been provided. Provide one to enable row selection or set \\`enableRowSelectionSingle\\` to \\`false\\`.`\n );\n }\n }, []);\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: enableRowSelection && !!props.onRowSelect,\n enableRowSelectionSingle: enableRowSelectionSingle && !!props.onRowSelect,\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: enableRowClick && !!props.onRowClick,\n enableRowGoto: enableRowGoto && !!props.onRowGoto,\n enableRowHeight: props.enableRowHeight ?? presetOptions.enableRowHeight,\n enableSettings: props.enableSettings ?? presetOptions.enableSettings,\n };\n}\n"],"names":["DEFAULT_PRESET","enableFiltering","enableSearch","enableSorting","enableColumnFreezing","enableColumnHiding","enableColumnResizing","enableRowExpansion","enableRowSelection","enableRowSelectionSingle","enableColumnOrdering","enableFontSize","enableFooter","enablePrinting","enableRowActive","enableRowActions","enableRowClick","enableRowGoto","enableRowHeight","enableSettings","presets","lite","complex","useTableFeaturePreset","props","presetOptions","preset","_props$enableRowActio","_props$enableRowClick","_props$enableRowGoto","_props$enableRowExpan","_props$enableRowSelec","_props$enableRowSelec2","React","useEffect","_props$rowActions","rowActions","length","console","warn","id","onRowClick","onRowGoto","rowExpansionRenderer","onRowSelect","_props$enableFilterin","_props$enableSearch","_props$enableSorting","_props$enableColumnFr","_props$enableColumnHi","_props$enableColumnRe","_props$enableColumnOr","_props$enableFontSize","_props$enableFooter","_props$enablePrinting","_props$enableRowActiv","_props$rowActions2","_props$enableRowHeigh","_props$enableSettings"],"mappings":";;AAGA,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;EACzBC,wBAAwB,EAAE,KAAK;;EAG/BC,oBAAoB,EAAE,KAAK;EAC3BC,cAAc,EAA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CAACL,cAAc,cAAAuC,qBAAA,cAAAA,qBAAA,GAAIjC,aAAa,CAACN;GACzD;AACL;;;;"}
1
+ {"version":3,"file":"presets.js","sources":["../../../../../../../../../src/primitives/Table/useTable/util/presets.ts"],"sourcesContent":["import React from 'react';\nimport { TableFeatureProps, TablePreset, useTableProps } 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 enableRowSelectionSingle: 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: false,\n enableRowGoto: false,\n enableRowHeight: false,\n enableSaveSettings: false,\n};\n\nconst presets: Record<TablePreset, TableFeatureProps> = {\n lite: {\n // react-table built-in\n enableFiltering: true,\n enableSearch: true,\n enableSorting: true,\n enableColumnFreezing: true,\n enableColumnHiding: false,\n enableColumnResizing: true,\n enableRowExpansion: true,\n enableRowSelection: true,\n enableRowSelectionSingle: false,\n\n // custom -- common between all table types\n enableColumnOrdering: false,\n enableFontSize: false,\n enableFooter: true,\n enablePrinting: false,\n enableRowActive: true,\n enableRowActions: true,\n enableRowClick: true,\n enableRowGoto: true,\n enableRowHeight: false,\n enableSaveSettings: true,\n },\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 enableRowSelectionSingle: false,\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 enableRowGoto: true,\n enableRowHeight: true,\n enableSaveSettings: true,\n },\n};\n\nexport function useTableFeaturePreset<TType = unknown>(props: useTableProps<TType>): TableFeatureProps {\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 enableRowGoto = props.enableRowGoto ?? presetOptions.enableRowGoto;\n const enableRowExpansion = props.enableRowExpansion ?? presetOptions.enableRowExpansion;\n const enableRowSelection = props.enableRowSelection ?? presetOptions.enableRowSelection;\n const enableRowSelectionSingle = props.enableRowSelectionSingle ?? presetOptions.enableRowSelectionSingle;\n\n // guard options that might be unintentionally broken\n React.useEffect(() => {\n if (enableRowActions && !props.rowActions?.length) {\n console.warn(\n `Table (id: ${props.id}) - Row actions is enabled but no \\`rowActions\\` has been provided. Provide one to enable row actions or set \\`enableRowActions\\` to \\`false\\`.`\n );\n }\n\n if (enableRowClick && !props.onRowClick) {\n console.warn(\n `Table (id: ${props.id}) - Row click is enabled but no \\`onRowClick\\` handler has been provided. Provide one to enable row click or set \\`enableRowClick\\` to \\`false\\`.`\n );\n }\n\n if (enableRowGoto && !props.onRowGoto) {\n console.warn(\n `Table (id: ${props.id}) - Row click is enabled but no \\`onRowGoto\\` handler has been provided. Provide one to enable row goto or set \\`enableRowGoto\\` to \\`false\\`.`\n );\n }\n\n if (enableRowExpansion && !props.rowExpansionRenderer) {\n console.warn(\n `Table (id: ${props.id}) - Row expansion is enabled but no \\`rowExpansionRenderer\\` has been provided. Provide one to enable row expansion or set \\`enableRowExpansion\\` to \\`false\\`.`\n );\n }\n\n if (enableRowSelection && !props.onRowSelect) {\n console.warn(\n `Table (id: ${props.id}) - Row selection is enabled but no \\`onRowSelect\\` handler has been provided. Provide one to enable row selection or set \\`enableRowSelection\\` to \\`false\\`.`\n );\n }\n\n if (enableRowSelectionSingle && !props.onRowSelect) {\n console.warn(\n `Table (id: ${props.id}) - Row selection (single) is enabled but no \\`onRowSelect\\` handler has been provided. Provide one to enable row selection or set \\`enableRowSelectionSingle\\` to \\`false\\`.`\n );\n }\n }, []);\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: enableRowSelection && !!props.onRowSelect,\n enableRowSelectionSingle: enableRowSelectionSingle && !!props.onRowSelect,\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: enableRowClick && !!props.onRowClick,\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","enableRowSelectionSingle","enableColumnOrdering","enableFontSize","enableFooter","enablePrinting","enableRowActive","enableRowActions","enableRowClick","enableRowGoto","enableRowHeight","enableSaveSettings","presets","lite","complex","useTableFeaturePreset","props","presetOptions","preset","_props$enableRowActio","_props$enableRowClick","_props$enableRowGoto","_props$enableRowExpan","_props$enableRowSelec","_props$enableRowSelec2","React","useEffect","_props$rowActions","rowActions","length","console","warn","id","onRowClick","onRowGoto","rowExpansionRenderer","onRowSelect","_props$enableFilterin","_props$enableSearch","_props$enableSorting","_props$enableColumnFr","_props$enableColumnHi","_props$enableColumnRe","_props$enableColumnOr","_props$enableFontSize","_props$enableFooter","_props$enablePrinting","_props$enableRowActiv","_props$rowActions2","_props$enableRowHeigh","_props$enableSaveSett"],"mappings":";;AAGA,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;EACzBC,wBAAwB,EAAE,KAAK;;EAG/BC,oBAAoB,EAAE,KAAK;EAC3BC,cAAc,EAAE,KAAK;EACrBC,YAAY,EAAE,KAAK;EACnBC,cAAc,EAAE,KAAK;EACrBC,eAAe,EAAE,IAAI;EACrBC,gBAAgB,EAAE,KAAK;EACvBC,cAAc,EAAE,KAAK;EACrBC,aAAa,EAAE,KAAK;EACpBC,eAAe,EAAE,KAAK;EACtBC,kBAAkB,EAAE;CACvB;AAED,MAAMC,OAAO,GAA2C;EACpDC,IAAI,EAAE;;IAEFpB,eAAe,EAAE,IAAI;IACrBC,YAAY,EAAE,IAAI;IAClBC,aAAa,EAAE,IAAI;IACnBC,oBAAoB,EAAE,IAAI;IAC1BC,kBAAkB,EAAE,KAAK;IACzBC,oBAAoB,EAAE,IAAI;IAC1BC,kBAAkB,EAAE,IAAI;IACxBC,kBAAkB,EAAE,IAAI;IACxBC,wBAAwB,EAAE,KAAK;;IAG/BC,oBAAoB,EAAE,KAAK;IAC3BC,cAAc,EAAE,KAAK;IACrBC,YAAY,EAAE,IAAI;IAClBC,cAAc,EAAE,KAAK;IACrBC,eAAe,EAAE,IAAI;IACrBC,gBAAgB,EAAE,IAAI;IACtBC,cAAc,EAAE,IAAI;IACpBC,aAAa,EAAE,IAAI;IACnBC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,GAAAyC,qBAAA,GAAE/B,KAAK,CAACV,eAAe,cAAAyC,qBAAA,cAAAA,qBAAA,GAAI9B,aAAa,CAACX,eAAe;IACvEC,gBAAgB,EAAEA,gBAAgB,IAAI,CAAC,GAAAyC,kBAAA,GAAChC,KAAK,CAACY,UAAU,cAAAoB,kBAAA,eAAhBA,kBAAA,CAAkBnB,MAAM;IAChErB,cAAc,EAAEA,cAAc,IAAI,CAAC,CAACQ,KAAK,CAACiB,UAAU;IACpDxB,aAAa,EAAEA,aAAa,IAAI,CAAC,CAACO,KAAK,CAACkB,SAAS;IACjDxB,eAAe,GAAAuC,qBAAA,GAAEjC,KAAK,CAACN,eAAe,cAAAuC,qBAAA,cAAAA,qBAAA,GAAIhC,aAAa,CAACP,eAAe;IACvEC,kBAAkB,GAAAuC,qBAAA,GAAElC,KAAK,CAACL,kBAAkB,cAAAuC,qBAAA,cAAAA,qBAAA,GAAIjC,aAAa,CAACN;GACjE;AACL;;;;"}
@@ -7,12 +7,25 @@ function resetHighlightedColumnIndexes(value, table) {
7
7
  if (value) {
8
8
  const indexes = [];
9
9
  const columns = table.getVisibleLeafColumns();
10
+ const rowGrouping = table.getState().grouping;
10
11
  table.getRowModel().rows.forEach((row, rowIndex) => {
11
12
  columns.forEach((column, columnIndex) => {
12
13
  try {
13
- if (column.getIsVisible() && column.columnDef.enableGlobalFilter) {
14
+ let allowSearch = true;
15
+ if (rowGrouping !== null && rowGrouping !== void 0 && rowGrouping.length) {
16
+ // if it's the grouped row, only allow search of the grouped column - because that's all that's visible
17
+ if (row.getIsGrouped()) {
18
+ allowSearch = column.getIsGrouped();
19
+ }
20
+ // otherwise for other rows, don't search the grouped column - because it isn't visible
21
+ else if (rowGrouping.includes(column.id)) {
22
+ allowSearch = false;
23
+ }
24
+ }
25
+ if (column.getIsVisible() && column.columnDef.enableGlobalFilter && allowSearch) {
14
26
  var _row$original, _column$columnDef$met;
15
27
  const cellValue = getCellValueAsString((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original[column.id], (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.dataType);
28
+ // indexes don't map to sorted data
16
29
  if (cellValue !== undefined && isWeakContains(cellValue, value)) {
17
30
  indexes.push([rowIndex, columnIndex]);
18
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"search.js","sources":["../../../../../../../../../src/primitives/Table/useTable/util/search.ts"],"sourcesContent":["import { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { getCellValueAsString } from './columns';\nimport { isWeakContains } from './filtering';\n\nexport function resetHighlightedColumnIndexes<TType = unknown>(value: string | undefined, table: ReactTable<TType>) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n let firstRowIndex: undefined | number;\n\n if (value) {\n const rowIndexes: number[] = [];\n const indexes: number[][] = [];\n const columns = table.getVisibleLeafColumns();\n\n table.getRowModel().rows.forEach((row, rowIndex) => {\n columns.forEach((column, columnIndex) => {\n try {\n if (column.getIsVisible() && column.columnDef.enableGlobalFilter) {\n const cellValue = getCellValueAsString(row.original?.[column.id], column.columnDef.meta?.dataType);\n\n if (cellValue !== undefined && isWeakContains(cellValue, value)) {\n indexes.push([rowIndex, columnIndex]);\n }\n }\n } catch (e) {\n //\n }\n });\n\n if (indexes.length) {\n rowIndexes.push(rowIndex);\n }\n });\n\n tableMeta.search.setHighlightedColumnIndexes(indexes);\n\n if (indexes.length) {\n firstRowIndex = indexes[0][0];\n tableMeta.search.setCurrentHighlightColumnIndex(0);\n } else {\n tableMeta.search.setCurrentHighlightColumnIndex(undefined);\n }\n } else {\n tableMeta.search.setHighlightedColumnIndexes([]);\n tableMeta.search.setCurrentHighlightColumnIndex(undefined);\n }\n\n if (firstRowIndex !== undefined) {\n tableMeta.rowActive.setRowActiveIndex(firstRowIndex);\n }\n\n return firstRowIndex;\n}\n"],"names":["resetHighlightedColumnIndexes","value","table","tableMeta","options","meta","firstRowIndex","indexes","columns","getVisibleLeafColumns","getRowModel","rows","forEach","row","rowIndex","column","columnIndex","getIsVisible","columnDef","enableGlobalFilter","_row$original","_column$columnDef$met","cellValue","getCellValueAsString","original","id","dataType","undefined","isWeakContains","push","e","search","setHighlightedColumnIndexes","length","setCurrentHighlightColumnIndex","rowActive","setRowActiveIndex"],"mappings":";;;SAIgBA,6BAA6BA,CAAkBC,KAAyB,EAAEC,KAAwB;EAC9G,MAAMC,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAA6B;EAC7D,IAAIC,aAAiC;EAErC,IAAIL,KAAK,EAAE;IAEP,MAAMM,OAAO,GAAe,EAAE;IAC9B,MAAMC,OAAO,GAAGN,KAAK,CAACO,qBAAqB,EAAE;IAE7CP,KAAK,CAACQ,WAAW,EAAE,CAACC,IAAI,CAACC,OAAO,CAAC,CAACC,GAAG,EAAEC,QAAQ;MAC3CN,OAAO,CAACI,OAAO,CAAC,CAACG,MAAM,EAAEC,WAAW;QAChC,IAAI;UACA,IAAID,MAAM,CAACE,YAAY,EAAE,IAAIF,MAAM,CAACG,SAAS,CAACC,kBAAkB,EAAE;YAAA,IAAAC,aAAA,EAAAC,qBAAA;YAC9D,MAAMC,SAAS,GAAGC,oBAAoB,EAAAH,aAAA,GAACP,GAAG,CAACW,QAAQ,cAAAJ,aAAA,uBAAZA,aAAA,CAAeL,MAAM,CAACU,EAAE,CAAC,GAAAJ,qBAAA,GAAEN,MAAM,CAACG,SAAS,CAACb,IAAI,cAAAgB,qBAAA,uBAArBA,qBAAA,CAAuBK,QAAQ,CAAC;YAElG,IAAIJ,SAAS,KAAKK,SAAS,IAAIC,cAAc,CAACN,SAAS,EAAErB,KAAK,CAAC,EAAE;cAC7DM,OAAO,CAACsB,IAAI,CAAC,CAACf,QAAQ,EAAEE,WAAW,CAAC,CAAC;;;SAGhD,CAAC,OAAOc,CAAC,EAAE;;;OAGf,CAAC;KAKL,CAAC;IAEF3B,SAAS,CAAC4B,MAAM,CAACC,2BAA2B,CAACzB,OAAO,CAAC;IAErD,IAAIA,OAAO,CAAC0B,MAAM,EAAE;MAChB3B,aAAa,GAAGC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;MAC7BJ,SAAS,CAAC4B,MAAM,CAACG,8BAA8B,CAAC,CAAC,CAAC;KACrD,MAAM;MACH/B,SAAS,CAAC4B,MAAM,CAACG,8BAA8B,CAACP,SAAS,CAAC;;GAEjE,MAAM;IACHxB,SAAS,CAAC4B,MAAM,CAACC,2BAA2B,CAAC,EAAE,CAAC;IAChD7B,SAAS,CAAC4B,MAAM,CAACG,8BAA8B,CAACP,SAAS,CAAC;;EAG9D,IAAIrB,aAAa,KAAKqB,SAAS,EAAE;IAC7BxB,SAAS,CAACgC,SAAS,CAACC,iBAAiB,CAAC9B,aAAa,CAAC;;EAGxD,OAAOA,aAAa;AACxB;;;;"}
1
+ {"version":3,"file":"search.js","sources":["../../../../../../../../../src/primitives/Table/useTable/util/search.ts"],"sourcesContent":["import { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { getCellValueAsString } from './columns';\nimport { isWeakContains } from './filtering';\n\nexport function resetHighlightedColumnIndexes<TType = unknown>(value: string | undefined, table: ReactTable<TType>) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n let firstRowIndex: undefined | number;\n\n if (value) {\n const indexes: number[][] = [];\n const columns = table.getVisibleLeafColumns();\n const rowGrouping = table.getState().grouping;\n\n table.getRowModel().rows.forEach((row, rowIndex) => {\n columns.forEach((column, columnIndex) => {\n try {\n let allowSearch = true;\n\n if (rowGrouping?.length) {\n // if it's the grouped row, only allow search of the grouped column - because that's all that's visible\n if (row.getIsGrouped()) {\n allowSearch = column.getIsGrouped();\n }\n // otherwise for other rows, don't search the grouped column - because it isn't visible\n else if (rowGrouping.includes(column.id)) {\n allowSearch = false;\n }\n }\n\n if (column.getIsVisible() && column.columnDef.enableGlobalFilter && allowSearch) {\n const cellValue = getCellValueAsString(row.original?.[column.id], column.columnDef.meta?.dataType);\n\n // indexes don't map to sorted data\n if (cellValue !== undefined && isWeakContains(cellValue, value)) {\n indexes.push([rowIndex, columnIndex]);\n }\n }\n } catch (e) {\n //\n }\n });\n });\n\n tableMeta.search.setHighlightedColumnIndexes(indexes);\n\n if (indexes.length) {\n firstRowIndex = indexes[0][0];\n tableMeta.search.setCurrentHighlightColumnIndex(0);\n } else {\n tableMeta.search.setCurrentHighlightColumnIndex(undefined);\n }\n } else {\n tableMeta.search.setHighlightedColumnIndexes([]);\n tableMeta.search.setCurrentHighlightColumnIndex(undefined);\n }\n\n if (firstRowIndex !== undefined) {\n tableMeta.rowActive.setRowActiveIndex(firstRowIndex);\n }\n\n return firstRowIndex;\n}\n"],"names":["resetHighlightedColumnIndexes","value","table","tableMeta","options","meta","firstRowIndex","indexes","columns","getVisibleLeafColumns","rowGrouping","getState","grouping","getRowModel","rows","forEach","row","rowIndex","column","columnIndex","allowSearch","length","getIsGrouped","includes","id","getIsVisible","columnDef","enableGlobalFilter","_row$original","_column$columnDef$met","cellValue","getCellValueAsString","original","dataType","undefined","isWeakContains","push","e","search","setHighlightedColumnIndexes","setCurrentHighlightColumnIndex","rowActive","setRowActiveIndex"],"mappings":";;;SAIgBA,6BAA6BA,CAAkBC,KAAyB,EAAEC,KAAwB;EAC9G,MAAMC,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAA6B;EAC7D,IAAIC,aAAiC;EAErC,IAAIL,KAAK,EAAE;IACP,MAAMM,OAAO,GAAe,EAAE;IAC9B,MAAMC,OAAO,GAAGN,KAAK,CAACO,qBAAqB,EAAE;IAC7C,MAAMC,WAAW,GAAGR,KAAK,CAACS,QAAQ,EAAE,CAACC,QAAQ;IAE7CV,KAAK,CAACW,WAAW,EAAE,CAACC,IAAI,CAACC,OAAO,CAAC,CAACC,GAAG,EAAEC,QAAQ;MAC3CT,OAAO,CAACO,OAAO,CAAC,CAACG,MAAM,EAAEC,WAAW;QAChC,IAAI;UACA,IAAIC,WAAW,GAAG,IAAI;UAEtB,IAA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ACmC,MAAM,CAACE,8BAA8B,CAACN,SAAS,CAAC;;EAG9D,IAAI5B,aAAa,KAAK4B,SAAS,EAAE;IAC7B/B,SAAS,CAACsC,SAAS,CAACC,iBAAiB,CAACpC,aAAa,CAAC;;EAGxD,OAAOA,aAAa;AACxB;;;;"}
@@ -1,7 +1,131 @@
1
- import 'react';
2
- import '../../../../../node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js';
1
+ import React__default from 'react';
2
+ import { _finallyRethrows, _catch } from '../../../../../node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js';
3
3
 
4
4
  const DEFAULT_PAGE_SIZE = 100;
5
+ function useTableDataLoader(fetch, fetchAll, options = {
6
+ pageSize: DEFAULT_PAGE_SIZE
7
+ }) {
8
+ const {
9
+ pageSize
10
+ } = options;
11
+ // track the data length, we don't know it until the first request
12
+ const length = React__default.useRef(undefined);
13
+ // data will be filled after the first request, then we'll update values in place
14
+ const [data, setData] = React__default.useState([]);
15
+ // track which pages have been loaded to dedupe requests
16
+ const _pendingPageRequests = React__default.useRef({});
17
+ const _lastUsedSorting = React__default.useRef([]);
18
+ const _lastUsedFilters = React__default.useRef([]);
19
+ const _lastUsedSearch = React__default.useRef();
20
+ const _forceReset = React__default.useRef(false);
21
+ const loadPage = function (pageIndex, sorting, filters, search) {
22
+ try {
23
+ let reset = false;
24
+ // sorting or filters changed, reset everything
25
+ if (_forceReset.current || search !== _lastUsedSearch.current || JSON.stringify(sorting) !== JSON.stringify(_lastUsedSorting.current) || JSON.stringify(filters) !== JSON.stringify(_lastUsedFilters.current)) {
26
+ _pendingPageRequests.current = {};
27
+ // nuke the dataset so that we "start again" after sorting
28
+ reset = true;
29
+ }
30
+ if (_pendingPageRequests.current[pageIndex]) {
31
+ // if page is already loaded/loading, abort, otherwise mark it as loading
32
+ return Promise.resolve();
33
+ } else {
34
+ _pendingPageRequests.current[pageIndex] = true;
35
+ }
36
+ _forceReset.current = false;
37
+ // set the sorting so we can track if it changed between loads
38
+ _lastUsedSorting.current = sorting;
39
+ // set the filters so we can track if it changed between loads
40
+ _lastUsedFilters.current = filters;
41
+ // set the search so we can track if it changed between loads
42
+ _lastUsedSearch.current = search;
43
+ const _temp = _finallyRethrows(function () {
44
+ return _catch(function () {
45
+ return Promise.resolve(fetch(pageIndex, pageSize, sorting, filters, search)).then(function (response) {
46
+ // update state, here we do some "magic" to support "load in place"
47
+ setData(currentData => {
48
+ let nextData;
49
+ // reset table state if:
50
+ // - the length isn't set at all (first load)
51
+ // - the client length and server length are different (the data changed)
52
+ if (reset || length.current !== response.length) {
53
+ length.current = response.length;
54
+ nextData = Array(length.current).fill(undefined);
55
+ } else {
56
+ nextData = [...currentData];
57
+ }
58
+ const startIndex = pageIndex * pageSize;
59
+ nextData.splice(startIndex, pageSize, ...response.data);
60
+ return nextData;
61
+ });
62
+ });
63
+ }, function () {});
64
+ }, function (_wasThrown, _result) {
65
+ _pendingPageRequests.current[pageIndex] = false;
66
+ if (_wasThrown) throw _result;
67
+ return _result;
68
+ });
69
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
70
+ } catch (e) {
71
+ return Promise.reject(e);
72
+ }
73
+ };
74
+ const loadAll = function (sorting, filters, search) {
75
+ try {
76
+ const _temp2 = _catch(function () {
77
+ return Promise.resolve(fetchAll(sorting, filters, search)).then(function (response) {
78
+ length.current = response.length;
79
+ setData(() => {
80
+ let nextData;
81
+ if (response.data.length !== response.length) {
82
+ nextData = Array(response.length).fill(undefined);
83
+ nextData.splice(0, response.data.length, ...response.data);
84
+ } else {
85
+ nextData = [...response.data];
86
+ }
87
+ return nextData;
88
+ });
89
+ });
90
+ }, function () {});
91
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
92
+ } catch (e) {
93
+ return Promise.reject(e);
94
+ }
95
+ };
96
+ const invalidate = function () {
97
+ try {
98
+ _forceReset.current = true;
99
+ return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current, _lastUsedSearch.current);
100
+ } catch (e) {
101
+ return Promise.reject(e);
102
+ }
103
+ };
104
+ // we reset the page to 0 whenever sorting, filtering or search changes
105
+ const handleSort = function (sorting) {
106
+ try {
107
+ return loadPage(0, sorting, _lastUsedFilters.current, _lastUsedSearch.current);
108
+ } catch (e) {
109
+ return Promise.reject(e);
110
+ }
111
+ };
112
+ const handleFilter = function (filters) {
113
+ try {
114
+ return loadPage(0, _lastUsedSorting.current, filters, _lastUsedSearch.current);
115
+ } catch (e) {
116
+ return Promise.reject(e);
117
+ }
118
+ };
119
+ return [{
120
+ data,
121
+ length: length.current,
122
+ loadAll,
123
+ loadPage,
124
+ onChangeFilter: handleFilter,
125
+ onChangeSort: handleSort,
126
+ pageSize
127
+ }, invalidate];
128
+ }
5
129
 
6
- export { DEFAULT_PAGE_SIZE };
130
+ export { DEFAULT_PAGE_SIZE, useTableDataLoader };
7
131
  //# sourceMappingURL=useTableDataLoader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTableDataLoader.js","sources":["../../../../../../../src/primitives/Table/useTableDataLoader.ts"],"sourcesContent":["import React from 'react';\nimport {\n TableColumnFilter,\n TableColumnSort,\n TableFilterHandler,\n TableServerLoadPageHandler,\n TableServerLoadAllHandler,\n TableSortHandler,\n} from './types';\n\nexport const DEFAULT_PAGE_SIZE = 100;\n\nexport type useTableDataPageFetcher<TType = unknown> = (\n pageIndex: number,\n pageSize: number,\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined\n) => Promise<{ data: TType[]; length: number }>;\n\nexport type useTableDataAllFetcher<TType = unknown> = (\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined\n) => Promise<{ data: TType[]; length: number }>;\n\nexport type useTableDataLoaderOptions = { pageSize: number };\n\nexport type useTableDataLoaderValues<TType = unknown> = {\n data: TType[];\n length: number | undefined;\n loadAll: TableServerLoadAllHandler;\n loadPage: TableServerLoadPageHandler;\n onChangeFilter: TableFilterHandler;\n onChangeSort: TableSortHandler;\n pageSize: number;\n};\n\nexport function useTableDataLoader<TType = unknown>(\n fetch: useTableDataPageFetcher<TType>,\n fetchAll: useTableDataAllFetcher<TType>,\n options: useTableDataLoaderOptions = { pageSize: DEFAULT_PAGE_SIZE }\n): [useTableDataLoaderValues<TType>, () => void] {\n const { pageSize } = options;\n\n // track the data length, we don't know it until the first request\n const length = React.useRef<number | undefined>(undefined);\n // data will be filled after the first request, then we'll update values in place\n const [data, setData] = React.useState<any[]>([]);\n // track which pages have been loaded to dedupe requests\n const _pendingPageRequests = React.useRef({});\n const _lastUsedSorting = React.useRef<TableColumnSort[]>([]);\n const _lastUsedFilters = React.useRef<TableColumnFilter[]>([]);\n const _lastUsedSearch = React.useRef<string>();\n const _forceReset = React.useRef(false);\n\n const loadPage = async (\n pageIndex: number,\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined\n ) => {\n let reset = false;\n\n // sorting or filters changed, reset everything\n if (\n _forceReset.current ||\n search !== _lastUsedSearch.current ||\n JSON.stringify(sorting) !== JSON.stringify(_lastUsedSorting.current) ||\n JSON.stringify(filters) !== JSON.stringify(_lastUsedFilters.current)\n ) {\n _pendingPageRequests.current = {};\n // nuke the dataset so that we \"start again\" after sorting\n reset = true;\n }\n\n if (_pendingPageRequests.current[pageIndex]) {\n // if page is already loaded/loading, abort, otherwise mark it as loading\n return;\n } else {\n _pendingPageRequests.current[pageIndex] = true;\n }\n\n _forceReset.current = false;\n // set the sorting so we can track if it changed between loads\n _lastUsedSorting.current = sorting;\n // set the filters so we can track if it changed between loads\n _lastUsedFilters.current = filters;\n // set the search so we can track if it changed between loads\n _lastUsedSearch.current = search;\n\n try {\n const response = await fetch(pageIndex, pageSize, sorting, filters, search);\n\n // update state, here we do some \"magic\" to support \"load in place\"\n setData(currentData => {\n let nextData;\n\n // reset table state if:\n // - the length isn't set at all (first load)\n // - the client length and server length are different (the data changed)\n if (reset || length.current !== response.length) {\n length.current = response.length;\n nextData = Array(length.current).fill(undefined);\n } else {\n nextData = [...currentData];\n }\n\n const startIndex = pageIndex * pageSize;\n nextData.splice(startIndex, pageSize, ...response.data);\n return nextData;\n });\n } catch {\n //\n } finally {\n _pendingPageRequests.current[pageIndex] = false;\n }\n };\n\n const loadAll = async (sorting: TableColumnSort[], filters: TableColumnFilter[], search: string | undefined) => {\n try {\n const response = await fetchAll(sorting, filters, search);\n length.current = response.length;\n\n setData(() => {\n let nextData;\n\n if (response.data.length !== response.length) {\n nextData = Array(response.length).fill(undefined);\n nextData.splice(0, response.data.length, ...response.data);\n } else {\n nextData = [...response.data];\n }\n\n return nextData;\n });\n } catch {\n //\n }\n };\n\n const invalidate = async () => {\n _forceReset.current = true;\n return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current, _lastUsedSearch.current);\n };\n\n // we reset the page to 0 whenever sorting, filtering or search changes\n const handleSort = async (sorting: TableColumnSort[]) =>\n loadPage(0, sorting, _lastUsedFilters.current, _lastUsedSearch.current);\n const handleFilter = async (filters: TableColumnFilter[]) =>\n loadPage(0, _lastUsedSorting.current, filters, _lastUsedSearch.current);\n\n return [\n {\n data,\n length: length.current,\n loadAll,\n loadPage,\n onChangeFilter: handleFilter,\n onChangeSort: handleSort,\n pageSize,\n },\n invalidate,\n ];\n}\n"],"names":["DEFAULT_PAGE_SIZE"],"mappings":";;;MAUaA,iBAAiB,GAAG;;;;"}
1
+ {"version":3,"file":"useTableDataLoader.js","sources":["../../../../../../../src/primitives/Table/useTableDataLoader.ts"],"sourcesContent":["import React from 'react';\nimport {\n TableColumnFilter,\n TableColumnSort,\n TableFilterHandler,\n TableServerLoadPageHandler,\n TableServerLoadAllHandler,\n TableSortHandler,\n} from './types';\n\nexport const DEFAULT_PAGE_SIZE = 100;\n\nexport type useTableDataPageFetcher<TType = unknown> = (\n pageIndex: number,\n pageSize: number,\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined\n) => Promise<{ data: TType[]; length: number }>;\n\nexport type useTableDataAllFetcher<TType = unknown> = (\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined\n) => Promise<{ data: TType[]; length: number }>;\n\nexport type useTableDataLoaderOptions = { pageSize: number };\n\nexport type useTableDataLoaderValues<TType = unknown> = {\n data: TType[];\n length: number | undefined;\n loadAll: TableServerLoadAllHandler;\n loadPage: TableServerLoadPageHandler;\n onChangeFilter: TableFilterHandler;\n onChangeSort: TableSortHandler;\n pageSize: number;\n};\n\nexport function useTableDataLoader<TType = unknown>(\n fetch: useTableDataPageFetcher<TType>,\n fetchAll: useTableDataAllFetcher<TType>,\n options: useTableDataLoaderOptions = { pageSize: DEFAULT_PAGE_SIZE }\n): [useTableDataLoaderValues<TType>, () => void] {\n const { pageSize } = options;\n\n // track the data length, we don't know it until the first request\n const length = React.useRef<number | undefined>(undefined);\n // data will be filled after the first request, then we'll update values in place\n const [data, setData] = React.useState<any[]>([]);\n // track which pages have been loaded to dedupe requests\n const _pendingPageRequests = React.useRef({});\n const _lastUsedSorting = React.useRef<TableColumnSort[]>([]);\n const _lastUsedFilters = React.useRef<TableColumnFilter[]>([]);\n const _lastUsedSearch = React.useRef<string>();\n const _forceReset = React.useRef(false);\n\n const loadPage = async (\n pageIndex: number,\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined\n ) => {\n let reset = false;\n\n // sorting or filters changed, reset everything\n if (\n _forceReset.current ||\n search !== _lastUsedSearch.current ||\n JSON.stringify(sorting) !== JSON.stringify(_lastUsedSorting.current) ||\n JSON.stringify(filters) !== JSON.stringify(_lastUsedFilters.current)\n ) {\n _pendingPageRequests.current = {};\n // nuke the dataset so that we \"start again\" after sorting\n reset = true;\n }\n\n if (_pendingPageRequests.current[pageIndex]) {\n // if page is already loaded/loading, abort, otherwise mark it as loading\n return;\n } else {\n _pendingPageRequests.current[pageIndex] = true;\n }\n\n _forceReset.current = false;\n // set the sorting so we can track if it changed between loads\n _lastUsedSorting.current = sorting;\n // set the filters so we can track if it changed between loads\n _lastUsedFilters.current = filters;\n // set the search so we can track if it changed between loads\n _lastUsedSearch.current = search;\n\n try {\n const response = await fetch(pageIndex, pageSize, sorting, filters, search);\n\n // update state, here we do some \"magic\" to support \"load in place\"\n setData(currentData => {\n let nextData;\n\n // reset table state if:\n // - the length isn't set at all (first load)\n // - the client length and server length are different (the data changed)\n if (reset || length.current !== response.length) {\n length.current = response.length;\n nextData = Array(length.current).fill(undefined);\n } else {\n nextData = [...currentData];\n }\n\n const startIndex = pageIndex * pageSize;\n nextData.splice(startIndex, pageSize, ...response.data);\n return nextData;\n });\n } catch {\n //\n } finally {\n _pendingPageRequests.current[pageIndex] = false;\n }\n };\n\n const loadAll = async (sorting: TableColumnSort[], filters: TableColumnFilter[], search: string | undefined) => {\n try {\n const response = await fetchAll(sorting, filters, search);\n length.current = response.length;\n\n setData(() => {\n let nextData;\n\n if (response.data.length !== response.length) {\n nextData = Array(response.length).fill(undefined);\n nextData.splice(0, response.data.length, ...response.data);\n } else {\n nextData = [...response.data];\n }\n\n return nextData;\n });\n } catch {\n //\n }\n };\n\n const invalidate = async () => {\n _forceReset.current = true;\n return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current, _lastUsedSearch.current);\n };\n\n // we reset the page to 0 whenever sorting, filtering or search changes\n const handleSort = async (sorting: TableColumnSort[]) =>\n loadPage(0, sorting, _lastUsedFilters.current, _lastUsedSearch.current);\n const handleFilter = async (filters: TableColumnFilter[]) =>\n loadPage(0, _lastUsedSorting.current, filters, _lastUsedSearch.current);\n\n return [\n {\n data,\n length: length.current,\n loadAll,\n loadPage,\n onChangeFilter: handleFilter,\n onChangeSort: handleSort,\n pageSize,\n },\n invalidate,\n ];\n}\n"],"names":["DEFAULT_PAGE_SIZE","useTableDataLoader","fetch","fetchAll","options","pageSize","length","React","useRef","undefined","data","setData","useState","_pendingPageRequests","_lastUsedSorting","_lastUsedFilters","_lastUsedSearch","_forceReset","loadPage","pageIndex","sorting","filters","search","reset","current","JSON","stringify","Promise","resolve","_temp","_finallyRethrows","_catch","then","response","currentData","nextData","Array","fill","startIndex","splice","_wasThrown","_result","e","reject","loadAll","_temp2","invalidate","handleSort","handleFilter","onChangeFilter","onChangeSort"],"mappings":";;;MAUaA,iBAAiB,GAAG;SA4BjBC,kBAAkBA,CAC9BC,KAAqC,EACrCC,QAAuC,EACvCC,UAAqC;EAAEC,QAAQ,EAAEL;CAAmB;EAEpE,MAAM;IAAEK;GAAU,GAAGD,OAAO;;EAG5B,MAAME,MAAM,GAAGC,cAAK,CAACC,MAAM,CAAqBC,SAAS,CAAC;;EAE1D,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGJ,cAAK,CAACK,QAAQ,CAAQ,EAAE,CAAC;;EAEjD,MAAMC,oBAAoB,GAAGN,cAAK,CAACC,MAAM,CAAC,EAAE,CAAC;EAC7C,MAAMM,gBAAgB,GAAGP,cAAK,CAACC,MAAM,CAAoB,EAAE,CAAC;EAC5D,MAAMO,gBAAgB,GAAGR,cAAK,CAACC,MAAM,CAAsB,EAAE,CAAC;EAC9D,MAAMQ,eAAe,GAAGT,cAAK,CAACC,MAAM,EAAU;EAC9C,MAAMS,WAAW,GAAGV,cAAK,CAACC,MAAM,CAAC,KAAK,CAAC;EAEvC,MAAMU,QAAQ,aACVC,SAAiB,EACjBC,OAA0B,EAC1BC,OAA4B,EAC5BC,MAA0B;IAAA;MAE1B,IAAIC,KAAK,GAAG,KAAK;;MAGjB,IACIN,WAAW,CAACO,OAAO,IACnBF,MAAM,KAAKN,eAAe,CAACQ,OAAO,IAClCC,IAAI,CAACC,SAAS,CAACN,OAAO,CAAC,KAAKK,IAAI,CAACC,SAAS,CAACZ,gBAAgB,CAACU,OAAO,CAAC,IACpEC,IAAI,CAACC,SAAS,CAACL,OAAO,CAAC,KAAKI,IAAI,CAACC,SAAS,CAACX,gBAAgB,CAACS,OAAO,CAAC,EACtE;QACEX,oBAAoB,CAACW,OAAO,GAAG,EAAE;;QAEjCD,KAAK,GAAG,IAAI;;MAGhB,IAAIV,oBAAoB,CAACW,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AgB,MAAA,CAAAD,CAAA;;;;EAGD,MAAMK,UAAU,aAAU3B,OAA0B;IAAA;MAAA,OAChDF,QAAQ,CAAC,CAAC,EAAEE,OAAO,EAAEL,gBAAgB,CAACS,OAAO,EAAER,eAAe,CAACQ,OAAO,CAAC;aAAAkB,CAAA;MAAA,OAAAf,OAAA,CAAAgB,MAAA,CAAAD,CAAA;;;EAC3E,MAAMM,YAAY,aAAU3B,OAA4B;IAAA;MAAA,OACpDH,QAAQ,CAAC,CAAC,EAAEJ,gBAAgB,CAACU,OAAO,EAAEH,OAAO,EAAEL,eAAe,CAACQ,OAAO,CAAC;aAAAkB,CAAA;MAAA,OAAAf,OAAA,CAAAgB,MAAA,CAAAD,CAAA;;;EAE3E,OAAO,CACH;IACIhC,IAAI;IACJJ,MAAM,EAAEA,MAAM,CAACkB,OAAO;IACtBoB,OAAO;IACP1B,QAAQ;IACR+B,cAAc,EAAED,YAAY;IAC5BE,YAAY,EAAEH,UAAU;IACxB1C;GACH,EACDyC,UAAU,CACb;AACL;;;;"}
@@ -1,18 +1,18 @@
1
1
  import React__default from 'react';
2
2
 
3
- const isTruncated = targetElement => {
3
+ const isElementTruncated = targetElement => {
4
4
  if (targetElement !== null) {
5
5
  return targetElement.offsetWidth < targetElement.scrollWidth;
6
6
  }
7
7
  return false;
8
8
  };
9
9
  const useTruncated = (element, deps = []) => {
10
- const [truncated, setTruncated] = React__default.useState(isTruncated(element));
10
+ const [isTruncated, setIsTruncated] = React__default.useState(isElementTruncated(element));
11
11
  React__default.useEffect(() => {
12
- setTruncated(isTruncated(element));
12
+ setIsTruncated(isElementTruncated(element));
13
13
  }, [element, ...deps]);
14
14
  return {
15
- truncated
15
+ isTruncated
16
16
  };
17
17
  };
18
18
 
@@ -1 +1 @@
1
- {"version":3,"file":"useTruncated.js","sources":["../../../../../../../src/utils/hooks/useTruncated.tsx"],"sourcesContent":["import React from 'react';\n\nconst isTruncated = (targetElement: HTMLElement | null) => {\n if (targetElement !== null) {\n return targetElement.offsetWidth < targetElement.scrollWidth;\n }\n\n return false;\n};\n\nexport const useTruncated = (element: HTMLElement | null, deps: any[] = []) => {\n const [truncated, setTruncated] = React.useState<boolean>(isTruncated(element));\n\n React.useEffect(() => {\n setTruncated(isTruncated(element));\n }, [element, ...deps]);\n\n return { truncated };\n};\n"],"names":["isTruncated","targetElement","offsetWidth","scrollWidth","useTruncated","element","deps","truncated","setTruncated","React","useState","useEffect"],"mappings":";;AAEA,MAAMA,WAAW,GAAIC,aAAiC;EAClD,IAAIA,aAAa,KAAK,IAAI,EAAE;IACxB,OAAOA,aAAa,CAACC,WAAW,GAAGD,aAAa,CAACE,WAAW;;EAGhE,OAAO,KAAK;AAChB,CAAC;MAEYC,YAAY,GAAGA,CAACC,OAA2B,EAAEC,OAAc,EAAE;EACtE,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAUV,WAAW,CAACK,OAAO,CAAC,CAAC;EAE/EI,cAAK,CAACE,SAAS,CAAC;IACZH,YAAY,CAACR,WAAW,CAACK,OAAO,CAAC,CAAC;GACrC,EAAE,CAACA,OAAO,EAAE,GAAGC,IAAI,CAAC,CAAC;EAEtB,OAAO;IAAEC;GAAW;AACxB;;;;"}
1
+ {"version":3,"file":"useTruncated.js","sources":["../../../../../../../src/utils/hooks/useTruncated.tsx"],"sourcesContent":["import React from 'react';\n\nconst isElementTruncated = (targetElement: HTMLElement | null) => {\n if (targetElement !== null) {\n return targetElement.offsetWidth < targetElement.scrollWidth;\n }\n\n return false;\n};\n\nexport const useTruncated = (element: HTMLElement | null, deps: any[] = []) => {\n const [isTruncated, setIsTruncated] = React.useState<boolean>(isElementTruncated(element));\n\n React.useEffect(() => {\n setIsTruncated(isElementTruncated(element));\n }, [element, ...deps]);\n\n return { isTruncated };\n};\n"],"names":["isElementTruncated","targetElement","offsetWidth","scrollWidth","useTruncated","element","deps","isTruncated","setIsTruncated","React","useState","useEffect"],"mappings":";;AAEA,MAAMA,kBAAkB,GAAIC,aAAiC;EACzD,IAAIA,aAAa,KAAK,IAAI,EAAE;IACxB,OAAOA,aAAa,CAACC,WAAW,GAAGD,aAAa,CAACE,WAAW;;EAGhE,OAAO,KAAK;AAChB,CAAC;MAEYC,YAAY,GAAGA,CAACC,OAA2B,EAAEC,OAAc,EAAE;EACtE,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAUV,kBAAkB,CAACK,OAAO,CAAC,CAAC;EAE1FI,cAAK,CAACE,SAAS,CAAC;IACZH,cAAc,CAACR,kBAAkB,CAACK,OAAO,CAAC,CAAC;GAC9C,EAAE,CAACA,OAAO,EAAE,GAAGC,IAAI,CAAC,CAAC;EAEtB,OAAO;IAAEC;GAAa;AAC1B;;;;"}
package/dist/index.css CHANGED
@@ -903,88 +903,80 @@ table[data-taco='report'][data-table-font-size='large']
903
903
  }
904
904
 
905
905
  /* row/cell backgrounds -- we have to be specific so that nested tables don't inherit */
906
-
907
906
  /* normal rows */
908
- table[data-taco='report'] > tbody > tr:not([data-row-selected='true']) > td {
909
- @apply bg-white;
910
- }
907
+ table[data-taco='report'] > tbody > tr:not([data-row-selected]) > td {
908
+ @apply bg-white;
909
+ }
910
+ table[data-taco='report'] > tbody > tr:not([data-row-selected]):hover > td,
911
+ table[data-taco='report'] > tbody > tr:not([data-row-selected])[data-row-active] > td,
912
+ table[data-taco='report'] > tbody > tr:not([data-row-selected])[data-row-group] > td {
913
+ --table-row-actions-shadow: theme(colors.grey.100);
914
+ @apply bg-grey-100;
915
+ }
911
916
  /* search highlighting */
912
- table[data-taco='report'] > tbody > tr:not([data-row-selected='true']) > td[data-cell-highlighted='true'] {
913
- @apply bg-[#e9f2ff];
917
+ table[data-taco='report'] > tbody > tr:not([data-row-selected]) > td[data-cell-highlighted='true'] {
918
+ --table-row-actions-shadow: #e9f2ff;
919
+ @apply !bg-[#e9f2ff];
914
920
  }
915
- table[data-taco='report'] > tbody > tr:not([data-row-selected='true']) > td[data-cell-highlighted='current'] {
916
- @apply !bg-[#bfd9ff];
921
+ table[data-taco='report'] > tbody > tr:not([data-row-selected]) > td[data-cell-highlighted='current'] {
922
+ --table-row-actions-shadow: #bdd7fc;
923
+ @apply !bg-[#bdd7fc];
924
+ }
925
+ /* selected rows */
926
+ table[data-taco='report'] > tbody > tr[data-row-selected] > td {
927
+ @apply bg-blue-100;
928
+ }
929
+ table[data-taco='report'] > tbody > tr[data-row-selected]:hover > td,
930
+ table[data-taco='report'] > tbody > tr[data-row-selected][data-row-active] > td,
931
+ table[data-taco='report'] > tbody > tr[data-row-selected][data-row-group] > td {
932
+ --table-row-actions-shadow: #d6e3f6;
933
+ @apply bg-[#d6e3f6];
917
934
  }
918
- table[data-taco='report'] > tbody > tr:not([data-row-selected='true'])[data-row-group] > td {
919
- @apply bg-grey-100;
920
- }
921
- table[data-taco='report'] > tbody > tr:not([data-row-selected='true']):hover > td,
922
- table[data-taco='report'] > tbody > tr:not([data-row-selected='true'])[data-row-active='true'] > td,
923
- table[data-taco='report'] > tbody > tr:not([data-row-selected='true'])[data-row-active='true']:hover > td {
924
- --table-row-actions-shadow: theme(colors.grey.100);
925
- @apply bg-grey-100;
926
- }
927
935
  /* search highlighting */
928
- table[data-taco='report'] > tbody > tr:not([data-row-selected='true']):hover > td[data-cell-highlighted='true'], table[data-taco='report'] > tbody > tr:not([data-row-selected='true'])[data-row-active='true'] > td[data-cell-highlighted='true'], table[data-taco='report'] > tbody > tr:not([data-row-selected='true'])[data-row-active='true']:hover > td[data-cell-highlighted='true'] {
929
- @apply bg-[#e2ebf8];
936
+ table[data-taco='report'] > tbody > tr[data-row-selected] > td[data-cell-highlighted] {
937
+ --table-row-actions-shadow: #b4d2fd;
938
+ @apply !bg-[#b4d2fd];
930
939
  }
931
- /* normal rows when focus is inside the table */
932
- table[data-taco='report']:focus-within > tbody > tr[data-row-active='true']:not([data-row-selected='true']) > td {
933
- --table-row-actions-shadow: theme(colors.grey.200);
934
- @apply !bg-grey-200;
935
- }
936
940
 
937
- /* normal rows when hover is paused */
938
- table[data-taco='report'][data-table-pause-hover='true'] > tbody > tr:not([data-row-selected='true']):hover:not([data-row-active='true']) > td {
939
- --table-row-actions-shadow: theme(colors.white);
940
- @apply !bg-white;
941
- }
942
- table[data-taco='report'][data-table-pause-hover='true'] > tbody > tr:not([data-row-selected='true']):hover[data-row-active='true'] > td {
943
- --table-row-actions-shadow: theme(colors.grey.200);
944
- @apply !bg-grey-200;
945
- }
941
+ /* normal rows */
942
+
943
+ table[data-taco='report']:focus-within > tbody > tr:not([data-row-selected])[data-row-active] > td {
944
+ --table-row-actions-shadow: theme(colors.grey.200);
945
+ @apply bg-grey-200;
946
+ }
946
947
 
947
948
  /* selected rows */
948
- table[data-taco='report'] > tbody > tr[data-row-selected='true'] > td {
949
- @apply bg-blue-100;
950
- }
951
- /* search highlighting */
952
- table[data-taco='report'] > tbody > tr[data-row-selected='true'] > td[data-cell-highlighted='true'] {
953
- @apply bg-[#d0e4ff];
949
+
950
+ table[data-taco='report']:focus-within > tbody > tr[data-row-selected][data-row-active] > td {
951
+ --table-row-actions-shadow: #ccd8eb;
952
+ @apply bg-[#ccd8eb];
953
+ }
954
+
955
+ /* normal rows */
956
+
957
+ table[data-taco='report'][data-table-pause-hover='true'] > tbody > tr:hover:not([data-row-selected]):not([data-row-active]) > td {
958
+ --table-row-actions-shadow: theme(colors.white);
959
+ @apply bg-white;
954
960
  }
955
- table[data-taco='report'] > tbody > tr[data-row-selected='true'] > td[data-cell-highlighted='current'] {
956
- @apply !bg-[#b6d4ff];
961
+
962
+ table[data-taco='report'][data-table-pause-hover='true'] > tbody > tr:hover:not([data-row-selected])[data-row-active] > td {
963
+ --table-row-actions-shadow: theme(colors.grey.200);
964
+ @apply bg-grey-200;
957
965
  }
958
- table[data-taco='report'] > tbody > tr[data-row-selected='true']:hover > td,
959
- table[data-taco='report'] > tbody > tr[data-row-selected='true'][data-row-active='true'] > td,
960
- table[data-taco='report'] > tbody > tr[data-row-selected='true'][data-row-active='true']:hover > td {
961
- --table-row-actions-shadow: #d6e3f6;
962
- @apply bg-[#D6E3F6];
963
- }
964
- /* search highlighting */
965
- table[data-taco='report'] > tbody > tr[data-row-selected='true']:hover > td[data-cell-highlighted='true'], table[data-taco='report'] > tbody > tr[data-row-selected='true'][data-row-active='true'] > td[data-cell-highlighted='true'], table[data-taco='report'] > tbody > tr[data-row-selected='true'][data-row-active='true']:hover > td[data-cell-highlighted='true'] {
966
- @apply bg-[#cadef9];
966
+
967
+ /* selected rows */
968
+
969
+ table[data-taco='report'][data-table-pause-hover='true'] > tbody > tr:hover[data-row-selected]:not([data-row-active]) > td {
970
+ --table-row-actions-shadow: theme(colors.blue.100);
971
+ @apply bg-blue-100;
967
972
  }
968
- table[data-taco='report'] > tbody > tr[data-row-selected='true']:hover > td[data-cell-highlighted='current'], table[data-taco='report'] > tbody > tr[data-row-selected='true'][data-row-active='true'] > td[data-cell-highlighted='current'], table[data-taco='report'] > tbody > tr[data-row-selected='true'][data-row-active='true']:hover > td[data-cell-highlighted='current'] {
969
- @apply !bg-[#b4d2fd];
973
+
974
+ table[data-taco='report'][data-table-pause-hover='true'] > tbody > tr:hover[data-row-selected][data-row-active] > td {
975
+ --table-row-actions-shadow: #ccd8eb;
976
+ @apply bg-[#CCD8EB];
970
977
  }
971
- /* selected rows when focus is inside the table */
972
- table[data-taco='report']:focus-within > tbody > tr[data-row-active='true'][data-row-selected='true'] > td {
973
- --table-row-actions-shadow: #ccd8eb;
974
- @apply bg-[#CCD8EB];
975
- }
976
- /* selected rows when hover is paused */
977
- table[data-taco='report'][data-table-pause-hover='true'] > tbody > tr[data-row-selected='true']:hover:not([data-row-active='true']) > td {
978
- --table-row-actions-shadow: theme(colors.blue.100);
979
- @apply !bg-blue-100;
980
- }
981
- table[data-taco='report'][data-table-pause-hover='true'] > tbody > tr[data-row-selected='true']:hover[data-row-active='true'] > td {
982
- --table-row-actions-shadow: #ccd8eb;
983
- @apply !bg-[#CCD8EB];
984
- }
985
978
 
986
979
  /* row metadata */
987
-
988
980
  table[data-taco='report'] tbody tr[data-row-meta-layout='heading']:not([data-row-group='true']) td {
989
981
  @apply !border-b-0 border-t font-bold;
990
982
  }
@@ -1335,7 +1327,7 @@ table[data-taco='report'] [data-cell-id^='__'] {
1335
1327
  }
1336
1328
 
1337
1329
  [data-font-size='small'] [role='cell'] [data-taco='tag'] {
1338
- @apply !-my-1;
1330
+ @apply h-4 min-h-[theme(spacing.4)];
1339
1331
  }
1340
1332
 
1341
1333
  [data-font-size='small'] [role='cell'] [data-taco='Select2'],
@@ -1391,7 +1383,7 @@ table[data-taco='report'] [data-cell-id^='__'] {
1391
1383
  }
1392
1384
 
1393
1385
  /* When cell is editable and highlighted, the padding should apply to highlight wrapper and remove 1px border-width,
1394
- because it should take all the available space in the cell */
1386
+ because it should take all the available space in the cell */
1395
1387
 
1396
1388
  [data-font-size='small'] [role='cell'][data-editable][data-highlighted='true'] [data-taco='highlight'] {
1397
1389
  @apply px-[calc(var(--table3-cell-padding-x)_-_6px_-_1px)];
@@ -1414,8 +1406,8 @@ table[data-taco='report'] [data-cell-id^='__'] {
1414
1406
  @apply !-my-0.5;
1415
1407
  }
1416
1408
 
1417
- [data-font-size='medium'] [role='cell'] [data-taco='tag'] {
1418
- @apply !-my-0.5;
1409
+ [data-font-size='medium'] [role='cell'] [data-taco='Select2'] {
1410
+ @apply !px-2;
1419
1411
  }
1420
1412
 
1421
1413
  [data-font-size='medium'] [role='cell'] [data-taco='Select2'],
@@ -1430,7 +1422,7 @@ table[data-taco='report'] [data-cell-id^='__'] {
1430
1422
  }
1431
1423
 
1432
1424
  /* When cell is editable and highlighted, the padding should apply to highlight wrapper and remove 1px border-width,
1433
- because it should take all the available space in the cell */
1425
+ because it should take all the available space in the cell */
1434
1426
 
1435
1427
  [data-font-size='medium'] [role='cell'][data-editable][data-highlighted='true'] [data-taco='highlight'] {
1436
1428
  @apply px-[calc(var(--table3-cell-padding-x)_-_8px_-_1px)];
@@ -1460,8 +1452,8 @@ table[data-taco='report'] [data-cell-id^='__'] {
1460
1452
  @apply !-my-0.5;
1461
1453
  }
1462
1454
 
1463
- [data-font-size='large'] [role='cell'] [data-taco='tag'] {
1464
- @apply !-my-0.5;
1455
+ [data-font-size='large'] [role='cell'] [data-taco='Select2'] {
1456
+ @apply !px-2.5;
1465
1457
  }
1466
1458
 
1467
1459
  [data-font-size='large'] [role='cell'] [data-taco='Select2'],
@@ -1502,7 +1494,7 @@ table[data-taco='report'] [data-cell-id^='__'] {
1502
1494
  }
1503
1495
 
1504
1496
  /* When cell is editable and highlighted, the padding should apply to highlight wrapper and remove 1px border-width,
1505
- because it should take all the available space in the cell */
1497
+ because it should take all the available space in the cell */
1506
1498
 
1507
1499
  [data-font-size='large'] [role='cell'][data-editable][data-highlighted='true'] [data-taco='highlight'] {
1508
1500
  @apply px-[calc(var(--table3-cell-padding-x)_-_10px_-_1px)];
@@ -1520,3 +1512,9 @@ table[data-taco='report'] [data-cell-id^='__'] {
1520
1512
  [data-font-size='large'] [role='columnheader'] button {
1521
1513
  @apply !text-sm;
1522
1514
  }
1515
+
1516
+ /* When spinner is rendered in the last cell of the table, it slightly pushes the edge of the table(while rotating),
1517
+ and making horisontal scroll bar jump */
1518
+ [data-editing='true'] [role='cell']:last-child [data-taco='spinner'] {
1519
+ overflow: hidden;
1520
+ }
package/dist/index.d.ts CHANGED
@@ -55,6 +55,7 @@ export * from './components/Header/Header';
55
55
  export * from './components/Layout/Layout';
56
56
  export * from './components/Navigation2/Navigation2';
57
57
  export * as CollectionPrimitive from './primitives/Collection/Collection';
58
+ export * from './primitives/Table/useTableDataLoader';
58
59
  export * from './utils/date';
59
60
  export * from './utils/keyboard';
60
61
  export * from './utils/mergeRefs';
@@ -104,6 +104,18 @@ export declare type TableSettings = {
104
104
  searchQuery?: string;
105
105
  sorting?: ReactTableSortingState;
106
106
  };
107
+ export declare type EnableSettingsOptions = {
108
+ columnOrder: boolean;
109
+ columnPinning: boolean;
110
+ columnSizing: boolean;
111
+ columnVisibility: boolean;
112
+ excludeUnmatchedRecordsInSearch: boolean;
113
+ fontSize: boolean;
114
+ grouping: boolean;
115
+ rowHeight: boolean;
116
+ showWarningWhenPrintingLargeDataset: boolean;
117
+ sorting: boolean;
118
+ };
107
119
  export declare type TableFeatureProps = {
108
120
  enableFiltering?: boolean;
109
121
  enableSearch?: boolean;
@@ -123,7 +135,7 @@ export declare type TableFeatureProps = {
123
135
  enableRowClick?: boolean;
124
136
  enableRowGoto?: boolean;
125
137
  enableRowHeight?: boolean;
126
- enableSettings?: boolean;
138
+ enableSaveSettings?: boolean | Partial<EnableSettingsOptions>;
127
139
  };
128
140
  export declare type useTableInternalColumn<TType = unknown> = {
129
141
  header?: (info: ReactTableHeaderContext<TType, unknown>) => JSX.Element | string | null;