@economic/taco 2.23.0 → 2.24.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Card/Card.d.ts +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +2 -0
- package/dist/components/Provider/Localization.d.ts +4 -0
- package/dist/components/Report/components/Body/Body.d.ts +0 -1
- package/dist/components/Report/components/Footer/Summary.d.ts +0 -1
- package/dist/components/Report/components/Toolbar/components/Filters/components/Filter.d.ts +2 -2
- package/dist/components/Report/components/Toolbar/components/Filters/components/FilterColumn.d.ts +5 -2
- package/dist/components/Report/useReport.d.ts +0 -1
- package/dist/components/Select2/Select2.d.ts +4 -0
- package/dist/components/Select2/hooks/useChildren.d.ts +1 -0
- package/dist/components/Table3/components/toolbar/Filter/filters/components/Filter.d.ts +2 -2
- package/dist/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.d.ts +5 -2
- package/dist/esm/index.css +55 -46
- package/dist/esm/packages/taco/src/components/Button/util.js +8 -8
- package/dist/esm/packages/taco/src/components/Button/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Card/Card.js +2 -1
- package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +11 -2
- package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +1 -1
- package/dist/esm/packages/taco/src/components/Provider/Localization.js +5 -1
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/Report.js +3 -8
- package/dist/esm/packages/taco/src/components/Report/Report.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Body/Body.js +1 -2
- package/dist/esm/packages/taco/src/components/Report/components/Body/Body.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Footer/Footer.js +14 -2
- package/dist/esm/packages/taco/src/components/Report/components/Footer/Footer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Footer/Summary.js +2 -2
- package/dist/esm/packages/taco/src/components/Report/components/Footer/Summary.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Internal/Selection.js +47 -11
- package/dist/esm/packages/taco/src/components/Report/components/Internal/Selection.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.js +28 -43
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Filter.js +14 -7
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Filter.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterColumn.js +4 -3
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterColumn.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/Print.js +10 -8
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/Print.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/listeners/useTableRowActiveListener.js +2 -2
- package/dist/esm/packages/taco/src/components/Report/listeners/useTableRowActiveListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/styles/useCssGridStylesheet.js +7 -4
- package/dist/esm/packages/taco/src/components/Report/styles/useCssGridStylesheet.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/util/useTableGlobalShortcuts.js +3 -10
- package/dist/esm/packages/taco/src/components/Report/util/useTableGlobalShortcuts.js.map +1 -1
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +2 -1
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +43 -4
- package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +4 -6
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js +66 -14
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +27 -44
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Filter.js +14 -7
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Filter.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js +4 -3
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js +2 -0
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSettings.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js +3 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +10 -3
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useLocalStorage.js.map +1 -1
- package/dist/esm/packages/taco/src/index.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Button.js +1 -0
- package/dist/esm/packages/taco/src/primitives/Button.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js +24 -4
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSettings.js +1 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSettings.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSettingsListener.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSettingsListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/useTable.js +7 -5
- package/dist/esm/packages/taco/src/primitives/Table/useTable/useTable.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js +33 -7
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/settings.js +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/settings.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/dom.js +12 -3
- package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/keyboard.js +2 -2
- package/dist/esm/packages/taco/src/utils/keyboard.js.map +1 -1
- package/dist/hooks/useLocalStorage.d.ts +2 -1
- package/dist/index.css +55 -46
- package/dist/primitives/Table/types.d.ts +0 -2
- package/dist/primitives/Table/useTable/features/useTablePrinting.d.ts +10 -3
- package/dist/primitives/Table/useTable/useTable.d.ts +1 -1
- package/dist/primitives/Table/useTable/util/settings.d.ts +0 -1
- package/dist/taco.cjs.development.js +511 -387
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/dist/utils/dom.d.ts +3 -1
- package/package.json +2 -2
- package/types.json +6781 -6993
- package/dist/components/Report/components/Toolbar/components/Filters/components/Placeholder.d.ts +0 -12
- package/dist/components/Table3/components/toolbar/Filter/filters/components/Placeholder.d.ts +0 -12
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Placeholder.js +0 -41
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Placeholder.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Placeholder.js +0 -41
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Placeholder.js.map +0 -1
@@ -1,6 +1,6 @@
|
|
1
1
|
import React__default from 'react';
|
2
|
-
import { useLocalStorage } from '../../../../hooks/useLocalStorage.js';
|
3
2
|
import { useTacoSettings } from '../../../../hooks/useTacoSettings.js';
|
3
|
+
import { useLocalStorage } from '../../../../hooks/useLocalStorage.js';
|
4
4
|
|
5
5
|
const DEFAULT_ENABLED_OPTIONS = {
|
6
6
|
columnOrder: true,
|
@@ -11,7 +11,6 @@ const DEFAULT_ENABLED_OPTIONS = {
|
|
11
11
|
fontSize: true,
|
12
12
|
grouping: true,
|
13
13
|
rowHeight: true,
|
14
|
-
showWarningWhenPrintingLargeDataset: true,
|
15
14
|
sorting: true
|
16
15
|
};
|
17
16
|
function useUniqueTableId(tableId) {
|
package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSettings.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useTableSettings.js","sources":["../../../../../../../../../src/primitives/Table/useTable/features/useTableSettings.ts"],"sourcesContent":["import React from 'react';\nimport { useLocalStorage } from '../../../../hooks/useLocalStorage';\nimport { useTacoSettings } from '../../../../hooks/useTacoSettings';\nimport { EnableSettingsOptions, TableSettings, TableSettingsHandler } from '../../types';\n\nconst DEFAULT_ENABLED_OPTIONS = {\n columnOrder: true,\n columnPinning: true,\n columnSizing: true,\n columnVisibility: true,\n excludeUnmatchedRecordsInSearch: true,\n fontSize: true,\n grouping: true,\n rowHeight: true,\n
|
1
|
+
{"version":3,"file":"useTableSettings.js","sources":["../../../../../../../../../src/primitives/Table/useTable/features/useTableSettings.ts"],"sourcesContent":["import React from 'react';\nimport { useLocalStorage } from '../../../../hooks/useLocalStorage';\nimport { useTacoSettings } from '../../../../hooks/useTacoSettings';\nimport { EnableSettingsOptions, TableSettings, TableSettingsHandler } from '../../types';\n\nconst DEFAULT_ENABLED_OPTIONS = {\n columnOrder: true,\n columnPinning: true,\n columnSizing: true,\n columnVisibility: true,\n excludeUnmatchedRecordsInSearch: true,\n fontSize: true,\n grouping: true,\n rowHeight: true,\n sorting: true,\n};\n\nexport function useUniqueTableId(tableId: string) {\n const tacoSettings = useTacoSettings();\n return `taco.${tacoSettings.uniqueUserIdentifier}.table.${tableId}.settings`;\n}\n\nfunction useEnabledSettings(isEnabled: boolean | Partial<EnableSettingsOptions>): [EnableSettingsOptions, boolean] {\n return React.useMemo(() => {\n if (isEnabled === false) {\n return [\n Object.keys(DEFAULT_ENABLED_OPTIONS).reduce((o, key) => ({ ...o, [key]: false }), {}) as EnableSettingsOptions,\n false,\n ];\n } else if (isEnabled === true) {\n return [DEFAULT_ENABLED_OPTIONS, true];\n }\n\n const options = { ...DEFAULT_ENABLED_OPTIONS, ...isEnabled };\n return [options, Object.values(options).some(o => o === true)];\n }, [isEnabled]);\n}\n\nexport function useTableSettings(\n isEnabled: boolean | Partial<EnableSettingsOptions> = false,\n id: string,\n defaultSettings: TableSettings | undefined = {},\n onChangeSettings: TableSettingsHandler | undefined\n): [TableSettings, TableSettingsHandler] {\n const uniqueId = useUniqueTableId(id);\n const [enabledSettings, hasSomeEnabledSettings] = useEnabledSettings(isEnabled);\n\n const [persistedSettings, _setPersistedSettings] = useLocalStorage<TableSettings>(\n hasSomeEnabledSettings ? uniqueId : undefined,\n removeDisabledSettings(defaultSettings, enabledSettings)\n );\n\n const setPersistedSettings = React.useCallback(\n (value: TableSettings) => {\n if (!hasSomeEnabledSettings) {\n return;\n }\n\n const sanitizedSettings = removeDisabledSettings(value, enabledSettings);\n _setPersistedSettings(sanitizedSettings);\n\n if (typeof onChangeSettings === 'function') {\n onChangeSettings(sanitizedSettings);\n }\n },\n [hasSomeEnabledSettings, onChangeSettings, JSON.stringify(enabledSettings)]\n );\n\n if (!hasSomeEnabledSettings) {\n return [defaultSettings, () => undefined];\n }\n\n return [persistedSettings, setPersistedSettings];\n}\n\nfunction removeDisabledSettings(settings: TableSettings, enabledSettings: EnableSettingsOptions) {\n const sanitizedSettings: TableSettings = { ...settings };\n\n Object.keys(enabledSettings).forEach(setting => {\n if (!enabledSettings[setting]) {\n delete sanitizedSettings[setting];\n }\n });\n\n return sanitizedSettings;\n}\n"],"names":["DEFAULT_ENABLED_OPTIONS","columnOrder","columnPinning","columnSizing","columnVisibility","excludeUnmatchedRecordsInSearch","fontSize","grouping","rowHeight","sorting","useUniqueTableId","tableId","tacoSettings","useTacoSettings","uniqueUserIdentifier","useEnabledSettings","isEnabled","React","useMemo","Object","keys","reduce","o","key","options","values","some","useTableSettings","id","defaultSettings","onChangeSettings","uniqueId","enabledSettings","hasSomeEnabledSettings","persistedSettings","_setPersistedSettings","useLocalStorage","undefined","removeDisabledSettings","setPersistedSettings","useCallback","value","sanitizedSettings","JSON","stringify","settings","forEach","setting"],"mappings":";;;;AAKA,MAAMA,uBAAuB,GAAG;EAC5BC,WAAW,EAAE,IAAI;EACjBC,aAAa,EAAE,IAAI;EACnBC,YAAY,EAAE,IAAI;EAClBC,gBAAgB,EAAE,IAAI;EACtBC,+BAA+B,EAAE,IAAI;EACrCC,QAAQ,EAAE,IAAI;EACdC,QAAQ,EAAE,IAAI;EACdC,SAAS,EAAE,IAAI;EACfC,OAAO,EAAE;CACZ;SAEeC,gBAAgBA,CAACC,OAAe;EAC5C,MAAMC,YAAY,GAAGC,eAAe,EAAE;EACtC,eAAeD,YAAY,CAACE,8BAA8BH,kBAAkB;AAChF;AAEA,S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iB,CAAC;IAExC,IAAI,OAAOZ,gBAAgB,KAAK,UAAU,EAAE;MACxCA,gBAAgB,CAACY,iBAAiB,CAAC;;GAE1C,EACD,CAACT,sBAAsB,EAAEH,gBAAgB,EAAEa,IAAI,CAACC,SAAS,CAACZ,eAAe,CAAC,CAAC,CAC9E;EAED,IAAI,CAACC,sBAAsB,EAAE;IACzB,OAAO,CAACJ,eAAe,EAAE,MAAMQ,SAAS,CAAC;;EAG7C,OAAO,CAACH,iBAAiB,EAAEK,oBAAoB,CAAC;AACpD;AAEA,SAASD,sBAAsBA,CAACO,QAAuB,EAAEb,eAAsC;EAC3F,MAAMU,iBAAiB,GAAkB;IAAE,GAAGG;GAAU;EAExD1B,MAAM,CAACC,IAAI,CAACY,eAAe,CAAC,CAACc,OAAO,CAACC,OAAO;IACxC,IAAI,CAACf,eAAe,CAACe,OAAO,CAAC,EAAE;MAC3B,OAAOL,iBAAiB,CAACK,OAAO,CAAC;;GAExC,CAAC;EAEF,OAAOL,iBAAiB;AAC5B;;;;"}
|
package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSettingsListener.js
CHANGED
@@ -17,7 +17,7 @@ function useTableSettingsListener(table, onChangeSettings) {
|
|
17
17
|
//state.columnFilters,
|
18
18
|
state.columnOrder, state.columnPinning, state.columnSizing, state.columnVisibility,
|
19
19
|
// @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel
|
20
|
-
meta.search.excludeUnmatchedResults, meta.fontSize.size, state.grouping, meta.rowHeight.height,
|
20
|
+
meta.search.excludeUnmatchedResults, meta.fontSize.size, state.grouping, meta.rowHeight.height,
|
21
21
|
//state.globalFilter,
|
22
22
|
state.sorting]);
|
23
23
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useTableSettingsListener.js","sources":["../../../../../../../../../src/primitives/Table/useTable/listeners/useTableSettingsListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { TableSettingsHandler } from '../../types';\nimport { getSettings } from '../util/settings';\n\nexport function useTableSettingsListener<TType = unknown>(\n table: ReactTable<TType>,\n onChangeSettings: TableSettingsHandler | undefined\n) {\n const meta = table.options.meta as ReactTableMeta<TType>;\n const state = table.getState();\n\n React.useEffect(() => {\n let handler;\n\n if (typeof onChangeSettings === 'function') {\n handler = setTimeout(() => {\n // some settings shouldn't be persisted, but we comment them out here to highlight the intention\n onChangeSettings(getSettings(table));\n }, 250);\n }\n\n return () => clearTimeout(handler);\n }, [\n //state.columnFilters,\n state.columnOrder,\n state.columnPinning,\n state.columnSizing,\n state.columnVisibility,\n // @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel\n meta.search.excludeUnmatchedResults,\n meta.fontSize.size,\n state.grouping,\n meta.rowHeight.height,\n
|
1
|
+
{"version":3,"file":"useTableSettingsListener.js","sources":["../../../../../../../../../src/primitives/Table/useTable/listeners/useTableSettingsListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { TableSettingsHandler } from '../../types';\nimport { getSettings } from '../util/settings';\n\nexport function useTableSettingsListener<TType = unknown>(\n table: ReactTable<TType>,\n onChangeSettings: TableSettingsHandler | undefined\n) {\n const meta = table.options.meta as ReactTableMeta<TType>;\n const state = table.getState();\n\n React.useEffect(() => {\n let handler;\n\n if (typeof onChangeSettings === 'function') {\n handler = setTimeout(() => {\n // some settings shouldn't be persisted, but we comment them out here to highlight the intention\n onChangeSettings(getSettings(table));\n }, 250);\n }\n\n return () => clearTimeout(handler);\n }, [\n //state.columnFilters,\n state.columnOrder,\n state.columnPinning,\n state.columnSizing,\n state.columnVisibility,\n // @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel\n meta.search.excludeUnmatchedResults,\n meta.fontSize.size,\n state.grouping,\n meta.rowHeight.height,\n //state.globalFilter,\n state.sorting,\n ]);\n}\n"],"names":["useTableSettingsListener","table","onChangeSettings","meta","options","state","getState","React","useEffect","handler","setTimeout","getSettings","clearTimeout","columnOrder","columnPinning","columnSizing","columnVisibility","search","excludeUnmatchedResults","fontSize","size","grouping","rowHeight","height","sorting"],"mappings":";;;SAKgBA,wBAAwBA,CACpCC,KAAwB,EACxBC,gBAAkD;EAElD,MAAMC,IAAI,GAAGF,KAAK,CAACG,OAAO,CAACD,IAA6B;EACxD,MAAME,KAAK,GAAGJ,KAAK,CAACK,QAAQ,EAAE;EAE9BC,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIC,OAAO;IAEX,IAAI,OAAOP,gBAAgB,KAAK,UAAU,EAAE;MACxCO,OAAO,GAAGC,UAAU,CAAC;;QAEjBR,gBAAgB,CAACS,WAAW,CAACV,KAAK,CAAC,CAAC;OACvC,EAAE,GAAG,CAAC;;IAGX,OAAO,MAAMW,YAAY,CAACH,OAAO,CAAC;GACrC,EAAE;;EAECJ,KAAK,CAACQ,WAAW,EACjBR,KAAK,CAACS,aAAa,EACnBT,KAAK,CAACU,YAAY,EAClBV,KAAK,CAACW,gBAAgB;;EAEtBb,IAAI,CAACc,MAAM,CAACC,uBAAuB,EACnCf,IAAI,CAACgB,QAAQ,CAACC,IAAI,EAClBf,KAAK,CAACgB,QAAQ,EACdlB,IAAI,CAACmB,SAAS,CAACC,MAAM;;EAErBlB,KAAK,CAACmB,OAAO,CAChB,CAAC;AACN;;;;"}
|
@@ -30,7 +30,7 @@ import { useTableServerLoadingListener } from './listeners/useTableServerLoading
|
|
30
30
|
import { useTableRef } from './features/useTableRef.js';
|
31
31
|
|
32
32
|
function useTable(props, ref, meta, internalColumns) {
|
33
|
-
var _props$length, _instance$options$met;
|
33
|
+
var _props$data, _props$length, _instance$options$met;
|
34
34
|
// CSS.escape would be best here, but it doesn't seem to work very well
|
35
35
|
const safeId = props.id.replace('.', '_');
|
36
36
|
// configure table options, merging props with presets
|
@@ -42,7 +42,7 @@ function useTable(props, ref, meta, internalColumns) {
|
|
42
42
|
const columnOrdering = useTableColumnOrdering(options.enableColumnOrdering);
|
43
43
|
const fontSize = useTableFontSize(options.enableFontSize, settings.fontSize);
|
44
44
|
const footer = useTableFooter(options.enableFooter);
|
45
|
-
const printing = useTablePrinting(options.enablePrinting,
|
45
|
+
const printing = useTablePrinting(options.enablePrinting, safeId);
|
46
46
|
const rowActive = useTableRowActive(options.enableRowActive, props.defaultRowActiveIndex);
|
47
47
|
const rowActions = useTableRowActions(options.enableRowActions, props.rowActions, props.rowActionsLength);
|
48
48
|
const rowClick = useTableRowClick(options.enableRowClick, props.onRowClick);
|
@@ -61,10 +61,13 @@ function useTable(props, ref, meta, internalColumns) {
|
|
61
61
|
} = mapTableChildrenToColumns(props, settings, options, internalColumns);
|
62
62
|
// configure initial table state
|
63
63
|
const initialState = useReactTableInitialState(props, columns, settings, defaultState);
|
64
|
+
// ensure data is always valid
|
65
|
+
const data = (_props$data = props.data) !== null && _props$data !== void 0 ? _props$data : [];
|
66
|
+
const length = (_props$length = props.length) !== null && _props$length !== void 0 ? _props$length : data.length;
|
64
67
|
// create a react-table instance
|
65
68
|
// @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel
|
66
69
|
const instance = useReactTable({
|
67
|
-
data
|
70
|
+
data,
|
68
71
|
columns,
|
69
72
|
// configure initial table state
|
70
73
|
initialState,
|
@@ -80,7 +83,7 @@ function useTable(props, ref, meta, internalColumns) {
|
|
80
83
|
columnOrdering,
|
81
84
|
fontSize,
|
82
85
|
footer,
|
83
|
-
|
86
|
+
length,
|
84
87
|
printing,
|
85
88
|
rowActions,
|
86
89
|
rowActive,
|
@@ -110,7 +113,6 @@ function useTable(props, ref, meta, internalColumns) {
|
|
110
113
|
return {
|
111
114
|
id: safeId,
|
112
115
|
instance,
|
113
|
-
length: (_props$length = props.length) !== null && _props$length !== void 0 ? _props$length : props.data.length,
|
114
116
|
meta: (_instance$options$met = instance.options.meta) !== null && _instance$options$met !== void 0 ? _instance$options$met : {},
|
115
117
|
state: instance.getState()
|
116
118
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useTable.js","sources":["../../../../../../../../src/primitives/Table/useTable/useTable.ts"],"sourcesContent":["import { useReactTable, TableMeta as ReactTableMeta, RowData } from '@tanstack/react-table';\nimport {\n TableColumnAlignment,\n TableColumnClassNameHandler,\n TableColumnDataType,\n TableColumnMenu,\n TableColumnRendererControl,\n TableFilterComparator,\n TableRef,\n useTableInternalColumns,\n useTableProps,\n} from '../types';\nimport { useReactTableInitialState, configureReactTableOptions, mapTableChildrenToColumns } from './util/setup';\nimport { useTableFeaturePreset } from './util/presets';\nimport { useTableColumnFreezing } from './features/useTableColumnFreezing';\nimport { useTableColumnOrdering } from './features/useTableColumnOrdering';\nimport { useTableFooter } from './features/useTableFooter';\nimport { useTableFontSize } from './features/useTableFontSize';\nimport { useTablePrinting } from './features/useTablePrinting';\nimport { useTableRowActions } from './features/useTableRowActions';\nimport { useTableRowActive } from './features/useTableRowActive';\nimport { useTableRowClick } from './features/useTableRowClick';\nimport { useTableRowExpansion } from './features/useTableRowExpansion';\nimport { useTableRowGoto } from './features/useTableRowGoto';\nimport { useTableRowGroups } from './features/useTableRowGroups';\nimport { useTableRowHeight } from './features/useTableRowHeight';\nimport { useTableRowSelection } from './features/useTableRowSelection';\nimport { useTableSearch } from './features/useTableSearch';\nimport { useTableServerLoading } from './features/useTableServerLoading';\nimport { useTableSettings } from './features/useTableSettings';\nimport { useTableDataListener } from './listeners/useTableDataListener';\nimport { useTableFilterListener } from './listeners/useTableFilterListener';\nimport { useTableFontSizeListener } from './listeners/useTableFontSizeListener';\nimport { useTableRowHeightListener } from './listeners/useTableRowHeightListener';\nimport { useTableRowSelectionListener } from './listeners/useTableRowSelectionListener';\nimport { useTableSearchListener } from './listeners/useTableSearchListener';\nimport { useTableSettingsListener } from './listeners/useTableSettingsListener';\nimport { useTableShortcutsListener } from './listeners/useTableShortcutsListener';\nimport { useTableSortingListener } from './listeners/useTableSortingListener';\nimport { useTableServerLoadingListener } from './listeners/useTableServerLoadingListener';\nimport { useTableRef } from './features/useTableRef';\n\n/*\n EDITING THIS FILE? READ ME FIRST!\n\n This is a shared, common hook for multiple tables. It's feature set is specifically chosen to support features\n common across those tables. If you are adding a new feature or changing an existing one, before writing any code\n in this file ask yourself the question - is this specific to a given table, or is it common to all of them.\n If you are unsure, ask your team first.\n*/\n\ndeclare module '@tanstack/table-core' {\n interface TableMeta<TData extends RowData> {\n columnFreezing: ReturnType<typeof useTableColumnFreezing>;\n columnOrdering: ReturnType<typeof useTableColumnOrdering>;\n fontSize: ReturnType<typeof useTableFontSize>;\n footer: ReturnType<typeof useTableFooter>;\n printing: ReturnType<typeof useTablePrinting>;\n rowActions: ReturnType<typeof useTableRowActions>;\n rowActive: ReturnType<typeof useTableRowActive>;\n rowClick: ReturnType<typeof useTableRowClick>;\n rowExpansion: ReturnType<typeof useTableRowExpansion>;\n rowGoto: ReturnType<typeof useTableRowGoto>;\n rowGroups: ReturnType<typeof useTableRowGroups>;\n rowHeight: ReturnType<typeof useTableRowHeight>;\n rowSelection: ReturnType<typeof useTableRowSelection>;\n search: ReturnType<typeof useTableSearch>;\n server: ReturnType<typeof useTableServerLoading>;\n //shortcutsState: ReturnType<typeof usePauseShortcuts>;\n }\n\n interface ColumnMeta<TData extends RowData, TValue> {\n align?: TableColumnAlignment;\n className?: TableColumnClassNameHandler<TData>;\n control?: TableColumnRendererControl<TData>;\n dataType?: TableColumnDataType;\n enableOrdering?: boolean;\n enablePrinting?: boolean;\n enableTruncate?: boolean;\n filters?: TableFilterComparator[];\n header: string;\n headerClassName?: string;\n menu?: TableColumnMenu;\n tooltip?: string;\n }\n}\n\nexport function useTable<TType = unknown, TMeta = {}>(\n props: useTableProps<TType>,\n ref: React.RefObject<TableRef>,\n meta?: Partial<ReactTableMeta<TType>> & TMeta,\n internalColumns?: useTableInternalColumns<TType>\n) {\n // CSS.escape would be best here, but it doesn't seem to work very well\n const safeId = props.id.replace('.', '_');\n // configure table options, merging props with presets\n const options = useTableFeaturePreset(props);\n\n // load any persisted table settings and merge them with any defaults\n const [settings, setSettings] = useTableSettings(\n options.enableSaveSettings,\n safeId,\n props.defaultSettings,\n props.onChangeSettings\n );\n\n // configure common custom features\n const columnFreezing = useTableColumnFreezing(options.enableColumnFreezing);\n const columnOrdering = useTableColumnOrdering(options.enableColumnOrdering);\n const fontSize = useTableFontSize(options.enableFontSize, settings.fontSize);\n const footer = useTableFooter(options.enableFooter);\n const printing = useTablePrinting(options.enablePrinting, settings.showWarningWhenPrintingLargeDataset);\n const rowActive = useTableRowActive(options.enableRowActive, props.defaultRowActiveIndex);\n const rowActions = useTableRowActions<TType>(options.enableRowActions, props.rowActions, props.rowActionsLength);\n const rowClick = useTableRowClick<TType>(options.enableRowClick, props.onRowClick);\n const rowExpansion = useTableRowExpansion<TType>(options.enableRowExpansion, props.rowExpansionRenderer);\n const rowGoto = useTableRowGoto(options.enableRowGoto, props.onRowGoto);\n const rowGroups = useTableRowGroups(props.rowActionsForGroup);\n const rowHeight = useTableRowHeight(options.enableRowHeight, settings.rowHeight);\n const rowSelection = useTableRowSelection(options.enableRowSelection);\n const search = useTableSearch(options.enableSearch, settings.excludeUnmatchedRecordsInSearch);\n const server = useTableServerLoading(props.loadPage, props.loadAll, props.pageSize);\n\n // TODO: memoise\n // convert jsx column components into valid table columns\n const { columns, ...defaultState } = mapTableChildrenToColumns<TType>(props, settings, options, internalColumns);\n\n // configure initial table state\n const initialState = useReactTableInitialState<TType>(props, columns, settings, defaultState);\n\n // create a react-table instance\n // @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel\n const instance = useReactTable<TType>({\n data: props.data,\n columns,\n // configure initial table state\n initialState,\n // configure react-table built-in features\n ...configureReactTableOptions(options, props),\n // settings that can be toggled by the user, and therefore require our own state\n enableGlobalFilter: search.enableGlobalFilter,\n // custom context\n meta: {\n // spread features from specific implementations\n ...meta,\n columnFreezing,\n columnOrdering,\n fontSize,\n footer,\n //getSettings\n printing,\n rowActions,\n rowActive,\n rowClick: rowClick as any,\n rowExpansion,\n rowGoto,\n rowGroups,\n rowHeight,\n rowSelection,\n search,\n server,\n },\n });\n\n // state listeners - we have these so that we don't have to control state outside the table\n useTableDataListener(instance);\n useTableFilterListener(instance, props.onChangeFilter);\n useTableFontSizeListener(instance);\n useTableRowHeightListener(instance);\n useTableRowSelectionListener(instance, props.onRowSelect);\n useTableSearchListener(instance);\n useTableServerLoadingListener(instance, server.loadPage);\n useTableSettingsListener(instance, setSettings);\n useTableShortcutsListener(instance, props.shortcuts);\n useTableSortingListener(instance, props.onChangeSort);\n\n // configure ref with reset functions\n useTableRef(instance, ref);\n\n return {\n id: safeId,\n instance,\n length: props.length ?? props.data.length,\n meta: (instance.options.meta ?? {}) as ReactTableMeta<TType> & TMeta,\n state: instance.getState(),\n };\n}\n"],"names":["useTable","props","ref","meta","internalColumns","safeId","id","replace","options","useTableFeaturePreset","settings","setSettings","useTableSettings","enableSaveSettings","defaultSettings","onChangeSettings","columnFreezing","useTableColumnFreezing","enableColumnFreezing","columnOrdering","useTableColumnOrdering","enableColumnOrdering","fontSize","useTableFontSize","enableFontSize","footer","useTableFooter","enableFooter","printing","useTablePrinting","enablePrinting","showWarningWhenPrintingLargeDataset","rowActive","useTableRowActive","enableRowActive","defaultRowActiveIndex","rowActions","useTableRowActions","enableRowActions","rowActionsLength","rowClick","useTableRowClick","enableRowClick","onRowClick","rowExpansion","useTableRowExpansion","enableRowExpansion","rowExpansionRenderer","rowGoto","useTableRowGoto","enableRowGoto","onRowGoto","rowGroups","useTableRowGroups","rowActionsForGroup","rowHeight","useTableRowHeight","enableRowHeight","rowSelection","useTableRowSelection","enableRowSelection","search","useTableSearch","enableSearch","excludeUnmatchedRecordsInSearch","server","useTableServerLoading","loadPage","loadAll","pageSize","columns","defaultState","mapTableChildrenToColumns","initialState","useReactTableInitialState","instance","useReactTable","data","configureReactTableOptions","enableGlobalFilter","useTableDataListener","useTableFilterListener","onChangeFilter","useTableFontSizeListener","useTableRowHeightListener","useTableRowSelectionListener","onRowSelect","useTableSearchListener","useTableServerLoadingListener","useTableSettingsListener","useTableShortcutsListener","shortcuts","useTableSortingListener","onChangeSort","useTableRef","length","_props$length","_instance$options$met","state","getState"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAuFgBA,QAAQA,CACpBC,KAA2B,EAC3BC,GAA8B,EAC9BC,IAA6C,EAC7CC,eAAgD;;;EAGhD,MAAMC,MAAM,GAAGJ,KAAK,CAACK,EAAE,CAACC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC;;EAEzC,MAAMC,OAAO,GAAGC,qBAAqB,CAACR,KAAK,CAAC;;EAG5C,MAAM,CAACS,QAAQ,EAAEC,WAAW,CAAC,GAAGC,gBAAgB,CAC5CJ,OAAO,CAACK,kBAAkB,EAC1BR,MAAM,EACNJ,KAAK,CAACa,eAAe,EACrBb,KAAK,CAACc,gBAAgB,CACzB;;EAGD,MAAMC,cAAc,GAAGC,sBAAsB,CAACT,OAAO,CAACU,oBAAoB,CAAC;EAC3E,MAAMC,cAAc,GAAGC,sBAAsB,CAACZ,OAAO,CAACa,oBAAoB,CAAC;EAC3E,MAAMC,QAAQ,GAAGC,gBAAgB,CAACf,OAAO,CAACgB,cAAc,EAAEd,QAAQ,CAACY,QAAQ,CAAC;EAC5E,MAAMG,MAAM,GAAGC,cAAc,CAAClB,OAAO,CAACmB,YAAY,CAAC;EACnD,MAAMC,QAAQ,GAAGC,gBAAgB,CAACrB,OAAO,CAACsB,cAAc,EAAEpB,QAAQ,CAACqB,mCAAmC,CAAC;EACvG,MAAMC,SAAS,GAAGC,iBAAiB,CAACzB,OAAO,CAAC0B,eAAe,EAAEjC,KAAK,CAACkC,qBAAqB,CAAC;EACzF,MAAMC,UAAU,GAAGC,kBAAkB,CAAQ7B,OAAO,CAAC8B,gBAAgB,EAAErC,KAAK,CAACmC,UAAU,EAAEnC,KAAK,CAACsC,gBAAgB,CAAC;EAChH,MAAMC,QAAQ,GAAGC,gBAAgB,CAAQj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AAQ;MACRG,MAAM;;MAENG,QAAQ;MACRQ,UAAU;MACVJ,SAAS;MACTQ,QAAQ,EAAEA,QAAe;MACzBI,YAAY;MACZI,OAAO;MACPI,SAAS;MACTG,SAAS;MACTG,YAAY;MACZG,MAAM;MACNI;;GAEP,CAAC;;EAGFe,oBAAoB,CAACL,QAAQ,CAAC;EAC9BM,sBAAsB,CAACN,QAAQ,EAAE1E,KAAK,CAACiF,cAAc,CAAC;EACtDC,wBAAwB,CAACR,QAAQ,CAAC;EAClCS,yBAAyB,CAACT,QAAQ,CAAC;EACnCU,4BAA4B,CAACV,QAAQ,EAAE1E,KAAK,CAACqF,WAAW,CAAC;EACzDC,sBAAsB,CAACZ,QAAQ,CAAC;EAChCa,6BAA6B,CAACb,QAAQ,EAAEV,MAAM,CAACE,QAAQ,CAAC;EACxDsB,wBAAwB,CAACd,QAAQ,EAAEhE,WAAW,CAAC;EAC/C+E,yBAAyB,CAACf,QAAQ,EAAE1E,KAAK,CAAC0F,SAAS,CAAC;EACpDC,uBAAuB,CAACjB,QAAQ,EAAE1E,KAAK,CAAC4F,YAAY,CAAC;;EAGrDC,WAAW,CAACnB,QAAQ,EAAEzE,GAAG,CAAC;EAE1B,OAAO;IACHI,EAAE,EAAED,MAAM;IACVsE,QAAQ;IACRoB,MAAM,GAAAC,aAAA,GAAE/F,KAAK,CAAC8F,MAAM,cAAAC,aAAA,cAAAA,aAAA,GAAI/F,KAAK,CAAC4E,IAAI,CAACkB,MAAM;IACzC5F,IAAI,GAAA8F,qBAAA,GAAGtB,QAAQ,CAACnE,OAAO,CAACL,IAAI,cAAA8F,qBAAA,cAAAA,qBAAA,GAAI,EAAoC;IACpEC,KAAK,EAAEvB,QAAQ,CAACwB,QAAQ;GAC3B;AACL;;;;"}
|
1
|
+
{"version":3,"file":"useTable.js","sources":["../../../../../../../../src/primitives/Table/useTable/useTable.ts"],"sourcesContent":["import { useReactTable, TableMeta as ReactTableMeta, RowData } from '@tanstack/react-table';\nimport {\n TableColumnAlignment,\n TableColumnClassNameHandler,\n TableColumnDataType,\n TableColumnMenu,\n TableColumnRendererControl,\n TableFilterComparator,\n TableRef,\n useTableInternalColumns,\n useTableProps,\n} from '../types';\nimport { useReactTableInitialState, configureReactTableOptions, mapTableChildrenToColumns } from './util/setup';\nimport { useTableFeaturePreset } from './util/presets';\nimport { useTableColumnFreezing } from './features/useTableColumnFreezing';\nimport { useTableColumnOrdering } from './features/useTableColumnOrdering';\nimport { useTableFooter } from './features/useTableFooter';\nimport { useTableFontSize } from './features/useTableFontSize';\nimport { useTablePrinting } from './features/useTablePrinting';\nimport { useTableRowActions } from './features/useTableRowActions';\nimport { useTableRowActive } from './features/useTableRowActive';\nimport { useTableRowClick } from './features/useTableRowClick';\nimport { useTableRowExpansion } from './features/useTableRowExpansion';\nimport { useTableRowGoto } from './features/useTableRowGoto';\nimport { useTableRowGroups } from './features/useTableRowGroups';\nimport { useTableRowHeight } from './features/useTableRowHeight';\nimport { useTableRowSelection } from './features/useTableRowSelection';\nimport { useTableSearch } from './features/useTableSearch';\nimport { useTableServerLoading } from './features/useTableServerLoading';\nimport { useTableSettings } from './features/useTableSettings';\nimport { useTableDataListener } from './listeners/useTableDataListener';\nimport { useTableFilterListener } from './listeners/useTableFilterListener';\nimport { useTableFontSizeListener } from './listeners/useTableFontSizeListener';\nimport { useTableRowHeightListener } from './listeners/useTableRowHeightListener';\nimport { useTableRowSelectionListener } from './listeners/useTableRowSelectionListener';\nimport { useTableSearchListener } from './listeners/useTableSearchListener';\nimport { useTableSettingsListener } from './listeners/useTableSettingsListener';\nimport { useTableShortcutsListener } from './listeners/useTableShortcutsListener';\nimport { useTableSortingListener } from './listeners/useTableSortingListener';\nimport { useTableServerLoadingListener } from './listeners/useTableServerLoadingListener';\nimport { useTableRef } from './features/useTableRef';\n\n/*\n EDITING THIS FILE? READ ME FIRST!\n\n This is a shared, common hook for multiple tables. It's feature set is specifically chosen to support features\n common across those tables. If you are adding a new feature or changing an existing one, before writing any code\n in this file ask yourself the question - is this specific to a given table, or is it common to all of them.\n If you are unsure, ask your team first.\n*/\n\ndeclare module '@tanstack/table-core' {\n interface TableMeta<TData extends RowData> {\n columnFreezing: ReturnType<typeof useTableColumnFreezing>;\n columnOrdering: ReturnType<typeof useTableColumnOrdering>;\n fontSize: ReturnType<typeof useTableFontSize>;\n footer: ReturnType<typeof useTableFooter>;\n length: number;\n printing: ReturnType<typeof useTablePrinting>;\n rowActions: ReturnType<typeof useTableRowActions>;\n rowActive: ReturnType<typeof useTableRowActive>;\n rowClick: ReturnType<typeof useTableRowClick>;\n rowExpansion: ReturnType<typeof useTableRowExpansion>;\n rowGoto: ReturnType<typeof useTableRowGoto>;\n rowGroups: ReturnType<typeof useTableRowGroups>;\n rowHeight: ReturnType<typeof useTableRowHeight>;\n rowSelection: ReturnType<typeof useTableRowSelection>;\n search: ReturnType<typeof useTableSearch>;\n server: ReturnType<typeof useTableServerLoading>;\n }\n\n interface ColumnMeta<TData extends RowData, TValue> {\n align?: TableColumnAlignment;\n className?: TableColumnClassNameHandler<TData>;\n control?: TableColumnRendererControl<TData>;\n dataType?: TableColumnDataType;\n enableOrdering?: boolean;\n enablePrinting?: boolean;\n enableTruncate?: boolean;\n filters?: TableFilterComparator[];\n header: string;\n headerClassName?: string;\n menu?: TableColumnMenu;\n tooltip?: string;\n }\n}\n\nexport function useTable<TType = unknown, TMeta = {}>(\n props: useTableProps<TType>,\n ref: React.RefObject<TableRef>,\n meta?: Partial<ReactTableMeta<TType>> & TMeta,\n internalColumns?: useTableInternalColumns<TType>\n) {\n // CSS.escape would be best here, but it doesn't seem to work very well\n const safeId = props.id.replace('.', '_');\n // configure table options, merging props with presets\n const options = useTableFeaturePreset(props);\n\n // load any persisted table settings and merge them with any defaults\n const [settings, setSettings] = useTableSettings(\n options.enableSaveSettings,\n safeId,\n props.defaultSettings,\n props.onChangeSettings\n );\n\n // configure common custom features\n const columnFreezing = useTableColumnFreezing(options.enableColumnFreezing);\n const columnOrdering = useTableColumnOrdering(options.enableColumnOrdering);\n const fontSize = useTableFontSize(options.enableFontSize, settings.fontSize);\n const footer = useTableFooter(options.enableFooter);\n const printing = useTablePrinting(options.enablePrinting, safeId);\n const rowActive = useTableRowActive(options.enableRowActive, props.defaultRowActiveIndex);\n const rowActions = useTableRowActions<TType>(options.enableRowActions, props.rowActions, props.rowActionsLength);\n const rowClick = useTableRowClick<TType>(options.enableRowClick, props.onRowClick);\n const rowExpansion = useTableRowExpansion<TType>(options.enableRowExpansion, props.rowExpansionRenderer);\n const rowGoto = useTableRowGoto(options.enableRowGoto, props.onRowGoto);\n const rowGroups = useTableRowGroups(props.rowActionsForGroup);\n const rowHeight = useTableRowHeight(options.enableRowHeight, settings.rowHeight);\n const rowSelection = useTableRowSelection(options.enableRowSelection);\n const search = useTableSearch(options.enableSearch, settings.excludeUnmatchedRecordsInSearch);\n const server = useTableServerLoading(props.loadPage, props.loadAll, props.pageSize);\n\n // TODO: memoise\n // convert jsx column components into valid table columns\n const { columns, ...defaultState } = mapTableChildrenToColumns<TType>(props, settings, options, internalColumns);\n\n // configure initial table state\n const initialState = useReactTableInitialState<TType>(props, columns, settings, defaultState);\n\n // ensure data is always valid\n const data = props.data ?? [];\n const length = props.length ?? data.length;\n\n // create a react-table instance\n // @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel\n const instance = useReactTable<TType>({\n data,\n columns,\n // configure initial table state\n initialState,\n // configure react-table built-in features\n ...configureReactTableOptions(options, props),\n // settings that can be toggled by the user, and therefore require our own state\n enableGlobalFilter: search.enableGlobalFilter,\n // custom context\n meta: {\n // spread features from specific implementations\n ...meta,\n columnFreezing,\n columnOrdering,\n fontSize,\n footer,\n length,\n printing,\n rowActions,\n rowActive,\n rowClick: rowClick as any,\n rowExpansion,\n rowGoto,\n rowGroups,\n rowHeight,\n rowSelection,\n search,\n server,\n },\n });\n\n // state listeners - we have these so that we don't have to control state outside the table\n useTableDataListener(instance);\n useTableFilterListener(instance, props.onChangeFilter);\n useTableFontSizeListener(instance);\n useTableRowHeightListener(instance);\n useTableRowSelectionListener(instance, props.onRowSelect);\n useTableSearchListener(instance);\n useTableServerLoadingListener(instance, server.loadPage);\n useTableSettingsListener(instance, setSettings);\n useTableShortcutsListener(instance, props.shortcuts);\n useTableSortingListener(instance, props.onChangeSort);\n\n // configure ref with reset functions\n useTableRef(instance, ref);\n\n return {\n id: safeId,\n instance,\n meta: (instance.options.meta ?? {}) as ReactTableMeta<TType> & TMeta,\n state: instance.getState(),\n };\n}\n"],"names":["useTable","props","ref","meta","internalColumns","safeId","id","replace","options","useTableFeaturePreset","settings","setSettings","useTableSettings","enableSaveSettings","defaultSettings","onChangeSettings","columnFreezing","useTableColumnFreezing","enableColumnFreezing","columnOrdering","useTableColumnOrdering","enableColumnOrdering","fontSize","useTableFontSize","enableFontSize","footer","useTableFooter","enableFooter","printing","useTablePrinting","enablePrinting","rowActive","useTableRowActive","enableRowActive","defaultRowActiveIndex","rowActions","useTableRowActions","enableRowActions","rowActionsLength","rowClick","useTableRowClick","enableRowClick","onRowClick","rowExpansion","useTableRowExpansion","enableRowExpansion","rowExpansionRenderer","rowGoto","useTableRowGoto","enableRowGoto","onRowGoto","rowGroups","useTableRowGroups","rowActionsForGroup","rowHeight","useTableRowHeight","enableRowHeight","rowSelection","useTableRowSelection","enableRowSelection","search","useTableSearch","enableSearch","excludeUnmatchedRecordsInSearch","server","useTableServerLoading","loadPage","loadAll","pageSize","columns","defaultState","mapTableChildrenToColumns","initialState","useReactTableInitialState","data","_props$data","length","_props$length","instance","useReactTable","configureReactTableOptions","enableGlobalFilter","useTableDataListener","useTableFilterListener","onChangeFilter","useTableFontSizeListener","useTableRowHeightListener","useTableRowSelectionListener","onRowSelect","useTableSearchListener","useTableServerLoadingListener","useTableSettingsListener","useTableShortcutsListener","shortcuts","useTableSortingListener","onChangeSort","useTableRef","_instance$options$met","state","getState"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAuFgBA,QAAQA,CACpBC,KAA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;MACNhD,QAAQ;MACRO,UAAU;MACVJ,SAAS;MACTQ,QAAQ,EAAEA,QAAe;MACzBI,YAAY;MACZI,OAAO;MACPI,SAAS;MACTG,SAAS;MACTG,YAAY;MACZG,MAAM;MACNI;;GAEP,CAAC;;EAGFkB,oBAAoB,CAACJ,QAAQ,CAAC;EAC9BK,sBAAsB,CAACL,QAAQ,EAAE7E,KAAK,CAACmF,cAAc,CAAC;EACtDC,wBAAwB,CAACP,QAAQ,CAAC;EAClCQ,yBAAyB,CAACR,QAAQ,CAAC;EACnCS,4BAA4B,CAACT,QAAQ,EAAE7E,KAAK,CAACuF,WAAW,CAAC;EACzDC,sBAAsB,CAACX,QAAQ,CAAC;EAChCY,6BAA6B,CAACZ,QAAQ,EAAEd,MAAM,CAACE,QAAQ,CAAC;EACxDyB,wBAAwB,CAACb,QAAQ,EAAEnE,WAAW,CAAC;EAC/CiF,yBAAyB,CAACd,QAAQ,EAAE7E,KAAK,CAAC4F,SAAS,CAAC;EACpDC,uBAAuB,CAAChB,QAAQ,EAAE7E,KAAK,CAAC8F,YAAY,CAAC;;EAGrDC,WAAW,CAAClB,QAAQ,EAAE5E,GAAG,CAAC;EAE1B,OAAO;IACHI,EAAE,EAAED,MAAM;IACVyE,QAAQ;IACR3E,IAAI,GAAA8F,qBAAA,GAAGnB,QAAQ,CAACtE,OAAO,CAACL,IAAI,cAAA8F,qBAAA,cAAAA,qBAAA,GAAI,EAAoC;IACpEC,KAAK,EAAEpB,QAAQ,CAACqB,QAAQ;GAC3B;AACL;;;;"}
|
@@ -36,13 +36,32 @@ function getCellValueAsString(value, dataType) {
|
|
36
36
|
}
|
37
37
|
return String(value);
|
38
38
|
}
|
39
|
+
function orderColumn(column, {
|
40
|
+
orderingDisabled,
|
41
|
+
orderingEnabled
|
42
|
+
}) {
|
43
|
+
const groupedColumn = column;
|
44
|
+
if (Array.isArray(groupedColumn.columns) && groupedColumn.columns.length > 0) {
|
45
|
+
groupedColumn.columns.forEach(subcolumn => orderColumn(subcolumn, {
|
46
|
+
orderingDisabled,
|
47
|
+
orderingEnabled
|
48
|
+
}));
|
49
|
+
} else {
|
50
|
+
var _column$meta;
|
51
|
+
if ((_column$meta = column.meta) !== null && _column$meta !== void 0 && _column$meta.enableOrdering) {
|
52
|
+
orderingEnabled.push(column.id);
|
53
|
+
} else {
|
54
|
+
orderingDisabled.push(column.id);
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
39
58
|
// ordering
|
40
59
|
function ensureOrdering(columns, settingsOrder, internalColumnsPinnedToTheRight = ['__actions']) {
|
41
60
|
// internal columns come with a defined order
|
42
61
|
const internalColumns = columns.filter(column => isInternalColumn(column.id) && !internalColumnsPinnedToTheRight.includes(String(column.id))).map(column => column.id);
|
43
62
|
// columns with ordering disabled should be moved to the front
|
44
63
|
const orderingDisabled = [];
|
45
|
-
|
64
|
+
let orderingEnabled = [];
|
46
65
|
let orderedColumns = columns;
|
47
66
|
// if settings is defined, make sure the columns that are actual children are sorted by it
|
48
67
|
if (Array.isArray(settingsOrder)) {
|
@@ -51,16 +70,23 @@ function ensureOrdering(columns, settingsOrder, internalColumnsPinnedToTheRight
|
|
51
70
|
(a, b) => (settingsOrder.indexOf(a.id) >>> 0) - (settingsOrder.indexOf(b.id) >>> 0));
|
52
71
|
}
|
53
72
|
orderedColumns.forEach(column => {
|
54
|
-
var _column$meta;
|
55
73
|
if (isInternalColumn(column.id)) {
|
56
74
|
return;
|
57
75
|
}
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
}
|
76
|
+
orderColumn(column, {
|
77
|
+
orderingDisabled,
|
78
|
+
orderingEnabled
|
79
|
+
});
|
63
80
|
});
|
81
|
+
if (settingsOrder && settingsOrder.length > 0) {
|
82
|
+
orderingEnabled = orderingEnabled.reduce((acc, column) => {
|
83
|
+
const index = settingsOrder.indexOf(column);
|
84
|
+
if (index > -1) {
|
85
|
+
acc[index] = column;
|
86
|
+
}
|
87
|
+
return acc;
|
88
|
+
}, []).filter(column => !!column);
|
89
|
+
}
|
64
90
|
const order = [...internalColumns, ...orderingDisabled, ...orderingEnabled];
|
65
91
|
// actions should always be last, enforce that
|
66
92
|
internalColumnsPinnedToTheRight.forEach(id => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"columns.js","sources":["../../../../../../../../../src/primitives/Table/useTable/util/columns.ts"],"sourcesContent":["import { ColumnDef as ReactTableColumnDef } from '@tanstack/react-table';\nimport { isDate } from 'date-fns';\nimport { FontSize, FontSizes } from '../../../../types';\nimport { format, parseFromISOString } from '../../../../utils/date';\nimport { TableColumnDataType } from '../../types';\n\nexport function isInternalColumn(id: string | undefined) {\n return id?.startsWith('__');\n}\n\n// column widths\nexport const getCellMinWidth = (fontSize: FontSize = 'medium') => {\n switch (fontSize) {\n case FontSizes.small:\n return 57;\n\n case FontSizes.large:\n return 83;\n\n default:\n case FontSizes.medium:\n return 72;\n }\n};\n\n// highlighting\nexport function isCellHighlighted(query: string, value: unknown, dataType?: TableColumnDataType) {\n if (value === undefined || value === null) {\n return false;\n }\n\n return String(getCellValueAsString(value, dataType)).toLocaleLowerCase().includes(query.toLocaleLowerCase());\n}\n\nexport function getCellValueAsString(value: unknown, dataType?: TableColumnDataType): string {\n if (value === undefined || value === null) {\n return '';\n } else if (isDate(value)) {\n return format(value as Date) ?? '';\n } else if (dataType === 'datetime' && typeof value === 'string') {\n return format(parseFromISOString(value as string)) ?? '';\n }\n\n return String(value);\n}\n\n// ordering\nexport function ensureOrdering<TType = unknown>(\n columns: ReactTableColumnDef<TType>[],\n settingsOrder: string[] | undefined,\n internalColumnsPinnedToTheRight: string[] = ['__actions']\n): string[] {\n // internal columns come with a defined order\n const internalColumns = columns\n .filter(column => isInternalColumn(column.id) && !internalColumnsPinnedToTheRight.includes(String(column.id)))\n .map(column => column.id) as string[];\n\n // columns with ordering disabled should be moved to the front\n const orderingDisabled: string[] = [];\n
|
1
|
+
{"version":3,"file":"columns.js","sources":["../../../../../../../../../src/primitives/Table/useTable/util/columns.ts"],"sourcesContent":["import { ColumnDef as ReactTableColumnDef, GroupColumnDef as ReactTableGroupColumnDef } from '@tanstack/react-table';\nimport { isDate } from 'date-fns';\nimport { FontSize, FontSizes } from '../../../../types';\nimport { format, parseFromISOString } from '../../../../utils/date';\nimport { TableColumnDataType } from '../../types';\n\nexport function isInternalColumn(id: string | undefined) {\n return id?.startsWith('__');\n}\n\n// column widths\nexport const getCellMinWidth = (fontSize: FontSize = 'medium') => {\n switch (fontSize) {\n case FontSizes.small:\n return 57;\n\n case FontSizes.large:\n return 83;\n\n default:\n case FontSizes.medium:\n return 72;\n }\n};\n\n// highlighting\nexport function isCellHighlighted(query: string, value: unknown, dataType?: TableColumnDataType) {\n if (value === undefined || value === null) {\n return false;\n }\n\n return String(getCellValueAsString(value, dataType)).toLocaleLowerCase().includes(query.toLocaleLowerCase());\n}\n\nexport function getCellValueAsString(value: unknown, dataType?: TableColumnDataType): string {\n if (value === undefined || value === null) {\n return '';\n } else if (isDate(value)) {\n return format(value as Date) ?? '';\n } else if (dataType === 'datetime' && typeof value === 'string') {\n return format(parseFromISOString(value as string)) ?? '';\n }\n\n return String(value);\n}\n\nfunction orderColumn<TType = unknown>(\n column: ReactTableColumnDef<TType>,\n { orderingDisabled, orderingEnabled }: { orderingDisabled: string[]; orderingEnabled: string[] }\n) {\n const groupedColumn = column as ReactTableGroupColumnDef<TType>;\n\n if (Array.isArray(groupedColumn.columns) && groupedColumn.columns.length > 0) {\n groupedColumn.columns.forEach((subcolumn: ReactTableColumnDef<TType>) =>\n orderColumn(subcolumn, { orderingDisabled, orderingEnabled })\n );\n } else {\n if (column.meta?.enableOrdering) {\n orderingEnabled.push(column.id as string);\n } else {\n orderingDisabled.push(column.id as string);\n }\n }\n}\n\n// ordering\nexport function ensureOrdering<TType = unknown>(\n columns: ReactTableColumnDef<TType>[],\n settingsOrder: string[] | undefined,\n internalColumnsPinnedToTheRight: string[] = ['__actions']\n): string[] {\n // internal columns come with a defined order\n const internalColumns = columns\n .filter(column => isInternalColumn(column.id) && !internalColumnsPinnedToTheRight.includes(String(column.id)))\n .map(column => column.id) as string[];\n\n // columns with ordering disabled should be moved to the front\n const orderingDisabled: string[] = [];\n let orderingEnabled: string[] = [];\n\n let orderedColumns = columns;\n\n // if settings is defined, make sure the columns that are actual children are sorted by it\n if (Array.isArray(settingsOrder)) {\n orderedColumns = columns.slice().sort(\n // the magic >>> 0 here ensures that columns that aren't found in settings, but are children, are pushed to the end\n (a, b) => (settingsOrder.indexOf(a.id as string) >>> 0) - (settingsOrder.indexOf(b.id as string) >>> 0)\n );\n }\n\n orderedColumns.forEach(column => {\n if (isInternalColumn(column.id)) {\n return;\n }\n\n orderColumn(column, { orderingDisabled, orderingEnabled });\n });\n\n if (settingsOrder && settingsOrder.length > 0) {\n orderingEnabled = orderingEnabled\n .reduce((acc, column) => {\n const index = settingsOrder.indexOf(column);\n if (index > -1) {\n acc[index] = column;\n }\n\n return acc;\n }, [] as string[])\n .filter(column => !!column);\n }\n\n const order = [...internalColumns, ...orderingDisabled, ...orderingEnabled];\n\n // actions should always be last, enforce that\n internalColumnsPinnedToTheRight.forEach(id => {\n if (columns.findIndex(column => column.id === id) > -1) {\n order.push(id);\n }\n });\n\n return order;\n}\n\n// freezing - we use the react-table pinning state, but that requires some mapping between them\nexport function unfreezeAllExternalColumns(leftPinnedState?: string[]): string[] {\n return leftPinnedState?.filter(id => isInternalColumn(id) && id !== '__actions') ?? [];\n}\n\nexport function freezeUptoExternalColumn(index: number, columns: string[]): string[] {\n return columns.slice(0, index + 1);\n}\n"],"names":["isInternalColumn","id","startsWith","getCellMinWidth","fontSize","FontSizes","small","large","medium","isCellHighlighted","query","value","dataType","undefined","String","getCellValueAsString","toLocaleLowerCase","includes","isDate","_format","format","_format2","parseFromISOString","orderColumn","column","orderingDisabled","orderingEnabled","groupedColumn","Array","isArray","columns","length","forEach","subcolumn","_column$meta","meta","enableOrdering","push","ensureOrdering","settingsOrder","internalColumnsPinnedToTheRight","internalColumns","filter","map","orderedColumns","slice","sort","a","b","indexOf","reduce","acc","index","order","findIndex","unfreezeAllExternalColumns","leftPinnedState","_leftPinnedState$filt","freezeUptoExternalColumn"],"mappings":";;;;SAMgBA,gBAAgBA,CAACC,EAAsB;EACnD,OAAOA,EAAE,aAAFA,EAAE,uBAAFA,EAAE,CAAEC,UAAU,CAAC,IAAI,CAAC;AAC/B;AAEA;MACaC,eAAe,GAAGA,CAACC,WAAqB,QAAQ;EACzD,QAAQA,QAAQ;IACZ,KAAKC,SAAS,CAACC,KAAK;MAChB,OAAO,EAAE;IAEb,KAAKD,SAAS,CAACE,KAAK;MAChB,OAAO,EAAE;IAEb;IACA,KAAKF,SAAS,CAACG,MAAM;MACjB,OAAO,EAAE;;AAErB;AAEA;SACgBC,iBAAiBA,CAACC,KAAa,EAAEC,KAAc,EAAEC,QAA8B;EAC3F,IAAID,KAAK,KAAKE,SAAS,IAAIF,KAAK,KAAK,IAAI,EAAE;IACvC,OAAO,KAAK;;EAGhB,OAAOG,MAAM,CAACC,oBAAoB,CAACJ,KAAK,EAAEC,QAAQ,CAAC,CAAC,CAACI,iBAAiB,EAAE,CAACC,QAAQ,CAACP,KAAK,CAACM,iBAAiB,EAAE,CAAC;AAChH;SAEgBD,oBAAoBA,CAACJ,KAAc,EAAEC,QAA8B;EAC/E,IAAID,KAAK,KAAKE,SAAS,IAAIF,KAAK,KAAK,IAAI,EAAE;IACvC,OAAO,EAAE;GACZ,MAAM,IAAIO,MAAM,CAACP,KAAK,CAAC,EAAE;IAAA,IAAAQ,OAAA;IACtB,QAAAA,OAAA,GAAOC,MAAM,CAACT,KAAa,CAAC,cAAAQ,OAAA,cAAAA,OAAA,GAAI,EAAE;GACrC,MAAM,IAAIP,QAAQ,KAAK,UAAU,IAAI,OAAOD,KAAK,KAAK,QAAQ,EAAE;IAAA,IAAAU,QAAA;IAC7D,QAAAA,QAAA,GAAOD,MAAM,CAACE,kBAAkB,CAACX,KAAe,CAAC,CAAC,cAAAU,QAA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BAAfA,eAAe,CAAEd,MAAM,CAACzC,EAAE,IAAID,gBAAgB,CAACC,EAAE,CAAC,IAAIA,EAAE,KAAK,WAAW,CAAC,cAAAwD,qBAAA,cAAAA,qBAAA,GAAI,EAAE;AAC1F;SAEgBC,wBAAwBA,CAACN,KAAa,EAAEtB,OAAiB;EACrE,OAAOA,OAAO,CAACe,KAAK,CAAC,CAAC,EAAEO,KAAK,GAAG,CAAC,CAAC;AACtC;;;;"}
|
@@ -12,7 +12,6 @@ function getSettings(table) {
|
|
12
12
|
fontSize: meta.fontSize.isEnabled ? meta.fontSize.size : undefined,
|
13
13
|
grouping: table.options.enableGrouping ? state.grouping : undefined,
|
14
14
|
rowHeight: meta.rowHeight.isEnabled ? meta.rowHeight.height : undefined,
|
15
|
-
showWarningWhenPrintingLargeDataset: meta.printing.isWarningVisibleForLargeDatasets,
|
16
15
|
//searchQuery: table.options.enableGlobalFilter ? state.globalFilter : undefined,
|
17
16
|
sorting: state.sorting
|
18
17
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"settings.js","sources":["../../../../../../../../../src/primitives/Table/useTable/util/settings.ts"],"sourcesContent":["import { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\n\nexport function getSettings<TType = unknown>(table: ReactTable<TType>) {\n const meta = table.options.meta as ReactTableMeta<TType>;\n const state = table.getState();\n\n return {\n //columnFilters: table.options.enableColumnFilters ? state.columnFilters : undefined,\n columnOrder: meta.columnOrdering.isEnabled ? state.columnOrder : undefined,\n columnPinning: state.columnPinning,\n columnSizing: state.columnSizing,\n columnVisibility: table.options.enableHiding ? state.columnVisibility : undefined,\n // @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel\n excludeUnmatchedRecordsInSearch: meta.search.excludeUnmatchedResults,\n fontSize: meta.fontSize.isEnabled ? meta.fontSize.size : undefined,\n grouping: table.options.enableGrouping ? state.grouping : undefined,\n rowHeight: meta.rowHeight.isEnabled ? meta.rowHeight.height : undefined,\n
|
1
|
+
{"version":3,"file":"settings.js","sources":["../../../../../../../../../src/primitives/Table/useTable/util/settings.ts"],"sourcesContent":["import { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\n\nexport function getSettings<TType = unknown>(table: ReactTable<TType>) {\n const meta = table.options.meta as ReactTableMeta<TType>;\n const state = table.getState();\n\n return {\n //columnFilters: table.options.enableColumnFilters ? state.columnFilters : undefined,\n columnOrder: meta.columnOrdering.isEnabled ? state.columnOrder : undefined,\n columnPinning: state.columnPinning,\n columnSizing: state.columnSizing,\n columnVisibility: table.options.enableHiding ? state.columnVisibility : undefined,\n // @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel\n excludeUnmatchedRecordsInSearch: meta.search.excludeUnmatchedResults,\n fontSize: meta.fontSize.isEnabled ? meta.fontSize.size : undefined,\n grouping: table.options.enableGrouping ? state.grouping : undefined,\n rowHeight: meta.rowHeight.isEnabled ? meta.rowHeight.height : undefined,\n //searchQuery: table.options.enableGlobalFilter ? state.globalFilter : undefined,\n sorting: state.sorting,\n };\n}\n"],"names":["getSettings","table","meta","options","state","getState","columnOrder","columnOrdering","isEnabled","undefined","columnPinning","columnSizing","columnVisibility","enableHiding","excludeUnmatchedRecordsInSearch","search","excludeUnmatchedResults","fontSize","size","grouping","enableGrouping","rowHeight","height","sorting"],"mappings":"SAEgBA,WAAWA,CAAkBC,KAAwB;EACjE,MAAMC,IAAI,GAAGD,KAAK,CAACE,OAAO,CAACD,IAA6B;EACxD,MAAME,KAAK,GAAGH,KAAK,CAACI,QAAQ,EAAE;EAE9B,OAAO;;IAEHC,WAAW,EAAEJ,IAAI,CAACK,cAAc,CAACC,SAAS,GAAGJ,KAAK,CAACE,WAAW,GAAGG,SAAS;IAC1EC,aAAa,EAAEN,KAAK,CAACM,aAAa;IAClCC,YAAY,EAAEP,KAAK,CAACO,YAAY;IAChCC,gBAAgB,EAAEX,KAAK,CAACE,OAAO,CAACU,YAAY,GAAGT,KAAK,CAACQ,gBAAgB,GAAGH,SAAS;;IAEjFK,+BAA+B,EAAEZ,IAAI,CAACa,MAAM,CAACC,uBAAuB;IACpEC,QAAQ,EAAEf,IAAI,CAACe,QAAQ,CAACT,SAAS,GAAGN,IAAI,CAACe,QAAQ,CAACC,IAAI,GAAGT,SAAS;IAClEU,QAAQ,EAAElB,KAAK,CAACE,OAAO,CAACiB,cAAc,GAAGhB,KAAK,CAACe,QAAQ,GAAGV,SAAS;IACnEY,SAAS,EAAEnB,IAAI,CAACmB,SAAS,CAACb,SAAS,GAAGN,IAAI,CAACmB,SAAS,CAACC,MAAM,GAAGb,SAAS;;IAEvEc,OAAO,EAAEnB,KAAK,CAACmB;GAClB;AACL;;;;"}
|
@@ -43,10 +43,19 @@ function isElementInsideOrTriggeredFromContainer(element, container) {
|
|
43
43
|
}
|
44
44
|
return !!(container !== null && container !== void 0 && container.contains(element));
|
45
45
|
}
|
46
|
-
function
|
47
|
-
|
46
|
+
function isElementInsideOverlay(element) {
|
47
|
+
return !!(element !== null && element !== void 0 && element.closest('[role=dialog],[role=menu]'));
|
48
|
+
}
|
49
|
+
function isSiblingElementInsideSameParentOverlay(element, sibling) {
|
50
|
+
var _element$closest2;
|
51
|
+
return !!(element !== null && element !== void 0 && (_element$closest2 = element.closest('[role=dialog],[role=menu]')) !== null && _element$closest2 !== void 0 && _element$closest2.contains(sibling));
|
52
|
+
}
|
53
|
+
function isElementInteractive(element) {
|
54
|
+
if (!element) {
|
55
|
+
return false;
|
56
|
+
}
|
48
57
|
return ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT', 'LABEL', 'OPTION'].includes(element.tagName) && !element.hidden && !element.disabled && !element.readOnly;
|
49
58
|
}
|
50
59
|
|
51
|
-
export { getIndexOfFirstChildOverflowingParent, getNextFocussableElement, isElementInsideOrTriggeredFromContainer,
|
60
|
+
export { getIndexOfFirstChildOverflowingParent, getNextFocussableElement, isElementInsideOrTriggeredFromContainer, isElementInsideOverlay, isElementInteractive, isSiblingElementInsideSameParentOverlay };
|
52
61
|
//# sourceMappingURL=dom.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dom.js","sources":["../../../../../../src/utils/dom.ts"],"sourcesContent":["export const isOverflowing = (element: HTMLElement | null) =>\n element !== null ? element.scrollWidth > element.offsetWidth : false;\n\nexport const getIndexOfFirstChildOverflowingParent = (element: HTMLElement, overscan = 0) => {\n let index = 0;\n let boundaryChildIndex: number | null = null;\n const clientRect = element.getBoundingClientRect();\n\n for (const child of Array.from(element.children)) {\n const right = child.getBoundingClientRect().right - clientRect.left;\n const width = clientRect.width - overscan;\n\n if (right > width) {\n boundaryChildIndex = index;\n break;\n }\n index++;\n }\n\n return boundaryChildIndex;\n};\n\nexport const getNextFocussableElement = (currentElement: HTMLElement | null) => {\n if (!currentElement) {\n return null;\n }\n\n const focussableElements = [\n ...document.querySelectorAll<HTMLElement>(\n 'button:not([disabled]), [href]:not(link):not(script), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"]):not([disabled]), details:not([disabled]), summary:not(:disabled)'\n ),\n ];\n const currentElementIndex = focussableElements.indexOf(currentElement);\n\n // If the currentElement is not in the focussable elements list or it is the last element\n if (currentElementIndex !== -1 && currentElementIndex === focussableElements.length - 1) {\n return null;\n }\n\n return focussableElements[currentElementIndex + 1];\n};\n\nconst getOverlaySelector = (element: Element | null) => {\n switch (element?.getAttribute('role')) {\n case 'dialog':\n return `[aria-controls='${element.id}']`;\n\n case 'menu':\n return `#${element.getAttribute('aria-labelledby')}`;\n\n default:\n return undefined;\n }\n};\n\nexport function isElementInsideOrTriggeredFromContainer(element: Element | null, container: Element | null) {\n const selector = getOverlaySelector(element) ?? getOverlaySelector(element?.closest('[role=dialog],[role=menu]') ?? null);\n\n if (selector) {\n return !!container?.querySelector(selector);\n }\n\n return !!container?.contains(element);\n}\n\nexport function
|
1
|
+
{"version":3,"file":"dom.js","sources":["../../../../../../src/utils/dom.ts"],"sourcesContent":["export const isOverflowing = (element: HTMLElement | null) =>\n element !== null ? element.scrollWidth > element.offsetWidth : false;\n\nexport const getIndexOfFirstChildOverflowingParent = (element: HTMLElement, overscan = 0) => {\n let index = 0;\n let boundaryChildIndex: number | null = null;\n const clientRect = element.getBoundingClientRect();\n\n for (const child of Array.from(element.children)) {\n const right = child.getBoundingClientRect().right - clientRect.left;\n const width = clientRect.width - overscan;\n\n if (right > width) {\n boundaryChildIndex = index;\n break;\n }\n index++;\n }\n\n return boundaryChildIndex;\n};\n\nexport const getNextFocussableElement = (currentElement: HTMLElement | null) => {\n if (!currentElement) {\n return null;\n }\n\n const focussableElements = [\n ...document.querySelectorAll<HTMLElement>(\n 'button:not([disabled]), [href]:not(link):not(script), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"]):not([disabled]), details:not([disabled]), summary:not(:disabled)'\n ),\n ];\n const currentElementIndex = focussableElements.indexOf(currentElement);\n\n // If the currentElement is not in the focussable elements list or it is the last element\n if (currentElementIndex !== -1 && currentElementIndex === focussableElements.length - 1) {\n return null;\n }\n\n return focussableElements[currentElementIndex + 1];\n};\n\nconst getOverlaySelector = (element: Element | null) => {\n switch (element?.getAttribute('role')) {\n case 'dialog':\n return `[aria-controls='${element.id}']`;\n\n case 'menu':\n return `#${element.getAttribute('aria-labelledby')}`;\n\n default:\n return undefined;\n }\n};\n\nexport function isElementInsideOrTriggeredFromContainer(element: Element | null, container: Element | null) {\n const selector = getOverlaySelector(element) ?? getOverlaySelector(element?.closest('[role=dialog],[role=menu]') ?? null);\n\n if (selector) {\n return !!container?.querySelector(selector);\n }\n\n return !!container?.contains(element);\n}\n\nexport function isElementInsideOverlay(element: Element | null) {\n return !!element?.closest('[role=dialog],[role=menu]');\n}\n\nexport function isSiblingElementInsideSameParentOverlay(element: Element | null, sibling: Element | null) {\n return !!element?.closest('[role=dialog],[role=menu]')?.contains(sibling);\n}\n\nexport function isElementInteractive(element: Element | null) {\n if (!element) {\n return false;\n }\n\n return (\n ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT', 'LABEL', 'OPTION'].includes(element.tagName) &&\n !(element as HTMLElement).hidden &&\n !(element as HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | HTMLButtonElement).disabled &&\n !(element as HTMLInputElement | HTMLTextAreaElement).readOnly\n );\n}\n"],"names":["getIndexOfFirstChildOverflowingParent","element","overscan","index","boundaryChildIndex","clientRect","getBoundingClientRect","child","Array","from","children","right","left","width","getNextFocussableElement","currentElement","focussableElements","document","querySelectorAll","currentElementIndex","indexOf","length","getOverlaySelector","getAttribute","id","undefined","isElementInsideOrTriggeredFromContainer","container","selector","_getOverlaySelector","_element$closest","closest","querySelector","contains","isElementInsideOverlay","isSiblingElementInsideSameParentOverlay","sibling","_element$closest2","isElementInteractive","includes","tagName","hidden","disabled","readOnly"],"mappings":"MAGaA,qCAAqC,GAAGA,CAACC,OAAoB,EAAEC,QAAQ,GAAG,CAAC;EACpF,IAAIC,KAAK,GAAG,CAAC;EACb,IAAIC,kBAAkB,GAAkB,IAAI;EAC5C,MAAMC,UAAU,GAAGJ,OAAO,CAACK,qBAAqB,EAAE;EAElD,KAAK,MAAMC,KAAK,IAAIC,KAAK,CAACC,IAAI,CAACR,OAAO,CAACS,QAAQ,CAAC,EAAE;IAC9C,MAAMC,KAAK,GAAGJ,KAAK,CAACD,qBAAqB,EAAE,CAACK,KAAK,GAAGN,UAAU,CAACO,IAAI;IACnE,MAAMC,KAAK,GAAGR,UAAU,CAACQ,KAAK,GAAGX,QAAQ;IAEzC,IAAIS,KAAK,GAAGE,KAAK,EAAE;MACfT,kBAAkB,GAAGD,KAAK;MAC1B;;IAEJA,KAAK,EAAE;;EAGX,OAAOC,kBAAkB;AAC7B;MAEaU,wBAAwB,GAAIC,cAAkC;EACvE,IAAI,CAACA,cAAc,EAAE;IACjB,OAAO,IAAI;;EAGf,MAAMC,kBAAkB,GAAG,CACvB,GAAGC,QAAQ,CAACC,gBAAgB,CACxB,i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AEmC,OAAuB;;EACpG,OAAO,CAAC,EAACnC,OAAO,aAAPA,OAAO,gBAAAoC,iBAAA,GAAPpC,OAAO,CAAE8B,OAAO,CAAC,2BAA2B,CAAC,cAAAM,iBAAA,eAA7CA,iBAAA,CAA+CJ,QAAQ,CAACG,OAAO,CAAC;AAC7E;SAEgBE,oBAAoBA,CAACrC,OAAuB;EACxD,IAAI,CAACA,OAAO,EAAE;IACV,OAAO,KAAK;;EAGhB,OACI,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAACsC,QAAQ,CAACtC,OAAO,CAACuC,OAAO,CAAC,IAC3F,CAAEvC,OAAuB,CAACwC,MAAM,IAChC,CAAExC,OAA0F,CAACyC,QAAQ,IACrG,CAAEzC,OAAkD,CAAC0C,QAAQ;AAErE;;;;"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { isElementInteractive } from './dom.js';
|
2
2
|
|
3
3
|
function isPressingMetaKey(event) {
|
4
4
|
return isMacOs() ? event.metaKey : event.ctrlKey;
|
@@ -19,7 +19,7 @@ function shouldTriggerShortcut(event, key) {
|
|
19
19
|
}
|
20
20
|
function createShortcutKeyDownHandler(key, handler, stopPropagation = true) {
|
21
21
|
return function (event) {
|
22
|
-
if (event.target !== event.currentTarget &&
|
22
|
+
if (event.target !== event.currentTarget && isElementInteractive(event.target) && !isPressingMetaKey(event)) {
|
23
23
|
return;
|
24
24
|
}
|
25
25
|
const condition = shouldTriggerShortcut(event, key);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"keyboard.js","sources":["../../../../../../src/utils/keyboard.ts"],"sourcesContent":["import React from 'react';\nimport {
|
1
|
+
{"version":3,"file":"keyboard.js","sources":["../../../../../../src/utils/keyboard.ts"],"sourcesContent":["import React from 'react';\nimport { isElementInteractive } from './dom';\n\nexport type KeyDownHandlerOptions = { key: string; meta?: boolean; shift?: boolean };\n\nexport function isPressingMetaKey<T = Element>(event: KeyboardEvent | React.KeyboardEvent<T>) {\n return isMacOs() ? event.metaKey : event.ctrlKey;\n}\n\nexport function shouldTriggerShortcut<T = Element>(\n event: KeyboardEvent | React.KeyboardEvent<T>,\n key: string | KeyDownHandlerOptions\n) {\n const keyOptions: KeyDownHandlerOptions = typeof key === 'string' ? { key, meta: false, shift: false } : key;\n\n if (\n (keyOptions.meta && (isMacOs() ? !event.metaKey : !event.ctrlKey)) ||\n (!keyOptions.meta && (isMacOs() ? event.metaKey : event.ctrlKey))\n ) {\n return false;\n }\n\n if ((keyOptions.shift && !event.shiftKey) || (keyOptions.shift === false && event.shiftKey)) {\n return false;\n }\n\n return event.key.toLowerCase() === keyOptions.key.toLowerCase();\n}\n\nexport function createShortcutKeyDownHandler<T = Element>(\n key: string | KeyDownHandlerOptions,\n handler: (event: KeyboardEvent | React.KeyboardEvent<T>) => void,\n stopPropagation = true\n) {\n return function (event: KeyboardEvent | React.KeyboardEvent<T>) {\n if (\n event.target !== event.currentTarget &&\n isElementInteractive(event.target as HTMLElement) &&\n !isPressingMetaKey(event)\n ) {\n return;\n }\n\n const condition = shouldTriggerShortcut(event, key);\n\n if (condition) {\n if (stopPropagation) {\n // stops react handlers bubbling up to global\n event.stopPropagation();\n // stops global handlers bubbling up to other global\n (event as KeyboardEvent).stopImmediatePropagation?.();\n }\n\n handler(event);\n }\n };\n}\n\nexport const isMacOs = () => window?.navigator.userAgent.includes('Mac');\n"],"names":["isPressingMetaKey","event","isMacOs","metaKey","ctrlKey","shouldTriggerShortcut","key","keyOptions","meta","shift","shiftKey","toLowerCase","createShortcutKeyDownHandler","handler","stopPropagation","target","currentTarget","isElementInteractive","condition","_event$stopImmediateP","stopImmediatePropagation","call","_window","window","navigator","userAgent","includes"],"mappings":";;SAKgBA,iBAAiBA,CAAcC,KAA6C;EACxF,OAAOC,OAAO,EAAE,GAAGD,KAAK,CAACE,OAAO,GAAGF,KAAK,CAACG,OAAO;AACpD;SAE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GzDY,OAAO,CAACZ,KAAK,CAAC;;GAErB;AACL;MAEaC,OAAO,GAAGA;EAAA,IAAAoB,OAAA;EAAA,QAAAA,OAAA,GAAMC,MAAM,cAAAD,OAAA,uBAANA,OAAA,CAAQE,SAAS,CAACC,SAAS,CAACC,QAAQ,CAAC,KAAK,CAAC;AAAA;;;;"}
|
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
import React from 'react';
|
2
|
+
export declare const useLocalStorage: <TType>(key?: string | undefined, initialValue?: TType | undefined) => [TType, React.Dispatch<React.SetStateAction<TType>>, () => void];
|
package/dist/index.css
CHANGED
@@ -282,51 +282,9 @@
|
|
282
282
|
@apply font-semibold;
|
283
283
|
}
|
284
284
|
|
285
|
-
[data-taco='
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
[data-taco='scrollable-list'] li > [data-taco='icon'] {
|
290
|
-
@apply mr-2;
|
291
|
-
}
|
292
|
-
|
293
|
-
[data-taco='scrollable-list']:not([readonly]) li:not([disabled]):hover {
|
294
|
-
@apply wcag-grey-200;
|
295
|
-
}
|
296
|
-
|
297
|
-
[data-taco='scrollable-list']:not([readonly]) li:not([disabled]):hover [data-taco='icon'] {
|
298
|
-
@apply wcag-grey-200;
|
299
|
-
}
|
300
|
-
|
301
|
-
[data-taco='scrollable-list'] li:focus,
|
302
|
-
[data-taco='scrollable-list']:not(.yt-list--multiselect) li[aria-selected='true'],
|
303
|
-
[data-taco='scrollable-list'] li[data-focused='true'] {
|
304
|
-
@apply wcag-blue-500;
|
305
|
-
}
|
306
|
-
|
307
|
-
[data-taco='scrollable-list'] li:focus [data-taco='icon'],
|
308
|
-
[data-taco='scrollable-list']:not(.yt-list--multiselect) li[aria-selected='true'] [data-taco='icon'],
|
309
|
-
[data-taco='scrollable-list'] li[data-focused='true'] [data-taco='icon'] {
|
310
|
-
@apply wcag-blue-500;
|
311
|
-
}
|
312
|
-
|
313
|
-
[data-taco='scrollable-list'][readonly] li {
|
314
|
-
@apply cursor-not-allowed;
|
315
|
-
}
|
316
|
-
|
317
|
-
[data-taco='scrollable-list'] li[disabled],
|
318
|
-
[data-taco='scrollable-list'][disabled] li[aria-selected='true'] {
|
319
|
-
@apply cursor-not-allowed text-black text-opacity-25;
|
320
|
-
}
|
321
|
-
|
322
|
-
[data-taco='scrollable-list'] li.yt-list__empty,
|
323
|
-
[data-taco='scrollable-list'] li.yt-list__empty:hover,
|
324
|
-
[data-taco='scrollable-list'] li.yt-list__empty:focus {
|
325
|
-
@apply text-grey-700 flex w-full items-center overflow-hidden bg-white px-3 italic;
|
326
|
-
}
|
327
|
-
|
328
|
-
[data-taco='scrollable-list'] li.yt-list__empty [data-taco='spinner'] {
|
329
|
-
@apply mr-2 mt-2 h-5 w-5 opacity-75;
|
285
|
+
[data-taco='card'] [data-taco='report'],
|
286
|
+
[data-taco='card'] [data-taco='table2'] {
|
287
|
+
@apply !border-0;
|
330
288
|
}
|
331
289
|
|
332
290
|
[data-taco='spinner'] svg circle {
|
@@ -404,6 +362,53 @@
|
|
404
362
|
stroke: currentColor;
|
405
363
|
}
|
406
364
|
|
365
|
+
[data-taco='scrollable-list'].yt-list--multiselect li:first-child {
|
366
|
+
@apply border-grey-100 border-b-2 pl-4; /* Listbox max-height is dependant on this border-bottom-width value! */
|
367
|
+
}
|
368
|
+
|
369
|
+
[data-taco='scrollable-list'] li > [data-taco='icon'] {
|
370
|
+
@apply mr-2;
|
371
|
+
}
|
372
|
+
|
373
|
+
[data-taco='scrollable-list']:not([readonly]) li:not([disabled]):hover {
|
374
|
+
@apply wcag-grey-200;
|
375
|
+
}
|
376
|
+
|
377
|
+
[data-taco='scrollable-list']:not([readonly]) li:not([disabled]):hover [data-taco='icon'] {
|
378
|
+
@apply wcag-grey-200;
|
379
|
+
}
|
380
|
+
|
381
|
+
[data-taco='scrollable-list'] li:focus,
|
382
|
+
[data-taco='scrollable-list']:not(.yt-list--multiselect) li[aria-selected='true'],
|
383
|
+
[data-taco='scrollable-list'] li[data-focused='true'] {
|
384
|
+
@apply wcag-blue-500;
|
385
|
+
}
|
386
|
+
|
387
|
+
[data-taco='scrollable-list'] li:focus [data-taco='icon'],
|
388
|
+
[data-taco='scrollable-list']:not(.yt-list--multiselect) li[aria-selected='true'] [data-taco='icon'],
|
389
|
+
[data-taco='scrollable-list'] li[data-focused='true'] [data-taco='icon'] {
|
390
|
+
@apply wcag-blue-500;
|
391
|
+
}
|
392
|
+
|
393
|
+
[data-taco='scrollable-list'][readonly] li {
|
394
|
+
@apply cursor-not-allowed;
|
395
|
+
}
|
396
|
+
|
397
|
+
[data-taco='scrollable-list'] li[disabled],
|
398
|
+
[data-taco='scrollable-list'][disabled] li[aria-selected='true'] {
|
399
|
+
@apply cursor-not-allowed text-black text-opacity-25;
|
400
|
+
}
|
401
|
+
|
402
|
+
[data-taco='scrollable-list'] li.yt-list__empty,
|
403
|
+
[data-taco='scrollable-list'] li.yt-list__empty:hover,
|
404
|
+
[data-taco='scrollable-list'] li.yt-list__empty:focus {
|
405
|
+
@apply text-grey-700 flex w-full items-center overflow-hidden bg-white px-3 italic;
|
406
|
+
}
|
407
|
+
|
408
|
+
[data-taco='scrollable-list'] li.yt-list__empty [data-taco='spinner'] {
|
409
|
+
@apply mr-2 mt-2 h-5 w-5 opacity-75;
|
410
|
+
}
|
411
|
+
|
407
412
|
[data-taco='combobox'] > [aria-expanded='true'] + [role='dialog'] > ul,
|
408
413
|
[data-taco='combobox'] > [aria-expanded='true'] + [role='dialog'] > ul:hover {
|
409
414
|
@apply border-blue-500;
|
@@ -574,9 +579,13 @@ table[data-taco='report'] tfoot {
|
|
574
579
|
/* z-indexes & layout */
|
575
580
|
@apply sticky bottom-0 isolate z-20;
|
576
581
|
/* grid */
|
577
|
-
@apply col-span-full grid
|
582
|
+
@apply col-span-full grid grid-cols-[subgrid] grid-rows-[calc(theme(spacing.10)_+_2px)];
|
578
583
|
}
|
579
584
|
|
585
|
+
table[data-taco='report'] tfoot > tr {
|
586
|
+
@apply grid-rows-[calc(theme(spacing.10)_+_2px)];
|
587
|
+
}
|
588
|
+
|
580
589
|
table[data-taco='report'] tbody {
|
581
590
|
/* z-indexes & layout */
|
582
591
|
@apply isolate z-10;
|
@@ -100,7 +100,6 @@ export declare type TableSettings = {
|
|
100
100
|
fontSize?: TableFontSize;
|
101
101
|
grouping?: ReactTableGroupingState;
|
102
102
|
rowHeight?: TableRowHeight;
|
103
|
-
showWarningWhenPrintingLargeDataset?: boolean;
|
104
103
|
searchQuery?: string;
|
105
104
|
sorting?: ReactTableSortingState;
|
106
105
|
};
|
@@ -113,7 +112,6 @@ export declare type EnableSettingsOptions = {
|
|
113
112
|
fontSize: boolean;
|
114
113
|
grouping: boolean;
|
115
114
|
rowHeight: boolean;
|
116
|
-
showWarningWhenPrintingLargeDataset: boolean;
|
117
115
|
sorting: boolean;
|
118
116
|
};
|
119
117
|
export declare type TableFeatureProps = {
|
@@ -1,8 +1,15 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
|
2
|
+
declare type TablePrintSettings = {
|
3
|
+
allRows: boolean;
|
4
|
+
orientation: 'portrait' | 'landscape';
|
5
|
+
size: 'A3' | 'A4' | 'A5' | 'letter' | 'legal';
|
6
|
+
splitGroups: boolean;
|
7
|
+
};
|
8
|
+
export declare function useTablePrinting(isEnabled: boolean | undefined, tableId: string): {
|
3
9
|
isEnabled: boolean;
|
4
10
|
isPrinting: boolean;
|
5
11
|
setIsPrinting: React.Dispatch<React.SetStateAction<boolean>>;
|
6
|
-
|
7
|
-
|
12
|
+
settings: TablePrintSettings;
|
13
|
+
setSetting: (key: "allRows" | "orientation" | "size" | "splitGroups", value: any) => void;
|
8
14
|
};
|
15
|
+
export {};
|