@economic/taco 2.66.1-alpha.0 → 2.67.0
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 +77 -29
- package/dist/taco.cjs.map +1 -1
- package/dist/taco.d.ts +5 -4
- package/dist/taco.js +77 -29
- package/dist/taco.js.map +1 -1
- package/package.json +2 -2
package/dist/taco.cjs
CHANGED
@@ -35651,7 +35651,7 @@ function useReactTableInitialState(props, columns, persistedSettings, defaults2)
|
|
35651
35651
|
columnOrder
|
35652
35652
|
);
|
35653
35653
|
} else {
|
35654
|
-
if (props.defaultColumnFreezingIndex) {
|
35654
|
+
if (props.defaultColumnFreezingIndex !== void 0) {
|
35655
35655
|
columnPinning.left = freezeUptoExternalColumn(props.defaultColumnFreezingIndex, columnOrder);
|
35656
35656
|
} else {
|
35657
35657
|
columnPinning.left = unfreezeAllExternalColumns(columnOrder);
|
@@ -37852,12 +37852,12 @@ function getScrollPaddingEndOffset(table) {
|
|
37852
37852
|
}
|
37853
37853
|
return height;
|
37854
37854
|
}
|
37855
|
-
function getPaddingEndOffset(table
|
37855
|
+
function getPaddingEndOffset(table) {
|
37856
37856
|
const bottomRows = table.getBottomRows() ?? [];
|
37857
|
-
return ROW_HEIGHT_ESTIMATES.medium * 1 * bottomRows.length
|
37857
|
+
return ROW_HEIGHT_ESTIMATES.medium * 1 * bottomRows.length;
|
37858
37858
|
}
|
37859
37859
|
const OVERSCAN_ROW_COUNT = 8;
|
37860
|
-
function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIndex
|
37860
|
+
function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIndex) {
|
37861
37861
|
var _a, _b, _c, _d, _e;
|
37862
37862
|
const tableMeta = table.options.meta;
|
37863
37863
|
const isTableRowGrouped = !!((_a = table.getState().grouping) == null ? void 0 : _a.length);
|
@@ -37876,7 +37876,7 @@ function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIn
|
|
37876
37876
|
// correctly sets the scroll padding offset, e.g. when keyboard navigating rows in the list
|
37877
37877
|
scrollPaddingStart,
|
37878
37878
|
scrollPaddingEnd: getScrollPaddingEndOffset(table),
|
37879
|
-
paddingEnd: getPaddingEndOffset(table
|
37879
|
+
paddingEnd: getPaddingEndOffset(table)
|
37880
37880
|
});
|
37881
37881
|
const expandedState = table.getState().expanded;
|
37882
37882
|
const previousExpandedStateRef = React.useRef(false);
|
@@ -37890,15 +37890,15 @@ function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIn
|
|
37890
37890
|
const totalSize = virtualiser.getTotalSize();
|
37891
37891
|
const virtualItems = virtualiser.getVirtualItems();
|
37892
37892
|
const scrollToIndex = React.useCallback(
|
37893
|
-
(index2,
|
37894
|
-
const notSmooth = { ...
|
37893
|
+
(index2, options = { align: "auto", behavior: "smooth" }) => {
|
37894
|
+
const notSmooth = { ...options, behavior: "auto" };
|
37895
37895
|
if (tableRef.current) {
|
37896
37896
|
if (index2 === 0) {
|
37897
37897
|
virtualiser.scrollToOffset(0, notSmooth);
|
37898
37898
|
} else if (index2 === count2 - 1) {
|
37899
37899
|
tableRef.current.scrollTop = tableRef.current.scrollHeight;
|
37900
37900
|
} else {
|
37901
|
-
virtualiser.scrollToIndex(index2,
|
37901
|
+
virtualiser.scrollToIndex(index2, options);
|
37902
37902
|
}
|
37903
37903
|
}
|
37904
37904
|
},
|
@@ -38336,17 +38336,10 @@ const INTERNAL_RENDERERS = {
|
|
38336
38336
|
rowExpansion: renderer$1,
|
38337
38337
|
rowSelection: renderer
|
38338
38338
|
};
|
38339
|
-
function useTable$1(props, externalRef, renderers, meta
|
38339
|
+
function useTable$1(props, externalRef, renderers, meta) {
|
38340
38340
|
const ref = useMergedRef(externalRef);
|
38341
38341
|
const manager = useTableManager(props, ref, meta, INTERNAL_RENDERERS);
|
38342
|
-
const renderer2 = useTableRenderer(
|
38343
|
-
renderers,
|
38344
|
-
manager.instance,
|
38345
|
-
ref,
|
38346
|
-
manager.meta.length,
|
38347
|
-
props.defaultRowActiveIndex,
|
38348
|
-
options
|
38349
|
-
);
|
38342
|
+
const renderer2 = useTableRenderer(renderers, manager.instance, ref, manager.meta.length, props.defaultRowActiveIndex);
|
38350
38343
|
const { style, stylesheet } = useTableStyle(manager.id, manager.instance);
|
38351
38344
|
useTableGlobalShortcuts(manager.instance, ref, renderer2.scrollToIndex, props.enableLocalKeyboardShortcuts);
|
38352
38345
|
useTableRef(manager.instance, ref);
|
@@ -39482,7 +39475,7 @@ const SearchInput22 = React.forwardRef(function SearchInput222(props, ref) {
|
|
39482
39475
|
);
|
39483
39476
|
}
|
39484
39477
|
if (hasFind && isActive) {
|
39485
|
-
postfix = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", { className: "text-grey-700 flex h-4 items-center" }, loading ? /* @__PURE__ */ React.createElement(Spinner, { className: "h-4 w-4" }) : showTotal ? /* @__PURE__ */ React.createElement("span", { className: "border-r border-black/[0.25] pr-2" }, `${findCurrent ?? 0}/${findTotal ?? 0}`) : null), findCurrent ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
39478
|
+
postfix = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", { className: "text-grey-700 flex h-4 items-center" }, loading ? /* @__PURE__ */ React.createElement(Spinner, { className: "h-4 w-4" }) : showTotal ? /* @__PURE__ */ React.createElement("span", { className: "border-r border-black/[0.25] pr-2", "data-taco": "search-matches-counter" }, `${findCurrent ?? 0}/${findTotal ?? 0}`) : null), findCurrent ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
39486
39479
|
IconButton,
|
39487
39480
|
{
|
39488
39481
|
"aria-label": texts.searchInput.findPrevious,
|
@@ -54050,11 +54043,17 @@ function useTableEditingListener(table, tableRef, scrollToIndex) {
|
|
54050
54043
|
}, [hasSavedChanges]);
|
54051
54044
|
React.useEffect(() => {
|
54052
54045
|
const onClickOutside = (event) => {
|
54046
|
+
var _a;
|
54053
54047
|
if (tableMeta.editing.isEditing) {
|
54054
54048
|
const element = event.target;
|
54055
|
-
const
|
54056
|
-
|
54057
|
-
|
54049
|
+
const isClickOnTableOrInsideTable = element.tagName === "TABLE" || element.tagName === "TBODY" || element.getAttribute("data-taco") === "backdrop" || element.getAttribute("data-table") === "editing-toggle" || !document.body.contains(element) || isElementInsideOrTriggeredFromContainer(element, tableRef.current);
|
54050
|
+
if (isClickOnTableOrInsideTable) {
|
54051
|
+
return;
|
54052
|
+
}
|
54053
|
+
const dialog = element.closest('[role="dialog"]');
|
54054
|
+
const isClickInsideParentDialog = dialog !== null && ((_a = tableRef.current) == null ? void 0 : _a.closest('[role="dialog"]')) === dialog;
|
54055
|
+
const isClickOutside = dialog === null;
|
54056
|
+
if (isClickInsideParentDialog || isClickOutside) {
|
54058
54057
|
tableMeta.editing.saveChanges(table);
|
54059
54058
|
}
|
54060
54059
|
}
|
@@ -55279,6 +55278,13 @@ function reducer(state, action) {
|
|
55279
55278
|
indexes: setWith(state.indexes, rowId, index2, Object)
|
55280
55279
|
};
|
55281
55280
|
}
|
55281
|
+
case "forceValidate": {
|
55282
|
+
const { newState } = payload;
|
55283
|
+
return {
|
55284
|
+
...state,
|
55285
|
+
...newState
|
55286
|
+
};
|
55287
|
+
}
|
55282
55288
|
default:
|
55283
55289
|
return state;
|
55284
55290
|
}
|
@@ -55438,6 +55444,46 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
55438
55444
|
}
|
55439
55445
|
});
|
55440
55446
|
}
|
55447
|
+
async function forceValidate(table) {
|
55448
|
+
if (validator && table.getRowModel().rows.length) {
|
55449
|
+
const newState = { ...state };
|
55450
|
+
const returnIds = [];
|
55451
|
+
await Promise.all(
|
55452
|
+
table.getRowModel().rows.map(async (row, index2) => {
|
55453
|
+
var _a, _b;
|
55454
|
+
const rowWithChanges = { ...row.original, ...state.changes.rows[row.id] };
|
55455
|
+
if (rowWithChanges) {
|
55456
|
+
const cellErrors = await validator(rowWithChanges);
|
55457
|
+
if (cellErrors) {
|
55458
|
+
newState.changes.dirty[row.id] = true;
|
55459
|
+
newState.changes.originals[row.id] = row.original;
|
55460
|
+
newState.changes.moveReasons[row.id] = { ...newState.changes.moveReasons[row.id] };
|
55461
|
+
newState.changes.rows[row.id] = { ...newState.changes.rows[row.id] };
|
55462
|
+
newState.changes.status[row.id] = "errored";
|
55463
|
+
newState.indexes[row.id] = index2;
|
55464
|
+
newState.changes.errors[row.id] = {
|
55465
|
+
cells: cellErrors,
|
55466
|
+
row: ((_a = newState.changes.errors[row.id]) == null ? void 0 : _a.row) ?? void 0,
|
55467
|
+
shouldShowErrorAlert: ((_b = newState.changes.errors[row.id]) == null ? void 0 : _b.shouldShowErrorAlert) ?? false
|
55468
|
+
};
|
55469
|
+
Object.keys(cellErrors).forEach((columnId) => {
|
55470
|
+
newState.changes.rows[row.id][columnId] = rowWithChanges[columnId];
|
55471
|
+
});
|
55472
|
+
returnIds.push(row.id);
|
55473
|
+
}
|
55474
|
+
}
|
55475
|
+
})
|
55476
|
+
);
|
55477
|
+
dispatch({
|
55478
|
+
type: "forceValidate",
|
55479
|
+
payload: {
|
55480
|
+
newState
|
55481
|
+
}
|
55482
|
+
});
|
55483
|
+
return returnIds;
|
55484
|
+
}
|
55485
|
+
return [];
|
55486
|
+
}
|
55441
55487
|
function getErrors() {
|
55442
55488
|
return Object.keys(state.changes.errors);
|
55443
55489
|
}
|
@@ -55566,6 +55612,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
55566
55612
|
hasTemporaryRowErrors,
|
55567
55613
|
getRowStatus,
|
55568
55614
|
setRowStatus,
|
55615
|
+
forceValidate,
|
55569
55616
|
// cells
|
55570
55617
|
setCellValue,
|
55571
55618
|
getCellValue,
|
@@ -56319,14 +56366,7 @@ function useTable3(props, ref) {
|
|
56319
56366
|
]) : props.rowActions
|
56320
56367
|
};
|
56321
56368
|
const meta = { editing };
|
56322
|
-
const
|
56323
|
-
virtualiserPaddingEndOffset: 0
|
56324
|
-
};
|
56325
|
-
if (props.enableEditing) {
|
56326
|
-
const validationErrorLabelHeight = 17;
|
56327
|
-
options.virtualiserPaddingEndOffset = editing.getErrors().length * validationErrorLabelHeight;
|
56328
|
-
}
|
56329
|
-
const table = useTable$1(extendedProps, ref, RENDERERS, meta, options);
|
56369
|
+
const table = useTable$1(extendedProps, ref, RENDERERS, meta);
|
56330
56370
|
const toggleEditing = (enabled) => table.meta.editing.toggleEditing(enabled ?? ((editing2) => !editing2), table.instance, table.renderer.scrollToIndex);
|
56331
56371
|
React.useEffect(() => {
|
56332
56372
|
if (props.defaultToggleEditing) {
|
@@ -56349,6 +56389,14 @@ function useTable3(props, ref) {
|
|
56349
56389
|
}
|
56350
56390
|
}
|
56351
56391
|
}, [table.ref.current, table.meta.editing.isEnabled]);
|
56392
|
+
React.useEffect(() => {
|
56393
|
+
if (table.ref.current) {
|
56394
|
+
const instance = table.ref.current.instance;
|
56395
|
+
if (table.meta.editing.isEnabled) {
|
56396
|
+
instance.editing.forceValidate = async () => table.meta.editing.forceValidate(table.instance);
|
56397
|
+
}
|
56398
|
+
}
|
56399
|
+
}, [table.meta.editing.forceValidate]);
|
56352
56400
|
return table;
|
56353
56401
|
}
|
56354
56402
|
function Alert(props) {
|