@economic/taco 3.0.2-row-active-search.0 → 3.0.2-row-active-search.1
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 +25 -16
- package/dist/taco.cjs.map +1 -1
- package/dist/taco.js +25 -16
- package/dist/taco.js.map +1 -1
- package/package.json +2 -2
package/dist/taco.js
CHANGED
|
@@ -43888,6 +43888,23 @@ const useIsHoverStatePaused = () => {
|
|
|
43888
43888
|
}, [shouldPauseHoverState]);
|
|
43889
43889
|
return [shouldPauseHoverState, setShouldPauseHoverState];
|
|
43890
43890
|
};
|
|
43891
|
+
function focusActiveRow(tableRef) {
|
|
43892
|
+
var _a;
|
|
43893
|
+
const activeRow = ((_a = (tableRef == null ? void 0 : tableRef.current) ?? document) == null ? void 0 : _a.querySelector('tbody tr[data-row-active="true"]')) ?? null;
|
|
43894
|
+
if (activeRow) {
|
|
43895
|
+
if (!isElementInsideOrTriggeredFromContainer(document.activeElement, activeRow) && !isElementInteractive(document.activeElement)) {
|
|
43896
|
+
activeRow.focus({ preventScroll: true });
|
|
43897
|
+
}
|
|
43898
|
+
}
|
|
43899
|
+
}
|
|
43900
|
+
function useTableRowActiveListener$1(table, tableRef) {
|
|
43901
|
+
const tableMeta = table.options.meta;
|
|
43902
|
+
React__default.useEffect(() => {
|
|
43903
|
+
if (tableMeta.rowActive.rowActiveIndex !== void 0) {
|
|
43904
|
+
focusActiveRow(tableRef);
|
|
43905
|
+
}
|
|
43906
|
+
}, [tableMeta.rowActive.rowActiveIndex, tableRef]);
|
|
43907
|
+
}
|
|
43891
43908
|
function useTableRowActive$1(isEnabled = false, initialRowActiveIndex) {
|
|
43892
43909
|
const [rowActiveIndex, setRowActiveIndex] = React__default.useState(initialRowActiveIndex);
|
|
43893
43910
|
const [rowHoverIndex, setRowHoverIndex] = React__default.useState(void 0);
|
|
@@ -43895,7 +43912,11 @@ function useTableRowActive$1(isEnabled = false, initialRowActiveIndex) {
|
|
|
43895
43912
|
const move = (direction, length, scrollToIndex) => {
|
|
43896
43913
|
const nextIndex = rowActiveIndex === void 0 ? 0 : getNextIndex(direction, rowActiveIndex, length);
|
|
43897
43914
|
scrollToIndex(nextIndex);
|
|
43898
|
-
|
|
43915
|
+
if (nextIndex === rowActiveIndex) {
|
|
43916
|
+
setTimeout(() => focusActiveRow(), 0);
|
|
43917
|
+
} else {
|
|
43918
|
+
setTimeout(() => setRowActiveIndex(nextIndex), 50);
|
|
43919
|
+
}
|
|
43899
43920
|
};
|
|
43900
43921
|
const onKeyDown = React__default.useCallback(
|
|
43901
43922
|
(event, length, scrollToIndex) => {
|
|
@@ -44612,7 +44633,7 @@ function useTableRowDrop(isEnabled = false, onRowDrop) {
|
|
|
44612
44633
|
handleDrop: isEnabled ? onRowDrop : void 0
|
|
44613
44634
|
};
|
|
44614
44635
|
}
|
|
44615
|
-
function useTableRowActiveListener
|
|
44636
|
+
function useTableRowActiveListener(table, onRowActive) {
|
|
44616
44637
|
var _a;
|
|
44617
44638
|
const meta = table.options.meta;
|
|
44618
44639
|
const rows = table.getRowModel().flatRows;
|
|
@@ -44724,7 +44745,7 @@ function useTableManager(props, ref, meta, internalColumns) {
|
|
|
44724
44745
|
useTableDataListener(instance, length);
|
|
44725
44746
|
useTableFilterListener(instance, props.onChangeFilter);
|
|
44726
44747
|
useTableFontSizeListener(instance);
|
|
44727
|
-
useTableRowActiveListener
|
|
44748
|
+
useTableRowActiveListener(instance, props.onRowActive);
|
|
44728
44749
|
useTableRowHeightListener(instance);
|
|
44729
44750
|
useTableRowSelectionListener(instance, props.onRowSelect);
|
|
44730
44751
|
useTableSearchListener(instance);
|
|
@@ -45909,18 +45930,6 @@ function useRowGroupVirtualisation(table) {
|
|
|
45909
45930
|
);
|
|
45910
45931
|
return isTableGrouped ? rangeExtractor : void 0;
|
|
45911
45932
|
}
|
|
45912
|
-
function useTableRowActiveListener(table, tableRef) {
|
|
45913
|
-
const tableMeta = table.options.meta;
|
|
45914
|
-
React__default.useEffect(() => {
|
|
45915
|
-
var _a, _b;
|
|
45916
|
-
if (tableMeta.rowActive.rowActiveIndex !== void 0) {
|
|
45917
|
-
const activeRow = ((_a = tableRef.current) == null ? void 0 : _a.querySelector('tbody tr[data-row-active="true"]')) ?? null;
|
|
45918
|
-
if (!isElementInsideOrTriggeredFromContainer(document.activeElement, activeRow) && !isElementInteractive(document.activeElement)) {
|
|
45919
|
-
(_b = activeRow == null ? void 0 : activeRow.focus) == null ? void 0 : _b.call(activeRow, { preventScroll: true });
|
|
45920
|
-
}
|
|
45921
|
-
}
|
|
45922
|
-
}, [tableMeta.rowActive.rowActiveIndex]);
|
|
45923
|
-
}
|
|
45924
45933
|
function Actions(props) {
|
|
45925
45934
|
var _a, _b;
|
|
45926
45935
|
const { actions, actionsLength, data, isActiveRow, rowId, table } = props;
|
|
@@ -46255,7 +46264,7 @@ function useTable$1(props, externalRef, renderers, meta) {
|
|
|
46255
46264
|
const { style, stylesheet } = useTableStyle(manager.id, manager.instance);
|
|
46256
46265
|
useTableGlobalShortcuts(manager.instance, ref, renderer2.scrollToIndex, props.enableLocalKeyboardShortcuts);
|
|
46257
46266
|
useTableRef(manager.instance, ref);
|
|
46258
|
-
useTableRowActiveListener(manager.instance, ref);
|
|
46267
|
+
useTableRowActiveListener$1(manager.instance, ref);
|
|
46259
46268
|
return {
|
|
46260
46269
|
...manager,
|
|
46261
46270
|
props: {
|