@economic/taco 2.58.0 → 2.58.2-EC-64962.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 +53 -29
- package/dist/taco.cjs.map +1 -1
- package/dist/taco.d.ts +48 -38
- package/dist/taco.js +53 -29
- package/dist/taco.js.map +1 -1
- package/package.json +2 -2
package/dist/taco.cjs
CHANGED
@@ -33534,23 +33534,27 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
|
|
33534
33534
|
enablePrinting,
|
33535
33535
|
enableTruncate,
|
33536
33536
|
enableEditing,
|
33537
|
-
header
|
33538
|
-
|
33537
|
+
header
|
33538
|
+
}
|
33539
|
+
};
|
33540
|
+
const formattedValueRenderer = (value) => {
|
33541
|
+
var _a;
|
33542
|
+
const displayValue = (_a = dataTypeProperties.getDisplayValue) == null ? void 0 : _a.call(dataTypeProperties, value, { localization });
|
33543
|
+
const safeValue = value !== void 0 && value !== null ? String(value) : value;
|
33544
|
+
if (Array.isArray(displayValue)) {
|
33545
|
+
return displayValue[0] ?? safeValue;
|
33539
33546
|
}
|
33547
|
+
return displayValue ?? safeValue;
|
33540
33548
|
};
|
33549
|
+
const rendererArgs = (info) => ({
|
33550
|
+
formattedValue: formattedValueRenderer(info.getValue()),
|
33551
|
+
row: info.row.original,
|
33552
|
+
value: info.getValue()
|
33553
|
+
});
|
33541
33554
|
if (typeof renderer2 === "function") {
|
33542
|
-
column.cell = (info) => renderer2(
|
33543
|
-
} else
|
33544
|
-
|
33545
|
-
var _a;
|
33546
|
-
const displayValue = (_a = dataTypeProperties.getDisplayValue) == null ? void 0 : _a.call(dataTypeProperties, value, { localization });
|
33547
|
-
if (Array.isArray(displayValue)) {
|
33548
|
-
return displayValue[0] ?? value;
|
33549
|
-
}
|
33550
|
-
return displayValue ?? value;
|
33551
|
-
};
|
33552
|
-
column.cell = (info) => dataTypeRenderer(info.getValue());
|
33553
|
-
column.meta.renderer = dataTypeRenderer;
|
33555
|
+
column.cell = (info) => renderer2(rendererArgs(info));
|
33556
|
+
} else {
|
33557
|
+
column.cell = (info) => formattedValueRenderer(info.getValue());
|
33554
33558
|
}
|
33555
33559
|
if (typeof footer === "function") {
|
33556
33560
|
column.footer = (info) => footer(info.table.getRowModel().rows.flatMap((row) => row.original !== void 0 ? row.original : []));
|
@@ -36458,17 +36462,14 @@ function useSearchHighlighting(cell, cellIndex, ref) {
|
|
36458
36462
|
return isHighlighted;
|
36459
36463
|
}
|
36460
36464
|
function GroupedCell(props) {
|
36461
|
-
var _a;
|
36462
36465
|
const { cell, cellRef, index: index2, isHighlighted } = props;
|
36463
36466
|
const { table } = cell.getContext();
|
36464
36467
|
const tableMeta = table.options.meta;
|
36465
|
-
const columnMeta = cell.column.columnDef.meta;
|
36466
36468
|
const attributes = getCellAttributes(cell, index2, isHighlighted);
|
36467
36469
|
const { isHovered, rowIndex } = React.useContext(RowContext);
|
36468
36470
|
const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;
|
36469
36471
|
const canShowActions = isActiveRow || isHovered && !tableMeta.rowActive.isHoverStatePaused;
|
36470
36472
|
const colSpan = cell.row.getVisibleCells().filter((c3) => c3.column.id === "__actions" || !isInternalColumn(c3.column.id)).length - 1;
|
36471
|
-
const content = ((_a = columnMeta.renderer) == null ? void 0 : _a.call(columnMeta, cell.getValue(), cell.row.original)) ?? cell.getValue() ?? null;
|
36472
36473
|
const subRows = cell.getContext().row.subRows.map((row) => row.original);
|
36473
36474
|
return /* @__PURE__ */ React.createElement(
|
36474
36475
|
MemoedGroupedCell,
|
@@ -36482,7 +36483,7 @@ function GroupedCell(props) {
|
|
36482
36483
|
subRows,
|
36483
36484
|
table
|
36484
36485
|
},
|
36485
|
-
|
36486
|
+
flexRender(cell.column.columnDef.cell, cell.getContext())
|
36486
36487
|
);
|
36487
36488
|
}
|
36488
36489
|
const MemoedGroupedCell = React.memo(function MemoedGroupedCell2(props) {
|
@@ -36628,19 +36629,11 @@ const DisplayRow = React.memo(function DisplayRow2(props) {
|
|
36628
36629
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("tr", { ...attributes, className, ref }, children, row.getVisibleCells().filter((cell) => !(isGrouped && cell.column.id === "__actions")).map((cell, cellIndex) => /* @__PURE__ */ React.createElement(Cell$2, { key: cell.id, cell, index: cellIndex, renderer: CellRenderer }))), expandedRow ? /* @__PURE__ */ React.createElement("tr", { "data-row-parent-id": row.id, ref: expansionRef }, /* @__PURE__ */ React.createElement("td", { className: "col-span-full" }, expandedRow)) : null);
|
36629
36630
|
});
|
36630
36631
|
function DisplayCell(props) {
|
36631
|
-
var _a;
|
36632
36632
|
const { cell, cellRef, index: index2, isHighlighted, ...cellAttributes } = props;
|
36633
36633
|
const columnMeta = cell.column.columnDef.meta;
|
36634
36634
|
const attributes = getCellAttributes(cell, index2, isHighlighted);
|
36635
36635
|
const isTruncated = !!columnMeta.enableTruncate;
|
36636
|
-
|
36637
|
-
let content;
|
36638
|
-
if (isInternalColumn(cell.column.id)) {
|
36639
|
-
content = flexRender(cell.column.columnDef.cell, cell.getContext());
|
36640
|
-
} else {
|
36641
|
-
content = ((_a = columnMeta.renderer) == null ? void 0 : _a.call(columnMeta, value, cell.row.original)) ?? value ?? null;
|
36642
|
-
}
|
36643
|
-
return /* @__PURE__ */ React.createElement(MemoedDisplayCell, { ...cellAttributes, ...attributes, cellRef, isTruncated }, content);
|
36636
|
+
return /* @__PURE__ */ React.createElement(MemoedDisplayCell, { ...cellAttributes, ...attributes, cellRef, isTruncated }, flexRender(cell.column.columnDef.cell, cell.getContext()));
|
36644
36637
|
}
|
36645
36638
|
const MemoedDisplayCell = React.memo(function MemoedDisplayCell2(props) {
|
36646
36639
|
const { cellRef, children, isTruncated, ...cellAttributes } = props;
|
@@ -53147,6 +53140,27 @@ function reducer(state, action) {
|
|
53147
53140
|
temporaryRows: state.temporaryRows.filter((row) => row[rowIdentityAccessor] !== rowId)
|
53148
53141
|
};
|
53149
53142
|
}
|
53143
|
+
case "complete": {
|
53144
|
+
const { changes, handleDiscard } = payload;
|
53145
|
+
if (JSON.stringify(changes) !== JSON.stringify(state.changes.rows[rowId])) {
|
53146
|
+
return {
|
53147
|
+
...state,
|
53148
|
+
changes: {
|
53149
|
+
...state.changes,
|
53150
|
+
originals: setWith(
|
53151
|
+
state.changes.originals,
|
53152
|
+
rowId,
|
53153
|
+
{ ...state.changes.originals[rowId], ...changes },
|
53154
|
+
Object
|
53155
|
+
)
|
53156
|
+
}
|
53157
|
+
};
|
53158
|
+
}
|
53159
|
+
if (typeof handleDiscard === "function") {
|
53160
|
+
handleDiscard();
|
53161
|
+
}
|
53162
|
+
return state;
|
53163
|
+
}
|
53150
53164
|
case "setRowStatus": {
|
53151
53165
|
const { status } = payload;
|
53152
53166
|
return {
|
@@ -53364,7 +53378,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
53364
53378
|
for (const rowId2 of Object.keys(changes)) {
|
53365
53379
|
const status = getRowStatus(rowId2);
|
53366
53380
|
try {
|
53367
|
-
const rowChanges = changes[rowId2] ?? {};
|
53381
|
+
const rowChanges = JSON.parse(JSON.stringify(changes[rowId2] ?? {}));
|
53368
53382
|
if (!Object.keys(rowChanges).length || status === "saving" || status === "errored") {
|
53369
53383
|
continue;
|
53370
53384
|
}
|
@@ -53380,7 +53394,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
53380
53394
|
}
|
53381
53395
|
}
|
53382
53396
|
await handleSave(changeSet);
|
53383
|
-
await
|
53397
|
+
await complete(rowId2, table, rowChanges);
|
53384
53398
|
setRowStatus(rowId2, "saved");
|
53385
53399
|
setTimeout(() => {
|
53386
53400
|
setRowStatus(rowId2, void 0);
|
@@ -53429,6 +53443,16 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
53429
53443
|
await handleDiscard();
|
53430
53444
|
}
|
53431
53445
|
}
|
53446
|
+
async function complete(rowId, table, changes) {
|
53447
|
+
const handleDiscard2 = async () => {
|
53448
|
+
await discardChanges(rowId, table);
|
53449
|
+
};
|
53450
|
+
dispatch({
|
53451
|
+
type: "complete",
|
53452
|
+
rowId,
|
53453
|
+
payload: { rowIdentityAccessor, changes, handleDiscard: handleDiscard2 }
|
53454
|
+
});
|
53455
|
+
}
|
53432
53456
|
return {
|
53433
53457
|
// row
|
53434
53458
|
getRowValue,
|