@economic/taco 2.64.1-test-1.0 → 2.65.0-alt-tab-popover-focus.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 +72 -47
- package/dist/taco.cjs.map +1 -1
- package/dist/taco.d.ts +4 -1
- package/dist/taco.js +72 -47
- package/dist/taco.js.map +1 -1
- package/package.json +2 -2
package/dist/taco.cjs
CHANGED
@@ -9863,8 +9863,25 @@ function isElementTriggeredFromContainer(element, container) {
|
|
9863
9863
|
}
|
9864
9864
|
return false;
|
9865
9865
|
}
|
9866
|
+
const isDialogOpenedFromContainer = (element, container) => {
|
9867
|
+
if (!container) {
|
9868
|
+
return false;
|
9869
|
+
}
|
9870
|
+
let currentDialog = element == null ? void 0 : element.closest('[role="dialog"]');
|
9871
|
+
while (currentDialog == null ? void 0 : currentDialog.id) {
|
9872
|
+
const opener = document.querySelector(`[aria-controls="${currentDialog.id}"]`);
|
9873
|
+
if (!opener) {
|
9874
|
+
return false;
|
9875
|
+
}
|
9876
|
+
if (container.contains(opener)) {
|
9877
|
+
return true;
|
9878
|
+
}
|
9879
|
+
currentDialog = opener.closest('[role="dialog"]');
|
9880
|
+
}
|
9881
|
+
return false;
|
9882
|
+
};
|
9866
9883
|
function isElementInsideOrTriggeredFromContainer(element, container) {
|
9867
|
-
return isElementTriggeredFromContainer(element, container) || !!(container == null ? void 0 : container.contains(element));
|
9884
|
+
return isElementTriggeredFromContainer(element, container) || !!(container == null ? void 0 : container.contains(element)) || isDialogOpenedFromContainer(element, container);
|
9868
9885
|
}
|
9869
9886
|
function isElementInsideOverlay(element) {
|
9870
9887
|
return !!(element == null ? void 0 : element.closest("[role=dialog],[role=menu]"));
|
@@ -18485,7 +18502,7 @@ const useCombobox = (props, ref) => {
|
|
18485
18502
|
React__namespace.useEffect(() => {
|
18486
18503
|
const isCurrentValue = value !== void 0 && value !== null && inputValue === String(value);
|
18487
18504
|
if (inputValue && data.length && !isCurrentValue) {
|
18488
|
-
setCurrentIndex(0);
|
18505
|
+
setCurrentIndex(getIndexFromValue(data, inputValue) || 0);
|
18489
18506
|
if (!open) {
|
18490
18507
|
setOpen(true);
|
18491
18508
|
}
|
@@ -25749,6 +25766,13 @@ const Dialog = React__namespace.forwardRef(function Dialog2(props, ref) {
|
|
25749
25766
|
}),
|
25750
25767
|
[closeOnEscape, drawerOpen, draggable, drawer, extra, open, otherProps, showCloseButton]
|
25751
25768
|
);
|
25769
|
+
React__namespace.useEffect(() => {
|
25770
|
+
const onFocusOut = (event) => {
|
25771
|
+
event.stopImmediatePropagation();
|
25772
|
+
};
|
25773
|
+
document.addEventListener("focusout", onFocusOut);
|
25774
|
+
return () => document.removeEventListener("focusout", onFocusOut);
|
25775
|
+
}, []);
|
25752
25776
|
return /* @__PURE__ */ React__namespace.createElement(DialogContext.Provider, { value: context }, /* @__PURE__ */ React__namespace.createElement($5d3850c4d0b4e6c7$export$be92b6f5f03c0fe9, { defaultOpen, open, onOpenChange: onChange }, trigger && /* @__PURE__ */ React__namespace.createElement(Trigger$4, null, trigger), children));
|
25753
25777
|
});
|
25754
25778
|
Dialog.Trigger = Trigger$4;
|
@@ -36623,6 +36647,17 @@ function useTableRowDrop(isEnabled = false, onRowDrop) {
|
|
36623
36647
|
handleDrop: isEnabled ? onRowDrop : void 0
|
36624
36648
|
};
|
36625
36649
|
}
|
36650
|
+
function useTableRowActiveListener$1(table, onRowActive) {
|
36651
|
+
var _a;
|
36652
|
+
const meta = table.options.meta;
|
36653
|
+
const rows = table.getRowModel().flatRows;
|
36654
|
+
const currentRow = meta.rowActive.rowActiveIndex !== void 0 ? (_a = rows[meta.rowActive.rowActiveIndex]) == null ? void 0 : _a.original : void 0;
|
36655
|
+
React.useEffect(() => {
|
36656
|
+
if (meta.rowActive.isEnabled && onRowActive) {
|
36657
|
+
onRowActive(currentRow);
|
36658
|
+
}
|
36659
|
+
}, [meta.rowActive.isEnabled, currentRow, onRowActive]);
|
36660
|
+
}
|
36626
36661
|
const DEFAULT_EMPTY_ARRAY = [];
|
36627
36662
|
function useTableManager(props, ref, meta, internalColumns) {
|
36628
36663
|
var _a;
|
@@ -36723,6 +36758,7 @@ function useTableManager(props, ref, meta, internalColumns) {
|
|
36723
36758
|
useTableDataListener(instance, length);
|
36724
36759
|
useTableFilterListener(instance, props.onChangeFilter);
|
36725
36760
|
useTableFontSizeListener(instance);
|
36761
|
+
useTableRowActiveListener$1(instance, props.onRowActive);
|
36726
36762
|
useTableRowHeightListener(instance);
|
36727
36763
|
useTableRowSelectionListener(instance, props.onRowSelect);
|
36728
36764
|
useTableSearchListener(instance);
|
@@ -37836,15 +37872,6 @@ function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIn
|
|
37836
37872
|
virtualiser.measure();
|
37837
37873
|
}
|
37838
37874
|
}, [expandedState]);
|
37839
|
-
React.useEffect(() => {
|
37840
|
-
const totalSize2 = virtualiser.getTotalSize();
|
37841
|
-
console.log("before measuring totalSize", totalSize2);
|
37842
|
-
virtualiser.measure();
|
37843
|
-
setTimeout(() => {
|
37844
|
-
const totalSize3 = virtualiser.getTotalSize();
|
37845
|
-
console.log("after measuring totalSize", totalSize3);
|
37846
|
-
}, 1e3);
|
37847
|
-
}, [tableMeta.fontSize.size, tableMeta.rowHeight.height, JSON.stringify(table.getState().sorting), rows.length]);
|
37848
37875
|
const totalSize = virtualiser.getTotalSize();
|
37849
37876
|
const virtualItems = virtualiser.getVirtualItems();
|
37850
37877
|
const scrollToIndex = React.useCallback(
|
@@ -38564,14 +38591,13 @@ const DisplayRow = React.memo(function DisplayRow2(props) {
|
|
38564
38591
|
}
|
38565
38592
|
const ref = React.useRef(null);
|
38566
38593
|
const expansionRef = React.useRef(null);
|
38567
|
-
const rowSize = useResizeObserver$1(ref, true);
|
38568
38594
|
const expandedRowSize = useResizeObserver$1(expansionRef, !!expandedRow);
|
38569
38595
|
React.useEffect(() => {
|
38570
38596
|
var _a2, _b2;
|
38571
38597
|
const rowHeight = ((_a2 = ref.current) == null ? void 0 : _a2.getBoundingClientRect().height) ?? 0;
|
38572
38598
|
const expansionHeight = ((_b2 = expansionRef.current) == null ? void 0 : _b2.getBoundingClientRect().height) ?? 0;
|
38573
38599
|
measureRow(rowHeight + expansionHeight);
|
38574
|
-
}, [
|
38600
|
+
}, [expansionRef.current, expandedRowSize == null ? void 0 : expandedRowSize.height]);
|
38575
38601
|
const className = clsx("group/row", otherAttributes.className, {
|
38576
38602
|
"hover:cursor-grab": tableMeta.rowDrag.isEnabled && typeof attributes.onClick !== "function",
|
38577
38603
|
"hover:cursor-pointer": typeof attributes.onClick === "function"
|
@@ -45187,11 +45213,11 @@ function guessComparatorsBasedOnControl(column) {
|
|
45187
45213
|
}
|
45188
45214
|
const FilterContext = React.createContext([]);
|
45189
45215
|
const FilterColumn = React.forwardRef((props, ref) => {
|
45190
|
-
const {
|
45216
|
+
const { allHeaders, onChange: handleChange, value = null, ...attributes } = props;
|
45191
45217
|
const { texts } = useLocalization();
|
45192
45218
|
const filters = React.useContext(FilterContext);
|
45193
|
-
const selectedColumn =
|
45194
|
-
const warning2 = selectedColumn && !selectedColumn.getIsVisible();
|
45219
|
+
const selectedColumn = allHeaders.find((header) => header.id === value);
|
45220
|
+
const warning2 = selectedColumn && !selectedColumn.column.getIsVisible();
|
45195
45221
|
return /* @__PURE__ */ React.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement(
|
45196
45222
|
Field,
|
45197
45223
|
{
|
@@ -45209,23 +45235,23 @@ const FilterColumn = React.forwardRef((props, ref) => {
|
|
45209
45235
|
onChange: handleChange,
|
45210
45236
|
value
|
45211
45237
|
},
|
45212
|
-
|
45213
|
-
var _a, _b
|
45238
|
+
allHeaders.map((header) => {
|
45239
|
+
var _a, _b;
|
45214
45240
|
return /* @__PURE__ */ React.createElement(
|
45215
45241
|
Select22.Option,
|
45216
45242
|
{
|
45217
|
-
key: column.id,
|
45218
|
-
value: column.id,
|
45219
|
-
postfix: !column.getIsVisible() || column.getIsGrouped() ? /* @__PURE__ */ React.createElement(
|
45243
|
+
key: header.column.id,
|
45244
|
+
value: header.column.id,
|
45245
|
+
postfix: !header.column.getIsVisible() || header.column.getIsGrouped() ? /* @__PURE__ */ React.createElement(
|
45220
45246
|
Tooltip$3,
|
45221
45247
|
{
|
45222
|
-
title: column.getIsGrouped() ? texts.table.filters.hiddenGroupedColumn : texts.table.filters.hiddenColumn
|
45248
|
+
title: header.column.getIsGrouped() ? texts.table.filters.hiddenGroupedColumn : texts.table.filters.hiddenColumn
|
45223
45249
|
},
|
45224
45250
|
/* @__PURE__ */ React.createElement(Icon$1, { name: "eye-off", className: "text-grey-500 !h-5 !w-5" })
|
45225
45251
|
) : void 0,
|
45226
|
-
disabled: column.id !== value && (!column.getCanFilter() || !!filters.find((f2) => f2.id === column.id))
|
45252
|
+
disabled: header.column.id !== value && (!header.column.getCanFilter() || !!filters.find((f2) => f2.id === header.column.id))
|
45227
45253
|
},
|
45228
|
-
(
|
45254
|
+
/* @__PURE__ */ React.createElement(React.Fragment, null, flexRender(header.column.columnDef.header, header.getContext()), header.column.parent ? ` (${flexRender((_b = (_a = header.column.parent) == null ? void 0 : _a.columnDef.meta) == null ? void 0 : _b.header, header.getContext())})` : "")
|
45229
45255
|
);
|
45230
45256
|
})
|
45231
45257
|
)
|
@@ -45394,9 +45420,9 @@ function Control(props) {
|
|
45394
45420
|
);
|
45395
45421
|
}
|
45396
45422
|
function Filter(props) {
|
45397
|
-
const {
|
45423
|
+
const { allHeaders, filter: filter2, onChange: handleChange, onRemove, position } = props;
|
45398
45424
|
const { texts } = useLocalization();
|
45399
|
-
const column =
|
45425
|
+
const column = allHeaders.find((header) => header.column.id === filter2.id);
|
45400
45426
|
const ref = React.useRef(null);
|
45401
45427
|
const {
|
45402
45428
|
id: id2,
|
@@ -45404,13 +45430,13 @@ function Filter(props) {
|
|
45404
45430
|
} = filter2;
|
45405
45431
|
const handleChangeColumn = (columnId) => {
|
45406
45432
|
var _a, _b, _c;
|
45407
|
-
const previousColumn =
|
45408
|
-
const nextColumn =
|
45409
|
-
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)) {
|
45433
|
+
const previousColumn = allHeaders.find((header) => header.column.id === id2);
|
45434
|
+
const nextColumn = allHeaders.find((header) => header.column.id === columnId);
|
45435
|
+
if (((_a = previousColumn == null ? void 0 : previousColumn.column.columnDef.meta) == null ? void 0 : _a.dataType) && ((_b = previousColumn == null ? void 0 : previousColumn.column.columnDef.meta) == null ? void 0 : _b.dataType) === ((_c = nextColumn == null ? void 0 : nextColumn.column.columnDef.meta) == null ? void 0 : _c.dataType)) {
|
45410
45436
|
handleChange(position, { id: columnId, value: filter2.value });
|
45411
45437
|
return;
|
45412
45438
|
}
|
45413
|
-
const validComparators = guessComparatorsBasedOnControl(nextColumn);
|
45439
|
+
const validComparators = guessComparatorsBasedOnControl(nextColumn == null ? void 0 : nextColumn.column);
|
45414
45440
|
const value2 = {
|
45415
45441
|
comparator: validComparators[0],
|
45416
45442
|
value: void 0
|
@@ -45433,13 +45459,13 @@ function Filter(props) {
|
|
45433
45459
|
ref.current.focus();
|
45434
45460
|
}
|
45435
45461
|
}, [id2]);
|
45436
|
-
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, {
|
45462
|
+
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);
|
45437
45463
|
}
|
45438
45464
|
const placeholderFilter = { id: "", value: { comparator: TableFilterComparator.Contains, value: void 0 } };
|
45439
45465
|
function ManageFiltersPopover(props) {
|
45440
45466
|
const { length, table, ...popoverProps } = props;
|
45441
45467
|
const { locale: locale2, texts } = useLocalization();
|
45442
|
-
const
|
45468
|
+
const allHeaders = table.getLeafHeaders().filter((column) => !isInternalColumn(column.id)).sort((headerA, headerB) => sortByHeader(headerA.column, headerB.column));
|
45443
45469
|
const columnFilters = table.getState().columnFilters;
|
45444
45470
|
const tableMeta = table.options.meta;
|
45445
45471
|
const [filters, setFilters] = React.useState(columnFilters.length ? columnFilters : [placeholderFilter]);
|
@@ -45478,7 +45504,7 @@ function ManageFiltersPopover(props) {
|
|
45478
45504
|
if (f2.id === null || f2.id === "") {
|
45479
45505
|
return false;
|
45480
45506
|
}
|
45481
|
-
const controlRenderer = (_b = (_a =
|
45507
|
+
const controlRenderer = (_b = (_a = allHeaders.find((header) => header.column.id === f2.id)) == null ? void 0 : _a.column.columnDef.meta) == null ? void 0 : _b.control;
|
45482
45508
|
if (f2.value.comparator === TableFilterComparator.IsEmpty || f2.value.comparator === TableFilterComparator.IsNotEmpty || controlRenderer === "switch") {
|
45483
45509
|
return true;
|
45484
45510
|
}
|
@@ -45508,7 +45534,7 @@ function ManageFiltersPopover(props) {
|
|
45508
45534
|
Filter,
|
45509
45535
|
{
|
45510
45536
|
key: `filter_${index2}`,
|
45511
|
-
|
45537
|
+
allHeaders,
|
45512
45538
|
filter: filter2,
|
45513
45539
|
position: index2,
|
45514
45540
|
onChange: handleChangeFilter,
|
@@ -53948,14 +53974,6 @@ function isTableScrolled(ref) {
|
|
53948
53974
|
function useTableEditingListener(table, tableRef, scrollToIndex) {
|
53949
53975
|
const tableMeta = table.options.meta;
|
53950
53976
|
const localization = useLocalization();
|
53951
|
-
useLazyEffect(() => {
|
53952
|
-
return () => {
|
53953
|
-
var _a;
|
53954
|
-
if (tableMeta.editing.isEditing && tableMeta.rowActive.rowActiveIndex !== void 0) {
|
53955
|
-
tableMeta.editing.saveChanges(table, (_a = table.getRowModel().rows[tableMeta.rowActive.rowActiveIndex]) == null ? void 0 : _a.id);
|
53956
|
-
}
|
53957
|
-
};
|
53958
|
-
}, [tableMeta.rowActive.rowActiveIndex, tableMeta.editing.isEditing]);
|
53959
53977
|
const hasChanges = tableMeta.editing.hasChanges();
|
53960
53978
|
React.useEffect(() => {
|
53961
53979
|
function showUnsavedChangesWarning(event) {
|
@@ -55300,7 +55318,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
55300
55318
|
var _a, _b, _c;
|
55301
55319
|
return (_c = (_b = (_a = state.changes.errors) == null ? void 0 : _a[cell.row.id]) == null ? void 0 : _b.cells) == null ? void 0 : _c[cell.column.id];
|
55302
55320
|
}
|
55303
|
-
async function onCellChanged(cell, rowIndex, nextValue, shouldRunUpdaters = true) {
|
55321
|
+
async function onCellChanged(cell, rowIndex, nextValue, shouldRunUpdaters = true, shouldRunValidation = true) {
|
55304
55322
|
var _a;
|
55305
55323
|
const tableMeta = cell.getContext().table.options.meta;
|
55306
55324
|
const state2 = tableMeta.editing.getState();
|
@@ -55330,7 +55348,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
55330
55348
|
const nextMoveReasons = { ...state2.changes.moveReasons[cell.row.id] };
|
55331
55349
|
const nextCellErrors = { ...(_a = state2.changes.errors[cell.row.id]) == null ? void 0 : _a.cells };
|
55332
55350
|
let validationErrors = {};
|
55333
|
-
if (validator && Object.keys(nextChanges).length && original) {
|
55351
|
+
if (validator && Object.keys(nextChanges).length && original && shouldRunValidation) {
|
55334
55352
|
const nextRowValue = { ...original, ...changes, ...updatesForOtherCells };
|
55335
55353
|
validationErrors = await validator(nextRowValue) ?? {};
|
55336
55354
|
}
|
@@ -55458,7 +55476,9 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
55458
55476
|
return completed;
|
55459
55477
|
}
|
55460
55478
|
async function discardChanges(rowId, table) {
|
55461
|
-
|
55479
|
+
if (rowId.startsWith(TEMPORARY_ROW_ID_PREFIX)) {
|
55480
|
+
table.resetRowPinning(true);
|
55481
|
+
}
|
55462
55482
|
dispatch({
|
55463
55483
|
type: "removeRow",
|
55464
55484
|
rowId,
|
@@ -55812,7 +55832,7 @@ function EditingControlCell(props) {
|
|
55812
55832
|
if (hasChanged) {
|
55813
55833
|
tableMeta.editing.setCellValue(cell, rowIndex, nextValue);
|
55814
55834
|
if (hasNonTextControl) {
|
55815
|
-
requestAnimationFrame(() => tableMeta.editing.onCellChanged(cell, rowIndex, nextValue));
|
55835
|
+
requestAnimationFrame(() => tableMeta.editing.onCellChanged(cell, rowIndex, nextValue, true, false));
|
55816
55836
|
}
|
55817
55837
|
}
|
55818
55838
|
},
|
@@ -55825,7 +55845,7 @@ function EditingControlCell(props) {
|
|
55825
55845
|
}
|
55826
55846
|
requestAnimationFrame(() => {
|
55827
55847
|
tableMeta.editing.toggleDetailedMode(false);
|
55828
|
-
tableMeta.editing.onCellChanged(cell, rowIndex, void 0, !hasNonTextControl);
|
55848
|
+
tableMeta.editing.onCellChanged(cell, rowIndex, void 0, !hasNonTextControl, true);
|
55829
55849
|
});
|
55830
55850
|
},
|
55831
55851
|
[hasNonTextControl, cell.row.id, JSON.stringify(rowChanges), rowIndex, cell.column.id, cell.row.original]
|
@@ -56121,6 +56141,11 @@ function Row(props) {
|
|
56121
56141
|
}
|
56122
56142
|
}
|
56123
56143
|
}, [tableMeta.editing.isEditing, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.lastFocusedCellIndex]);
|
56144
|
+
useLazyEffect(() => {
|
56145
|
+
if (tableMeta.editing.isEditing && !isActiveRow) {
|
56146
|
+
tableMeta.editing.saveChanges(table, row.id);
|
56147
|
+
}
|
56148
|
+
}, [isActiveRow]);
|
56124
56149
|
const handleFocus = React.useCallback(
|
56125
56150
|
(event) => {
|
56126
56151
|
var _a;
|