@economic/taco 2.68.0 → 2.69.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 +35 -32
- package/dist/taco.cjs.map +1 -1
- package/dist/taco.d.ts +3 -1
- package/dist/taco.js +35 -32
- package/dist/taco.js.map +1 -1
- package/package.json +2 -2
package/dist/taco.d.ts
CHANGED
@@ -3046,7 +3046,9 @@ export declare interface Table3CommonProps<TType = unknown> extends Table3Featur
|
|
3046
3046
|
|
3047
3047
|
export declare type Table3EditingChangeHandler<TType = unknown> = (accessor: string, value: unknown, row: TType, prevRow: TType) => Promise<Partial<TType>> | undefined;
|
3048
3048
|
|
3049
|
-
export declare type Table3EditingCreateHandler<TType = unknown> = (
|
3049
|
+
export declare type Table3EditingCreateHandler<TType = unknown> = ({ activeRow, }?: {
|
3050
|
+
activeRow: TType | undefined;
|
3051
|
+
}) => Promise<Partial<TType>>;
|
3050
3052
|
|
3051
3053
|
declare type Table3EditingDiscardHandler = () => void;
|
3052
3054
|
|
package/dist/taco.js
CHANGED
@@ -18244,7 +18244,7 @@ const ScrollableList = React.forwardRef(function ScrollableList2(props, ref) {
|
|
18244
18244
|
role: options.length <= 0 || loading ? "presentation" : "listbox",
|
18245
18245
|
tabIndex: otherProps.tabIndex || 0
|
18246
18246
|
};
|
18247
|
-
return /* @__PURE__ */ React.createElement("ul", { ...list, "data-taco": "scrollable-list" }, loading ? /* @__PURE__ */ React.createElement("li", { className: "yt-list__empty" }, /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(Spinner, { delay: 0 })), /* @__PURE__ */ React.createElement("span", null, texts.listbox.loading)) : options.length ? options.map(({ children, icon, ...optionProps }) => /* @__PURE__ */ React.createElement("li", { ...optionProps }, icon, /* @__PURE__ */ React.createElement("span", { className: "flex-grow truncate text-left" }, children), multiselect && /* @__PURE__ */ React.createElement(
|
18247
|
+
return /* @__PURE__ */ React.createElement("ul", { ...list, "data-taco": "scrollable-list" }, loading ? /* @__PURE__ */ React.createElement("li", { className: "yt-list__empty" }, /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(Spinner, { delay: 0 })), /* @__PURE__ */ React.createElement("span", null, texts.listbox.loading)) : options.length ? options.map(({ children, icon, ...optionProps }) => /* @__PURE__ */ React.createElement("li", { ...optionProps }, icon, /* @__PURE__ */ React.createElement("span", { "data-taco": "list-option", className: "flex-grow truncate text-left" }, children), multiselect && /* @__PURE__ */ React.createElement(
|
18248
18248
|
Checkbox$2,
|
18249
18249
|
{
|
18250
18250
|
"aria-hidden": true,
|
@@ -44223,7 +44223,7 @@ const Option = React__default.forwardRef(function Select2Option(props, ref) {
|
|
44223
44223
|
value: props.value
|
44224
44224
|
}
|
44225
44225
|
) : void 0;
|
44226
|
-
return /* @__PURE__ */ React__default.createElement(Option$1, { ...otherProps, className, onClick: handleClick, onKeyDown: handleKeyDown, ref }, hasValue2 ? /* @__PURE__ */ React__default.createElement(Icon$1, { name: "tick", className: "pointer-events-none invisible -mx-0.5 !h-4 !w-4 group-aria-selected:visible" }) : null, typeof children === "string" ? isTag ? /* @__PURE__ */ React__default.createElement(Tag, { className: "pointer-events-none my-1", color: color2, icon: prefix2 }, children) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, prefix2 ? typeof prefix2 === "string" ? /* @__PURE__ */ React__default.createElement(Icon$1, { name: prefix2, className: "!h-5 !w-5" }) : prefix2 : null, /* @__PURE__ */ React__default.createElement("span", { className: "flex w-full justify-between" }, /* @__PURE__ */ React__default.createElement("span", { className: "flex flex-col" }, /* @__PURE__ */ React__default.createElement("span", null, children), description ? /* @__PURE__ */ React__default.createElement("span", { className: "text-grey-700 -mt-1.5 mb-1.5 text-xs", "data-taco": "description" }, description) : null), /* @__PURE__ */ React__default.createElement("span", { className: "flex flex-col self-center" }, postfix ? typeof postfix === "string" ? /* @__PURE__ */ React__default.createElement(Icon$1, { name: postfix, className: "!h-5 !w-5" }) : postfix : null))) : /* @__PURE__ */ React__default.createElement("span",
|
44226
|
+
return /* @__PURE__ */ React__default.createElement(Option$1, { ...otherProps, className, onClick: handleClick, onKeyDown: handleKeyDown, ref }, hasValue2 ? /* @__PURE__ */ React__default.createElement(Icon$1, { name: "tick", className: "pointer-events-none invisible -mx-0.5 !h-4 !w-4 group-aria-selected:visible" }) : null, typeof children === "string" ? isTag ? /* @__PURE__ */ React__default.createElement(Tag, { className: "pointer-events-none my-1", color: color2, icon: prefix2 }, children) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, prefix2 ? typeof prefix2 === "string" ? /* @__PURE__ */ React__default.createElement(Icon$1, { name: prefix2, className: "!h-5 !w-5" }) : prefix2 : null, /* @__PURE__ */ React__default.createElement("span", { className: "flex w-full justify-between" }, /* @__PURE__ */ React__default.createElement("span", { className: "flex flex-col" }, /* @__PURE__ */ React__default.createElement("span", null, children), description ? /* @__PURE__ */ React__default.createElement("span", { className: "text-grey-700 -mt-1.5 mb-1.5 text-xs", "data-taco": "description" }, description) : null), /* @__PURE__ */ React__default.createElement("span", { className: "flex flex-col self-center" }, postfix ? typeof postfix === "string" ? /* @__PURE__ */ React__default.createElement(Icon$1, { name: postfix, className: "!h-5 !w-5" }) : postfix : null))) : /* @__PURE__ */ React__default.createElement("span", { className: "w-full" }, children), popover ? /* @__PURE__ */ React__default.createElement(
|
44227
44227
|
IconButton,
|
44228
44228
|
{
|
44229
44229
|
icon: "ellipsis-vertical",
|
@@ -45231,11 +45231,11 @@ function guessComparatorsBasedOnControl(column) {
|
|
45231
45231
|
}
|
45232
45232
|
const FilterContext = React__default.createContext([]);
|
45233
45233
|
const FilterColumn = React__default.forwardRef((props, ref) => {
|
45234
|
-
const {
|
45234
|
+
const { allColumns, onChange: handleChange, value = null, ...attributes } = props;
|
45235
45235
|
const { texts } = useLocalization();
|
45236
45236
|
const filters = React__default.useContext(FilterContext);
|
45237
|
-
const selectedColumn =
|
45238
|
-
const warning2 = selectedColumn && !selectedColumn.
|
45237
|
+
const selectedColumn = allColumns.find((column) => column.id === value);
|
45238
|
+
const warning2 = selectedColumn && !selectedColumn.getIsVisible();
|
45239
45239
|
return /* @__PURE__ */ React__default.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React__default.createElement(
|
45240
45240
|
Field,
|
45241
45241
|
{
|
@@ -45253,23 +45253,22 @@ const FilterColumn = React__default.forwardRef((props, ref) => {
|
|
45253
45253
|
onChange: handleChange,
|
45254
45254
|
value
|
45255
45255
|
},
|
45256
|
-
|
45256
|
+
allColumns.map((column) => {
|
45257
45257
|
var _a, _b;
|
45258
45258
|
return /* @__PURE__ */ React__default.createElement(
|
45259
45259
|
Select22.Option,
|
45260
45260
|
{
|
45261
|
-
key:
|
45262
|
-
value:
|
45263
|
-
|
45264
|
-
Tooltip$3,
|
45265
|
-
{
|
45266
|
-
title: header.column.getIsGrouped() ? texts.table.filters.hiddenGroupedColumn : texts.table.filters.hiddenColumn
|
45267
|
-
},
|
45268
|
-
/* @__PURE__ */ React__default.createElement(Icon$1, { name: "eye-off", className: "text-grey-500 !h-5 !w-5" })
|
45269
|
-
) : void 0,
|
45270
|
-
disabled: header.column.id !== value && (!header.column.getCanFilter() || !!filters.some((f2) => f2.id === header.column.id))
|
45261
|
+
key: column.id,
|
45262
|
+
value: column.id,
|
45263
|
+
disabled: column.id !== value && (!column.getCanFilter() || !!filters.some((f2) => f2.id === column.id))
|
45271
45264
|
},
|
45272
|
-
/* @__PURE__ */ React__default.createElement(React__default.
|
45265
|
+
/* @__PURE__ */ React__default.createElement("span", { className: "flex w-full justify-between" }, /* @__PURE__ */ React__default.createElement("span", { className: "flex flex-col" }, flexRender(column.columnDef.header, { column }), column.parent ? flexRender((_b = (_a = column.parent) == null ? void 0 : _a.columnDef.meta) == null ? void 0 : _b.header, { column }) : ""), /* @__PURE__ */ React__default.createElement("span", { className: "flex flex-col self-center" }, !column.getIsVisible() || column.getIsGrouped() ? /* @__PURE__ */ React__default.createElement(
|
45266
|
+
Tooltip$3,
|
45267
|
+
{
|
45268
|
+
title: column.getIsGrouped() ? texts.table.filters.hiddenGroupedColumn : texts.table.filters.hiddenColumn
|
45269
|
+
},
|
45270
|
+
/* @__PURE__ */ React__default.createElement(Icon$1, { name: "eye-off", className: "text-grey-500 !h-5 !w-5" })
|
45271
|
+
) : void 0))
|
45273
45272
|
);
|
45274
45273
|
})
|
45275
45274
|
)
|
@@ -45440,9 +45439,9 @@ function Control(props) {
|
|
45440
45439
|
);
|
45441
45440
|
}
|
45442
45441
|
function Filter(props) {
|
45443
|
-
const {
|
45442
|
+
const { allColumns, filter: filter2, onChange: handleChange, onRemove, position } = props;
|
45444
45443
|
const { texts } = useLocalization();
|
45445
|
-
const column =
|
45444
|
+
const column = allColumns.find((column2) => column2.id === filter2.id);
|
45446
45445
|
const ref = React__default.useRef(null);
|
45447
45446
|
const {
|
45448
45447
|
id: id2,
|
@@ -45450,13 +45449,13 @@ function Filter(props) {
|
|
45450
45449
|
} = filter2;
|
45451
45450
|
const handleChangeColumn = (columnId) => {
|
45452
45451
|
var _a, _b, _c;
|
45453
|
-
const previousColumn =
|
45454
|
-
const nextColumn =
|
45455
|
-
if (((_a = previousColumn == null ? void 0 : previousColumn.
|
45452
|
+
const previousColumn = allColumns.find((column2) => column2.id === id2);
|
45453
|
+
const nextColumn = allColumns.find((column2) => column2.id === columnId);
|
45454
|
+
if (((_a = previousColumn == null ? void 0 : previousColumn.columnDef.meta) == null ? void 0 : _a.dataType) && ((_b = previousColumn == null ? void 0 : previousColumn.columnDef.meta) == null ? void 0 : _b.dataType) === ((_c = nextColumn == null ? void 0 : nextColumn.columnDef.meta) == null ? void 0 : _c.dataType)) {
|
45456
45455
|
handleChange(position, { id: columnId, value: filter2.value });
|
45457
45456
|
return;
|
45458
45457
|
}
|
45459
|
-
const validComparators = guessComparatorsBasedOnControl(nextColumn
|
45458
|
+
const validComparators = guessComparatorsBasedOnControl(nextColumn);
|
45460
45459
|
const value2 = {
|
45461
45460
|
comparator: validComparators[0],
|
45462
45461
|
value: void 0
|
@@ -45479,13 +45478,13 @@ function Filter(props) {
|
|
45479
45478
|
ref.current.focus();
|
45480
45479
|
}
|
45481
45480
|
}, [id2]);
|
45482
|
-
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, {
|
45481
|
+
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, { allColumns, onChange: handleChangeColumn, value: id2, ref }), /* @__PURE__ */ React__default.createElement(FilterComparator, { column, onChange: handleChangeComparator, value: comparator }), /* @__PURE__ */ React__default.createElement(FilterValue, { column, comparator, onChange: handleChangeValue, value }), onRemove ? /* @__PURE__ */ React__default.createElement(IconButton, { appearance: "discrete", className: "ml-auto", icon: "close", onClick: handleRemove }) : null);
|
45483
45482
|
}
|
45484
45483
|
const placeholderFilter = { id: "", value: { comparator: TableFilterComparator.Contains, value: void 0 } };
|
45485
45484
|
function ManageFiltersPopover(props) {
|
45486
45485
|
const { length, table, ...popoverProps } = props;
|
45487
45486
|
const { locale: locale2, texts } = useLocalization();
|
45488
|
-
const
|
45487
|
+
const allColumns = table.getAllLeafColumns().filter((column) => !isInternalColumn(column.id)).sort(sortByHeader);
|
45489
45488
|
const columnFilters = table.getState().columnFilters;
|
45490
45489
|
const tableMeta = table.options.meta;
|
45491
45490
|
const [filters, setFilters] = React__default.useState(columnFilters.length ? columnFilters : [placeholderFilter]);
|
@@ -45524,7 +45523,7 @@ function ManageFiltersPopover(props) {
|
|
45524
45523
|
if (f2.id === null || f2.id === "") {
|
45525
45524
|
return false;
|
45526
45525
|
}
|
45527
|
-
const controlRenderer = (_b = (_a =
|
45526
|
+
const controlRenderer = (_b = (_a = allColumns.find((column) => column.id === f2.id)) == null ? void 0 : _a.columnDef.meta) == null ? void 0 : _b.control;
|
45528
45527
|
if (f2.value.comparator === TableFilterComparator.IsEmpty || f2.value.comparator === TableFilterComparator.IsNotEmpty || controlRenderer === "switch") {
|
45529
45528
|
return true;
|
45530
45529
|
}
|
@@ -45554,7 +45553,7 @@ function ManageFiltersPopover(props) {
|
|
45554
45553
|
Filter,
|
45555
45554
|
{
|
45556
45555
|
key: `filter_${index2}`,
|
45557
|
-
|
45556
|
+
allColumns,
|
45558
45557
|
filter: filter2,
|
45559
45558
|
position: index2,
|
45560
45559
|
onChange: handleChangeFilter,
|
@@ -55635,6 +55634,7 @@ function useTableEditing(isEnabled = false, defaultToggleEditing = false, handle
|
|
55635
55634
|
pendingChangesFns.saveChanges(table);
|
55636
55635
|
}
|
55637
55636
|
async function createRow2(table, row) {
|
55637
|
+
var _a, _b;
|
55638
55638
|
if (!handleCreate) {
|
55639
55639
|
return;
|
55640
55640
|
}
|
@@ -55645,7 +55645,10 @@ function useTableEditing(isEnabled = false, defaultToggleEditing = false, handle
|
|
55645
55645
|
return;
|
55646
55646
|
}
|
55647
55647
|
}
|
55648
|
-
const
|
55648
|
+
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;
|
55649
|
+
const changeset = row ?? await handleCreate({
|
55650
|
+
activeRow: currentRow ? { ...currentRow.original, ...tableMeta.editing.getRowValue(currentRow.id) } : void 0
|
55651
|
+
});
|
55649
55652
|
try {
|
55650
55653
|
if (changeset) {
|
55651
55654
|
const temporaryRows = tableMeta.editing.temporaryRows;
|
@@ -55654,10 +55657,10 @@ function useTableEditing(isEnabled = false, defaultToggleEditing = false, handle
|
|
55654
55657
|
requestAnimationFrame(() => {
|
55655
55658
|
const newRowId = pendingChangesFns.insertTemporaryRow(changeset, nextRowIndex);
|
55656
55659
|
table.setRowPinning((currentState) => {
|
55657
|
-
var
|
55660
|
+
var _a2;
|
55658
55661
|
return {
|
55659
55662
|
...currentState,
|
55660
|
-
bottom: (
|
55663
|
+
bottom: (_a2 = currentState.bottom ?? []) == null ? void 0 : _a2.concat(newRowId)
|
55661
55664
|
};
|
55662
55665
|
});
|
55663
55666
|
toggleDetailedMode(false);
|
@@ -56211,10 +56214,10 @@ function Row(props) {
|
|
56211
56214
|
const isActiveRow = tableMeta.rowActive.rowActiveIndex === index2;
|
56212
56215
|
const rowRef = React__default.useRef(null);
|
56213
56216
|
const hasErrors = tableMeta.editing.hasRowErrors(row.id);
|
56214
|
-
React__default.
|
56217
|
+
React__default.useEffect(() => {
|
56215
56218
|
if (!measureRow || !rowRef.current) return;
|
56216
56219
|
measureRow(rowRef.current.getBoundingClientRect().height);
|
56217
|
-
}, [hasErrors, measureRow
|
56220
|
+
}, [hasErrors, measureRow]);
|
56218
56221
|
React__default.useEffect(() => {
|
56219
56222
|
if (tableMeta.editing.isEditing && isActiveRow && tableMeta.editing.lastFocusedCellIndex === void 0) {
|
56220
56223
|
const element = focusManager.focusFirst();
|