@economic/taco 2.54.0 → 2.55.0-settings.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/components/Provider/Provider.d.ts +7 -6
  2. package/dist/components/Provider/TacoContext.d.ts +7 -0
  3. package/dist/components/Provider/useTacoSettings.d.ts +8 -0
  4. package/dist/components/Report/Report.d.ts +1 -1
  5. package/dist/esm/packages/taco/src/components/Provider/Provider.js +14 -7
  6. package/dist/esm/packages/taco/src/components/Provider/Provider.js.map +1 -1
  7. package/dist/esm/packages/taco/src/components/Provider/TacoContext.js +6 -0
  8. package/dist/esm/packages/taco/src/components/Provider/TacoContext.js.map +1 -0
  9. package/dist/esm/packages/taco/src/components/Provider/useTacoSettings.js +39 -0
  10. package/dist/esm/packages/taco/src/components/Provider/useTacoSettings.js.map +1 -0
  11. package/dist/esm/packages/taco/src/components/Report/Report.js +8 -0
  12. package/dist/esm/packages/taco/src/components/Report/Report.js.map +1 -1
  13. package/dist/esm/packages/taco/src/components/Table3/Table3.js +8 -0
  14. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  15. package/dist/esm/packages/taco/src/hooks/useTaco.js +9 -0
  16. package/dist/esm/packages/taco/src/hooks/useTaco.js.map +1 -0
  17. package/dist/esm/packages/taco/src/index.js +1 -1
  18. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/Toolbar.js +6 -4
  19. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/Toolbar.js.map +1 -1
  20. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +9 -5
  21. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
  22. package/dist/esm/packages/taco/src/primitives/Table/Core/useTable.js.map +1 -1
  23. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  24. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTablePrinting.js +18 -21
  25. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTablePrinting.js.map +1 -1
  26. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js +2 -2
  27. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js.map +1 -1
  28. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSettingsListener.js +57 -9
  29. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSettingsListener.js.map +1 -1
  30. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +7 -5
  31. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
  32. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableSettingsPreloader.js +44 -0
  33. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableSettingsPreloader.js.map +1 -0
  34. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js +3 -1
  35. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js.map +1 -1
  36. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +5 -2
  37. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  38. package/dist/hooks/useTaco.d.ts +1 -0
  39. package/dist/primitives/Table/Core/features/useTableRenderer.d.ts +2 -2
  40. package/dist/primitives/Table/Core/useTable.d.ts +4 -4
  41. package/dist/primitives/Table/types.d.ts +16 -6
  42. package/dist/primitives/Table/useTableManager/features/useTablePrinting.d.ts +2 -8
  43. package/dist/primitives/Table/useTableManager/features/useTableRowActive.d.ts +2 -2
  44. package/dist/primitives/Table/useTableManager/listeners/useTableSettingsListener.d.ts +2 -2
  45. package/dist/primitives/Table/useTableManager/useTableSettingsPreloader.d.ts +3 -0
  46. package/dist/primitives/Table/useTableManager/util/settings.d.ts +2 -0
  47. package/dist/taco.cjs.development.js +195 -153
  48. package/dist/taco.cjs.development.js.map +1 -1
  49. package/dist/taco.cjs.production.min.js +1 -1
  50. package/dist/taco.cjs.production.min.js.map +1 -1
  51. package/package.json +2 -2
  52. package/dist/esm/packages/taco/src/hooks/useLocalStorage.js +0 -44
  53. package/dist/esm/packages/taco/src/hooks/useLocalStorage.js.map +0 -1
  54. package/dist/esm/packages/taco/src/hooks/useTacoSettings.js +0 -9
  55. package/dist/esm/packages/taco/src/hooks/useTacoSettings.js.map +0 -1
  56. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSettings.js +0 -69
  57. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSettings.js.map +0 -1
  58. package/dist/hooks/useLocalStorage.d.ts +0 -2
  59. package/dist/hooks/useTacoSettings.d.ts +0 -1
  60. package/dist/primitives/Table/useTableManager/features/useTableSettings.d.ts +0 -3
@@ -1,14 +1,15 @@
1
- import * as React from 'react';
1
+ /// <reference types="react" />
2
2
  import { Localization } from './Localization';
3
- export declare type TacoSettings = {
4
- uniqueUserIdentifier: string;
5
- };
6
- export declare const TacoContext: React.Context<TacoSettings>;
3
+ declare type TacoSettingsLoadHandler = <TType = unknown>(key: string) => Promise<TType>;
4
+ declare type TacoSettingsSaveHandler = <TType = unknown>(key: string, setting: TType) => Promise<void>;
7
5
  export declare type ProviderProps = {
8
6
  /** Content would be your application */
9
7
  children?: any;
10
8
  /** Define localized texts and formatted data in your application */
11
9
  localization?: Localization;
12
- settings: TacoSettings;
10
+ loadSetting: TacoSettingsLoadHandler;
11
+ saveSetting: TacoSettingsSaveHandler;
12
+ userId: string;
13
13
  };
14
14
  export declare const Provider: (props: ProviderProps) => JSX.Element;
15
+ export {};
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { useTacoSettings } from './useTacoSettings';
3
+ export declare type Taco = {
4
+ settings: ReturnType<typeof useTacoSettings>;
5
+ userId: string;
6
+ };
7
+ export declare const TacoContext: React.Context<Taco>;
@@ -0,0 +1,8 @@
1
+ declare type TacoSettingsLoadHandler = <TType = unknown>(key: string) => Promise<TType>;
2
+ declare type TacoSettingsSaveHandler = <TType = unknown>(key: string, setting: TType) => Promise<void>;
3
+ export declare function useTacoSettings(load: TacoSettingsLoadHandler, save: TacoSettingsSaveHandler): {
4
+ getSetting: <TType = unknown>(path: string) => TType;
5
+ loadSetting: <TType_1 = unknown>(path: string) => Promise<TType_1>;
6
+ saveSetting: <TType_2 = unknown>(path: string, value: TType_2) => Promise<void>;
7
+ };
8
+ export {};
@@ -4,7 +4,7 @@ declare const Column: React.FC<ReportColumnProps<unknown>> & {
4
4
  <TType = unknown>(_: ReportColumnProps<TType>): null;
5
5
  };
6
6
  declare function Group(_: ReportGroupProps): null;
