@economic/taco 2.69.0 → 2.69.2-alpha.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 +108 -76
- package/dist/taco.cjs.map +1 -1
- package/dist/taco.d.ts +4 -4
- package/dist/taco.js +108 -76
- package/dist/taco.js.map +1 -1
- package/package.json +3 -3
- package/tailwind.config.js +0 -3
package/dist/taco.d.ts
CHANGED
@@ -1057,7 +1057,7 @@ export declare type DialogContentDrawerRenderProps = DialogContext['drawer'];
|
|
1057
1057
|
export declare type DialogContentProps = Omit<React_2.HTMLAttributes<HTMLDivElement>, 'children'> & {
|
1058
1058
|
/** An accessible label to be announced when the dialog is opened */
|
1059
1059
|
'aria-label': string;
|
1060
|
-
children:
|
1060
|
+
children: React_2.ReactNode | ((props: DialogContentRenderProps) => JSX.Element);
|
1061
1061
|
onOpenAutoFocus?: DialogPrimitive.DialogContentProps['onOpenAutoFocus'];
|
1062
1062
|
onCloseAutoFocus?: DialogPrimitive.DialogContentProps['onCloseAutoFocus'];
|
1063
1063
|
};
|
@@ -1165,7 +1165,7 @@ declare type DrawerCloseProps = default_2.HTMLAttributes<HTMLButtonElement>;
|
|
1165
1165
|
declare type DrawerContentProps = Omit<default_2.HTMLAttributes<HTMLDivElement>, 'children'> & {
|
1166
1166
|
/** An accessible label to be announced when the side drawer is opened */
|
1167
1167
|
'aria-label': string;
|
1168
|
-
children:
|
1168
|
+
children: default_2.ReactNode | ((props: DrawerContentRenderProps) => JSX.Element);
|
1169
1169
|
};
|
1170
1170
|
|
1171
1171
|
declare type DrawerContentRenderProps = {
|
@@ -3071,7 +3071,7 @@ export declare type Table3Ref = TableRef & {
|
|
3071
3071
|
createRow?: (row: unknown) => Promise<void>;
|
3072
3072
|
save: (rowId?: string) => Promise<boolean>;
|
3073
3073
|
removeRowChanges: (rowId: string) => Promise<void>;
|
3074
|
-
forceValidate
|
3074
|
+
forceValidate?: () => Promise<string[]>;
|
3075
3075
|
};
|
3076
3076
|
};
|
3077
3077
|
};
|
@@ -3930,7 +3930,7 @@ export declare const Truncate: ({ children, tooltip }: TruncateProps) => default
|
|
3930
3930
|
|
3931
3931
|
export declare type TruncateProps = {
|
3932
3932
|
children: default_2.ReactElement;
|
3933
|
-
tooltip: string;
|
3933
|
+
tooltip: string | JSX.Element;
|
3934
3934
|
};
|
3935
3935
|
|
3936
3936
|
export declare interface UncontrolledCheckboxProps extends CheckboxBaseProps {
|
package/dist/taco.js
CHANGED
@@ -11391,22 +11391,22 @@ const getButtonClasses$1 = () => {
|
|
11391
11391
|
const getAppearanceClasses = (value, icon = false) => {
|
11392
11392
|
switch (value) {
|
11393
11393
|
case "primary":
|
11394
|
-
return `wcag-blue-500 visited:wcag-blue-500 hover:wcag-blue-700 hover:active:wcag-blue-500 aria-disabled:bg-blue-500/50 aria-disabled:active:bg-blue-500/50`;
|
11394
|
+
return `wcag-blue-500 visited:wcag-blue-500 hover:wcag-blue-700 hover:active:wcag-blue-500 focus-visible:wcag-blue-500 aria-disabled:bg-blue-500/50 aria-disabled:active:bg-blue-500/50`;
|
11395
11395
|
case "danger":
|
11396
|
-
return `wcag-red-500 visited:wcag-red-500 hover:wcag-red-700 hover:active:wcag-red-500 aria-disabled:bg-red-500/50 aria-disabled:active:bg-red-500/50`;
|
11396
|
+
return `wcag-red-500 visited:wcag-red-500 hover:wcag-red-700 hover:active:wcag-red-500 focus-visible:wcag-red-500 aria-disabled:bg-red-500/50 aria-disabled:active:bg-red-500/50`;
|
11397
11397
|
case "ghost":
|
11398
|
-
return `bg-white border border-blue-500 text-blue-500 visited:text-blue-500 hover:bg-blue-100 hover:text-blue-700 aria-disabled:border-blue-500/50 aria-disabled:text-blue-500/50 aria-disabled:bg-white`;
|
11398
|
+
return `bg-white border border-blue-500 text-blue-500 visited:text-blue-500 hover:bg-blue-100 hover:text-blue-700 focus-visible:text-blue-700 aria-disabled:border-blue-500/50 aria-disabled:text-blue-500/50 aria-disabled:bg-white`;
|
11399
11399
|
case "discrete": {
|
11400
11400
|
if (icon) {
|
11401
|
-
return `bg-transparent text-black visited:text-black hover:bg-[#000]/[0.08] aria-disabled:text-black/30`;
|
11401
|
+
return `bg-transparent text-black visited:text-black hover:bg-[#000]/[0.08] focus-visible:bg-[#000]/[0.08] aria-disabled:text-black/30`;
|
11402
11402
|
}
|
11403
|
-
return `bg-transparent text-blue-500 visited:text-blue-500 hover:text-blue-700 aria-disabled:text-blue-500/50`;
|
11403
|
+
return `bg-transparent text-blue-500 visited:text-blue-500 hover:text-blue-700 focus-visible:text-blue-700 aria-disabled:text-blue-500/50`;
|
11404
11404
|
}
|
11405
11405
|
case "transparent": {
|
11406
|
-
return `bg-transparent text-black visited:text-black hover:text-black hover:bg-[#000]/[0.08] aria-disabled:text-black/30 aria-disabled:bg-transparent`;
|
11406
|
+
return `bg-transparent text-black visited:text-black hover:text-black focus-visible:text-black hover:bg-[#000]/[0.08] aria-disabled:text-black/30 aria-disabled:bg-transparent`;
|
11407
11407
|
}
|
11408
11408
|
default:
|
11409
|
-
return `wcag-grey-200 visited:wcag-grey-200 hover:wcag-grey-300 aria-disabled:bg-grey-200/50 aria-disabled:text-black/30`;
|
11409
|
+
return `wcag-grey-200 visited:wcag-grey-200 hover:wcag-grey-300 focus-visible:wcag-grey-300 aria-disabled:bg-grey-200/50 aria-disabled:text-black/30`;
|
11410
11410
|
}
|
11411
11411
|
};
|
11412
11412
|
const createButtonWithTooltip = (props, className, ref) => {
|
@@ -38481,7 +38481,16 @@ const useResizeObserver$1 = (ref, enabled = true) => {
|
|
38481
38481
|
const DisplayRow = React__default.memo(
|
38482
38482
|
React__default.forwardRef(function DisplayRow2(props, externalRef) {
|
38483
38483
|
var _a, _b, _c;
|
38484
|
-
const {
|
38484
|
+
const {
|
38485
|
+
children,
|
38486
|
+
cellRenderer: CellRenderer,
|
38487
|
+
index: index2,
|
38488
|
+
measureRow,
|
38489
|
+
row,
|
38490
|
+
table,
|
38491
|
+
remeasureDependencies = [],
|
38492
|
+
...otherAttributes
|
38493
|
+
} = props;
|
38485
38494
|
const tableMeta = table.options.meta;
|
38486
38495
|
const attributes = {
|
38487
38496
|
...otherAttributes,
|
@@ -38577,7 +38586,7 @@ const DisplayRow = React__default.memo(
|
|
38577
38586
|
const rowHeight = ((_a2 = ref.current) == null ? void 0 : _a2.getBoundingClientRect().height) ?? 0;
|
38578
38587
|
const expansionHeight = ((_b2 = expansionRef.current) == null ? void 0 : _b2.getBoundingClientRect().height) ?? 0;
|
38579
38588
|
measureRow(rowHeight + expansionHeight);
|
38580
|
-
}, [expansionRef.current, expandedRowSize == null ? void 0 : expandedRowSize.height]);
|
38589
|
+
}, [expansionRef.current, expandedRowSize == null ? void 0 : expandedRowSize.height, ...remeasureDependencies]);
|
38581
38590
|
const className = clsx("group/row", otherAttributes.className, {
|
38582
38591
|
"hover:cursor-grab": tableMeta.rowDrag.isEnabled && typeof attributes.onClick !== "function",
|
38583
38592
|
"hover:cursor-pointer": typeof attributes.onClick === "function"
|
@@ -39587,9 +39596,9 @@ function Search$1(props) {
|
|
39587
39596
|
if (tableMeta.search.enableGlobalFilter && tableMeta.search.handleSearch) {
|
39588
39597
|
clearTimeout(searchTimeoutRef.current);
|
39589
39598
|
searchTimeoutRef.current = setTimeout(() => {
|
39590
|
-
var _a2, _b;
|
39599
|
+
var _a2, _b, _c;
|
39591
39600
|
setLoading(true);
|
39592
|
-
(_b = (_a2 = tableMeta.search).handleSearch) == null ? void 0 : _b.call(_a2, query2, hiddenColumns).then(() => {
|
39601
|
+
(_c = (_b = (_a2 = tableMeta.search).handleSearch) == null ? void 0 : _b.call(_a2, query2, hiddenColumns)) == null ? void 0 : _c.then(() => {
|
39593
39602
|
setLoading(false);
|
39594
39603
|
});
|
39595
39604
|
}, 150);
|
@@ -44133,7 +44142,14 @@ const EditPopover = (props) => {
|
|
44133
44142
|
onChangeColor: setColor,
|
44134
44143
|
onKeyDown: preventKeyDownPropagation
|
44135
44144
|
}
|
44136
|
-
)) : null, /* @__PURE__ */ React__default.createElement(Group$6, null, /* @__PURE__ */ React__default.createElement(Button$4, { onClick: close }, texts.select2.cancel), /* @__PURE__ */ React__default.createElement(
|
44145
|
+
)) : null, /* @__PURE__ */ React__default.createElement(Group$6, null, /* @__PURE__ */ React__default.createElement(Button$4, { onClick: close }, texts.select2.cancel), /* @__PURE__ */ React__default.createElement(
|
44146
|
+
Button$4,
|
44147
|
+
{
|
44148
|
+
appearance: "primary",
|
44149
|
+
onClick: handleSave(close)
|
44150
|
+
},
|
44151
|
+
texts.select2.save
|
44152
|
+
))) : null, onEdit && onDelete ? /* @__PURE__ */ React__default.createElement("hr", null) : null, onDelete ? /* @__PURE__ */ React__default.createElement(
|
44137
44153
|
"button",
|
44138
44154
|
{
|
44139
44155
|
className: "hover:text-grey-700 flex items-center justify-start gap-1",
|
@@ -45399,6 +45415,7 @@ function Control(props) {
|
|
45399
45415
|
const controlRenderer = (_a = column == null ? void 0 : column.columnDef.meta) == null ? void 0 : _a.control;
|
45400
45416
|
const dataType = (_b = column == null ? void 0 : column.columnDef.meta) == null ? void 0 : _b.dataType;
|
45401
45417
|
const filters = React__default.useContext(FilterContext);
|
45418
|
+
const ref = React__default.useRef(null);
|
45402
45419
|
useEffect(() => {
|
45403
45420
|
if ((controlRenderer === "switch" || controlRenderer === "checkbox") && value === void 0) {
|
45404
45421
|
onChange(false);
|
@@ -45408,8 +45425,9 @@ function Control(props) {
|
|
45408
45425
|
const control = controlRenderer(
|
45409
45426
|
{
|
45410
45427
|
...attributes,
|
45411
|
-
setValue:
|
45412
|
-
value
|
45428
|
+
setValue: onChange,
|
45429
|
+
value,
|
45430
|
+
ref
|
45413
45431
|
},
|
45414
45432
|
void 0,
|
45415
45433
|
filters
|
@@ -51671,7 +51689,9 @@ const useRowSelect = (onSelectedRows) => {
|
|
51671
51689
|
const { onChange: _, ...props } = getToggleAllRowsSelectedProps();
|
51672
51690
|
const onChange = (checked) => {
|
51673
51691
|
if (checked) {
|
51674
|
-
onSelectedRows(
|
51692
|
+
onSelectedRows(
|
51693
|
+
Object.assign({}, Array.from({ length: rows.length }).fill(true))
|
51694
|
+
);
|
51675
51695
|
} else {
|
51676
51696
|
onSelectedRows({});
|
51677
51697
|
}
|
@@ -55118,7 +55138,8 @@ var setWithExports = requireSetWith();
|
|
55118
55138
|
const setWith = /* @__PURE__ */ getDefaultExportFromCjs(setWithExports);
|
55119
55139
|
const DELAY_BEFORE_REMOVING_SAVE_STATUS = 3e3;
|
55120
55140
|
function reducer(state, action) {
|
55121
|
-
|
55141
|
+
var _a;
|
55142
|
+
const { type, payload } = action;
|
55122
55143
|
switch (type) {
|
55123
55144
|
case "setCellValue": {
|
55124
55145
|
const { columnId, index: index2, row, value } = payload;
|
@@ -55126,26 +55147,26 @@ function reducer(state, action) {
|
|
55126
55147
|
...state,
|
55127
55148
|
changes: {
|
55128
55149
|
...state.changes,
|
55129
|
-
rows: setWith(state.changes.rows, `${rowId}.${columnId}`, value, Object),
|
55130
|
-
originals: setWith(state.changes.originals, rowId, row, Object),
|
55131
|
-
dirty: setWith(state.changes.dirty, rowId, true, Object)
|
55150
|
+
rows: setWith(state.changes.rows, `${action.rowId}.${columnId}`, value, Object),
|
55151
|
+
originals: setWith(state.changes.originals, action.rowId, row, Object),
|
55152
|
+
dirty: setWith(state.changes.dirty, action.rowId, true, Object)
|
55132
55153
|
},
|
55133
|
-
indexes: setWith(state.indexes, rowId, index2, Object)
|
55154
|
+
indexes: setWith(state.indexes, action.rowId, index2, Object)
|
55134
55155
|
};
|
55135
55156
|
}
|
55136
55157
|
case "removeCellValue": {
|
55137
55158
|
const { columnId, rowIdentityAccessor } = payload;
|
55138
|
-
const changes = omit$1(state.changes.rows, `${rowId}.${columnId}`);
|
55139
|
-
if (!Object.keys(changes[rowId]).length) {
|
55140
|
-
return reducer(state, { type: "removeRow", rowId, payload: { rowIdentityAccessor } });
|
55159
|
+
const changes = omit$1(state.changes.rows, `${action.rowId}.${columnId}`);
|
55160
|
+
if (!Object.keys(changes[action.rowId]).length) {
|
55161
|
+
return reducer(state, { type: "removeRow", rowId: action.rowId, payload: { rowIdentityAccessor } });
|
55141
55162
|
}
|
55142
55163
|
return {
|
55143
55164
|
...state,
|
55144
55165
|
changes: {
|
55145
55166
|
...state.changes,
|
55146
|
-
rows: omit$1(state.changes.rows, `${rowId}.${columnId}`),
|
55147
|
-
errors: omit$1(state.changes.errors, `${rowId}.cells.${columnId}`),
|
55148
|
-
moveReasons: omit$1(state.changes.moveReasons, `${rowId}.${columnId}`)
|
55167
|
+
rows: omit$1(state.changes.rows, `${action.rowId}.${columnId}`),
|
55168
|
+
errors: omit$1(state.changes.errors, `${action.rowId}.cells.${columnId}`),
|
55169
|
+
moveReasons: omit$1(state.changes.moveReasons, `${action.rowId}.${columnId}`)
|
55149
55170
|
}
|
55150
55171
|
};
|
55151
55172
|
}
|
@@ -55155,24 +55176,28 @@ function reducer(state, action) {
|
|
55155
55176
|
...state,
|
55156
55177
|
changes: {
|
55157
55178
|
...state.changes,
|
55158
|
-
rows: setWith(state.changes.rows, rowId, value, Object),
|
55179
|
+
rows: setWith(state.changes.rows, action.rowId, value, Object),
|
55159
55180
|
errors: setWith(
|
55160
55181
|
state.changes.errors,
|
55161
|
-
`${rowId}.cells`,
|
55162
|
-
cellErrors ?? state.changes.errors.
|
55182
|
+
`${action.rowId}.cells`,
|
55183
|
+
cellErrors ?? ((_a = state.changes.errors[action.rowId]) == null ? void 0 : _a.cells),
|
55184
|
+
Object
|
55185
|
+
),
|
55186
|
+
originals: setWith(
|
55187
|
+
state.changes.originals,
|
55188
|
+
action.rowId,
|
55189
|
+
original ?? state.changes.originals[action.rowId],
|
55163
55190
|
Object
|
55164
55191
|
),
|
55165
|
-
originals: setWith(state.changes.originals, rowId, original ?? state.changes.originals[rowId], Object),
|
55166
55192
|
moveReasons: setWith(
|
55167
55193
|
state.changes.moveReasons,
|
55168
|
-
rowId,
|
55169
|
-
moveReasons ?? state.changes.moveReasons[rowId],
|
55194
|
+
action.rowId,
|
55195
|
+
moveReasons ?? state.changes.moveReasons[action.rowId],
|
55170
55196
|
Object
|
55171
|
-
)
|
55172
|
-
// status can be undefined, so don't use ??
|
55173
|
-
status: setWith(state.changes.status, rowId, void 0, Object)
|
55197
|
+
)
|
55174
55198
|
},
|
55175
|
-
indexes: setWith(state.indexes, rowId, index2, Object)
|
55199
|
+
indexes: setWith(state.indexes, action.rowId, index2, Object),
|
55200
|
+
statuses: omit$1(state.statuses, action.rowId)
|
55176
55201
|
};
|
55177
55202
|
}
|
55178
55203
|
case "removeRow": {
|
@@ -55181,28 +55206,27 @@ function reducer(state, action) {
|
|
55181
55206
|
...state,
|
55182
55207
|
changes: {
|
55183
55208
|
...state.changes,
|
55184
|
-
rows: omit$1(state.changes.rows, rowId),
|
55185
|
-
errors: omit$1(state.changes.errors, rowId),
|
55186
|
-
moveReasons: omit$1(state.changes.moveReasons, rowId),
|
55187
|
-
originals: omit$1(state.changes.originals, rowId),
|
55188
|
-
|
55189
|
-
dirty: omit$1(state.changes.dirty, rowId)
|
55209
|
+
rows: omit$1(state.changes.rows, action.rowId),
|
55210
|
+
errors: omit$1(state.changes.errors, action.rowId),
|
55211
|
+
moveReasons: omit$1(state.changes.moveReasons, action.rowId),
|
55212
|
+
originals: omit$1(state.changes.originals, action.rowId),
|
55213
|
+
dirty: omit$1(state.changes.dirty, action.rowId)
|
55190
55214
|
},
|
55191
|
-
indexes: omit$1(state.indexes, rowId),
|
55192
|
-
temporaryRows: state.temporaryRows.filter((row) => row[rowIdentityAccessor] !== rowId)
|
55215
|
+
indexes: omit$1(state.indexes, action.rowId),
|
55216
|
+
temporaryRows: state.temporaryRows.filter((row) => row[rowIdentityAccessor] !== action.rowId)
|
55193
55217
|
};
|
55194
55218
|
}
|
55195
55219
|
case "complete": {
|
55196
55220
|
const { changes, handleDiscard } = payload;
|
55197
|
-
if (JSON.stringify(changes) !== JSON.stringify(state.changes.rows[rowId])) {
|
55221
|
+
if (JSON.stringify(changes) !== JSON.stringify(state.changes.rows[action.rowId])) {
|
55198
55222
|
return {
|
55199
55223
|
...state,
|
55200
55224
|
changes: {
|
55201
55225
|
...state.changes,
|
55202
55226
|
originals: setWith(
|
55203
55227
|
state.changes.originals,
|
55204
|
-
rowId,
|
55205
|
-
{ ...state.changes.originals[rowId], ...changes },
|
55228
|
+
action.rowId,
|
55229
|
+
{ ...state.changes.originals[action.rowId], ...changes },
|
55206
55230
|
Object
|
55207
55231
|
)
|
55208
55232
|
}
|
@@ -55215,12 +55239,15 @@ function reducer(state, action) {
|
|
55215
55239
|
}
|
55216
55240
|
case "setRowStatus": {
|
55217
55241
|
const { status } = payload;
|
55242
|
+
if (status) {
|
55243
|
+
return {
|
55244
|
+
...state,
|
55245
|
+
statuses: setWith(state.statuses, action.rowId, status, Object)
|
55246
|
+
};
|
55247
|
+
}
|
55218
55248
|
return {
|
55219
55249
|
...state,
|
55220
|
-
|
55221
|
-
...state.changes,
|
55222
|
-
status: status ? setWith(state.changes.status, rowId, status, Object) : omit$1(state.changes.status, rowId)
|
55223
|
-
}
|
55250
|
+
statuses: omit$1(state.statuses, action.rowId)
|
55224
55251
|
};
|
55225
55252
|
}
|
55226
55253
|
case "setRowErrors": {
|
@@ -55229,7 +55256,7 @@ function reducer(state, action) {
|
|
55229
55256
|
...state,
|
55230
55257
|
changes: {
|
55231
55258
|
...state.changes,
|
55232
|
-
errors: setWith(state.changes.errors, rowId, errors, Object)
|
55259
|
+
errors: setWith(state.changes.errors, action.rowId, errors, Object)
|
55233
55260
|
}
|
55234
55261
|
};
|
55235
55262
|
}
|
@@ -55240,10 +55267,10 @@ function reducer(state, action) {
|
|
55240
55267
|
temporaryRows: state.temporaryRows.concat(value),
|
55241
55268
|
changes: {
|
55242
55269
|
...state.changes,
|
55243
|
-
rows: setWith(state.changes.rows, rowId, value, Object),
|
55244
|
-
originals: setWith(state.changes.originals, rowId, value, Object)
|
55270
|
+
rows: setWith(state.changes.rows, action.rowId, value, Object),
|
55271
|
+
originals: setWith(state.changes.originals, action.rowId, value, Object)
|
55245
55272
|
},
|
55246
|
-
indexes: setWith(state.indexes, rowId, index2, Object)
|
55273
|
+
indexes: setWith(state.indexes, action.rowId, index2, Object)
|
55247
55274
|
};
|
55248
55275
|
}
|
55249
55276
|
case "forceValidate": {
|
@@ -55260,9 +55287,10 @@ function reducer(state, action) {
|
|
55260
55287
|
function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIdentityAccessor, validator) {
|
55261
55288
|
const localization = useLocalization();
|
55262
55289
|
const [state, dispatch] = React__default.useReducer(reducer, {
|
55263
|
-
changes: { rows: {}, errors: {}, moveReasons: {}, originals: {},
|
55290
|
+
changes: { rows: {}, errors: {}, moveReasons: {}, originals: {}, dirty: {} },
|
55264
55291
|
indexes: {},
|
55265
|
-
temporaryRows: []
|
55292
|
+
temporaryRows: [],
|
55293
|
+
statuses: {}
|
55266
55294
|
});
|
55267
55295
|
function getRowValue(rowId) {
|
55268
55296
|
var _a;
|
@@ -55290,7 +55318,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
55290
55318
|
return !!((_b = state.changes.errors[rowId]) == null ? void 0 : _b.row) || !!Object.keys(((_c = state.changes.errors[rowId]) == null ? void 0 : _c.cells) ?? {}).length;
|
55291
55319
|
}
|
55292
55320
|
function getRowStatus(rowId) {
|
55293
|
-
return state.
|
55321
|
+
return state.statuses[rowId];
|
55294
55322
|
}
|
55295
55323
|
function setRowStatus(rowId, status) {
|
55296
55324
|
dispatch({
|
@@ -55301,6 +55329,12 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
55301
55329
|
}
|
55302
55330
|
});
|
55303
55331
|
}
|
55332
|
+
function showSavedStatus(rowId) {
|
55333
|
+
setRowStatus(rowId, "saved");
|
55334
|
+
setTimeout(() => {
|
55335
|
+
setRowStatus(rowId, void 0);
|
55336
|
+
}, DELAY_BEFORE_REMOVING_SAVE_STATUS);
|
55337
|
+
}
|
55304
55338
|
function insertTemporaryRow(data, rowIndex) {
|
55305
55339
|
const newRowId = `${TEMPORARY_ROW_ID_PREFIX}${nanoid()}`;
|
55306
55340
|
const value = {
|
@@ -55427,7 +55461,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
55427
55461
|
newState.changes.originals[row.id] = row.original;
|
55428
55462
|
newState.changes.moveReasons[row.id] = { ...newState.changes.moveReasons[row.id] };
|
55429
55463
|
newState.changes.rows[row.id] = { ...newState.changes.rows[row.id] };
|
55430
|
-
newState.
|
55464
|
+
newState.statuses[row.id] = "errored";
|
55431
55465
|
newState.indexes[row.id] = index2;
|
55432
55466
|
newState.changes.errors[row.id] = {
|
55433
55467
|
cells: cellErrors,
|
@@ -55468,7 +55502,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
55468
55502
|
}));
|
55469
55503
|
}
|
55470
55504
|
function hasSaved() {
|
55471
|
-
return !!Object.values(state.
|
55505
|
+
return !!Object.values(state.statuses).filter((status) => status === "saved").length;
|
55472
55506
|
}
|
55473
55507
|
function hasChanges(rowId) {
|
55474
55508
|
return rowId ? !!state.changes.rows[rowId] : !!Object.keys(state.changes.rows).length;
|
@@ -55507,10 +55541,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
55507
55541
|
}
|
55508
55542
|
await handleSave(changeSet);
|
55509
55543
|
complete(rowId2, table, rowChanges);
|
55510
|
-
|
55511
|
-
setTimeout(() => {
|
55512
|
-
setRowStatus(rowId2, void 0);
|
55513
|
-
}, DELAY_BEFORE_REMOVING_SAVE_STATUS);
|
55544
|
+
showSavedStatus(rowId2);
|
55514
55545
|
} catch (error) {
|
55515
55546
|
if (error instanceof ReferenceError || error instanceof TypeError || ((_a = error == null ? void 0 : error.response) == null ? void 0 : _a.status) >= 500) {
|
55516
55547
|
console.error(error);
|
@@ -55890,10 +55921,17 @@ function EditingControlCell(props) {
|
|
55890
55921
|
const handleFocus = useEditingCellAutofocus(props);
|
55891
55922
|
const value = cell.getValue();
|
55892
55923
|
const rowChanges = tableMeta.editing.getRowValue(cell.row.id);
|
55924
|
+
const shouldRunUpdate = React__default.useRef(false);
|
55893
55925
|
const hasNonTextControl = React__default.useMemo(() => {
|
55894
55926
|
var _a;
|
55895
55927
|
return typeof type === "function" && !!((_a = cellRef.current) == null ? void 0 : _a.querySelector('[data-taco="Select2"],[data-taco="switch"],[data-taco="checkbox"]'));
|
55896
55928
|
}, [cellRef.current]);
|
55929
|
+
useLazyEffect(() => {
|
55930
|
+
if (hasNonTextControl && shouldRunUpdate.current) {
|
55931
|
+
tableMeta.editing.onCellChanged(cell, rowIndex, value, true, false);
|
55932
|
+
shouldRunUpdate.current = false;
|
55933
|
+
}
|
55934
|
+
}, [value]);
|
55897
55935
|
const handleChange = React__default.useCallback(
|
55898
55936
|
(nextValue) => {
|
55899
55937
|
let hasChanged = false;
|
@@ -55910,9 +55948,7 @@ function EditingControlCell(props) {
|
|
55910
55948
|
}
|
55911
55949
|
if (hasChanged) {
|
55912
55950
|
tableMeta.editing.setCellValue(cell, rowIndex, nextValue);
|
55913
|
-
|
55914
|
-
requestAnimationFrame(() => tableMeta.editing.onCellChanged(cell, rowIndex, nextValue, true, false));
|
55915
|
-
}
|
55951
|
+
shouldRunUpdate.current = hasNonTextControl;
|
55916
55952
|
}
|
55917
55953
|
},
|
55918
55954
|
[hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex, value, columnMeta.dataType]
|
@@ -56190,6 +56226,7 @@ function DiscardChangesConfirmationDialog(props) {
|
|
56190
56226
|
return /* @__PURE__ */ React__default.createElement(Dialog, { ...dialogProps, showCloseButton: false }, /* @__PURE__ */ React__default.createElement(
|
56191
56227
|
Dialog.Content,
|
56192
56228
|
{
|
56229
|
+
"data-taco": "discard-changes-dialog",
|
56193
56230
|
"aria-label": texts.table3.editing.clearChangesConfirmationDialog.title,
|
56194
56231
|
onClick: handleClickInsideDialogContent,
|
56195
56232
|
onKeyDown: handleKeydown
|
@@ -56208,16 +56245,11 @@ function DiscardChangesConfirmationDialog(props) {
|
|
56208
56245
|
));
|
56209
56246
|
}
|
56210
56247
|
function Row(props) {
|
56211
|
-
const { row, index: index2, table
|
56248
|
+
const { row, index: index2, table } = props;
|
56212
56249
|
const focusManager = useAugmentedFocusManager();
|
56213
56250
|
const tableMeta = table.options.meta;
|
56214
56251
|
const isActiveRow = tableMeta.rowActive.rowActiveIndex === index2;
|
56215
|
-
const rowRef = React__default.useRef(null);
|
56216
56252
|
const hasErrors = tableMeta.editing.hasRowErrors(row.id);
|
56217
|
-
React__default.useEffect(() => {
|
56218
|
-
if (!measureRow || !rowRef.current) return;
|
56219
|
-
measureRow(rowRef.current.getBoundingClientRect().height);
|
56220
|
-
}, [hasErrors, measureRow]);
|
56221
56253
|
React__default.useEffect(() => {
|
56222
56254
|
if (tableMeta.editing.isEditing && isActiveRow && tableMeta.editing.lastFocusedCellIndex === void 0) {
|
56223
56255
|
const element = focusManager.focusFirst();
|
@@ -56274,7 +56306,7 @@ function Row(props) {
|
|
56274
56306
|
onFocus: handleFocus,
|
56275
56307
|
onKeyDown: handleKeyDown
|
56276
56308
|
};
|
56277
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(DisplayRow, { ...props, ...attributes,
|
56309
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(DisplayRow, { ...props, ...attributes, remeasureDependencies: [hasErrors] }, rowStatus === "saving" || rowStatus === "saved" ? /* @__PURE__ */ React__default.createElement(SaveStatus, { rowId: row.id, table }) : null), /* @__PURE__ */ React__default.createElement(
|
56278
56310
|
DiscardChangesConfirmationDialog,
|
56279
56311
|
{
|
56280
56312
|
open: showDiscardDialog,
|
@@ -56371,7 +56403,7 @@ function useTable3(props, ref) {
|
|
56371
56403
|
removeRowChanges: (rowId) => table.meta.editing.discardChanges(rowId, table.instance),
|
56372
56404
|
save: (rowId) => table.meta.editing.saveChanges(table.instance, rowId)
|
56373
56405
|
};
|
56374
|
-
if (props.onEditingCreate) {
|
56406
|
+
if (props.onEditingCreate && instance.editing) {
|
56375
56407
|
instance.editing.createRow = (row) => table.meta.editing.createRow(table.instance, row);
|
56376
56408
|
}
|
56377
56409
|
}
|
@@ -56380,7 +56412,7 @@ function useTable3(props, ref) {
|
|
56380
56412
|
React__default.useEffect(() => {
|
56381
56413
|
if (table.ref.current) {
|
56382
56414
|
const instance = table.ref.current.instance;
|
56383
|
-
if (table.meta.editing.isEnabled) {
|
56415
|
+
if (table.meta.editing.isEnabled && instance.editing) {
|
56384
56416
|
instance.editing.forceValidate = async () => await table.meta.editing.forceValidate(table.instance);
|
56385
56417
|
}
|
56386
56418
|
}
|