@economic/taco 2.64.1-dataloader2-infinite-loop.0 → 2.64.1-stale-validator.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 +27 -14
- package/dist/taco.cjs.map +1 -1
- package/dist/taco.js +27 -14
- package/dist/taco.js.map +1 -1
- package/package.json +2 -2
package/dist/taco.js
CHANGED
@@ -38428,6 +38428,21 @@ function Cell$2(props) {
|
|
38428
38428
|
}
|
38429
38429
|
return /* @__PURE__ */ React__default.createElement(CellRenderer, { ...cellProps });
|
38430
38430
|
}
|
38431
|
+
const useResizeObserver$1 = (ref, enabled = true) => {
|
38432
|
+
const [size2, setSize] = React__default.useState();
|
38433
|
+
React__default.useEffect(() => {
|
38434
|
+
if (!ref.current || !enabled) {
|
38435
|
+
return () => void 0;
|
38436
|
+
}
|
38437
|
+
const observer = new ResizeObserver((entries) => {
|
38438
|
+
const entry = entries[0];
|
38439
|
+
setSize({ height: entry.contentRect.height, width: entry.contentRect.width });
|
38440
|
+
});
|
38441
|
+
observer.observe(ref.current);
|
38442
|
+
return () => observer.disconnect();
|
38443
|
+
}, [enabled]);
|
38444
|
+
return size2;
|
38445
|
+
};
|
38431
38446
|
const DisplayRow = React__default.memo(function DisplayRow2(props) {
|
38432
38447
|
var _a, _b, _c;
|
38433
38448
|
const { children, cellRenderer: CellRenderer, index: index2, measureRow, row, table, ...otherAttributes } = props;
|
@@ -38522,12 +38537,13 @@ const DisplayRow = React__default.memo(function DisplayRow2(props) {
|
|
38522
38537
|
}
|
38523
38538
|
const ref = React__default.useRef(null);
|
38524
38539
|
const expansionRef = React__default.useRef(null);
|
38540
|
+
const expandedRowSize = useResizeObserver$1(expansionRef, !!expandedRow);
|
38525
38541
|
React__default.useEffect(() => {
|
38526
38542
|
var _a2, _b2;
|
38527
38543
|
const rowHeight = ((_a2 = ref.current) == null ? void 0 : _a2.getBoundingClientRect().height) ?? 0;
|
38528
38544
|
const expansionHeight = ((_b2 = expansionRef.current) == null ? void 0 : _b2.getBoundingClientRect().height) ?? 0;
|
38529
38545
|
measureRow(rowHeight + expansionHeight);
|
38530
|
-
}, [expansionRef.current]);
|
38546
|
+
}, [expansionRef.current, expandedRowSize == null ? void 0 : expandedRowSize.height]);
|
38531
38547
|
const className = clsx("group/row", otherAttributes.className, {
|
38532
38548
|
"hover:cursor-grab": tableMeta.rowDrag.isEnabled && typeof attributes.onClick !== "function",
|
38533
38549
|
"hover:cursor-pointer": typeof attributes.onClick === "function"
|
@@ -53904,14 +53920,6 @@ function isTableScrolled(ref) {
|
|
53904
53920
|
function useTableEditingListener(table, tableRef, scrollToIndex) {
|
53905
53921
|
const tableMeta = table.options.meta;
|
53906
53922
|
const localization = useLocalization();
|
53907
|
-
useLazyEffect(() => {
|
53908
|
-
return () => {
|
53909
|
-
var _a;
|
53910
|
-
if (tableMeta.editing.isEditing && tableMeta.rowActive.rowActiveIndex !== void 0) {
|
53911
|
-
tableMeta.editing.saveChanges(table, (_a = table.getRowModel().rows[tableMeta.rowActive.rowActiveIndex]) == null ? void 0 : _a.id);
|
53912
|
-
}
|
53913
|
-
};
|
53914
|
-
}, [tableMeta.rowActive.rowActiveIndex, tableMeta.editing.isEditing]);
|
53915
53923
|
const hasChanges = tableMeta.editing.hasChanges();
|
53916
53924
|
React__default.useEffect(() => {
|
53917
53925
|
function showUnsavedChangesWarning(event) {
|
@@ -55256,7 +55264,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
55256
55264
|
var _a, _b, _c;
|
55257
55265
|
return (_c = (_b = (_a = state.changes.errors) == null ? void 0 : _a[cell.row.id]) == null ? void 0 : _b.cells) == null ? void 0 : _c[cell.column.id];
|
55258
55266
|
}
|
55259
|
-
async function onCellChanged(cell, rowIndex, nextValue, shouldRunUpdaters = true) {
|
55267
|
+
async function onCellChanged(cell, rowIndex, nextValue, shouldRunUpdaters = true, shouldRunValidation = true) {
|
55260
55268
|
var _a;
|
55261
55269
|
const tableMeta = cell.getContext().table.options.meta;
|
55262
55270
|
const state2 = tableMeta.editing.getState();
|
@@ -55286,7 +55294,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
55286
55294
|
const nextMoveReasons = { ...state2.changes.moveReasons[cell.row.id] };
|
55287
55295
|
const nextCellErrors = { ...(_a = state2.changes.errors[cell.row.id]) == null ? void 0 : _a.cells };
|
55288
55296
|
let validationErrors = {};
|
55289
|
-
if (validator && Object.keys(nextChanges).length && original) {
|
55297
|
+
if (validator && Object.keys(nextChanges).length && original && shouldRunValidation) {
|
55290
55298
|
const nextRowValue = { ...original, ...changes, ...updatesForOtherCells };
|
55291
55299
|
validationErrors = await validator(nextRowValue) ?? {};
|
55292
55300
|
}
|
@@ -55768,7 +55776,7 @@ function EditingControlCell(props) {
|
|
55768
55776
|
if (hasChanged) {
|
55769
55777
|
tableMeta.editing.setCellValue(cell, rowIndex, nextValue);
|
55770
55778
|
if (hasNonTextControl) {
|
55771
|
-
requestAnimationFrame(() => tableMeta.editing.onCellChanged(cell, rowIndex, nextValue));
|
55779
|
+
requestAnimationFrame(() => tableMeta.editing.onCellChanged(cell, rowIndex, nextValue, true, false));
|
55772
55780
|
}
|
55773
55781
|
}
|
55774
55782
|
},
|
@@ -55781,7 +55789,7 @@ function EditingControlCell(props) {
|
|
55781
55789
|
}
|
55782
55790
|
requestAnimationFrame(() => {
|
55783
55791
|
tableMeta.editing.toggleDetailedMode(false);
|
55784
|
-
tableMeta.editing.onCellChanged(cell, rowIndex, void 0, !hasNonTextControl);
|
55792
|
+
tableMeta.editing.onCellChanged(cell, rowIndex, void 0, !hasNonTextControl, true);
|
55785
55793
|
});
|
55786
55794
|
},
|
55787
55795
|
[hasNonTextControl, cell.row.id, JSON.stringify(rowChanges), rowIndex, cell.column.id, cell.row.original]
|
@@ -56077,6 +56085,11 @@ function Row(props) {
|
|
56077
56085
|
}
|
56078
56086
|
}
|
56079
56087
|
}, [tableMeta.editing.isEditing, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.lastFocusedCellIndex]);
|
56088
|
+
useLazyEffect(() => {
|
56089
|
+
if (tableMeta.editing.isEditing && !isActiveRow) {
|
56090
|
+
tableMeta.editing.saveChanges(table, row.id);
|
56091
|
+
}
|
56092
|
+
}, [isActiveRow]);
|
56080
56093
|
const handleFocus = React__default.useCallback(
|
56081
56094
|
(event) => {
|
56082
56095
|
var _a;
|
@@ -88572,7 +88585,7 @@ function getDirection(pageIndex, currentPages) {
|
|
88572
88585
|
return void 0;
|
88573
88586
|
}
|
88574
88587
|
function getPages(pageIndex, lastUsedPageIndex, currentPages, direction) {
|
88575
|
-
if (currentPages.length && (pageIndex === lastUsedPageIndex || currentPages.includes(pageIndex)
|
88588
|
+
if (currentPages.length && (pageIndex === lastUsedPageIndex || currentPages.includes(pageIndex))) {
|
88576
88589
|
return currentPages;
|
88577
88590
|
}
|
88578
88591
|
if (direction === "forward") {
|