7
- export declare const Report: (<TType = unknown>(props: Pick<import("../..").TableProps<TType>, "length" | "loadAll" | "loadPage" | "pageSize" | "pages" | "_experimentalDataLoader2" | "enableFiltering" | "enableSearch" | "enableSorting" | "enableColumnFreezing" | "enableColumnHiding" | "enableColumnResizing" | "enableRowExpansion" | "enableRowExpansionAll" | "enableRowSelection" | "enableColumnOrdering" | "enableFontSize" | "enableFooter" | "enablePrinting" | "enableRowActions" | "enableRowActive" | "enableRowClick" | "enableRowDrag" | "enableRowDrop" | "enableRowGoto" | "enableRowHeight" | "enableSaveSettings" | "children" | "data" | "id" | "customSettings" | "defaultColumnFreezingIndex" | "defaultRowActiveIndex" | "defaultRowGroupColumnId" | "defaultSettings" | "emptyState" | "rowActions" | "rowActionsForGroup" | "rowActionsLength" | "rowExpansionRenderer" | "rowIdentityAccessor" | "shortcuts" | "toolbarLeft" | "toolbarRight" | "toolbarPanel" | "onEvent" | "onRowClick" | "onRowDrag" | "onRowDrop" | "onRowGoto" | "onRowSelect" | "onChangeFilter" | "onChangeSearch" | "onChangeSettings" | "onChangeSort"> & React.RefAttributes<import("../..").TableRef>) => JSX.Element) & {
7
+ export declare const Report: (<TType = unknown>(props: Pick<import("../..").TableProps<TType>, "length" | "loadAll" | "loadPage" | "pageSize" | "pages" | "_experimentalDataLoader2" | "enableFiltering" | "enableSearch" | "enableSorting" | "enableColumnFreezing" | "enableColumnHiding" | "enableColumnResizing" | "enableRowExpansion" | "enableRowExpansionAll" | "enableRowSelection" | "enableColumnOrdering" | "enableFontSize" | "enableFooter" | "enablePrinting" | "enableRowActions" | "enableRowActive" | "enableRowClick" | "enableRowDrag" | "enableRowDrop" | "enableRowGoto" | "enableRowHeight" | "enableSaveSettings" | "children" | "data" | "id" | "customSettings" | "defaultColumnFreezingIndex" | "defaultRowActiveIndex" | "defaultRowGroupColumnId" | "defaultSettings" | "emptyState" | "rowActions" | "rowActionsForGroup" | "rowActionsLength" | "rowExpansionRenderer" | "rowIdentityAccessor" | "shortcuts" | "toolbarLeft" | "toolbarRight" | "toolbarPanel" | "onEvent" | "onRowClick" | "onRowDrag" | "onRowDrop" | "onRowGoto" | "onRowSelect" | "onChangeFilter" | "onChangeSearch" | "onChangeSort" | "_DEPRECATED_DO_NOT_USE_onChangeSettings"> & React.RefAttributes<import("../..").TableRef>) => JSX.Element) & {
8
8
  Column: typeof Column;
9
9
  Group: typeof Group;
10
10
  };
@@ -1,18 +1,25 @@
1
- import { createContext, useMemo, createElement } from 'react';
1
+ import { useMemo, createElement } from 'react';
2
2
  import { Provider as Provider$1 } from '@radix-ui/react-tooltip';
3
3
  import { LocalizationProvider } from './Localization.js';
4
4
  import { ToastProvider } from '../Toast/Toaster.js';
5
+ import { TacoContext } from './TacoContext.js';
6
+ import { useTacoSettings } from './useTacoSettings.js';
5
7
 
6
- const TacoContext = /*#__PURE__*/createContext({
7
- uniqueUserIdentifier: ''
8
- });
9
8
  const Provider = props => {
10
9
  const {
11
10
  children,
12
11
  localization,
13
- settings
12
+ loadSetting,
13
+ saveSetting,
14
+ userId
14
15
  } = props;
15
- const context = useMemo(() => settings, [JSON.stringify(settings)]);
16
+ const settings = useTacoSettings(loadSetting, saveSetting);
17
+ const context = useMemo(() => {
18
+ return {
19
+ settings,
20
+ userId
21
+ };
22
+ }, []);
16
23
  return /*#__PURE__*/createElement(LocalizationProvider, {
17
24
  localization: localization
18
25
  }, /*#__PURE__*/createElement(TacoContext.Provider, {
@@ -20,5 +27,5 @@ const Provider = props => {
20
27
  }, /*#__PURE__*/createElement(Provider$1, null, /*#__PURE__*/createElement(ToastProvider, null, children))));
21
28
  };
22
29
 
23
- export { Provider, TacoContext };
30
+ export { Provider };
24
31
  //# sourceMappingURL=Provider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Provider.js","sources":["../../../../../../../src/components/Provider/Provider.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as Tooltip from '@radix-ui/react-tooltip';\nimport { ToastProvider } from '../Toast/Toaster';\nimport { Localization, LocalizationProvider } from './Localization';\n\nexport type TacoSettings = {\n uniqueUserIdentifier: string;\n};\n\nexport const TacoContext = React.createContext<TacoSettings>({\n uniqueUserIdentifier: '',\n});\n\nexport type ProviderProps = {\n /** Content would be your application */\n children?: any;\n /** Define localized texts and formatted data in your application */\n localization?: Localization;\n settings: TacoSettings;\n};\n\nexport const Provider = (props: ProviderProps): JSX.Element => {\n const { children, localization, settings } = props;\n\n const context = React.useMemo(() => settings, [JSON.stringify(settings)]);\n\n return (\n <LocalizationProvider localization={localization}>\n <TacoContext.Provider value={context}>\n <Tooltip.Provider>\n <ToastProvider>{children}</ToastProvider>\n </Tooltip.Provider>\n </TacoContext.Provider>\n </LocalizationProvider>\n );\n};\n"],"names":["TacoContext","React","uniqueUserIdentifier","Provider","props","children","localization","settings","context","JSON","stringify","LocalizationProvider","value","Tooltip","ToastProvider"],"mappings":";;;;;MASaA,WAAW,gBAAGC,aAAmB,CAAe;EACzDC,oBAAoB,EAAE;CACzB;MAUYC,QAAQ,GAAIC,KAAoB;EACzC,MAAM;IAAEC,QAAQ;IAAEC,YAAY;IAAEC;GAAU,GAAGH,KAAK;EAElD,MAAMI,OAAO,GAAGP,OAAa,CAAC,MAAMM,QAAQ,EAAE,CAACE,IAAI,CAACC,SAAS,CAACH,QAAQ,CAAC,CAAC,CAAC;EAEzE,oBACIN,cAACU,oBAAoB;IAACL,YAAY,EAAEA;kBAChCL,cAACD,WAAW,CAACG,QAAQ;IAACS,KAAK,EAAEJ;kBACzBP,cAACY,UAAgB,qBACbZ,cAACa,aAAa,QAAET,QAAQ,CAAiB,CAC1B,CACA,CACJ;AAE/B;;;;"}
1
+ {"version":3,"file":"Provider.js","sources":["../../../../../../../src/components/Provider/Provider.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as Tooltip from '@radix-ui/react-tooltip';\nimport { ToastProvider } from '../Toast/Toaster';\nimport { Localization, LocalizationProvider } from './Localization';\nimport { Taco, TacoContext } from './TacoContext';\nimport { useTacoSettings } from './useTacoSettings';\n\ntype TacoSettingsLoadHandler = <TType = unknown>(key: string) => Promise<TType>;\ntype TacoSettingsSaveHandler = <TType = unknown>(key: string, setting: TType) => Promise<void>;\n\nexport type ProviderProps = {\n /** Content would be your application */\n children?: any;\n /** Define localized texts and formatted data in your application */\n localization?: Localization;\n // settings\n loadSetting: TacoSettingsLoadHandler;\n saveSetting: TacoSettingsSaveHandler;\n // TODO: remove this - it is redundant and only here in order to migrate legacy settings\n userId: string;\n};\n\nexport const Provider = (props: ProviderProps): JSX.Element => {\n const { children, localization, loadSetting, saveSetting, userId } = props;\n const settings = useTacoSettings(loadSetting, saveSetting);\n\n const context = React.useMemo(() => {\n return {\n settings,\n userId,\n } as Taco;\n }, []);\n\n return (\n <LocalizationProvider localization={localization}>\n <TacoContext.Provider value={context}>\n <Tooltip.Provider>\n <ToastProvider>{children}</ToastProvider>\n </Tooltip.Provider>\n </TacoContext.Provider>\n </LocalizationProvider>\n );\n};\n"],"names":["Provider","props","children","localization","loadSetting","saveSetting","userId","settings","useTacoSettings","context","React","LocalizationProvider","TacoContext","value","Tooltip","ToastProvider"],"mappings":";;;;;;;MAsBaA,QAAQ,GAAIC,KAAoB;EACzC,MAAM;IAAEC,QAAQ;IAAEC,YAAY;IAAEC,WAAW;IAAEC,WAAW;IAAEC;GAAQ,GAAGL,KAAK;EAC1E,MAAMM,QAAQ,GAAGC,eAAe,CAACJ,WAAW,EAAEC,WAAW,CAAC;EAE1D,MAAMI,OAAO,GAAGC,OAAa,CAAC;IAC1B,OAAO;MACHH,QAAQ;MACRD;KACK;GACZ,EAAE,EAAE,CAAC;EAEN,oBACII,cAACC,oBAAoB;IAACR,YAAY,EAAEA;kBAChCO,cAACE,WAAW,CAACZ,QAAQ;IAACa,KAAK,EAAEJ;kBACzBC,cAACI,UAAgB,qBACbJ,cAACK,aAAa,QAAEb,QAAQ,CAAiB,CAC1B,CACA,CACJ;AAE/B;;;;"}
@@ -0,0 +1,6 @@
1
+ import { createContext } from 'react';
2
+
3
+ const TacoContext = /*#__PURE__*/createContext({});
4
+
5
+ export { TacoContext };
6
+ //# sourceMappingURL=TacoContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TacoContext.js","sources":["../../../../../../../src/components/Provider/TacoContext.ts"],"sourcesContent":["import * as React from 'react';\nimport { useTacoSettings } from './useTacoSettings';\n\nexport type Taco = {\n settings: ReturnType<typeof useTacoSettings>;\n userId: string;\n};\n\nexport const TacoContext = React.createContext<Taco>({} as Taco);\n"],"names":["TacoContext","React"],"mappings":";;MAQaA,WAAW,gBAAGC,aAAmB,CAAO,EAAU;;;;"}
@@ -0,0 +1,39 @@
1
+ import { useState } from 'react';
2
+ import { setWith, get } from 'lodash-es';
3
+
4
+ function useTacoSettings(load, save) {
5
+ const saveSetting = function (path, value) {
6
+ try {
7
+ setState(currentState => setWith(currentState, path, value, Object));
8
+ return Promise.resolve(save(path, value)); // don't block, since we have local state
9
+ } catch (e) {
10
+ return Promise.reject(e);
11
+ }
12
+ };
13
+ const loadSetting = function (path) {
14
+ try {
15
+ const currentValue = get(state, path);
16
+ if (currentValue) {
17
+ return Promise.resolve(currentValue);
18
+ }
19
+ return Promise.resolve(load(path)).then(function (value) {
20
+ setState(currentState => setWith(currentState, path, value, Object));
21
+ return value;
22
+ });
23
+ } catch (e) {
24
+ return Promise.reject(e);
25
+ }
26
+ };
27
+ const [state, setState] = useState({});
28
+ function getSetting(path) {
29
+ return get(state, path);
30
+ }
31
+ return {
32
+ getSetting,
33
+ loadSetting,
34
+ saveSetting
35
+ };
36
+ }
37
+
38
+ export { useTacoSettings };
39
+ //# sourceMappingURL=useTacoSettings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTacoSettings.js","sources":["../../../../../../../src/components/Provider/useTacoSettings.ts"],"sourcesContent":["import * as React from 'react';\nimport { get, setWith } from 'lodash';\n\ntype TacoSettingsLoadHandler = <TType = unknown>(key: string) => Promise<TType>;\ntype TacoSettingsSaveHandler = <TType = unknown>(key: string, setting: TType) => Promise<void>;\n\nexport function useTacoSettings(load: TacoSettingsLoadHandler, save: TacoSettingsSaveHandler) {\n const [state, setState] = React.useState({});\n\n function getSetting<TType = unknown>(path: string): TType {\n return get(state, path) as TType;\n }\n\n async function loadSetting<TType = unknown>(path: string) {\n const currentValue = get(state, path) as TType;\n\n if (currentValue) {\n return currentValue;\n }\n\n const value = await load<TType>(path);\n setState(currentState => setWith(currentState, path, value, Object));\n return value;\n }\n\n async function saveSetting<TType = unknown>(path: string, value: TType) {\n setState(currentState => setWith(currentState, path, value, Object));\n return save(path, value); // don't block, since we have local state\n }\n\n return { getSetting, loadSetting, saveSetting };\n}\n"],"names":["useTacoSettings","load","save","saveSetting","path","value","setState","currentState","setWith","Object","Promise","resolve","e","reject","loadSetting","currentValue","get","state","then","React","getSetting"],"mappings":";;;SAMgBA,eAAeA,CAACC,IAA6B,EAAEC,IAA6B;QAmBzEC,WAAW,aAAkBC,IAAY,EAAEC,KAAY;IAAA;MAClEC,QAAQ,CAACC,YAAY,IAAIC,OAAO,CAACD,YAAY,EAAEH,IAAI,EAAEC,KAAK,EAAEI,MAAM,CAAC,CAAC;MACpE,OAAAC,OAAA,CAAAC,OAAA,CAAOT,IAAI,CAACE,IAAI,EAAEC,KAAK,CAAC,EAAC;KAC5B,QAAAO,CAAA;MAAA,OAAAF,OAAA,CAAAG,MAAA,CAAAD,CAAA;;;EAAA,MAfcE,WAAW,aAAkBV,IAAY;IAAA;MACpD,MAAMW,YAAY,GAAGC,GAAG,CAACC,KAAK,EAAEb,IAAI,CAAU;MAE9C,IAAIW,YAAY,EAAE;QACd,OAAAL,OAAA,CAAAC,OAAA,CAAOI,YAAY;;MACtB,OAAAL,OAAA,CAAAC,OAAA,CAEmBV,IAAI,CAAQG,IAAI,CAAC,EAAAc,IAAA,WAA/Bb,KAAK;QACXC,QAAQ,CAACC,YAAY,IAAIC,OAAO,CAACD,YAAY,EAAEH,IAAI,EAAEC,KAAK,EAAEI,MAAM,CAAC,CAAC;QACpE,OAAOJ,KAAK;;KACf,QAAAO,CAAA;MAAA,OAAAF,OAAA,CAAAG,MAAA,CAAAD,CAAA;;;EAhBD,MAAM,CAACK,KAAK,EAAEX,QAAQ,CAAC,GAAGa,QAAc,CAAC,EAAE,CAAC;EAE5C,SAASC,UAAUA,CAAkBhB,IAAY;IAC7C,OAAOY,GAAG,CAACC,KAAK,EAAEb,IAAI,CAAU;;EAoBpC,OAAO;IAAEgB,UAAU;IAAEN,WAAW;IAAEX;GAAa;AACnD;;;;"}
@@ -1,7 +1,9 @@
1
1
  import React__default from 'react';
2
+ import { Spinner } from '../Spinner/Spinner.js';
2
3
  import { fixedForwardRef } from '../../types.js';
3
4
  import { useReport } from './useReport.js';
4
5
  import { Table } from '../../primitives/Table/Core/Table.js';
6
+ import { useTableSettingsPreloader } from '../../primitives/Table/useTableManager/useTableSettingsPreloader.js';
5
7
 
6
8
  const Column = () => null;
7
9
  Column.displayName = 'Table3Column';
@@ -22,6 +24,12 @@ const Report = /*#__PURE__*/fixedForwardRef(function Report(props, ref) {
22
24
  // we force a remount (using key) when the child columns change because there are too many places to add children as an effect
23
25
  // this is cheaper from a complexity perspective, and probably performance wise as well
24
26
  const key = React__default.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);
27
+ const {
28
+ loading
29
+ } = useTableSettingsPreloader(props.id);
30
+ if (loading) {
31
+ return /*#__PURE__*/React__default.createElement(Spinner, null);
32
+ }
25
33
  return /*#__PURE__*/React__default.createElement(BaseReport, Object.assign({}, props, {
26
34
  key: key,
27
35
  ref: ref
@@ -1 +1 @@
1
- {"version":3,"file":"Report.js","sources":["../../../../../../../src/components/Report/Report.tsx"],"sourcesContent":["import React from 'react';\nimport { fixedForwardRef } from '../../types';\nimport { useReport } from './useReport';\nimport { Table } from '../../primitives/Table/Core/Table';\nimport { ReportRef, ReportProps, ReportColumnProps, ReportGroupProps } from './types';\n\nconst Column: React.FC<ReportColumnProps<unknown>> & {\n <TType = unknown>(_: ReportColumnProps<TType>): null;\n} = () => null;\n\nColumn.displayName = 'Table3Column';\n\nfunction Group(_: ReportGroupProps) {\n return null;\n}\n\nconst BaseReport = fixedForwardRef(function BaseReport<TType = unknown>(props: ReportProps<TType>, ref: React.Ref<ReportRef>) {\n const report = useReport<TType>(props, ref);\n\n return (\n <Table>\n <Table.Toolbar<TType> table={report} />\n <Table.Grid<TType> data-taco=\"table-report\" table={report} />\n </Table>\n );\n});\n\nexport const Report = fixedForwardRef(function Report<TType = unknown>(props: ReportProps<TType>, ref: React.Ref<ReportRef>) {\n const stringifiedChildren = String(props.children);\n // we force a remount (using key) when the child columns change because there are too many places to add children as an effect\n // this is cheaper from a complexity perspective, and probably performance wise as well\n const key = React.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);\n return <BaseReport<TType> {...props} key={key} ref={ref} />;\n}) as (<TType = unknown>(props: ReportProps<TType> & React.RefAttributes<ReportRef>) => JSX.Element) & {\n Column: typeof Column;\n Group: typeof Group;\n};\nReport.Column = Column;\nReport.Group = Group;\n\nexport type { ReportRef, ReportProps, ReportColumnProps, ReportGroupProps } from './types';\n"],"names":["Column","displayName","Group","_","BaseReport","fixedForwardRef","props","ref","report","useReport","React","Table","Toolbar","table","Grid","Report","stringifiedChildren","String","children","key","useMemo"],"mappings":";;;;;AAMA,MAAMA,MAAM,GAERA,MAAM,IAAI;AAEdA,MAAM,CAACC,WAAW,GAAG,cAAc;AAEnC,SAASC,KAAKA,CAACC,CAAmB;EAC9B,OAAO,IAAI;AACf;AAEA,MAAMC,UAAU,gBAAGC,eAAe,CAAC,SAASD,UAAUA,CAAkBE,KAAyB,EAAEC,GAAyB;EACxH,MAAMC,MAAM,GAAGC,SAAS,CAAQH,KAAK,EAAEC,GAAG,CAAC;EAE3C,oBACIG,6BAACC,KAAK,qBACFD,6BAACC,KAAK,CAACC,OAAO;IAAQC,KAAK,EAAEL;IAAU,eACvCE,6BAACC,KAAK,CAACG,IAAI;iBAAkB,cAAc;IAACD,KAAK,EAAEL;IAAU,CACzD;AAEhB,CAAC,CAAC;MAEWO,MAAM,gBAAGV,eAAe,CAAC,SAASU,MAAMA,CAAkBT,KAAyB,EAAEC,GAAyB;EACvH,MAAMS,mBAAmB,GAAGC,MAAM,CAACX,KAAK,CAACY,QAAQ,CAAC;;;EAGlD,MAAMC,GAAG,GAAGT,cAAK,CAACU,OAAO,CAAC,MAAMH,MAAM,CAAC,WAAW,GAAGD,mBAAmB,CAAC,EAAE,CAACA,mBAAmB,CAAC,CAAC;EACjG,oBAAON,6BAACN,UAAU,oBAAYE,KAAK;IAAEa,GAAG,EAAEA,GAAG;IAAEZ,GAAG,EAAEA;KAAO;AAC/D,CAAC;AAIDQ,MAAM,CAACf,MAAM,GAAGA,MAAM;AACtBe,MAAM,CAACb,KAAK,GAAGA,KAAK;;;;"}
1
+ {"version":3,"file":"Report.js","sources":["../../../../../../../src/components/Report/Report.tsx"],"sourcesContent":["import React from 'react';\nimport { fixedForwardRef } from '../../types';\nimport { useReport } from './useReport';\nimport { Table } from '../../primitives/Table/Core/Table';\nimport { ReportRef, ReportProps, ReportColumnProps, ReportGroupProps } from './types';\nimport { useTableSettingsPreloader } from '../../primitives/Table/useTableManager/useTableSettingsPreloader';\nimport { Spinner } from '../Spinner/Spinner';\n\nconst Column: React.FC<ReportColumnProps<unknown>> & {\n <TType = unknown>(_: ReportColumnProps<TType>): null;\n} = () => null;\n\nColumn.displayName = 'Table3Column';\n\nfunction Group(_: ReportGroupProps) {\n return null;\n}\n\nconst BaseReport = fixedForwardRef(function BaseReport<TType = unknown>(props: ReportProps<TType>, ref: React.Ref<ReportRef>) {\n const report = useReport<TType>(props, ref);\n\n return (\n <Table>\n <Table.Toolbar<TType> table={report} />\n <Table.Grid<TType> data-taco=\"table-report\" table={report} />\n </Table>\n );\n});\n\nexport const Report = fixedForwardRef(function Report<TType = unknown>(props: ReportProps<TType>, ref: React.Ref<ReportRef>) {\n const stringifiedChildren = String(props.children);\n // we force a remount (using key) when the child columns change because there are too many places to add children as an effect\n // this is cheaper from a complexity perspective, and probably performance wise as well\n const key = React.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);\n const { loading } = useTableSettingsPreloader(props.id);\n\n if (loading) {\n return <Spinner />;\n }\n\n return <BaseReport<TType> {...props} key={key} ref={ref} />;\n}) as (<TType = unknown>(props: ReportProps<TType> & React.RefAttributes<ReportRef>) => JSX.Element) & {\n Column: typeof Column;\n Group: typeof Group;\n};\nReport.Column = Column;\nReport.Group = Group;\n\nexport type { ReportRef, ReportProps, ReportColumnProps, ReportGroupProps } from './types';\n"],"names":["Column","displayName","Group","_","BaseReport","fixedForwardRef","props","ref","report","useReport","React","Table","Toolbar","table","Grid","Report","stringifiedChildren","String","children","key","useMemo","loading","useTableSettingsPreloader","id","Spinner"],"mappings":";;;;;;;AAQA,MAAMA,MAAM,GAERA,MAAM,IAAI;AAEdA,MAAM,CAACC,WAAW,GAAG,cAAc;AAEnC,SAASC,KAAKA,CAACC,CAAmB;EAC9B,OAAO,IAAI;AACf;AAEA,MAAMC,UAAU,gBAAGC,eAAe,CAAC,SAASD,UAAUA,CAAkBE,KAAyB,EAAEC,GAAyB;EACxH,MAAMC,MAAM,GAAGC,SAAS,CAAQH,KAAK,EAAEC,GAAG,CAAC;EAE3C,oBACIG,6BAACC,KAAK,qBACFD,6BAACC,KAAK,CAACC,OAAO;IAAQC,KAAK,EAAEL;IAAU,eACvCE,6BAACC,KAAK,CAACG,IAAI;iBAAkB,cAAc;IAACD,KAAK,EAAEL;IAAU,CACzD;AAEhB,CAAC,CAAC;MAEWO,MAAM,gBAAGV,eAAe,CAAC,SAASU,MAAMA,CAAkBT,KAAyB,EAAEC,GAAyB;EACvH,MAAMS,mBAAmB,GAAGC,MAAM,CAACX,KAAK,CAACY,QAAQ,CAAC;;;EAGlD,MAAMC,GAAG,GAAGT,cAAK,CAACU,OAAO,CAAC,MAAMH,MAAM,CAAC,WAAW,GAAGD,mBAAmB,CAAC,EAAE,CAACA,mBAAmB,CAAC,CAAC;EACjG,MAAM;IAAEK;GAAS,GAAGC,yBAAyB,CAAChB,KAAK,CAACiB,EAAE,CAAC;EAEvD,IAAIF,OAAO,EAAE;IACT,oBAAOX,6BAACc,OAAO,OAAG;;EAGtB,oBAAOd,6BAACN,UAAU,oBAAYE,KAAK;IAAEa,GAAG,EAAEA,GAAG;IAAEZ,GAAG,EAAEA;KAAO;AAC/D,CAAC;AAIDQ,MAAM,CAACf,MAAM,GAAGA,MAAM;AACtBe,MAAM,CAACb,KAAK,GAAGA,KAAK;;;;"}
@@ -1,6 +1,8 @@
1
1
  import React__default from 'react';
2
+ import { Spinner } from '../Spinner/Spinner.js';
2
3
  import { fixedForwardRef } from '../../types.js';
3
4
  import { Table } from '../../primitives/Table/Core/Table.js';
5
+ import { useTableSettingsPreloader } from '../../primitives/Table/useTableManager/useTableSettingsPreloader.js';
4
6
  import { isTableScrolled } from './util/editing.js';
5
7
  import { useTable3 } from './useTable3.js';
6
8
  import { Alert } from './components/Editing/Alert.js';
@@ -67,6 +69,12 @@ const Table3 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
67
69
  // we force a remount (using key) when the child columns change because there are too many places to add children as an effect
68
70
  // this is cheaper from a complexity perspective, and probably performance wise as well
69
71
  const key = React__default.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);
72
+ const {
73
+ loading
74
+ } = useTableSettingsPreloader(props.id);
75
+ if (loading) {
76
+ return /*#__PURE__*/React__default.createElement(Spinner, null);
77
+ }
70
78
  return /*#__PURE__*/React__default.createElement(BaseTable3, Object.assign({}, props, {
71
79
  key: key,
72
80
  ref: ref
@@ -1 +1 @@
1
- {"version":3,"file":"Table3.js","sources":["../../../../../../../src/components/Table3/Table3.tsx"],"sourcesContent":["import React from 'react';\nimport { fixedForwardRef } from '../../types';\nimport { useTable3 } from './useTable3';\nimport { Table } from '../../primitives/Table/Core/Table';\nimport { Alert } from './components/Editing/Alert';\nimport { Table3Props, Table3Ref, Table3ColumnProps, Table3GroupProps } from './types';\nimport { Editing } from './components/Toolbar/Editing/Editing';\nimport { CreateNewRow } from './components/Row/Editing/CreateNewRow';\nimport { TemporaryRow } from './components/Row/Editing/TemporaryRow';\nimport './style.css';\nimport { isTableScrolled } from './util/editing';\n\nconst Column: React.FC<Table3ColumnProps<unknown>> & {\n <TType = unknown>(_: Table3ColumnProps<TType>): null;\n} = () => null;\n\nColumn.displayName = 'Table3Column';\n\nfunction Group(_: Table3GroupProps) {\n return null;\n}\nGroup.displayName = 'Table3Group';\n\nconst BaseTable3 = fixedForwardRef(function BaseTable3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const table3 = useTable3<TType>(props, ref);\n\n const gridAttributes = {\n 'data-table-editing-mode': table3.meta.editing?.isEditing\n ? table3.meta.editing?.isDetailedMode\n ? 'detailed'\n : 'normal'\n : undefined,\n enableHorizontalArrowKeyNavigation: table3.meta.editing.isEditing,\n };\n\n const rowsById = table3.instance.getCoreRowModel().rowsById;\n const hasAlertErrors = table3.meta.editing.getErrorsShownInAlert().filter(row => {\n if (table3.meta.server._experimentalDataLoader2) {\n // consumers of dataloader2 need to run a cleanup function, as this would otherwise return false when pages are unloaded.\n return true;\n }\n\n return rowsById[row.rowId];\n }).length;\n\n const hasCreateWorkflow = table3.meta.editing.isEnabled && props.onEditingCreate;\n const isScrolled = isTableScrolled(table3.ref);\n\n let createWorkflow;\n\n if (hasCreateWorkflow) {\n createWorkflow = (\n <CreateNewRow\n buttonRef={table3.meta.editing.createRowButtonRef}\n isScrolled={isScrolled}\n table={table3.instance}\n tableMeta={table3.meta}\n />\n );\n }\n\n return (\n <Table>\n <Table.Toolbar<TType> table={table3}>\n {table3.meta.editing.isEnabled ? (\n <Editing scrollToIndex={table3.renderer.scrollToIndex} table={table3.instance} />\n ) : null}\n </Table.Toolbar>\n {hasAlertErrors ? (\n <Alert\n className=\"mb-4\"\n scrollToIndex={table3.renderer.scrollToIndex}\n table={table3.instance}\n tableRef={table3.ref}\n />\n ) : null}\n <Table.Grid<TType>\n {...gridAttributes}\n data-taco=\"table3\"\n footerRows={hasCreateWorkflow && isScrolled ? createWorkflow : undefined}\n table={table3}>\n {hasCreateWorkflow ? (\n <>\n <TemporaryRow\n createRowButtonRef={table3.meta.editing.createRowButtonRef}\n isScrolled={isScrolled}\n table={table3.instance}\n tableMeta={table3.meta}\n tableRef={table3.ref}\n />\n {!isScrolled ? createWorkflow : null}\n </>\n ) : null}\n </Table.Grid>\n </Table>\n );\n});\n\nexport const Table3 = fixedForwardRef(function Table3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const stringifiedChildren = String(props.children);\n // we force a remount (using key) when the child columns change because there are too many places to add children as an effect\n // this is cheaper from a complexity perspective, and probably performance wise as well\n const key = React.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);\n return <BaseTable3<TType> {...props} key={key} ref={ref} />;\n}) as (<TType = unknown>(props: Table3Props<TType> & React.RefAttributes<Table3Ref>) => JSX.Element) & {\n Column: typeof Column;\n Group: typeof Group;\n};\nTable3.Column = Column;\nTable3.Group = Group;\n\nexport type {\n Table3Ref,\n Table3Props,\n Table3ColumnProps,\n Table3GroupProps,\n Table3EditingSaveHandler,\n Table3EditingValidatorFn,\n Table3Texts,\n Table3FeatureProps,\n Table3CommonProps,\n Table3WithoutEditingWithClientProps,\n Table3WithoutEditingWithServerProps,\n Table3WithEditingProps,\n Table3WithEditingWithClientProps,\n Table3WithEditingWithServerProps,\n Table3EditingChangeHandler,\n Table3EditingCreateHandler,\n} from './types';\n"],"names":["Column","displayName","Group","_","BaseTable3","fixedForwardRef","props","ref","table3","useTable3","gridAttributes","_table3$meta$editing","meta","editing","isEditing","_table3$meta$editing2","isDetailedMode","undefined","enableHorizontalArrowKeyNavigation","rowsById","instance","getCoreRowModel","hasAlertErrors","getErrorsShownInAlert","filter","row","server","_experimentalDataLoader2","rowId","length","hasCreateWorkflow","isEnabled","onEditingCreate","isScrolled","isTableScrolled","createWorkflow","React","CreateNewRow","buttonRef","createRowButtonRef","table","tableMeta","Table","Toolbar","Editing","scrollToIndex","renderer","Alert","className","tableRef","Grid","footerRows","TemporaryRow","Table3","stringifiedChildren","String","children","key","useMemo"],"mappings":";;;;;;;;;;AAYA,MAAMA,MAAM,GAERA,MAAM,IAAI;AAEdA,MAAM,CAACC,WAAW,GAAG,cAAc;AAEnC,SAASC,KAAKA,CAACC,CAAmB;EAC9B,OAAO,IAAI;AACf;AACAD,KAAK,CAACD,WAAW,GAAG,aAAa;AAEjC,MAAMG,UAAU,gBAAGC,eAAe,CAAC,SAASD,UAAUA,CAAkBE,KAAyB,EAAEC,GAAyB;;EACxH,MAAMC,MAAM,GAAGC,SAAS,CAAQH,KAAK,EAAEC,GAAG,CAAC;EAE3C,MAAMG,cAAc,GAAG;IACnB,yBAAyB,EAAE,CAAAC,oBAAA,GAAAH,MAAM,CAACI,IAAI,CAACC,OAAO,cAAAF,oBAAA,eAAnBA,oBAAA,CAAqBG,SAAS,GACnD,CAAAC,qBAAA,GAAAP,MAAM,CAACI,IAAI,CAACC,OAAO,cAAAE,qBAAA,eAAnBA,qBAAA,CAAqBC,cAAc,GAC/B,UAAU,GACV,QAAQ,GACZC,SAAS;IACfC,kCAAkC,EAAEV,MAAM,CAACI,IAAI,CAACC,OAAO,CAACC;GAC3D;EAED,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,eACR6B,6BAACM,KAAK,CAACQ,IAAI,oBACHxC,cAAc;iBACR,QAAQ;IAClByC,UAAU,EAAErB,iBAAiB,IAAIG,UAAU,GAAGE,cAAc,GAAGlB,SAAS;IACxEuB,KAAK,EAAEhC;MACNsB,iBAAiB,iBACdM,yEACIA,6BAACgB,YAAY;IACTb,kBAAkB,EAAE/B,MAAM,CAACI,IAAI,CAACC,OAAO,CAAC0B,kBAAkB;IAC1DN,UAAU,EAAEA,UAAU;IACtBO,KAAK,EAAEhC,MAAM,CAACY,QAAQ;IACtBqB,SAAS,EAAEjC,MAAM,CAACI,IAAI;IACtBqC,QAAQ,EAAEzC,MAAM,CAACD;IACnB,EACD,CAAC0B,UAAU,GAAGE,cAAc,GAAG,IAAI,CACrC,IACH,IAAI,CACC,CACT;AAEhB,CAAC,CAAC;MAEWkB,MAAM,gBAAGhD,eAAe,CAAC,SAASgD,MAAMA,CAAkB/C,KAAyB,EAAEC,GAAyB;EACvH,MAAM+C,mBAAmB,GAAGC,MAAM,CAACjD,KAAK,CAACkD,QAAQ,CAAC;;;EAGlD,MAAMC,GAAG,GAAGrB,cAAK,CAACsB,OAAO,CAAC,MAAMH,MAAM,CAAC,WAAW,GAAGD,mBAAmB,CAAC,EAAE,CAACA,mBAAmB,CAAC,CAAC;EACjG,oBAAOlB,6BAAChC,UAAU,oBAAYE,KAAK;IAAEmD,GAAG,EAAEA,GAAG;IAAElD,GAAG,EAAEA;KAAO;AAC/D,CAAC;AAID8C,MAAM,CAACrD,MAAM,GAAGA,MAAM;AACtBqD,MAAM,CAACnD,KAAK,GAAGA,KAAK;;;;"}
1
+ {"version":3,"file":"Table3.js","sources":["../../../../../../../src/components/Table3/Table3.tsx"],"sourcesContent":["import React from 'react';\nimport { fixedForwardRef } from '../../types';\nimport { useTable3 } from './useTable3';\nimport { Table } from '../../primitives/Table/Core/Table';\nimport { Alert } from './components/Editing/Alert';\nimport { Table3Props, Table3Ref, Table3ColumnProps, Table3GroupProps } from './types';\nimport { Editing } from './components/Toolbar/Editing/Editing';\nimport { CreateNewRow } from './components/Row/Editing/CreateNewRow';\nimport { TemporaryRow } from './components/Row/Editing/TemporaryRow';\nimport './style.css';\nimport { isTableScrolled } from './util/editing';\nimport { useTableSettingsPreloader } from '../../primitives/Table/useTableManager/useTableSettingsPreloader';\nimport { Spinner } from '../Spinner/Spinner';\n\nconst Column: React.FC<Table3ColumnProps<unknown>> & {\n <TType = unknown>(_: Table3ColumnProps<TType>): null;\n} = () => null;\n\nColumn.displayName = 'Table3Column';\n\nfunction Group(_: Table3GroupProps) {\n return null;\n}\nGroup.displayName = 'Table3Group';\n\nconst BaseTable3 = fixedForwardRef(function BaseTable3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const table3 = useTable3<TType>(props, ref);\n\n const gridAttributes = {\n 'data-table-editing-mode': table3.meta.editing?.isEditing\n ? table3.meta.editing?.isDetailedMode\n ? 'detailed'\n : 'normal'\n : undefined,\n enableHorizontalArrowKeyNavigation: table3.meta.editing.isEditing,\n };\n\n const rowsById = table3.instance.getCoreRowModel().rowsById;\n const hasAlertErrors = table3.meta.editing.getErrorsShownInAlert().filter(row => {\n if (table3.meta.server._experimentalDataLoader2) {\n // consumers of dataloader2 need to run a cleanup function, as this would otherwise return false when pages are unloaded.\n return true;\n }\n\n return rowsById[row.rowId];\n }).length;\n\n const hasCreateWorkflow = table3.meta.editing.isEnabled && props.onEditingCreate;\n const isScrolled = isTableScrolled(table3.ref);\n\n let createWorkflow;\n\n if (hasCreateWorkflow) {\n createWorkflow = (\n <CreateNewRow\n buttonRef={table3.meta.editing.createRowButtonRef}\n isScrolled={isScrolled}\n table={table3.instance}\n tableMeta={table3.meta}\n />\n );\n }\n\n return (\n <Table>\n <Table.Toolbar<TType> table={table3}>\n {table3.meta.editing.isEnabled ? (\n <Editing scrollToIndex={table3.renderer.scrollToIndex} table={table3.instance} />\n ) : null}\n </Table.Toolbar>\n {hasAlertErrors ? (\n <Alert\n className=\"mb-4\"\n scrollToIndex={table3.renderer.scrollToIndex}\n table={table3.instance}\n tableRef={table3.ref}\n />\n ) : null}\n <Table.Grid<TType>\n {...gridAttributes}\n data-taco=\"table3\"\n footerRows={hasCreateWorkflow && isScrolled ? createWorkflow : undefined}\n table={table3}>\n {hasCreateWorkflow ? (\n <>\n <TemporaryRow\n createRowButtonRef={table3.meta.editing.createRowButtonRef}\n isScrolled={isScrolled}\n table={table3.instance}\n tableMeta={table3.meta}\n tableRef={table3.ref}\n />\n {!isScrolled ? createWorkflow : null}\n </>\n ) : null}\n </Table.Grid>\n </Table>\n );\n});\n\nexport const Table3 = fixedForwardRef(function Table3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const stringifiedChildren = String(props.children);\n // we force a remount (using key) when the child columns change because there are too many places to add children as an effect\n // this is cheaper from a complexity perspective, and probably performance wise as well\n const key = React.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);\n const { loading } = useTableSettingsPreloader(props.id);\n\n if (loading) {\n return <Spinner />;\n }\n\n return <BaseTable3<TType> {...props} key={key} ref={ref} />;\n}) as (<TType = unknown>(props: Table3Props<TType> & React.RefAttributes<Table3Ref>) => JSX.Element) & {\n Column: typeof Column;\n Group: typeof Group;\n};\nTable3.Column = Column;\nTable3.Group = Group;\n\nexport type {\n Table3Ref,\n Table3Props,\n Table3ColumnProps,\n Table3GroupProps,\n Table3EditingSaveHandler,\n Table3EditingValidatorFn,\n Table3Texts,\n Table3FeatureProps,\n Table3CommonProps,\n Table3WithoutEditingWithClientProps,\n Table3WithoutEditingWithServerProps,\n Table3WithEditingProps,\n Table3WithEditingWithClientProps,\n Table3WithEditingWithServerProps,\n Table3EditingChangeHandler,\n Table3EditingCreateHandler,\n} from './types';\n"],"names":["Column","displayName","Group","_","BaseTable3","fixedForwardRef","props","ref","table3","useTable3","gridAttributes","_table3$meta$editing","meta","editing","isEditing","_table3$meta$editing2","isDetailedMode","undefined","enableHorizontalArrowKeyNavigation","rowsById","instance","getCoreRowModel","hasAlertErrors","getErrorsShownInAlert","filter","row","server","_experimentalDataLoader2","rowId","length","hasCreateWorkflow","isEnabled","onEditingCreate","isScrolled","isTableScrolled","createWorkflow","React","CreateNewRow","buttonRef","createRowButtonRef","table","tableMeta","Table","Toolbar","Editing","scrollToIndex","renderer","Alert","className","tableRef","Grid","footerRows","TemporaryRow","Table3","stringifiedChildren","String","children","key","useMemo","loading","useTableSettingsPreloader","id","Spinner"],"mappings":";;;;;;;;;;;;AAcA,MAAMA,MAAM,GAERA,MAAM,IAAI;AAEdA,MAAM,CAACC,WAAW,GAAG,cAAc;AAEnC,SAASC,KAAKA,CAACC,CAAmB;EAC9B,OAAO,IAAI;AACf;AACAD,KAAK,CAACD,WAAW,GAAG,aAAa;AAEjC,MAAMG,UAAU,gBAAGC,eAAe,CAAC,SAASD,UAAUA,CAAkBE,KAAyB,EAAEC,GAAyB;;EACxH,MAAMC,MAAM,GAAGC,SAAS,CAAQH,KAAK,EAAEC,GAAG,CAAC;EAE3C,MAAMG,cAAc,GAAG;IACnB,yBAAyB,EAAE,CAAAC,oBAAA,GAAAH,MAAM,CAACI,IAAI,CAACC,OAAO,cAAAF,oBAAA,eAAnBA,oBAAA,CAAqBG,SAAS,GACnD,CAAAC,qBAAA,GAAAP,MAAM,CAACI,IAAI,CAACC,OAAO,cAAAE,qBAAA,eAAnBA,qBAAA,CAAqBC,cAAc,GAC/B,UAAU,GACV,QAAQ,GACZC,SAAS;IACfC,kCAAkC,EAAEV,MAAM,CAACI,IAAI,CAACC,OAAO,CAACC;GAC3D;EAED,MAAMK,QAAQ,GAAGX,MAAM,CAACY,QAAQ,CAACC,eAAe,EAAE,CAACF,QAAQ;EAC3D,MAAMG,cAAc,GAAGd,MAAM,CAACI,IAAI,CAACC,OAAO,CAACU,qBAAqB,EAAE,CAACC,MAAM,CAACC,GAAG;IACzE,IAAIjB,MAAM,CAACI,IAAI,CAACc,MAAM,CAACC,wBAAwB,EAAE;;MAE7C,OA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O,CAAC0B,kBAAkB;IAC1DN,UAAU,EAAEA,UAAU;IACtBO,KAAK,EAAEhC,MAAM,CAACY,QAAQ;IACtBqB,SAAS,EAAEjC,MAAM,CAACI,IAAI;IACtBqC,QAAQ,EAAEzC,MAAM,CAACD;IACnB,EACD,CAAC0B,UAAU,GAAGE,cAAc,GAAG,IAAI,CACrC,IACH,IAAI,CACC,CACT;AAEhB,CAAC,CAAC;MAEWkB,MAAM,gBAAGhD,eAAe,CAAC,SAASgD,MAAMA,CAAkB/C,KAAyB,EAAEC,GAAyB;EACvH,MAAM+C,mBAAmB,GAAGC,MAAM,CAACjD,KAAK,CAACkD,QAAQ,CAAC;;;EAGlD,MAAMC,GAAG,GAAGrB,cAAK,CAACsB,OAAO,CAAC,MAAMH,MAAM,CAAC,WAAW,GAAGD,mBAAmB,CAAC,EAAE,CAACA,mBAAmB,CAAC,CAAC;EACjG,MAAM;IAAEK;GAAS,GAAGC,yBAAyB,CAACtD,KAAK,CAACuD,EAAE,CAAC;EAEvD,IAAIF,OAAO,EAAE;IACT,oBAAOvB,6BAAC0B,OAAO,OAAG;;EAGtB,oBAAO1B,6BAAChC,UAAU,oBAAYE,KAAK;IAAEmD,GAAG,EAAEA,GAAG;IAAElD,GAAG,EAAEA;KAAO;AAC/D,CAAC;AAID8C,MAAM,CAACrD,MAAM,GAAGA,MAAM;AACtBqD,MAAM,CAACnD,KAAK,GAAGA,KAAK;;;;"}
@@ -0,0 +1,9 @@
1
+ import React__default from 'react';
2
+ import { TacoContext } from '../components/Provider/TacoContext.js';
3
+
4
+ function useTaco() {
5
+ return React__default.useContext(TacoContext);
6
+ }
7
+
8
+ export { useTaco };
9
+ //# sourceMappingURL=useTaco.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTaco.js","sources":["../../../../../../src/hooks/useTaco.ts"],"sourcesContent":["import React from 'react';\nimport { TacoContext } from '../components/Provider/TacoContext';\n\nexport function useTaco() {\n return React.useContext(TacoContext);\n}\n"],"names":["useTaco","React","useContext","TacoContext"],"mappings":";;;SAGgBA,OAAOA;EACnB,OAAOC,cAAK,CAACC,UAAU,CAACC,WAAW,CAAC;AACxC;;;;"}
@@ -51,7 +51,7 @@ export { usePagination } from './components/Pagination/usePagination.js';
51
51
  export { Pagination } from './components/Pagination/Pagination.js';
52
52
  export { Progress } from './components/Progress/Progress.js';
53
53
  export { ToastProvider, useToast } from './components/Toast/Toaster.js';
54
- export { Provider, TacoContext } from './components/Provider/Provider.js';
54
+ export { Provider } from './components/Provider/Provider.js';
55
55
  export { FontSizes, fixedForwardRef } from './types.js';
56
56
  export { TableFilterComparator } from './primitives/Table/types.js';
57
57
  export { DEFAULT_PAGE_SIZE, useTableDataLoader } from './primitives/Table/useTableDataLoader.js';
@@ -1,5 +1,6 @@
1
1
  import React__default from 'react';
2
2
  import { Group } from '../../../../../components/Group/Group.js';
3
+ import { getSettings } from '../../../useTableManager/util/settings.js';
3
4
  import { Search } from './components/Search/Search.js';
4
5
  import { Settings } from './components/Settings/Settings.js';
5
6
  import { Print } from './components/Print/Print.js';
@@ -18,15 +19,16 @@ function TableToolbar(props) {
18
19
  const canPrint = table.meta.printing.isEnabled;
19
20
  const canSettings = canChangeSettings(table.instance, table.props.customSettings);
20
21
  const canSearch = table.meta.search.isEnabled;
22
+ const settings = getSettings(table.instance);
21
23
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", Object.assign({}, attributes, {
22
24
  className: "mb-4 flex flex-shrink flex-grow-0 flex-wrap gap-2 print:hidden",
23
25
  "data-taco": "table-toolbar"
24
- }), table.props.toolbarLeft, /*#__PURE__*/React__default.createElement(Group, {
26
+ }), typeof table.props.toolbarLeft === 'function' ? table.props.toolbarLeft(settings) : table.props.toolbarLeft, /*#__PURE__*/React__default.createElement(Group, {
25
27
  className: "ml-auto flex-shrink-0 items-center print:hidden"
26
28
  }, customTools, canFilter ? /*#__PURE__*/React__default.createElement(Filters, {
27
29
  length: table.meta.length,
28
30
  table: table.instance
29
- }) : null, table.props.toolbarRight, canPrint ? /*#__PURE__*/React__default.createElement(Print, {
31
+ }) : null, typeof table.props.toolbarRight === 'function' ? table.props.toolbarRight(settings) : table.props.toolbarRight, canPrint ? /*#__PURE__*/React__default.createElement(Print, {
30
32
  table: table.instance,
31
33
  tableId: table.id,
32
34
  tableRef: table.ref
@@ -37,9 +39,9 @@ function TableToolbar(props) {
37
39
  scrollToIndex: table.renderer.scrollToIndex,
38
40
  table: table.instance,
39
41
  tableRef: table.ref
40
- })) : null)), table.props.toolbarPanel ? /*#__PURE__*/React__default.createElement("div", {
42
+ })) : null)), table.props.toolbarPanel ? (/*#__PURE__*/React__default.createElement("div", {
41
43
  className: "mb-4"
42
- }, table.props.toolbarPanel) : undefined);
44
+ }, typeof table.props.toolbarPanel === 'function' ? table.props.toolbarPanel(settings) : table.props.toolbarPanel)) : undefined);
43
45
  }
