@economic/taco 2.69.2-search-racecondition-v2.0 → 2.70.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/taco.cjs +82 -19
- package/dist/taco.cjs.map +1 -1
- package/dist/taco.d.ts +1 -0
- package/dist/taco.js +82 -19
- package/dist/taco.js.map +1 -1
- package/package.json +2 -2
package/dist/taco.d.ts
CHANGED
@@ -3362,6 +3362,7 @@ export declare type TableFeatureProps<TType = unknown> = {
|
|
3362
3362
|
enableRowGoto?: boolean;
|
3363
3363
|
enableRowHeight?: boolean;
|
3364
3364
|
enableSaveSettings?: boolean | Partial<TableEnableSettingsOptions>;
|
3365
|
+
enableSaveSettingsLocally?: boolean;
|
3365
3366
|
};
|
3366
3367
|
|
3367
3368
|
export declare type TableFilter = {
|
package/dist/taco.js
CHANGED
@@ -16962,7 +16962,8 @@ const Navbar = React.memo(({ onMonthChange, value = /* @__PURE__ */ new Date() }
|
|
16962
16962
|
icon: "chevron-left",
|
16963
16963
|
"aria-label": actions.previousMonth,
|
16964
16964
|
onClick: onPreviousClick,
|
16965
|
-
rounded: true
|
16965
|
+
rounded: true,
|
16966
|
+
"data-action": "prev-month"
|
16966
16967
|
}
|
16967
16968
|
)), /* @__PURE__ */ React.createElement(Tooltip$3, { title: actions.nextMonth }, /* @__PURE__ */ React.createElement(
|
16968
16969
|
IconButton,
|
@@ -16971,7 +16972,8 @@ const Navbar = React.memo(({ onMonthChange, value = /* @__PURE__ */ new Date() }
|
|
16971
16972
|
icon: "chevron-right",
|
16972
16973
|
"aria-label": actions.nextMonth,
|
16973
16974
|
onClick: onNextClick,
|
16974
|
-
rounded: true
|
16975
|
+
rounded: true,
|
16976
|
+
"data-action": "next-month"
|
16975
16977
|
}
|
16976
16978
|
))));
|
16977
16979
|
});
|
@@ -16988,7 +16990,8 @@ const TodayButton = ({ handleChange }) => {
|
|
16988
16990
|
Button$3,
|
16989
16991
|
{
|
16990
16992
|
className: "cursor-pointer border-none bg-transparent text-xs text-blue-500 hover:text-blue-300",
|
16991
|
-
onClick: handleCalendarClickToday
|
16993
|
+
onClick: handleCalendarClickToday,
|
16994
|
+
"data-action": "today"
|
16992
16995
|
},
|
16993
16996
|
texts.calendar.actions.today
|
16994
16997
|
);
|
@@ -35677,7 +35680,8 @@ const DEFAULT_PRESET = {
|
|
35677
35680
|
enableRowDrop: false,
|
35678
35681
|
enableRowGoto: false,
|
35679
35682
|
enableRowHeight: false,
|
35680
|
-
enableSaveSettings: false
|
35683
|
+
enableSaveSettings: false,
|
35684
|
+
enableSaveSettingsLocally: true
|
35681
35685
|
};
|
35682
35686
|
const presets = {
|
35683
35687
|
// View/edit/create on page
|
@@ -35704,7 +35708,8 @@ const presets = {
|
|
35704
35708
|
enableRowDrop: true,
|
35705
35709
|
enableRowGoto: true,
|
35706
35710
|
enableRowHeight: true,
|
35707
|
-
enableSaveSettings: true
|
35711
|
+
enableSaveSettings: true,
|
35712
|
+
enableSaveSettingsLocally: true
|
35708
35713
|
},
|
35709
35714
|
// View/create in dialog
|
35710
35715
|
list: {
|
@@ -35730,7 +35735,8 @@ const presets = {
|
|
35730
35735
|
enableRowDrop: false,
|
35731
35736
|
enableRowGoto: false,
|
35732
35737
|
enableRowHeight: false,
|
35733
|
-
enableSaveSettings: true
|
35738
|
+
enableSaveSettings: true,
|
35739
|
+
enableSaveSettingsLocally: true
|
35734
35740
|
},
|
35735
35741
|
// View in card or dialog
|
35736
35742
|
simple: {
|
@@ -35756,7 +35762,8 @@ const presets = {
|
|
35756
35762
|
enableRowDrop: false,
|
35757
35763
|
enableRowGoto: false,
|
35758
35764
|
enableRowHeight: false,
|
35759
|
-
enableSaveSettings: true
|
35765
|
+
enableSaveSettings: true,
|
35766
|
+
enableSaveSettingsLocally: true
|
35760
35767
|
}
|
35761
35768
|
};
|
35762
35769
|
function getTableFeaturePreset(props) {
|
@@ -35795,7 +35802,8 @@ function getTableFeaturePreset(props) {
|
|
35795
35802
|
enableRowGoto: enableRowGoto && !!props.onRowGoto,
|
35796
35803
|
enableRowExpansionAll: enableRowExpansion && enableRowExpansionAll && !!props.rowExpansionRenderer,
|
35797
35804
|
enableRowHeight: props.enableRowHeight ?? presetOptions.enableRowHeight,
|
35798
|
-
enableSaveSettings: props.enableSaveSettings ?? presetOptions.enableSaveSettings
|
35805
|
+
enableSaveSettings: props.enableSaveSettings ?? presetOptions.enableSaveSettings,
|
35806
|
+
enableSaveSettingsLocally: props.enableSaveSettingsLocally ?? presetOptions.enableSaveSettingsLocally
|
35799
35807
|
};
|
35800
35808
|
}
|
35801
35809
|
function useTableColumnFreezing(isEnabled = false) {
|
@@ -36345,11 +36353,11 @@ function useEnabledSettings(isEnabled) {
|
|
36345
36353
|
return [options, Object.values(options).some((o2) => o2 === true)];
|
36346
36354
|
}, [isEnabled]);
|
36347
36355
|
}
|
36348
|
-
function useTableSettings(isEnabled = false, id2, defaultSettings = {}, onChangeSettings) {
|
36356
|
+
function useTableSettings(isEnabled = false, id2, defaultSettings = {}, onChangeSettings, enableSaveSettingsLocally = true) {
|
36349
36357
|
const uniqueId3 = useUniqueTableId(id2);
|
36350
36358
|
const [enabledSettings, hasSomeEnabledSettings] = useEnabledSettings(isEnabled);
|
36351
36359
|
const [persistedSettings, _setPersistedSettings] = useLocalStorage(
|
36352
|
-
hasSomeEnabledSettings ? uniqueId3 : void 0,
|
36360
|
+
hasSomeEnabledSettings && enableSaveSettingsLocally ? uniqueId3 : void 0,
|
36353
36361
|
removeDisabledSettings(defaultSettings, enabledSettings)
|
36354
36362
|
);
|
36355
36363
|
const setPersistedSettings = React__default.useCallback(
|
@@ -36358,17 +36366,20 @@ function useTableSettings(isEnabled = false, id2, defaultSettings = {}, onChange
|
|
36358
36366
|
return;
|
36359
36367
|
}
|
36360
36368
|
const sanitizedSettings = removeDisabledSettings(value, enabledSettings);
|
36361
|
-
|
36369
|
+
if (enableSaveSettingsLocally) {
|
36370
|
+
_setPersistedSettings(sanitizedSettings);
|
36371
|
+
}
|
36362
36372
|
if (typeof onChangeSettings === "function") {
|
36363
36373
|
onChangeSettings(sanitizedSettings);
|
36364
36374
|
}
|
36365
36375
|
},
|
36366
|
-
[hasSomeEnabledSettings, onChangeSettings, JSON.stringify(enabledSettings)]
|
36376
|
+
[hasSomeEnabledSettings, enableSaveSettingsLocally, onChangeSettings, JSON.stringify(enabledSettings)]
|
36367
36377
|
);
|
36368
36378
|
if (!hasSomeEnabledSettings) {
|
36369
36379
|
return [defaultSettings, () => void 0];
|
36370
36380
|
}
|
36371
|
-
|
36381
|
+
const currentSettings = enableSaveSettingsLocally ? persistedSettings : removeDisabledSettings(defaultSettings, enabledSettings);
|
36382
|
+
return [currentSettings, setPersistedSettings];
|
36372
36383
|
}
|
36373
36384
|
function removeDisabledSettings(settings, enabledSettings) {
|
36374
36385
|
const sanitizedSettings = { ...settings };
|
@@ -36477,7 +36488,7 @@ function useTableSearchListener(table) {
|
|
36477
36488
|
const meta = table.options.meta;
|
36478
36489
|
const localization = useLocalization();
|
36479
36490
|
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
36480
|
-
const query =
|
36491
|
+
const query = table.getState().globalFilter;
|
36481
36492
|
useLazyEffect(() => {
|
36482
36493
|
if (meta.search.isEnabled) {
|
36483
36494
|
const currentFilter = query;
|
@@ -36655,7 +36666,8 @@ function useTableManager(props, ref, meta, internalColumns) {
|
|
36655
36666
|
options.enableSaveSettings,
|
36656
36667
|
safeId,
|
36657
36668
|
props.defaultSettings,
|
36658
|
-
props.onChangeSettings
|
36669
|
+
props.onChangeSettings,
|
36670
|
+
props.enableSaveSettingsLocally
|
36659
36671
|
);
|
36660
36672
|
const data = props.data ?? DEFAULT_EMPTY_ARRAY;
|
36661
36673
|
const length = props.length ?? data.length;
|
@@ -37706,12 +37718,15 @@ const RowContext = React__default.createContext({
|
|
37706
37718
|
isHovered: false,
|
37707
37719
|
rowIndex: -1
|
37708
37720
|
});
|
37721
|
+
const DELAY_BEFORE_LOAD_MS$1 = 250;
|
37709
37722
|
function Row$2(props) {
|
37710
37723
|
const {
|
37711
37724
|
renderer: RowRenderer,
|
37712
37725
|
cellRenderer: CellRenderer,
|
37713
37726
|
hideInternalColumns = false,
|
37714
37727
|
hideRowActions = false,
|
37728
|
+
scrollDirection,
|
37729
|
+
skipPageLoading = false,
|
37715
37730
|
...displayRowProps
|
37716
37731
|
} = props;
|
37717
37732
|
const tableMeta = props.table.options.meta;
|
@@ -37720,6 +37735,44 @@ function Row$2(props) {
|
|
37720
37735
|
() => ({ isHovered, rowIndex: props.index, hideInternalColumns, hideRowActions }),
|
37721
37736
|
[isHovered, props.index, hideInternalColumns, hideRowActions]
|
37722
37737
|
);
|
37738
|
+
React__default.useEffect(() => {
|
37739
|
+
let timeout;
|
37740
|
+
if (tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2 && !skipPageLoading) {
|
37741
|
+
const pageIndex = Math.floor(props.index / tableMeta.server.pageSize) * tableMeta.server.pageSize / tableMeta.server.pageSize;
|
37742
|
+
const sorting = props.table.getState().sorting;
|
37743
|
+
const filters = props.table.getState().columnFilters;
|
37744
|
+
const search = props.table.getState().globalFilter;
|
37745
|
+
const hiddenColumns = getHiddenColumns(props.table.getState().columnVisibility);
|
37746
|
+
const pageIndexesToFetch = [];
|
37747
|
+
if (scrollDirection === "backward" || !scrollDirection) {
|
37748
|
+
const backIndex = pageIndex - 1;
|
37749
|
+
if (backIndex > -1) {
|
37750
|
+
pageIndexesToFetch.push(backIndex);
|
37751
|
+
}
|
37752
|
+
}
|
37753
|
+
if ((scrollDirection === "forward" || !scrollDirection) && pageIndex + 2 < tableMeta.server.pageCount) {
|
37754
|
+
pageIndexesToFetch.push(pageIndex + 1);
|
37755
|
+
}
|
37756
|
+
if (pageIndexesToFetch.length) {
|
37757
|
+
timeout = setTimeout(() => {
|
37758
|
+
pageIndexesToFetch.forEach((index2) => {
|
37759
|
+
var _a, _b;
|
37760
|
+
(_b = (_a = tableMeta.server).loadPage) == null ? void 0 : _b.call(
|
37761
|
+
_a,
|
37762
|
+
index2,
|
37763
|
+
sorting,
|
37764
|
+
filters,
|
37765
|
+
hiddenColumns,
|
37766
|
+
tableMeta.search.enableGlobalFilter ? search : void 0
|
37767
|
+
);
|
37768
|
+
});
|
37769
|
+
}, DELAY_BEFORE_LOAD_MS$1);
|
37770
|
+
}
|
37771
|
+
}
|
37772
|
+
return () => {
|
37773
|
+
clearTimeout(timeout);
|
37774
|
+
};
|
37775
|
+
}, [tableMeta.server.pages]);
|
37723
37776
|
return /* @__PURE__ */ React__default.createElement(RowContext.Provider, { value: contextValue }, /* @__PURE__ */ React__default.createElement(RowRenderer, { ...displayRowProps, cellRenderer: CellRenderer }));
|
37724
37777
|
}
|
37725
37778
|
const DELAY_BEFORE_LOAD_MS = 150;
|
@@ -37871,7 +37924,15 @@ function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIn
|
|
37871
37924
|
}
|
37872
37925
|
if (!(row == null ? void 0 : row.original)) {
|
37873
37926
|
const skeletonKey = `skeleton-${virtualRow.index}`;
|
37874
|
-
return /* @__PURE__ */ React__default.createElement(
|
37927
|
+
return /* @__PURE__ */ React__default.createElement(
|
37928
|
+
SkeletonRow,
|
37929
|
+
{
|
37930
|
+
key: skeletonKey,
|
37931
|
+
index: virtualRow.index,
|
37932
|
+
scrollDirection: virtualiser.scrollDirection ?? void 0,
|
37933
|
+
table
|
37934
|
+
}
|
37935
|
+
);
|
37875
37936
|
}
|
37876
37937
|
const measureRow = (rowHeight) => {
|
37877
37938
|
virtualiser.resizeItem(virtualRow, rowHeight);
|
@@ -37882,6 +37943,7 @@ function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIn
|
|
37882
37943
|
key: row.id,
|
37883
37944
|
row,
|
37884
37945
|
index: virtualRow.index,
|
37946
|
+
scrollDirection: virtualiser.scrollDirection ?? void 0,
|
37885
37947
|
table,
|
37886
37948
|
measureRow,
|
37887
37949
|
renderer: renderers.row,
|
@@ -39551,7 +39613,7 @@ function Search$1(props) {
|
|
39551
39613
|
(_c = (_b = (_a2 = tableMeta.search).handleSearch) == null ? void 0 : _b.call(_a2, query2, hiddenColumns)) == null ? void 0 : _c.then(() => {
|
39552
39614
|
setLoading(false);
|
39553
39615
|
});
|
39554
|
-
},
|
39616
|
+
}, 150);
|
39555
39617
|
}
|
39556
39618
|
};
|
39557
39619
|
const handleToggleExcludeUnmatchedResults = async (enabled) => {
|
@@ -56163,7 +56225,7 @@ function SaveStatus(props) {
|
|
56163
56225
|
const className = clsx(
|
56164
56226
|
"col-span-full sticky ml-auto right-0 top-0 -mb-[100%] z-10 h-8 bg-[inherit] flex items-center px-1.5 shadow-[-6px_0px_6px_var(--table-row-actions-shadow)]",
|
56165
56227
|
{
|
56166
|
-
"mt-0
|
56228
|
+
"mt-0": tableMeta.rowHeight.height === "short",
|
56167
56229
|
"mt-1": tableMeta.rowHeight.height === "medium",
|
56168
56230
|
"mt-1.5": tableMeta.rowHeight.height === "tall",
|
56169
56231
|
"mt-2": tableMeta.rowHeight.height === "extra-tall"
|
@@ -56581,7 +56643,8 @@ function TemporaryRow(props) {
|
|
56581
56643
|
className,
|
56582
56644
|
onKeyDown: handleKeyDown,
|
56583
56645
|
hideInternalColumns: true,
|
56584
|
-
hideRowActions: !tableMeta.editing.isEditing
|
56646
|
+
hideRowActions: !tableMeta.editing.isEditing,
|
56647
|
+
skipPageLoading: true
|
56585
56648
|
}
|
56586
56649
|
);
|
56587
56650
|
}
|