@vuu-ui/vuu-table-extras 0.8.20-debug → 0.8.21-debug
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/cjs/index.js +508 -481
- package/cjs/index.js.map +4 -4
- package/esm/index.js +340 -307
- package/esm/index.js.map +4 -4
- package/index.css +1 -0
- package/index.css.map +2 -2
- package/package.json +12 -11
package/esm/index.js
CHANGED
|
@@ -473,7 +473,7 @@ import { useForkRef } from "@salt-ds/core";
|
|
|
473
473
|
import cx9 from "clsx";
|
|
474
474
|
import {
|
|
475
475
|
forwardRef,
|
|
476
|
-
useRef as
|
|
476
|
+
useRef as useRef14,
|
|
477
477
|
useState as useState7
|
|
478
478
|
} from "react";
|
|
479
479
|
|
|
@@ -636,7 +636,6 @@ var Row = memo(
|
|
|
636
636
|
"div",
|
|
637
637
|
{
|
|
638
638
|
...htmlAttributes,
|
|
639
|
-
"aria-rowindex": row[0] + 1,
|
|
640
639
|
key: `row-${row[0]}`,
|
|
641
640
|
role: "row",
|
|
642
641
|
className,
|
|
@@ -668,12 +667,12 @@ Row.displayName = "Row";
|
|
|
668
667
|
|
|
669
668
|
// ../vuu-table/src/useTable.ts
|
|
670
669
|
import {
|
|
671
|
-
|
|
670
|
+
useDragDrop
|
|
672
671
|
} from "@vuu-ui/vuu-ui-controls";
|
|
673
672
|
import {
|
|
674
673
|
applySort,
|
|
675
674
|
buildColumnMap as buildColumnMap2,
|
|
676
|
-
getIndexFromRowElement as
|
|
675
|
+
getIndexFromRowElement as getIndexFromRowElement3,
|
|
677
676
|
isGroupColumn as isGroupColumn3,
|
|
678
677
|
isJsonGroup as isJsonGroup2,
|
|
679
678
|
isValidNumber,
|
|
@@ -682,9 +681,9 @@ import {
|
|
|
682
681
|
useLayoutEffectSkipFirst as useLayoutEffectSkipFirst2
|
|
683
682
|
} from "@vuu-ui/vuu-utils";
|
|
684
683
|
import {
|
|
685
|
-
useCallback as
|
|
684
|
+
useCallback as useCallback18,
|
|
686
685
|
useEffect as useEffect4,
|
|
687
|
-
useMemo as
|
|
686
|
+
useMemo as useMemo6,
|
|
688
687
|
useState as useState6
|
|
689
688
|
} from "react";
|
|
690
689
|
|
|
@@ -1013,7 +1012,7 @@ import {
|
|
|
1013
1012
|
|
|
1014
1013
|
// ../vuu-table/src/table-dom-utils.ts
|
|
1015
1014
|
var headerCellQuery = (colIdx) => `.vuuTable-col-headers .vuuTableHeaderCell:nth-child(${colIdx})`;
|
|
1016
|
-
var dataCellQuery = (rowIdx, colIdx) => `.vuuTable-body > [aria-rowindex='${rowIdx}'] > [role='cell']:nth-child(${colIdx + 1})`;
|
|
1015
|
+
var dataCellQuery = (rowIdx, colIdx) => `.vuuTable-body > [aria-rowindex='${rowIdx + 1}'] > [role='cell']:nth-child(${colIdx + 1})`;
|
|
1017
1016
|
var getTableCell = (containerRef, [rowIdx, colIdx]) => {
|
|
1018
1017
|
var _a;
|
|
1019
1018
|
const cssQuery = rowIdx === -1 ? headerCellQuery(colIdx) : dataCellQuery(rowIdx, colIdx);
|
|
@@ -1285,6 +1284,7 @@ var useInitialValue = (value) => {
|
|
|
1285
1284
|
};
|
|
1286
1285
|
|
|
1287
1286
|
// ../vuu-table/src/useKeyboardNavigation.ts
|
|
1287
|
+
import { getIndexFromRowElement } from "@vuu-ui/vuu-utils";
|
|
1288
1288
|
import { useControlled } from "@salt-ds/core";
|
|
1289
1289
|
import {
|
|
1290
1290
|
useCallback as useCallback12,
|
|
@@ -1315,51 +1315,6 @@ var isNavigationKey = (key, navigationStyle) => {
|
|
|
1315
1315
|
var PageKeys = ["Home", "End", "PageUp", "PageDown"];
|
|
1316
1316
|
var isPagingKey = (key) => PageKeys.includes(key);
|
|
1317
1317
|
var NULL_CELL_POS = [-1, -1];
|
|
1318
|
-
var NO_SCROLL_NECESSARY = [void 0, void 0];
|
|
1319
|
-
var howFarIsRowOutsideViewport = (rowEl, contentContainer = rowEl.closest(".vuuTable-contentContainer")) => {
|
|
1320
|
-
if (contentContainer) {
|
|
1321
|
-
const viewport = contentContainer == null ? void 0 : contentContainer.getBoundingClientRect();
|
|
1322
|
-
const row = rowEl.getBoundingClientRect();
|
|
1323
|
-
if (row) {
|
|
1324
|
-
if (row.bottom > viewport.bottom) {
|
|
1325
|
-
return ["down", row.bottom - viewport.bottom];
|
|
1326
|
-
} else if (row.top < viewport.top) {
|
|
1327
|
-
return ["up", row.top - viewport.top];
|
|
1328
|
-
} else {
|
|
1329
|
-
return NO_SCROLL_NECESSARY;
|
|
1330
|
-
}
|
|
1331
|
-
} else {
|
|
1332
|
-
throw Error("Whats going on, row not found");
|
|
1333
|
-
}
|
|
1334
|
-
} else {
|
|
1335
|
-
throw Error("Whats going on, scrollbar container not found");
|
|
1336
|
-
}
|
|
1337
|
-
};
|
|
1338
|
-
var howFarIsCellOutsideViewport = (cellEl) => {
|
|
1339
|
-
var _a;
|
|
1340
|
-
const contentContainer = cellEl.closest(".vuuTable-contentContainer");
|
|
1341
|
-
if (contentContainer) {
|
|
1342
|
-
const rowEl = cellEl.closest(".vuuTableRow");
|
|
1343
|
-
if (rowEl) {
|
|
1344
|
-
const result = howFarIsRowOutsideViewport(rowEl, contentContainer);
|
|
1345
|
-
if (result !== NO_SCROLL_NECESSARY) {
|
|
1346
|
-
return result;
|
|
1347
|
-
}
|
|
1348
|
-
const viewport = contentContainer == null ? void 0 : contentContainer.getBoundingClientRect();
|
|
1349
|
-
const cell = (_a = cellEl.closest(".vuuTableCell")) == null ? void 0 : _a.getBoundingClientRect();
|
|
1350
|
-
if (cell) {
|
|
1351
|
-
if (cell.right > viewport.right) {
|
|
1352
|
-
return ["right", cell.right + 6 - viewport.right];
|
|
1353
|
-
} else if (cell.left < viewport.left) {
|
|
1354
|
-
return ["left", cell.left - viewport.left];
|
|
1355
|
-
}
|
|
1356
|
-
} else {
|
|
1357
|
-
throw Error("Whats going on, cell not found");
|
|
1358
|
-
}
|
|
1359
|
-
}
|
|
1360
|
-
}
|
|
1361
|
-
return NO_SCROLL_NECESSARY;
|
|
1362
|
-
};
|
|
1363
1318
|
function nextCellPos(key, [rowIdx, colIdx], columnCount, rowCount) {
|
|
1364
1319
|
if (key === "ArrowUp") {
|
|
1365
1320
|
if (rowIdx > -1) {
|
|
@@ -1427,14 +1382,14 @@ var useKeyboardNavigation = ({
|
|
|
1427
1382
|
"[role='columnHeader'],[role='cell']"
|
|
1428
1383
|
);
|
|
1429
1384
|
const getTableCellPos = (tableCell) => {
|
|
1430
|
-
var _a2
|
|
1385
|
+
var _a2;
|
|
1431
1386
|
if (tableCell.role === "columnHeader") {
|
|
1432
1387
|
const colIdx = parseInt((_a2 = tableCell.dataset.idx) != null ? _a2 : "-1", 10);
|
|
1433
1388
|
return [-1, colIdx];
|
|
1434
1389
|
} else {
|
|
1435
1390
|
const focusedRow = tableCell.closest("[role='row']");
|
|
1436
1391
|
if (focusedRow) {
|
|
1437
|
-
const rowIdx =
|
|
1392
|
+
const rowIdx = getIndexFromRowElement(focusedRow);
|
|
1438
1393
|
const colIdx = Array.from(focusedRow.childNodes).indexOf(tableCell);
|
|
1439
1394
|
return [rowIdx, colIdx];
|
|
1440
1395
|
}
|
|
@@ -1452,11 +1407,8 @@ var useKeyboardNavigation = ({
|
|
|
1452
1407
|
focusableCell.current = activeCell;
|
|
1453
1408
|
activeCell.setAttribute("tabindex", "0");
|
|
1454
1409
|
}
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
requestScroll == null ? void 0 : requestScroll({ type: "scroll-distance", distance, direction });
|
|
1458
|
-
}
|
|
1459
|
-
console.log(`activeCell focus`);
|
|
1410
|
+
console.log(`scroll row ${cellPos[0]}`);
|
|
1411
|
+
requestScroll == null ? void 0 : requestScroll({ type: "scroll-row", rowIndex: cellPos[0] });
|
|
1460
1412
|
activeCell.focus({ preventScroll: true });
|
|
1461
1413
|
}
|
|
1462
1414
|
}
|
|
@@ -1538,18 +1490,9 @@ var useKeyboardNavigation = ({
|
|
|
1538
1490
|
);
|
|
1539
1491
|
const scrollRowIntoViewIfNecessary = useCallback12(
|
|
1540
1492
|
(rowIndex) => {
|
|
1541
|
-
|
|
1542
|
-
const activeRow = container == null ? void 0 : container.querySelector(
|
|
1543
|
-
`[aria-rowindex="${rowIndex}"]`
|
|
1544
|
-
);
|
|
1545
|
-
if (activeRow) {
|
|
1546
|
-
const [direction, distance] = howFarIsRowOutsideViewport(activeRow);
|
|
1547
|
-
if (direction && distance) {
|
|
1548
|
-
requestScroll == null ? void 0 : requestScroll({ type: "scroll-distance", distance, direction });
|
|
1549
|
-
}
|
|
1550
|
-
}
|
|
1493
|
+
requestScroll == null ? void 0 : requestScroll({ type: "scroll-row", rowIndex });
|
|
1551
1494
|
},
|
|
1552
|
-
[
|
|
1495
|
+
[requestScroll]
|
|
1553
1496
|
);
|
|
1554
1497
|
const moveHighlightedRow = useCallback12(
|
|
1555
1498
|
async (key) => {
|
|
@@ -1710,7 +1653,7 @@ var useSelection = ({
|
|
|
1710
1653
|
|
|
1711
1654
|
// ../vuu-table/src/useTableContextMenu.ts
|
|
1712
1655
|
import { useContextMenu as usePopupContextMenu } from "@vuu-ui/vuu-popups";
|
|
1713
|
-
import { buildColumnMap, getIndexFromRowElement } from "@vuu-ui/vuu-utils";
|
|
1656
|
+
import { buildColumnMap, getIndexFromRowElement as getIndexFromRowElement2 } from "@vuu-ui/vuu-utils";
|
|
1714
1657
|
import { useCallback as useCallback14 } from "react";
|
|
1715
1658
|
var NO_ROWS = [];
|
|
1716
1659
|
var useTableContextMenu = ({
|
|
@@ -1728,7 +1671,7 @@ var useTableContextMenu = ({
|
|
|
1728
1671
|
if (cellEl && rowEl) {
|
|
1729
1672
|
const { selectedRowsCount } = dataSource;
|
|
1730
1673
|
const columnMap = buildColumnMap(columns);
|
|
1731
|
-
const rowIndex =
|
|
1674
|
+
const rowIndex = getIndexFromRowElement2(rowEl);
|
|
1732
1675
|
const cellIndex = Array.from(rowEl.childNodes).indexOf(cellEl);
|
|
1733
1676
|
const row = data.find(([idx]) => idx === rowIndex);
|
|
1734
1677
|
const columnName = columns[cellIndex];
|
|
@@ -2059,7 +2002,14 @@ function updateTableConfig2(state, { confirmed, filter, groupBy, sort }) {
|
|
|
2059
2002
|
}
|
|
2060
2003
|
|
|
2061
2004
|
// ../vuu-table/src/useTableScroll.ts
|
|
2062
|
-
import {
|
|
2005
|
+
import { getRowElementAtIndex } from "@vuu-ui/vuu-utils";
|
|
2006
|
+
import {
|
|
2007
|
+
useCallback as useCallback15,
|
|
2008
|
+
useEffect as useEffect3,
|
|
2009
|
+
useImperativeHandle,
|
|
2010
|
+
useMemo as useMemo4,
|
|
2011
|
+
useRef as useRef10
|
|
2012
|
+
} from "react";
|
|
2063
2013
|
var getPctScroll = (container) => {
|
|
2064
2014
|
const { scrollLeft, scrollTop } = container;
|
|
2065
2015
|
const { clientHeight, clientWidth, scrollHeight, scrollWidth } = container;
|
|
@@ -2067,6 +2017,31 @@ var getPctScroll = (container) => {
|
|
|
2067
2017
|
const pctScrollTop = scrollTop / (scrollHeight - clientHeight);
|
|
2068
2018
|
return [pctScrollLeft, pctScrollTop];
|
|
2069
2019
|
};
|
|
2020
|
+
var noScrolling = {
|
|
2021
|
+
scrollToIndex: () => void 0,
|
|
2022
|
+
scrollToKey: () => void 0
|
|
2023
|
+
};
|
|
2024
|
+
var NO_SCROLL_NECESSARY = [void 0, void 0];
|
|
2025
|
+
var howFarIsRowOutsideViewport = (rowEl, totalHeaderHeight, contentContainer = rowEl.closest(".vuuTable-contentContainer")) => {
|
|
2026
|
+
if (contentContainer) {
|
|
2027
|
+
const viewport = contentContainer == null ? void 0 : contentContainer.getBoundingClientRect();
|
|
2028
|
+
const upperBoundary = viewport.top + totalHeaderHeight;
|
|
2029
|
+
const row = rowEl.getBoundingClientRect();
|
|
2030
|
+
if (row) {
|
|
2031
|
+
if (row.bottom > viewport.bottom) {
|
|
2032
|
+
return ["down", row.bottom - viewport.bottom];
|
|
2033
|
+
} else if (row.top < upperBoundary) {
|
|
2034
|
+
return ["up", row.top - upperBoundary];
|
|
2035
|
+
} else {
|
|
2036
|
+
return NO_SCROLL_NECESSARY;
|
|
2037
|
+
}
|
|
2038
|
+
} else {
|
|
2039
|
+
throw Error("Whats going on, row not found");
|
|
2040
|
+
}
|
|
2041
|
+
} else {
|
|
2042
|
+
throw Error("Whats going on, scrollbar container not found");
|
|
2043
|
+
}
|
|
2044
|
+
};
|
|
2070
2045
|
var useCallbackRef = ({
|
|
2071
2046
|
onAttach,
|
|
2072
2047
|
onDetach
|
|
@@ -2088,17 +2063,37 @@ var useCallbackRef = ({
|
|
|
2088
2063
|
return callbackRef;
|
|
2089
2064
|
};
|
|
2090
2065
|
var useTableScroll = ({
|
|
2091
|
-
|
|
2092
|
-
maxScrollTop,
|
|
2066
|
+
getRowAtPosition,
|
|
2093
2067
|
onHorizontalScroll,
|
|
2094
2068
|
onVerticalScroll,
|
|
2095
|
-
|
|
2096
|
-
|
|
2069
|
+
scrollingApiRef,
|
|
2070
|
+
setRange,
|
|
2071
|
+
viewportMeasurements
|
|
2097
2072
|
}) => {
|
|
2073
|
+
const firstRowRef = useRef10(0);
|
|
2098
2074
|
const contentContainerScrolledRef = useRef10(false);
|
|
2099
2075
|
const scrollPosRef = useRef10({ scrollTop: 0, scrollLeft: 0 });
|
|
2100
2076
|
const scrollbarContainerRef = useRef10(null);
|
|
2101
2077
|
const contentContainerRef = useRef10(null);
|
|
2078
|
+
const {
|
|
2079
|
+
appliedPageSize,
|
|
2080
|
+
isVirtualScroll,
|
|
2081
|
+
maxScrollContainerScrollHorizontal: maxScrollLeft,
|
|
2082
|
+
maxScrollContainerScrollVertical: maxScrollTop,
|
|
2083
|
+
rowCount: viewportRowCount,
|
|
2084
|
+
totalHeaderHeight
|
|
2085
|
+
} = viewportMeasurements;
|
|
2086
|
+
const handleVerticalScroll = useCallback15(
|
|
2087
|
+
(scrollTop, pctScrollTop) => {
|
|
2088
|
+
onVerticalScroll == null ? void 0 : onVerticalScroll(scrollTop, pctScrollTop);
|
|
2089
|
+
const firstRow = getRowAtPosition(scrollTop);
|
|
2090
|
+
if (firstRow !== firstRowRef.current) {
|
|
2091
|
+
firstRowRef.current = firstRow;
|
|
2092
|
+
setRange({ from: firstRow, to: firstRow + viewportRowCount + 1 });
|
|
2093
|
+
}
|
|
2094
|
+
},
|
|
2095
|
+
[getRowAtPosition, onVerticalScroll, setRange, viewportRowCount]
|
|
2096
|
+
);
|
|
2102
2097
|
const handleScrollbarContainerScroll = useCallback15(() => {
|
|
2103
2098
|
const { current: contentContainer } = contentContainerRef;
|
|
2104
2099
|
const { current: scrollbarContainer } = scrollbarContainerRef;
|
|
@@ -2108,7 +2103,7 @@ var useTableScroll = ({
|
|
|
2108
2103
|
} else if (contentContainer && scrollbarContainer) {
|
|
2109
2104
|
const [pctScrollLeft, pctScrollTop] = getPctScroll(scrollbarContainer);
|
|
2110
2105
|
const rootScrollLeft = Math.round(pctScrollLeft * maxScrollLeft);
|
|
2111
|
-
const rootScrollTop =
|
|
2106
|
+
const rootScrollTop = pctScrollTop * maxScrollTop;
|
|
2112
2107
|
contentContainer.scrollTo({
|
|
2113
2108
|
left: rootScrollLeft,
|
|
2114
2109
|
top: rootScrollTop,
|
|
@@ -2125,17 +2120,17 @@ var useTableScroll = ({
|
|
|
2125
2120
|
const [pctScrollLeft, pctScrollTop] = getPctScroll(contentContainer);
|
|
2126
2121
|
contentContainerScrolledRef.current = true;
|
|
2127
2122
|
scrollbarContainer.scrollLeft = Math.round(pctScrollLeft * maxScrollLeft);
|
|
2128
|
-
scrollbarContainer.scrollTop =
|
|
2123
|
+
scrollbarContainer.scrollTop = pctScrollTop * maxScrollTop;
|
|
2129
2124
|
if (scrollPos.scrollTop !== scrollTop) {
|
|
2130
2125
|
scrollPos.scrollTop = scrollTop;
|
|
2131
|
-
|
|
2126
|
+
handleVerticalScroll(scrollTop, pctScrollTop);
|
|
2132
2127
|
}
|
|
2133
2128
|
if (scrollPos.scrollLeft !== scrollLeft) {
|
|
2134
2129
|
scrollPos.scrollLeft = scrollLeft;
|
|
2135
2130
|
onHorizontalScroll == null ? void 0 : onHorizontalScroll(scrollLeft);
|
|
2136
2131
|
}
|
|
2137
2132
|
}
|
|
2138
|
-
}, [maxScrollLeft, maxScrollTop, onHorizontalScroll
|
|
2133
|
+
}, [handleVerticalScroll, maxScrollLeft, maxScrollTop, onHorizontalScroll]);
|
|
2139
2134
|
const handleAttachScrollbarContainer = useCallback15(
|
|
2140
2135
|
(el) => {
|
|
2141
2136
|
scrollbarContainerRef.current = el;
|
|
@@ -2182,37 +2177,60 @@ var useTableScroll = ({
|
|
|
2182
2177
|
if (scrollbarContainer) {
|
|
2183
2178
|
const { scrollLeft, scrollTop } = scrollbarContainer;
|
|
2184
2179
|
contentContainerScrolledRef.current = false;
|
|
2185
|
-
if (scrollRequest.type === "scroll-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
newScrollLeft = Math.min(
|
|
2195
|
-
Math.max(0, scrollLeft + scrollRequest.distance),
|
|
2196
|
-
maxScrollLeft
|
|
2180
|
+
if (scrollRequest.type === "scroll-row") {
|
|
2181
|
+
const activeRow = getRowElementAtIndex(
|
|
2182
|
+
scrollbarContainer,
|
|
2183
|
+
scrollRequest.rowIndex
|
|
2184
|
+
);
|
|
2185
|
+
if (activeRow !== null) {
|
|
2186
|
+
const [direction, distance] = howFarIsRowOutsideViewport(
|
|
2187
|
+
activeRow,
|
|
2188
|
+
totalHeaderHeight
|
|
2197
2189
|
);
|
|
2190
|
+
if (direction && distance) {
|
|
2191
|
+
if (isVirtualScroll) {
|
|
2192
|
+
console.log(
|
|
2193
|
+
`virtual scroll row required ${direction} ${distance}
|
|
2194
|
+
first Row ${firstRowRef.current}`
|
|
2195
|
+
);
|
|
2196
|
+
} else {
|
|
2197
|
+
let newScrollLeft = scrollLeft;
|
|
2198
|
+
let newScrollTop = scrollTop;
|
|
2199
|
+
if (direction === "up" || direction === "down") {
|
|
2200
|
+
newScrollTop = Math.min(
|
|
2201
|
+
Math.max(0, scrollTop + distance),
|
|
2202
|
+
maxScrollTop
|
|
2203
|
+
);
|
|
2204
|
+
} else {
|
|
2205
|
+
newScrollLeft = Math.min(
|
|
2206
|
+
Math.max(0, scrollLeft + distance),
|
|
2207
|
+
maxScrollLeft
|
|
2208
|
+
);
|
|
2209
|
+
}
|
|
2210
|
+
scrollbarContainer.scrollTo({
|
|
2211
|
+
top: newScrollTop,
|
|
2212
|
+
left: newScrollLeft,
|
|
2213
|
+
behavior: "smooth"
|
|
2214
|
+
});
|
|
2215
|
+
}
|
|
2216
|
+
}
|
|
2198
2217
|
}
|
|
2199
|
-
scrollbarContainer.scrollTo({
|
|
2200
|
-
top: newScrollTop,
|
|
2201
|
-
left: newScrollLeft,
|
|
2202
|
-
behavior: "smooth"
|
|
2203
|
-
});
|
|
2204
2218
|
} else if (scrollRequest.type === "scroll-page") {
|
|
2205
2219
|
const { direction } = scrollRequest;
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2220
|
+
if (isVirtualScroll) {
|
|
2221
|
+
console.log(`need a virtual page scroll`);
|
|
2222
|
+
} else {
|
|
2223
|
+
const scrollBy = direction === "down" ? appliedPageSize : -appliedPageSize;
|
|
2224
|
+
const newScrollTop = Math.min(
|
|
2225
|
+
Math.max(0, scrollTop + scrollBy),
|
|
2226
|
+
maxScrollTop
|
|
2227
|
+
);
|
|
2228
|
+
scrollbarContainer.scrollTo({
|
|
2229
|
+
top: newScrollTop,
|
|
2230
|
+
left: scrollLeft,
|
|
2231
|
+
behavior: "auto"
|
|
2232
|
+
});
|
|
2233
|
+
}
|
|
2216
2234
|
} else if (scrollRequest.type === "scroll-end") {
|
|
2217
2235
|
const { direction } = scrollRequest;
|
|
2218
2236
|
const scrollTo = direction === "end" ? maxScrollTop : 0;
|
|
@@ -2224,8 +2242,46 @@ var useTableScroll = ({
|
|
|
2224
2242
|
}
|
|
2225
2243
|
}
|
|
2226
2244
|
},
|
|
2227
|
-
[
|
|
2245
|
+
[
|
|
2246
|
+
appliedPageSize,
|
|
2247
|
+
isVirtualScroll,
|
|
2248
|
+
maxScrollLeft,
|
|
2249
|
+
maxScrollTop,
|
|
2250
|
+
setRange,
|
|
2251
|
+
totalHeaderHeight,
|
|
2252
|
+
viewportRowCount
|
|
2253
|
+
]
|
|
2254
|
+
);
|
|
2255
|
+
const scrollHandles = useMemo4(
|
|
2256
|
+
() => ({
|
|
2257
|
+
scrollToIndex: (rowIndex) => {
|
|
2258
|
+
if (scrollbarContainerRef.current) {
|
|
2259
|
+
const scrollPos = (rowIndex - 30) * 20;
|
|
2260
|
+
scrollbarContainerRef.current.scrollTop = scrollPos;
|
|
2261
|
+
}
|
|
2262
|
+
},
|
|
2263
|
+
scrollToKey: (rowKey) => {
|
|
2264
|
+
console.log(`scrollToKey ${rowKey}`);
|
|
2265
|
+
}
|
|
2266
|
+
}),
|
|
2267
|
+
[]
|
|
2268
|
+
);
|
|
2269
|
+
useImperativeHandle(
|
|
2270
|
+
scrollingApiRef,
|
|
2271
|
+
() => {
|
|
2272
|
+
if (scrollbarContainerRef.current) {
|
|
2273
|
+
return scrollHandles;
|
|
2274
|
+
} else {
|
|
2275
|
+
return noScrolling;
|
|
2276
|
+
}
|
|
2277
|
+
},
|
|
2278
|
+
[scrollHandles]
|
|
2228
2279
|
);
|
|
2280
|
+
useEffect3(() => {
|
|
2281
|
+
const { current: from } = firstRowRef;
|
|
2282
|
+
const rowRange = { from, to: from + viewportRowCount + 1 };
|
|
2283
|
+
setRange(rowRange);
|
|
2284
|
+
}, [setRange, viewportRowCount]);
|
|
2229
2285
|
return {
|
|
2230
2286
|
/** Ref to be assigned to ScrollbarContainer */
|
|
2231
2287
|
scrollbarContainerRef: scrollbarContainerCallbackRef,
|
|
@@ -2237,18 +2293,20 @@ var useTableScroll = ({
|
|
|
2237
2293
|
};
|
|
2238
2294
|
|
|
2239
2295
|
// ../vuu-table/src/useTableViewport.ts
|
|
2240
|
-
import { useCallback as useCallback16, useMemo as
|
|
2296
|
+
import { useCallback as useCallback16, useMemo as useMemo5, useRef as useRef11 } from "react";
|
|
2241
2297
|
import {
|
|
2242
2298
|
actualRowPositioning,
|
|
2243
2299
|
virtualRowPositioning
|
|
2244
2300
|
} from "@vuu-ui/vuu-utils";
|
|
2245
|
-
var MAX_RAW_ROWS =
|
|
2301
|
+
var MAX_RAW_ROWS = 1e5;
|
|
2246
2302
|
var UNMEASURED_VIEWPORT = {
|
|
2303
|
+
appliedPageSize: 0,
|
|
2247
2304
|
contentHeight: 0,
|
|
2248
2305
|
contentWidth: 0,
|
|
2249
2306
|
getRowAtPosition: () => -1,
|
|
2250
2307
|
getRowOffset: () => -1,
|
|
2251
2308
|
horizontalScrollbarHeight: 0,
|
|
2309
|
+
isVirtualScroll: false,
|
|
2252
2310
|
maxScrollContainerScrollHorizontal: 0,
|
|
2253
2311
|
maxScrollContainerScrollVertical: 0,
|
|
2254
2312
|
pinnedWidthLeft: 0,
|
|
@@ -2289,19 +2347,18 @@ var useTableViewport = ({
|
|
|
2289
2347
|
size
|
|
2290
2348
|
}) => {
|
|
2291
2349
|
const pctScrollTopRef = useRef11(0);
|
|
2292
|
-
const
|
|
2293
|
-
const appliedContentHeight = appliedRowCount * rowHeight;
|
|
2350
|
+
const pixelContentHeight = rowHeight * Math.min(rowCount, MAX_RAW_ROWS);
|
|
2294
2351
|
const virtualContentHeight = rowCount * rowHeight;
|
|
2295
|
-
const virtualisedExtent = virtualContentHeight -
|
|
2296
|
-
const { pinnedWidthLeft, pinnedWidthRight, unpinnedWidth } =
|
|
2352
|
+
const virtualisedExtent = virtualContentHeight - pixelContentHeight;
|
|
2353
|
+
const { pinnedWidthLeft, pinnedWidthRight, unpinnedWidth } = useMemo5(
|
|
2297
2354
|
() => measurePinnedColumns(columns),
|
|
2298
2355
|
[columns]
|
|
2299
2356
|
);
|
|
2300
|
-
const
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
);
|
|
2304
|
-
const [getRowOffset, getRowAtPosition] =
|
|
2357
|
+
const totalHeaderHeightRef = useRef11(headerHeight);
|
|
2358
|
+
useMemo5(() => {
|
|
2359
|
+
totalHeaderHeightRef.current = headerHeight * (1 + headings.length);
|
|
2360
|
+
}, [headerHeight, headings.length]);
|
|
2361
|
+
const [getRowOffset, getRowAtPosition, isVirtualScroll] = useMemo5(() => {
|
|
2305
2362
|
if (virtualisedExtent) {
|
|
2306
2363
|
return virtualRowPositioning(
|
|
2307
2364
|
rowHeight,
|
|
@@ -2309,37 +2366,39 @@ var useTableViewport = ({
|
|
|
2309
2366
|
pctScrollTopRef
|
|
2310
2367
|
);
|
|
2311
2368
|
} else {
|
|
2312
|
-
return
|
|
2369
|
+
return actualRowPositioning(rowHeight);
|
|
2313
2370
|
}
|
|
2314
|
-
}, [
|
|
2371
|
+
}, [virtualisedExtent, rowHeight]);
|
|
2315
2372
|
const setPctScrollTop = useCallback16((scrollPct) => {
|
|
2316
2373
|
pctScrollTopRef.current = scrollPct;
|
|
2317
2374
|
}, []);
|
|
2318
|
-
return
|
|
2375
|
+
return useMemo5(() => {
|
|
2319
2376
|
var _a;
|
|
2320
2377
|
if (size) {
|
|
2321
|
-
const
|
|
2378
|
+
const { current: totalHeaderHeight } = totalHeaderHeightRef;
|
|
2322
2379
|
const scrollbarSize = 15;
|
|
2323
2380
|
const contentWidth = pinnedWidthLeft + unpinnedWidth + pinnedWidthRight;
|
|
2324
2381
|
const horizontalScrollbarHeight = contentWidth > size.width ? scrollbarSize : 0;
|
|
2325
|
-
const
|
|
2326
|
-
const maxScrollContainerScrollVertical = appliedContentHeight - (((_a = size == null ? void 0 : size.height) != null ? _a : 0) - horizontalScrollbarHeight) + totalHeaderHeight;
|
|
2382
|
+
const maxScrollContainerScrollVertical = pixelContentHeight - (((_a = size == null ? void 0 : size.height) != null ? _a : 0) - horizontalScrollbarHeight) + totalHeaderHeight;
|
|
2327
2383
|
const maxScrollContainerScrollHorizontal = contentWidth - size.width + pinnedWidthLeft;
|
|
2328
2384
|
const visibleRows = (size.height - headerHeight) / rowHeight;
|
|
2329
|
-
const count = Number.isInteger(visibleRows) ? visibleRows
|
|
2385
|
+
const count = Number.isInteger(visibleRows) ? visibleRows : Math.ceil(visibleRows);
|
|
2330
2386
|
const viewportBodyHeight = size.height - totalHeaderHeight;
|
|
2331
|
-
const verticalScrollbarWidth =
|
|
2387
|
+
const verticalScrollbarWidth = pixelContentHeight > viewportBodyHeight ? scrollbarSize : 0;
|
|
2388
|
+
const appliedPageSize = count * rowHeight * (pixelContentHeight / virtualContentHeight);
|
|
2332
2389
|
return {
|
|
2333
|
-
|
|
2390
|
+
appliedPageSize,
|
|
2391
|
+
contentHeight: pixelContentHeight,
|
|
2392
|
+
contentWidth,
|
|
2334
2393
|
getRowAtPosition,
|
|
2335
2394
|
getRowOffset,
|
|
2395
|
+
isVirtualScroll,
|
|
2336
2396
|
horizontalScrollbarHeight,
|
|
2337
2397
|
maxScrollContainerScrollHorizontal,
|
|
2338
2398
|
maxScrollContainerScrollVertical,
|
|
2339
2399
|
pinnedWidthLeft,
|
|
2340
2400
|
pinnedWidthRight,
|
|
2341
2401
|
rowCount: count,
|
|
2342
|
-
contentWidth,
|
|
2343
2402
|
setPctScrollTop,
|
|
2344
2403
|
totalHeaderHeight,
|
|
2345
2404
|
verticalScrollbarWidth,
|
|
@@ -2349,53 +2408,25 @@ var useTableViewport = ({
|
|
|
2349
2408
|
return UNMEASURED_VIEWPORT;
|
|
2350
2409
|
}
|
|
2351
2410
|
}, [
|
|
2352
|
-
|
|
2353
|
-
|
|
2411
|
+
getRowAtPosition,
|
|
2412
|
+
getRowOffset,
|
|
2413
|
+
headerHeight,
|
|
2414
|
+
isVirtualScroll,
|
|
2354
2415
|
pinnedWidthLeft,
|
|
2355
2416
|
unpinnedWidth,
|
|
2356
2417
|
pinnedWidthRight,
|
|
2357
|
-
|
|
2358
|
-
headerHeight,
|
|
2418
|
+
pixelContentHeight,
|
|
2359
2419
|
rowHeight,
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2420
|
+
setPctScrollTop,
|
|
2421
|
+
size,
|
|
2422
|
+
virtualContentHeight
|
|
2363
2423
|
]);
|
|
2364
2424
|
};
|
|
2365
2425
|
|
|
2366
|
-
// ../vuu-table/src/useVirtualViewport.ts
|
|
2367
|
-
import { useCallback as useCallback17, useEffect as useEffect3, useRef as useRef12 } from "react";
|
|
2368
|
-
var useVirtualViewport = ({
|
|
2369
|
-
getRowAtPosition,
|
|
2370
|
-
setRange,
|
|
2371
|
-
viewportMeasurements
|
|
2372
|
-
}) => {
|
|
2373
|
-
const firstRowRef = useRef12(0);
|
|
2374
|
-
const { rowCount: viewportRowCount } = viewportMeasurements;
|
|
2375
|
-
const handleVerticalScroll = useCallback17(
|
|
2376
|
-
(scrollTop) => {
|
|
2377
|
-
const firstRow = getRowAtPosition(scrollTop);
|
|
2378
|
-
if (firstRow !== firstRowRef.current) {
|
|
2379
|
-
firstRowRef.current = firstRow;
|
|
2380
|
-
setRange({ from: firstRow, to: firstRow + viewportRowCount });
|
|
2381
|
-
}
|
|
2382
|
-
},
|
|
2383
|
-
[getRowAtPosition, setRange, viewportRowCount]
|
|
2384
|
-
);
|
|
2385
|
-
useEffect3(() => {
|
|
2386
|
-
const { current: from } = firstRowRef;
|
|
2387
|
-
const rowRange = { from, to: from + viewportRowCount };
|
|
2388
|
-
setRange(rowRange);
|
|
2389
|
-
}, [setRange, viewportRowCount]);
|
|
2390
|
-
return {
|
|
2391
|
-
onVerticalScroll: handleVerticalScroll
|
|
2392
|
-
};
|
|
2393
|
-
};
|
|
2394
|
-
|
|
2395
2426
|
// ../vuu-table/src/useTableAndColumnSettings.ts
|
|
2396
2427
|
import { useLayoutProviderDispatch } from "@vuu-ui/vuu-layout";
|
|
2397
2428
|
import { getCalculatedColumnType } from "@vuu-ui/vuu-utils";
|
|
2398
|
-
import { useCallback as
|
|
2429
|
+
import { useCallback as useCallback17, useRef as useRef12, useState as useState5 } from "react";
|
|
2399
2430
|
var useTableAndColumnSettings = ({
|
|
2400
2431
|
availableColumns: availableColumnsProps,
|
|
2401
2432
|
onAvailableColumnsChange,
|
|
@@ -2405,11 +2436,11 @@ var useTableAndColumnSettings = ({
|
|
|
2405
2436
|
tableConfig
|
|
2406
2437
|
}) => {
|
|
2407
2438
|
const dispatchLayoutAction = useLayoutProviderDispatch();
|
|
2408
|
-
const showTableSettingsRef =
|
|
2439
|
+
const showTableSettingsRef = useRef12();
|
|
2409
2440
|
const [availableColumns, setAvailableColumns] = useState5(
|
|
2410
2441
|
availableColumnsProps
|
|
2411
2442
|
);
|
|
2412
|
-
const showContextPanel =
|
|
2443
|
+
const showContextPanel = useCallback17(
|
|
2413
2444
|
(componentType, title, props) => {
|
|
2414
2445
|
dispatchLayoutAction({
|
|
2415
2446
|
type: "set-props",
|
|
@@ -2426,13 +2457,13 @@ var useTableAndColumnSettings = ({
|
|
|
2426
2457
|
},
|
|
2427
2458
|
[dispatchLayoutAction]
|
|
2428
2459
|
);
|
|
2429
|
-
const handleCancelCreateColumn =
|
|
2460
|
+
const handleCancelCreateColumn = useCallback17(() => {
|
|
2430
2461
|
requestAnimationFrame(() => {
|
|
2431
2462
|
var _a;
|
|
2432
2463
|
(_a = showTableSettingsRef.current) == null ? void 0 : _a.call(showTableSettingsRef);
|
|
2433
2464
|
});
|
|
2434
2465
|
}, []);
|
|
2435
|
-
const handleCreateCalculatedColumn =
|
|
2466
|
+
const handleCreateCalculatedColumn = useCallback17(
|
|
2436
2467
|
(column) => {
|
|
2437
2468
|
const newAvailableColumns = availableColumns.concat({
|
|
2438
2469
|
name: column.name,
|
|
@@ -2448,7 +2479,7 @@ var useTableAndColumnSettings = ({
|
|
|
2448
2479
|
},
|
|
2449
2480
|
[availableColumns, onAvailableColumnsChange, onCreateCalculatedColumn]
|
|
2450
2481
|
);
|
|
2451
|
-
const showColumnSettingsPanel =
|
|
2482
|
+
const showColumnSettingsPanel = useCallback17(
|
|
2452
2483
|
(action) => {
|
|
2453
2484
|
showContextPanel("ColumnSettings", "Column Settings", {
|
|
2454
2485
|
column: action.column,
|
|
@@ -2467,7 +2498,7 @@ var useTableAndColumnSettings = ({
|
|
|
2467
2498
|
tableConfig
|
|
2468
2499
|
]
|
|
2469
2500
|
);
|
|
2470
|
-
const handleAddCalculatedColumn =
|
|
2501
|
+
const handleAddCalculatedColumn = useCallback17(() => {
|
|
2471
2502
|
showColumnSettingsPanel({
|
|
2472
2503
|
column: {
|
|
2473
2504
|
name: "::",
|
|
@@ -2477,7 +2508,7 @@ var useTableAndColumnSettings = ({
|
|
|
2477
2508
|
vuuTable: { module: "SIMUL", table: "instruments" }
|
|
2478
2509
|
});
|
|
2479
2510
|
}, [showColumnSettingsPanel]);
|
|
2480
|
-
const handleNavigateToColumn =
|
|
2511
|
+
const handleNavigateToColumn = useCallback17(
|
|
2481
2512
|
(columnName) => {
|
|
2482
2513
|
const column = tableConfig.columns.find((c) => c.name === columnName);
|
|
2483
2514
|
if (column) {
|
|
@@ -2491,7 +2522,7 @@ var useTableAndColumnSettings = ({
|
|
|
2491
2522
|
},
|
|
2492
2523
|
[showColumnSettingsPanel, tableConfig.columns]
|
|
2493
2524
|
);
|
|
2494
|
-
showTableSettingsRef.current =
|
|
2525
|
+
showTableSettingsRef.current = useCallback17(() => {
|
|
2495
2526
|
showContextPanel("TableSettings", "DataGrid Settings", {
|
|
2496
2527
|
availableColumns: availableColumns != null ? availableColumns : tableConfig.columns.map(({ name: name2, serverDataType }) => ({
|
|
2497
2528
|
name: name2,
|
|
@@ -2554,6 +2585,7 @@ var useTable = ({
|
|
|
2554
2585
|
onSelectionChange,
|
|
2555
2586
|
renderBufferSize = 0,
|
|
2556
2587
|
rowHeight = 20,
|
|
2588
|
+
scrollingApiRef,
|
|
2557
2589
|
selectionModel,
|
|
2558
2590
|
size
|
|
2559
2591
|
}) => {
|
|
@@ -2562,11 +2594,11 @@ var useTable = ({
|
|
|
2562
2594
|
throw Error("no data source provided to Vuu Table");
|
|
2563
2595
|
}
|
|
2564
2596
|
const useRowDragDrop = allowDragDrop ? useDragDrop : useNullDragDrop;
|
|
2565
|
-
const menuBuilder =
|
|
2597
|
+
const menuBuilder = useMemo6(
|
|
2566
2598
|
() => buildContextMenuDescriptors(dataSource),
|
|
2567
2599
|
[dataSource]
|
|
2568
2600
|
);
|
|
2569
|
-
const onDataRowcountChange =
|
|
2601
|
+
const onDataRowcountChange = useCallback18((size2) => {
|
|
2570
2602
|
setRowCount(size2);
|
|
2571
2603
|
}, []);
|
|
2572
2604
|
const {
|
|
@@ -2583,7 +2615,7 @@ var useTable = ({
|
|
|
2583
2615
|
tableConfig
|
|
2584
2616
|
});
|
|
2585
2617
|
}, [tableConfig, dataSource, dispatchColumnAction]);
|
|
2586
|
-
const applyTableConfigChange =
|
|
2618
|
+
const applyTableConfigChange = useCallback18(
|
|
2587
2619
|
(config2) => {
|
|
2588
2620
|
dispatchColumnAction({
|
|
2589
2621
|
type: "init",
|
|
@@ -2595,14 +2627,14 @@ var useTable = ({
|
|
|
2595
2627
|
[dataSource, dispatchColumnAction, onConfigChange]
|
|
2596
2628
|
);
|
|
2597
2629
|
const [stateColumns, setStateColumns] = useState6();
|
|
2598
|
-
const [columns, setColumnSize] =
|
|
2630
|
+
const [columns, setColumnSize] = useMemo6(() => {
|
|
2599
2631
|
const setSize = (columnName, width) => {
|
|
2600
2632
|
const cols = updateColumn(runtimeColumns, columnName, { width });
|
|
2601
2633
|
setStateColumns(cols);
|
|
2602
2634
|
};
|
|
2603
2635
|
return [stateColumns != null ? stateColumns : runtimeColumns, setSize];
|
|
2604
2636
|
}, [runtimeColumns, stateColumns]);
|
|
2605
|
-
const columnMap =
|
|
2637
|
+
const columnMap = useMemo6(
|
|
2606
2638
|
() => buildColumnMap2(dataSource.columns),
|
|
2607
2639
|
[dataSource.columns]
|
|
2608
2640
|
);
|
|
@@ -2621,9 +2653,9 @@ var useTable = ({
|
|
|
2621
2653
|
});
|
|
2622
2654
|
const initialRange = useInitialValue({
|
|
2623
2655
|
from: 0,
|
|
2624
|
-
to: viewportMeasurements.rowCount
|
|
2656
|
+
to: viewportMeasurements.rowCount === 0 ? 0 : viewportMeasurements.rowCount + 1
|
|
2625
2657
|
});
|
|
2626
|
-
const onSubscribed =
|
|
2658
|
+
const onSubscribed = useCallback18(
|
|
2627
2659
|
({ tableSchema }) => {
|
|
2628
2660
|
if (tableSchema) {
|
|
2629
2661
|
dispatchColumnAction({
|
|
@@ -2645,9 +2677,8 @@ var useTable = ({
|
|
|
2645
2677
|
onSubscribed,
|
|
2646
2678
|
range: initialRange
|
|
2647
2679
|
});
|
|
2648
|
-
const handleConfigEditedInSettingsPanel =
|
|
2680
|
+
const handleConfigEditedInSettingsPanel = useCallback18(
|
|
2649
2681
|
(tableConfig2) => {
|
|
2650
|
-
console.log(`settings changed`);
|
|
2651
2682
|
dispatchColumnAction({
|
|
2652
2683
|
type: "init",
|
|
2653
2684
|
tableConfig: tableConfig2,
|
|
@@ -2657,7 +2688,7 @@ var useTable = ({
|
|
|
2657
2688
|
},
|
|
2658
2689
|
[dataSource, dispatchColumnAction, onConfigChange]
|
|
2659
2690
|
);
|
|
2660
|
-
const handleDataSourceConfigChanged =
|
|
2691
|
+
const handleDataSourceConfigChanged = useCallback18(
|
|
2661
2692
|
(dataSourceConfig) => {
|
|
2662
2693
|
dataSource.config = {
|
|
2663
2694
|
...dataSource.config,
|
|
@@ -2675,14 +2706,14 @@ var useTable = ({
|
|
|
2675
2706
|
});
|
|
2676
2707
|
});
|
|
2677
2708
|
}, [dataSource, dispatchColumnAction]);
|
|
2678
|
-
const handleCreateCalculatedColumn =
|
|
2709
|
+
const handleCreateCalculatedColumn = useCallback18(
|
|
2679
2710
|
(column) => {
|
|
2680
2711
|
dataSource.columns = dataSource.columns.concat(column.name);
|
|
2681
2712
|
applyTableConfigChange(addColumn(tableConfig, column));
|
|
2682
2713
|
},
|
|
2683
2714
|
[dataSource, tableConfig, applyTableConfigChange]
|
|
2684
2715
|
);
|
|
2685
|
-
const hideColumns2 =
|
|
2716
|
+
const hideColumns2 = useCallback18(
|
|
2686
2717
|
(action) => {
|
|
2687
2718
|
const { columns: columns2 } = action;
|
|
2688
2719
|
const hiddenColumns = columns2.map((c) => c.name);
|
|
@@ -2696,7 +2727,7 @@ var useTable = ({
|
|
|
2696
2727
|
},
|
|
2697
2728
|
[tableConfig, applyTableConfigChange]
|
|
2698
2729
|
);
|
|
2699
|
-
const pinColumn3 =
|
|
2730
|
+
const pinColumn3 = useCallback18(
|
|
2700
2731
|
(action) => {
|
|
2701
2732
|
applyTableConfigChange({
|
|
2702
2733
|
...tableConfig,
|
|
@@ -2719,7 +2750,7 @@ var useTable = ({
|
|
|
2719
2750
|
onDataSourceConfigChange: handleDataSourceConfigChanged,
|
|
2720
2751
|
tableConfig
|
|
2721
2752
|
});
|
|
2722
|
-
const onPersistentColumnOperation =
|
|
2753
|
+
const onPersistentColumnOperation = useCallback18(
|
|
2723
2754
|
(action) => {
|
|
2724
2755
|
if (isShowColumnSettings(action)) {
|
|
2725
2756
|
showColumnSettingsPanel(action);
|
|
@@ -2748,7 +2779,7 @@ var useTable = ({
|
|
|
2748
2779
|
dataSource,
|
|
2749
2780
|
onPersistentColumnOperation
|
|
2750
2781
|
});
|
|
2751
|
-
const handleSort =
|
|
2782
|
+
const handleSort = useCallback18(
|
|
2752
2783
|
(column, extendSort = false, sortType) => {
|
|
2753
2784
|
if (dataSource) {
|
|
2754
2785
|
dataSource.sort = applySort(
|
|
@@ -2761,7 +2792,7 @@ var useTable = ({
|
|
|
2761
2792
|
},
|
|
2762
2793
|
[dataSource]
|
|
2763
2794
|
);
|
|
2764
|
-
const onResizeColumn =
|
|
2795
|
+
const onResizeColumn = useCallback18(
|
|
2765
2796
|
(phase, columnName, width) => {
|
|
2766
2797
|
const column = columns.find((column2) => column2.name === columnName);
|
|
2767
2798
|
if (column) {
|
|
@@ -2805,7 +2836,7 @@ var useTable = ({
|
|
|
2805
2836
|
},
|
|
2806
2837
|
[columns, tableConfig, dispatchColumnAction, onConfigChange, setColumnSize]
|
|
2807
2838
|
);
|
|
2808
|
-
const onToggleGroup =
|
|
2839
|
+
const onToggleGroup = useCallback18(
|
|
2809
2840
|
(row, column) => {
|
|
2810
2841
|
var _a, _b;
|
|
2811
2842
|
const isJson = isJsonGroup2(column, row);
|
|
@@ -2842,24 +2873,19 @@ var useTable = ({
|
|
|
2842
2873
|
},
|
|
2843
2874
|
[columns, dataSource, dispatchColumnAction]
|
|
2844
2875
|
);
|
|
2845
|
-
const
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
setRange,
|
|
2849
|
-
viewportMeasurements
|
|
2850
|
-
});
|
|
2851
|
-
const handleVerticalScroll = useCallback19(
|
|
2852
|
-
(scrollTop) => {
|
|
2853
|
-
onVerticalScroll(scrollTop);
|
|
2876
|
+
const handleVerticalScroll = useCallback18(
|
|
2877
|
+
(_, pctScrollTop) => {
|
|
2878
|
+
setPctScrollTop(pctScrollTop);
|
|
2854
2879
|
},
|
|
2855
|
-
[
|
|
2880
|
+
[setPctScrollTop]
|
|
2856
2881
|
);
|
|
2857
2882
|
const { requestScroll, ...scrollProps } = useTableScroll({
|
|
2858
|
-
|
|
2859
|
-
maxScrollTop: viewportMeasurements.maxScrollContainerScrollVertical,
|
|
2883
|
+
getRowAtPosition,
|
|
2860
2884
|
rowHeight,
|
|
2885
|
+
scrollingApiRef,
|
|
2886
|
+
setRange,
|
|
2861
2887
|
onVerticalScroll: handleVerticalScroll,
|
|
2862
|
-
|
|
2888
|
+
viewportMeasurements
|
|
2863
2889
|
});
|
|
2864
2890
|
const {
|
|
2865
2891
|
highlightedIndexRef,
|
|
@@ -2887,7 +2913,7 @@ var useTable = ({
|
|
|
2887
2913
|
} = useCellEditing({
|
|
2888
2914
|
navigate
|
|
2889
2915
|
});
|
|
2890
|
-
const handleFocus =
|
|
2916
|
+
const handleFocus = useCallback18(
|
|
2891
2917
|
(e) => {
|
|
2892
2918
|
navigationFocus();
|
|
2893
2919
|
if (!e.defaultPrevented) {
|
|
@@ -2902,13 +2928,13 @@ var useTable = ({
|
|
|
2902
2928
|
dataSource,
|
|
2903
2929
|
getSelectedRows
|
|
2904
2930
|
});
|
|
2905
|
-
const onMoveGroupColumn =
|
|
2931
|
+
const onMoveGroupColumn = useCallback18(
|
|
2906
2932
|
(columns2) => {
|
|
2907
2933
|
dataSource.groupBy = columns2.map((col) => col.name);
|
|
2908
2934
|
},
|
|
2909
2935
|
[dataSource]
|
|
2910
2936
|
);
|
|
2911
|
-
const onRemoveGroupColumn =
|
|
2937
|
+
const onRemoveGroupColumn = useCallback18(
|
|
2912
2938
|
(column) => {
|
|
2913
2939
|
if (isGroupColumn3(column)) {
|
|
2914
2940
|
dataSource.groupBy = [];
|
|
@@ -2922,7 +2948,7 @@ var useTable = ({
|
|
|
2922
2948
|
},
|
|
2923
2949
|
[dataSource]
|
|
2924
2950
|
);
|
|
2925
|
-
const handleSelectionChange =
|
|
2951
|
+
const handleSelectionChange = useCallback18(
|
|
2926
2952
|
(selected) => {
|
|
2927
2953
|
dataSource.select(selected);
|
|
2928
2954
|
onSelectionChange == null ? void 0 : onSelectionChange(selected);
|
|
@@ -2938,7 +2964,7 @@ var useTable = ({
|
|
|
2938
2964
|
onSelectionChange: handleSelectionChange,
|
|
2939
2965
|
selectionModel
|
|
2940
2966
|
});
|
|
2941
|
-
const handleKeyDown =
|
|
2967
|
+
const handleKeyDown = useCallback18(
|
|
2942
2968
|
(e) => {
|
|
2943
2969
|
navigationKeyDown(e);
|
|
2944
2970
|
if (!e.defaultPrevented) {
|
|
@@ -2950,7 +2976,7 @@ var useTable = ({
|
|
|
2950
2976
|
},
|
|
2951
2977
|
[navigationKeyDown, editingKeyDown, selectionHookKeyDown]
|
|
2952
2978
|
);
|
|
2953
|
-
const handleRowClick =
|
|
2979
|
+
const handleRowClick = useCallback18(
|
|
2954
2980
|
(row, rangeSelect, keepExistingSelection) => {
|
|
2955
2981
|
selectionHookOnRowClick(row, rangeSelect, keepExistingSelection);
|
|
2956
2982
|
onRowClickProp == null ? void 0 : onRowClickProp(row);
|
|
@@ -2964,7 +2990,7 @@ var useTable = ({
|
|
|
2964
2990
|
dataSource
|
|
2965
2991
|
});
|
|
2966
2992
|
}, [config, dataSource, dispatchColumnAction]);
|
|
2967
|
-
const onMoveColumn =
|
|
2993
|
+
const onMoveColumn = useCallback18(
|
|
2968
2994
|
(columns2) => {
|
|
2969
2995
|
console.log(`useTable onMoveColumn`, {
|
|
2970
2996
|
columns: columns2
|
|
@@ -2982,20 +3008,20 @@ var useTable = ({
|
|
|
2982
3008
|
},
|
|
2983
3009
|
[dataSource, dispatchColumnAction, onConfigChange, tableConfig]
|
|
2984
3010
|
);
|
|
2985
|
-
const handleDropRow =
|
|
3011
|
+
const handleDropRow = useCallback18(
|
|
2986
3012
|
(dragDropState) => {
|
|
2987
3013
|
onDrop == null ? void 0 : onDrop(dragDropState);
|
|
2988
3014
|
},
|
|
2989
3015
|
[onDrop]
|
|
2990
3016
|
);
|
|
2991
|
-
const handleDataEdited =
|
|
3017
|
+
const handleDataEdited = useCallback18(
|
|
2992
3018
|
async (row, columnName, value) => dataSource.applyEdit(row, columnName, value),
|
|
2993
3019
|
[dataSource]
|
|
2994
3020
|
);
|
|
2995
|
-
const handleDragStartRow =
|
|
3021
|
+
const handleDragStartRow = useCallback18(
|
|
2996
3022
|
(dragDropState) => {
|
|
2997
3023
|
const { initialDragElement } = dragDropState;
|
|
2998
|
-
const rowIndex =
|
|
3024
|
+
const rowIndex = getIndexFromRowElement3(initialDragElement);
|
|
2999
3025
|
const row = dataRef.current.find((row2) => row2[0] === rowIndex);
|
|
3000
3026
|
if (row) {
|
|
3001
3027
|
dragDropState.setPayload(row);
|
|
@@ -3027,6 +3053,7 @@ var useTable = ({
|
|
|
3027
3053
|
columnMap,
|
|
3028
3054
|
columns,
|
|
3029
3055
|
data,
|
|
3056
|
+
getRowOffset,
|
|
3030
3057
|
handleContextMenuAction,
|
|
3031
3058
|
headings,
|
|
3032
3059
|
highlightedIndex: highlightedIndexRef.current,
|
|
@@ -3053,17 +3080,17 @@ import { isGroupColumn as isGroupColumn4, isNotHidden as isNotHidden2 } from "@v
|
|
|
3053
3080
|
import cx8 from "clsx";
|
|
3054
3081
|
|
|
3055
3082
|
// ../vuu-table/src/table-header/useTableHeader.ts
|
|
3056
|
-
import {
|
|
3083
|
+
import { useDragDrop as useDragDrop2 } from "@vuu-ui/vuu-ui-controls";
|
|
3057
3084
|
import { moveColumnTo, visibleColumnAtIndex } from "@vuu-ui/vuu-utils";
|
|
3058
|
-
import { useCallback as
|
|
3085
|
+
import { useCallback as useCallback19, useRef as useRef13 } from "react";
|
|
3059
3086
|
var useTableHeader = ({
|
|
3060
3087
|
columns,
|
|
3061
3088
|
onMoveColumn,
|
|
3062
3089
|
onSortColumn,
|
|
3063
3090
|
tableConfig
|
|
3064
3091
|
}) => {
|
|
3065
|
-
const containerRef =
|
|
3066
|
-
const handleDropColumnHeader =
|
|
3092
|
+
const containerRef = useRef13(null);
|
|
3093
|
+
const handleDropColumnHeader = useCallback19(
|
|
3067
3094
|
(moveFrom, moveTo) => {
|
|
3068
3095
|
const column = columns[moveFrom];
|
|
3069
3096
|
const orderedColumns = moveColumnTo(columns, column, moveTo);
|
|
@@ -3079,7 +3106,7 @@ var useTableHeader = ({
|
|
|
3079
3106
|
},
|
|
3080
3107
|
[columns, onMoveColumn, tableConfig.columns]
|
|
3081
3108
|
);
|
|
3082
|
-
const handleColumnHeaderClick =
|
|
3109
|
+
const handleColumnHeaderClick = useCallback19(
|
|
3083
3110
|
(evt) => {
|
|
3084
3111
|
var _a;
|
|
3085
3112
|
const targetElement = evt.target;
|
|
@@ -3199,8 +3226,9 @@ var TableCore = ({
|
|
|
3199
3226
|
onRowClick: onRowClickProp,
|
|
3200
3227
|
onSelect,
|
|
3201
3228
|
onSelectionChange,
|
|
3202
|
-
renderBufferSize =
|
|
3229
|
+
renderBufferSize = 5,
|
|
3203
3230
|
rowHeight = 20,
|
|
3231
|
+
scrollingApiRef,
|
|
3204
3232
|
selectionModel = "extended",
|
|
3205
3233
|
showColumnHeaders = true,
|
|
3206
3234
|
headerHeight = showColumnHeaders ? 25 : 0,
|
|
@@ -3212,6 +3240,7 @@ var TableCore = ({
|
|
|
3212
3240
|
columns,
|
|
3213
3241
|
data,
|
|
3214
3242
|
draggableRow,
|
|
3243
|
+
getRowOffset,
|
|
3215
3244
|
handleContextMenuAction,
|
|
3216
3245
|
headings,
|
|
3217
3246
|
highlightedIndex,
|
|
@@ -3251,10 +3280,11 @@ var TableCore = ({
|
|
|
3251
3280
|
onSelectionChange,
|
|
3252
3281
|
renderBufferSize,
|
|
3253
3282
|
rowHeight,
|
|
3283
|
+
scrollingApiRef,
|
|
3254
3284
|
selectionModel,
|
|
3255
3285
|
size
|
|
3256
3286
|
});
|
|
3257
|
-
const
|
|
3287
|
+
const contentContainerClassName = cx9(`${classBase7}-contentContainer`, {
|
|
3258
3288
|
[`${classBase7}-colLines`]: tableAttributes.columnSeparators,
|
|
3259
3289
|
[`${classBase7}-rowLines`]: tableAttributes.rowSeparators,
|
|
3260
3290
|
// [`${classBase}-highlight`]: tableAttributes.showHighlightedRow,
|
|
@@ -3291,7 +3321,7 @@ var TableCore = ({
|
|
|
3291
3321
|
/* @__PURE__ */ jsx12(
|
|
3292
3322
|
"div",
|
|
3293
3323
|
{
|
|
3294
|
-
className,
|
|
3324
|
+
className: contentContainerClassName,
|
|
3295
3325
|
ref: scrollProps.contentContainerRef,
|
|
3296
3326
|
style: cssVariables,
|
|
3297
3327
|
children: /* @__PURE__ */ jsxs8(
|
|
@@ -3319,13 +3349,14 @@ var TableCore = ({
|
|
|
3319
3349
|
/* @__PURE__ */ jsx12("div", { className: `${classBase7}-body`, children: data.map((data2) => /* @__PURE__ */ jsx12(
|
|
3320
3350
|
Row2,
|
|
3321
3351
|
{
|
|
3352
|
+
"aria-rowindex": data2[0] + 1,
|
|
3322
3353
|
columnMap,
|
|
3323
3354
|
columns,
|
|
3324
3355
|
highlighted: highlightedIndex === data2[IDX3],
|
|
3325
3356
|
onClick: onRowClick,
|
|
3326
3357
|
onDataEdited,
|
|
3327
3358
|
row: data2,
|
|
3328
|
-
offset:
|
|
3359
|
+
offset: getRowOffset(data2),
|
|
3329
3360
|
onToggleGroup,
|
|
3330
3361
|
zebraStripes: tableAttributes.zebraStripes
|
|
3331
3362
|
},
|
|
@@ -3363,13 +3394,14 @@ var Table = forwardRef(function TableNext({
|
|
|
3363
3394
|
onSelectionChange,
|
|
3364
3395
|
renderBufferSize,
|
|
3365
3396
|
rowHeight,
|
|
3397
|
+
scrollingApiRef,
|
|
3366
3398
|
selectionModel,
|
|
3367
3399
|
showColumnHeaders,
|
|
3368
3400
|
headerHeight,
|
|
3369
3401
|
style: styleProp,
|
|
3370
3402
|
...htmlAttributes
|
|
3371
3403
|
}, forwardedRef) {
|
|
3372
|
-
const containerRef =
|
|
3404
|
+
const containerRef = useRef14(null);
|
|
3373
3405
|
const [size, setSize] = useState7();
|
|
3374
3406
|
if (config === void 0) {
|
|
3375
3407
|
throw Error(
|
|
@@ -3412,6 +3444,7 @@ var Table = forwardRef(function TableNext({
|
|
|
3412
3444
|
onSelectionChange,
|
|
3413
3445
|
renderBufferSize,
|
|
3414
3446
|
rowHeight,
|
|
3447
|
+
scrollingApiRef,
|
|
3415
3448
|
selectionModel,
|
|
3416
3449
|
showColumnHeaders,
|
|
3417
3450
|
size
|
|
@@ -3422,7 +3455,7 @@ var Table = forwardRef(function TableNext({
|
|
|
3422
3455
|
});
|
|
3423
3456
|
|
|
3424
3457
|
// ../vuu-table/src/cell-renderers/checkbox-cell/CheckboxCell.tsx
|
|
3425
|
-
import { memo as memo2, useCallback as
|
|
3458
|
+
import { memo as memo2, useCallback as useCallback20 } from "react";
|
|
3426
3459
|
import { CheckboxIcon, WarnCommit } from "@vuu-ui/vuu-ui-controls";
|
|
3427
3460
|
import { Checkbox } from "@salt-ds/core";
|
|
3428
3461
|
|
|
@@ -3436,7 +3469,7 @@ var CheckboxCell = memo2(
|
|
|
3436
3469
|
({ column, columnMap, onCommit = WarnCommit, row }) => {
|
|
3437
3470
|
const dataIdx = columnMap[column.name];
|
|
3438
3471
|
const isChecked = row[dataIdx];
|
|
3439
|
-
const handleCommit =
|
|
3472
|
+
const handleCommit = useCallback20(
|
|
3440
3473
|
(value) => async (evt) => {
|
|
3441
3474
|
const res = await onCommit(value);
|
|
3442
3475
|
if (res === true) {
|
|
@@ -3506,7 +3539,7 @@ import {
|
|
|
3506
3539
|
registerComponent as registerComponent5
|
|
3507
3540
|
} from "@vuu-ui/vuu-utils";
|
|
3508
3541
|
import cx11 from "clsx";
|
|
3509
|
-
import { memo as memo3, useCallback as
|
|
3542
|
+
import { memo as memo3, useCallback as useCallback21 } from "react";
|
|
3510
3543
|
import { CycleStateButton } from "@vuu-ui/vuu-ui-controls";
|
|
3511
3544
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
3512
3545
|
var classBase9 = "vuuTableToggleCell";
|
|
@@ -3529,7 +3562,7 @@ var ToggleCell = memo3(
|
|
|
3529
3562
|
const values = getValueList(column);
|
|
3530
3563
|
const dataIdx = columnMap[column.name];
|
|
3531
3564
|
const value = row[dataIdx];
|
|
3532
|
-
const handleCommit =
|
|
3565
|
+
const handleCommit = useCallback21(
|
|
3533
3566
|
(evt, value2) => {
|
|
3534
3567
|
return onCommit(value2).then((response) => {
|
|
3535
3568
|
if (response === true) {
|
|
@@ -3559,7 +3592,7 @@ registerComponent5("toggle-cell", ToggleCell, "cell-renderer", {});
|
|
|
3559
3592
|
// ../vuu-table/src/useControlledTableNavigation.ts
|
|
3560
3593
|
import { useStateRef } from "@vuu-ui/vuu-ui-controls";
|
|
3561
3594
|
import { dispatchMouseEvent as dispatchMouseEvent2 } from "@vuu-ui/vuu-utils";
|
|
3562
|
-
import { useCallback as
|
|
3595
|
+
import { useCallback as useCallback22, useRef as useRef15 } from "react";
|
|
3563
3596
|
|
|
3564
3597
|
// src/cell-renderers/background-cell/BackgroundCell.tsx
|
|
3565
3598
|
import {
|
|
@@ -3580,11 +3613,11 @@ import {
|
|
|
3580
3613
|
isTypeDescriptor as isTypeDescriptor2,
|
|
3581
3614
|
isValidNumber as isValidNumber2
|
|
3582
3615
|
} from "@vuu-ui/vuu-utils";
|
|
3583
|
-
import { useEffect as useEffect5, useRef as
|
|
3616
|
+
import { useEffect as useEffect5, useRef as useRef16 } from "react";
|
|
3584
3617
|
var INITIAL_VALUE = [void 0, void 0, void 0, void 0];
|
|
3585
3618
|
function useDirection(key, value, column) {
|
|
3586
3619
|
var _a;
|
|
3587
|
-
const ref =
|
|
3620
|
+
const ref = useRef16();
|
|
3588
3621
|
const [prevKey, prevValue, prevColumn, prevDirection] = ref.current || INITIAL_VALUE;
|
|
3589
3622
|
const { type: dataType } = column;
|
|
3590
3623
|
const decimals = isTypeDescriptor2(dataType) ? (_a = dataType.formatting) == null ? void 0 : _a.decimals : void 0;
|
|
@@ -3657,7 +3690,7 @@ import {
|
|
|
3657
3690
|
} from "@vuu-ui/vuu-utils";
|
|
3658
3691
|
import { FormField, FormFieldLabel } from "@salt-ds/core";
|
|
3659
3692
|
import { Dropdown } from "@vuu-ui/vuu-ui-controls";
|
|
3660
|
-
import { useCallback as
|
|
3693
|
+
import { useCallback as useCallback23, useState as useState8 } from "react";
|
|
3661
3694
|
import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3662
3695
|
var classBase11 = "vuuBackgroundCellConfiguration";
|
|
3663
3696
|
var flashOptions = [
|
|
@@ -3677,7 +3710,7 @@ var BackgroundCellConfigurationEditor = ({
|
|
|
3677
3710
|
const [flashStyle, setFlashStyle] = useState8(
|
|
3678
3711
|
valueFromColumn(column)
|
|
3679
3712
|
);
|
|
3680
|
-
const handleSelectionChange =
|
|
3713
|
+
const handleSelectionChange = useCallback23(
|
|
3681
3714
|
(_, flashOption) => {
|
|
3682
3715
|
var _a;
|
|
3683
3716
|
setFlashStyle(flashOption);
|
|
@@ -3715,7 +3748,7 @@ import {
|
|
|
3715
3748
|
WarnCommit as WarnCommit4
|
|
3716
3749
|
} from "@vuu-ui/vuu-ui-controls";
|
|
3717
3750
|
import { dispatchCustomEvent as dispatchCustomEvent3, registerComponent as registerComponent7 } from "@vuu-ui/vuu-utils";
|
|
3718
|
-
import { memo as memo5, useCallback as
|
|
3751
|
+
import { memo as memo5, useCallback as useCallback24, useState as useState9 } from "react";
|
|
3719
3752
|
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
3720
3753
|
var classBase12 = "vuuTableDropdownCell";
|
|
3721
3754
|
var openKeys = ["Enter", " "];
|
|
@@ -3729,7 +3762,7 @@ var DropdownCell = memo5(
|
|
|
3729
3762
|
const dataIdx = columnMap[column.name];
|
|
3730
3763
|
const { initialValue, values } = useLookupValues(column, row[dataIdx]);
|
|
3731
3764
|
const [value, setValue] = useState9(null);
|
|
3732
|
-
const handleSelectionChange =
|
|
3765
|
+
const handleSelectionChange = useCallback24(
|
|
3733
3766
|
(evt, selectedOption) => {
|
|
3734
3767
|
if (selectedOption) {
|
|
3735
3768
|
setValue(selectedOption);
|
|
@@ -3846,7 +3879,7 @@ import {
|
|
|
3846
3879
|
import { Checkbox as Checkbox2, Switch } from "@salt-ds/core";
|
|
3847
3880
|
import cx14 from "clsx";
|
|
3848
3881
|
import {
|
|
3849
|
-
useCallback as
|
|
3882
|
+
useCallback as useCallback25
|
|
3850
3883
|
} from "react";
|
|
3851
3884
|
import { getColumnLabel as getColumnLabel2 } from "@vuu-ui/vuu-utils";
|
|
3852
3885
|
import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
@@ -3886,7 +3919,7 @@ var ColumnList = ({
|
|
|
3886
3919
|
onNavigateToColumn,
|
|
3887
3920
|
...htmlAttributes
|
|
3888
3921
|
}) => {
|
|
3889
|
-
const handleChange =
|
|
3922
|
+
const handleChange = useCallback25(
|
|
3890
3923
|
(evt) => {
|
|
3891
3924
|
const input = evt.target;
|
|
3892
3925
|
const listItem = input.closest(`.${classBaseListItem}`);
|
|
@@ -3907,7 +3940,7 @@ var ColumnList = ({
|
|
|
3907
3940
|
},
|
|
3908
3941
|
[onChange]
|
|
3909
3942
|
);
|
|
3910
|
-
const handleClick =
|
|
3943
|
+
const handleClick = useCallback25((evt) => {
|
|
3911
3944
|
const targetEl = evt.target;
|
|
3912
3945
|
if (targetEl.classList.contains("vuuColumnList-text")) {
|
|
3913
3946
|
const listItemEl = targetEl.closest(".vuuListItem");
|
|
@@ -3963,7 +3996,7 @@ import {
|
|
|
3963
3996
|
getCalculatedColumnType as getCalculatedColumnType2
|
|
3964
3997
|
} from "@vuu-ui/vuu-utils";
|
|
3965
3998
|
import { FormField as FormField2, FormFieldLabel as FormFieldLabel2, Input as Input2 } from "@salt-ds/core";
|
|
3966
|
-
import { useCallback as
|
|
3999
|
+
import { useCallback as useCallback30, useRef as useRef20 } from "react";
|
|
3967
4000
|
|
|
3968
4001
|
// src/column-expression-input/ColumnExpressionInput.tsx
|
|
3969
4002
|
import { memo as memo7 } from "react";
|
|
@@ -3981,10 +4014,10 @@ import {
|
|
|
3981
4014
|
} from "@vuu-ui/vuu-codemirror";
|
|
3982
4015
|
import { createEl } from "@vuu-ui/vuu-utils";
|
|
3983
4016
|
import {
|
|
3984
|
-
useCallback as
|
|
4017
|
+
useCallback as useCallback27,
|
|
3985
4018
|
useEffect as useEffect6,
|
|
3986
|
-
useMemo as
|
|
3987
|
-
useRef as
|
|
4019
|
+
useMemo as useMemo7,
|
|
4020
|
+
useRef as useRef17
|
|
3988
4021
|
} from "react";
|
|
3989
4022
|
|
|
3990
4023
|
// src/column-expression-input/column-language-parser/ColumnExpressionLanguage.ts
|
|
@@ -4633,7 +4666,7 @@ import {
|
|
|
4633
4666
|
getValue,
|
|
4634
4667
|
syntaxTree
|
|
4635
4668
|
} from "@vuu-ui/vuu-codemirror";
|
|
4636
|
-
import { useCallback as
|
|
4669
|
+
import { useCallback as useCallback26 } from "react";
|
|
4637
4670
|
var applyPrefix = (completions, prefix) => prefix ? completions.map((completion) => {
|
|
4638
4671
|
var _a;
|
|
4639
4672
|
return {
|
|
@@ -4743,7 +4776,7 @@ var promptToSave = (context, onSubmit) => {
|
|
|
4743
4776
|
return { from: context.pos, options };
|
|
4744
4777
|
};
|
|
4745
4778
|
var useColumnAutoComplete = (suggestionProvider, onSubmit) => {
|
|
4746
|
-
const makeSuggestions2 =
|
|
4779
|
+
const makeSuggestions2 = useCallback26(
|
|
4747
4780
|
async (context, suggestionType, optionalArgs = {}) => {
|
|
4748
4781
|
const options = await suggestionProvider.getSuggestions(
|
|
4749
4782
|
suggestionType,
|
|
@@ -4754,7 +4787,7 @@ var useColumnAutoComplete = (suggestionProvider, onSubmit) => {
|
|
|
4754
4787
|
},
|
|
4755
4788
|
[suggestionProvider]
|
|
4756
4789
|
);
|
|
4757
|
-
return
|
|
4790
|
+
return useCallback26(
|
|
4758
4791
|
async (context) => {
|
|
4759
4792
|
var _a, _b;
|
|
4760
4793
|
const { state, pos } = context;
|
|
@@ -5019,11 +5052,11 @@ var useColumnExpressionEditor = ({
|
|
|
5019
5052
|
source,
|
|
5020
5053
|
suggestionProvider
|
|
5021
5054
|
}) => {
|
|
5022
|
-
const editorRef =
|
|
5023
|
-
const onSubmitRef =
|
|
5024
|
-
const viewRef =
|
|
5055
|
+
const editorRef = useRef17(null);
|
|
5056
|
+
const onSubmitRef = useRef17(noop);
|
|
5057
|
+
const viewRef = useRef17();
|
|
5025
5058
|
const completionFn = useColumnAutoComplete(suggestionProvider, onSubmitRef);
|
|
5026
|
-
const [createState, clearInput, submit] =
|
|
5059
|
+
const [createState, clearInput, submit] = useMemo7(() => {
|
|
5027
5060
|
const parseExpression = () => {
|
|
5028
5061
|
const view = getView(viewRef);
|
|
5029
5062
|
const source2 = view.state.doc.toString();
|
|
@@ -5104,7 +5137,7 @@ var useColumnExpressionEditor = ({
|
|
|
5104
5137
|
(_a = viewRef.current) == null ? void 0 : _a.destroy();
|
|
5105
5138
|
};
|
|
5106
5139
|
}, [completionFn, createState]);
|
|
5107
|
-
const handleBlur =
|
|
5140
|
+
const handleBlur = useCallback27(() => {
|
|
5108
5141
|
submit();
|
|
5109
5142
|
}, [submit]);
|
|
5110
5143
|
return { editorRef, clearInput, onBlur: handleBlur };
|
|
@@ -5147,7 +5180,7 @@ import {
|
|
|
5147
5180
|
useTypeaheadSuggestions
|
|
5148
5181
|
} from "@vuu-ui/vuu-data-react";
|
|
5149
5182
|
import { isNumericColumn as isNumericColumn3, isTextColumn } from "@vuu-ui/vuu-utils";
|
|
5150
|
-
import { useCallback as
|
|
5183
|
+
import { useCallback as useCallback28, useRef as useRef18 } from "react";
|
|
5151
5184
|
|
|
5152
5185
|
// src/column-expression-input/column-function-descriptors.ts
|
|
5153
5186
|
var columnFunctionDescriptors = [
|
|
@@ -5600,13 +5633,13 @@ var useColumnExpressionSuggestionProvider = ({
|
|
|
5600
5633
|
columns,
|
|
5601
5634
|
table
|
|
5602
5635
|
}) => {
|
|
5603
|
-
const findColumn =
|
|
5636
|
+
const findColumn = useCallback28(
|
|
5604
5637
|
(name2) => name2 ? columns.find((col) => col.name === name2) : void 0,
|
|
5605
5638
|
[columns]
|
|
5606
5639
|
);
|
|
5607
|
-
const latestSuggestionsRef =
|
|
5640
|
+
const latestSuggestionsRef = useRef18();
|
|
5608
5641
|
const getTypeaheadSuggestions = useTypeaheadSuggestions();
|
|
5609
|
-
const getSuggestions =
|
|
5642
|
+
const getSuggestions = useCallback28(
|
|
5610
5643
|
async (suggestionType, options = NONE) => {
|
|
5611
5644
|
const { columnName, functionName, operator, prefix } = options;
|
|
5612
5645
|
switch (suggestionType) {
|
|
@@ -5671,7 +5704,7 @@ var useColumnExpressionSuggestionProvider = ({
|
|
|
5671
5704
|
},
|
|
5672
5705
|
[columns, findColumn, getTypeaheadSuggestions, table]
|
|
5673
5706
|
);
|
|
5674
|
-
const isPartialMatch =
|
|
5707
|
+
const isPartialMatch = useCallback28(
|
|
5675
5708
|
async (valueType, columnName, pattern) => {
|
|
5676
5709
|
const { current: latestSuggestions } = latestSuggestionsRef;
|
|
5677
5710
|
let maybe = false;
|
|
@@ -5702,7 +5735,7 @@ import {
|
|
|
5702
5735
|
setCalculatedColumnName,
|
|
5703
5736
|
setCalculatedColumnType
|
|
5704
5737
|
} from "@vuu-ui/vuu-utils";
|
|
5705
|
-
import { useCallback as
|
|
5738
|
+
import { useCallback as useCallback29, useRef as useRef19, useState as useState10 } from "react";
|
|
5706
5739
|
var applyDefaults = (column) => {
|
|
5707
5740
|
const [name2, expression, type] = getCalculatedColumnDetails(column);
|
|
5708
5741
|
if (type === "") {
|
|
@@ -5721,12 +5754,12 @@ var useColumnExpression = ({
|
|
|
5721
5754
|
const [column, _setColumn] = useState10(
|
|
5722
5755
|
applyDefaults(columnProp)
|
|
5723
5756
|
);
|
|
5724
|
-
const columnRef =
|
|
5725
|
-
const setColumn =
|
|
5757
|
+
const columnRef = useRef19(columnProp);
|
|
5758
|
+
const setColumn = useCallback29((column2) => {
|
|
5726
5759
|
columnRef.current = column2;
|
|
5727
5760
|
_setColumn(column2);
|
|
5728
5761
|
}, []);
|
|
5729
|
-
const onChangeName =
|
|
5762
|
+
const onChangeName = useCallback29(
|
|
5730
5763
|
(evt) => {
|
|
5731
5764
|
const { value } = evt.target;
|
|
5732
5765
|
const newColumn = setCalculatedColumnName(column, value);
|
|
@@ -5735,7 +5768,7 @@ var useColumnExpression = ({
|
|
|
5735
5768
|
},
|
|
5736
5769
|
[column, onChangeNameProp, setColumn]
|
|
5737
5770
|
);
|
|
5738
|
-
const onChangeExpression =
|
|
5771
|
+
const onChangeExpression = useCallback29(
|
|
5739
5772
|
(value) => {
|
|
5740
5773
|
const expression = value.trim();
|
|
5741
5774
|
const { current: column2 } = columnRef;
|
|
@@ -5745,7 +5778,7 @@ var useColumnExpression = ({
|
|
|
5745
5778
|
},
|
|
5746
5779
|
[onChangeNameProp, setColumn]
|
|
5747
5780
|
);
|
|
5748
|
-
const onChangeType =
|
|
5781
|
+
const onChangeType = useCallback29(
|
|
5749
5782
|
(evt, value) => {
|
|
5750
5783
|
if (typeof value === "string") {
|
|
5751
5784
|
const newColumn = setCalculatedColumnType(column, value);
|
|
@@ -5772,19 +5805,19 @@ var ColumnExpressionPanel = ({
|
|
|
5772
5805
|
tableConfig,
|
|
5773
5806
|
vuuTable
|
|
5774
5807
|
}) => {
|
|
5775
|
-
const typeRef =
|
|
5808
|
+
const typeRef = useRef20(null);
|
|
5776
5809
|
const { column, onChangeExpression, onChangeName, onChangeType } = useColumnExpression({
|
|
5777
5810
|
column: columnProp,
|
|
5778
5811
|
onChangeName: onChangeNameProp
|
|
5779
5812
|
});
|
|
5780
|
-
const initialExpressionRef =
|
|
5813
|
+
const initialExpressionRef = useRef20(
|
|
5781
5814
|
getCalculatedColumnExpression(column)
|
|
5782
5815
|
);
|
|
5783
5816
|
const suggestionProvider = useColumnExpressionSuggestionProvider({
|
|
5784
5817
|
columns: tableConfig.columns,
|
|
5785
5818
|
table: vuuTable
|
|
5786
5819
|
});
|
|
5787
|
-
const handleSubmitExpression =
|
|
5820
|
+
const handleSubmitExpression = useCallback30(() => {
|
|
5788
5821
|
var _a, _b;
|
|
5789
5822
|
if (typeRef.current) {
|
|
5790
5823
|
(_b = (_a = typeRef.current) == null ? void 0 : _a.querySelector("button")) == null ? void 0 : _b.focus();
|
|
@@ -5842,13 +5875,13 @@ import {
|
|
|
5842
5875
|
} from "@vuu-ui/vuu-utils";
|
|
5843
5876
|
import { FormField as FormField6, FormFieldLabel as FormFieldLabel6 } from "@salt-ds/core";
|
|
5844
5877
|
import cx15 from "clsx";
|
|
5845
|
-
import { useCallback as
|
|
5878
|
+
import { useCallback as useCallback34, useMemo as useMemo9 } from "react";
|
|
5846
5879
|
|
|
5847
5880
|
// src/column-formatting-settings/BaseNumericFormattingSettings.tsx
|
|
5848
5881
|
import { FormField as FormField3, FormFieldLabel as FormFieldLabel3, Input as Input3, Switch as Switch2 } from "@salt-ds/core";
|
|
5849
5882
|
import { getTypeFormattingFromColumn } from "@vuu-ui/vuu-utils";
|
|
5850
5883
|
import {
|
|
5851
|
-
useCallback as
|
|
5884
|
+
useCallback as useCallback31,
|
|
5852
5885
|
useState as useState11
|
|
5853
5886
|
} from "react";
|
|
5854
5887
|
import { jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
@@ -5859,7 +5892,7 @@ var BaseNumericFormattingSettings = ({
|
|
|
5859
5892
|
}) => {
|
|
5860
5893
|
var _a, _b, _c;
|
|
5861
5894
|
const [formattingSettings, setFormattingSettings] = useState11(getTypeFormattingFromColumn(column));
|
|
5862
|
-
const handleInputKeyDown =
|
|
5895
|
+
const handleInputKeyDown = useCallback31(
|
|
5863
5896
|
(evt) => {
|
|
5864
5897
|
if (evt.key === "Enter" || evt.key === "Tab") {
|
|
5865
5898
|
onChange(formattingSettings);
|
|
@@ -5867,7 +5900,7 @@ var BaseNumericFormattingSettings = ({
|
|
|
5867
5900
|
},
|
|
5868
5901
|
[formattingSettings, onChange]
|
|
5869
5902
|
);
|
|
5870
|
-
const handleChangeDecimals =
|
|
5903
|
+
const handleChangeDecimals = useCallback31(
|
|
5871
5904
|
(evt) => {
|
|
5872
5905
|
const { value } = evt.target;
|
|
5873
5906
|
const numericValue = value === "" ? void 0 : isNaN(parseInt(value)) ? void 0 : parseInt(value);
|
|
@@ -5879,7 +5912,7 @@ var BaseNumericFormattingSettings = ({
|
|
|
5879
5912
|
},
|
|
5880
5913
|
[formattingSettings]
|
|
5881
5914
|
);
|
|
5882
|
-
const handleChangeAlignDecimals =
|
|
5915
|
+
const handleChangeAlignDecimals = useCallback31(
|
|
5883
5916
|
(evt) => {
|
|
5884
5917
|
const { checked } = evt.target;
|
|
5885
5918
|
const newFormattingSettings = {
|
|
@@ -5891,7 +5924,7 @@ var BaseNumericFormattingSettings = ({
|
|
|
5891
5924
|
},
|
|
5892
5925
|
[formattingSettings, onChange]
|
|
5893
5926
|
);
|
|
5894
|
-
const handleChangeZeroPad =
|
|
5927
|
+
const handleChangeZeroPad = useCallback31(
|
|
5895
5928
|
(evt) => {
|
|
5896
5929
|
const { checked } = evt.target;
|
|
5897
5930
|
const newFormattingSettings = {
|
|
@@ -5942,7 +5975,7 @@ var BaseNumericFormattingSettings = ({
|
|
|
5942
5975
|
};
|
|
5943
5976
|
|
|
5944
5977
|
// src/column-formatting-settings/LongTypeFormattingSettings.tsx
|
|
5945
|
-
import { useCallback as
|
|
5978
|
+
import { useCallback as useCallback33 } from "react";
|
|
5946
5979
|
import {
|
|
5947
5980
|
FormField as FormField5,
|
|
5948
5981
|
FormFieldLabel as FormFieldLabel5,
|
|
@@ -5952,7 +5985,7 @@ import {
|
|
|
5952
5985
|
import { isDateTimeColumn, isTypeDescriptor as isTypeDescriptor5 } from "@vuu-ui/vuu-utils";
|
|
5953
5986
|
|
|
5954
5987
|
// src/column-formatting-settings/DateTimeFormattingSettings.tsx
|
|
5955
|
-
import { useCallback as
|
|
5988
|
+
import { useCallback as useCallback32, useMemo as useMemo8, useState as useState12 } from "react";
|
|
5956
5989
|
import { Dropdown as Dropdown4 } from "@vuu-ui/vuu-ui-controls";
|
|
5957
5990
|
import {
|
|
5958
5991
|
defaultPatternsByType,
|
|
@@ -5971,18 +6004,18 @@ var DateTimeFormattingSettings = ({ column, onChangeFormatting: onChange }) => {
|
|
|
5971
6004
|
var _a, _b;
|
|
5972
6005
|
const formatting = getTypeFormattingFromColumn2(column);
|
|
5973
6006
|
const { pattern = fallbackDateTimePattern } = formatting;
|
|
5974
|
-
const toggleValue =
|
|
6007
|
+
const toggleValue = useMemo8(() => getToggleValue(pattern), [pattern]);
|
|
5975
6008
|
const [fallbackState, setFallbackState] = useState12(
|
|
5976
6009
|
{
|
|
5977
6010
|
time: (_a = pattern.time) != null ? _a : defaultPatternsByType.time,
|
|
5978
6011
|
date: (_b = pattern.date) != null ? _b : defaultPatternsByType.date
|
|
5979
6012
|
}
|
|
5980
6013
|
);
|
|
5981
|
-
const onPatternChange =
|
|
6014
|
+
const onPatternChange = useCallback32(
|
|
5982
6015
|
(pattern2) => onChange({ ...formatting, pattern: pattern2 }),
|
|
5983
6016
|
[onChange, formatting]
|
|
5984
6017
|
);
|
|
5985
|
-
const onDropdownChange =
|
|
6018
|
+
const onDropdownChange = useCallback32(
|
|
5986
6019
|
(key) => (_, p) => {
|
|
5987
6020
|
const updatedPattern = { ...pattern != null ? pattern : {}, [key]: p };
|
|
5988
6021
|
setFallbackState((s) => {
|
|
@@ -5996,7 +6029,7 @@ var DateTimeFormattingSettings = ({ column, onChangeFormatting: onChange }) => {
|
|
|
5996
6029
|
},
|
|
5997
6030
|
[onPatternChange, pattern]
|
|
5998
6031
|
);
|
|
5999
|
-
const onToggleChange =
|
|
6032
|
+
const onToggleChange = useCallback32(
|
|
6000
6033
|
(evnt) => {
|
|
6001
6034
|
var _a2, _b2, _c, _d;
|
|
6002
6035
|
const value = evnt.currentTarget.value;
|
|
@@ -6057,7 +6090,7 @@ var classBase18 = "vuuLongColumnFormattingSettings";
|
|
|
6057
6090
|
var LongTypeFormattingSettings = (props) => {
|
|
6058
6091
|
const { column, onChangeType } = props;
|
|
6059
6092
|
const type = isTypeDescriptor5(column.type) ? column.type.name : column.type;
|
|
6060
|
-
const handleToggleChange =
|
|
6093
|
+
const handleToggleChange = useCallback33(
|
|
6061
6094
|
(event) => {
|
|
6062
6095
|
const value = event.currentTarget.value;
|
|
6063
6096
|
onChangeType(value);
|
|
@@ -6098,11 +6131,11 @@ var ColumnFormattingPanel = ({
|
|
|
6098
6131
|
onChangeRendering,
|
|
6099
6132
|
...htmlAttributes
|
|
6100
6133
|
}) => {
|
|
6101
|
-
const formattingSettingsForType =
|
|
6134
|
+
const formattingSettingsForType = useMemo9(
|
|
6102
6135
|
() => formattingSettingsByColType({ column, onChangeFormatting, onChangeType }),
|
|
6103
6136
|
[column, onChangeFormatting, onChangeType]
|
|
6104
6137
|
);
|
|
6105
|
-
const ConfigEditor =
|
|
6138
|
+
const ConfigEditor = useMemo9(() => {
|
|
6106
6139
|
const { type } = column;
|
|
6107
6140
|
if (isTypeDescriptor6(type) && isColumnTypeRenderer2(type.renderer)) {
|
|
6108
6141
|
const cellRendererOptions = getCellRendererOptions(type.renderer.name);
|
|
@@ -6110,7 +6143,7 @@ var ColumnFormattingPanel = ({
|
|
|
6110
6143
|
}
|
|
6111
6144
|
return void 0;
|
|
6112
6145
|
}, [column]);
|
|
6113
|
-
const selectedCellRenderer =
|
|
6146
|
+
const selectedCellRenderer = useMemo9(() => {
|
|
6114
6147
|
const { type } = column;
|
|
6115
6148
|
const [defaultRenderer] = availableRenderers;
|
|
6116
6149
|
const rendererName = isTypeDescriptor6(type) && isColumnTypeRenderer2(type.renderer) ? type.renderer.name : void 0;
|
|
@@ -6119,7 +6152,7 @@ var ColumnFormattingPanel = ({
|
|
|
6119
6152
|
);
|
|
6120
6153
|
return configuredRenderer != null ? configuredRenderer : defaultRenderer;
|
|
6121
6154
|
}, [availableRenderers, column]);
|
|
6122
|
-
const handleChangeRenderer =
|
|
6155
|
+
const handleChangeRenderer = useCallback34(
|
|
6123
6156
|
(_, cellRendererDescriptor) => {
|
|
6124
6157
|
const renderProps = {
|
|
6125
6158
|
name: cellRendererDescriptor.name
|
|
@@ -6222,10 +6255,10 @@ import {
|
|
|
6222
6255
|
updateColumnType
|
|
6223
6256
|
} from "@vuu-ui/vuu-utils";
|
|
6224
6257
|
import {
|
|
6225
|
-
useCallback as
|
|
6258
|
+
useCallback as useCallback35,
|
|
6226
6259
|
useEffect as useEffect7,
|
|
6227
|
-
useMemo as
|
|
6228
|
-
useRef as
|
|
6260
|
+
useMemo as useMemo10,
|
|
6261
|
+
useRef as useRef21,
|
|
6229
6262
|
useState as useState13
|
|
6230
6263
|
} from "react";
|
|
6231
6264
|
var integerCellRenderers = [
|
|
@@ -6309,9 +6342,9 @@ var useColumnSettings = ({
|
|
|
6309
6342
|
const [column, setColumn] = useState13(
|
|
6310
6343
|
getColumn(tableConfig.columns, columnProp)
|
|
6311
6344
|
);
|
|
6312
|
-
const columnRef =
|
|
6345
|
+
const columnRef = useRef21(column);
|
|
6313
6346
|
const [inEditMode, setEditMode] = useState13(column.name === "::");
|
|
6314
|
-
const handleEditCalculatedcolumn =
|
|
6347
|
+
const handleEditCalculatedcolumn = useCallback35(() => {
|
|
6315
6348
|
columnRef.current = column;
|
|
6316
6349
|
setEditMode(true);
|
|
6317
6350
|
}, [column]);
|
|
@@ -6319,13 +6352,13 @@ var useColumnSettings = ({
|
|
|
6319
6352
|
setColumn(columnProp);
|
|
6320
6353
|
setEditMode(columnProp.name === "::");
|
|
6321
6354
|
}, [columnProp]);
|
|
6322
|
-
const availableRenderers =
|
|
6355
|
+
const availableRenderers = useMemo10(() => {
|
|
6323
6356
|
return getAvailableCellRenderers(column);
|
|
6324
6357
|
}, [column]);
|
|
6325
|
-
const handleInputCommit =
|
|
6358
|
+
const handleInputCommit = useCallback35(() => {
|
|
6326
6359
|
onConfigChange(replaceColumn2(tableConfig, column));
|
|
6327
6360
|
}, [column, onConfigChange, tableConfig]);
|
|
6328
|
-
const handleChange =
|
|
6361
|
+
const handleChange = useCallback35(
|
|
6329
6362
|
(evt) => {
|
|
6330
6363
|
const input = evt.target;
|
|
6331
6364
|
const fieldName = getFieldName(input);
|
|
@@ -6364,10 +6397,10 @@ var useColumnSettings = ({
|
|
|
6364
6397
|
},
|
|
6365
6398
|
[column, onConfigChange, tableConfig]
|
|
6366
6399
|
);
|
|
6367
|
-
const handleChangeCalculatedColumnName =
|
|
6400
|
+
const handleChangeCalculatedColumnName = useCallback35((name2) => {
|
|
6368
6401
|
setColumn((state) => ({ ...state, name: name2 }));
|
|
6369
6402
|
}, []);
|
|
6370
|
-
const handleChangeFormatting =
|
|
6403
|
+
const handleChangeFormatting = useCallback35(
|
|
6371
6404
|
(formatting) => {
|
|
6372
6405
|
const newColumn = updateColumnFormatting(column, formatting);
|
|
6373
6406
|
setColumn(newColumn);
|
|
@@ -6375,7 +6408,7 @@ var useColumnSettings = ({
|
|
|
6375
6408
|
},
|
|
6376
6409
|
[column, onConfigChange, tableConfig]
|
|
6377
6410
|
);
|
|
6378
|
-
const handleChangeType =
|
|
6411
|
+
const handleChangeType = useCallback35(
|
|
6379
6412
|
(type) => {
|
|
6380
6413
|
const updatedColumn = updateColumnType(column, type);
|
|
6381
6414
|
setColumn(updatedColumn);
|
|
@@ -6383,7 +6416,7 @@ var useColumnSettings = ({
|
|
|
6383
6416
|
},
|
|
6384
6417
|
[column, onConfigChange, tableConfig]
|
|
6385
6418
|
);
|
|
6386
|
-
const handleChangeRendering =
|
|
6419
|
+
const handleChangeRendering = useCallback35(
|
|
6387
6420
|
(renderProps) => {
|
|
6388
6421
|
if (renderProps) {
|
|
6389
6422
|
const newColumn = updateColumnRenderProps(
|
|
@@ -6396,7 +6429,7 @@ var useColumnSettings = ({
|
|
|
6396
6429
|
},
|
|
6397
6430
|
[column, onConfigChange, tableConfig]
|
|
6398
6431
|
);
|
|
6399
|
-
const navigateColumn =
|
|
6432
|
+
const navigateColumn = useCallback35(
|
|
6400
6433
|
({ moveBy }) => {
|
|
6401
6434
|
const { columns } = tableConfig;
|
|
6402
6435
|
const index = columns.indexOf(column) + moveBy;
|
|
@@ -6407,16 +6440,16 @@ var useColumnSettings = ({
|
|
|
6407
6440
|
},
|
|
6408
6441
|
[column, tableConfig]
|
|
6409
6442
|
);
|
|
6410
|
-
const navigateNextColumn =
|
|
6443
|
+
const navigateNextColumn = useCallback35(() => {
|
|
6411
6444
|
navigateColumn({ moveBy: 1 });
|
|
6412
6445
|
}, [navigateColumn]);
|
|
6413
|
-
const navigatePrevColumn =
|
|
6446
|
+
const navigatePrevColumn = useCallback35(() => {
|
|
6414
6447
|
navigateColumn({ moveBy: -1 });
|
|
6415
6448
|
}, [navigateColumn]);
|
|
6416
|
-
const handleSaveCalculatedColumn =
|
|
6449
|
+
const handleSaveCalculatedColumn = useCallback35(() => {
|
|
6417
6450
|
onCreateCalculatedColumn(column);
|
|
6418
6451
|
}, [column, onCreateCalculatedColumn]);
|
|
6419
|
-
const handleCancelEdit =
|
|
6452
|
+
const handleCancelEdit = useCallback35(() => {
|
|
6420
6453
|
if (columnProp.name === "::") {
|
|
6421
6454
|
onCancelCreateColumn();
|
|
6422
6455
|
} else {
|
|
@@ -6720,8 +6753,8 @@ import {
|
|
|
6720
6753
|
useLayoutEffectSkipFirst as useLayoutEffectSkipFirst3
|
|
6721
6754
|
} from "@vuu-ui/vuu-utils";
|
|
6722
6755
|
import {
|
|
6723
|
-
useCallback as
|
|
6724
|
-
useMemo as
|
|
6756
|
+
useCallback as useCallback36,
|
|
6757
|
+
useMemo as useMemo11,
|
|
6725
6758
|
useState as useState15
|
|
6726
6759
|
} from "react";
|
|
6727
6760
|
var sortOrderFromAvailableColumns = (availableColumns, columns) => {
|
|
@@ -6757,11 +6790,11 @@ var useTableSettings = ({
|
|
|
6757
6790
|
availableColumns: availableColumnsProp,
|
|
6758
6791
|
tableConfig: tableConfigProp
|
|
6759
6792
|
});
|
|
6760
|
-
const columnItems =
|
|
6793
|
+
const columnItems = useMemo11(
|
|
6761
6794
|
() => buildColumnItems(availableColumns, tableConfig.columns),
|
|
6762
6795
|
[availableColumns, tableConfig.columns]
|
|
6763
6796
|
);
|
|
6764
|
-
const handleMoveListItem =
|
|
6797
|
+
const handleMoveListItem = useCallback36(
|
|
6765
6798
|
(fromIndex, toIndex) => {
|
|
6766
6799
|
setColumnState((state) => {
|
|
6767
6800
|
const newAvailableColumns = moveItem(
|
|
@@ -6784,7 +6817,7 @@ var useTableSettings = ({
|
|
|
6784
6817
|
},
|
|
6785
6818
|
[tableConfig.columns]
|
|
6786
6819
|
);
|
|
6787
|
-
const handleColumnChange =
|
|
6820
|
+
const handleColumnChange = useCallback36(
|
|
6788
6821
|
(name2, property, value) => {
|
|
6789
6822
|
const columnItem = columnItems.find((col) => col.name === name2);
|
|
6790
6823
|
if (property === "subscribed") {
|
|
@@ -6838,7 +6871,7 @@ var useTableSettings = ({
|
|
|
6838
6871
|
},
|
|
6839
6872
|
[availableColumns, columnItems, onDataSourceConfigChange, tableConfig]
|
|
6840
6873
|
);
|
|
6841
|
-
const handleChangeColumnLabels =
|
|
6874
|
+
const handleChangeColumnLabels = useCallback36((evt) => {
|
|
6842
6875
|
const { value } = evt.target;
|
|
6843
6876
|
const columnFormatHeader = value === "0" ? void 0 : value === "1" ? "capitalize" : "uppercase";
|
|
6844
6877
|
setColumnState((state) => ({
|
|
@@ -6849,7 +6882,7 @@ var useTableSettings = ({
|
|
|
6849
6882
|
}
|
|
6850
6883
|
}));
|
|
6851
6884
|
}, []);
|
|
6852
|
-
const handleChangeTableAttribute =
|
|
6885
|
+
const handleChangeTableAttribute = useCallback36(
|
|
6853
6886
|
(evt) => {
|
|
6854
6887
|
const { ariaChecked, value } = evt.target;
|
|
6855
6888
|
setColumnState((state) => ({
|