44
46
  function canChangeSettings(table, customSettings) {
45
47
  const tableMeta = table.options.meta;
@@ -1 +1 @@
1
- {"version":3,"file":"Toolbar.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Toolbar/Toolbar.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { Group } from '../../../../../components/Group/Group';\nimport { Search } from './components/Search/Search';\nimport { Settings } from './components/Settings/Settings';\nimport { Print } from './components/Print/Print';\nimport { Filters } from './components/Filters/Filters';\nimport { TableCustomSettingsRenderer } from '../../../types';\nimport { useTableReturnValue } from '../../useTable';\n\nexport type TableToolbarProps<TType = unknown> = React.HTMLAttributes<HTMLDivElement> & {\n children?: JSX.Element | null;\n table: useTableReturnValue<TType>;\n};\n\nexport function TableToolbar<TType = unknown>(props: TableToolbarProps<TType>) {\n const { children: customTools, table, ...attributes } = props;\n\n if (!isToolbarVisible<TType>(table, !!customTools)) {\n return null;\n }\n\n const canFilter = table.instance.options.enableColumnFilters;\n const canPrint = table.meta.printing.isEnabled;\n const canSettings = canChangeSettings(table.instance, table.props.customSettings);\n const canSearch = table.meta.search.isEnabled;\n\n return (\n <>\n <div\n {...attributes}\n className=\"mb-4 flex flex-shrink flex-grow-0 flex-wrap gap-2 print:hidden\"\n data-taco=\"table-toolbar\">\n {table.props.toolbarLeft}\n <Group className=\"ml-auto flex-shrink-0 items-center print:hidden\">\n {customTools}\n {canFilter ? <Filters length={table.meta.length} table={table.instance} /> : null}\n {table.props.toolbarRight}\n {canPrint ? <Print table={table.instance} tableId={table.id} tableRef={table.ref} /> : null}\n {canSettings ? <Settings customSettings={table.props.customSettings} table={table.instance} /> : null}\n {canSearch ? (\n <Search scrollToIndex={table.renderer.scrollToIndex} table={table.instance} tableRef={table.ref} />\n ) : null}\n </Group>\n </div>\n {table.props.toolbarPanel ? <div className=\"mb-4\">{table.props.toolbarPanel}</div> : undefined}\n </>\n );\n}\n\nfunction canChangeSettings<TType = unknown>(table: ReactTable<TType>, customSettings?: TableCustomSettingsRenderer) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n return (\n table.options.enableHiding ||\n tableMeta.columnOrdering.isEnabled ||\n tableMeta.fontSize.isEnabled ||\n tableMeta.rowHeight.isEnabled ||\n typeof customSettings === 'function'\n );\n}\n\nfunction isToolbarVisible<TType = unknown>(table: useTableReturnValue<TType>, customTools: boolean) {\n const hasInternalToolbar =\n customTools ||\n table.instance.options.enableColumnFilters ||\n table.meta.printing.isEnabled ||\n canChangeSettings(table.instance, table.props.customSettings) ||\n table.meta.search.isEnabled;\n\n return hasInternalToolbar || !!table.props.toolbarLeft || !!table.props.toolbarRight;\n}\n"],"names":["TableToolbar","props","children","customTools","table","attributes","isToolbarVisible","canFilter","instance","options","enableColumnFilters","canPrint","meta","printing","isEnabled","canSettings","canChangeSettings","customSettings","canSearch","search","React","className","toolbarLeft","Group","Filters","length","toolbarRight","Print","tableId","id","tableRef","ref","Settings","Search","scrollToIndex","renderer","toolbarPanel","undefined","tableMeta","enableHiding","columnOrdering","fontSize","rowHeight","has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ACa,MAAM;IAACC,aAAa,EAAE9B,KAAK,CAAC+B,QAAQ,CAACD,aAAa;IAAE9B,KAAK,EAAEA,KAAK,CAACI,QAAQ;IAAEsB,QAAQ,EAAE1B,KAAK,CAAC2B;IAAO,IACnG,IAAI,CACJ,CACN,EACL3B,KAAK,CAACH,KAAK,CAACmC,YAAY,gBAAGhB;IAAKC,SAAS,EAAC;KAAQjB,KAAK,CAACH,KAAK,CAACmC,YAAY,CAAO,GAAGC,SAAS,CAC/F;AAEX;AAEA,SAASrB,iBAAiBA,CAAkBZ,KAAwB,EAAEa,cAA4C;EAC9G,MAAMqB,SAAS,GAAGlC,KAAK,CAACK,OAAO,CAACG,IAA6B;EAE7D,OACIR,KAAK,CAACK,OAAO,CAAC8B,YAAY,IAC1BD,SAAS,CAACE,cAAc,CAAC1B,SAAS,IAClCwB,SAAS,CAACG,QAAQ,CAAC3B,SAAS,IAC5BwB,SAAS,CAACI,SAAS,CAAC5B,SAAS,IAC7B,OAAOG,cAAc,KAAK,UAAU;AAE5C;AAEA,SAASX,gBAAgBA,CAAkBF,KAAiC,EAAED,WAAoB;EAC9F,MAAMwC,kBAAkB,GACpBxC,WAAW,IACXC,KAAK,CAACI,QAAQ,CAACC,OAAO,CAACC,mBAAmB,IAC1CN,KAAK,CAACQ,IAAI,CAACC,QAAQ,CAACC,SAAS,IAC7BE,iBAAiB,CAACZ,KAAK,CAACI,QAAQ,EAAEJ,KAAK,CAACH,KAAK,CAACgB,cAAc,CAAC,IAC7Db,KAAK,CAACQ,IAAI,CAACO,MAAM,CAACL,SAAS;EAE/B,OAAO6B,kBAAkB,IAAI,CAAC,CAACvC,KAAK,CAACH,KAAK,CAACqB,WAAW,IAAI,CAAC,CAAClB,KAAK,CAACH,KAAK,CAACyB,YAAY;AACxF;;;;"}
1
+ {"version":3,"file":"Toolbar.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Toolbar/Toolbar.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { Group } from '../../../../../components/Group/Group';\nimport { Search } from './components/Search/Search';\nimport { Settings } from './components/Settings/Settings';\nimport { Print } from './components/Print/Print';\nimport { Filters } from './components/Filters/Filters';\nimport { TableCustomSettingsRenderer } from '../../../types';\nimport { useTableReturnValue } from '../../useTable';\nimport { getSettings } from '../../../useTableManager/util/settings';\n\nexport type TableToolbarProps<TType = unknown> = React.HTMLAttributes<HTMLDivElement> & {\n children?: JSX.Element | null;\n table: useTableReturnValue<TType>;\n};\n\nexport function TableToolbar<TType = unknown>(props: TableToolbarProps<TType>) {\n const { children: customTools, table, ...attributes } = props;\n\n if (!isToolbarVisible<TType>(table, !!customTools)) {\n return null;\n }\n\n const canFilter = table.instance.options.enableColumnFilters;\n const canPrint = table.meta.printing.isEnabled;\n const canSettings = canChangeSettings(table.instance, table.props.customSettings);\n const canSearch = table.meta.search.isEnabled;\n\n const settings = getSettings(table.instance);\n\n return (\n <>\n <div\n {...attributes}\n className=\"mb-4 flex flex-shrink flex-grow-0 flex-wrap gap-2 print:hidden\"\n data-taco=\"table-toolbar\">\n {typeof table.props.toolbarLeft === 'function' ? table.props.toolbarLeft(settings) : table.props.toolbarLeft}\n <Group className=\"ml-auto flex-shrink-0 items-center print:hidden\">\n {customTools}\n {canFilter ? <Filters length={table.meta.length} table={table.instance} /> : null}\n {typeof table.props.toolbarRight === 'function'\n ? table.props.toolbarRight(settings)\n : table.props.toolbarRight}\n {canPrint ? <Print table={table.instance} tableId={table.id} tableRef={table.ref} /> : null}\n {canSettings ? <Settings customSettings={table.props.customSettings} table={table.instance} /> : null}\n {canSearch ? (\n <Search scrollToIndex={table.renderer.scrollToIndex} table={table.instance} tableRef={table.ref} />\n ) : null}\n </Group>\n </div>\n {table.props.toolbarPanel ? (\n <div className=\"mb-4\">\n {typeof table.props.toolbarPanel === 'function'\n ? table.props.toolbarPanel(settings)\n : table.props.toolbarPanel}\n </div>\n ) : undefined}\n </>\n );\n}\n\nfunction canChangeSettings<TType = unknown>(table: ReactTable<TType>, customSettings?: TableCustomSettingsRenderer) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n return (\n table.options.enableHiding ||\n tableMeta.columnOrdering.isEnabled ||\n tableMeta.fontSize.isEnabled ||\n tableMeta.rowHeight.isEnabled ||\n typeof customSettings === 'function'\n );\n}\n\nfunction isToolbarVisible<TType = unknown>(table: useTableReturnValue<TType>, customTools: boolean) {\n const hasInternalToolbar =\n customTools ||\n table.instance.options.enableColumnFilters ||\n table.meta.printing.isEnabled ||\n canChangeSettings(table.instance, table.props.customSettings) ||\n table.meta.search.isEnabled;\n\n return hasInternalToolbar || !!table.props.toolbarLeft || !!table.props.toolbarRight;\n}\n"],"names":["TableToolbar","props","children","customTools","table","attributes","isToolbarVisible","canFilter","instance","options","enableColumnFilters","canPrint","meta","printing","isEnabled","canSettings","canChangeSettings","customSettings","canSearch","search","settings","getSettings","React","className","toolbarLeft","Group","Filters","length","toolbarRight","Print","tableId","id","tableRef","ref","Settings","Search","scrollToIndex","renderer","toolbarPanel","undefined","tableMeta","enableHiding","columnOrdering","fontSize","rowHeight","hasInternalToolbar"],"mappings":";;;;;;;;SAgBgBA,YAAYA,CAAkBC,KAA+B;EACzE,MAAM;IAAEC,QAAQ,EAAEC,WAAW;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGJ,KAAK;EAE7D,IAAI,CAACK,gBAAgB,CAAQF,KAAK,EAAE,CAAC,CAACD,WAAW,CAAC,EAAE;IAChD,OAAO,IAAI;;EAGf,MAAMI,SAAS,GAAGH,KAAK,CAACI,QAAQ,CAACC,OAAO,CAACC,mBAAmB;EAC5D,MAAMC,QAAQ,GAAGP,KAAK,CAACQ,IAAI,CAACC,QAAQ,CAACC,SAAS;EAC9C,MAAMC,WAAW,GAAGC,iBAAiB,CAACZ,KAAK,CAACI,QAAQ,EAAEJ,KAAK,CAACH,KAAK,CAACgB,cAAc,CAAC;EACjF,MAAMC,SAAS,GAAGd,KA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AY,iBACrBhB;IAAKC,SAAS,EAAC;KACV,OAAOnB,KAAK,CAACH,KAAK,CAACqC,YAAY,KAAK,UAAU,GACzClC,KAAK,CAACH,KAAK,CAACqC,YAAY,CAAClB,QAAQ,CAAC,GAClChB,KAAK,CAACH,KAAK,CAACqC,YAAY,CAC5B,IACNC,SAAS,CACd;AAEX;AAEA,SAASvB,iBAAiBA,CAAkBZ,KAAwB,EAAEa,cAA4C;EAC9G,MAAMuB,SAAS,GAAGpC,KAAK,CAACK,OAAO,CAACG,IAA6B;EAE7D,OACIR,KAAK,CAACK,OAAO,CAACgC,YAAY,IAC1BD,SAAS,CAACE,cAAc,CAAC5B,SAAS,IAClC0B,SAAS,CAACG,QAAQ,CAAC7B,SAAS,IAC5B0B,SAAS,CAACI,SAAS,CAAC9B,SAAS,IAC7B,OAAOG,cAAc,KAAK,UAAU;AAE5C;AAEA,SAASX,gBAAgBA,CAAkBF,KAAiC,EAAED,WAAoB;EAC9F,MAAM0C,kBAAkB,GACpB1C,WAAW,IACXC,KAAK,CAACI,QAAQ,CAACC,OAAO,CAACC,mBAAmB,IAC1CN,KAAK,CAACQ,IAAI,CAACC,QAAQ,CAACC,SAAS,IAC7BE,iBAAiB,CAACZ,KAAK,CAACI,QAAQ,EAAEJ,KAAK,CAACH,KAAK,CAACgB,cAAc,CAAC,IAC7Db,KAAK,CAACQ,IAAI,CAACO,MAAM,CAACL,SAAS;EAE/B,OAAO+B,kBAAkB,IAAI,CAAC,CAACzC,KAAK,CAACH,KAAK,CAACuB,WAAW,IAAI,CAAC,CAACpB,KAAK,CAACH,KAAK,CAAC2B,YAAY;AACxF;;;;"}
@@ -1,4 +1,5 @@
1
1
  import React__default from 'react';
