@economic/taco 2.66.1-test.0 → 2.67.1-create-handler-active-row.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 +90 -37
- package/dist/taco.cjs.map +1 -1
- package/dist/taco.d.ts +7 -4
- package/dist/taco.js +90 -37
- package/dist/taco.js.map +1 -1
- package/package.json +2 -2
package/dist/taco.d.ts
CHANGED
@@ -3043,7 +3043,9 @@ export declare interface Table3CommonProps<TType = unknown> extends Table3Featur
|
|
3043
3043
|
|
3044
3044
|
export declare type Table3EditingChangeHandler<TType = unknown> = (accessor: string, value: unknown, row: TType, prevRow: TType) => Promise<Partial<TType>> | undefined;
|
3045
3045
|
|
3046
|
-
export declare type Table3EditingCreateHandler<TType = unknown> = (
|
3046
|
+
export declare type Table3EditingCreateHandler<TType = unknown> = ({ activeRow }: {
|
3047
|
+
activeRow: TType;
|
3048
|
+
}) => Promise<Partial<TType>>;
|
3047
3049
|
|
3048
3050
|
declare type Table3EditingDiscardHandler = () => void;
|
3049
3051
|
|
@@ -3066,6 +3068,7 @@ export declare type Table3Ref = TableRef & {
|
|
3066
3068
|
createRow?: (row: unknown) => Promise<void>;
|
3067
3069
|
save: (rowId?: string) => Promise<boolean>;
|
3068
3070
|
removeRowChanges: (rowId: string) => Promise<void>;
|
3071
|
+
forceValidate: () => Promise<string[]>;
|
3069
3072
|
};
|
3070
3073
|
};
|
3071
3074
|
};
|
@@ -3382,7 +3385,7 @@ export declare enum TableFilterComparator {
|
|
3382
3385
|
IsNoneOf = 15
|
3383
3386
|
}
|
3384
3387
|
|
3385
|
-
export declare type TableFilterHandler = (filters: TableColumnFilter[], hiddenColumns: string[]) => Promise<void
|
3388
|
+
export declare type TableFilterHandler = (filters: TableColumnFilter[], hiddenColumns: string[]) => Promise<void> | void;
|
3386
3389
|
|
3387
3390
|
export declare type TableFilterValue = {
|
3388
3391
|
comparator: TableFilterComparator;
|
@@ -3455,7 +3458,7 @@ export declare type TableScrollToIndexHandler = (index: number, options?: {
|
|
3455
3458
|
align: 'start' | 'center' | 'end' | 'auto';
|
3456
3459
|
}) => void;
|
3457
3460
|
|
3458
|
-
export declare type TableSearchHandler = (search: string | undefined, hiddenColumns: string[]) => Promise<void
|
3461
|
+
export declare type TableSearchHandler = (search: string | undefined, hiddenColumns: string[]) => Promise<void> | void;
|
3459
3462
|
|
3460
3463
|
export declare type TableServerLoadAllHandler = (sorting: TableColumnSort[], filters: TableColumnFilter[], hiddenColumns: string[], search: string | undefined) => Promise<void>;
|
3461
3464
|
|
@@ -3495,7 +3498,7 @@ export declare type TableShortcutHandlerObject<TType = unknown> = {
|
|
3495
3498
|
|
3496
3499
|
export declare type TableShortcuts<TType = unknown> = Record<string, TableShortcutHandlerFn<TType> | TableShortcutHandlerObject<TType>>;
|
3497
3500
|
|
3498
|
-
export declare type TableSortHandler = (sorting: TableColumnSort[]) => Promise<void
|
3501
|
+
export declare type TableSortHandler = (sorting: TableColumnSort[]) => Promise<void> | void;
|
3499
3502
|
|
3500
3503
|
export declare type TableTexts = {
|
3501
3504
|
columns: {
|
package/dist/taco.js
CHANGED
@@ -26960,7 +26960,7 @@ const Content$4 = React.forwardRef(function HangerContent(props, ref) {
|
|
26960
26960
|
const context = React.useContext(HangerContext);
|
26961
26961
|
const { texts } = useLocalization();
|
26962
26962
|
const className = clsx(
|
26963
|
-
"wcag-blue-500 border border-transparent rounded p-3 pr-12 yt-shadow focus:border-transparent max-w-sm",
|
26963
|
+
"wcag-blue-500 border border-transparent rounded p-3 pr-12 yt-shadow focus:border-transparent max-w-sm print:hidden",
|
26964
26964
|
props.className
|
26965
26965
|
);
|
26966
26966
|
const handleInteractOutside = (event) => {
|
@@ -35633,7 +35633,7 @@ function useReactTableInitialState(props, columns, persistedSettings, defaults2)
|
|
35633
35633
|
columnOrder
|
35634
35634
|
);
|
35635
35635
|
} else {
|
35636
|
-
if (props.defaultColumnFreezingIndex) {
|
35636
|
+
if (props.defaultColumnFreezingIndex !== void 0) {
|
35637
35637
|
columnPinning.left = freezeUptoExternalColumn(props.defaultColumnFreezingIndex, columnOrder);
|
35638
35638
|
} else {
|
35639
35639
|
columnPinning.left = unfreezeAllExternalColumns(columnOrder);
|
@@ -37834,12 +37834,12 @@ function getScrollPaddingEndOffset(table) {
|
|
37834
37834
|
}
|
37835
37835
|
return height;
|
37836
37836
|
}
|
37837
|
-
function getPaddingEndOffset(table
|
37837
|
+
function getPaddingEndOffset(table) {
|
37838
37838
|
const bottomRows = table.getBottomRows() ?? [];
|
37839
|
-
return ROW_HEIGHT_ESTIMATES.medium * 1 * bottomRows.length
|
37839
|
+
return ROW_HEIGHT_ESTIMATES.medium * 1 * bottomRows.length;
|
37840
37840
|
}
|
37841
37841
|
const OVERSCAN_ROW_COUNT = 8;
|
37842
|
-
function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIndex
|
37842
|
+
function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIndex) {
|
37843
37843
|
var _a, _b, _c, _d, _e;
|
37844
37844
|
const tableMeta = table.options.meta;
|
37845
37845
|
const isTableRowGrouped = !!((_a = table.getState().grouping) == null ? void 0 : _a.length);
|
@@ -37858,7 +37858,7 @@ function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIn
|
|
37858
37858
|
// correctly sets the scroll padding offset, e.g. when keyboard navigating rows in the list
|
37859
37859
|
scrollPaddingStart,
|
37860
37860
|
scrollPaddingEnd: getScrollPaddingEndOffset(table),
|
37861
|
-
paddingEnd: getPaddingEndOffset(table
|
37861
|
+
paddingEnd: getPaddingEndOffset(table)
|
37862
37862
|
});
|
37863
37863
|
const expandedState = table.getState().expanded;
|
37864
37864
|
const previousExpandedStateRef = React__default.useRef(false);
|
@@ -37872,15 +37872,15 @@ function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIn
|
|
37872
37872
|
const totalSize = virtualiser.getTotalSize();
|
37873
37873
|
const virtualItems = virtualiser.getVirtualItems();
|
37874
37874
|
const scrollToIndex = React__default.useCallback(
|
37875
|
-
(index2,
|
37876
|
-
const notSmooth = { ...
|
37875
|
+
(index2, options = { align: "auto", behavior: "smooth" }) => {
|
37876
|
+
const notSmooth = { ...options, behavior: "auto" };
|
37877
37877
|
if (tableRef.current) {
|
37878
37878
|
if (index2 === 0) {
|
37879
37879
|
virtualiser.scrollToOffset(0, notSmooth);
|
37880
37880
|
} else if (index2 === count2 - 1) {
|
37881
37881
|
tableRef.current.scrollTop = tableRef.current.scrollHeight;
|
37882
37882
|
} else {
|
37883
|
-
virtualiser.scrollToIndex(index2,
|
37883
|
+
virtualiser.scrollToIndex(index2, options);
|
37884
37884
|
}
|
37885
37885
|
}
|
37886
37886
|
},
|
@@ -38318,17 +38318,10 @@ const INTERNAL_RENDERERS = {
|
|
38318
38318
|
rowExpansion: renderer$1,
|
38319
38319
|
rowSelection: renderer
|
38320
38320
|
};
|
38321
|
-
function useTable$1(props, externalRef, renderers, meta
|
38321
|
+
function useTable$1(props, externalRef, renderers, meta) {
|
38322
38322
|
const ref = useMergedRef(externalRef);
|
38323
38323
|
const manager = useTableManager(props, ref, meta, INTERNAL_RENDERERS);
|
38324
|
-
const renderer2 = useTableRenderer(
|
38325
|
-
renderers,
|
38326
|
-
manager.instance,
|
38327
|
-
ref,
|
38328
|
-
manager.meta.length,
|
38329
|
-
props.defaultRowActiveIndex,
|
38330
|
-
options
|
38331
|
-
);
|
38324
|
+
const renderer2 = useTableRenderer(renderers, manager.instance, ref, manager.meta.length, props.defaultRowActiveIndex);
|
38332
38325
|
const { style, stylesheet } = useTableStyle(manager.id, manager.instance);
|
38333
38326
|
useTableGlobalShortcuts(manager.instance, ref, renderer2.scrollToIndex, props.enableLocalKeyboardShortcuts);
|
38334
38327
|
useTableRef(manager.instance, ref);
|
@@ -39019,6 +39012,9 @@ function Header$1(props) {
|
|
39019
39012
|
if (canHide) {
|
39020
39013
|
memoedProps.onHide = header.column.getToggleVisibilityHandler();
|
39021
39014
|
}
|
39015
|
+
if (header.id === "__expansion") {
|
39016
|
+
memoedProps.isExpanded = table.getIsSomeRowsExpanded();
|
39017
|
+
}
|
39022
39018
|
if (canPin) {
|
39023
39019
|
memoedProps.onPin = (index2) => {
|
39024
39020
|
table.setColumnPinning((pinningState) => {
|
@@ -39069,6 +39065,7 @@ const MemoedHeader = React__default.memo(function MemoedHeader2(props) {
|
|
39069
39065
|
hasMenu,
|
39070
39066
|
id: id2,
|
39071
39067
|
index: index2,
|
39068
|
+
isExpanded,
|
39072
39069
|
isFiltered,
|
39073
39070
|
isGroup: isGroup2,
|
39074
39071
|
isPinned,
|
@@ -39108,6 +39105,7 @@ const MemoedHeader = React__default.memo(function MemoedHeader2(props) {
|
|
39108
39105
|
"data-cell-id": id2,
|
39109
39106
|
"data-cell-pinned": isPinned ? isPinned : void 0,
|
39110
39107
|
"data-taco": isGroup2 ? "grouped-column-header" : "column-header",
|
39108
|
+
"data-rows-expanded": isExpanded ? isExpanded : void 0,
|
39111
39109
|
style,
|
39112
39110
|
ref: setRef
|
39113
39111
|
},
|
@@ -39302,10 +39300,10 @@ function Summary(props) {
|
|
39302
39300
|
} else if (!tableMeta.server.isEnabled && (((_a = table.getState().columnFilters) == null ? void 0 : _a.length) || // filtered data
|
39303
39301
|
!!table.getState().globalFilter && table.options.enableGlobalFilter)) {
|
39304
39302
|
label = texts.table.footer.summary.records;
|
39305
|
-
count2 = /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("strong",
|
39303
|
+
count2 = /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("strong", { "data-taco": "table-footer-current-count" }, new Intl.NumberFormat(locale2).format(currentLength)), " ", texts.table.footer.summary.count, " ", /* @__PURE__ */ React__default.createElement("strong", { "data-taco": "table-footer-total-count" }, new Intl.NumberFormat(locale2).format(length)));
|
39306
39304
|
} else {
|
39307
39305
|
label = texts.table.footer.summary.records;
|
39308
|
-
count2 = /* @__PURE__ */ React__default.createElement("strong",
|
39306
|
+
count2 = /* @__PURE__ */ React__default.createElement("strong", { "data-taco": "table-footer-total-count" }, new Intl.NumberFormat(locale2).format(length));
|
39309
39307
|
}
|
39310
39308
|
return /* @__PURE__ */ React__default.createElement(
|
39311
39309
|
"div",
|
@@ -39464,7 +39462,7 @@ const SearchInput22 = React__default.forwardRef(function SearchInput222(props, r
|
|
39464
39462
|
);
|
39465
39463
|
}
|
39466
39464
|
if (hasFind && isActive) {
|
39467
|
-
postfix = /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("span", { className: "text-grey-700 flex h-4 items-center" }, loading ? /* @__PURE__ */ React__default.createElement(Spinner, { className: "h-4 w-4" }) : showTotal ? /* @__PURE__ */ React__default.createElement("span", { className: "border-r border-black/[0.25] pr-2" }, `${findCurrent ?? 0}/${findTotal ?? 0}`) : null), findCurrent ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
39465
|
+
postfix = /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("span", { className: "text-grey-700 flex h-4 items-center" }, loading ? /* @__PURE__ */ React__default.createElement(Spinner, { className: "h-4 w-4" }) : showTotal ? /* @__PURE__ */ React__default.createElement("span", { className: "border-r border-black/[0.25] pr-2", "data-taco": "search-matches-counter" }, `${findCurrent ?? 0}/${findTotal ?? 0}`) : null), findCurrent ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
39468
39466
|
IconButton,
|
39469
39467
|
{
|
39470
39468
|
"aria-label": texts.searchInput.findPrevious,
|
@@ -45156,6 +45154,7 @@ function Print(props) {
|
|
45156
45154
|
{
|
45157
45155
|
icon: "print",
|
45158
45156
|
"aria-label": texts.table.print.tooltip,
|
45157
|
+
id: `${tableId}-toolbar-print`,
|
45159
45158
|
dialog: (dialogProps) => /* @__PURE__ */ React__default.createElement(
|
45160
45159
|
PrintDialog,
|
45161
45160
|
{
|
@@ -45492,7 +45491,7 @@ function Filter(props) {
|
|
45492
45491
|
ref.current.focus();
|
45493
45492
|
}
|
45494
45493
|
}, [id2]);
|
45495
|
-
return /* @__PURE__ */ React__default.createElement("div", { className: "flex items-start gap-2" }, /* @__PURE__ */ React__default.createElement("div", { className: "flex min-h-[theme(spacing.8)] w-14 flex-shrink-0 items-center justify-end pr-2 text-right" }, position > 0 ? texts.table.filters.conditions.and : texts.table.filters.conditions.where), /* @__PURE__ */ React__default.createElement(FilterColumn, { allHeaders, onChange: handleChangeColumn, value: id2, ref }), /* @__PURE__ */ React__default.createElement(FilterComparator, { column: column == null ? void 0 : column.column, onChange: handleChangeComparator, value: comparator }), /* @__PURE__ */ React__default.createElement(FilterValue, { column: column == null ? void 0 : column.column, comparator, onChange: handleChangeValue, value }), onRemove ? /* @__PURE__ */ React__default.createElement(IconButton, { appearance: "discrete", className: "ml-auto", icon: "close", onClick: handleRemove }) : null);
|
45494
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: "flex items-start gap-2", "data-taco": "filter-row" }, /* @__PURE__ */ React__default.createElement("div", { className: "flex min-h-[theme(spacing.8)] w-14 flex-shrink-0 items-center justify-end pr-2 text-right" }, position > 0 ? texts.table.filters.conditions.and : texts.table.filters.conditions.where), /* @__PURE__ */ React__default.createElement(FilterColumn, { allHeaders, onChange: handleChangeColumn, value: id2, ref }), /* @__PURE__ */ React__default.createElement(FilterComparator, { column: column == null ? void 0 : column.column, onChange: handleChangeComparator, value: comparator }), /* @__PURE__ */ React__default.createElement(FilterValue, { column: column == null ? void 0 : column.column, comparator, onChange: handleChangeValue, value }), onRemove ? /* @__PURE__ */ React__default.createElement(IconButton, { appearance: "discrete", className: "ml-auto", icon: "close", onClick: handleRemove }) : null);
|
45496
45495
|
}
|
45497
45496
|
const placeholderFilter = { id: "", value: { comparator: TableFilterComparator.Contains, value: void 0 } };
|
45498
45497
|
function ManageFiltersPopover(props) {
|
@@ -45573,10 +45572,10 @@ function ManageFiltersPopover(props) {
|
|
45573
45572
|
onChange: handleChangeFilter,
|
45574
45573
|
onRemove: filters.length > 0 && filters.some((f2) => f2.id) || filters.length > 1 ? handleRemoveFilter : void 0
|
45575
45574
|
}
|
45576
|
-
)), /* @__PURE__ */ React__default.createElement("div", { className: "justify-start" }, /* @__PURE__ */ React__default.createElement(Button$4, { appearance: "discrete", onClick: handleCreate }, "+ ", texts.table.filters.buttons.addFilter))), /* @__PURE__ */ React__default.createElement(Group$6, { className: "ml-auto" }, /* @__PURE__ */ React__default.createElement(Popover.Close, null, /* @__PURE__ */ React__default.createElement(Button$4,
|
45575
|
+
)), /* @__PURE__ */ React__default.createElement("div", { className: "justify-start" }, /* @__PURE__ */ React__default.createElement(Button$4, { appearance: "discrete", onClick: handleCreate, name: "add-filter" }, "+ ", texts.table.filters.buttons.addFilter))), /* @__PURE__ */ React__default.createElement(Group$6, { className: "ml-auto" }, /* @__PURE__ */ React__default.createElement(Popover.Close, null, /* @__PURE__ */ React__default.createElement(Button$4, { name: "close-filters" }, texts.table.filters.buttons.cancel)), /* @__PURE__ */ React__default.createElement(Button$4, { name: "clear-filters", onClick: handleClear }, texts.table.filters.buttons.clear), /* @__PURE__ */ React__default.createElement(Button$4, { appearance: "primary", name: "apply-filters", onClick: handleApply }, texts.table.filters.buttons.apply))))));
|
45577
45576
|
}
|
45578
45577
|
function Filters(props) {
|
45579
|
-
const { length, table } = props;
|
45578
|
+
const { length, tableId, table } = props;
|
45580
45579
|
const { texts } = useLocalization();
|
45581
45580
|
const isLargeScreen = useIsLargeScreen();
|
45582
45581
|
const columnFilters = table.getState().columnFilters;
|
@@ -45589,7 +45588,8 @@ function Filters(props) {
|
|
45589
45588
|
popover: (popoverProps) => /* @__PURE__ */ React__default.createElement(ManageFiltersPopover, { ...popoverProps, length, table }),
|
45590
45589
|
shortcut: shortcut2,
|
45591
45590
|
ref,
|
45592
|
-
tooltip: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, texts.table.filters.tooltip, /* @__PURE__ */ React__default.createElement(Shortcut, { className: "ml-2", keys: shortcut2 }))
|
45591
|
+
tooltip: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, texts.table.filters.tooltip, /* @__PURE__ */ React__default.createElement(Shortcut, { className: "ml-2", keys: shortcut2 })),
|
45592
|
+
id: `${tableId}-toolbar-filters`
|
45593
45593
|
};
|
45594
45594
|
React__default.useEffect(() => {
|
45595
45595
|
var _a;
|
@@ -45622,7 +45622,7 @@ function TableToolbar(props) {
|
|
45622
45622
|
"data-taco": "table-toolbar"
|
45623
45623
|
},
|
45624
45624
|
table.props.toolbarLeft,
|
45625
|
-
/* @__PURE__ */ React__default.createElement(Group$6, { className: "ml-auto flex-shrink-0 items-center print:hidden" }, customTools, canFilter ? /* @__PURE__ */ React__default.createElement(Filters, { length: table.meta.length, table: table.instance }) : null, table.props.toolbarRight, canPrint ? /* @__PURE__ */ React__default.createElement(Print, { table: table.instance, tableId: table.id, tableRef: table.ref }) : null, canSettings ? /* @__PURE__ */ React__default.createElement(Settings, { customSettings: table.props.customSettings, id: `${id2}-settings`, table: table.instance }) : null, canSearch ? /* @__PURE__ */ React__default.createElement(Search$1, { scrollToIndex: table.renderer.scrollToIndex, table: table.instance, tableRef: table.ref }) : null)
|
45625
|
+
/* @__PURE__ */ React__default.createElement(Group$6, { className: "ml-auto flex-shrink-0 items-center print:hidden" }, customTools, canFilter ? /* @__PURE__ */ React__default.createElement(Filters, { length: table.meta.length, tableId: table.id, table: table.instance }) : null, table.props.toolbarRight, canPrint ? /* @__PURE__ */ React__default.createElement(Print, { table: table.instance, tableId: table.id, tableRef: table.ref }) : null, canSettings ? /* @__PURE__ */ React__default.createElement(Settings, { customSettings: table.props.customSettings, id: `${id2}-settings`, table: table.instance }) : null, canSearch ? /* @__PURE__ */ React__default.createElement(Search$1, { scrollToIndex: table.renderer.scrollToIndex, table: table.instance, tableRef: table.ref }) : null)
|
45626
45626
|
), table.props.toolbarPanel ? /* @__PURE__ */ React__default.createElement("div", { className: "mb-4" }, table.props.toolbarPanel) : void 0);
|
45627
45627
|
}
|
45628
45628
|
function canChangeSettings(table, customSettings) {
|
@@ -55267,6 +55267,13 @@ function reducer(state, action) {
|
|
55267
55267
|
indexes: setWith(state.indexes, rowId, index2, Object)
|
55268
55268
|
};
|
55269
55269
|
}
|
55270
|
+
case "forceValidate": {
|
55271
|
+
const { newState } = payload;
|
55272
|
+
return {
|
55273
|
+
...state,
|
55274
|
+
...newState
|
55275
|
+
};
|
55276
|
+
}
|
55270
55277
|
default:
|
55271
55278
|
return state;
|
55272
55279
|
}
|
@@ -55426,6 +55433,46 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
55426
55433
|
}
|
55427
55434
|
});
|
55428
55435
|
}
|
55436
|
+
async function forceValidate(table) {
|
55437
|
+
if (validator && table.getRowModel().rows.length) {
|
55438
|
+
const newState = { ...state };
|
55439
|
+
const returnIds = [];
|
55440
|
+
await Promise.all(
|
55441
|
+
table.getRowModel().rows.map(async (row, index2) => {
|
55442
|
+
var _a, _b;
|
55443
|
+
const rowWithChanges = { ...row.original, ...state.changes.rows[row.id] };
|
55444
|
+
if (rowWithChanges) {
|
55445
|
+
const cellErrors = await validator(rowWithChanges);
|
55446
|
+
if (cellErrors) {
|
55447
|
+
newState.changes.dirty[row.id] = true;
|
55448
|
+
newState.changes.originals[row.id] = row.original;
|
55449
|
+
newState.changes.moveReasons[row.id] = { ...newState.changes.moveReasons[row.id] };
|
55450
|
+
newState.changes.rows[row.id] = { ...newState.changes.rows[row.id] };
|
55451
|
+
newState.changes.status[row.id] = "errored";
|
55452
|
+
newState.indexes[row.id] = index2;
|
55453
|
+
newState.changes.errors[row.id] = {
|
55454
|
+
cells: cellErrors,
|
55455
|
+
row: ((_a = newState.changes.errors[row.id]) == null ? void 0 : _a.row) ?? void 0,
|
55456
|
+
shouldShowErrorAlert: ((_b = newState.changes.errors[row.id]) == null ? void 0 : _b.shouldShowErrorAlert) ?? false
|
55457
|
+
};
|
55458
|
+
Object.keys(cellErrors).forEach((columnId) => {
|
55459
|
+
newState.changes.rows[row.id][columnId] = rowWithChanges[columnId];
|
55460
|
+
});
|
55461
|
+
returnIds.push(row.id);
|
55462
|
+
}
|
55463
|
+
}
|
55464
|
+
})
|
55465
|
+
);
|
55466
|
+
dispatch({
|
55467
|
+
type: "forceValidate",
|
55468
|
+
payload: {
|
55469
|
+
newState
|
55470
|
+
}
|
55471
|
+
});
|
55472
|
+
return returnIds;
|
55473
|
+
}
|
55474
|
+
return [];
|
55475
|
+
}
|
55429
55476
|
function getErrors() {
|
55430
55477
|
return Object.keys(state.changes.errors);
|
55431
55478
|
}
|
@@ -55554,6 +55601,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
55554
55601
|
hasTemporaryRowErrors,
|
55555
55602
|
getRowStatus,
|
55556
55603
|
setRowStatus,
|
55604
|
+
forceValidate,
|
55557
55605
|
// cells
|
55558
55606
|
setCellValue,
|
55559
55607
|
getCellValue,
|
@@ -55607,6 +55655,7 @@ function useTableEditing(isEnabled = false, defaultToggleEditing = false, handle
|
|
55607
55655
|
pendingChangesFns.saveChanges(table);
|
55608
55656
|
}
|
55609
55657
|
async function createRow2(table, row) {
|
55658
|
+
var _a, _b;
|
55610
55659
|
if (!handleCreate) {
|
55611
55660
|
return;
|
55612
55661
|
}
|
@@ -55617,7 +55666,10 @@ function useTableEditing(isEnabled = false, defaultToggleEditing = false, handle
|
|
55617
55666
|
return;
|
55618
55667
|
}
|
55619
55668
|
}
|
55620
|
-
const
|
55669
|
+
const currentRow = ((_a = table.options.meta) == null ? void 0 : _a.rowActive.rowActiveIndex) !== void 0 ? table.getRowModel().flatRows[(_b = table.options.meta) == null ? void 0 : _b.rowActive.rowActiveIndex] : void 0;
|
55670
|
+
const changeset = row ?? await handleCreate({
|
55671
|
+
activeRow: currentRow ? { ...currentRow.original, ...tableMeta.editing.getRowValue(currentRow.id) } : void 0
|
55672
|
+
});
|
55621
55673
|
try {
|
55622
55674
|
if (changeset) {
|
55623
55675
|
const temporaryRows = tableMeta.editing.temporaryRows;
|
@@ -55626,10 +55678,10 @@ function useTableEditing(isEnabled = false, defaultToggleEditing = false, handle
|
|
55626
55678
|
requestAnimationFrame(() => {
|
55627
55679
|
const newRowId = pendingChangesFns.insertTemporaryRow(changeset, nextRowIndex);
|
55628
55680
|
table.setRowPinning((currentState) => {
|
55629
|
-
var
|
55681
|
+
var _a2;
|
55630
55682
|
return {
|
55631
55683
|
...currentState,
|
55632
|
-
bottom: (
|
55684
|
+
bottom: (_a2 = currentState.bottom ?? []) == null ? void 0 : _a2.concat(newRowId)
|
55633
55685
|
};
|
55634
55686
|
});
|
55635
55687
|
toggleDetailedMode(false);
|
@@ -56307,14 +56359,7 @@ function useTable3(props, ref) {
|
|
56307
56359
|
]) : props.rowActions
|
56308
56360
|
};
|
56309
56361
|
const meta = { editing };
|
56310
|
-
const
|
56311
|
-
virtualiserPaddingEndOffset: 0
|
56312
|
-
};
|
56313
|
-
if (props.enableEditing) {
|
56314
|
-
const validationErrorLabelHeight = 17;
|
56315
|
-
options.virtualiserPaddingEndOffset = editing.getErrors().length * validationErrorLabelHeight;
|
56316
|
-
}
|
56317
|
-
const table = useTable$1(extendedProps, ref, RENDERERS, meta, options);
|
56362
|
+
const table = useTable$1(extendedProps, ref, RENDERERS, meta);
|
56318
56363
|
const toggleEditing = (enabled) => table.meta.editing.toggleEditing(enabled ?? ((editing2) => !editing2), table.instance, table.renderer.scrollToIndex);
|
56319
56364
|
React__default.useEffect(() => {
|
56320
56365
|
if (props.defaultToggleEditing) {
|
@@ -56337,6 +56382,14 @@ function useTable3(props, ref) {
|
|
56337
56382
|
}
|
56338
56383
|
}
|
56339
56384
|
}, [table.ref.current, table.meta.editing.isEnabled]);
|
56385
|
+
React__default.useEffect(() => {
|
56386
|
+
if (table.ref.current) {
|
56387
|
+
const instance = table.ref.current.instance;
|
56388
|
+
if (table.meta.editing.isEnabled) {
|
56389
|
+
instance.editing.forceValidate = async () => table.meta.editing.forceValidate(table.instance);
|
56390
|
+
}
|
56391
|
+
}
|
56392
|
+
}, [table.meta.editing.forceValidate]);
|
56340
56393
|
return table;
|
56341
56394
|
}
|
56342
56395
|
function Alert(props) {
|