@economic/taco 2.27.1 → 2.27.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/esm/index.css +9 -3
- package/dist/esm/packages/taco/src/components/Provider/Localization.js +3 -3
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/TextareaWithAutosizing.js +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/TextareaWithAutosizing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +7 -2
- package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/util.js +3 -7
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/util.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js +2 -2
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleColumnFreezing.js +19 -6
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleColumnFreezing.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/useTableDataLoader.js +45 -12
- package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFontSizeListener.js +9 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFontSizeListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js +7 -3
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js +1 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js +15 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +6 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
- package/dist/index.css +9 -3
- package/dist/primitives/Table/Core/components/Columns/Cell/util.d.ts +0 -1
- package/dist/primitives/Table/types.d.ts +6 -7
- package/dist/primitives/Table/useTableDataLoader.d.ts +5 -4
- package/dist/primitives/Table/useTableManager/listeners/useTableSearchListener.d.ts +2 -1
- package/dist/primitives/Table/useTableManager/util/settings.d.ts +2 -1
- package/dist/taco.cjs.development.js +135 -63
- 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/package.json +2 -2
@@ -4572,12 +4572,12 @@ const defaultLocalisationTexts = {
|
|
4572
4572
|
},
|
4573
4573
|
validation: {
|
4574
4574
|
alert: {
|
4575
|
-
titleOne: '[COUNT] unsaved entry:
|
4576
|
-
titlePlural: '[COUNT] unsaved entries:
|
4575
|
+
titleOne: '[COUNT] unsaved entry:',
|
4576
|
+
titlePlural: '[COUNT] unsaved entries:',
|
4577
4577
|
messageOne: "[COLUMN] [ROW] is incomplete and hasn't been saved.",
|
4578
4578
|
messagePlural: "[COLUMN] [ROW] are incomplete and haven't been saved.",
|
4579
4579
|
messageRow: 'Row',
|
4580
|
-
messageAnd: '
|
4580
|
+
messageAnd: 'and'
|
4581
4581
|
},
|
4582
4582
|
resetFiltersDialog: {
|
4583
4583
|
title: 'Row is hidden',
|
@@ -9523,6 +9523,36 @@ function globalFilterFn(row, columnId, searchQuery) {
|
|
9523
9523
|
return false;
|
9524
9524
|
}
|
9525
9525
|
|
9526
|
+
function getSettings(table) {
|
9527
|
+
const meta = table.options.meta;
|
9528
|
+
const state = table.getState();
|
9529
|
+
return {
|
9530
|
+
// commented out properties are here to highlight things we explicitly don't want them saved
|
9531
|
+
//columnFilters: table.options.enableColumnFilters ? state.columnFilters : undefined,
|
9532
|
+
columnOrder: meta.columnOrdering.isEnabled ? state.columnOrder : undefined,
|
9533
|
+
columnPinning: state.columnPinning,
|
9534
|
+
columnSizing: ignoreInternalColumns(state.columnSizing),
|
9535
|
+
columnVisibility: table.options.enableHiding ? state.columnVisibility : undefined,
|
9536
|
+
excludeUnmatchedRecordsInSearch: table.options.enableGlobalFilter,
|
9537
|
+
fontSize: meta.fontSize.isEnabled ? meta.fontSize.size : undefined,
|
9538
|
+
//grouping: table.options.enableGrouping ? state.grouping : undefined,
|
9539
|
+
rowHeight: meta.rowHeight.isEnabled ? meta.rowHeight.height : undefined,
|
9540
|
+
//searchQuery: table.options.enableGlobalFilter ? state.globalFilter : undefined,
|
9541
|
+
sorting: state.sorting
|
9542
|
+
};
|
9543
|
+
}
|
9544
|
+
function ignoreInternalColumns(data) {
|
9545
|
+
return Object.keys(data).reduce((accum, key) => {
|
9546
|
+
if (isInternalColumn(key)) {
|
9547
|
+
return accum;
|
9548
|
+
}
|
9549
|
+
return {
|
9550
|
+
...accum,
|
9551
|
+
[key]: data[key]
|
9552
|
+
};
|
9553
|
+
}, {});
|
9554
|
+
}
|
9555
|
+
|
9526
9556
|
// mapping children to react-table columns
|
9527
9557
|
function processChildren(child, columns, defaultSizing, defaultSorting, defaultVisibility, settings, defaultRowGroupColumnId) {
|
9528
9558
|
const columnHelper = reactTable.createColumnHelper();
|
@@ -9608,7 +9638,10 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
|
|
9608
9638
|
column.cell = info => renderer(info.getValue(), info.row.original);
|
9609
9639
|
}
|
9610
9640
|
if (typeof footer === 'function') {
|
9611
|
-
column.footer = info => footer(info.table.getRowModel().rows.
|
9641
|
+
column.footer = info => footer(info.table.getRowModel().rows.flatMap(row => {
|
9642
|
+
var _row$original;
|
9643
|
+
return ((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original[id]) !== undefined ? [row.original[id]] : [];
|
9644
|
+
}));
|
9612
9645
|
}
|
9613
9646
|
// config - filtering
|
9614
9647
|
if (enableColumnFilter) {
|
@@ -9775,7 +9808,7 @@ function useReactTableInitialState(props, columns, persistedSettings, defaults)
|
|
9775
9808
|
columnFilters: (_ref2 = (_persistedSettings$co3 = persistedSettings.columnFilters) !== null && _persistedSettings$co3 !== void 0 ? _persistedSettings$co3 : (_props$defaultSetting3 = props.defaultSettings) === null || _props$defaultSetting3 === void 0 ? void 0 : _props$defaultSetting3.columnFilters) !== null && _ref2 !== void 0 ? _ref2 : [],
|
9776
9809
|
columnOrder,
|
9777
9810
|
columnPinning,
|
9778
|
-
columnSizing: (_ref3 = (_ref4 = (_persistedSettings$co4 = persistedSettings.columnSizing) !== null && _persistedSettings$co4 !== void 0 ? _persistedSettings$co4 : (_props$defaultSetting4 = props.defaultSettings) === null || _props$defaultSetting4 === void 0 ? void 0 : _props$defaultSetting4.columnSizing) !== null && _ref4 !== void 0 ? _ref4 : defaults.defaultSizing) !== null && _ref3 !== void 0 ? _ref3 : {},
|
9811
|
+
columnSizing: ignoreInternalColumns((_ref3 = (_ref4 = (_persistedSettings$co4 = persistedSettings.columnSizing) !== null && _persistedSettings$co4 !== void 0 ? _persistedSettings$co4 : (_props$defaultSetting4 = props.defaultSettings) === null || _props$defaultSetting4 === void 0 ? void 0 : _props$defaultSetting4.columnSizing) !== null && _ref4 !== void 0 ? _ref4 : defaults.defaultSizing) !== null && _ref3 !== void 0 ? _ref3 : {}),
|
9779
9812
|
columnVisibility: (_ref5 = (_ref6 = (_persistedSettings$co5 = persistedSettings.columnVisibility) !== null && _persistedSettings$co5 !== void 0 ? _persistedSettings$co5 : (_props$defaultSetting5 = props.defaultSettings) === null || _props$defaultSetting5 === void 0 ? void 0 : _props$defaultSetting5.columnVisibility) !== null && _ref6 !== void 0 ? _ref6 : defaults.defaultVisibility) !== null && _ref5 !== void 0 ? _ref5 : {},
|
9780
9813
|
globalFilter: (_persistedSettings$se = persistedSettings.searchQuery) !== null && _persistedSettings$se !== void 0 ? _persistedSettings$se : (_props$defaultSetting6 = props.defaultSettings) === null || _props$defaultSetting6 === void 0 ? void 0 : _props$defaultSetting6.searchQuery,
|
9781
9814
|
sorting: persistedSettings.sorting ? persistedSettings.sorting.filter(ignoreNotDefinedColumns) : (_props$defaultSetting7 = (_props$defaultSetting8 = props.defaultSettings) === null || _props$defaultSetting8 === void 0 ? void 0 : _props$defaultSetting8.sorting) !== null && _props$defaultSetting7 !== void 0 ? _props$defaultSetting7 : defaults.defaultSorting
|
@@ -10292,7 +10325,7 @@ function _finallyRethrows(body, finalizer) {
|
|
10292
10325
|
}
|
10293
10326
|
|
10294
10327
|
const DEFAULT_PAGE_SIZE = 100;
|
10295
|
-
function useTableDataLoader(
|
10328
|
+
function useTableDataLoader(fetchPage, fetchAll, options = {
|
10296
10329
|
pageSize: DEFAULT_PAGE_SIZE
|
10297
10330
|
}) {
|
10298
10331
|
const {
|
@@ -10308,11 +10341,11 @@ function useTableDataLoader(fetch, fetchAll, options = {
|
|
10308
10341
|
const _lastUsedFilters = React__default.useRef([]);
|
10309
10342
|
const _lastUsedSearch = React__default.useRef();
|
10310
10343
|
const _forceReset = React__default.useRef(false);
|
10311
|
-
const loadPage = function (pageIndex, sorting, filters
|
10344
|
+
const loadPage = function (pageIndex, sorting, filters) {
|
10312
10345
|
try {
|
10313
10346
|
let reset = false;
|
10314
10347
|
// sorting or filters changed, reset everything
|
10315
|
-
if (_forceReset.current ||
|
10348
|
+
if (_forceReset.current || JSON.stringify(sorting) !== JSON.stringify(_lastUsedSorting.current) || JSON.stringify(filters) !== JSON.stringify(_lastUsedFilters.current)) {
|
10316
10349
|
_pendingPageRequests.current = {};
|
10317
10350
|
// nuke the dataset so that we "start again" after sorting
|
10318
10351
|
reset = true;
|
@@ -10328,11 +10361,9 @@ function useTableDataLoader(fetch, fetchAll, options = {
|
|
10328
10361
|
_lastUsedSorting.current = sorting;
|
10329
10362
|
// set the filters so we can track if it changed between loads
|
10330
10363
|
_lastUsedFilters.current = filters;
|
10331
|
-
// set the search so we can track if it changed between loads
|
10332
|
-
_lastUsedSearch.current = search;
|
10333
10364
|
const _temp = _finallyRethrows(function () {
|
10334
10365
|
return _catch(function () {
|
10335
|
-
return Promise.resolve(
|
10366
|
+
return Promise.resolve(fetchPage(pageIndex, pageSize, sorting, filters)).then(function (response) {
|
10336
10367
|
// update state, here we do some "magic" to support "load in place"
|
10337
10368
|
setData(currentData => {
|
10338
10369
|
let nextData;
|
@@ -10361,10 +10392,14 @@ function useTableDataLoader(fetch, fetchAll, options = {
|
|
10361
10392
|
return Promise.reject(e);
|
10362
10393
|
}
|
10363
10394
|
};
|
10364
|
-
const loadAll = function (sorting, filters
|
10395
|
+
const loadAll = function (sorting, filters) {
|
10365
10396
|
try {
|
10397
|
+
// set the sorting so we can track if it changed between loads
|
10398
|
+
_lastUsedSorting.current = sorting;
|
10399
|
+
// set the filters so we can track if it changed between loads
|
10400
|
+
_lastUsedFilters.current = filters;
|
10366
10401
|
const _temp2 = _catch(function () {
|
10367
|
-
return Promise.resolve(fetchAll(sorting, filters
|
10402
|
+
return Promise.resolve(fetchAll(sorting, filters)).then(function (response) {
|
10368
10403
|
length.current = response.length;
|
10369
10404
|
setData(() => {
|
10370
10405
|
let nextData;
|
@@ -10386,22 +10421,52 @@ function useTableDataLoader(fetch, fetchAll, options = {
|
|
10386
10421
|
const invalidate = function () {
|
10387
10422
|
try {
|
10388
10423
|
_forceReset.current = true;
|
10389
|
-
return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current
|
10424
|
+
return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current);
|
10390
10425
|
} catch (e) {
|
10391
10426
|
return Promise.reject(e);
|
10392
10427
|
}
|
10393
10428
|
};
|
10394
|
-
//
|
10429
|
+
// search works client side - it fetches all then works client side - so these handlers are a little "weird"
|
10430
|
+
// if a search is currently "active", we need to re load all because
|
10395
10431
|
const handleSort = function (sorting) {
|
10396
10432
|
try {
|
10397
|
-
|
10433
|
+
// set the sorting so we can track if it changed between loads
|
10434
|
+
_lastUsedSorting.current = sorting;
|
10435
|
+
if (_lastUsedSearch.current) {
|
10436
|
+
// we're searching, which means we need to refetch all with the correct sorting applied
|
10437
|
+
loadAll(sorting, _lastUsedFilters.current);
|
10438
|
+
} else {
|
10439
|
+
// reset the page to 0 whenever sorting
|
10440
|
+
loadPage(0, sorting, _lastUsedFilters.current);
|
10441
|
+
}
|
10442
|
+
return Promise.resolve();
|
10398
10443
|
} catch (e) {
|
10399
10444
|
return Promise.reject(e);
|
10400
10445
|
}
|
10401
10446
|
};
|
10402
10447
|
const handleFilter = function (filters) {
|
10403
10448
|
try {
|
10404
|
-
|
10449
|
+
// set the filters so we can track if it changed between loads
|
10450
|
+
_lastUsedFilters.current = filters;
|
10451
|
+
if (_lastUsedSearch.current) {
|
10452
|
+
// we're searching, which means we need to refetch all with the correct sorting applied
|
10453
|
+
loadAll(_lastUsedSorting.current, filters);
|
10454
|
+
} else {
|
10455
|
+
// reset the page to 0 whenever sorting
|
10456
|
+
loadPage(0, _lastUsedSorting.current, filters);
|
10457
|
+
}
|
10458
|
+
return Promise.resolve();
|
10459
|
+
} catch (e) {
|
10460
|
+
return Promise.reject(e);
|
10461
|
+
}
|
10462
|
+
};
|
10463
|
+
const handleSearch = function (search) {
|
10464
|
+
try {
|
10465
|
+
// set the search so we can track if it changed between loads
|
10466
|
+
_lastUsedSearch.current = search || undefined;
|
10467
|
+
// search works client side, and focusing the search field triggers a load of all so we don't actually
|
10468
|
+
// want to load anything when search gets changed, we just store the value for other handlers
|
10469
|
+
return Promise.resolve();
|
10405
10470
|
} catch (e) {
|
10406
10471
|
return Promise.reject(e);
|
10407
10472
|
}
|
@@ -10412,6 +10477,7 @@ function useTableDataLoader(fetch, fetchAll, options = {
|
|
10412
10477
|
loadAll,
|
10413
10478
|
loadPage,
|
10414
10479
|
onChangeFilter: handleFilter,
|
10480
|
+
onChangeSearch: handleSearch,
|
10415
10481
|
onChangeSort: handleSort,
|
10416
10482
|
pageSize
|
10417
10483
|
}, invalidate];
|
@@ -10588,10 +10654,17 @@ function useTableFontSizeListener(table) {
|
|
10588
10654
|
const previousFontSizeRef = React__default.useRef(meta.fontSize.size);
|
10589
10655
|
useLazyEffect(() => {
|
10590
10656
|
const cellWidthDifference = getCellWidthDifference(`${previousFontSizeRef.current}-${meta.fontSize.size}`);
|
10657
|
+
const globalMinSize = getCellMinWidth(meta.fontSize.size);
|
10591
10658
|
table.setColumnSizing(sizes => {
|
10592
|
-
const minColumnSize = getCellMinWidth(meta.fontSize.size);
|
10593
10659
|
return Object.fromEntries(Object.entries(sizes).map(([columnName, prevColumnSize]) => {
|
10660
|
+
var _column$columnDef$min;
|
10661
|
+
const column = table.getColumn(columnName);
|
10662
|
+
if (isInternalColumn(columnName)) {
|
10663
|
+
var _column$getSize;
|
10664
|
+
return [columnName, (_column$getSize = column === null || column === void 0 ? void 0 : column.getSize()) !== null && _column$getSize !== void 0 ? _column$getSize : prevColumnSize];
|
10665
|
+
}
|
10594
10666
|
// Prevents width value in the setting to go below the minColumnSize
|
10667
|
+
const minColumnSize = (_column$columnDef$min = column === null || column === void 0 ? void 0 : column.columnDef.minSize) !== null && _column$columnDef$min !== void 0 ? _column$columnDef$min : globalMinSize;
|
10595
10668
|
const newSize = Math.max(minColumnSize, prevColumnSize + cellWidthDifference);
|
10596
10669
|
return [columnName, newSize];
|
10597
10670
|
}));
|
@@ -10695,33 +10768,18 @@ function resetHighlightedColumnIndexes(value, table) {
|
|
10695
10768
|
return firstRowIndex;
|
10696
10769
|
}
|
10697
10770
|
|
10698
|
-
function useTableSearchListener(table) {
|
10771
|
+
function useTableSearchListener(table, onChangeSearch) {
|
10699
10772
|
const meta = table.options.meta;
|
10700
10773
|
// recalculates highlighted indexes whenever something important changes
|
10701
10774
|
React__default.useEffect(() => {
|
10702
10775
|
if (meta.search.isEnabled) {
|
10703
|
-
|
10776
|
+
const query = table.getState().globalFilter;
|
10777
|
+
resetHighlightedColumnIndexes(query, table);
|
10778
|
+
if (typeof onChangeSearch === 'function') {
|
10779
|
+
onChangeSearch(query);
|
10780
|
+
}
|
10704
10781
|
}
|
10705
|
-
}, [meta.server.loadAllStatus, meta.search.isEnabled, meta.search.enableGlobalFilter, table.getRowModel().rows.length, table.getState().globalFilter, JSON.stringify(table.getState().sorting), JSON.stringify(table.getState().columnVisibility)]);
|
10706
|
-
}
|
10707
|
-
|
10708
|
-
function getSettings(table) {
|
10709
|
-
const meta = table.options.meta;
|
10710
|
-
const state = table.getState();
|
10711
|
-
return {
|
10712
|
-
// commented out properties are here to highlight things we explicitly don't want them saved
|
10713
|
-
//columnFilters: table.options.enableColumnFilters ? state.columnFilters : undefined,
|
10714
|
-
columnOrder: meta.columnOrdering.isEnabled ? state.columnOrder : undefined,
|
10715
|
-
columnPinning: state.columnPinning,
|
10716
|
-
columnSizing: state.columnSizing,
|
10717
|
-
columnVisibility: table.options.enableHiding ? state.columnVisibility : undefined,
|
10718
|
-
excludeUnmatchedRecordsInSearch: table.options.enableGlobalFilter,
|
10719
|
-
fontSize: meta.fontSize.isEnabled ? meta.fontSize.size : undefined,
|
10720
|
-
//grouping: table.options.enableGrouping ? state.grouping : undefined,
|
10721
|
-
rowHeight: meta.rowHeight.isEnabled ? meta.rowHeight.height : undefined,
|
10722
|
-
//searchQuery: table.options.enableGlobalFilter ? state.globalFilter : undefined,
|
10723
|
-
sorting: state.sorting
|
10724
|
-
};
|
10782
|
+
}, [meta.server.loadAllStatus, meta.search.isEnabled, meta.search.enableGlobalFilter, table.getRowModel().rows.length, table.getState().globalFilter, JSON.stringify(table.getState().sorting), JSON.stringify(table.getState().columnVisibility), onChangeSearch]);
|
10725
10783
|
}
|
10726
10784
|
|
10727
10785
|
function useTableSettingsListener(table, onChangeSettings) {
|
@@ -10807,11 +10865,10 @@ function useTableSortingListener(table, onSort) {
|
|
10807
10865
|
function useTableServerLoadingListener(table, loadPage) {
|
10808
10866
|
const sorting = table.getState().sorting;
|
10809
10867
|
const columnFilters = table.getState().columnFilters;
|
10810
|
-
const search = table.getState().globalFilter;
|
10811
10868
|
// trigger load of the first page on mount
|
10812
10869
|
React__default.useEffect(() => {
|
10813
10870
|
if (loadPage) {
|
10814
|
-
loadPage(0, sorting, columnFilters
|
10871
|
+
loadPage(0, sorting, columnFilters);
|
10815
10872
|
}
|
10816
10873
|
}, []);
|
10817
10874
|
}
|
@@ -10912,7 +10969,7 @@ function useTableManager(props, meta, internalColumns) {
|
|
10912
10969
|
useTableFontSizeListener(instance);
|
10913
10970
|
useTableRowHeightListener(instance);
|
10914
10971
|
useTableRowSelectionListener(instance, props.onRowSelect);
|
10915
|
-
useTableSearchListener(instance);
|
10972
|
+
useTableSearchListener(instance, props.onChangeSearch);
|
10916
10973
|
useTableServerLoadingListener(instance, server.loadPage);
|
10917
10974
|
useTableSettingsListener(instance, setSettings);
|
10918
10975
|
useTableShortcutsListener(instance, props.shortcuts);
|
@@ -10992,16 +11049,23 @@ function useTableStyleGrid(tableId, table, fontSize) {
|
|
10992
11049
|
|
10993
11050
|
function useTableStyleColumnFreezing(tableId, table) {
|
10994
11051
|
const {
|
10995
|
-
columnPinning
|
11052
|
+
columnPinning,
|
11053
|
+
columnSizing
|
10996
11054
|
} = table.getState();
|
10997
11055
|
const stylesheet = React__default.useMemo(() => {
|
10998
11056
|
const styles = [];
|
10999
11057
|
// might be a better way to get this information, but it wasn't obvious
|
11000
11058
|
const all = table.getFlatHeaders().filter(column => !column.subHeaders.length).map(x => x.id);
|
11001
|
-
const left = table.getLeftFlatHeaders().filter(column => !column.subHeaders.length)
|
11002
|
-
const right = table.getRightFlatHeaders().filter(column => !column.subHeaders.length)
|
11059
|
+
const left = table.getLeftFlatHeaders().filter(column => !column.subHeaders.length);
|
11060
|
+
const right = table.getRightFlatHeaders().filter(column => !column.subHeaders.length);
|
11003
11061
|
if (left.length) {
|
11004
|
-
|
11062
|
+
left.forEach(cell => {
|
11063
|
+
styles.push(`table[data-taco^='table']#${tableId} [data-cell-id="${cell.column.id}"] {
|
11064
|
+
left: ${cell.column.getStart(cell.column.getIsPinned())}px;
|
11065
|
+
}`);
|
11066
|
+
});
|
11067
|
+
const leftIds = left.map(x => x.id);
|
11068
|
+
const index = all.indexOf(leftIds[leftIds.length - 1]);
|
11005
11069
|
// add right border, hide the header seperator and add shadow when scrolled
|
11006
11070
|
// we have to be specific so that nested tables don't inherit the same css
|
11007
11071
|
styles.push(`table[data-taco^='table']#${tableId} > thead > tr > th:nth-child(${index + 1}),
|
@@ -11019,14 +11083,20 @@ function useTableStyleColumnFreezing(tableId, table) {
|
|
11019
11083
|
}`);
|
11020
11084
|
}
|
11021
11085
|
if (right.length) {
|
11022
|
-
|
11086
|
+
right.forEach(cell => {
|
11087
|
+
styles.push(`table[data-taco^='table']#${tableId} [data-cell-id="${cell.column.id}"] {
|
11088
|
+
right: ${cell.column.getStart(cell.column.getIsPinned())}px;
|
11089
|
+
}`);
|
11090
|
+
});
|
11091
|
+
const rightIds = right.map(x => x.id);
|
11092
|
+
const index = all.indexOf(rightIds[rightIds.length - 1]);
|
11023
11093
|
styles.push(`table[data-taco^='table']#${tableId} > thead > tr > th:nth-child(${index + 1}):not([data-cell-id^="__"]),
|
11024
11094
|
table[data-taco^='table']#${tableId} > tbody > tr > td:nth-child(${index + 1}):not([data-cell-id^="__"]) {
|
11025
11095
|
border-left-width: 1px;
|
11026
11096
|
}`);
|
11027
11097
|
}
|
11028
11098
|
return styles.join('\n');
|
11029
|
-
}, [columnPinning]);
|
11099
|
+
}, [columnPinning, columnSizing]);
|
11030
11100
|
return {
|
11031
11101
|
stylesheet
|
11032
11102
|
};
|
@@ -11195,7 +11265,7 @@ function RowWithServerLoading(props) {
|
|
11195
11265
|
React__default.useEffect(() => {
|
11196
11266
|
if (inView) {
|
11197
11267
|
var _tableMeta$server$loa, _tableMeta$server;
|
11198
|
-
(_tableMeta$server$loa = (_tableMeta$server = tableMeta.server).loadPage) === null || _tableMeta$server$loa === void 0 ? void 0 : _tableMeta$server$loa.call(_tableMeta$server, pageIndex, table.getState().sorting, table.getState().columnFilters
|
11268
|
+
(_tableMeta$server$loa = (_tableMeta$server = tableMeta.server).loadPage) === null || _tableMeta$server$loa === void 0 ? void 0 : _tableMeta$server$loa.call(_tableMeta$server, pageIndex, table.getState().sorting, table.getState().columnFilters);
|
11199
11269
|
}
|
11200
11270
|
}, [inView]);
|
11201
11271
|
return /*#__PURE__*/React__default.createElement(Skeleton, {
|
@@ -11669,7 +11739,7 @@ function Header$4(context) {
|
|
11669
11739
|
const _temp = function () {
|
11670
11740
|
if (tableMeta.server.loadAllIfNeeded) {
|
11671
11741
|
// don't pass the search query because we need all data - not filtered data
|
11672
|
-
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters
|
11742
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
|
11673
11743
|
}
|
11674
11744
|
}();
|
11675
11745
|
// load all data if that is possible
|
@@ -11743,7 +11813,7 @@ function Cell$3(context) {
|
|
11743
11813
|
const _temp3 = function () {
|
11744
11814
|
if (tableMeta.server.loadAllIfNeeded && selectedRows.some(row => row.original === undefined)) {
|
11745
11815
|
// don't pass the search query because we need all data - not filtered data
|
11746
|
-
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters
|
11816
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
|
11747
11817
|
}
|
11748
11818
|
}();
|
11749
11819
|
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
|
@@ -11847,20 +11917,16 @@ function useTable(props, externalRef, renderers, meta) {
|
|
11847
11917
|
function getCellAttributes(cell, index, isHighlighted) {
|
11848
11918
|
const columnMeta = cell.column.columnDef.meta;
|
11849
11919
|
const isPinned = cell.column.getIsPinned();
|
11850
|
-
|
11920
|
+
// be careful adding new properties here, any objects will break cell memoisation (e.g. the style attribute)
|
11921
|
+
return {
|
11851
11922
|
'data-cell-align': columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.align,
|
11852
11923
|
'data-cell-highlighted': isHighlighted,
|
11853
11924
|
'data-cell-id': cell.column.id,
|
11854
11925
|
'data-cell-index': index,
|
11855
11926
|
'data-cell-pinned': isPinned ? true : undefined,
|
11856
11927
|
'data-cell-truncate': columnMeta.enableTruncate ? true : undefined,
|
11857
|
-
className: typeof columnMeta.className === 'function' ? columnMeta.className(cell.row.original) : columnMeta.className
|
11858
|
-
style: {}
|
11928
|
+
className: typeof columnMeta.className === 'function' ? columnMeta.className(cell.row.original) : columnMeta.className
|
11859
11929
|
};
|
11860
|
-
if (isPinned) {
|
11861
|
-
attributes.style[isPinned] = `${cell.column.getStart(isPinned)}px`;
|
11862
|
-
}
|
11863
|
-
return attributes;
|
11864
11930
|
}
|
11865
11931
|
function useSearchHighlighting(cell, cellIndex, ref) {
|
11866
11932
|
const {
|
@@ -13135,7 +13201,7 @@ function Search$1(props) {
|
|
13135
13201
|
const _temp = function () {
|
13136
13202
|
if (tableMeta.server.loadAllIfNeeded) {
|
13137
13203
|
// don't pass the search query because we need all data - not filtered data
|
13138
|
-
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters
|
13204
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
|
13139
13205
|
}
|
13140
13206
|
}();
|
13141
13207
|
// load all data if that is possible
|
@@ -15183,7 +15249,7 @@ function Print$1(props) {
|
|
15183
15249
|
const _temp2 = function () {
|
15184
15250
|
if (tableMeta.server.isEnabled && tableMeta.server.loadAllIfNeeded) {
|
15185
15251
|
const _temp = _catch(function () {
|
15186
|
-
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters
|
15252
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
|
15187
15253
|
}, function (error) {
|
15188
15254
|
const errorMessage = `${texts.table.print.error}: ${error}`;
|
15189
15255
|
console.error(errorMessage);
|
@@ -17968,6 +18034,7 @@ const TextareaWithAutosizing = /*#__PURE__*/React__default.forwardRef(function T
|
|
17968
18034
|
};
|
17969
18035
|
const handleFocus = event => {
|
17970
18036
|
var _props$onFocus;
|
18037
|
+
toggleHeight();
|
17971
18038
|
(_props$onFocus = props.onFocus) === null || _props$onFocus === void 0 ? void 0 : _props$onFocus.call(props, event);
|
17972
18039
|
};
|
17973
18040
|
const handleBlur = event => {
|
@@ -18453,9 +18520,13 @@ function Alert$1(props) {
|
|
18453
18520
|
const tableMeta = table.options.meta;
|
18454
18521
|
const [showFilterResetDialog, setShowFilterResetDialog] = React__default.useState(false);
|
18455
18522
|
const pendingChangesWithErrors = tableMeta.editing.getErrors();
|
18523
|
+
const activeRow = React__default.useMemo(() => tableMeta.rowActive.rowActiveIndex ? table.getRowModel().rows[tableMeta.rowActive.rowActiveIndex] : undefined, [tableMeta.rowActive.rowActiveIndex]);
|
18456
18524
|
// mark errors being rendered as seen
|
18457
18525
|
React__default.useEffect(() => {
|
18458
18526
|
pendingChangesWithErrors.forEach(error => {
|
18527
|
+
if (activeRow && error.rowId === activeRow.id) {
|
18528
|
+
return;
|
18529
|
+
}
|
18459
18530
|
tableMeta.editing.setRowErrorsSeen(error.rowId);
|
18460
18531
|
});
|
18461
18532
|
}, [pendingChangesWithErrors]);
|
@@ -18481,7 +18552,8 @@ function Alert$1(props) {
|
|
18481
18552
|
pendingChangesWithErrors.forEach((error, index) => {
|
18482
18553
|
// if appropriate, concatenate the item with the text "and"
|
18483
18554
|
if (pendingChangesWithErrors.length > 1 && index === pendingChangesWithErrors.length - 1) {
|
18484
|
-
|
18555
|
+
// Add space before and after `messageAnd` text
|
18556
|
+
links.push(` ${validationTexts.alert.messageAnd} `);
|
18485
18557
|
}
|
18486
18558
|
const rowIndex = table.getRowModel().rows.findIndex(row => row.id === error.rowId);
|
18487
18559
|
const handleClick = () => {
|
@@ -18539,7 +18611,7 @@ function Alert$1(props) {
|
|
18539
18611
|
state: "error"
|
18540
18612
|
}), /*#__PURE__*/React__default.createElement("span", {
|
18541
18613
|
className: "font-bold"
|
18542
|
-
}, title), message), /*#__PURE__*/React__default.createElement(FilterResetDialog, {
|
18614
|
+
}, title), "\u00A0", message), /*#__PURE__*/React__default.createElement(FilterResetDialog, {
|
18543
18615
|
open: showFilterResetDialog !== false,
|
18544
18616
|
onChange: () => setShowFilterResetDialog(false),
|
18545
18617
|
onSubmit: handleResetFilters
|