2
+ import { getSettings } from '../../useTableManager/util/settings.js';
2
3
  import { useVirtualizer, defaultRangeExtractor } from '@tanstack/react-virtual';
3
4
  import { ROW_HEIGHT_ESTIMATES } from '../util/rows.js';
4
5
  import { Row } from '../components/Row/Row.js';
@@ -84,11 +85,14 @@ function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIn
84
85
  const [paddingTop, paddingBottom] = virtualItems.length > 0 ? [Math.max(0, startValue !== null && startValue !== void 0 ? startValue : 0), Math.max(0, totalSize - ((_virtualItems$end = (_virtualItems = virtualItems[virtualItems.length - 1]) === null || _virtualItems === void 0 ? void 0 : _virtualItems.end) !== null && _virtualItems$end !== void 0 ? _virtualItems$end : 0))] : [0, 0];
85
86
  // ensure default active rows are scrolled to
86
87
  React__default.useEffect(() => {
87
- if (defaultRowActiveIndex) {
88
- scrollToIndex(defaultRowActiveIndex, {
89
- align: 'center',
90
- behavior: 'auto'
91
- });
88
+ if (defaultRowActiveIndex !== undefined) {
89
+ const index = typeof defaultRowActiveIndex === 'function' ? defaultRowActiveIndex(getSettings(table)) : defaultRowActiveIndex;
90
+ if (index !== undefined) {
91
+ scrollToIndex(index, {
92
+ align: 'center',
93
+ behavior: 'auto'
94
+ });
95
+ }
92
96
  }
93
97
  }, []);
94
98
  // rendered output
@@ -1 +1 @@
1
- {"version":3,"file":"useTableRenderer.js","sources":["../../../../../../../../../src/primitives/Table/Core/features/useTableRenderer.tsx"],"sourcesContent":["import React, { CSSProperties } from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta, Row as ReactTableRow } from '@tanstack/react-table';\nimport {\n useVirtualizer,\n defaultRangeExtractor,\n ScrollToOptions as ReactVirtualScrollToOptions,\n Range,\n} from '@tanstack/react-virtual';\nimport { ROW_HEIGHT_ESTIMATES } from '../util/rows';\nimport { Row } from '../components/Row/Row';\nimport { useTableRenderers, useTableRenderOptions } from '../types';\nimport { TableRef } from '../../types';\nimport { SkeletonRow } from '../components/Row/BuiltIns/SkeletonRow';\n\n// scroll padding end is designed to always show half of the next row\nfunction getScrollPaddingEndOffset<TType = unknown>(table: ReactTable<TType>) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n let offset = 2;\n\n if (tableMeta.footer.isEnabled) {\n offset += 1;\n }\n\n if (table.getHeaderGroups().length > 1) {\n offset += table.getHeaderGroups().length - 1;\n }\n\n let height = ROW_HEIGHT_ESTIMATES.medium * offset;\n\n const bottomRows = table.getBottomRows();\n\n if (bottomRows.length) {\n // 1.4 offsets for half rows and also accounts for increased row heights (which is likely in pinned rows)\n height += ROW_HEIGHT_ESTIMATES[tableMeta.rowHeight.height] * 1.4 * bottomRows.length;\n }\n\n return height;\n}\n\n// scroll padding end is designed to always show half of the next row\nfunction getPaddingEndOffset<TType = unknown>(table: ReactTable<TType>, options?: useTableRenderOptions) {\n const bottomRows = table.getBottomRows() ?? [];\n return ROW_HEIGHT_ESTIMATES.medium * (options?.virtualiserPaddingEndOffset ?? 1) * bottomRows.length;\n}\n\n// A higher number ensure less scroll jumping for dynamic row heights, but too high can reduce performance. 8 worked well\nconst OVERSCAN_ROW_COUNT = 8;\n\nexport function useTableRenderer<TType = unknown>(\n renderers: useTableRenderers<TType>,\n table: ReactTable<TType>,\n tableRef: React.RefObject<TableRef>,\n length: number,\n defaultRowActiveIndex?: number | undefined,\n options?: useTableRenderOptions\n) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const isTableRowGrouped = !!table.getState().grouping?.length;\n const rows = table.getCenterRows() ?? [];\n\n // row groups\n const rangeExtractor = useRowGroupVirtualisation<TType>(table);\n\n // account for thead and tfoot in the scroll area - both are always medium row height\n const scrollPaddingStart = ROW_HEIGHT_ESTIMATES.medium;\n\n const count = tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2 ? length : rows.length;\n\n const virtualiser = useVirtualizer({\n count,\n estimateSize: () => {\n return tableMeta.rowHeight.height ? ROW_HEIGHT_ESTIMATES[tableMeta.rowHeight.height] : ROW_HEIGHT_ESTIMATES.medium;\n },\n getScrollElement: () => tableRef.current,\n overscan: tableMeta.printing.isPrinting ? count : OVERSCAN_ROW_COUNT,\n rangeExtractor,\n // correctly sets the scroll padding offset, e.g. when keyboard navigating rows in the list\n scrollPaddingStart,\n scrollPaddingEnd: getScrollPaddingEndOffset(table),\n paddingEnd: getPaddingEndOffset(table, options),\n });\n\n React.useEffect(() => {\n virtualiser.measure();\n }, [table.getState().expanded]);\n\n const totalSize = virtualiser.getTotalSize();\n const virtualItems = virtualiser.getVirtualItems();\n\n const scrollToIndex = React.useCallback(\n (index: number, options: ReactVirtualScrollToOptions = { align: 'auto', behavior: 'smooth' }) => {\n const notSmooth: ReactVirtualScrollToOptions = { ...options, behavior: 'auto' };\n\n if (tableRef.current) {\n if (index === 0) {\n virtualiser.scrollToOffset(0, notSmooth);\n } else if (index === count - 1) {\n // sometimes the last row doesn't fully show, so we just force scroll to the bottom\n tableRef.current.scrollTop = tableRef.current.scrollHeight;\n } else {\n virtualiser.scrollToIndex(index, options);\n }\n }\n },\n [virtualItems.length, tableRef.current, totalSize, count]\n );\n\n // use row 1 not 0, because 0 might be sticky in grouped tables and it's start value will always be 0\n const paddingStartIndex = isTableRowGrouped && count > 1 ? 1 : 0;\n\n const startValue = isTableRowGrouped\n ? virtualItems[paddingStartIndex]?.start - virtualItems[paddingStartIndex]?.size\n : virtualItems[paddingStartIndex]?.start;\n\n // styling for offsetting rows - this \"is\" the virtualisation\n const [paddingTop, paddingBottom] =\n virtualItems.length > 0\n ? [Math.max(0, startValue ?? 0), Math.max(0, totalSize - (virtualItems[virtualItems.length - 1]?.end ?? 0))]\n : [0, 0];\n\n // ensure default active rows are scrolled to\n React.useEffect(() => {\n if (defaultRowActiveIndex) {\n scrollToIndex(defaultRowActiveIndex, { align: 'center', behavior: 'auto' });\n }\n }, []);\n\n // rendered output\n let style: CSSProperties = {};\n let content: (JSX.Element | null)[] | null = null;\n\n // bottom rows aren't virtualised (they're sticky) but we need to set the height\n if (count || table.getBottomRows().length) {\n style = {\n height: totalSize,\n paddingBottom: isNaN(paddingBottom) ? 0 : paddingBottom,\n paddingTop: isNaN(paddingTop) ? 0 : paddingTop,\n };\n }\n\n // only render non sticky rows\n if (count) {\n content = virtualItems.map(virtualRow => {\n // there appears to be a react-virtual bug where it inserts a single `undefined` item at the end of the row, which crashes here\n if (!virtualRow) {\n return null;\n }\n\n let row: ReactTableRow<TType> | undefined;\n\n if (tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2) {\n const currentPageIndex =\n (Math.floor(virtualRow.index / tableMeta.server.pageSize) * tableMeta.server.pageSize) /\n tableMeta.server.pageSize;\n const pagePosition = tableMeta.server.pages?.indexOf(currentPageIndex) ?? -1;\n\n if (pagePosition > -1) {\n // \"flatten\" row indexes down into the dataloader2 dataset size\n // for example, with a page size of 100...\n // row index 14267 is actually one of index 67, 167, 267 etc within the dataset (depending on number of pages stored)\n const fakeIndex = pagePosition * tableMeta.server.pageSize + (virtualRow.index % tableMeta.server.pageSize);\n row = rows[fakeIndex];\n }\n } else {\n row = rows[virtualRow.index];\n }\n\n if (!row?.original) {\n return (\n <SkeletonRow\n key={virtualRow.index}\n index={virtualRow.index}\n scrollDirection={virtualiser.scrollDirection ?? undefined}\n table={table}\n />\n );\n }\n\n const measureRow = (rowHeight: number) => {\n virtualiser.resizeItem(virtualRow, rowHeight);\n };\n\n return (\n <Row\n key={row.id}\n row={row}\n index={virtualRow.index}\n scrollDirection={virtualiser.scrollDirection ?? undefined}\n table={table}\n measureRow={measureRow}\n renderer={renderers.row}\n cellRenderer={renderers.cell}\n />\n );\n });\n }\n\n return {\n rows: content,\n style,\n scrollToIndex,\n };\n}\n\n// support virtualised row groups (where the row group headers are sticky)\nfunction useRowGroupVirtualisation<TType = unknown>(table: ReactTable<TType>) {\n const rows = table.getRowModel().rows;\n const isTableGrouped = !!table.getState().grouping.length;\n\n const rowGroupIndexes = React.useMemo(() => {\n const indexes: number[] = [];\n\n if (isTableGrouped) {\n rows.forEach((row, index) => {\n if (row.getIsGrouped()) {\n indexes.push(index);\n }\n });\n }\n\n return indexes;\n }, [rows]);\n\n // this is taken from the react-virtual docs/examples\n const rangeExtractor = React.useCallback(\n (range: Range) => {\n const activeRowGroupIndex =\n [...rowGroupIndexes].reverse().find(index => range.startIndex >= index) ?? rowGroupIndexes[0];\n\n const next = new Set([activeRowGroupIndex, ...defaultRangeExtractor(range)]);\n return [...next].sort((a, b) => a - b);\n },\n [rowGroupIndexes]\n );\n\n return isTableGrouped ? rangeExtractor : undefined;\n}\n"],"names":["getScrollPaddingEndOffset","table","tableMeta","options","meta","offset","footer","isEnabled","getHeaderGroups","length","height","ROW_HEIGHT_ESTIMATES","medium","bottomRows","getBottomRows","rowHeight","getPaddingEndOffset","_table$getBottomRows","_options$virtualiserP","virtualiserPaddingEndOffset","OVERSCAN_ROW_COUNT","useTableRenderer","renderers","tableRef","defaultRowActiveIndex","isTableRowGrouped","_table$getState$group","getState","grouping","rows","_table$getCenterRows","getCenterRows","rangeExtractor","useRowGroupVirtualisation","scrollPaddingStart","count","server","_experimentalDataLoader2","virtualiser","useVirtualizer","estimateSize","getScrollElement","current","overscan","printing","isPrinting","scrollPaddingEnd","paddingEnd","React","useEffect","measure","expanded","totalSize","getTotalSize","virtualItems","getVirtualItems","scrollToIndex","useCallback","index","align","behavior","notSmooth","scrollToOffset","scrollTop","scrollHeight","paddingStartIndex","startValue","_virtualItems$padding","start","_virtualItems$padding2","size","_virtualItems$padding3","paddingTop","paddingBottom","Math","max","_virtualItems$end","_virtualItems","end","style","content","isNaN","map","virtualRow","row","_tableMeta$server$pag","_tableMeta$server$pag2","currentPageIndex","floor","pageSize","pagePosition","pages","indexOf","fakeIndex","_row","original","_virtualiser$scrollDi","SkeletonRow","key","scrollDirection","undefined","measureRow","resizeItem","Row","id","_virtualiser$scrollDi2","renderer","cellRenderer","cell","getRowModel","isTableGrouped","rowGroupIndexes","useMemo","indexes","forEach","getIsGrouped","push","range","activeRowGroupIndex","_reverse$find","reverse","find","startIndex","next","Set","defaultRangeExtractor","sort","a","b"],"mappings":";;;;;;AAcA;AACA,SAASA,yBAAyBA,CAAkBC,KAAwB;EACxE,MAAMC,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAA6B;EAC7D,IAAIC,MAAM,GAAG,CAAC;EAEd,I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D,cAAc,GAAG9E,cAAc,GAAGoE,SAAS;AACtD;;;;"}
1
+ {"version":3,"file":"useTableRenderer.js","sources":["../../../../../../../../../src/primitives/Table/Core/features/useTableRenderer.tsx"],"sourcesContent":["import React, { CSSProperties } from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta, Row as ReactTableRow } from '@tanstack/react-table';\nimport {\n useVirtualizer,\n defaultRangeExtractor,\n ScrollToOptions as ReactVirtualScrollToOptions,\n Range,\n} from '@tanstack/react-virtual';\nimport { ROW_HEIGHT_ESTIMATES } from '../util/rows';\nimport { Row } from '../components/Row/Row';\nimport { useTableRenderers, useTableRenderOptions } from '../types';\nimport { TableRef, TableDefaultRowActiveIndex } from '../../types';\nimport { SkeletonRow } from '../components/Row/BuiltIns/SkeletonRow';\nimport { getSettings } from '../../useTableManager/util/settings';\n\n// scroll padding end is designed to always show half of the next row\nfunction getScrollPaddingEndOffset<TType = unknown>(table: ReactTable<TType>) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n let offset = 2;\n\n if (tableMeta.footer.isEnabled) {\n offset += 1;\n }\n\n if (table.getHeaderGroups().length > 1) {\n offset += table.getHeaderGroups().length - 1;\n }\n\n let height = ROW_HEIGHT_ESTIMATES.medium * offset;\n\n const bottomRows = table.getBottomRows();\n\n if (bottomRows.length) {\n // 1.4 offsets for half rows and also accounts for increased row heights (which is likely in pinned rows)\n height += ROW_HEIGHT_ESTIMATES[tableMeta.rowHeight.height] * 1.4 * bottomRows.length;\n }\n\n return height;\n}\n\n// scroll padding end is designed to always show half of the next row\nfunction getPaddingEndOffset<TType = unknown>(table: ReactTable<TType>, options?: useTableRenderOptions) {\n const bottomRows = table.getBottomRows() ?? [];\n return ROW_HEIGHT_ESTIMATES.medium * (options?.virtualiserPaddingEndOffset ?? 1) * bottomRows.length;\n}\n\n// A higher number ensure less scroll jumping for dynamic row heights, but too high can reduce performance. 8 worked well\nconst OVERSCAN_ROW_COUNT = 8;\n\nexport function useTableRenderer<TType = unknown>(\n renderers: useTableRenderers<TType>,\n table: ReactTable<TType>,\n tableRef: React.RefObject<TableRef>,\n length: number,\n defaultRowActiveIndex?: TableDefaultRowActiveIndex | undefined,\n options?: useTableRenderOptions\n) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const isTableRowGrouped = !!table.getState().grouping?.length;\n const rows = table.getCenterRows() ?? [];\n\n // row groups\n const rangeExtractor = useRowGroupVirtualisation<TType>(table);\n\n // account for thead and tfoot in the scroll area - both are always medium row height\n const scrollPaddingStart = ROW_HEIGHT_ESTIMATES.medium;\n\n const count = tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2 ? length : rows.length;\n\n const virtualiser = useVirtualizer({\n count,\n estimateSize: () => {\n return tableMeta.rowHeight.height ? ROW_HEIGHT_ESTIMATES[tableMeta.rowHeight.height] : ROW_HEIGHT_ESTIMATES.medium;\n },\n getScrollElement: () => tableRef.current,\n overscan: tableMeta.printing.isPrinting ? count : OVERSCAN_ROW_COUNT,\n rangeExtractor,\n // correctly sets the scroll padding offset, e.g. when keyboard navigating rows in the list\n scrollPaddingStart,\n scrollPaddingEnd: getScrollPaddingEndOffset(table),\n paddingEnd: getPaddingEndOffset(table, options),\n });\n\n React.useEffect(() => {\n virtualiser.measure();\n }, [table.getState().expanded]);\n\n const totalSize = virtualiser.getTotalSize();\n const virtualItems = virtualiser.getVirtualItems();\n\n const scrollToIndex = React.useCallback(\n (index: number, options: ReactVirtualScrollToOptions = { align: 'auto', behavior: 'smooth' }) => {\n const notSmooth: ReactVirtualScrollToOptions = { ...options, behavior: 'auto' };\n\n if (tableRef.current) {\n if (index === 0) {\n virtualiser.scrollToOffset(0, notSmooth);\n } else if (index === count - 1) {\n // sometimes the last row doesn't fully show, so we just force scroll to the bottom\n tableRef.current.scrollTop = tableRef.current.scrollHeight;\n } else {\n virtualiser.scrollToIndex(index, options);\n }\n }\n },\n [virtualItems.length, tableRef.current, totalSize, count]\n );\n\n // use row 1 not 0, because 0 might be sticky in grouped tables and it's start value will always be 0\n const paddingStartIndex = isTableRowGrouped && count > 1 ? 1 : 0;\n\n const startValue = isTableRowGrouped\n ? virtualItems[paddingStartIndex]?.start - virtualItems[paddingStartIndex]?.size\n : virtualItems[paddingStartIndex]?.start;\n\n // styling for offsetting rows - this \"is\" the virtualisation\n const [paddingTop, paddingBottom] =\n virtualItems.length > 0\n ? [Math.max(0, startValue ?? 0), Math.max(0, totalSize - (virtualItems[virtualItems.length - 1]?.end ?? 0))]\n : [0, 0];\n\n // ensure default active rows are scrolled to\n React.useEffect(() => {\n if (defaultRowActiveIndex !== undefined) {\n const index =\n typeof defaultRowActiveIndex === 'function' ? defaultRowActiveIndex(getSettings(table)) : defaultRowActiveIndex;\n\n if (index !== undefined) {\n scrollToIndex(index, { align: 'center', behavior: 'auto' });\n }\n }\n }, []);\n\n // rendered output\n let style: CSSProperties = {};\n let content: (JSX.Element | null)[] | null = null;\n\n // bottom rows aren't virtualised (they're sticky) but we need to set the height\n if (count || table.getBottomRows().length) {\n style = {\n height: totalSize,\n paddingBottom: isNaN(paddingBottom) ? 0 : paddingBottom,\n paddingTop: isNaN(paddingTop) ? 0 : paddingTop,\n };\n }\n\n // only render non sticky rows\n if (count) {\n content = virtualItems.map(virtualRow => {\n // there appears to be a react-virtual bug where it inserts a single `undefined` item at the end of the row, which crashes here\n if (!virtualRow) {\n return null;\n }\n\n let row: ReactTableRow<TType> | undefined;\n\n if (tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2) {\n const currentPageIndex =\n (Math.floor(virtualRow.index / tableMeta.server.pageSize) * tableMeta.server.pageSize) /\n tableMeta.server.pageSize;\n const pagePosition = tableMeta.server.pages?.indexOf(currentPageIndex) ?? -1;\n\n if (pagePosition > -1) {\n // \"flatten\" row indexes down into the dataloader2 dataset size\n // for example, with a page size of 100...\n // row index 14267 is actually one of index 67, 167, 267 etc within the dataset (depending on number of pages stored)\n const fakeIndex = pagePosition * tableMeta.server.pageSize + (virtualRow.index % tableMeta.server.pageSize);\n row = rows[fakeIndex];\n }\n } else {\n row = rows[virtualRow.index];\n }\n\n if (!row?.original) {\n return (\n <SkeletonRow\n key={virtualRow.index}\n index={virtualRow.index}\n scrollDirection={virtualiser.scrollDirection ?? undefined}\n table={table}\n />\n );\n }\n\n const measureRow = (rowHeight: number) => {\n virtualiser.resizeItem(virtualRow, rowHeight);\n };\n\n return (\n <Row\n key={row.id}\n row={row}\n index={virtualRow.index}\n scrollDirection={virtualiser.scrollDirection ?? undefined}\n table={table}\n measureRow={measureRow}\n renderer={renderers.row}\n cellRenderer={renderers.cell}\n />\n );\n });\n }\n\n return {\n rows: content,\n style,\n scrollToIndex,\n };\n}\n\n// support virtualised row groups (where the row group headers are sticky)\nfunction useRowGroupVirtualisation<TType = unknown>(table: ReactTable<TType>) {\n const rows = table.getRowModel().rows;\n const isTableGrouped = !!table.getState().grouping.length;\n\n const rowGroupIndexes = React.useMemo(() => {\n const indexes: number[] = [];\n\n if (isTableGrouped) {\n rows.forEach((row, index) => {\n if (row.getIsGrouped()) {\n indexes.push(index);\n }\n });\n }\n\n return indexes;\n }, [rows]);\n\n // this is taken from the react-virtual docs/examples\n const rangeExtractor = React.useCallback(\n (range: Range) => {\n const activeRowGroupIndex =\n [...rowGroupIndexes].reverse().find(index => range.startIndex >= index) ?? rowGroupIndexes[0];\n\n const next = new Set([activeRowGroupIndex, ...defaultRangeExtractor(range)]);\n return [...next].sort((a, b) => a - b);\n },\n [rowGroupIndexes]\n );\n\n return isTableGrouped ? rangeExtractor : undefined;\n}\n"],"names":["getScrollPaddingEndOffset","table","tableMeta","options","meta","offset","footer","isEnabled","getHeaderGroups","length","height","ROW_HEIGHT_ESTIMATES","medium","bottomRows","getBottomRows","rowHeight","getPaddingEndOffset","_table$getBottomRows","_options$virtualiserP","virtualiserPaddingEndOffset","OVERSCAN_ROW_COUNT","useTableRenderer","renderers","tableRef","defaultRowActiveIndex","isTableRowGrouped","_table$getState$group","getState","grouping","rows","_table$getCenterRows","getCenterRows","rangeExtractor","useRowGroupVirtualisation","scrollPaddingStart","count","server","_experimentalDataLoader2","virtualiser","useVirtualizer","estimateSize","getScrollElement","current","overscan","printing","isPrinting","scrollPaddingEnd","paddingEnd","React","useEffect","measure","expanded","totalSize","getTotalSize","virtualItems","getVirtualItems","scrollToIndex","useCallback","index","align","behavior","notSmooth","scrollToOffset","scrollTop","scrollHeight","paddingStartIndex","startValue","_virtualItems$padding","start","_virtualItems$padding2","size","_virtualItems$padding3","paddingTop","paddingBottom","Math","max","_virtualItems$end","_virtualItems","end","undefined","getSettings","style","content","isNaN","map","virtualRow","row","_tableMeta$server$pag","_tableMeta$server$pag2","currentPageIndex","floor","pageSize","pagePosition","pages","indexOf","fakeIndex","_row","original","_virtualiser$scrollDi","SkeletonRow","key","scrollDirection","measureRow","resizeItem","Row","id","_virtualiser$scrollDi2","renderer","cellRenderer","cell","getRowModel","isTableGrouped","rowGroupIndexes","useMemo","indexes","forEach","getIsGrouped","push","range","activeRowGroupIndex","_reverse$find","reverse","find","startIndex","next","Set","defaultRangeExtractor","sort","a","b"],"mappings":";;;;;;;AAeA;AACA,SAASA,yBAAyBA,CAAkBC,KAAwB;EACxE,MAAMC,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAA6B;EAC7D,IAAIC,MAAM,GAAG,CAAC;EAEd,IAAIH,SAAS,CAACI,MAAM,CAACC,SAAS,EAAE;IAC5BF,MAAM,IAAI,CAAC;;EAGf,IAAIJ,KAAK,CAACO,eAAe,EAAE,CAACC,MAAM,GAAG,CAAC,EAAE;IACpCJ,MAAM,IAAIJ,KAAK,CAACO,eAAe,EAAE,CAACC,MAAM,GAAG,CAAC;;EAGhD,IAAIC,MAAM,GAAGC,oBAAoB,CAACC,MAAM,GAAGP,MAAM;EAEjD,MAAMQ,UAAU,GAAGZ,KAAK,CAACa,aAAa,EAAE;EAExC,IAAID,UAAU,CAACJ,MAAM,EAAE;;IAEnBC,MAAM,IAAIC,oBAAoB,CAACT,SAAS,CAACa,SAAS,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AW,EAAE,CAACjF,IAAI;EACrC,MAAMkF,cAAc,GAAG,CAAC,CAAC9G,KAAK,CAAC0B,QAAQ,EAAE,CAACC,QAAQ,CAACnB,MAAM;EAEzD,MAAMuG,eAAe,GAAGhE,cAAK,CAACiE,OAAO,CAAC;IAClC,MAAMC,OAAO,GAAa,EAAE;IAE5B,IAAIH,cAAc,EAAE;MAChBlF,IAAI,CAACsF,OAAO,CAAC,CAAC7B,GAAG,EAAE5B,KAAK;QACpB,IAAI4B,GAAG,CAAC8B,YAAY,EAAE,EAAE;UACpBF,OAAO,CAACG,IAAI,CAAC3D,KAAK,CAAC;;OAE1B,CAAC;;IAGN,OAAOwD,OAAO;GACjB,EAAE,CAACrF,IAAI,CAAC,CAAC;;EAGV,MAAMG,cAAc,GAAGgB,cAAK,CAACS,WAAW,CACnC6D,KAAY;;IACT,MAAMC,mBAAmB,IAAAC,aAAA,GACrB,CAAC,GAAGR,eAAe,CAAC,CAACS,OAAO,EAAE,CAACC,IAAI,CAAChE,KAAK,IAAI4D,KAAK,CAACK,UAAU,IAAIjE,KAAK,CAAC,cAAA8D,aAAA,cAAAA,aAAA,GAAIR,eAAe,CAAC,CAAC,CAAC;IAEjG,MAAMY,IAAI,GAAG,IAAIC,GAAG,CAAC,CAACN,mBAAmB,EAAE,GAAGO,qBAAqB,CAACR,KAAK,CAAC,CAAC,CAAC;IAC5E,OAAO,CAAC,GAAGM,IAAI,CAAC,CAACG,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,GAAGC,CAAC,CAAC;GACzC,EACD,CAACjB,eAAe,CAAC,CACpB;EAED,OAAOD,cAAc,GAAG/E,cAAc,GAAG+C,SAAS;AACtD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTable.js","sources":["../../../../../../../../src/primitives/Table/Core/useTable.ts"],"sourcesContent":["import { Table as ReactTable, TableMeta as ReactTableMeta, TableState as ReactTableState } from '@tanstack/react-table';\nimport { ScrollToOptions as ReactVirtualScrollToOptions } from '@tanstack/react-virtual';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { TableCustomSettingsRenderer, TableEmptyStateRenderer, TableProps } from '../types';\nimport { useTableManager } from '../useTableManager/useTableManager';\nimport { useTableStyle } from './features/useTableStyle';\nimport { useTableGlobalShortcuts } from './features/useTableGlobalShortcuts';\nimport { useTableRef } from './features/useTableRef';\nimport { useTableRenderer } from './features/useTableRenderer';\nimport { useTableRowActiveListener } from './listeners/useTableRowActiveListener';\nimport { TableRef } from '../types';\nimport { useTableRenderers, useTableRenderOptions } from './types';\nimport { renderer as rowActions } from './components/Columns/Internal/Actions';\nimport { renderer as rowDrag } from './components/Columns/Internal/Drag';\nimport { renderer as rowExpansion } from './components/Columns/Internal/Expansion';\nimport { renderer as rowSelection } from './components/Columns/Internal/Selection';\nimport { useTableManagerInternalColumns } from '../useTableManager/types';\n\nconst INTERNAL_RENDERERS = {\n rowActions,\n rowDrag,\n rowExpansion,\n rowSelection,\n};\n\nexport type useTableReturnValue<TType = unknown> = {\n id: string;\n instance: ReactTable<TType>;\n meta: ReactTableMeta<TType>;\n props: {\n customSettings: TableCustomSettingsRenderer | undefined;\n emptyState: TableEmptyStateRenderer | undefined;\n toolbarLeft: JSX.Element | undefined;\n toolbarPanel: JSX.Element | undefined;\n toolbarRight: JSX.Element | undefined;\n };\n ref: React.RefObject<TableRef>;\n renderer: {\n rows: (JSX.Element | null)[] | null;\n style: React.CSSProperties;\n scrollToIndex: (index: number, options?: ReactVirtualScrollToOptions) => void;\n };\n style: React.CSSProperties;\n stylesheet: string;\n state: ReactTableState;\n};\n\nexport function useTable<TType = unknown, TMeta = {}>(\n props: TableProps<TType>,\n externalRef: React.Ref<TableRef>,\n renderers: useTableRenderers<TType>,\n meta?: Partial<ReactTableMeta<TType>> & TMeta,\n options?: useTableRenderOptions\n): useTableReturnValue<TType> {\n // create a ref and merge with the consumer's ref\n const ref = useMergedRef<TableRef>(externalRef);\n // configure the table\n const manager = useTableManager<TType>(props, meta, INTERNAL_RENDERERS as useTableManagerInternalColumns<TType>);\n\n // configure the virtualised renderer\n const renderer = useTableRenderer<TType>(\n renderers,\n manager.instance,\n ref,\n manager.meta.length,\n props.defaultRowActiveIndex,\n options\n );\n // configure dynamic styling\n const { style, stylesheet } = useTableStyle(manager.id, manager.instance);\n // configure global keyboard shortcuts\n useTableGlobalShortcuts(manager.instance, ref, renderer.scrollToIndex);\n // augment the ref with some helper functions\n useTableRef(manager.instance, ref);\n\n // listeners - they are here and not in useTableManager because they rely on the dom and the table ref\n useTableRowActiveListener(manager.instance, ref);\n\n return {\n ...manager,\n props: {\n customSettings: props.customSettings,\n emptyState: props.emptyState,\n toolbarLeft: props.toolbarLeft,\n toolbarPanel: props.toolbarPanel,\n toolbarRight: props.toolbarRight,\n },\n renderer,\n style,\n stylesheet,\n ref,\n };\n}\n"],"names":["INTERNAL_RENDERERS","rowActions","rowDrag","rowExpansion","rowSelection","useTable","props","externalRef","renderers","meta","options","ref","useMergedRef","manager","useTableManager","renderer","useTableRenderer","instance","length","defaultRowActiveIndex","style","stylesheet","useTableStyle","id","useTableGlobalShortcuts","scrollToIndex","useTableRef","useTableRowActiveListener","customSettings","emptyState","toolbarLeft","toolbarPanel","toolbarRight"],"mappings":";;;;;;;;;;;;AAkBA,MAAMA,kBAAkB,GAAG;cACvBC,QAAU;WACVC,UAAO;gBACPC,UAAY;gBACZC;CACH;SAwBeC,QAAQA,CACpBC,KAAwB,EACxBC,WAAgC,EAChCC,SAAmC,EACnCC,IAA6C,EAC7CC,OAA+B;;EAG/B,MAAMC,GAAG,GAAGC,YAAY,CAAWL,WAAW,CAAC;;EAE/C,MAAMM,OAAO,GAAGC,eAAe,CAAQR,KAAK,EAAEG,IAAI,EAAET,kBAA2D,CAAC;;EAGhH,MAAMe,QAAQ,GAAGC,gBAAgB,CAC7BR,SAAS,EACTK,OAAO,CAACI,QAAQ,EAChBN,GAAG,EACHE,OAAO,CAACJ,IAAI,CAACS,MAAM,EACnBZ,KAAK,CAACa,qBAAqB,EAC3BT,OAAO,CACV;;EAED,MAAM;IAAEU,KAAK;IAAEC;GAAY,GAAGC,aAAa,CAACT,OAAO,CAACU,EAAE,EAAEV,OAAO,CAACI,QAAQ,CAAC;;EAEzEO,uBAAuB,CAACX,OAAO,CAACI,QAAQ,EAAEN,GAAG,EAAEI,QAAQ,CAACU,aAAa,CAAC;;EAEtEC,WAAW,CAACb,OAAO,CAACI,QAAQ,EAAEN,GAAG,CAAC;;EAGlCgB,yBAAyB,CAACd,OAAO,CAACI,QAAQ,EAAEN,GAAG,CAAC;EAEhD,OAAO;IACH,GAAGE,OAAO;IACVP,KAAK,EAAE;MACHsB,cAAc,EAAEtB,KAAK,CAACsB,cAAc;MACpCC,UAAU,EAAEvB,KAAK,CAACuB,UAAU;MAC5BC,WAAW,EAAExB,KAAK,CAACwB,WAAW;MAC9BC,YAAY,EAAEzB,KAAK,CAACyB,YAAY;MAChCC,YAAY,EAAE1B,KAAK,CAAC0B;KACvB;IACDjB,QAAQ;IACRK,KAAK;IACLC,UAAU;IACVV;GACH;AACL;;;;"}
1
+ {"version":3,"file":"useTable.js","sources":["../../../../../../../../src/primitives/Table/Core/useTable.ts"],"sourcesContent":["import { Table as ReactTable, TableMeta as ReactTableMeta, TableState as ReactTableState } from '@tanstack/react-table';\nimport { ScrollToOptions as ReactVirtualScrollToOptions } from '@tanstack/react-virtual';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { TableCustomSettingsRenderer, TableEmptyStateRenderer, TableProps, TableToolbarRenderer } from '../types';\nimport { useTableManager } from '../useTableManager/useTableManager';\nimport { useTableStyle } from './features/useTableStyle';\nimport { useTableGlobalShortcuts } from './features/useTableGlobalShortcuts';\nimport { useTableRef } from './features/useTableRef';\nimport { useTableRenderer } from './features/useTableRenderer';\nimport { useTableRowActiveListener } from './listeners/useTableRowActiveListener';\nimport { TableRef } from '../types';\nimport { useTableRenderers, useTableRenderOptions } from './types';\nimport { renderer as rowActions } from './components/Columns/Internal/Actions';\nimport { renderer as rowDrag } from './components/Columns/Internal/Drag';\nimport { renderer as rowExpansion } from './components/Columns/Internal/Expansion';\nimport { renderer as rowSelection } from './components/Columns/Internal/Selection';\nimport { useTableManagerInternalColumns } from '../useTableManager/types';\n\nconst INTERNAL_RENDERERS = {\n rowActions,\n rowDrag,\n rowExpansion,\n rowSelection,\n};\n\nexport type useTableReturnValue<TType = unknown> = {\n id: string;\n instance: ReactTable<TType>;\n meta: ReactTableMeta<TType>;\n props: {\n customSettings: TableCustomSettingsRenderer | undefined;\n emptyState: TableEmptyStateRenderer | undefined;\n toolbarLeft: TableToolbarRenderer | undefined;\n toolbarPanel: TableToolbarRenderer | undefined;\n toolbarRight: TableToolbarRenderer | undefined;\n };\n ref: React.RefObject<TableRef>;\n renderer: {\n rows: (JSX.Element | null)[] | null;\n style: React.CSSProperties;\n scrollToIndex: (index: number, options?: ReactVirtualScrollToOptions) => void;\n };\n style: React.CSSProperties;\n stylesheet: string;\n state: ReactTableState;\n};\n\nexport function useTable<TType = unknown, TMeta = {}>(\n props: TableProps<TType>,\n externalRef: React.Ref<TableRef>,\n renderers: useTableRenderers<TType>,\n meta?: Partial<ReactTableMeta<TType>> & TMeta,\n options?: useTableRenderOptions\n): useTableReturnValue<TType> {\n // create a ref and merge with the consumer's ref\n const ref = useMergedRef<TableRef>(externalRef);\n // configure the table\n const manager = useTableManager<TType>(props, meta, INTERNAL_RENDERERS as useTableManagerInternalColumns<TType>);\n\n // configure the virtualised renderer\n const renderer = useTableRenderer<TType>(\n renderers,\n manager.instance,\n ref,\n manager.meta.length,\n props.defaultRowActiveIndex,\n options\n );\n // configure dynamic styling\n const { style, stylesheet } = useTableStyle(manager.id, manager.instance);\n // configure global keyboard shortcuts\n useTableGlobalShortcuts(manager.instance, ref, renderer.scrollToIndex);\n // augment the ref with some helper functions\n useTableRef(manager.instance, ref);\n\n // listeners - they are here and not in useTableManager because they rely on the dom and the table ref\n useTableRowActiveListener(manager.instance, ref);\n\n return {\n ...manager,\n props: {\n customSettings: props.customSettings,\n emptyState: props.emptyState,\n toolbarLeft: props.toolbarLeft,\n toolbarPanel: props.toolbarPanel,\n toolbarRight: props.toolbarRight,\n },\n renderer,\n style,\n stylesheet,\n ref,\n };\n}\n"],"names":["INTERNAL_RENDERERS","rowActions","rowDrag","rowExpansion","rowSelection","useTable","props","externalRef","renderers","meta","options","ref","useMergedRef","manager","useTableManager","renderer","useTableRenderer","instance","length","defaultRowActiveIndex","style","stylesheet","useTableStyle","id","useTableGlobalShortcuts","scrollToIndex","useTableRef","useTableRowActiveListener","customSettings","emptyState","toolbarLeft","toolbarPanel","toolbarRight"],"mappings":";;;;;;;;;;;;AAkBA,MAAMA,kBAAkB,GAAG;cACvBC,QAAU;WACVC,UAAO;gBACPC,UAAY;gBACZC;CACH;SAwBeC,QAAQA,CACpBC,KAAwB,EACxBC,WAAgC,EAChCC,SAAmC,EACnCC,IAA6C,EAC7CC,OAA+B;;EAG/B,MAAMC,GAAG,GAAGC,YAAY,CAAWL,WAAW,CAAC;;EAE/C,MAAMM,OAAO,GAAGC,eAAe,CAAQR,KAAK,EAAEG,IAAI,EAAET,kBAA2D,CAAC;;EAGhH,MAAMe,QAAQ,GAAGC,gBAAgB,CAC7BR,SAAS,EACTK,OAAO,CAACI,QAAQ,EAChBN,GAAG,EACHE,OAAO,CAACJ,IAAI,CAACS,MAAM,EACnBZ,KAAK,CAACa,qBAAqB,EAC3BT,OAAO,CACV;;EAED,MAAM;IAAEU,KAAK;IAAEC;GAAY,GAAGC,aAAa,CAACT,OAAO,CAACU,EAAE,EAAEV,OAAO,CAACI,QAAQ,CAAC;;EAEzEO,uBAAuB,CAACX,OAAO,CAACI,QAAQ,EAAEN,GAAG,EAAEI,QAAQ,CAACU,aAAa,CAAC;;EAEtEC,WAAW,CAACb,OAAO,CAACI,QAAQ,EAAEN,GAAG,CAAC;;EAGlCgB,yBAAyB,CAACd,OAAO,CAACI,QAAQ,EAAEN,GAAG,CAAC;EAEhD,OAAO;IACH,GAAGE,OAAO;IACVP,KAAK,EAAE;MACHsB,cAAc,EAAEtB,KAAK,CAACsB,cAAc;MACpCC,UAAU,EAAEvB,KAAK,CAACuB,UAAU;MAC5BC,WAAW,EAAExB,KAAK,CAACwB,WAAW;MAC9BC,YAAY,EAAEzB,KAAK,CAACyB,YAAY;MAChCC,YAAY,EAAE1B,KAAK,CAAC0B;KACvB;IACDjB,QAAQ;IACRK,KAAK;IACLC,UAAU;IACVV;GACH;AACL;;;;"}