@economic/taco 2.67.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 +22 -11
- package/dist/taco.cjs.map +1 -1
- package/dist/taco.d.ts +3 -1
- package/dist/taco.js +22 -11
- package/dist/taco.js.map +1 -1
- package/package.json +2 -2
package/dist/taco.cjs
CHANGED
@@ -26978,7 +26978,7 @@ const Content$4 = React__namespace.forwardRef(function HangerContent(props, ref)
|
|
26978
26978
|
const context = React__namespace.useContext(HangerContext);
|
26979
26979
|
const { texts } = useLocalization();
|
26980
26980
|
const className = clsx(
|
26981
|
-
"wcag-blue-500 border border-transparent rounded p-3 pr-12 yt-shadow focus:border-transparent max-w-sm",
|
26981
|
+
"wcag-blue-500 border border-transparent rounded p-3 pr-12 yt-shadow focus:border-transparent max-w-sm print:hidden",
|
26982
26982
|
props.className
|
26983
26983
|
);
|
26984
26984
|
const handleInteractOutside = (event) => {
|
@@ -39030,6 +39030,9 @@ function Header$1(props) {
|
|
39030
39030
|
if (canHide) {
|
39031
39031
|
memoedProps.onHide = header.column.getToggleVisibilityHandler();
|
39032
39032
|
}
|
39033
|
+
if (header.id === "__expansion") {
|
39034
|
+
memoedProps.isExpanded = table.getIsSomeRowsExpanded();
|
39035
|
+
}
|
39033
39036
|
if (canPin) {
|
39034
39037
|
memoedProps.onPin = (index2) => {
|
39035
39038
|
table.setColumnPinning((pinningState) => {
|
@@ -39080,6 +39083,7 @@ const MemoedHeader = React.memo(function MemoedHeader2(props) {
|
|
39080
39083
|
hasMenu,
|
39081
39084
|
id: id2,
|
39082
39085
|
index: index2,
|
39086
|
+
isExpanded,
|
39083
39087
|
isFiltered,
|
39084
39088
|
isGroup: isGroup2,
|
39085
39089
|
isPinned,
|
@@ -39119,6 +39123,7 @@ const MemoedHeader = React.memo(function MemoedHeader2(props) {
|
|
39119
39123
|
"data-cell-id": id2,
|
39120
39124
|
"data-cell-pinned": isPinned ? isPinned : void 0,
|
39121
39125
|
"data-taco": isGroup2 ? "grouped-column-header" : "column-header",
|
39126
|
+
"data-rows-expanded": isExpanded ? isExpanded : void 0,
|
39122
39127
|
style,
|
39123
39128
|
ref: setRef
|
39124
39129
|
},
|
@@ -39313,10 +39318,10 @@ function Summary(props) {
|
|
39313
39318
|
} else if (!tableMeta.server.isEnabled && (((_a = table.getState().columnFilters) == null ? void 0 : _a.length) || // filtered data
|
39314
39319
|
!!table.getState().globalFilter && table.options.enableGlobalFilter)) {
|
39315
39320
|
label = texts.table.footer.summary.records;
|
39316
|
-
count2 = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("strong",
|
39321
|
+
count2 = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("strong", { "data-taco": "table-footer-current-count" }, new Intl.NumberFormat(locale2).format(currentLength)), " ", texts.table.footer.summary.count, " ", /* @__PURE__ */ React.createElement("strong", { "data-taco": "table-footer-total-count" }, new Intl.NumberFormat(locale2).format(length)));
|
39317
39322
|
} else {
|
39318
39323
|
label = texts.table.footer.summary.records;
|
39319
|
-
count2 = /* @__PURE__ */ React.createElement("strong",
|
39324
|
+
count2 = /* @__PURE__ */ React.createElement("strong", { "data-taco": "table-footer-total-count" }, new Intl.NumberFormat(locale2).format(length));
|
39320
39325
|
}
|
39321
39326
|
return /* @__PURE__ */ React.createElement(
|
39322
39327
|
"div",
|
@@ -45167,6 +45172,7 @@ function Print(props) {
|
|
45167
45172
|
{
|
45168
45173
|
icon: "print",
|
45169
45174
|
"aria-label": texts.table.print.tooltip,
|
45175
|
+
id: `${tableId}-toolbar-print`,
|
45170
45176
|
dialog: (dialogProps) => /* @__PURE__ */ React.createElement(
|
45171
45177
|
PrintDialog,
|
45172
45178
|
{
|
@@ -45503,7 +45509,7 @@ function Filter(props) {
|
|
45503
45509
|
ref.current.focus();
|
45504
45510
|
}
|
45505
45511
|
}, [id2]);
|
45506
|
-
return /* @__PURE__ */ React.createElement("div", { className: "flex items-start gap-2" }, /* @__PURE__ */ React.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.createElement(FilterColumn, { allHeaders, onChange: handleChangeColumn, value: id2, ref }), /* @__PURE__ */ React.createElement(FilterComparator, { column: column == null ? void 0 : column.column, onChange: handleChangeComparator, value: comparator }), /* @__PURE__ */ React.createElement(FilterValue, { column: column == null ? void 0 : column.column, comparator, onChange: handleChangeValue, value }), onRemove ? /* @__PURE__ */ React.createElement(IconButton, { appearance: "discrete", className: "ml-auto", icon: "close", onClick: handleRemove }) : null);
|
45512
|
+
return /* @__PURE__ */ React.createElement("div", { className: "flex items-start gap-2", "data-taco": "filter-row" }, /* @__PURE__ */ React.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.createElement(FilterColumn, { allHeaders, onChange: handleChangeColumn, value: id2, ref }), /* @__PURE__ */ React.createElement(FilterComparator, { column: column == null ? void 0 : column.column, onChange: handleChangeComparator, value: comparator }), /* @__PURE__ */ React.createElement(FilterValue, { column: column == null ? void 0 : column.column, comparator, onChange: handleChangeValue, value }), onRemove ? /* @__PURE__ */ React.createElement(IconButton, { appearance: "discrete", className: "ml-auto", icon: "close", onClick: handleRemove }) : null);
|
45507
45513
|
}
|
45508
45514
|
const placeholderFilter = { id: "", value: { comparator: TableFilterComparator.Contains, value: void 0 } };
|
45509
45515
|
function ManageFiltersPopover(props) {
|
@@ -45584,10 +45590,10 @@ function ManageFiltersPopover(props) {
|
|
45584
45590
|
onChange: handleChangeFilter,
|
45585
45591
|
onRemove: filters.length > 0 && filters.some((f2) => f2.id) || filters.length > 1 ? handleRemoveFilter : void 0
|
45586
45592
|
}
|
45587
|
-
)), /* @__PURE__ */ React.createElement("div", { className: "justify-start" }, /* @__PURE__ */ React.createElement(Button$4, { appearance: "discrete", onClick: handleCreate }, "+ ", texts.table.filters.buttons.addFilter))), /* @__PURE__ */ React.createElement(Group$6, { className: "ml-auto" }, /* @__PURE__ */ React.createElement(Popover.Close, null, /* @__PURE__ */ React.createElement(Button$4,
|
45593
|
+
)), /* @__PURE__ */ React.createElement("div", { className: "justify-start" }, /* @__PURE__ */ React.createElement(Button$4, { appearance: "discrete", onClick: handleCreate, name: "add-filter" }, "+ ", texts.table.filters.buttons.addFilter))), /* @__PURE__ */ React.createElement(Group$6, { className: "ml-auto" }, /* @__PURE__ */ React.createElement(Popover.Close, null, /* @__PURE__ */ React.createElement(Button$4, { name: "close-filters" }, texts.table.filters.buttons.cancel)), /* @__PURE__ */ React.createElement(Button$4, { name: "clear-filters", onClick: handleClear }, texts.table.filters.buttons.clear), /* @__PURE__ */ React.createElement(Button$4, { appearance: "primary", name: "apply-filters", onClick: handleApply }, texts.table.filters.buttons.apply))))));
|
45588
45594
|
}
|
45589
45595
|
function Filters(props) {
|
45590
|
-
const { length, table } = props;
|
45596
|
+
const { length, tableId, table } = props;
|
45591
45597
|
const { texts } = useLocalization();
|
45592
45598
|
const isLargeScreen = useIsLargeScreen();
|
45593
45599
|
const columnFilters = table.getState().columnFilters;
|
@@ -45600,7 +45606,8 @@ function Filters(props) {
|
|
45600
45606
|
popover: (popoverProps) => /* @__PURE__ */ React.createElement(ManageFiltersPopover, { ...popoverProps, length, table }),
|
45601
45607
|
shortcut: shortcut2,
|
45602
45608
|
ref,
|
45603
|
-
tooltip: /* @__PURE__ */ React.createElement(React.Fragment, null, texts.table.filters.tooltip, /* @__PURE__ */ React.createElement(Shortcut, { className: "ml-2", keys: shortcut2 }))
|
45609
|
+
tooltip: /* @__PURE__ */ React.createElement(React.Fragment, null, texts.table.filters.tooltip, /* @__PURE__ */ React.createElement(Shortcut, { className: "ml-2", keys: shortcut2 })),
|
45610
|
+
id: `${tableId}-toolbar-filters`
|
45604
45611
|
};
|
45605
45612
|
React.useEffect(() => {
|
45606
45613
|
var _a;
|
@@ -45633,7 +45640,7 @@ function TableToolbar(props) {
|
|
45633
45640
|
"data-taco": "table-toolbar"
|
45634
45641
|
},
|
45635
45642
|
table.props.toolbarLeft,
|
45636
|
-
/* @__PURE__ */ React.createElement(Group$6, { className: "ml-auto flex-shrink-0 items-center print:hidden" }, customTools, canFilter ? /* @__PURE__ */ React.createElement(Filters, { length: table.meta.length, table: table.instance }) : null, table.props.toolbarRight, canPrint ? /* @__PURE__ */ React.createElement(Print, { table: table.instance, tableId: table.id, tableRef: table.ref }) : null, canSettings ? /* @__PURE__ */ React.createElement(Settings, { customSettings: table.props.customSettings, id: `${id2}-settings`, table: table.instance }) : null, canSearch ? /* @__PURE__ */ React.createElement(Search$1, { scrollToIndex: table.renderer.scrollToIndex, table: table.instance, tableRef: table.ref }) : null)
|
45643
|
+
/* @__PURE__ */ React.createElement(Group$6, { className: "ml-auto flex-shrink-0 items-center print:hidden" }, customTools, canFilter ? /* @__PURE__ */ React.createElement(Filters, { length: table.meta.length, tableId: table.id, table: table.instance }) : null, table.props.toolbarRight, canPrint ? /* @__PURE__ */ React.createElement(Print, { table: table.instance, tableId: table.id, tableRef: table.ref }) : null, canSettings ? /* @__PURE__ */ React.createElement(Settings, { customSettings: table.props.customSettings, id: `${id2}-settings`, table: table.instance }) : null, canSearch ? /* @__PURE__ */ React.createElement(Search$1, { scrollToIndex: table.renderer.scrollToIndex, table: table.instance, tableRef: table.ref }) : null)
|
45637
45644
|
), table.props.toolbarPanel ? /* @__PURE__ */ React.createElement("div", { className: "mb-4" }, table.props.toolbarPanel) : void 0);
|
45638
45645
|
}
|
45639
45646
|
function canChangeSettings(table, customSettings) {
|
@@ -55666,6 +55673,7 @@ function useTableEditing(isEnabled = false, defaultToggleEditing = false, handle
|
|
55666
55673
|
pendingChangesFns.saveChanges(table);
|
55667
55674
|
}
|
55668
55675
|
async function createRow2(table, row) {
|
55676
|
+
var _a, _b;
|
55669
55677
|
if (!handleCreate) {
|
55670
55678
|
return;
|
55671
55679
|
}
|
@@ -55676,7 +55684,10 @@ function useTableEditing(isEnabled = false, defaultToggleEditing = false, handle
|
|
55676
55684
|
return;
|
55677
55685
|
}
|
55678
55686
|
}
|
55679
|
-
const
|
55687
|
+
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;
|
55688
|
+
const changeset = row ?? await handleCreate({
|
55689
|
+
activeRow: currentRow ? { ...currentRow.original, ...tableMeta.editing.getRowValue(currentRow.id) } : void 0
|
55690
|
+
});
|
55680
55691
|
try {
|
55681
55692
|
if (changeset) {
|
55682
55693
|
const temporaryRows = tableMeta.editing.temporaryRows;
|
@@ -55685,10 +55696,10 @@ function useTableEditing(isEnabled = false, defaultToggleEditing = false, handle
|
|
55685
55696
|
requestAnimationFrame(() => {
|
55686
55697
|
const newRowId = pendingChangesFns.insertTemporaryRow(changeset, nextRowIndex);
|
55687
55698
|
table.setRowPinning((currentState) => {
|
55688
|
-
var
|
55699
|
+
var _a2;
|
55689
55700
|
return {
|
55690
55701
|
...currentState,
|
55691
|
-
bottom: (
|
55702
|
+
bottom: (_a2 = currentState.bottom ?? []) == null ? void 0 : _a2.concat(newRowId)
|
55692
55703
|
};
|
55693
55704
|
});
|
55694
55705
|
toggleDetailedMode(false);
|