@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.cjs
CHANGED
@@ -11409,22 +11409,22 @@ const getButtonClasses$1 = () => {
|
|
11409
11409
|
const getAppearanceClasses = (value, icon = false) => {
|
11410
11410
|
switch (value) {
|
11411
11411
|
case "primary":
|
11412
|
-
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`;
|
11412
|
+
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`;
|
11413
11413
|
case "danger":
|
11414
|
-
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`;
|
11414
|
+
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`;
|
11415
11415
|
case "ghost":
|
11416
|
-
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`;
|
11416
|
+
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`;
|
11417
11417
|
case "discrete": {
|
11418
11418
|
if (icon) {
|
11419
|
-
return `bg-transparent text-black visited:text-black hover:bg-[#000]/[0.08] aria-disabled:text-black/30`;
|
11419
|
+
return `bg-transparent text-black visited:text-black hover:bg-[#000]/[0.08] focus-visible:bg-[#000]/[0.08] aria-disabled:text-black/30`;
|
11420
11420
|
}
|
11421
|
-
return `bg-transparent text-blue-500 visited:text-blue-500 hover:text-blue-700 aria-disabled:text-blue-500/50`;
|
11421
|
+
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`;
|
11422
11422
|
}
|
11423
11423
|
case "transparent": {
|
11424
|
-
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`;
|
11424
|
+
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`;
|
11425
11425
|
}
|
11426
11426
|
default:
|
11427
|
-
return `wcag-grey-200 visited:wcag-grey-200 hover:wcag-grey-300 aria-disabled:bg-grey-200/50 aria-disabled:text-black/30`;
|
11427
|
+
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`;
|
11428
11428
|
}
|
11429
11429
|
};
|
11430
11430
|
const createButtonWithTooltip = (props, className, ref) => {
|
@@ -38499,7 +38499,16 @@ const useResizeObserver$1 = (ref, enabled = true) => {
|
|
38499
38499
|
const DisplayRow = React.memo(
|
38500
38500
|
React.forwardRef(function DisplayRow2(props, externalRef) {
|
38501
38501
|
var _a, _b, _c;
|
38502
|
-
const {
|
38502
|
+
const {
|
38503
|
+
children,
|
38504
|
+
cellRenderer: CellRenderer,
|
38505
|
+
index: index2,
|
38506
|
+
measureRow,
|
38507
|
+
row,
|
38508
|
+
table,
|
38509
|
+
remeasureDependencies = [],
|
38510
|
+
...otherAttributes
|
38511
|
+
} = props;
|
38503
38512
|
const tableMeta = table.options.meta;
|
38504
38513
|
const attributes = {
|
38505
38514
|
...otherAttributes,
|
@@ -38595,7 +38604,7 @@ const DisplayRow = React.memo(
|
|
38595
38604
|
const rowHeight = ((_a2 = ref.current) == null ? void 0 : _a2.getBoundingClientRect().height) ?? 0;
|
38596
38605
|
const expansionHeight = ((_b2 = expansionRef.current) == null ? void 0 : _b2.getBoundingClientRect().height) ?? 0;
|
38597
38606
|
measureRow(rowHeight + expansionHeight);
|
38598
|
-
}, [expansionRef.current, expandedRowSize == null ? void 0 : expandedRowSize.height]);
|
38607
|
+
}, [expansionRef.current, expandedRowSize == null ? void 0 : expandedRowSize.height, ...remeasureDependencies]);
|
38599
38608
|
const className = clsx("group/row", otherAttributes.className, {
|
38600
38609
|
"hover:cursor-grab": tableMeta.rowDrag.isEnabled && typeof attributes.onClick !== "function",
|
38601
38610
|
"hover:cursor-pointer": typeof attributes.onClick === "function"
|
@@ -39605,9 +39614,9 @@ function Search$1(props) {
|
|
39605
39614
|
if (tableMeta.search.enableGlobalFilter && tableMeta.search.handleSearch) {
|
39606
39615
|
clearTimeout(searchTimeoutRef.current);
|
39607
39616
|
searchTimeoutRef.current = setTimeout(() => {
|
39608
|
-
var _a2, _b;
|
39617
|
+
var _a2, _b, _c;
|
39609
39618
|
setLoading(true);
|
39610
|
-
(_b = (_a2 = tableMeta.search).handleSearch) == null ? void 0 : _b.call(_a2, query2, hiddenColumns).then(() => {
|
39619
|
+
(_c = (_b = (_a2 = tableMeta.search).handleSearch) == null ? void 0 : _b.call(_a2, query2, hiddenColumns)) == null ? void 0 : _c.then(() => {
|
39611
39620
|
setLoading(false);
|
39612
39621
|
});
|
39613
39622
|
}, 150);
|
@@ -44151,7 +44160,14 @@ const EditPopover = (props) => {
|
|
44151
44160
|
onChangeColor: setColor,
|
44152
44161
|
onKeyDown: preventKeyDownPropagation
|
44153
44162
|
}
|
44154
|
-
)) : null, /* @__PURE__ */ React.createElement(Group$6, null, /* @__PURE__ */ React.createElement(Button$4, { onClick: close }, texts.select2.cancel), /* @__PURE__ */ React.createElement(
|
44163
|
+
)) : null, /* @__PURE__ */ React.createElement(Group$6, null, /* @__PURE__ */ React.createElement(Button$4, { onClick: close }, texts.select2.cancel), /* @__PURE__ */ React.createElement(
|
44164
|
+
Button$4,
|
44165
|
+
{
|
44166
|
+
appearance: "primary",
|
44167
|
+
onClick: handleSave(close)
|
44168
|
+
},
|
44169
|
+
texts.select2.save
|
44170
|
+
))) : null, onEdit && onDelete ? /* @__PURE__ */ React.createElement("hr", null) : null, onDelete ? /* @__PURE__ */ React.createElement(
|
44155
44171
|
"button",
|
44156
44172
|
{
|
44157
44173
|
className: "hover:text-grey-700 flex items-center justify-start gap-1",
|
@@ -45417,6 +45433,7 @@ function Control(props) {
|
|
45417
45433
|
const controlRenderer = (_a = column == null ? void 0 : column.columnDef.meta) == null ? void 0 : _a.control;
|
45418
45434
|
const dataType = (_b = column == null ? void 0 : column.columnDef.meta) == null ? void 0 : _b.dataType;
|
45419
45435
|
const filters = React.useContext(FilterContext);
|
45436
|
+
const ref = React.useRef(null);
|
45420
45437
|
React.useEffect(() => {
|
45421
45438
|
if ((controlRenderer === "switch" || controlRenderer === "checkbox") && value === void 0) {
|
45422
45439
|
onChange(false);
|
@@ -45426,8 +45443,9 @@ function Control(props) {
|
|
45426
45443
|
const control = controlRenderer(
|
45427
45444
|
{
|
45428
45445
|
...attributes,
|
45429
|
-
setValue:
|
45430
|
-
value
|
45446
|
+
setValue: onChange,
|
45447
|
+
value,
|
45448
|
+
ref
|
45431
45449
|
},
|
45432
45450
|
void 0,
|
45433
45451
|
filters
|
@@ -51689,7 +51707,9 @@ const useRowSelect = (onSelectedRows) => {
|
|
51689
51707
|
const { onChange: _, ...props } = getToggleAllRowsSelectedProps();
|
51690
51708
|
const onChange = (checked) => {
|
51691
51709
|
if (checked) {
|
51692
|
-
onSelectedRows(
|
51710
|
+
onSelectedRows(
|
51711
|
+
Object.assign({}, Array.from({ length: rows.length }).fill(true))
|
51712
|
+
);
|
51693
51713
|
} else {
|
51694
51714
|
onSelectedRows({});
|
51695
51715
|
}
|
@@ -55136,7 +55156,8 @@ var setWithExports = requireSetWith();
|
|
55136
55156
|
const setWith = /* @__PURE__ */ getDefaultExportFromCjs(setWithExports);
|
55137
55157
|
const DELAY_BEFORE_REMOVING_SAVE_STATUS = 3e3;
|
55138
55158
|
function reducer(state, action) {
|
55139
|
-
|
55159
|
+
var _a;
|
55160
|
+
const { type, payload } = action;
|
55140
55161
|
switch (type) {
|
55141
55162
|
case "setCellValue": {
|
55142
55163
|
const { columnId, index: index2, row, value } = payload;
|
@@ -55144,26 +55165,26 @@ function reducer(state, action) {
|
|
55144
55165
|
...state,
|
55145
55166
|
changes: {
|
55146
55167
|
...state.changes,
|
55147
|
-
rows: setWith(state.changes.rows, `${rowId}.${columnId}`, value, Object),
|
55148
|
-
originals: setWith(state.changes.originals, rowId, row, Object),
|
55149
|
-
dirty: setWith(state.changes.dirty, rowId, true, Object)
|
55168
|
+
rows: setWith(state.changes.rows, `${action.rowId}.${columnId}`, value, Object),
|
55169
|
+
originals: setWith(state.changes.originals, action.rowId, row, Object),
|
55170
|
+
dirty: setWith(state.changes.dirty, action.rowId, true, Object)
|
55150
55171
|
},
|
55151
|
-
indexes: setWith(state.indexes, rowId, index2, Object)
|
55172
|
+
indexes: setWith(state.indexes, action.rowId, index2, Object)
|
55152
55173
|
};
|
55153
55174
|
}
|
55154
55175
|
case "removeCellValue": {
|
55155
55176
|
const { columnId, rowIdentityAccessor } = payload;
|
55156
|
-
const changes = omit$1(state.changes.rows, `${rowId}.${columnId}`);
|
55157
|
-
if (!Object.keys(changes[rowId]).length) {
|
55158
|
-
return reducer(state, { type: "removeRow", rowId, payload: { rowIdentityAccessor } });
|
55177
|
+
const changes = omit$1(state.changes.rows, `${action.rowId}.${columnId}`);
|
55178
|
+
if (!Object.keys(changes[action.rowId]).length) {
|
55179
|
+
return reducer(state, { type: "removeRow", rowId: action.rowId, payload: { rowIdentityAccessor } });
|
55159
55180
|
}
|
55160
55181
|
return {
|
55161
55182
|
...state,
|
55162
55183
|
changes: {
|
55163
55184
|
...state.changes,
|
55164
|
-
rows: omit$1(state.changes.rows, `${rowId}.${columnId}`),
|
55165
|
-
errors: omit$1(state.changes.errors, `${rowId}.cells.${columnId}`),
|
55166
|
-
moveReasons: omit$1(state.changes.moveReasons, `${rowId}.${columnId}`)
|
55185
|
+
rows: omit$1(state.changes.rows, `${action.rowId}.${columnId}`),
|
55186
|
+
errors: omit$1(state.changes.errors, `${action.rowId}.cells.${columnId}`),
|
55187
|
+
moveReasons: omit$1(state.changes.moveReasons, `${action.rowId}.${columnId}`)
|
55167
55188
|
}
|
55168
55189
|
};
|
55169
55190
|
}
|
@@ -55173,24 +55194,28 @@ function reducer(state, action) {
|
|
55173
55194
|
...state,
|
55174
55195
|
changes: {
|
55175
55196
|
...state.changes,
|
55176
|
-
rows: setWith(state.changes.rows, rowId, value, Object),
|
55197
|
+
rows: setWith(state.changes.rows, action.rowId, value, Object),
|
55177
55198
|
errors: setWith(
|
55178
55199
|
state.changes.errors,
|
55179
|
-
`${rowId}.cells`,
|
55180
|
-
cellErrors ?? state.changes.errors.
|
55200
|
+
`${action.rowId}.cells`,
|
55201
|
+
cellErrors ?? ((_a = state.changes.errors[action.rowId]) == null ? void 0 : _a.cells),
|
55202
|
+
Object
|
55203
|
+
),
|
55204
|
+
originals: setWith(
|
55205
|
+
state.changes.originals,
|
55206
|
+
action.rowId,
|
55207
|
+
original ?? state.changes.originals[action.rowId],
|
55181
55208
|
Object
|
55182
55209
|
),
|
55183
|
-
originals: setWith(state.changes.originals, rowId, original ?? state.changes.originals[rowId], Object),
|
55184
55210
|
moveReasons: setWith(
|
55185
55211
|
state.changes.moveReasons,
|
55186
|
-
rowId,
|
55187
|
-
moveReasons ?? state.changes.moveReasons[rowId],
|
55212
|
+
action.rowId,
|
55213
|
+
moveReasons ?? state.changes.moveReasons[action.rowId],
|
55188
55214
|
Object
|
55189
|
-
)
|
55190
|
-
// status can be undefined, so don't use ??
|
55191
|
-
status: setWith(state.changes.status, rowId, void 0, Object)
|
55215
|
+
)
|
55192
55216
|
},
|
55193
|
-
indexes: setWith(state.indexes, rowId, index2, Object)
|
55217
|
+
indexes: setWith(state.indexes, action.rowId, index2, Object),
|
55218
|
+
statuses: omit$1(state.statuses, action.rowId)
|
55194
55219
|
};
|
55195
55220
|
}
|
55196
55221
|
case "removeRow": {
|
@@ -55199,28 +55224,27 @@ function reducer(state, action) {
|
|
55199
55224
|
...state,
|
55200
55225
|
changes: {
|
55201
55226
|
...state.changes,
|
55202
|
-
rows: omit$1(state.changes.rows, rowId),
|
55203
|
-
errors: omit$1(state.changes.errors, rowId),
|
55204
|
-
moveReasons: omit$1(state.changes.moveReasons, rowId),
|
55205
|
-
originals: omit$1(state.changes.originals, rowId),
|
55206
|
-
|
55207
|
-
dirty: omit$1(state.changes.dirty, rowId)
|
55227
|
+
rows: omit$1(state.changes.rows, action.rowId),
|
55228
|
+
errors: omit$1(state.changes.errors, action.rowId),
|
55229
|
+
moveReasons: omit$1(state.changes.moveReasons, action.rowId),
|
55230
|
+
originals: omit$1(state.changes.originals, action.rowId),
|
55231
|
+
dirty: omit$1(state.changes.dirty, action.rowId)
|
55208
55232
|
},
|
55209
|
-
indexes: omit$1(state.indexes, rowId),
|
55210
|
-
temporaryRows: state.temporaryRows.filter((row) => row[rowIdentityAccessor] !== rowId)
|
55233
|
+
indexes: omit$1(state.indexes, action.rowId),
|
55234
|
+
temporaryRows: state.temporaryRows.filter((row) => row[rowIdentityAccessor] !== action.rowId)
|
55211
55235
|
};
|
55212
55236
|
}
|
55213
55237
|
case "complete": {
|
55214
55238
|
const { changes, handleDiscard } = payload;
|
55215
|
-
if (JSON.stringify(changes) !== JSON.stringify(state.changes.rows[rowId])) {
|
55239
|
+
if (JSON.stringify(changes) !== JSON.stringify(state.changes.rows[action.rowId])) {
|
55216
55240
|
return {
|
55217
55241
|
...state,
|
55218
55242
|
changes: {
|
55219
55243
|
...state.changes,
|
55220
55244
|
originals: setWith(
|
55221
55245
|
state.changes.originals,
|
55222
|
-
rowId,
|
55223
|
-
{ ...state.changes.originals[rowId], ...changes },
|
55246
|
+
action.rowId,
|
55247
|
+
{ ...state.changes.originals[action.rowId], ...changes },
|
55224
55248
|
Object
|
55225
55249
|
)
|
55226
55250
|
}
|
@@ -55233,12 +55257,15 @@ function reducer(state, action) {
|
|
55233
55257
|
}
|
55234
55258
|
case "setRowStatus": {
|
55235
55259
|
const { status } = payload;
|
55260
|
+
if (status) {
|
55261
|
+
return {
|
55262
|
+
...state,
|
55263
|
+
statuses: setWith(state.statuses, action.rowId, status, Object)
|
55264
|
+
};
|
55265
|
+
}
|
55236
55266
|
return {
|
55237
55267
|
...state,
|
55238
|
-
|
55239
|
-
...state.changes,
|
55240
|
-
status: status ? setWith(state.changes.status, rowId, status, Object) : omit$1(state.changes.status, rowId)
|
55241
|
-
}
|
55268
|
+
statuses: omit$1(state.statuses, action.rowId)
|
55242
55269
|
};
|
55243
55270
|
}
|
55244
55271
|
case "setRowErrors": {
|
@@ -55247,7 +55274,7 @@ function reducer(state, action) {
|
|
55247
55274
|
...state,
|
55248
55275
|
changes: {
|
55249
55276
|
...state.changes,
|
55250
|
-
errors: setWith(state.changes.errors, rowId, errors, Object)
|
55277
|
+
errors: setWith(state.changes.errors, action.rowId, errors, Object)
|
55251
55278
|
}
|
55252
55279
|
};
|
55253
55280
|
}
|
@@ -55258,10 +55285,10 @@ function reducer(state, action) {
|
|
55258
55285
|
temporaryRows: state.temporaryRows.concat(value),
|
55259
55286
|
changes: {
|
55260
55287
|
...state.changes,
|
55261
|
-
rows: setWith(state.changes.rows, rowId, value, Object),
|
55262
|
-
originals: setWith(state.changes.originals, rowId, value, Object)
|
55288
|
+
rows: setWith(state.changes.rows, action.rowId, value, Object),
|
55289
|
+
originals: setWith(state.changes.originals, action.rowId, value, Object)
|
55263
55290
|
},
|
55264
|
-
indexes: setWith(state.indexes, rowId, index2, Object)
|
55291
|
+
indexes: setWith(state.indexes, action.rowId, index2, Object)
|
55265
55292
|
};
|
55266
55293
|
}
|
55267
55294
|
case "forceValidate": {
|
@@ -55278,9 +55305,10 @@ function reducer(state, action) {
|
|
55278
55305
|
function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIdentityAccessor, validator) {
|
55279
55306
|
const localization = useLocalization();
|
55280
55307
|
const [state, dispatch] = React.useReducer(reducer, {
|
55281
|
-
changes: { rows: {}, errors: {}, moveReasons: {}, originals: {},
|
55308
|
+
changes: { rows: {}, errors: {}, moveReasons: {}, originals: {}, dirty: {} },
|
55282
55309
|
indexes: {},
|
55283
|
-
temporaryRows: []
|
55310
|
+
temporaryRows: [],
|
55311
|
+
statuses: {}
|
55284
55312
|
});
|
55285
55313
|
function getRowValue(rowId) {
|
55286
55314
|
var _a;
|
@@ -55308,7 +55336,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
55308
55336
|
return !!((_b = state.changes.errors[rowId]) == null ? void 0 : _b.row) || !!Object.keys(((_c = state.changes.errors[rowId]) == null ? void 0 : _c.cells) ?? {}).length;
|
55309
55337
|
}
|
55310
55338
|
function getRowStatus(rowId) {
|
55311
|
-
return state.
|
55339
|
+
return state.statuses[rowId];
|
55312
55340
|
}
|
55313
55341
|
function setRowStatus(rowId, status) {
|
55314
55342
|
dispatch({
|
@@ -55319,6 +55347,12 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
55319
55347
|
}
|
55320
55348
|
});
|
55321
55349
|
}
|
55350
|
+
function showSavedStatus(rowId) {
|
55351
|
+
setRowStatus(rowId, "saved");
|
55352
|
+
setTimeout(() => {
|
55353
|
+
setRowStatus(rowId, void 0);
|
55354
|
+
}, DELAY_BEFORE_REMOVING_SAVE_STATUS);
|
55355
|
+
}
|
55322
55356
|
function insertTemporaryRow(data, rowIndex) {
|
55323
55357
|
const newRowId = `${TEMPORARY_ROW_ID_PREFIX}${nanoid()}`;
|
55324
55358
|
const value = {
|
@@ -55445,7 +55479,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
55445
55479
|
newState.changes.originals[row.id] = row.original;
|
55446
55480
|
newState.changes.moveReasons[row.id] = { ...newState.changes.moveReasons[row.id] };
|
55447
55481
|
newState.changes.rows[row.id] = { ...newState.changes.rows[row.id] };
|
55448
|
-
newState.
|
55482
|
+
newState.statuses[row.id] = "errored";
|
55449
55483
|
newState.indexes[row.id] = index2;
|
55450
55484
|
newState.changes.errors[row.id] = {
|
55451
55485
|
cells: cellErrors,
|
@@ -55486,7 +55520,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
55486
55520
|
}));
|
55487
55521
|
}
|
55488
55522
|
function hasSaved() {
|
55489
|
-
return !!Object.values(state.
|
55523
|
+
return !!Object.values(state.statuses).filter((status) => status === "saved").length;
|
55490
55524
|
}
|
55491
55525
|
function hasChanges(rowId) {
|
55492
55526
|
return rowId ? !!state.changes.rows[rowId] : !!Object.keys(state.changes.rows).length;
|
@@ -55525,10 +55559,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
55525
55559
|
}
|
55526
55560
|
await handleSave(changeSet);
|
55527
55561
|
complete(rowId2, table, rowChanges);
|
55528
|
-
|
55529
|
-
setTimeout(() => {
|
55530
|
-
setRowStatus(rowId2, void 0);
|
55531
|
-
}, DELAY_BEFORE_REMOVING_SAVE_STATUS);
|
55562
|
+
showSavedStatus(rowId2);
|
55532
55563
|
} catch (error) {
|
55533
55564
|
if (error instanceof ReferenceError || error instanceof TypeError || ((_a = error == null ? void 0 : error.response) == null ? void 0 : _a.status) >= 500) {
|
55534
55565
|
console.error(error);
|
@@ -55908,10 +55939,17 @@ function EditingControlCell(props) {
|
|
55908
55939
|
const handleFocus = useEditingCellAutofocus(props);
|
55909
55940
|
const value = cell.getValue();
|
55910
55941
|
const rowChanges = tableMeta.editing.getRowValue(cell.row.id);
|
55942
|
+
const shouldRunUpdate = React.useRef(false);
|
55911
55943
|
const hasNonTextControl = React.useMemo(() => {
|
55912
55944
|
var _a;
|
55913
55945
|
return typeof type === "function" && !!((_a = cellRef.current) == null ? void 0 : _a.querySelector('[data-taco="Select2"],[data-taco="switch"],[data-taco="checkbox"]'));
|
55914
55946
|
}, [cellRef.current]);
|
55947
|
+
useLazyEffect(() => {
|
55948
|
+
if (hasNonTextControl && shouldRunUpdate.current) {
|
55949
|
+
tableMeta.editing.onCellChanged(cell, rowIndex, value, true, false);
|
55950
|
+
shouldRunUpdate.current = false;
|
55951
|
+
}
|
55952
|
+
}, [value]);
|
55915
55953
|
const handleChange = React.useCallback(
|
55916
55954
|
(nextValue) => {
|
55917
55955
|
let hasChanged = false;
|
@@ -55928,9 +55966,7 @@ function EditingControlCell(props) {
|
|
55928
55966
|
}
|
55929
55967
|
if (hasChanged) {
|
55930
55968
|
tableMeta.editing.setCellValue(cell, rowIndex, nextValue);
|
55931
|
-
|
55932
|
-
requestAnimationFrame(() => tableMeta.editing.onCellChanged(cell, rowIndex, nextValue, true, false));
|
55933
|
-
}
|
55969
|
+
shouldRunUpdate.current = hasNonTextControl;
|
55934
55970
|
}
|
55935
55971
|
},
|
55936
55972
|
[hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex, value, columnMeta.dataType]
|
@@ -56208,6 +56244,7 @@ function DiscardChangesConfirmationDialog(props) {
|
|
56208
56244
|
return /* @__PURE__ */ React.createElement(Dialog, { ...dialogProps, showCloseButton: false }, /* @__PURE__ */ React.createElement(
|
56209
56245
|
Dialog.Content,
|
56210
56246
|
{
|
56247
|
+
"data-taco": "discard-changes-dialog",
|
56211
56248
|
"aria-label": texts.table3.editing.clearChangesConfirmationDialog.title,
|
56212
56249
|
onClick: handleClickInsideDialogContent,
|
56213
56250
|
onKeyDown: handleKeydown
|
@@ -56226,16 +56263,11 @@ function DiscardChangesConfirmationDialog(props) {
|
|
56226
56263
|
));
|
56227
56264
|
}
|
56228
56265
|
function Row(props) {
|
56229
|
-
const { row, index: index2, table
|
56266
|
+
const { row, index: index2, table } = props;
|
56230
56267
|
const focusManager = useAugmentedFocusManager();
|
56231
56268
|
const tableMeta = table.options.meta;
|
56232
56269
|
const isActiveRow = tableMeta.rowActive.rowActiveIndex === index2;
|
56233
|
-
const rowRef = React.useRef(null);
|
56234
56270
|
const hasErrors = tableMeta.editing.hasRowErrors(row.id);
|
56235
|
-
React.useEffect(() => {
|
56236
|
-
if (!measureRow || !rowRef.current) return;
|
56237
|
-
measureRow(rowRef.current.getBoundingClientRect().height);
|
56238
|
-
}, [hasErrors, measureRow]);
|
56239
56271
|
React.useEffect(() => {
|
56240
56272
|
if (tableMeta.editing.isEditing && isActiveRow && tableMeta.editing.lastFocusedCellIndex === void 0) {
|
56241
56273
|
const element = focusManager.focusFirst();
|
@@ -56292,7 +56324,7 @@ function Row(props) {
|
|
56292
56324
|
onFocus: handleFocus,
|
56293
56325
|
onKeyDown: handleKeyDown
|
56294
56326
|
};
|
56295
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DisplayRow, { ...props, ...attributes,
|
56327
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DisplayRow, { ...props, ...attributes, remeasureDependencies: [hasErrors] }, rowStatus === "saving" || rowStatus === "saved" ? /* @__PURE__ */ React.createElement(SaveStatus, { rowId: row.id, table }) : null), /* @__PURE__ */ React.createElement(
|
56296
56328
|
DiscardChangesConfirmationDialog,
|
56297
56329
|
{
|
56298
56330
|
open: showDiscardDialog,
|
@@ -56389,7 +56421,7 @@ function useTable3(props, ref) {
|
|
56389
56421
|
removeRowChanges: (rowId) => table.meta.editing.discardChanges(rowId, table.instance),
|
56390
56422
|
save: (rowId) => table.meta.editing.saveChanges(table.instance, rowId)
|
56391
56423
|
};
|
56392
|
-
if (props.onEditingCreate) {
|
56424
|
+
if (props.onEditingCreate && instance.editing) {
|
56393
56425
|
instance.editing.createRow = (row) => table.meta.editing.createRow(table.instance, row);
|
56394
56426
|
}
|
56395
56427
|
}
|
@@ -56398,7 +56430,7 @@ function useTable3(props, ref) {
|
|
56398
56430
|
React.useEffect(() => {
|
56399
56431
|
if (table.ref.current) {
|
56400
56432
|
const instance = table.ref.current.instance;
|
56401
|
-
if (table.meta.editing.isEnabled) {
|
56433
|
+
if (table.meta.editing.isEnabled && instance.editing) {
|
56402
56434
|
instance.editing.forceValidate = async () => await table.meta.editing.forceValidate(table.instance);
|
56403
56435
|
}
|
56404
56436
|
}
|