@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/cjs/index.js
CHANGED
|
@@ -520,10 +520,10 @@ var HeaderCell = ({
|
|
|
520
520
|
// ../vuu-table/src/Table.tsx
|
|
521
521
|
var import_vuu_layout3 = require("@vuu-ui/vuu-layout");
|
|
522
522
|
var import_vuu_popups3 = require("@vuu-ui/vuu-popups");
|
|
523
|
-
var
|
|
523
|
+
var import_vuu_utils24 = require("@vuu-ui/vuu-utils");
|
|
524
524
|
var import_core2 = require("@salt-ds/core");
|
|
525
525
|
var import_clsx9 = __toESM(require("clsx"));
|
|
526
|
-
var
|
|
526
|
+
var import_react25 = require("react");
|
|
527
527
|
|
|
528
528
|
// ../vuu-table/src/Row.tsx
|
|
529
529
|
var import_vuu_utils7 = require("@vuu-ui/vuu-utils");
|
|
@@ -677,7 +677,6 @@ var Row = (0, import_react11.memo)(
|
|
|
677
677
|
"div",
|
|
678
678
|
{
|
|
679
679
|
...htmlAttributes,
|
|
680
|
-
"aria-rowindex": row[0] + 1,
|
|
681
680
|
key: `row-${row[0]}`,
|
|
682
681
|
role: "row",
|
|
683
682
|
className,
|
|
@@ -709,8 +708,8 @@ Row.displayName = "Row";
|
|
|
709
708
|
|
|
710
709
|
// ../vuu-table/src/useTable.ts
|
|
711
710
|
var import_vuu_ui_controls2 = require("@vuu-ui/vuu-ui-controls");
|
|
712
|
-
var
|
|
713
|
-
var
|
|
711
|
+
var import_vuu_utils21 = require("@vuu-ui/vuu-utils");
|
|
712
|
+
var import_react23 = require("react");
|
|
714
713
|
|
|
715
714
|
// ../vuu-table/src/context-menu/buildContextMenuDescriptors.ts
|
|
716
715
|
var import_vuu_utils8 = require("@vuu-ui/vuu-utils");
|
|
@@ -1029,7 +1028,7 @@ var import_react13 = require("react");
|
|
|
1029
1028
|
|
|
1030
1029
|
// ../vuu-table/src/table-dom-utils.ts
|
|
1031
1030
|
var headerCellQuery = (colIdx) => `.vuuTable-col-headers .vuuTableHeaderCell:nth-child(${colIdx})`;
|
|
1032
|
-
var dataCellQuery = (rowIdx, colIdx) => `.vuuTable-body > [aria-rowindex='${rowIdx}'] > [role='cell']:nth-child(${colIdx + 1})`;
|
|
1031
|
+
var dataCellQuery = (rowIdx, colIdx) => `.vuuTable-body > [aria-rowindex='${rowIdx + 1}'] > [role='cell']:nth-child(${colIdx + 1})`;
|
|
1033
1032
|
var getTableCell = (containerRef, [rowIdx, colIdx]) => {
|
|
1034
1033
|
var _a;
|
|
1035
1034
|
const cssQuery = rowIdx === -1 ? headerCellQuery(colIdx) : dataCellQuery(rowIdx, colIdx);
|
|
@@ -1297,6 +1296,7 @@ var useInitialValue = (value) => {
|
|
|
1297
1296
|
};
|
|
1298
1297
|
|
|
1299
1298
|
// ../vuu-table/src/useKeyboardNavigation.ts
|
|
1299
|
+
var import_vuu_utils14 = require("@vuu-ui/vuu-utils");
|
|
1300
1300
|
var import_core = require("@salt-ds/core");
|
|
1301
1301
|
var import_react16 = require("react");
|
|
1302
1302
|
var rowNavigationKeys = /* @__PURE__ */ new Set([
|
|
@@ -1323,51 +1323,6 @@ var isNavigationKey = (key, navigationStyle) => {
|
|
|
1323
1323
|
var PageKeys = ["Home", "End", "PageUp", "PageDown"];
|
|
1324
1324
|
var isPagingKey = (key) => PageKeys.includes(key);
|
|
1325
1325
|
var NULL_CELL_POS = [-1, -1];
|
|
1326
|
-
var NO_SCROLL_NECESSARY = [void 0, void 0];
|
|
1327
|
-
var howFarIsRowOutsideViewport = (rowEl, contentContainer = rowEl.closest(".vuuTable-contentContainer")) => {
|
|
1328
|
-
if (contentContainer) {
|
|
1329
|
-
const viewport = contentContainer == null ? void 0 : contentContainer.getBoundingClientRect();
|
|
1330
|
-
const row = rowEl.getBoundingClientRect();
|
|
1331
|
-
if (row) {
|
|
1332
|
-
if (row.bottom > viewport.bottom) {
|
|
1333
|
-
return ["down", row.bottom - viewport.bottom];
|
|
1334
|
-
} else if (row.top < viewport.top) {
|
|
1335
|
-
return ["up", row.top - viewport.top];
|
|
1336
|
-
} else {
|
|
1337
|
-
return NO_SCROLL_NECESSARY;
|
|
1338
|
-
}
|
|
1339
|
-
} else {
|
|
1340
|
-
throw Error("Whats going on, row not found");
|
|
1341
|
-
}
|
|
1342
|
-
} else {
|
|
1343
|
-
throw Error("Whats going on, scrollbar container not found");
|
|
1344
|
-
}
|
|
1345
|
-
};
|
|
1346
|
-
var howFarIsCellOutsideViewport = (cellEl) => {
|
|
1347
|
-
var _a;
|
|
1348
|
-
const contentContainer = cellEl.closest(".vuuTable-contentContainer");
|
|
1349
|
-
if (contentContainer) {
|
|
1350
|
-
const rowEl = cellEl.closest(".vuuTableRow");
|
|
1351
|
-
if (rowEl) {
|
|
1352
|
-
const result = howFarIsRowOutsideViewport(rowEl, contentContainer);
|
|
1353
|
-
if (result !== NO_SCROLL_NECESSARY) {
|
|
1354
|
-
return result;
|
|
1355
|
-
}
|
|
1356
|
-
const viewport = contentContainer == null ? void 0 : contentContainer.getBoundingClientRect();
|
|
1357
|
-
const cell = (_a = cellEl.closest(".vuuTableCell")) == null ? void 0 : _a.getBoundingClientRect();
|
|
1358
|
-
if (cell) {
|
|
1359
|
-
if (cell.right > viewport.right) {
|
|
1360
|
-
return ["right", cell.right + 6 - viewport.right];
|
|
1361
|
-
} else if (cell.left < viewport.left) {
|
|
1362
|
-
return ["left", cell.left - viewport.left];
|
|
1363
|
-
}
|
|
1364
|
-
} else {
|
|
1365
|
-
throw Error("Whats going on, cell not found");
|
|
1366
|
-
}
|
|
1367
|
-
}
|
|
1368
|
-
}
|
|
1369
|
-
return NO_SCROLL_NECESSARY;
|
|
1370
|
-
};
|
|
1371
1326
|
function nextCellPos(key, [rowIdx, colIdx], columnCount, rowCount) {
|
|
1372
1327
|
if (key === "ArrowUp") {
|
|
1373
1328
|
if (rowIdx > -1) {
|
|
@@ -1435,14 +1390,14 @@ var useKeyboardNavigation = ({
|
|
|
1435
1390
|
"[role='columnHeader'],[role='cell']"
|
|
1436
1391
|
);
|
|
1437
1392
|
const getTableCellPos = (tableCell) => {
|
|
1438
|
-
var _a2
|
|
1393
|
+
var _a2;
|
|
1439
1394
|
if (tableCell.role === "columnHeader") {
|
|
1440
1395
|
const colIdx = parseInt((_a2 = tableCell.dataset.idx) != null ? _a2 : "-1", 10);
|
|
1441
1396
|
return [-1, colIdx];
|
|
1442
1397
|
} else {
|
|
1443
1398
|
const focusedRow = tableCell.closest("[role='row']");
|
|
1444
1399
|
if (focusedRow) {
|
|
1445
|
-
const rowIdx =
|
|
1400
|
+
const rowIdx = (0, import_vuu_utils14.getIndexFromRowElement)(focusedRow);
|
|
1446
1401
|
const colIdx = Array.from(focusedRow.childNodes).indexOf(tableCell);
|
|
1447
1402
|
return [rowIdx, colIdx];
|
|
1448
1403
|
}
|
|
@@ -1460,11 +1415,8 @@ var useKeyboardNavigation = ({
|
|
|
1460
1415
|
focusableCell.current = activeCell;
|
|
1461
1416
|
activeCell.setAttribute("tabindex", "0");
|
|
1462
1417
|
}
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
requestScroll == null ? void 0 : requestScroll({ type: "scroll-distance", distance, direction });
|
|
1466
|
-
}
|
|
1467
|
-
console.log(`activeCell focus`);
|
|
1418
|
+
console.log(`scroll row ${cellPos[0]}`);
|
|
1419
|
+
requestScroll == null ? void 0 : requestScroll({ type: "scroll-row", rowIndex: cellPos[0] });
|
|
1468
1420
|
activeCell.focus({ preventScroll: true });
|
|
1469
1421
|
}
|
|
1470
1422
|
}
|
|
@@ -1546,18 +1498,9 @@ var useKeyboardNavigation = ({
|
|
|
1546
1498
|
);
|
|
1547
1499
|
const scrollRowIntoViewIfNecessary = (0, import_react16.useCallback)(
|
|
1548
1500
|
(rowIndex) => {
|
|
1549
|
-
|
|
1550
|
-
const activeRow = container == null ? void 0 : container.querySelector(
|
|
1551
|
-
`[aria-rowindex="${rowIndex}"]`
|
|
1552
|
-
);
|
|
1553
|
-
if (activeRow) {
|
|
1554
|
-
const [direction, distance] = howFarIsRowOutsideViewport(activeRow);
|
|
1555
|
-
if (direction && distance) {
|
|
1556
|
-
requestScroll == null ? void 0 : requestScroll({ type: "scroll-distance", distance, direction });
|
|
1557
|
-
}
|
|
1558
|
-
}
|
|
1501
|
+
requestScroll == null ? void 0 : requestScroll({ type: "scroll-row", rowIndex });
|
|
1559
1502
|
},
|
|
1560
|
-
[
|
|
1503
|
+
[requestScroll]
|
|
1561
1504
|
);
|
|
1562
1505
|
const moveHighlightedRow = (0, import_react16.useCallback)(
|
|
1563
1506
|
async (key) => {
|
|
@@ -1645,9 +1588,9 @@ var useKeyboardNavigation = ({
|
|
|
1645
1588
|
};
|
|
1646
1589
|
|
|
1647
1590
|
// ../vuu-table/src/useSelection.ts
|
|
1648
|
-
var
|
|
1591
|
+
var import_vuu_utils15 = require("@vuu-ui/vuu-utils");
|
|
1649
1592
|
var import_react17 = require("react");
|
|
1650
|
-
var { IDX: IDX2 } =
|
|
1593
|
+
var { IDX: IDX2 } = import_vuu_utils15.metadataKeys;
|
|
1651
1594
|
var NO_SELECTION = [];
|
|
1652
1595
|
var defaultSelectionKeys = ["Enter", " "];
|
|
1653
1596
|
var useSelection = ({
|
|
@@ -1669,7 +1612,7 @@ var useSelection = ({
|
|
|
1669
1612
|
const { [IDX2]: idx } = row;
|
|
1670
1613
|
const { current: active } = lastActiveRef;
|
|
1671
1614
|
const { current: selected } = selectedRef;
|
|
1672
|
-
const selectOperation = (0,
|
|
1615
|
+
const selectOperation = (0, import_vuu_utils15.isRowSelected)(row) ? import_vuu_utils15.deselectItem : import_vuu_utils15.selectItem;
|
|
1673
1616
|
const newSelected = selectOperation(
|
|
1674
1617
|
selectionModel,
|
|
1675
1618
|
selected,
|
|
@@ -1694,7 +1637,7 @@ var useSelection = ({
|
|
|
1694
1637
|
`[aria-rowindex="${rowIndex}"]`
|
|
1695
1638
|
);
|
|
1696
1639
|
if (rowEl) {
|
|
1697
|
-
(0,
|
|
1640
|
+
(0, import_vuu_utils15.dispatchMouseEvent)(rowEl, "click");
|
|
1698
1641
|
}
|
|
1699
1642
|
}
|
|
1700
1643
|
}
|
|
@@ -1709,7 +1652,7 @@ var useSelection = ({
|
|
|
1709
1652
|
|
|
1710
1653
|
// ../vuu-table/src/useTableContextMenu.ts
|
|
1711
1654
|
var import_vuu_popups2 = require("@vuu-ui/vuu-popups");
|
|
1712
|
-
var
|
|
1655
|
+
var import_vuu_utils16 = require("@vuu-ui/vuu-utils");
|
|
1713
1656
|
var import_react18 = require("react");
|
|
1714
1657
|
var NO_ROWS = [];
|
|
1715
1658
|
var useTableContextMenu = ({
|
|
@@ -1726,8 +1669,8 @@ var useTableContextMenu = ({
|
|
|
1726
1669
|
const rowEl = target == null ? void 0 : target.closest("div[role='row']");
|
|
1727
1670
|
if (cellEl && rowEl) {
|
|
1728
1671
|
const { selectedRowsCount } = dataSource;
|
|
1729
|
-
const columnMap = (0,
|
|
1730
|
-
const rowIndex = (0,
|
|
1672
|
+
const columnMap = (0, import_vuu_utils16.buildColumnMap)(columns);
|
|
1673
|
+
const rowIndex = (0, import_vuu_utils16.getIndexFromRowElement)(rowEl);
|
|
1731
1674
|
const cellIndex = Array.from(rowEl.childNodes).indexOf(cellEl);
|
|
1732
1675
|
const row = data.find(([idx]) => idx === rowIndex);
|
|
1733
1676
|
const columnName = columns[cellIndex];
|
|
@@ -1746,12 +1689,12 @@ var useTableContextMenu = ({
|
|
|
1746
1689
|
};
|
|
1747
1690
|
|
|
1748
1691
|
// ../vuu-table/src/useTableModel.ts
|
|
1749
|
-
var
|
|
1692
|
+
var import_vuu_utils17 = require("@vuu-ui/vuu-utils");
|
|
1750
1693
|
var import_vuu_ui_controls = require("@vuu-ui/vuu-ui-controls");
|
|
1751
1694
|
var import_react19 = require("react");
|
|
1752
|
-
var { info } = (0,
|
|
1695
|
+
var { info } = (0, import_vuu_utils17.logger)("useTableModel");
|
|
1753
1696
|
var DEFAULT_COLUMN_WIDTH = 100;
|
|
1754
|
-
var KEY_OFFSET =
|
|
1697
|
+
var KEY_OFFSET = import_vuu_utils17.metadataKeys.count;
|
|
1755
1698
|
var columnWithoutDataType = ({ serverDataType }) => serverDataType === void 0;
|
|
1756
1699
|
var getDataType = (column, tableSchema) => {
|
|
1757
1700
|
const schemaColumn = tableSchema == null ? void 0 : tableSchema.columns.find(
|
|
@@ -1807,13 +1750,13 @@ var useTableModel = (tableConfigProp, dataSource) => {
|
|
|
1807
1750
|
function init({ dataSource, tableConfig }) {
|
|
1808
1751
|
const { columns, ...tableAttributes } = tableConfig;
|
|
1809
1752
|
const { config: dataSourceConfig, tableSchema } = dataSource;
|
|
1810
|
-
const runtimeColumns = columns.filter((0,
|
|
1753
|
+
const runtimeColumns = columns.filter((0, import_vuu_utils17.subscribedOnly)(dataSourceConfig == null ? void 0 : dataSourceConfig.columns)).map(
|
|
1811
1754
|
columnDescriptorToRuntimeColumDescriptor(tableAttributes, tableSchema)
|
|
1812
1755
|
);
|
|
1813
|
-
const maybePinnedColumns = runtimeColumns.some(
|
|
1756
|
+
const maybePinnedColumns = runtimeColumns.some(import_vuu_utils17.isPinned) ? (0, import_vuu_utils17.sortPinnedColumns)(runtimeColumns) : runtimeColumns;
|
|
1814
1757
|
let state = {
|
|
1815
1758
|
columns: maybePinnedColumns,
|
|
1816
|
-
headings: (0,
|
|
1759
|
+
headings: (0, import_vuu_utils17.getTableHeadings)(maybePinnedColumns),
|
|
1817
1760
|
tableConfig,
|
|
1818
1761
|
...tableAttributes
|
|
1819
1762
|
};
|
|
@@ -1841,26 +1784,26 @@ var columnDescriptorToRuntimeColumDescriptor = (tableAttributes, tableSchema) =>
|
|
|
1841
1784
|
align = getDefaultAlignment(serverDataType),
|
|
1842
1785
|
key,
|
|
1843
1786
|
name: name2,
|
|
1844
|
-
label = (0,
|
|
1787
|
+
label = (0, import_vuu_utils17.getColumnLabel)(column),
|
|
1845
1788
|
width = columnDefaultWidth,
|
|
1846
1789
|
...rest
|
|
1847
1790
|
} = column;
|
|
1848
1791
|
const runtimeColumnWithDefaults = {
|
|
1849
1792
|
...rest,
|
|
1850
1793
|
align,
|
|
1851
|
-
CellRenderer: (0,
|
|
1852
|
-
HeaderCellContentRenderer: (0,
|
|
1853
|
-
HeaderCellLabelRenderer: (0,
|
|
1854
|
-
clientSideEditValidationCheck: (0,
|
|
1794
|
+
CellRenderer: (0, import_vuu_utils17.getCellRenderer)(column),
|
|
1795
|
+
HeaderCellContentRenderer: (0, import_vuu_utils17.getColumnHeaderContentRenderer)(column),
|
|
1796
|
+
HeaderCellLabelRenderer: (0, import_vuu_utils17.getColumnHeaderLabelRenderer)(column),
|
|
1797
|
+
clientSideEditValidationCheck: (0, import_vuu_utils17.hasValidationRules)(column.type) ? (0, import_vuu_ui_controls.buildValidationChecker)(column.type.renderer.rules) : void 0,
|
|
1855
1798
|
label: getLabel(label, columnFormatHeader),
|
|
1856
1799
|
key: key != null ? key : index + KEY_OFFSET,
|
|
1857
1800
|
name: name2,
|
|
1858
1801
|
originalIdx: index,
|
|
1859
1802
|
serverDataType,
|
|
1860
|
-
valueFormatter: (0,
|
|
1803
|
+
valueFormatter: (0, import_vuu_utils17.getValueFormatter)(column, serverDataType),
|
|
1861
1804
|
width
|
|
1862
1805
|
};
|
|
1863
|
-
if ((0,
|
|
1806
|
+
if ((0, import_vuu_utils17.isGroupColumn)(runtimeColumnWithDefaults)) {
|
|
1864
1807
|
runtimeColumnWithDefaults.columns = runtimeColumnWithDefaults.columns.map(
|
|
1865
1808
|
(col) => columnDescriptorToRuntimeColumDescriptor(tableAttributes)(
|
|
1866
1809
|
col,
|
|
@@ -1957,8 +1900,8 @@ function pinColumn2(state, action) {
|
|
|
1957
1900
|
const { column, pin } = action;
|
|
1958
1901
|
const targetColumn = columns.find((col) => col.name === column.name);
|
|
1959
1902
|
if (targetColumn) {
|
|
1960
|
-
columns = (0,
|
|
1961
|
-
columns = (0,
|
|
1903
|
+
columns = (0, import_vuu_utils17.replaceColumn)(columns, { ...targetColumn, pin });
|
|
1904
|
+
columns = (0, import_vuu_utils17.sortPinnedColumns)(columns);
|
|
1962
1905
|
return {
|
|
1963
1906
|
...state,
|
|
1964
1907
|
columns
|
|
@@ -1973,26 +1916,26 @@ function updateColumnProp(state, action) {
|
|
|
1973
1916
|
const targetColumn = columns.find((col) => col.name === column.name);
|
|
1974
1917
|
if (targetColumn) {
|
|
1975
1918
|
if (align === "left" || align === "right") {
|
|
1976
|
-
columns = (0,
|
|
1919
|
+
columns = (0, import_vuu_utils17.replaceColumn)(columns, { ...targetColumn, align });
|
|
1977
1920
|
}
|
|
1978
1921
|
if (typeof label === "string") {
|
|
1979
|
-
columns = (0,
|
|
1922
|
+
columns = (0, import_vuu_utils17.replaceColumn)(columns, { ...targetColumn, label });
|
|
1980
1923
|
}
|
|
1981
1924
|
if (typeof resizing === "boolean") {
|
|
1982
|
-
columns = (0,
|
|
1925
|
+
columns = (0, import_vuu_utils17.replaceColumn)(columns, { ...targetColumn, resizing });
|
|
1983
1926
|
}
|
|
1984
1927
|
if (typeof hidden === "boolean") {
|
|
1985
|
-
columns = (0,
|
|
1928
|
+
columns = (0, import_vuu_utils17.replaceColumn)(columns, { ...targetColumn, hidden });
|
|
1986
1929
|
}
|
|
1987
1930
|
if (typeof width === "number") {
|
|
1988
|
-
columns = (0,
|
|
1931
|
+
columns = (0, import_vuu_utils17.replaceColumn)(columns, { ...targetColumn, width });
|
|
1989
1932
|
const targetConfigColumn = tableConfig.columns.find(
|
|
1990
1933
|
(col) => col.name === column.name
|
|
1991
1934
|
);
|
|
1992
1935
|
if (targetConfigColumn) {
|
|
1993
1936
|
tableConfig = {
|
|
1994
1937
|
...tableConfig,
|
|
1995
|
-
columns: (0,
|
|
1938
|
+
columns: (0, import_vuu_utils17.replaceColumn)(tableConfig.columns, {
|
|
1996
1939
|
...targetConfigColumn,
|
|
1997
1940
|
width
|
|
1998
1941
|
})
|
|
@@ -2014,30 +1957,31 @@ function updateTableConfig2(state, { confirmed, filter, groupBy, sort }) {
|
|
|
2014
1957
|
if (hasGroupBy) {
|
|
2015
1958
|
result = {
|
|
2016
1959
|
...state,
|
|
2017
|
-
columns: (0,
|
|
1960
|
+
columns: (0, import_vuu_utils17.applyGroupByToColumns)(result.columns, groupBy, confirmed)
|
|
2018
1961
|
};
|
|
2019
1962
|
}
|
|
2020
1963
|
if (hasSort) {
|
|
2021
1964
|
result = {
|
|
2022
1965
|
...state,
|
|
2023
|
-
columns: (0,
|
|
1966
|
+
columns: (0, import_vuu_utils17.applySortToColumns)(result.columns, sort)
|
|
2024
1967
|
};
|
|
2025
1968
|
}
|
|
2026
1969
|
if (hasFilter) {
|
|
2027
1970
|
result = {
|
|
2028
1971
|
...state,
|
|
2029
|
-
columns: (0,
|
|
1972
|
+
columns: (0, import_vuu_utils17.applyFilterToColumns)(result.columns, filter)
|
|
2030
1973
|
};
|
|
2031
|
-
} else if (result.columns.some(
|
|
1974
|
+
} else if (result.columns.some(import_vuu_utils17.isFilteredColumn)) {
|
|
2032
1975
|
result = {
|
|
2033
1976
|
...state,
|
|
2034
|
-
columns: (0,
|
|
1977
|
+
columns: (0, import_vuu_utils17.stripFilterFromColumns)(result.columns)
|
|
2035
1978
|
};
|
|
2036
1979
|
}
|
|
2037
1980
|
return result;
|
|
2038
1981
|
}
|
|
2039
1982
|
|
|
2040
1983
|
// ../vuu-table/src/useTableScroll.ts
|
|
1984
|
+
var import_vuu_utils18 = require("@vuu-ui/vuu-utils");
|
|
2041
1985
|
var import_react20 = require("react");
|
|
2042
1986
|
var getPctScroll = (container) => {
|
|
2043
1987
|
const { scrollLeft, scrollTop } = container;
|
|
@@ -2046,6 +1990,31 @@ var getPctScroll = (container) => {
|
|
|
2046
1990
|
const pctScrollTop = scrollTop / (scrollHeight - clientHeight);
|
|
2047
1991
|
return [pctScrollLeft, pctScrollTop];
|
|
2048
1992
|
};
|
|
1993
|
+
var noScrolling = {
|
|
1994
|
+
scrollToIndex: () => void 0,
|
|
1995
|
+
scrollToKey: () => void 0
|
|
1996
|
+
};
|
|
1997
|
+
var NO_SCROLL_NECESSARY = [void 0, void 0];
|
|
1998
|
+
var howFarIsRowOutsideViewport = (rowEl, totalHeaderHeight, contentContainer = rowEl.closest(".vuuTable-contentContainer")) => {
|
|
1999
|
+
if (contentContainer) {
|
|
2000
|
+
const viewport = contentContainer == null ? void 0 : contentContainer.getBoundingClientRect();
|
|
2001
|
+
const upperBoundary = viewport.top + totalHeaderHeight;
|
|
2002
|
+
const row = rowEl.getBoundingClientRect();
|
|
2003
|
+
if (row) {
|
|
2004
|
+
if (row.bottom > viewport.bottom) {
|
|
2005
|
+
return ["down", row.bottom - viewport.bottom];
|
|
2006
|
+
} else if (row.top < upperBoundary) {
|
|
2007
|
+
return ["up", row.top - upperBoundary];
|
|
2008
|
+
} else {
|
|
2009
|
+
return NO_SCROLL_NECESSARY;
|
|
2010
|
+
}
|
|
2011
|
+
} else {
|
|
2012
|
+
throw Error("Whats going on, row not found");
|
|
2013
|
+
}
|
|
2014
|
+
} else {
|
|
2015
|
+
throw Error("Whats going on, scrollbar container not found");
|
|
2016
|
+
}
|
|
2017
|
+
};
|
|
2049
2018
|
var useCallbackRef = ({
|
|
2050
2019
|
onAttach,
|
|
2051
2020
|
onDetach
|
|
@@ -2067,17 +2036,37 @@ var useCallbackRef = ({
|
|
|
2067
2036
|
return callbackRef;
|
|
2068
2037
|
};
|
|
2069
2038
|
var useTableScroll = ({
|
|
2070
|
-
|
|
2071
|
-
maxScrollTop,
|
|
2039
|
+
getRowAtPosition,
|
|
2072
2040
|
onHorizontalScroll,
|
|
2073
2041
|
onVerticalScroll,
|
|
2074
|
-
|
|
2075
|
-
|
|
2042
|
+
scrollingApiRef,
|
|
2043
|
+
setRange,
|
|
2044
|
+
viewportMeasurements
|
|
2076
2045
|
}) => {
|
|
2046
|
+
const firstRowRef = (0, import_react20.useRef)(0);
|
|
2077
2047
|
const contentContainerScrolledRef = (0, import_react20.useRef)(false);
|
|
2078
2048
|
const scrollPosRef = (0, import_react20.useRef)({ scrollTop: 0, scrollLeft: 0 });
|
|
2079
2049
|
const scrollbarContainerRef = (0, import_react20.useRef)(null);
|
|
2080
2050
|
const contentContainerRef = (0, import_react20.useRef)(null);
|
|
2051
|
+
const {
|
|
2052
|
+
appliedPageSize,
|
|
2053
|
+
isVirtualScroll,
|
|
2054
|
+
maxScrollContainerScrollHorizontal: maxScrollLeft,
|
|
2055
|
+
maxScrollContainerScrollVertical: maxScrollTop,
|
|
2056
|
+
rowCount: viewportRowCount,
|
|
2057
|
+
totalHeaderHeight
|
|
2058
|
+
} = viewportMeasurements;
|
|
2059
|
+
const handleVerticalScroll = (0, import_react20.useCallback)(
|
|
2060
|
+
(scrollTop, pctScrollTop) => {
|
|
2061
|
+
onVerticalScroll == null ? void 0 : onVerticalScroll(scrollTop, pctScrollTop);
|
|
2062
|
+
const firstRow = getRowAtPosition(scrollTop);
|
|
2063
|
+
if (firstRow !== firstRowRef.current) {
|
|
2064
|
+
firstRowRef.current = firstRow;
|
|
2065
|
+
setRange({ from: firstRow, to: firstRow + viewportRowCount + 1 });
|
|
2066
|
+
}
|
|
2067
|
+
},
|
|
2068
|
+
[getRowAtPosition, onVerticalScroll, setRange, viewportRowCount]
|
|
2069
|
+
);
|
|
2081
2070
|
const handleScrollbarContainerScroll = (0, import_react20.useCallback)(() => {
|
|
2082
2071
|
const { current: contentContainer } = contentContainerRef;
|
|
2083
2072
|
const { current: scrollbarContainer } = scrollbarContainerRef;
|
|
@@ -2087,7 +2076,7 @@ var useTableScroll = ({
|
|
|
2087
2076
|
} else if (contentContainer && scrollbarContainer) {
|
|
2088
2077
|
const [pctScrollLeft, pctScrollTop] = getPctScroll(scrollbarContainer);
|
|
2089
2078
|
const rootScrollLeft = Math.round(pctScrollLeft * maxScrollLeft);
|
|
2090
|
-
const rootScrollTop =
|
|
2079
|
+
const rootScrollTop = pctScrollTop * maxScrollTop;
|
|
2091
2080
|
contentContainer.scrollTo({
|
|
2092
2081
|
left: rootScrollLeft,
|
|
2093
2082
|
top: rootScrollTop,
|
|
@@ -2104,17 +2093,17 @@ var useTableScroll = ({
|
|
|
2104
2093
|
const [pctScrollLeft, pctScrollTop] = getPctScroll(contentContainer);
|
|
2105
2094
|
contentContainerScrolledRef.current = true;
|
|
2106
2095
|
scrollbarContainer.scrollLeft = Math.round(pctScrollLeft * maxScrollLeft);
|
|
2107
|
-
scrollbarContainer.scrollTop =
|
|
2096
|
+
scrollbarContainer.scrollTop = pctScrollTop * maxScrollTop;
|
|
2108
2097
|
if (scrollPos.scrollTop !== scrollTop) {
|
|
2109
2098
|
scrollPos.scrollTop = scrollTop;
|
|
2110
|
-
|
|
2099
|
+
handleVerticalScroll(scrollTop, pctScrollTop);
|
|
2111
2100
|
}
|
|
2112
2101
|
if (scrollPos.scrollLeft !== scrollLeft) {
|
|
2113
2102
|
scrollPos.scrollLeft = scrollLeft;
|
|
2114
2103
|
onHorizontalScroll == null ? void 0 : onHorizontalScroll(scrollLeft);
|
|
2115
2104
|
}
|
|
2116
2105
|
}
|
|
2117
|
-
}, [maxScrollLeft, maxScrollTop, onHorizontalScroll
|
|
2106
|
+
}, [handleVerticalScroll, maxScrollLeft, maxScrollTop, onHorizontalScroll]);
|
|
2118
2107
|
const handleAttachScrollbarContainer = (0, import_react20.useCallback)(
|
|
2119
2108
|
(el) => {
|
|
2120
2109
|
scrollbarContainerRef.current = el;
|
|
@@ -2161,37 +2150,60 @@ var useTableScroll = ({
|
|
|
2161
2150
|
if (scrollbarContainer) {
|
|
2162
2151
|
const { scrollLeft, scrollTop } = scrollbarContainer;
|
|
2163
2152
|
contentContainerScrolledRef.current = false;
|
|
2164
|
-
if (scrollRequest.type === "scroll-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
newScrollLeft = Math.min(
|
|
2174
|
-
Math.max(0, scrollLeft + scrollRequest.distance),
|
|
2175
|
-
maxScrollLeft
|
|
2153
|
+
if (scrollRequest.type === "scroll-row") {
|
|
2154
|
+
const activeRow = (0, import_vuu_utils18.getRowElementAtIndex)(
|
|
2155
|
+
scrollbarContainer,
|
|
2156
|
+
scrollRequest.rowIndex
|
|
2157
|
+
);
|
|
2158
|
+
if (activeRow !== null) {
|
|
2159
|
+
const [direction, distance] = howFarIsRowOutsideViewport(
|
|
2160
|
+
activeRow,
|
|
2161
|
+
totalHeaderHeight
|
|
2176
2162
|
);
|
|
2163
|
+
if (direction && distance) {
|
|
2164
|
+
if (isVirtualScroll) {
|
|
2165
|
+
console.log(
|
|
2166
|
+
`virtual scroll row required ${direction} ${distance}
|
|
2167
|
+
first Row ${firstRowRef.current}`
|
|
2168
|
+
);
|
|
2169
|
+
} else {
|
|
2170
|
+
let newScrollLeft = scrollLeft;
|
|
2171
|
+
let newScrollTop = scrollTop;
|
|
2172
|
+
if (direction === "up" || direction === "down") {
|
|
2173
|
+
newScrollTop = Math.min(
|
|
2174
|
+
Math.max(0, scrollTop + distance),
|
|
2175
|
+
maxScrollTop
|
|
2176
|
+
);
|
|
2177
|
+
} else {
|
|
2178
|
+
newScrollLeft = Math.min(
|
|
2179
|
+
Math.max(0, scrollLeft + distance),
|
|
2180
|
+
maxScrollLeft
|
|
2181
|
+
);
|
|
2182
|
+
}
|
|
2183
|
+
scrollbarContainer.scrollTo({
|
|
2184
|
+
top: newScrollTop,
|
|
2185
|
+
left: newScrollLeft,
|
|
2186
|
+
behavior: "smooth"
|
|
2187
|
+
});
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2177
2190
|
}
|
|
2178
|
-
scrollbarContainer.scrollTo({
|
|
2179
|
-
top: newScrollTop,
|
|
2180
|
-
left: newScrollLeft,
|
|
2181
|
-
behavior: "smooth"
|
|
2182
|
-
});
|
|
2183
2191
|
} else if (scrollRequest.type === "scroll-page") {
|
|
2184
2192
|
const { direction } = scrollRequest;
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2193
|
+
if (isVirtualScroll) {
|
|
2194
|
+
console.log(`need a virtual page scroll`);
|
|
2195
|
+
} else {
|
|
2196
|
+
const scrollBy = direction === "down" ? appliedPageSize : -appliedPageSize;
|
|
2197
|
+
const newScrollTop = Math.min(
|
|
2198
|
+
Math.max(0, scrollTop + scrollBy),
|
|
2199
|
+
maxScrollTop
|
|
2200
|
+
);
|
|
2201
|
+
scrollbarContainer.scrollTo({
|
|
2202
|
+
top: newScrollTop,
|
|
2203
|
+
left: scrollLeft,
|
|
2204
|
+
behavior: "auto"
|
|
2205
|
+
});
|
|
2206
|
+
}
|
|
2195
2207
|
} else if (scrollRequest.type === "scroll-end") {
|
|
2196
2208
|
const { direction } = scrollRequest;
|
|
2197
2209
|
const scrollTo = direction === "end" ? maxScrollTop : 0;
|
|
@@ -2203,8 +2215,46 @@ var useTableScroll = ({
|
|
|
2203
2215
|
}
|
|
2204
2216
|
}
|
|
2205
2217
|
},
|
|
2206
|
-
[
|
|
2218
|
+
[
|
|
2219
|
+
appliedPageSize,
|
|
2220
|
+
isVirtualScroll,
|
|
2221
|
+
maxScrollLeft,
|
|
2222
|
+
maxScrollTop,
|
|
2223
|
+
setRange,
|
|
2224
|
+
totalHeaderHeight,
|
|
2225
|
+
viewportRowCount
|
|
2226
|
+
]
|
|
2227
|
+
);
|
|
2228
|
+
const scrollHandles = (0, import_react20.useMemo)(
|
|
2229
|
+
() => ({
|
|
2230
|
+
scrollToIndex: (rowIndex) => {
|
|
2231
|
+
if (scrollbarContainerRef.current) {
|
|
2232
|
+
const scrollPos = (rowIndex - 30) * 20;
|
|
2233
|
+
scrollbarContainerRef.current.scrollTop = scrollPos;
|
|
2234
|
+
}
|
|
2235
|
+
},
|
|
2236
|
+
scrollToKey: (rowKey) => {
|
|
2237
|
+
console.log(`scrollToKey ${rowKey}`);
|
|
2238
|
+
}
|
|
2239
|
+
}),
|
|
2240
|
+
[]
|
|
2207
2241
|
);
|
|
2242
|
+
(0, import_react20.useImperativeHandle)(
|
|
2243
|
+
scrollingApiRef,
|
|
2244
|
+
() => {
|
|
2245
|
+
if (scrollbarContainerRef.current) {
|
|
2246
|
+
return scrollHandles;
|
|
2247
|
+
} else {
|
|
2248
|
+
return noScrolling;
|
|
2249
|
+
}
|
|
2250
|
+
},
|
|
2251
|
+
[scrollHandles]
|
|
2252
|
+
);
|
|
2253
|
+
(0, import_react20.useEffect)(() => {
|
|
2254
|
+
const { current: from } = firstRowRef;
|
|
2255
|
+
const rowRange = { from, to: from + viewportRowCount + 1 };
|
|
2256
|
+
setRange(rowRange);
|
|
2257
|
+
}, [setRange, viewportRowCount]);
|
|
2208
2258
|
return {
|
|
2209
2259
|
/** Ref to be assigned to ScrollbarContainer */
|
|
2210
2260
|
scrollbarContainerRef: scrollbarContainerCallbackRef,
|
|
@@ -2217,14 +2267,16 @@ var useTableScroll = ({
|
|
|
2217
2267
|
|
|
2218
2268
|
// ../vuu-table/src/useTableViewport.ts
|
|
2219
2269
|
var import_react21 = require("react");
|
|
2220
|
-
var
|
|
2221
|
-
var MAX_RAW_ROWS =
|
|
2270
|
+
var import_vuu_utils19 = require("@vuu-ui/vuu-utils");
|
|
2271
|
+
var MAX_RAW_ROWS = 1e5;
|
|
2222
2272
|
var UNMEASURED_VIEWPORT = {
|
|
2273
|
+
appliedPageSize: 0,
|
|
2223
2274
|
contentHeight: 0,
|
|
2224
2275
|
contentWidth: 0,
|
|
2225
2276
|
getRowAtPosition: () => -1,
|
|
2226
2277
|
getRowOffset: () => -1,
|
|
2227
2278
|
horizontalScrollbarHeight: 0,
|
|
2279
|
+
isVirtualScroll: false,
|
|
2228
2280
|
maxScrollContainerScrollHorizontal: 0,
|
|
2229
2281
|
maxScrollContainerScrollVertical: 0,
|
|
2230
2282
|
pinnedWidthLeft: 0,
|
|
@@ -2265,57 +2317,58 @@ var useTableViewport = ({
|
|
|
2265
2317
|
size
|
|
2266
2318
|
}) => {
|
|
2267
2319
|
const pctScrollTopRef = (0, import_react21.useRef)(0);
|
|
2268
|
-
const
|
|
2269
|
-
const appliedContentHeight = appliedRowCount * rowHeight;
|
|
2320
|
+
const pixelContentHeight = rowHeight * Math.min(rowCount, MAX_RAW_ROWS);
|
|
2270
2321
|
const virtualContentHeight = rowCount * rowHeight;
|
|
2271
|
-
const virtualisedExtent = virtualContentHeight -
|
|
2322
|
+
const virtualisedExtent = virtualContentHeight - pixelContentHeight;
|
|
2272
2323
|
const { pinnedWidthLeft, pinnedWidthRight, unpinnedWidth } = (0, import_react21.useMemo)(
|
|
2273
2324
|
() => measurePinnedColumns(columns),
|
|
2274
2325
|
[columns]
|
|
2275
2326
|
);
|
|
2276
|
-
const
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
);
|
|
2280
|
-
const [getRowOffset, getRowAtPosition] = (0, import_react21.useMemo)(() => {
|
|
2327
|
+
const totalHeaderHeightRef = (0, import_react21.useRef)(headerHeight);
|
|
2328
|
+
(0, import_react21.useMemo)(() => {
|
|
2329
|
+
totalHeaderHeightRef.current = headerHeight * (1 + headings.length);
|
|
2330
|
+
}, [headerHeight, headings.length]);
|
|
2331
|
+
const [getRowOffset, getRowAtPosition, isVirtualScroll] = (0, import_react21.useMemo)(() => {
|
|
2281
2332
|
if (virtualisedExtent) {
|
|
2282
|
-
return (0,
|
|
2333
|
+
return (0, import_vuu_utils19.virtualRowPositioning)(
|
|
2283
2334
|
rowHeight,
|
|
2284
2335
|
virtualisedExtent,
|
|
2285
2336
|
pctScrollTopRef
|
|
2286
2337
|
);
|
|
2287
2338
|
} else {
|
|
2288
|
-
return
|
|
2339
|
+
return (0, import_vuu_utils19.actualRowPositioning)(rowHeight);
|
|
2289
2340
|
}
|
|
2290
|
-
}, [
|
|
2341
|
+
}, [virtualisedExtent, rowHeight]);
|
|
2291
2342
|
const setPctScrollTop = (0, import_react21.useCallback)((scrollPct) => {
|
|
2292
2343
|
pctScrollTopRef.current = scrollPct;
|
|
2293
2344
|
}, []);
|
|
2294
2345
|
return (0, import_react21.useMemo)(() => {
|
|
2295
2346
|
var _a;
|
|
2296
2347
|
if (size) {
|
|
2297
|
-
const
|
|
2348
|
+
const { current: totalHeaderHeight } = totalHeaderHeightRef;
|
|
2298
2349
|
const scrollbarSize = 15;
|
|
2299
2350
|
const contentWidth = pinnedWidthLeft + unpinnedWidth + pinnedWidthRight;
|
|
2300
2351
|
const horizontalScrollbarHeight = contentWidth > size.width ? scrollbarSize : 0;
|
|
2301
|
-
const
|
|
2302
|
-
const maxScrollContainerScrollVertical = appliedContentHeight - (((_a = size == null ? void 0 : size.height) != null ? _a : 0) - horizontalScrollbarHeight) + totalHeaderHeight;
|
|
2352
|
+
const maxScrollContainerScrollVertical = pixelContentHeight - (((_a = size == null ? void 0 : size.height) != null ? _a : 0) - horizontalScrollbarHeight) + totalHeaderHeight;
|
|
2303
2353
|
const maxScrollContainerScrollHorizontal = contentWidth - size.width + pinnedWidthLeft;
|
|
2304
2354
|
const visibleRows = (size.height - headerHeight) / rowHeight;
|
|
2305
|
-
const count = Number.isInteger(visibleRows) ? visibleRows
|
|
2355
|
+
const count = Number.isInteger(visibleRows) ? visibleRows : Math.ceil(visibleRows);
|
|
2306
2356
|
const viewportBodyHeight = size.height - totalHeaderHeight;
|
|
2307
|
-
const verticalScrollbarWidth =
|
|
2357
|
+
const verticalScrollbarWidth = pixelContentHeight > viewportBodyHeight ? scrollbarSize : 0;
|
|
2358
|
+
const appliedPageSize = count * rowHeight * (pixelContentHeight / virtualContentHeight);
|
|
2308
2359
|
return {
|
|
2309
|
-
|
|
2360
|
+
appliedPageSize,
|
|
2361
|
+
contentHeight: pixelContentHeight,
|
|
2362
|
+
contentWidth,
|
|
2310
2363
|
getRowAtPosition,
|
|
2311
2364
|
getRowOffset,
|
|
2365
|
+
isVirtualScroll,
|
|
2312
2366
|
horizontalScrollbarHeight,
|
|
2313
2367
|
maxScrollContainerScrollHorizontal,
|
|
2314
2368
|
maxScrollContainerScrollVertical,
|
|
2315
2369
|
pinnedWidthLeft,
|
|
2316
2370
|
pinnedWidthRight,
|
|
2317
2371
|
rowCount: count,
|
|
2318
|
-
contentWidth,
|
|
2319
2372
|
setPctScrollTop,
|
|
2320
2373
|
totalHeaderHeight,
|
|
2321
2374
|
verticalScrollbarWidth,
|
|
@@ -2325,53 +2378,25 @@ var useTableViewport = ({
|
|
|
2325
2378
|
return UNMEASURED_VIEWPORT;
|
|
2326
2379
|
}
|
|
2327
2380
|
}, [
|
|
2328
|
-
|
|
2329
|
-
|
|
2381
|
+
getRowAtPosition,
|
|
2382
|
+
getRowOffset,
|
|
2383
|
+
headerHeight,
|
|
2384
|
+
isVirtualScroll,
|
|
2330
2385
|
pinnedWidthLeft,
|
|
2331
2386
|
unpinnedWidth,
|
|
2332
2387
|
pinnedWidthRight,
|
|
2333
|
-
|
|
2334
|
-
headerHeight,
|
|
2388
|
+
pixelContentHeight,
|
|
2335
2389
|
rowHeight,
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2390
|
+
setPctScrollTop,
|
|
2391
|
+
size,
|
|
2392
|
+
virtualContentHeight
|
|
2339
2393
|
]);
|
|
2340
2394
|
};
|
|
2341
2395
|
|
|
2342
|
-
// ../vuu-table/src/useVirtualViewport.ts
|
|
2343
|
-
var import_react22 = require("react");
|
|
2344
|
-
var useVirtualViewport = ({
|
|
2345
|
-
getRowAtPosition,
|
|
2346
|
-
setRange,
|
|
2347
|
-
viewportMeasurements
|
|
2348
|
-
}) => {
|
|
2349
|
-
const firstRowRef = (0, import_react22.useRef)(0);
|
|
2350
|
-
const { rowCount: viewportRowCount } = viewportMeasurements;
|
|
2351
|
-
const handleVerticalScroll = (0, import_react22.useCallback)(
|
|
2352
|
-
(scrollTop) => {
|
|
2353
|
-
const firstRow = getRowAtPosition(scrollTop);
|
|
2354
|
-
if (firstRow !== firstRowRef.current) {
|
|
2355
|
-
firstRowRef.current = firstRow;
|
|
2356
|
-
setRange({ from: firstRow, to: firstRow + viewportRowCount });
|
|
2357
|
-
}
|
|
2358
|
-
},
|
|
2359
|
-
[getRowAtPosition, setRange, viewportRowCount]
|
|
2360
|
-
);
|
|
2361
|
-
(0, import_react22.useEffect)(() => {
|
|
2362
|
-
const { current: from } = firstRowRef;
|
|
2363
|
-
const rowRange = { from, to: from + viewportRowCount };
|
|
2364
|
-
setRange(rowRange);
|
|
2365
|
-
}, [setRange, viewportRowCount]);
|
|
2366
|
-
return {
|
|
2367
|
-
onVerticalScroll: handleVerticalScroll
|
|
2368
|
-
};
|
|
2369
|
-
};
|
|
2370
|
-
|
|
2371
2396
|
// ../vuu-table/src/useTableAndColumnSettings.ts
|
|
2372
2397
|
var import_vuu_layout2 = require("@vuu-ui/vuu-layout");
|
|
2373
|
-
var
|
|
2374
|
-
var
|
|
2398
|
+
var import_vuu_utils20 = require("@vuu-ui/vuu-utils");
|
|
2399
|
+
var import_react22 = require("react");
|
|
2375
2400
|
var useTableAndColumnSettings = ({
|
|
2376
2401
|
availableColumns: availableColumnsProps,
|
|
2377
2402
|
onAvailableColumnsChange,
|
|
@@ -2381,11 +2406,11 @@ var useTableAndColumnSettings = ({
|
|
|
2381
2406
|
tableConfig
|
|
2382
2407
|
}) => {
|
|
2383
2408
|
const dispatchLayoutAction = (0, import_vuu_layout2.useLayoutProviderDispatch)();
|
|
2384
|
-
const showTableSettingsRef = (0,
|
|
2385
|
-
const [availableColumns, setAvailableColumns] = (0,
|
|
2409
|
+
const showTableSettingsRef = (0, import_react22.useRef)();
|
|
2410
|
+
const [availableColumns, setAvailableColumns] = (0, import_react22.useState)(
|
|
2386
2411
|
availableColumnsProps
|
|
2387
2412
|
);
|
|
2388
|
-
const showContextPanel = (0,
|
|
2413
|
+
const showContextPanel = (0, import_react22.useCallback)(
|
|
2389
2414
|
(componentType, title, props) => {
|
|
2390
2415
|
dispatchLayoutAction({
|
|
2391
2416
|
type: "set-props",
|
|
@@ -2402,17 +2427,17 @@ var useTableAndColumnSettings = ({
|
|
|
2402
2427
|
},
|
|
2403
2428
|
[dispatchLayoutAction]
|
|
2404
2429
|
);
|
|
2405
|
-
const handleCancelCreateColumn = (0,
|
|
2430
|
+
const handleCancelCreateColumn = (0, import_react22.useCallback)(() => {
|
|
2406
2431
|
requestAnimationFrame(() => {
|
|
2407
2432
|
var _a;
|
|
2408
2433
|
(_a = showTableSettingsRef.current) == null ? void 0 : _a.call(showTableSettingsRef);
|
|
2409
2434
|
});
|
|
2410
2435
|
}, []);
|
|
2411
|
-
const handleCreateCalculatedColumn = (0,
|
|
2436
|
+
const handleCreateCalculatedColumn = (0, import_react22.useCallback)(
|
|
2412
2437
|
(column) => {
|
|
2413
2438
|
const newAvailableColumns = availableColumns.concat({
|
|
2414
2439
|
name: column.name,
|
|
2415
|
-
serverDataType: (0,
|
|
2440
|
+
serverDataType: (0, import_vuu_utils20.getCalculatedColumnType)(column)
|
|
2416
2441
|
});
|
|
2417
2442
|
setAvailableColumns(newAvailableColumns);
|
|
2418
2443
|
onAvailableColumnsChange == null ? void 0 : onAvailableColumnsChange(newAvailableColumns);
|
|
@@ -2424,7 +2449,7 @@ var useTableAndColumnSettings = ({
|
|
|
2424
2449
|
},
|
|
2425
2450
|
[availableColumns, onAvailableColumnsChange, onCreateCalculatedColumn]
|
|
2426
2451
|
);
|
|
2427
|
-
const showColumnSettingsPanel = (0,
|
|
2452
|
+
const showColumnSettingsPanel = (0, import_react22.useCallback)(
|
|
2428
2453
|
(action) => {
|
|
2429
2454
|
showContextPanel("ColumnSettings", "Column Settings", {
|
|
2430
2455
|
column: action.column,
|
|
@@ -2443,7 +2468,7 @@ var useTableAndColumnSettings = ({
|
|
|
2443
2468
|
tableConfig
|
|
2444
2469
|
]
|
|
2445
2470
|
);
|
|
2446
|
-
const handleAddCalculatedColumn = (0,
|
|
2471
|
+
const handleAddCalculatedColumn = (0, import_react22.useCallback)(() => {
|
|
2447
2472
|
showColumnSettingsPanel({
|
|
2448
2473
|
column: {
|
|
2449
2474
|
name: "::",
|
|
@@ -2453,7 +2478,7 @@ var useTableAndColumnSettings = ({
|
|
|
2453
2478
|
vuuTable: { module: "SIMUL", table: "instruments" }
|
|
2454
2479
|
});
|
|
2455
2480
|
}, [showColumnSettingsPanel]);
|
|
2456
|
-
const handleNavigateToColumn = (0,
|
|
2481
|
+
const handleNavigateToColumn = (0, import_react22.useCallback)(
|
|
2457
2482
|
(columnName) => {
|
|
2458
2483
|
const column = tableConfig.columns.find((c) => c.name === columnName);
|
|
2459
2484
|
if (column) {
|
|
@@ -2467,7 +2492,7 @@ var useTableAndColumnSettings = ({
|
|
|
2467
2492
|
},
|
|
2468
2493
|
[showColumnSettingsPanel, tableConfig.columns]
|
|
2469
2494
|
);
|
|
2470
|
-
showTableSettingsRef.current = (0,
|
|
2495
|
+
showTableSettingsRef.current = (0, import_react22.useCallback)(() => {
|
|
2471
2496
|
showContextPanel("TableSettings", "DataGrid Settings", {
|
|
2472
2497
|
availableColumns: availableColumns != null ? availableColumns : tableConfig.columns.map(({ name: name2, serverDataType }) => ({
|
|
2473
2498
|
name: name2,
|
|
@@ -2498,7 +2523,7 @@ var useTableAndColumnSettings = ({
|
|
|
2498
2523
|
var stripInternalProperties = (tableConfig) => {
|
|
2499
2524
|
return tableConfig;
|
|
2500
2525
|
};
|
|
2501
|
-
var { KEY, IS_EXPANDED: IS_EXPANDED2, IS_LEAF: IS_LEAF2 } =
|
|
2526
|
+
var { KEY, IS_EXPANDED: IS_EXPANDED2, IS_LEAF: IS_LEAF2 } = import_vuu_utils21.metadataKeys;
|
|
2502
2527
|
var NULL_DRAG_DROP = {
|
|
2503
2528
|
draggable: void 0,
|
|
2504
2529
|
onMouseDown: void 0
|
|
@@ -2530,19 +2555,20 @@ var useTable = ({
|
|
|
2530
2555
|
onSelectionChange,
|
|
2531
2556
|
renderBufferSize = 0,
|
|
2532
2557
|
rowHeight = 20,
|
|
2558
|
+
scrollingApiRef,
|
|
2533
2559
|
selectionModel,
|
|
2534
2560
|
size
|
|
2535
2561
|
}) => {
|
|
2536
|
-
const [rowCount, setRowCount] = (0,
|
|
2562
|
+
const [rowCount, setRowCount] = (0, import_react23.useState)(dataSource.size);
|
|
2537
2563
|
if (dataSource === void 0) {
|
|
2538
2564
|
throw Error("no data source provided to Vuu Table");
|
|
2539
2565
|
}
|
|
2540
|
-
const useRowDragDrop = allowDragDrop ? import_vuu_ui_controls2.
|
|
2541
|
-
const menuBuilder = (0,
|
|
2566
|
+
const useRowDragDrop = allowDragDrop ? import_vuu_ui_controls2.useDragDrop : useNullDragDrop;
|
|
2567
|
+
const menuBuilder = (0, import_react23.useMemo)(
|
|
2542
2568
|
() => buildContextMenuDescriptors(dataSource),
|
|
2543
2569
|
[dataSource]
|
|
2544
2570
|
);
|
|
2545
|
-
const onDataRowcountChange = (0,
|
|
2571
|
+
const onDataRowcountChange = (0, import_react23.useCallback)((size2) => {
|
|
2546
2572
|
setRowCount(size2);
|
|
2547
2573
|
}, []);
|
|
2548
2574
|
const {
|
|
@@ -2552,14 +2578,14 @@ var useTable = ({
|
|
|
2552
2578
|
tableAttributes,
|
|
2553
2579
|
tableConfig
|
|
2554
2580
|
} = useTableModel(config, dataSource);
|
|
2555
|
-
(0,
|
|
2581
|
+
(0, import_vuu_utils21.useLayoutEffectSkipFirst)(() => {
|
|
2556
2582
|
dispatchColumnAction({
|
|
2557
2583
|
type: "init",
|
|
2558
2584
|
dataSource,
|
|
2559
2585
|
tableConfig
|
|
2560
2586
|
});
|
|
2561
2587
|
}, [tableConfig, dataSource, dispatchColumnAction]);
|
|
2562
|
-
const applyTableConfigChange = (0,
|
|
2588
|
+
const applyTableConfigChange = (0, import_react23.useCallback)(
|
|
2563
2589
|
(config2) => {
|
|
2564
2590
|
dispatchColumnAction({
|
|
2565
2591
|
type: "init",
|
|
@@ -2570,16 +2596,16 @@ var useTable = ({
|
|
|
2570
2596
|
},
|
|
2571
2597
|
[dataSource, dispatchColumnAction, onConfigChange]
|
|
2572
2598
|
);
|
|
2573
|
-
const [stateColumns, setStateColumns] = (0,
|
|
2574
|
-
const [columns, setColumnSize] = (0,
|
|
2599
|
+
const [stateColumns, setStateColumns] = (0, import_react23.useState)();
|
|
2600
|
+
const [columns, setColumnSize] = (0, import_react23.useMemo)(() => {
|
|
2575
2601
|
const setSize = (columnName, width) => {
|
|
2576
|
-
const cols = (0,
|
|
2602
|
+
const cols = (0, import_vuu_utils21.updateColumn)(runtimeColumns, columnName, { width });
|
|
2577
2603
|
setStateColumns(cols);
|
|
2578
2604
|
};
|
|
2579
2605
|
return [stateColumns != null ? stateColumns : runtimeColumns, setSize];
|
|
2580
2606
|
}, [runtimeColumns, stateColumns]);
|
|
2581
|
-
const columnMap = (0,
|
|
2582
|
-
() => (0,
|
|
2607
|
+
const columnMap = (0, import_react23.useMemo)(
|
|
2608
|
+
() => (0, import_vuu_utils21.buildColumnMap)(dataSource.columns),
|
|
2583
2609
|
[dataSource.columns]
|
|
2584
2610
|
);
|
|
2585
2611
|
const {
|
|
@@ -2597,9 +2623,9 @@ var useTable = ({
|
|
|
2597
2623
|
});
|
|
2598
2624
|
const initialRange = useInitialValue({
|
|
2599
2625
|
from: 0,
|
|
2600
|
-
to: viewportMeasurements.rowCount
|
|
2626
|
+
to: viewportMeasurements.rowCount === 0 ? 0 : viewportMeasurements.rowCount + 1
|
|
2601
2627
|
});
|
|
2602
|
-
const onSubscribed = (0,
|
|
2628
|
+
const onSubscribed = (0, import_react23.useCallback)(
|
|
2603
2629
|
({ tableSchema }) => {
|
|
2604
2630
|
if (tableSchema) {
|
|
2605
2631
|
dispatchColumnAction({
|
|
@@ -2621,9 +2647,8 @@ var useTable = ({
|
|
|
2621
2647
|
onSubscribed,
|
|
2622
2648
|
range: initialRange
|
|
2623
2649
|
});
|
|
2624
|
-
const handleConfigEditedInSettingsPanel = (0,
|
|
2650
|
+
const handleConfigEditedInSettingsPanel = (0, import_react23.useCallback)(
|
|
2625
2651
|
(tableConfig2) => {
|
|
2626
|
-
console.log(`settings changed`);
|
|
2627
2652
|
dispatchColumnAction({
|
|
2628
2653
|
type: "init",
|
|
2629
2654
|
tableConfig: tableConfig2,
|
|
@@ -2633,7 +2658,7 @@ var useTable = ({
|
|
|
2633
2658
|
},
|
|
2634
2659
|
[dataSource, dispatchColumnAction, onConfigChange]
|
|
2635
2660
|
);
|
|
2636
|
-
const handleDataSourceConfigChanged = (0,
|
|
2661
|
+
const handleDataSourceConfigChanged = (0, import_react23.useCallback)(
|
|
2637
2662
|
(dataSourceConfig) => {
|
|
2638
2663
|
dataSource.config = {
|
|
2639
2664
|
...dataSource.config,
|
|
@@ -2642,7 +2667,7 @@ var useTable = ({
|
|
|
2642
2667
|
},
|
|
2643
2668
|
[dataSource]
|
|
2644
2669
|
);
|
|
2645
|
-
(0,
|
|
2670
|
+
(0, import_react23.useEffect)(() => {
|
|
2646
2671
|
dataSource.on("config", (config2, confirmed) => {
|
|
2647
2672
|
dispatchColumnAction({
|
|
2648
2673
|
type: "tableConfig",
|
|
@@ -2651,14 +2676,14 @@ var useTable = ({
|
|
|
2651
2676
|
});
|
|
2652
2677
|
});
|
|
2653
2678
|
}, [dataSource, dispatchColumnAction]);
|
|
2654
|
-
const handleCreateCalculatedColumn = (0,
|
|
2679
|
+
const handleCreateCalculatedColumn = (0, import_react23.useCallback)(
|
|
2655
2680
|
(column) => {
|
|
2656
2681
|
dataSource.columns = dataSource.columns.concat(column.name);
|
|
2657
2682
|
applyTableConfigChange(addColumn(tableConfig, column));
|
|
2658
2683
|
},
|
|
2659
2684
|
[dataSource, tableConfig, applyTableConfigChange]
|
|
2660
2685
|
);
|
|
2661
|
-
const hideColumns2 = (0,
|
|
2686
|
+
const hideColumns2 = (0, import_react23.useCallback)(
|
|
2662
2687
|
(action) => {
|
|
2663
2688
|
const { columns: columns2 } = action;
|
|
2664
2689
|
const hiddenColumns = columns2.map((c) => c.name);
|
|
@@ -2672,11 +2697,11 @@ var useTable = ({
|
|
|
2672
2697
|
},
|
|
2673
2698
|
[tableConfig, applyTableConfigChange]
|
|
2674
2699
|
);
|
|
2675
|
-
const pinColumn3 = (0,
|
|
2700
|
+
const pinColumn3 = (0, import_react23.useCallback)(
|
|
2676
2701
|
(action) => {
|
|
2677
2702
|
applyTableConfigChange({
|
|
2678
2703
|
...tableConfig,
|
|
2679
|
-
columns: (0,
|
|
2704
|
+
columns: (0, import_vuu_utils21.updateColumn)(tableConfig.columns, {
|
|
2680
2705
|
...action.column,
|
|
2681
2706
|
pin: action.pin
|
|
2682
2707
|
})
|
|
@@ -2695,7 +2720,7 @@ var useTable = ({
|
|
|
2695
2720
|
onDataSourceConfigChange: handleDataSourceConfigChanged,
|
|
2696
2721
|
tableConfig
|
|
2697
2722
|
});
|
|
2698
|
-
const onPersistentColumnOperation = (0,
|
|
2723
|
+
const onPersistentColumnOperation = (0, import_react23.useCallback)(
|
|
2699
2724
|
(action) => {
|
|
2700
2725
|
if (isShowColumnSettings(action)) {
|
|
2701
2726
|
showColumnSettingsPanel(action);
|
|
@@ -2724,10 +2749,10 @@ var useTable = ({
|
|
|
2724
2749
|
dataSource,
|
|
2725
2750
|
onPersistentColumnOperation
|
|
2726
2751
|
});
|
|
2727
|
-
const handleSort = (0,
|
|
2752
|
+
const handleSort = (0, import_react23.useCallback)(
|
|
2728
2753
|
(column, extendSort = false, sortType) => {
|
|
2729
2754
|
if (dataSource) {
|
|
2730
|
-
dataSource.sort = (0,
|
|
2755
|
+
dataSource.sort = (0, import_vuu_utils21.applySort)(
|
|
2731
2756
|
dataSource.sort,
|
|
2732
2757
|
column,
|
|
2733
2758
|
extendSort,
|
|
@@ -2737,16 +2762,16 @@ var useTable = ({
|
|
|
2737
2762
|
},
|
|
2738
2763
|
[dataSource]
|
|
2739
2764
|
);
|
|
2740
|
-
const onResizeColumn = (0,
|
|
2765
|
+
const onResizeColumn = (0, import_react23.useCallback)(
|
|
2741
2766
|
(phase, columnName, width) => {
|
|
2742
2767
|
const column = columns.find((column2) => column2.name === columnName);
|
|
2743
2768
|
if (column) {
|
|
2744
2769
|
if (phase === "resize") {
|
|
2745
|
-
if ((0,
|
|
2770
|
+
if ((0, import_vuu_utils21.isValidNumber)(width)) {
|
|
2746
2771
|
setColumnSize(columnName, width);
|
|
2747
2772
|
}
|
|
2748
2773
|
} else if (phase === "end") {
|
|
2749
|
-
if ((0,
|
|
2774
|
+
if ((0, import_vuu_utils21.isValidNumber)(width)) {
|
|
2750
2775
|
dispatchColumnAction({
|
|
2751
2776
|
type: "resizeColumn",
|
|
2752
2777
|
phase,
|
|
@@ -2781,10 +2806,10 @@ var useTable = ({
|
|
|
2781
2806
|
},
|
|
2782
2807
|
[columns, tableConfig, dispatchColumnAction, onConfigChange, setColumnSize]
|
|
2783
2808
|
);
|
|
2784
|
-
const onToggleGroup = (0,
|
|
2809
|
+
const onToggleGroup = (0, import_react23.useCallback)(
|
|
2785
2810
|
(row, column) => {
|
|
2786
2811
|
var _a, _b;
|
|
2787
|
-
const isJson = (0,
|
|
2812
|
+
const isJson = (0, import_vuu_utils21.isJsonGroup)(column, row);
|
|
2788
2813
|
const key = row[KEY];
|
|
2789
2814
|
if (row[IS_EXPANDED2]) {
|
|
2790
2815
|
dataSource.closeTreeNode(key, true);
|
|
@@ -2818,24 +2843,19 @@ var useTable = ({
|
|
|
2818
2843
|
},
|
|
2819
2844
|
[columns, dataSource, dispatchColumnAction]
|
|
2820
2845
|
);
|
|
2821
|
-
const
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
setRange,
|
|
2825
|
-
viewportMeasurements
|
|
2826
|
-
});
|
|
2827
|
-
const handleVerticalScroll = (0, import_react24.useCallback)(
|
|
2828
|
-
(scrollTop) => {
|
|
2829
|
-
onVerticalScroll(scrollTop);
|
|
2846
|
+
const handleVerticalScroll = (0, import_react23.useCallback)(
|
|
2847
|
+
(_, pctScrollTop) => {
|
|
2848
|
+
setPctScrollTop(pctScrollTop);
|
|
2830
2849
|
},
|
|
2831
|
-
[
|
|
2850
|
+
[setPctScrollTop]
|
|
2832
2851
|
);
|
|
2833
2852
|
const { requestScroll, ...scrollProps } = useTableScroll({
|
|
2834
|
-
|
|
2835
|
-
maxScrollTop: viewportMeasurements.maxScrollContainerScrollVertical,
|
|
2853
|
+
getRowAtPosition,
|
|
2836
2854
|
rowHeight,
|
|
2855
|
+
scrollingApiRef,
|
|
2856
|
+
setRange,
|
|
2837
2857
|
onVerticalScroll: handleVerticalScroll,
|
|
2838
|
-
|
|
2858
|
+
viewportMeasurements
|
|
2839
2859
|
});
|
|
2840
2860
|
const {
|
|
2841
2861
|
highlightedIndexRef,
|
|
@@ -2863,7 +2883,7 @@ var useTable = ({
|
|
|
2863
2883
|
} = useCellEditing({
|
|
2864
2884
|
navigate
|
|
2865
2885
|
});
|
|
2866
|
-
const handleFocus = (0,
|
|
2886
|
+
const handleFocus = (0, import_react23.useCallback)(
|
|
2867
2887
|
(e) => {
|
|
2868
2888
|
navigationFocus();
|
|
2869
2889
|
if (!e.defaultPrevented) {
|
|
@@ -2878,15 +2898,15 @@ var useTable = ({
|
|
|
2878
2898
|
dataSource,
|
|
2879
2899
|
getSelectedRows
|
|
2880
2900
|
});
|
|
2881
|
-
const onMoveGroupColumn = (0,
|
|
2901
|
+
const onMoveGroupColumn = (0, import_react23.useCallback)(
|
|
2882
2902
|
(columns2) => {
|
|
2883
2903
|
dataSource.groupBy = columns2.map((col) => col.name);
|
|
2884
2904
|
},
|
|
2885
2905
|
[dataSource]
|
|
2886
2906
|
);
|
|
2887
|
-
const onRemoveGroupColumn = (0,
|
|
2907
|
+
const onRemoveGroupColumn = (0, import_react23.useCallback)(
|
|
2888
2908
|
(column) => {
|
|
2889
|
-
if ((0,
|
|
2909
|
+
if ((0, import_vuu_utils21.isGroupColumn)(column)) {
|
|
2890
2910
|
dataSource.groupBy = [];
|
|
2891
2911
|
} else {
|
|
2892
2912
|
if (dataSource && dataSource.groupBy.includes(column.name)) {
|
|
@@ -2898,7 +2918,7 @@ var useTable = ({
|
|
|
2898
2918
|
},
|
|
2899
2919
|
[dataSource]
|
|
2900
2920
|
);
|
|
2901
|
-
const handleSelectionChange = (0,
|
|
2921
|
+
const handleSelectionChange = (0, import_react23.useCallback)(
|
|
2902
2922
|
(selected) => {
|
|
2903
2923
|
dataSource.select(selected);
|
|
2904
2924
|
onSelectionChange == null ? void 0 : onSelectionChange(selected);
|
|
@@ -2914,7 +2934,7 @@ var useTable = ({
|
|
|
2914
2934
|
onSelectionChange: handleSelectionChange,
|
|
2915
2935
|
selectionModel
|
|
2916
2936
|
});
|
|
2917
|
-
const handleKeyDown = (0,
|
|
2937
|
+
const handleKeyDown = (0, import_react23.useCallback)(
|
|
2918
2938
|
(e) => {
|
|
2919
2939
|
navigationKeyDown(e);
|
|
2920
2940
|
if (!e.defaultPrevented) {
|
|
@@ -2926,21 +2946,21 @@ var useTable = ({
|
|
|
2926
2946
|
},
|
|
2927
2947
|
[navigationKeyDown, editingKeyDown, selectionHookKeyDown]
|
|
2928
2948
|
);
|
|
2929
|
-
const handleRowClick = (0,
|
|
2949
|
+
const handleRowClick = (0, import_react23.useCallback)(
|
|
2930
2950
|
(row, rangeSelect, keepExistingSelection) => {
|
|
2931
2951
|
selectionHookOnRowClick(row, rangeSelect, keepExistingSelection);
|
|
2932
2952
|
onRowClickProp == null ? void 0 : onRowClickProp(row);
|
|
2933
2953
|
},
|
|
2934
2954
|
[onRowClickProp, selectionHookOnRowClick]
|
|
2935
2955
|
);
|
|
2936
|
-
(0,
|
|
2956
|
+
(0, import_vuu_utils21.useLayoutEffectSkipFirst)(() => {
|
|
2937
2957
|
dispatchColumnAction({
|
|
2938
2958
|
type: "init",
|
|
2939
2959
|
tableConfig: config,
|
|
2940
2960
|
dataSource
|
|
2941
2961
|
});
|
|
2942
2962
|
}, [config, dataSource, dispatchColumnAction]);
|
|
2943
|
-
const onMoveColumn = (0,
|
|
2963
|
+
const onMoveColumn = (0, import_react23.useCallback)(
|
|
2944
2964
|
(columns2) => {
|
|
2945
2965
|
console.log(`useTable onMoveColumn`, {
|
|
2946
2966
|
columns: columns2
|
|
@@ -2958,20 +2978,20 @@ var useTable = ({
|
|
|
2958
2978
|
},
|
|
2959
2979
|
[dataSource, dispatchColumnAction, onConfigChange, tableConfig]
|
|
2960
2980
|
);
|
|
2961
|
-
const handleDropRow = (0,
|
|
2981
|
+
const handleDropRow = (0, import_react23.useCallback)(
|
|
2962
2982
|
(dragDropState) => {
|
|
2963
2983
|
onDrop == null ? void 0 : onDrop(dragDropState);
|
|
2964
2984
|
},
|
|
2965
2985
|
[onDrop]
|
|
2966
2986
|
);
|
|
2967
|
-
const handleDataEdited = (0,
|
|
2987
|
+
const handleDataEdited = (0, import_react23.useCallback)(
|
|
2968
2988
|
async (row, columnName, value) => dataSource.applyEdit(row, columnName, value),
|
|
2969
2989
|
[dataSource]
|
|
2970
2990
|
);
|
|
2971
|
-
const handleDragStartRow = (0,
|
|
2991
|
+
const handleDragStartRow = (0, import_react23.useCallback)(
|
|
2972
2992
|
(dragDropState) => {
|
|
2973
2993
|
const { initialDragElement } = dragDropState;
|
|
2974
|
-
const rowIndex = (0,
|
|
2994
|
+
const rowIndex = (0, import_vuu_utils21.getIndexFromRowElement)(initialDragElement);
|
|
2975
2995
|
const row = dataRef.current.find((row2) => row2[0] === rowIndex);
|
|
2976
2996
|
if (row) {
|
|
2977
2997
|
dragDropState.setPayload(row);
|
|
@@ -3003,6 +3023,7 @@ var useTable = ({
|
|
|
3003
3023
|
columnMap,
|
|
3004
3024
|
columns,
|
|
3005
3025
|
data,
|
|
3026
|
+
getRowOffset,
|
|
3006
3027
|
handleContextMenuAction,
|
|
3007
3028
|
headings,
|
|
3008
3029
|
highlightedIndex: highlightedIndexRef.current,
|
|
@@ -3025,37 +3046,37 @@ var useTable = ({
|
|
|
3025
3046
|
};
|
|
3026
3047
|
|
|
3027
3048
|
// ../vuu-table/src/table-header/TableHeader.tsx
|
|
3028
|
-
var
|
|
3049
|
+
var import_vuu_utils23 = require("@vuu-ui/vuu-utils");
|
|
3029
3050
|
var import_clsx8 = __toESM(require("clsx"));
|
|
3030
3051
|
|
|
3031
3052
|
// ../vuu-table/src/table-header/useTableHeader.ts
|
|
3032
3053
|
var import_vuu_ui_controls3 = require("@vuu-ui/vuu-ui-controls");
|
|
3033
|
-
var
|
|
3034
|
-
var
|
|
3054
|
+
var import_vuu_utils22 = require("@vuu-ui/vuu-utils");
|
|
3055
|
+
var import_react24 = require("react");
|
|
3035
3056
|
var useTableHeader = ({
|
|
3036
3057
|
columns,
|
|
3037
3058
|
onMoveColumn,
|
|
3038
3059
|
onSortColumn,
|
|
3039
3060
|
tableConfig
|
|
3040
3061
|
}) => {
|
|
3041
|
-
const containerRef = (0,
|
|
3042
|
-
const handleDropColumnHeader = (0,
|
|
3062
|
+
const containerRef = (0, import_react24.useRef)(null);
|
|
3063
|
+
const handleDropColumnHeader = (0, import_react24.useCallback)(
|
|
3043
3064
|
(moveFrom, moveTo) => {
|
|
3044
3065
|
const column = columns[moveFrom];
|
|
3045
|
-
const orderedColumns = (0,
|
|
3066
|
+
const orderedColumns = (0, import_vuu_utils22.moveColumnTo)(columns, column, moveTo);
|
|
3046
3067
|
const ofColumn = ({ name: name2 }) => (col) => col.name === name2;
|
|
3047
3068
|
const targetIndex = orderedColumns.findIndex(ofColumn(column));
|
|
3048
3069
|
const nextColumn = orderedColumns[targetIndex + 1];
|
|
3049
3070
|
const insertPos = nextColumn ? tableConfig.columns.findIndex(ofColumn(nextColumn)) : -1;
|
|
3050
3071
|
if (moveTo > moveFrom && insertPos !== -1) {
|
|
3051
|
-
onMoveColumn((0,
|
|
3072
|
+
onMoveColumn((0, import_vuu_utils22.moveColumnTo)(tableConfig.columns, column, insertPos - 1));
|
|
3052
3073
|
} else {
|
|
3053
|
-
onMoveColumn((0,
|
|
3074
|
+
onMoveColumn((0, import_vuu_utils22.moveColumnTo)(tableConfig.columns, column, insertPos));
|
|
3054
3075
|
}
|
|
3055
3076
|
},
|
|
3056
3077
|
[columns, onMoveColumn, tableConfig.columns]
|
|
3057
3078
|
);
|
|
3058
|
-
const handleColumnHeaderClick = (0,
|
|
3079
|
+
const handleColumnHeaderClick = (0, import_react24.useCallback)(
|
|
3059
3080
|
(evt) => {
|
|
3060
3081
|
var _a;
|
|
3061
3082
|
const targetElement = evt.target;
|
|
@@ -3063,7 +3084,7 @@ var useTableHeader = ({
|
|
|
3063
3084
|
".vuuTableHeaderCell"
|
|
3064
3085
|
);
|
|
3065
3086
|
const colIdx = parseInt((_a = headerCell == null ? void 0 : headerCell.dataset.index) != null ? _a : "-1");
|
|
3066
|
-
const column = (0,
|
|
3087
|
+
const column = (0, import_vuu_utils22.visibleColumnAtIndex)(columns, colIdx);
|
|
3067
3088
|
const isAdditive = evt.shiftKey;
|
|
3068
3089
|
column && onSortColumn(column, isAdditive);
|
|
3069
3090
|
},
|
|
@@ -3073,7 +3094,7 @@ var useTableHeader = ({
|
|
|
3073
3094
|
onMouseDown: columnHeaderDragMouseDown,
|
|
3074
3095
|
draggable: draggableColumn,
|
|
3075
3096
|
...dragDropHook
|
|
3076
|
-
} = (0, import_vuu_ui_controls3.
|
|
3097
|
+
} = (0, import_vuu_ui_controls3.useDragDrop)({
|
|
3077
3098
|
allowDragDrop: true,
|
|
3078
3099
|
containerRef,
|
|
3079
3100
|
draggableClassName: `vuuTable`,
|
|
@@ -3119,8 +3140,8 @@ var TableHeader = ({
|
|
|
3119
3140
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `${classBase24}-col-headings`, ref: containerRef, children: [
|
|
3120
3141
|
headings.map((colHeaders, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "vuuTable-heading", children: colHeaders.map(({ label, width }, j) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "vuuTable-headingCell", style: { width }, children: label }, j)) }, i)),
|
|
3121
3142
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `${classBase24}-col-headers`, role: "row", children: [
|
|
3122
|
-
columns.filter(
|
|
3123
|
-
(col, i) => (0,
|
|
3143
|
+
columns.filter(import_vuu_utils23.isNotHidden).map(
|
|
3144
|
+
(col, i) => (0, import_vuu_utils23.isGroupColumn)(col) ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3124
3145
|
GroupHeaderCellNext,
|
|
3125
3146
|
{
|
|
3126
3147
|
column: col,
|
|
@@ -3154,7 +3175,7 @@ var TableHeader = ({
|
|
|
3154
3175
|
// ../vuu-table/src/Table.tsx
|
|
3155
3176
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
3156
3177
|
var classBase7 = "vuuTable";
|
|
3157
|
-
var { IDX: IDX3, RENDER_IDX } =
|
|
3178
|
+
var { IDX: IDX3, RENDER_IDX } = import_vuu_utils24.metadataKeys;
|
|
3158
3179
|
var TableCore = ({
|
|
3159
3180
|
Row: Row2 = Row,
|
|
3160
3181
|
allowDragDrop,
|
|
@@ -3175,19 +3196,21 @@ var TableCore = ({
|
|
|
3175
3196
|
onRowClick: onRowClickProp,
|
|
3176
3197
|
onSelect,
|
|
3177
3198
|
onSelectionChange,
|
|
3178
|
-
renderBufferSize =
|
|
3199
|
+
renderBufferSize = 5,
|
|
3179
3200
|
rowHeight = 20,
|
|
3201
|
+
scrollingApiRef,
|
|
3180
3202
|
selectionModel = "extended",
|
|
3181
3203
|
showColumnHeaders = true,
|
|
3182
3204
|
headerHeight = showColumnHeaders ? 25 : 0,
|
|
3183
3205
|
size
|
|
3184
3206
|
}) => {
|
|
3185
|
-
const id = (0,
|
|
3207
|
+
const id = (0, import_vuu_utils24.useId)(idProp);
|
|
3186
3208
|
const {
|
|
3187
3209
|
columnMap,
|
|
3188
3210
|
columns,
|
|
3189
3211
|
data,
|
|
3190
3212
|
draggableRow,
|
|
3213
|
+
getRowOffset,
|
|
3191
3214
|
handleContextMenuAction,
|
|
3192
3215
|
headings,
|
|
3193
3216
|
highlightedIndex,
|
|
@@ -3227,10 +3250,11 @@ var TableCore = ({
|
|
|
3227
3250
|
onSelectionChange,
|
|
3228
3251
|
renderBufferSize,
|
|
3229
3252
|
rowHeight,
|
|
3253
|
+
scrollingApiRef,
|
|
3230
3254
|
selectionModel,
|
|
3231
3255
|
size
|
|
3232
3256
|
});
|
|
3233
|
-
const
|
|
3257
|
+
const contentContainerClassName = (0, import_clsx9.default)(`${classBase7}-contentContainer`, {
|
|
3234
3258
|
[`${classBase7}-colLines`]: tableAttributes.columnSeparators,
|
|
3235
3259
|
[`${classBase7}-rowLines`]: tableAttributes.rowSeparators,
|
|
3236
3260
|
// [`${classBase}-highlight`]: tableAttributes.showHighlightedRow,
|
|
@@ -3267,7 +3291,7 @@ var TableCore = ({
|
|
|
3267
3291
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3268
3292
|
"div",
|
|
3269
3293
|
{
|
|
3270
|
-
className,
|
|
3294
|
+
className: contentContainerClassName,
|
|
3271
3295
|
ref: scrollProps.contentContainerRef,
|
|
3272
3296
|
style: cssVariables,
|
|
3273
3297
|
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
@@ -3295,13 +3319,14 @@ var TableCore = ({
|
|
|
3295
3319
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `${classBase7}-body`, children: data.map((data2) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3296
3320
|
Row2,
|
|
3297
3321
|
{
|
|
3322
|
+
"aria-rowindex": data2[0] + 1,
|
|
3298
3323
|
columnMap,
|
|
3299
3324
|
columns,
|
|
3300
3325
|
highlighted: highlightedIndex === data2[IDX3],
|
|
3301
3326
|
onClick: onRowClick,
|
|
3302
3327
|
onDataEdited,
|
|
3303
3328
|
row: data2,
|
|
3304
|
-
offset:
|
|
3329
|
+
offset: getRowOffset(data2),
|
|
3305
3330
|
onToggleGroup,
|
|
3306
3331
|
zebraStripes: tableAttributes.zebraStripes
|
|
3307
3332
|
},
|
|
@@ -3317,7 +3342,7 @@ var TableCore = ({
|
|
|
3317
3342
|
}
|
|
3318
3343
|
);
|
|
3319
3344
|
};
|
|
3320
|
-
var Table = (0,
|
|
3345
|
+
var Table = (0, import_react25.forwardRef)(function TableNext({
|
|
3321
3346
|
Row: Row2,
|
|
3322
3347
|
allowDragDrop,
|
|
3323
3348
|
availableColumns,
|
|
@@ -3339,14 +3364,15 @@ var Table = (0, import_react26.forwardRef)(function TableNext({
|
|
|
3339
3364
|
onSelectionChange,
|
|
3340
3365
|
renderBufferSize,
|
|
3341
3366
|
rowHeight,
|
|
3367
|
+
scrollingApiRef,
|
|
3342
3368
|
selectionModel,
|
|
3343
3369
|
showColumnHeaders,
|
|
3344
3370
|
headerHeight,
|
|
3345
3371
|
style: styleProp,
|
|
3346
3372
|
...htmlAttributes
|
|
3347
3373
|
}, forwardedRef) {
|
|
3348
|
-
const containerRef = (0,
|
|
3349
|
-
const [size, setSize] = (0,
|
|
3374
|
+
const containerRef = (0, import_react25.useRef)(null);
|
|
3375
|
+
const [size, setSize] = (0, import_react25.useState)();
|
|
3350
3376
|
if (config === void 0) {
|
|
3351
3377
|
throw Error(
|
|
3352
3378
|
"vuu Table requires config prop. Minimum config is list of Column Descriptors"
|
|
@@ -3388,6 +3414,7 @@ var Table = (0, import_react26.forwardRef)(function TableNext({
|
|
|
3388
3414
|
onSelectionChange,
|
|
3389
3415
|
renderBufferSize,
|
|
3390
3416
|
rowHeight,
|
|
3417
|
+
scrollingApiRef,
|
|
3391
3418
|
selectionModel,
|
|
3392
3419
|
showColumnHeaders,
|
|
3393
3420
|
size
|
|
@@ -3398,7 +3425,7 @@ var Table = (0, import_react26.forwardRef)(function TableNext({
|
|
|
3398
3425
|
});
|
|
3399
3426
|
|
|
3400
3427
|
// ../vuu-table/src/cell-renderers/checkbox-cell/CheckboxCell.tsx
|
|
3401
|
-
var
|
|
3428
|
+
var import_react26 = require("react");
|
|
3402
3429
|
var import_vuu_ui_controls4 = require("@vuu-ui/vuu-ui-controls");
|
|
3403
3430
|
var import_core3 = require("@salt-ds/core");
|
|
3404
3431
|
|
|
@@ -3406,17 +3433,17 @@ var import_core3 = require("@salt-ds/core");
|
|
|
3406
3433
|
var dataAndColumnUnchanged = (p, p1) => p.column === p1.column && p.column.valueFormatter(p.row[p.columnMap[p.column.name]]) === p1.column.valueFormatter(p1.row[p1.columnMap[p1.column.name]]);
|
|
3407
3434
|
|
|
3408
3435
|
// ../vuu-table/src/cell-renderers/checkbox-cell/CheckboxCell.tsx
|
|
3409
|
-
var
|
|
3436
|
+
var import_vuu_utils25 = require("@vuu-ui/vuu-utils");
|
|
3410
3437
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
3411
|
-
var CheckboxCell = (0,
|
|
3438
|
+
var CheckboxCell = (0, import_react26.memo)(
|
|
3412
3439
|
({ column, columnMap, onCommit = import_vuu_ui_controls4.WarnCommit, row }) => {
|
|
3413
3440
|
const dataIdx = columnMap[column.name];
|
|
3414
3441
|
const isChecked = row[dataIdx];
|
|
3415
|
-
const handleCommit = (0,
|
|
3442
|
+
const handleCommit = (0, import_react26.useCallback)(
|
|
3416
3443
|
(value) => async (evt) => {
|
|
3417
3444
|
const res = await onCommit(value);
|
|
3418
3445
|
if (res === true) {
|
|
3419
|
-
(0,
|
|
3446
|
+
(0, import_vuu_utils25.dispatchCustomEvent)(evt.target, "vuu-commit");
|
|
3420
3447
|
}
|
|
3421
3448
|
return res;
|
|
3422
3449
|
},
|
|
@@ -3427,12 +3454,12 @@ var CheckboxCell = (0, import_react27.memo)(
|
|
|
3427
3454
|
dataAndColumnUnchanged
|
|
3428
3455
|
);
|
|
3429
3456
|
CheckboxCell.displayName = "CheckboxCell";
|
|
3430
|
-
(0,
|
|
3457
|
+
(0, import_vuu_utils25.registerComponent)("checkbox-cell", CheckboxCell, "cell-renderer", {
|
|
3431
3458
|
serverDataType: "boolean"
|
|
3432
3459
|
});
|
|
3433
3460
|
|
|
3434
3461
|
// ../vuu-table/src/cell-renderers/input-cell/InputCell.tsx
|
|
3435
|
-
var
|
|
3462
|
+
var import_vuu_utils26 = require("@vuu-ui/vuu-utils");
|
|
3436
3463
|
var import_core4 = require("@salt-ds/core");
|
|
3437
3464
|
var import_vuu_ui_controls5 = require("@vuu-ui/vuu-ui-controls");
|
|
3438
3465
|
var import_clsx10 = __toESM(require("clsx"));
|
|
@@ -3471,18 +3498,18 @@ var InputCell = ({
|
|
|
3471
3498
|
}
|
|
3472
3499
|
);
|
|
3473
3500
|
};
|
|
3474
|
-
(0,
|
|
3501
|
+
(0, import_vuu_utils26.registerComponent)("input-cell", InputCell, "cell-renderer", {});
|
|
3475
3502
|
|
|
3476
3503
|
// ../vuu-table/src/cell-renderers/toggle-cell/ToggleCell.tsx
|
|
3477
3504
|
var import_vuu_ui_controls6 = require("@vuu-ui/vuu-ui-controls");
|
|
3478
|
-
var
|
|
3505
|
+
var import_vuu_utils27 = require("@vuu-ui/vuu-utils");
|
|
3479
3506
|
var import_clsx11 = __toESM(require("clsx"));
|
|
3480
|
-
var
|
|
3507
|
+
var import_react27 = require("react");
|
|
3481
3508
|
var import_vuu_ui_controls7 = require("@vuu-ui/vuu-ui-controls");
|
|
3482
3509
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
3483
3510
|
var classBase9 = "vuuTableToggleCell";
|
|
3484
3511
|
var getValueList = ({ name: name2, type }) => {
|
|
3485
|
-
if ((0,
|
|
3512
|
+
if ((0, import_vuu_utils27.isTypeDescriptor)(type) && (0, import_vuu_utils27.isValueListRenderer)(type.renderer)) {
|
|
3486
3513
|
return type.renderer.values;
|
|
3487
3514
|
} else {
|
|
3488
3515
|
throw Error(
|
|
@@ -3490,7 +3517,7 @@ var getValueList = ({ name: name2, type }) => {
|
|
|
3490
3517
|
);
|
|
3491
3518
|
}
|
|
3492
3519
|
};
|
|
3493
|
-
var ToggleCell = (0,
|
|
3520
|
+
var ToggleCell = (0, import_react27.memo)(
|
|
3494
3521
|
function ToggleCell2({
|
|
3495
3522
|
column,
|
|
3496
3523
|
columnMap,
|
|
@@ -3500,11 +3527,11 @@ var ToggleCell = (0, import_react28.memo)(
|
|
|
3500
3527
|
const values = getValueList(column);
|
|
3501
3528
|
const dataIdx = columnMap[column.name];
|
|
3502
3529
|
const value = row[dataIdx];
|
|
3503
|
-
const handleCommit = (0,
|
|
3530
|
+
const handleCommit = (0, import_react27.useCallback)(
|
|
3504
3531
|
(evt, value2) => {
|
|
3505
3532
|
return onCommit(value2).then((response) => {
|
|
3506
3533
|
if (response === true) {
|
|
3507
|
-
(0,
|
|
3534
|
+
(0, import_vuu_utils27.dispatchCustomEvent)(evt.target, "vuu-commit");
|
|
3508
3535
|
}
|
|
3509
3536
|
return response;
|
|
3510
3537
|
});
|
|
@@ -3525,30 +3552,30 @@ var ToggleCell = (0, import_react28.memo)(
|
|
|
3525
3552
|
},
|
|
3526
3553
|
dataAndColumnUnchanged
|
|
3527
3554
|
);
|
|
3528
|
-
(0,
|
|
3555
|
+
(0, import_vuu_utils27.registerComponent)("toggle-cell", ToggleCell, "cell-renderer", {});
|
|
3529
3556
|
|
|
3530
3557
|
// ../vuu-table/src/useControlledTableNavigation.ts
|
|
3531
3558
|
var import_vuu_ui_controls8 = require("@vuu-ui/vuu-ui-controls");
|
|
3532
|
-
var
|
|
3533
|
-
var
|
|
3559
|
+
var import_vuu_utils28 = require("@vuu-ui/vuu-utils");
|
|
3560
|
+
var import_react28 = require("react");
|
|
3534
3561
|
|
|
3535
3562
|
// src/cell-renderers/background-cell/BackgroundCell.tsx
|
|
3536
|
-
var
|
|
3563
|
+
var import_vuu_utils30 = require("@vuu-ui/vuu-utils");
|
|
3537
3564
|
var import_clsx12 = __toESM(require("clsx"), 1);
|
|
3538
|
-
var
|
|
3565
|
+
var import_react30 = require("react");
|
|
3539
3566
|
|
|
3540
3567
|
// src/cell-renderers/background-cell/useDirection.ts
|
|
3541
|
-
var
|
|
3542
|
-
var
|
|
3568
|
+
var import_vuu_utils29 = require("@vuu-ui/vuu-utils");
|
|
3569
|
+
var import_react29 = require("react");
|
|
3543
3570
|
var INITIAL_VALUE = [void 0, void 0, void 0, void 0];
|
|
3544
3571
|
function useDirection(key, value, column) {
|
|
3545
3572
|
var _a;
|
|
3546
|
-
const ref = (0,
|
|
3573
|
+
const ref = (0, import_react29.useRef)();
|
|
3547
3574
|
const [prevKey, prevValue, prevColumn, prevDirection] = ref.current || INITIAL_VALUE;
|
|
3548
3575
|
const { type: dataType } = column;
|
|
3549
|
-
const decimals = (0,
|
|
3550
|
-
const direction = key === prevKey && (0,
|
|
3551
|
-
(0,
|
|
3576
|
+
const decimals = (0, import_vuu_utils29.isTypeDescriptor)(dataType) ? (_a = dataType.formatting) == null ? void 0 : _a.decimals : void 0;
|
|
3577
|
+
const direction = key === prevKey && (0, import_vuu_utils29.isValidNumber)(value) && (0, import_vuu_utils29.isValidNumber)(prevValue) && column === prevColumn ? (0, import_vuu_utils29.getMovingValueDirection)(value, prevDirection, prevValue, decimals) : "";
|
|
3578
|
+
(0, import_react29.useEffect)(() => {
|
|
3552
3579
|
ref.current = [key, value, column, direction];
|
|
3553
3580
|
});
|
|
3554
3581
|
return direction;
|
|
@@ -3558,7 +3585,7 @@ function useDirection(key, value, column) {
|
|
|
3558
3585
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3559
3586
|
var CHAR_ARROW_UP = String.fromCharCode(11014);
|
|
3560
3587
|
var CHAR_ARROW_DOWN = String.fromCharCode(11015);
|
|
3561
|
-
var { KEY: KEY2 } =
|
|
3588
|
+
var { KEY: KEY2 } = import_vuu_utils30.metadataKeys;
|
|
3562
3589
|
var classBase10 = "vuuBackgroundCell";
|
|
3563
3590
|
var FlashStyle = {
|
|
3564
3591
|
ArrowOnly: "arrow",
|
|
@@ -3566,14 +3593,14 @@ var FlashStyle = {
|
|
|
3566
3593
|
ArrowBackground: "arrow-bg"
|
|
3567
3594
|
};
|
|
3568
3595
|
var getFlashStyle = (colType) => {
|
|
3569
|
-
if ((0,
|
|
3596
|
+
if ((0, import_vuu_utils30.isTypeDescriptor)(colType) && colType.renderer) {
|
|
3570
3597
|
if ("flashStyle" in colType.renderer) {
|
|
3571
3598
|
return colType.renderer["flashStyle"];
|
|
3572
3599
|
}
|
|
3573
3600
|
}
|
|
3574
3601
|
return FlashStyle.BackgroundOnly;
|
|
3575
3602
|
};
|
|
3576
|
-
var BackgroundCell = (0,
|
|
3603
|
+
var BackgroundCell = (0, import_react30.memo)(
|
|
3577
3604
|
function BackgroundCell2({
|
|
3578
3605
|
column,
|
|
3579
3606
|
columnMap,
|
|
@@ -3584,7 +3611,7 @@ var BackgroundCell = (0, import_react31.memo)(
|
|
|
3584
3611
|
const value = row[dataIdx];
|
|
3585
3612
|
const flashStyle = getFlashStyle(type);
|
|
3586
3613
|
const direction = useDirection(row[KEY2], value, column);
|
|
3587
|
-
const arrow = flashStyle === FlashStyle.ArrowOnly || flashStyle === FlashStyle.ArrowBackground ? direction ===
|
|
3614
|
+
const arrow = flashStyle === FlashStyle.ArrowOnly || flashStyle === FlashStyle.ArrowBackground ? direction === import_vuu_utils30.UP1 || direction === import_vuu_utils30.UP2 ? CHAR_ARROW_UP : direction === import_vuu_utils30.DOWN1 || direction === import_vuu_utils30.DOWN2 ? CHAR_ARROW_DOWN : null : null;
|
|
3588
3615
|
const dirClass = direction ? ` ` + direction : "";
|
|
3589
3616
|
const className = (0, import_clsx12.default)(classBase10, dirClass, {
|
|
3590
3617
|
[`${classBase10}-backgroundOnly`]: flashStyle === FlashStyle.BackgroundOnly,
|
|
@@ -3598,7 +3625,7 @@ var BackgroundCell = (0, import_react31.memo)(
|
|
|
3598
3625
|
},
|
|
3599
3626
|
dataAndColumnUnchanged
|
|
3600
3627
|
);
|
|
3601
|
-
(0,
|
|
3628
|
+
(0, import_vuu_utils30.registerComponent)(
|
|
3602
3629
|
"vuu.price-move-background",
|
|
3603
3630
|
BackgroundCell,
|
|
3604
3631
|
"cell-renderer",
|
|
@@ -3611,10 +3638,10 @@ var BackgroundCell = (0, import_react31.memo)(
|
|
|
3611
3638
|
);
|
|
3612
3639
|
|
|
3613
3640
|
// src/cell-renderers/background-cell/BackgroundCellConfigurationEditor.tsx
|
|
3614
|
-
var
|
|
3641
|
+
var import_vuu_utils31 = require("@vuu-ui/vuu-utils");
|
|
3615
3642
|
var import_core5 = require("@salt-ds/core");
|
|
3616
3643
|
var import_vuu_ui_controls9 = require("@vuu-ui/vuu-ui-controls");
|
|
3617
|
-
var
|
|
3644
|
+
var import_react31 = require("react");
|
|
3618
3645
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3619
3646
|
var classBase11 = "vuuBackgroundCellConfiguration";
|
|
3620
3647
|
var flashOptions = [
|
|
@@ -3631,10 +3658,10 @@ var BackgroundCellConfigurationEditor = ({
|
|
|
3631
3658
|
column,
|
|
3632
3659
|
onChangeRendering
|
|
3633
3660
|
}) => {
|
|
3634
|
-
const [flashStyle, setFlashStyle] = (0,
|
|
3661
|
+
const [flashStyle, setFlashStyle] = (0, import_react31.useState)(
|
|
3635
3662
|
valueFromColumn(column)
|
|
3636
3663
|
);
|
|
3637
|
-
const handleSelectionChange = (0,
|
|
3664
|
+
const handleSelectionChange = (0, import_react31.useCallback)(
|
|
3638
3665
|
(_, flashOption) => {
|
|
3639
3666
|
var _a;
|
|
3640
3667
|
setFlashStyle(flashOption);
|
|
@@ -3660,7 +3687,7 @@ var BackgroundCellConfigurationEditor = ({
|
|
|
3660
3687
|
)
|
|
3661
3688
|
] });
|
|
3662
3689
|
};
|
|
3663
|
-
(0,
|
|
3690
|
+
(0, import_vuu_utils31.registerConfigurationEditor)(
|
|
3664
3691
|
"BackgroundCellConfigurationEditor",
|
|
3665
3692
|
BackgroundCellConfigurationEditor
|
|
3666
3693
|
);
|
|
@@ -3668,12 +3695,12 @@ var BackgroundCellConfigurationEditor = ({
|
|
|
3668
3695
|
// src/cell-renderers/dropdown-cell/DropdownCell.tsx
|
|
3669
3696
|
var import_vuu_data_react = require("@vuu-ui/vuu-data-react");
|
|
3670
3697
|
var import_vuu_ui_controls10 = require("@vuu-ui/vuu-ui-controls");
|
|
3671
|
-
var
|
|
3672
|
-
var
|
|
3698
|
+
var import_vuu_utils32 = require("@vuu-ui/vuu-utils");
|
|
3699
|
+
var import_react32 = require("react");
|
|
3673
3700
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3674
3701
|
var classBase12 = "vuuTableDropdownCell";
|
|
3675
3702
|
var openKeys = ["Enter", " "];
|
|
3676
|
-
var DropdownCell = (0,
|
|
3703
|
+
var DropdownCell = (0, import_react32.memo)(
|
|
3677
3704
|
function DropdownCell2({
|
|
3678
3705
|
column,
|
|
3679
3706
|
columnMap,
|
|
@@ -3682,14 +3709,14 @@ var DropdownCell = (0, import_react33.memo)(
|
|
|
3682
3709
|
}) {
|
|
3683
3710
|
const dataIdx = columnMap[column.name];
|
|
3684
3711
|
const { initialValue, values } = (0, import_vuu_data_react.useLookupValues)(column, row[dataIdx]);
|
|
3685
|
-
const [value, setValue] = (0,
|
|
3686
|
-
const handleSelectionChange = (0,
|
|
3712
|
+
const [value, setValue] = (0, import_react32.useState)(null);
|
|
3713
|
+
const handleSelectionChange = (0, import_react32.useCallback)(
|
|
3687
3714
|
(evt, selectedOption) => {
|
|
3688
3715
|
if (selectedOption) {
|
|
3689
3716
|
setValue(selectedOption);
|
|
3690
3717
|
onCommit(selectedOption.value).then((response) => {
|
|
3691
3718
|
if (response === true && evt) {
|
|
3692
|
-
(0,
|
|
3719
|
+
(0, import_vuu_utils32.dispatchCustomEvent)(evt.target, "vuu-commit");
|
|
3693
3720
|
}
|
|
3694
3721
|
});
|
|
3695
3722
|
}
|
|
@@ -3710,14 +3737,14 @@ var DropdownCell = (0, import_react33.memo)(
|
|
|
3710
3737
|
},
|
|
3711
3738
|
dataAndColumnUnchanged
|
|
3712
3739
|
);
|
|
3713
|
-
(0,
|
|
3740
|
+
(0, import_vuu_utils32.registerComponent)("dropdown-cell", DropdownCell, "cell-renderer", {});
|
|
3714
3741
|
|
|
3715
3742
|
// src/cell-renderers/lookup-cell/LookupCell.tsx
|
|
3716
3743
|
var import_vuu_data_react2 = require("@vuu-ui/vuu-data-react");
|
|
3717
|
-
var
|
|
3718
|
-
var
|
|
3744
|
+
var import_vuu_utils33 = require("@vuu-ui/vuu-utils");
|
|
3745
|
+
var import_react33 = require("react");
|
|
3719
3746
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3720
|
-
var LookupCell = (0,
|
|
3747
|
+
var LookupCell = (0, import_react33.memo)(
|
|
3721
3748
|
function LookupCell2({
|
|
3722
3749
|
column,
|
|
3723
3750
|
columnMap,
|
|
@@ -3729,10 +3756,10 @@ var LookupCell = (0, import_react34.memo)(
|
|
|
3729
3756
|
},
|
|
3730
3757
|
dataAndColumnUnchanged
|
|
3731
3758
|
);
|
|
3732
|
-
(0,
|
|
3759
|
+
(0, import_vuu_utils33.registerComponent)("lookup-cell", LookupCell, "cell-renderer", {});
|
|
3733
3760
|
|
|
3734
3761
|
// src/cell-renderers/progress-cell/ProgressCell.tsx
|
|
3735
|
-
var
|
|
3762
|
+
var import_vuu_utils34 = require("@vuu-ui/vuu-utils");
|
|
3736
3763
|
var import_clsx13 = __toESM(require("clsx"), 1);
|
|
3737
3764
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3738
3765
|
var classBase13 = "vuuProgressCell";
|
|
@@ -3741,11 +3768,11 @@ var ProgressCell = ({ column, columnMap, row }) => {
|
|
|
3741
3768
|
const value = row[column.key];
|
|
3742
3769
|
let showProgress = false;
|
|
3743
3770
|
let percentage = 0;
|
|
3744
|
-
if ((0,
|
|
3771
|
+
if ((0, import_vuu_utils34.isTypeDescriptor)(type) && (0, import_vuu_utils34.isColumnTypeRenderer)(type.renderer)) {
|
|
3745
3772
|
const { associatedField } = type.renderer;
|
|
3746
3773
|
if (associatedField) {
|
|
3747
3774
|
const associatedValue = row[columnMap[associatedField]];
|
|
3748
|
-
if (typeof (0,
|
|
3775
|
+
if (typeof (0, import_vuu_utils34.isValidNumber)(value) && (0, import_vuu_utils34.isValidNumber)(associatedValue)) {
|
|
3749
3776
|
percentage = Math.min(Math.round(value / associatedValue * 100), 100);
|
|
3750
3777
|
percentage = Math.min(Math.round(value / associatedValue * 100), 100);
|
|
3751
3778
|
showProgress = isFinite(percentage);
|
|
@@ -3781,7 +3808,7 @@ var ProgressCell = ({ column, columnMap, row }) => {
|
|
|
3781
3808
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: `${classBase13}-text`, children: `${percentage} %` })
|
|
3782
3809
|
] });
|
|
3783
3810
|
};
|
|
3784
|
-
(0,
|
|
3811
|
+
(0, import_vuu_utils34.registerComponent)("vuu.progress", ProgressCell, "cell-renderer", {
|
|
3785
3812
|
description: "Progress formatter",
|
|
3786
3813
|
label: "Progress formatter",
|
|
3787
3814
|
serverDataType: ["long", "int", "double"]
|
|
@@ -3791,8 +3818,8 @@ var ProgressCell = ({ column, columnMap, row }) => {
|
|
|
3791
3818
|
var import_vuu_ui_controls11 = require("@vuu-ui/vuu-ui-controls");
|
|
3792
3819
|
var import_core6 = require("@salt-ds/core");
|
|
3793
3820
|
var import_clsx14 = __toESM(require("clsx"), 1);
|
|
3794
|
-
var
|
|
3795
|
-
var
|
|
3821
|
+
var import_react34 = require("react");
|
|
3822
|
+
var import_vuu_utils35 = require("@vuu-ui/vuu-utils");
|
|
3796
3823
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3797
3824
|
var classBase14 = "vuuColumnList";
|
|
3798
3825
|
var classBaseListItem = "vuuColumnListItem";
|
|
@@ -3810,7 +3837,7 @@ var ColumnListItem = ({
|
|
|
3810
3837
|
children: [
|
|
3811
3838
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: `${classBase14}-icon`, "data-icon": "draggable" }),
|
|
3812
3839
|
(item == null ? void 0 : item.isCalculated) ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: `${classBase14}-icon`, "data-icon": "function" }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_core6.Switch, { className: `${classBase14}-switch`, checked: item == null ? void 0 : item.subscribed }),
|
|
3813
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: `${classBase14}-text`, children: (0,
|
|
3840
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: `${classBase14}-text`, children: (0, import_vuu_utils35.getColumnLabel)(item) }),
|
|
3814
3841
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3815
3842
|
import_core6.Checkbox,
|
|
3816
3843
|
{
|
|
@@ -3830,7 +3857,7 @@ var ColumnList = ({
|
|
|
3830
3857
|
onNavigateToColumn,
|
|
3831
3858
|
...htmlAttributes
|
|
3832
3859
|
}) => {
|
|
3833
|
-
const handleChange = (0,
|
|
3860
|
+
const handleChange = (0, import_react34.useCallback)(
|
|
3834
3861
|
(evt) => {
|
|
3835
3862
|
const input = evt.target;
|
|
3836
3863
|
const listItem = input.closest(`.${classBaseListItem}`);
|
|
@@ -3851,7 +3878,7 @@ var ColumnList = ({
|
|
|
3851
3878
|
},
|
|
3852
3879
|
[onChange]
|
|
3853
3880
|
);
|
|
3854
|
-
const handleClick = (0,
|
|
3881
|
+
const handleClick = (0, import_react34.useCallback)((evt) => {
|
|
3855
3882
|
const targetEl = evt.target;
|
|
3856
3883
|
if (targetEl.classList.contains("vuuColumnList-text")) {
|
|
3857
3884
|
const listItemEl = targetEl.closest(".vuuListItem");
|
|
@@ -3885,23 +3912,23 @@ var ColumnList = ({
|
|
|
3885
3912
|
|
|
3886
3913
|
// src/column-settings/ColumnSettingsPanel.tsx
|
|
3887
3914
|
var import_vuu_ui_controls15 = require("@vuu-ui/vuu-ui-controls");
|
|
3888
|
-
var
|
|
3915
|
+
var import_vuu_utils47 = require("@vuu-ui/vuu-utils");
|
|
3889
3916
|
var import_core12 = require("@salt-ds/core");
|
|
3890
3917
|
var import_clsx17 = __toESM(require("clsx"), 1);
|
|
3891
3918
|
|
|
3892
3919
|
// src/column-expression-panel/ColumnExpressionPanel.tsx
|
|
3893
3920
|
var import_vuu_ui_controls12 = require("@vuu-ui/vuu-ui-controls");
|
|
3894
|
-
var
|
|
3921
|
+
var import_vuu_utils40 = require("@vuu-ui/vuu-utils");
|
|
3895
3922
|
var import_core7 = require("@salt-ds/core");
|
|
3896
|
-
var
|
|
3923
|
+
var import_react40 = require("react");
|
|
3897
3924
|
|
|
3898
3925
|
// src/column-expression-input/ColumnExpressionInput.tsx
|
|
3899
|
-
var
|
|
3926
|
+
var import_react37 = require("react");
|
|
3900
3927
|
|
|
3901
3928
|
// src/column-expression-input/useColumnExpressionEditor.ts
|
|
3902
3929
|
var import_vuu_codemirror5 = require("@vuu-ui/vuu-codemirror");
|
|
3903
|
-
var
|
|
3904
|
-
var
|
|
3930
|
+
var import_vuu_utils36 = require("@vuu-ui/vuu-utils");
|
|
3931
|
+
var import_react36 = require("react");
|
|
3905
3932
|
|
|
3906
3933
|
// src/column-expression-input/column-language-parser/ColumnExpressionLanguage.ts
|
|
3907
3934
|
var import_vuu_codemirror = require("@vuu-ui/vuu-codemirror");
|
|
@@ -4534,7 +4561,7 @@ var vuuTheme = import_vuu_codemirror3.EditorView.theme(
|
|
|
4534
4561
|
|
|
4535
4562
|
// src/column-expression-input/useColumnAutoComplete.ts
|
|
4536
4563
|
var import_vuu_codemirror4 = require("@vuu-ui/vuu-codemirror");
|
|
4537
|
-
var
|
|
4564
|
+
var import_react35 = require("react");
|
|
4538
4565
|
var applyPrefix = (completions, prefix) => prefix ? completions.map((completion) => {
|
|
4539
4566
|
var _a;
|
|
4540
4567
|
return {
|
|
@@ -4644,7 +4671,7 @@ var promptToSave = (context, onSubmit) => {
|
|
|
4644
4671
|
return { from: context.pos, options };
|
|
4645
4672
|
};
|
|
4646
4673
|
var useColumnAutoComplete = (suggestionProvider, onSubmit) => {
|
|
4647
|
-
const makeSuggestions2 = (0,
|
|
4674
|
+
const makeSuggestions2 = (0, import_react35.useCallback)(
|
|
4648
4675
|
async (context, suggestionType, optionalArgs = {}) => {
|
|
4649
4676
|
const options = await suggestionProvider.getSuggestions(
|
|
4650
4677
|
suggestionType,
|
|
@@ -4655,7 +4682,7 @@ var useColumnAutoComplete = (suggestionProvider, onSubmit) => {
|
|
|
4655
4682
|
},
|
|
4656
4683
|
[suggestionProvider]
|
|
4657
4684
|
);
|
|
4658
|
-
return (0,
|
|
4685
|
+
return (0, import_react35.useCallback)(
|
|
4659
4686
|
async (context) => {
|
|
4660
4687
|
var _a, _b;
|
|
4661
4688
|
const { state, pos } = context;
|
|
@@ -4906,8 +4933,8 @@ var noop = () => console.log("noooop");
|
|
|
4906
4933
|
var hasExpressionType = (completion) => "expressionType" in completion;
|
|
4907
4934
|
var injectOptionContent = (completion) => {
|
|
4908
4935
|
if (hasExpressionType(completion)) {
|
|
4909
|
-
const div = (0,
|
|
4910
|
-
const span = (0,
|
|
4936
|
+
const div = (0, import_vuu_utils36.createEl)("div", "expression-type-container");
|
|
4937
|
+
const span = (0, import_vuu_utils36.createEl)("span", "expression-type", completion.expressionType);
|
|
4911
4938
|
div.appendChild(span);
|
|
4912
4939
|
return div;
|
|
4913
4940
|
} else {
|
|
@@ -4920,11 +4947,11 @@ var useColumnExpressionEditor = ({
|
|
|
4920
4947
|
source,
|
|
4921
4948
|
suggestionProvider
|
|
4922
4949
|
}) => {
|
|
4923
|
-
const editorRef = (0,
|
|
4924
|
-
const onSubmitRef = (0,
|
|
4925
|
-
const viewRef = (0,
|
|
4950
|
+
const editorRef = (0, import_react36.useRef)(null);
|
|
4951
|
+
const onSubmitRef = (0, import_react36.useRef)(noop);
|
|
4952
|
+
const viewRef = (0, import_react36.useRef)();
|
|
4926
4953
|
const completionFn = useColumnAutoComplete(suggestionProvider, onSubmitRef);
|
|
4927
|
-
const [createState, clearInput, submit] = (0,
|
|
4954
|
+
const [createState, clearInput, submit] = (0, import_react36.useMemo)(() => {
|
|
4928
4955
|
const parseExpression = () => {
|
|
4929
4956
|
const view = getView(viewRef);
|
|
4930
4957
|
const source2 = view.state.doc.toString();
|
|
@@ -4992,7 +5019,7 @@ var useColumnExpressionEditor = ({
|
|
|
4992
5019
|
};
|
|
4993
5020
|
return [createState2, clearInput2, submitExpression];
|
|
4994
5021
|
}, [completionFn, onChange, onSubmitExpression, source]);
|
|
4995
|
-
(0,
|
|
5022
|
+
(0, import_react36.useEffect)(() => {
|
|
4996
5023
|
if (!editorRef.current) {
|
|
4997
5024
|
throw Error("editor not in dom");
|
|
4998
5025
|
}
|
|
@@ -5005,7 +5032,7 @@ var useColumnExpressionEditor = ({
|
|
|
5005
5032
|
(_a = viewRef.current) == null ? void 0 : _a.destroy();
|
|
5006
5033
|
};
|
|
5007
5034
|
}, [completionFn, createState]);
|
|
5008
|
-
const handleBlur = (0,
|
|
5035
|
+
const handleBlur = (0, import_react36.useCallback)(() => {
|
|
5009
5036
|
submit();
|
|
5010
5037
|
}, [submit]);
|
|
5011
5038
|
return { editorRef, clearInput, onBlur: handleBlur };
|
|
@@ -5014,7 +5041,7 @@ var useColumnExpressionEditor = ({
|
|
|
5014
5041
|
// src/column-expression-input/ColumnExpressionInput.tsx
|
|
5015
5042
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
5016
5043
|
var classBase15 = "vuuColumnExpressionInput";
|
|
5017
|
-
var ColumnExpressionInput = (0,
|
|
5044
|
+
var ColumnExpressionInput = (0, import_react37.memo)(
|
|
5018
5045
|
({
|
|
5019
5046
|
onChange,
|
|
5020
5047
|
onSubmitExpression,
|
|
@@ -5038,8 +5065,8 @@ ColumnExpressionInput.displayName = "ColumnExpressionInput";
|
|
|
5038
5065
|
// src/column-expression-input/useColumnExpressionSuggestionProvider.ts
|
|
5039
5066
|
var import_vuu_codemirror6 = require("@vuu-ui/vuu-codemirror");
|
|
5040
5067
|
var import_vuu_data_react3 = require("@vuu-ui/vuu-data-react");
|
|
5041
|
-
var
|
|
5042
|
-
var
|
|
5068
|
+
var import_vuu_utils38 = require("@vuu-ui/vuu-utils");
|
|
5069
|
+
var import_react38 = require("react");
|
|
5043
5070
|
|
|
5044
5071
|
// src/column-expression-input/column-function-descriptors.ts
|
|
5045
5072
|
var columnFunctionDescriptors = [
|
|
@@ -5346,7 +5373,7 @@ var columnFunctionDescriptors = [
|
|
|
5346
5373
|
];
|
|
5347
5374
|
|
|
5348
5375
|
// src/column-expression-input/functionDocInfo.ts
|
|
5349
|
-
var
|
|
5376
|
+
var import_vuu_utils37 = require("@vuu-ui/vuu-utils");
|
|
5350
5377
|
var functionDocInfo = ({
|
|
5351
5378
|
name: name2,
|
|
5352
5379
|
description,
|
|
@@ -5354,25 +5381,25 @@ var functionDocInfo = ({
|
|
|
5354
5381
|
params,
|
|
5355
5382
|
type
|
|
5356
5383
|
}) => {
|
|
5357
|
-
const rootElement = (0,
|
|
5358
|
-
const headingElement = (0,
|
|
5359
|
-
const nameElement = (0,
|
|
5360
|
-
const paramElement = (0,
|
|
5361
|
-
const typeElement = (0,
|
|
5384
|
+
const rootElement = (0, import_vuu_utils37.createEl)("div", "vuuFunctionDoc");
|
|
5385
|
+
const headingElement = (0, import_vuu_utils37.createEl)("div", "function-heading");
|
|
5386
|
+
const nameElement = (0, import_vuu_utils37.createEl)("span", "function-name", name2);
|
|
5387
|
+
const paramElement = (0, import_vuu_utils37.createEl)("span", "param-list", params.description);
|
|
5388
|
+
const typeElement = (0, import_vuu_utils37.createEl)("span", "function-type", type);
|
|
5362
5389
|
headingElement.appendChild(nameElement);
|
|
5363
5390
|
headingElement.appendChild(paramElement);
|
|
5364
5391
|
headingElement.appendChild(typeElement);
|
|
5365
|
-
const child2 = (0,
|
|
5392
|
+
const child2 = (0, import_vuu_utils37.createEl)("p", void 0, description);
|
|
5366
5393
|
rootElement.appendChild(headingElement);
|
|
5367
5394
|
rootElement.appendChild(child2);
|
|
5368
5395
|
if (example) {
|
|
5369
|
-
const exampleElement = (0,
|
|
5370
|
-
const expressionElement = (0,
|
|
5396
|
+
const exampleElement = (0, import_vuu_utils37.createEl)("div", "example-container");
|
|
5397
|
+
const expressionElement = (0, import_vuu_utils37.createEl)(
|
|
5371
5398
|
"div",
|
|
5372
5399
|
"example-expression",
|
|
5373
5400
|
example.expression
|
|
5374
5401
|
);
|
|
5375
|
-
const resultElement = (0,
|
|
5402
|
+
const resultElement = (0, import_vuu_utils37.createEl)("div", "example-result", example.result);
|
|
5376
5403
|
exampleElement.appendChild(expressionElement);
|
|
5377
5404
|
rootElement.appendChild(exampleElement);
|
|
5378
5405
|
rootElement.appendChild(resultElement);
|
|
@@ -5391,15 +5418,15 @@ var withApplySpace = (suggestions) => suggestions.map((suggestion) => {
|
|
|
5391
5418
|
});
|
|
5392
5419
|
var getValidColumns = (columns, { functionName, operator }) => {
|
|
5393
5420
|
if (operator) {
|
|
5394
|
-
return columns.filter(
|
|
5421
|
+
return columns.filter(import_vuu_utils38.isNumericColumn);
|
|
5395
5422
|
} else if (functionName) {
|
|
5396
5423
|
const fn = columnFunctionDescriptors.find((f) => f.name === functionName);
|
|
5397
5424
|
if (fn) {
|
|
5398
5425
|
switch (fn.accepts) {
|
|
5399
5426
|
case "string":
|
|
5400
|
-
return columns.filter(
|
|
5427
|
+
return columns.filter(import_vuu_utils38.isTextColumn);
|
|
5401
5428
|
case "number":
|
|
5402
|
-
return columns.filter(
|
|
5429
|
+
return columns.filter(import_vuu_utils38.isNumericColumn);
|
|
5403
5430
|
default:
|
|
5404
5431
|
return columns;
|
|
5405
5432
|
}
|
|
@@ -5428,7 +5455,7 @@ var arithmeticOperators = [
|
|
|
5428
5455
|
{ apply: "- ", boost: 2, label: "-", type: "operator" }
|
|
5429
5456
|
];
|
|
5430
5457
|
var getOperators = (column) => {
|
|
5431
|
-
if (column === void 0 || (0,
|
|
5458
|
+
if (column === void 0 || (0, import_vuu_utils38.isNumericColumn)(column)) {
|
|
5432
5459
|
return arithmeticOperators;
|
|
5433
5460
|
} else {
|
|
5434
5461
|
return NO_OPERATORS;
|
|
@@ -5492,13 +5519,13 @@ var useColumnExpressionSuggestionProvider = ({
|
|
|
5492
5519
|
columns,
|
|
5493
5520
|
table
|
|
5494
5521
|
}) => {
|
|
5495
|
-
const findColumn = (0,
|
|
5522
|
+
const findColumn = (0, import_react38.useCallback)(
|
|
5496
5523
|
(name2) => name2 ? columns.find((col) => col.name === name2) : void 0,
|
|
5497
5524
|
[columns]
|
|
5498
5525
|
);
|
|
5499
|
-
const latestSuggestionsRef = (0,
|
|
5526
|
+
const latestSuggestionsRef = (0, import_react38.useRef)();
|
|
5500
5527
|
const getTypeaheadSuggestions = (0, import_vuu_data_react3.useTypeaheadSuggestions)();
|
|
5501
|
-
const getSuggestions = (0,
|
|
5528
|
+
const getSuggestions = (0, import_react38.useCallback)(
|
|
5502
5529
|
async (suggestionType, options = NONE) => {
|
|
5503
5530
|
const { columnName, functionName, operator, prefix } = options;
|
|
5504
5531
|
switch (suggestionType) {
|
|
@@ -5563,7 +5590,7 @@ var useColumnExpressionSuggestionProvider = ({
|
|
|
5563
5590
|
},
|
|
5564
5591
|
[columns, findColumn, getTypeaheadSuggestions, table]
|
|
5565
5592
|
);
|
|
5566
|
-
const isPartialMatch = (0,
|
|
5593
|
+
const isPartialMatch = (0, import_react38.useCallback)(
|
|
5567
5594
|
async (valueType, columnName, pattern) => {
|
|
5568
5595
|
const { current: latestSuggestions } = latestSuggestionsRef;
|
|
5569
5596
|
let maybe = false;
|
|
@@ -5588,10 +5615,10 @@ var useColumnExpressionSuggestionProvider = ({
|
|
|
5588
5615
|
};
|
|
5589
5616
|
|
|
5590
5617
|
// src/column-expression-panel/useColumnExpression.ts
|
|
5591
|
-
var
|
|
5592
|
-
var
|
|
5618
|
+
var import_vuu_utils39 = require("@vuu-ui/vuu-utils");
|
|
5619
|
+
var import_react39 = require("react");
|
|
5593
5620
|
var applyDefaults = (column) => {
|
|
5594
|
-
const [name2, expression, type] = (0,
|
|
5621
|
+
const [name2, expression, type] = (0, import_vuu_utils39.getCalculatedColumnDetails)(column);
|
|
5595
5622
|
if (type === "") {
|
|
5596
5623
|
return {
|
|
5597
5624
|
...column,
|
|
@@ -5605,37 +5632,37 @@ var useColumnExpression = ({
|
|
|
5605
5632
|
column: columnProp,
|
|
5606
5633
|
onChangeName: onChangeNameProp
|
|
5607
5634
|
}) => {
|
|
5608
|
-
const [column, _setColumn] = (0,
|
|
5635
|
+
const [column, _setColumn] = (0, import_react39.useState)(
|
|
5609
5636
|
applyDefaults(columnProp)
|
|
5610
5637
|
);
|
|
5611
|
-
const columnRef = (0,
|
|
5612
|
-
const setColumn = (0,
|
|
5638
|
+
const columnRef = (0, import_react39.useRef)(columnProp);
|
|
5639
|
+
const setColumn = (0, import_react39.useCallback)((column2) => {
|
|
5613
5640
|
columnRef.current = column2;
|
|
5614
5641
|
_setColumn(column2);
|
|
5615
5642
|
}, []);
|
|
5616
|
-
const onChangeName = (0,
|
|
5643
|
+
const onChangeName = (0, import_react39.useCallback)(
|
|
5617
5644
|
(evt) => {
|
|
5618
5645
|
const { value } = evt.target;
|
|
5619
|
-
const newColumn = (0,
|
|
5646
|
+
const newColumn = (0, import_vuu_utils39.setCalculatedColumnName)(column, value);
|
|
5620
5647
|
setColumn(newColumn);
|
|
5621
5648
|
onChangeNameProp == null ? void 0 : onChangeNameProp(newColumn.name);
|
|
5622
5649
|
},
|
|
5623
5650
|
[column, onChangeNameProp, setColumn]
|
|
5624
5651
|
);
|
|
5625
|
-
const onChangeExpression = (0,
|
|
5652
|
+
const onChangeExpression = (0, import_react39.useCallback)(
|
|
5626
5653
|
(value) => {
|
|
5627
5654
|
const expression = value.trim();
|
|
5628
5655
|
const { current: column2 } = columnRef;
|
|
5629
|
-
const newColumn = (0,
|
|
5656
|
+
const newColumn = (0, import_vuu_utils39.setCalculatedColumnExpression)(column2, expression);
|
|
5630
5657
|
setColumn(newColumn);
|
|
5631
5658
|
onChangeNameProp == null ? void 0 : onChangeNameProp(newColumn.name);
|
|
5632
5659
|
},
|
|
5633
5660
|
[onChangeNameProp, setColumn]
|
|
5634
5661
|
);
|
|
5635
|
-
const onChangeType = (0,
|
|
5662
|
+
const onChangeType = (0, import_react39.useCallback)(
|
|
5636
5663
|
(evt, value) => {
|
|
5637
5664
|
if (typeof value === "string") {
|
|
5638
|
-
const newColumn = (0,
|
|
5665
|
+
const newColumn = (0, import_vuu_utils39.setCalculatedColumnType)(column, value);
|
|
5639
5666
|
setColumn(newColumn);
|
|
5640
5667
|
onChangeNameProp == null ? void 0 : onChangeNameProp(newColumn.name);
|
|
5641
5668
|
}
|
|
@@ -5659,19 +5686,19 @@ var ColumnExpressionPanel = ({
|
|
|
5659
5686
|
tableConfig,
|
|
5660
5687
|
vuuTable
|
|
5661
5688
|
}) => {
|
|
5662
|
-
const typeRef = (0,
|
|
5689
|
+
const typeRef = (0, import_react40.useRef)(null);
|
|
5663
5690
|
const { column, onChangeExpression, onChangeName, onChangeType } = useColumnExpression({
|
|
5664
5691
|
column: columnProp,
|
|
5665
5692
|
onChangeName: onChangeNameProp
|
|
5666
5693
|
});
|
|
5667
|
-
const initialExpressionRef = (0,
|
|
5668
|
-
(0,
|
|
5694
|
+
const initialExpressionRef = (0, import_react40.useRef)(
|
|
5695
|
+
(0, import_vuu_utils40.getCalculatedColumnExpression)(column)
|
|
5669
5696
|
);
|
|
5670
5697
|
const suggestionProvider = useColumnExpressionSuggestionProvider({
|
|
5671
5698
|
columns: tableConfig.columns,
|
|
5672
5699
|
table: vuuTable
|
|
5673
5700
|
});
|
|
5674
|
-
const handleSubmitExpression = (0,
|
|
5701
|
+
const handleSubmitExpression = (0, import_react40.useCallback)(() => {
|
|
5675
5702
|
var _a, _b;
|
|
5676
5703
|
if (typeRef.current) {
|
|
5677
5704
|
(_b = (_a = typeRef.current) == null ? void 0 : _a.querySelector("button")) == null ? void 0 : _b.focus();
|
|
@@ -5686,7 +5713,7 @@ var ColumnExpressionPanel = ({
|
|
|
5686
5713
|
{
|
|
5687
5714
|
className: "vuuInput",
|
|
5688
5715
|
onChange: onChangeName,
|
|
5689
|
-
value: (0,
|
|
5716
|
+
value: (0, import_vuu_utils40.getCalculatedColumnName)(column)
|
|
5690
5717
|
}
|
|
5691
5718
|
)
|
|
5692
5719
|
] }),
|
|
@@ -5710,7 +5737,7 @@ var ColumnExpressionPanel = ({
|
|
|
5710
5737
|
className: `${classBase16}-type`,
|
|
5711
5738
|
onSelectionChange: onChangeType,
|
|
5712
5739
|
ref: typeRef,
|
|
5713
|
-
selected: (0,
|
|
5740
|
+
selected: (0, import_vuu_utils40.getCalculatedColumnType)(column) || null,
|
|
5714
5741
|
source: ["double", "long", "string"],
|
|
5715
5742
|
width: "100%"
|
|
5716
5743
|
}
|
|
@@ -5721,15 +5748,15 @@ var ColumnExpressionPanel = ({
|
|
|
5721
5748
|
|
|
5722
5749
|
// src/column-formatting-settings/ColumnFormattingPanel.tsx
|
|
5723
5750
|
var import_vuu_ui_controls14 = require("@vuu-ui/vuu-ui-controls");
|
|
5724
|
-
var
|
|
5751
|
+
var import_vuu_utils44 = require("@vuu-ui/vuu-utils");
|
|
5725
5752
|
var import_core11 = require("@salt-ds/core");
|
|
5726
5753
|
var import_clsx15 = __toESM(require("clsx"), 1);
|
|
5727
|
-
var
|
|
5754
|
+
var import_react44 = require("react");
|
|
5728
5755
|
|
|
5729
5756
|
// src/column-formatting-settings/BaseNumericFormattingSettings.tsx
|
|
5730
5757
|
var import_core8 = require("@salt-ds/core");
|
|
5731
|
-
var
|
|
5732
|
-
var
|
|
5758
|
+
var import_vuu_utils41 = require("@vuu-ui/vuu-utils");
|
|
5759
|
+
var import_react41 = require("react");
|
|
5733
5760
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
5734
5761
|
var classBase17 = "vuuFormattingSettings";
|
|
5735
5762
|
var BaseNumericFormattingSettings = ({
|
|
@@ -5737,8 +5764,8 @@ var BaseNumericFormattingSettings = ({
|
|
|
5737
5764
|
onChangeFormatting: onChange
|
|
5738
5765
|
}) => {
|
|
5739
5766
|
var _a, _b, _c;
|
|
5740
|
-
const [formattingSettings, setFormattingSettings] = (0,
|
|
5741
|
-
const handleInputKeyDown = (0,
|
|
5767
|
+
const [formattingSettings, setFormattingSettings] = (0, import_react41.useState)((0, import_vuu_utils41.getTypeFormattingFromColumn)(column));
|
|
5768
|
+
const handleInputKeyDown = (0, import_react41.useCallback)(
|
|
5742
5769
|
(evt) => {
|
|
5743
5770
|
if (evt.key === "Enter" || evt.key === "Tab") {
|
|
5744
5771
|
onChange(formattingSettings);
|
|
@@ -5746,7 +5773,7 @@ var BaseNumericFormattingSettings = ({
|
|
|
5746
5773
|
},
|
|
5747
5774
|
[formattingSettings, onChange]
|
|
5748
5775
|
);
|
|
5749
|
-
const handleChangeDecimals = (0,
|
|
5776
|
+
const handleChangeDecimals = (0, import_react41.useCallback)(
|
|
5750
5777
|
(evt) => {
|
|
5751
5778
|
const { value } = evt.target;
|
|
5752
5779
|
const numericValue = value === "" ? void 0 : isNaN(parseInt(value)) ? void 0 : parseInt(value);
|
|
@@ -5758,7 +5785,7 @@ var BaseNumericFormattingSettings = ({
|
|
|
5758
5785
|
},
|
|
5759
5786
|
[formattingSettings]
|
|
5760
5787
|
);
|
|
5761
|
-
const handleChangeAlignDecimals = (0,
|
|
5788
|
+
const handleChangeAlignDecimals = (0, import_react41.useCallback)(
|
|
5762
5789
|
(evt) => {
|
|
5763
5790
|
const { checked } = evt.target;
|
|
5764
5791
|
const newFormattingSettings = {
|
|
@@ -5770,7 +5797,7 @@ var BaseNumericFormattingSettings = ({
|
|
|
5770
5797
|
},
|
|
5771
5798
|
[formattingSettings, onChange]
|
|
5772
5799
|
);
|
|
5773
|
-
const handleChangeZeroPad = (0,
|
|
5800
|
+
const handleChangeZeroPad = (0, import_react41.useCallback)(
|
|
5774
5801
|
(evt) => {
|
|
5775
5802
|
const { checked } = evt.target;
|
|
5776
5803
|
const newFormattingSettings = {
|
|
@@ -5821,32 +5848,32 @@ var BaseNumericFormattingSettings = ({
|
|
|
5821
5848
|
};
|
|
5822
5849
|
|
|
5823
5850
|
// src/column-formatting-settings/LongTypeFormattingSettings.tsx
|
|
5824
|
-
var
|
|
5851
|
+
var import_react43 = require("react");
|
|
5825
5852
|
var import_core10 = require("@salt-ds/core");
|
|
5826
|
-
var
|
|
5853
|
+
var import_vuu_utils43 = require("@vuu-ui/vuu-utils");
|
|
5827
5854
|
|
|
5828
5855
|
// src/column-formatting-settings/DateTimeFormattingSettings.tsx
|
|
5829
|
-
var
|
|
5856
|
+
var import_react42 = require("react");
|
|
5830
5857
|
var import_vuu_ui_controls13 = require("@vuu-ui/vuu-ui-controls");
|
|
5831
|
-
var
|
|
5858
|
+
var import_vuu_utils42 = require("@vuu-ui/vuu-utils");
|
|
5832
5859
|
var import_core9 = require("@salt-ds/core");
|
|
5833
5860
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
5834
5861
|
var DateTimeFormattingSettings = ({ column, onChangeFormatting: onChange }) => {
|
|
5835
5862
|
var _a, _b;
|
|
5836
|
-
const formatting = (0,
|
|
5837
|
-
const { pattern =
|
|
5838
|
-
const toggleValue = (0,
|
|
5839
|
-
const [fallbackState, setFallbackState] = (0,
|
|
5863
|
+
const formatting = (0, import_vuu_utils42.getTypeFormattingFromColumn)(column);
|
|
5864
|
+
const { pattern = import_vuu_utils42.fallbackDateTimePattern } = formatting;
|
|
5865
|
+
const toggleValue = (0, import_react42.useMemo)(() => getToggleValue(pattern), [pattern]);
|
|
5866
|
+
const [fallbackState, setFallbackState] = (0, import_react42.useState)(
|
|
5840
5867
|
{
|
|
5841
|
-
time: (_a = pattern.time) != null ? _a :
|
|
5842
|
-
date: (_b = pattern.date) != null ? _b :
|
|
5868
|
+
time: (_a = pattern.time) != null ? _a : import_vuu_utils42.defaultPatternsByType.time,
|
|
5869
|
+
date: (_b = pattern.date) != null ? _b : import_vuu_utils42.defaultPatternsByType.date
|
|
5843
5870
|
}
|
|
5844
5871
|
);
|
|
5845
|
-
const onPatternChange = (0,
|
|
5872
|
+
const onPatternChange = (0, import_react42.useCallback)(
|
|
5846
5873
|
(pattern2) => onChange({ ...formatting, pattern: pattern2 }),
|
|
5847
5874
|
[onChange, formatting]
|
|
5848
5875
|
);
|
|
5849
|
-
const onDropdownChange = (0,
|
|
5876
|
+
const onDropdownChange = (0, import_react42.useCallback)(
|
|
5850
5877
|
(key) => (_, p) => {
|
|
5851
5878
|
const updatedPattern = { ...pattern != null ? pattern : {}, [key]: p };
|
|
5852
5879
|
setFallbackState((s) => {
|
|
@@ -5860,7 +5887,7 @@ var DateTimeFormattingSettings = ({ column, onChangeFormatting: onChange }) => {
|
|
|
5860
5887
|
},
|
|
5861
5888
|
[onPatternChange, pattern]
|
|
5862
5889
|
);
|
|
5863
|
-
const onToggleChange = (0,
|
|
5890
|
+
const onToggleChange = (0, import_react42.useCallback)(
|
|
5864
5891
|
(evnt) => {
|
|
5865
5892
|
var _a2, _b2, _c, _d;
|
|
5866
5893
|
const value = evnt.currentTarget.value;
|
|
@@ -5902,7 +5929,7 @@ var DateTimeFormattingSettings = ({ column, onChangeFormatting: onChange }) => {
|
|
|
5902
5929
|
{
|
|
5903
5930
|
onSelectionChange: onDropdownChange(v),
|
|
5904
5931
|
selected: pattern[v],
|
|
5905
|
-
source:
|
|
5932
|
+
source: import_vuu_utils42.supportedDateTimePatterns[v],
|
|
5906
5933
|
width: "100%"
|
|
5907
5934
|
}
|
|
5908
5935
|
)
|
|
@@ -5920,8 +5947,8 @@ var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
|
5920
5947
|
var classBase18 = "vuuLongColumnFormattingSettings";
|
|
5921
5948
|
var LongTypeFormattingSettings = (props) => {
|
|
5922
5949
|
const { column, onChangeType } = props;
|
|
5923
|
-
const type = (0,
|
|
5924
|
-
const handleToggleChange = (0,
|
|
5950
|
+
const type = (0, import_vuu_utils43.isTypeDescriptor)(column.type) ? column.type.name : column.type;
|
|
5951
|
+
const handleToggleChange = (0, import_react43.useCallback)(
|
|
5925
5952
|
(event) => {
|
|
5926
5953
|
const value = event.currentTarget.value;
|
|
5927
5954
|
onChangeType(value);
|
|
@@ -5941,7 +5968,7 @@ var LongTypeFormattingSettings = (props) => {
|
|
|
5941
5968
|
}
|
|
5942
5969
|
)
|
|
5943
5970
|
] }),
|
|
5944
|
-
(0,
|
|
5971
|
+
(0, import_vuu_utils43.isDateTimeColumn)(column) ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DateTimeFormattingSettings, { ...props, column }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(BaseNumericFormattingSettings, { ...props })
|
|
5945
5972
|
] });
|
|
5946
5973
|
};
|
|
5947
5974
|
var toggleValues2 = ["number", "date/time"];
|
|
@@ -5962,28 +5989,28 @@ var ColumnFormattingPanel = ({
|
|
|
5962
5989
|
onChangeRendering,
|
|
5963
5990
|
...htmlAttributes
|
|
5964
5991
|
}) => {
|
|
5965
|
-
const formattingSettingsForType = (0,
|
|
5992
|
+
const formattingSettingsForType = (0, import_react44.useMemo)(
|
|
5966
5993
|
() => formattingSettingsByColType({ column, onChangeFormatting, onChangeType }),
|
|
5967
5994
|
[column, onChangeFormatting, onChangeType]
|
|
5968
5995
|
);
|
|
5969
|
-
const ConfigEditor = (0,
|
|
5996
|
+
const ConfigEditor = (0, import_react44.useMemo)(() => {
|
|
5970
5997
|
const { type } = column;
|
|
5971
|
-
if ((0,
|
|
5972
|
-
const cellRendererOptions = (0,
|
|
5973
|
-
return (0,
|
|
5998
|
+
if ((0, import_vuu_utils44.isTypeDescriptor)(type) && (0, import_vuu_utils44.isColumnTypeRenderer)(type.renderer)) {
|
|
5999
|
+
const cellRendererOptions = (0, import_vuu_utils44.getCellRendererOptions)(type.renderer.name);
|
|
6000
|
+
return (0, import_vuu_utils44.getConfigurationEditor)(cellRendererOptions == null ? void 0 : cellRendererOptions.configEditor);
|
|
5974
6001
|
}
|
|
5975
6002
|
return void 0;
|
|
5976
6003
|
}, [column]);
|
|
5977
|
-
const selectedCellRenderer = (0,
|
|
6004
|
+
const selectedCellRenderer = (0, import_react44.useMemo)(() => {
|
|
5978
6005
|
const { type } = column;
|
|
5979
6006
|
const [defaultRenderer] = availableRenderers;
|
|
5980
|
-
const rendererName = (0,
|
|
6007
|
+
const rendererName = (0, import_vuu_utils44.isTypeDescriptor)(type) && (0, import_vuu_utils44.isColumnTypeRenderer)(type.renderer) ? type.renderer.name : void 0;
|
|
5981
6008
|
const configuredRenderer = availableRenderers.find(
|
|
5982
6009
|
(renderer) => renderer.name === rendererName
|
|
5983
6010
|
);
|
|
5984
6011
|
return configuredRenderer != null ? configuredRenderer : defaultRenderer;
|
|
5985
6012
|
}, [availableRenderers, column]);
|
|
5986
|
-
const handleChangeRenderer = (0,
|
|
6013
|
+
const handleChangeRenderer = (0, import_react44.useCallback)(
|
|
5987
6014
|
(_, cellRendererDescriptor) => {
|
|
5988
6015
|
const renderProps = {
|
|
5989
6016
|
name: cellRendererDescriptor.name
|
|
@@ -6042,12 +6069,12 @@ function formattingSettingsByColType(props) {
|
|
|
6042
6069
|
|
|
6043
6070
|
// src/column-settings/ColumnNameLabel.tsx
|
|
6044
6071
|
var import_clsx16 = __toESM(require("clsx"), 1);
|
|
6045
|
-
var
|
|
6072
|
+
var import_vuu_utils45 = require("@vuu-ui/vuu-utils");
|
|
6046
6073
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
6047
6074
|
var classBase20 = "vuuColumnNameLabel";
|
|
6048
6075
|
var ColumnNameLabel = ({ column, onClick }) => {
|
|
6049
|
-
if ((0,
|
|
6050
|
-
const [name2, type, expression] = (0,
|
|
6076
|
+
if ((0, import_vuu_utils45.isCalculatedColumn)(column.name)) {
|
|
6077
|
+
const [name2, type, expression] = (0, import_vuu_utils45.getCalculatedColumnDetails)(column);
|
|
6051
6078
|
const displayName = name2 || "name";
|
|
6052
6079
|
const displayExpression = "=expression";
|
|
6053
6080
|
const nameClass = displayName === "name" ? `${classBase20}-placeholder` : void 0;
|
|
@@ -6073,15 +6100,15 @@ var ColumnNameLabel = ({ column, onClick }) => {
|
|
|
6073
6100
|
};
|
|
6074
6101
|
|
|
6075
6102
|
// src/column-settings/useColumnSettings.ts
|
|
6076
|
-
var
|
|
6077
|
-
var
|
|
6103
|
+
var import_vuu_utils46 = require("@vuu-ui/vuu-utils");
|
|
6104
|
+
var import_react45 = require("react");
|
|
6078
6105
|
var integerCellRenderers = [
|
|
6079
6106
|
{
|
|
6080
6107
|
description: "Default formatter for columns with data type integer",
|
|
6081
6108
|
label: "Default Renderer (int, long)",
|
|
6082
6109
|
name: "default-int"
|
|
6083
6110
|
},
|
|
6084
|
-
...(0,
|
|
6111
|
+
...(0, import_vuu_utils46.getRegisteredCellRenderers)("int")
|
|
6085
6112
|
];
|
|
6086
6113
|
var doubleCellRenderers = [
|
|
6087
6114
|
{
|
|
@@ -6089,7 +6116,7 @@ var doubleCellRenderers = [
|
|
|
6089
6116
|
label: "Default Renderer (double)",
|
|
6090
6117
|
name: "default-double"
|
|
6091
6118
|
},
|
|
6092
|
-
...(0,
|
|
6119
|
+
...(0, import_vuu_utils46.getRegisteredCellRenderers)("double")
|
|
6093
6120
|
];
|
|
6094
6121
|
var stringCellRenderers = [
|
|
6095
6122
|
{
|
|
@@ -6097,10 +6124,10 @@ var stringCellRenderers = [
|
|
|
6097
6124
|
label: "Default Renderer (string)",
|
|
6098
6125
|
name: "default-string"
|
|
6099
6126
|
},
|
|
6100
|
-
...(0,
|
|
6127
|
+
...(0, import_vuu_utils46.getRegisteredCellRenderers)("string")
|
|
6101
6128
|
];
|
|
6102
6129
|
var booleanCellRenderers = [
|
|
6103
|
-
...(0,
|
|
6130
|
+
...(0, import_vuu_utils46.getRegisteredCellRenderers)("boolean")
|
|
6104
6131
|
];
|
|
6105
6132
|
var getAvailableCellRenderers = (column) => {
|
|
6106
6133
|
switch (column.serverDataType) {
|
|
@@ -6153,26 +6180,26 @@ var useColumnSettings = ({
|
|
|
6153
6180
|
onCreateCalculatedColumn,
|
|
6154
6181
|
tableConfig
|
|
6155
6182
|
}) => {
|
|
6156
|
-
const [column, setColumn] = (0,
|
|
6183
|
+
const [column, setColumn] = (0, import_react45.useState)(
|
|
6157
6184
|
getColumn(tableConfig.columns, columnProp)
|
|
6158
6185
|
);
|
|
6159
|
-
const columnRef = (0,
|
|
6160
|
-
const [inEditMode, setEditMode] = (0,
|
|
6161
|
-
const handleEditCalculatedcolumn = (0,
|
|
6186
|
+
const columnRef = (0, import_react45.useRef)(column);
|
|
6187
|
+
const [inEditMode, setEditMode] = (0, import_react45.useState)(column.name === "::");
|
|
6188
|
+
const handleEditCalculatedcolumn = (0, import_react45.useCallback)(() => {
|
|
6162
6189
|
columnRef.current = column;
|
|
6163
6190
|
setEditMode(true);
|
|
6164
6191
|
}, [column]);
|
|
6165
|
-
(0,
|
|
6192
|
+
(0, import_react45.useEffect)(() => {
|
|
6166
6193
|
setColumn(columnProp);
|
|
6167
6194
|
setEditMode(columnProp.name === "::");
|
|
6168
6195
|
}, [columnProp]);
|
|
6169
|
-
const availableRenderers = (0,
|
|
6196
|
+
const availableRenderers = (0, import_react45.useMemo)(() => {
|
|
6170
6197
|
return getAvailableCellRenderers(column);
|
|
6171
6198
|
}, [column]);
|
|
6172
|
-
const handleInputCommit = (0,
|
|
6199
|
+
const handleInputCommit = (0, import_react45.useCallback)(() => {
|
|
6173
6200
|
onConfigChange(replaceColumn2(tableConfig, column));
|
|
6174
6201
|
}, [column, onConfigChange, tableConfig]);
|
|
6175
|
-
const handleChange = (0,
|
|
6202
|
+
const handleChange = (0, import_react45.useCallback)(
|
|
6176
6203
|
(evt) => {
|
|
6177
6204
|
const input = evt.target;
|
|
6178
6205
|
const fieldName = getFieldName(input);
|
|
@@ -6182,13 +6209,13 @@ var useColumnSettings = ({
|
|
|
6182
6209
|
setColumn((state) => ({ ...state, label: value }));
|
|
6183
6210
|
break;
|
|
6184
6211
|
case "column-name":
|
|
6185
|
-
setColumn((state) => (0,
|
|
6212
|
+
setColumn((state) => (0, import_vuu_utils46.setCalculatedColumnName)(state, value));
|
|
6186
6213
|
break;
|
|
6187
6214
|
case "column-width":
|
|
6188
6215
|
setColumn((state) => ({ ...state, width: parseInt(value) }));
|
|
6189
6216
|
break;
|
|
6190
6217
|
case "column-alignment":
|
|
6191
|
-
if ((0,
|
|
6218
|
+
if ((0, import_vuu_utils46.isValidColumnAlignment)(value)) {
|
|
6192
6219
|
const newColumn = {
|
|
6193
6220
|
...column,
|
|
6194
6221
|
align: value || void 0
|
|
@@ -6198,7 +6225,7 @@ var useColumnSettings = ({
|
|
|
6198
6225
|
}
|
|
6199
6226
|
break;
|
|
6200
6227
|
case "column-pin":
|
|
6201
|
-
if ((0,
|
|
6228
|
+
if ((0, import_vuu_utils46.isValidPinLocation)(value)) {
|
|
6202
6229
|
const newColumn = {
|
|
6203
6230
|
...column,
|
|
6204
6231
|
pin: value || void 0
|
|
@@ -6211,29 +6238,29 @@ var useColumnSettings = ({
|
|
|
6211
6238
|
},
|
|
6212
6239
|
[column, onConfigChange, tableConfig]
|
|
6213
6240
|
);
|
|
6214
|
-
const handleChangeCalculatedColumnName = (0,
|
|
6241
|
+
const handleChangeCalculatedColumnName = (0, import_react45.useCallback)((name2) => {
|
|
6215
6242
|
setColumn((state) => ({ ...state, name: name2 }));
|
|
6216
6243
|
}, []);
|
|
6217
|
-
const handleChangeFormatting = (0,
|
|
6244
|
+
const handleChangeFormatting = (0, import_react45.useCallback)(
|
|
6218
6245
|
(formatting) => {
|
|
6219
|
-
const newColumn = (0,
|
|
6246
|
+
const newColumn = (0, import_vuu_utils46.updateColumnFormatting)(column, formatting);
|
|
6220
6247
|
setColumn(newColumn);
|
|
6221
6248
|
onConfigChange(replaceColumn2(tableConfig, newColumn));
|
|
6222
6249
|
},
|
|
6223
6250
|
[column, onConfigChange, tableConfig]
|
|
6224
6251
|
);
|
|
6225
|
-
const handleChangeType = (0,
|
|
6252
|
+
const handleChangeType = (0, import_react45.useCallback)(
|
|
6226
6253
|
(type) => {
|
|
6227
|
-
const updatedColumn = (0,
|
|
6254
|
+
const updatedColumn = (0, import_vuu_utils46.updateColumnType)(column, type);
|
|
6228
6255
|
setColumn(updatedColumn);
|
|
6229
6256
|
onConfigChange(replaceColumn2(tableConfig, updatedColumn));
|
|
6230
6257
|
},
|
|
6231
6258
|
[column, onConfigChange, tableConfig]
|
|
6232
6259
|
);
|
|
6233
|
-
const handleChangeRendering = (0,
|
|
6260
|
+
const handleChangeRendering = (0, import_react45.useCallback)(
|
|
6234
6261
|
(renderProps) => {
|
|
6235
6262
|
if (renderProps) {
|
|
6236
|
-
const newColumn = (0,
|
|
6263
|
+
const newColumn = (0, import_vuu_utils46.updateColumnRenderProps)(
|
|
6237
6264
|
column,
|
|
6238
6265
|
renderProps
|
|
6239
6266
|
);
|
|
@@ -6243,7 +6270,7 @@ var useColumnSettings = ({
|
|
|
6243
6270
|
},
|
|
6244
6271
|
[column, onConfigChange, tableConfig]
|
|
6245
6272
|
);
|
|
6246
|
-
const navigateColumn = (0,
|
|
6273
|
+
const navigateColumn = (0, import_react45.useCallback)(
|
|
6247
6274
|
({ moveBy }) => {
|
|
6248
6275
|
const { columns } = tableConfig;
|
|
6249
6276
|
const index = columns.indexOf(column) + moveBy;
|
|
@@ -6254,16 +6281,16 @@ var useColumnSettings = ({
|
|
|
6254
6281
|
},
|
|
6255
6282
|
[column, tableConfig]
|
|
6256
6283
|
);
|
|
6257
|
-
const navigateNextColumn = (0,
|
|
6284
|
+
const navigateNextColumn = (0, import_react45.useCallback)(() => {
|
|
6258
6285
|
navigateColumn({ moveBy: 1 });
|
|
6259
6286
|
}, [navigateColumn]);
|
|
6260
|
-
const navigatePrevColumn = (0,
|
|
6287
|
+
const navigatePrevColumn = (0, import_react45.useCallback)(() => {
|
|
6261
6288
|
navigateColumn({ moveBy: -1 });
|
|
6262
6289
|
}, [navigateColumn]);
|
|
6263
|
-
const handleSaveCalculatedColumn = (0,
|
|
6290
|
+
const handleSaveCalculatedColumn = (0, import_react45.useCallback)(() => {
|
|
6264
6291
|
onCreateCalculatedColumn(column);
|
|
6265
6292
|
}, [column, onCreateCalculatedColumn]);
|
|
6266
|
-
const handleCancelEdit = (0,
|
|
6293
|
+
const handleCancelEdit = (0, import_react45.useCallback)(() => {
|
|
6267
6294
|
if (columnProp.name === "::") {
|
|
6268
6295
|
onCancelCreateColumn();
|
|
6269
6296
|
} else {
|
|
@@ -6296,8 +6323,8 @@ var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
|
6296
6323
|
var classBase21 = "vuuColumnSettingsPanel";
|
|
6297
6324
|
var getColumnLabel3 = (column) => {
|
|
6298
6325
|
const { name: name2, label } = column;
|
|
6299
|
-
if ((0,
|
|
6300
|
-
return label != null ? label : (0,
|
|
6326
|
+
if ((0, import_vuu_utils47.isCalculatedColumn)(name2)) {
|
|
6327
|
+
return label != null ? label : (0, import_vuu_utils47.getCalculatedColumnName)(column);
|
|
6301
6328
|
} else {
|
|
6302
6329
|
return label != null ? label : name2;
|
|
6303
6330
|
}
|
|
@@ -6335,7 +6362,7 @@ var ColumnSettingsPanel = ({
|
|
|
6335
6362
|
});
|
|
6336
6363
|
const {
|
|
6337
6364
|
serverDataType,
|
|
6338
|
-
align = (0,
|
|
6365
|
+
align = (0, import_vuu_utils47.getDefaultAlignment)(serverDataType),
|
|
6339
6366
|
pin,
|
|
6340
6367
|
width
|
|
6341
6368
|
} = column;
|
|
@@ -6519,7 +6546,7 @@ var ColumnSettingsPanel = ({
|
|
|
6519
6546
|
|
|
6520
6547
|
// src/datasource-stats/DatasourceStats.tsx
|
|
6521
6548
|
var import_clsx18 = __toESM(require("clsx"), 1);
|
|
6522
|
-
var
|
|
6549
|
+
var import_react46 = require("react");
|
|
6523
6550
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
6524
6551
|
var classBase22 = "vuuDatasourceStats";
|
|
6525
6552
|
var numberFormatter = new Intl.NumberFormat();
|
|
@@ -6527,9 +6554,9 @@ var DataSourceStats = ({
|
|
|
6527
6554
|
className: classNameProp,
|
|
6528
6555
|
dataSource
|
|
6529
6556
|
}) => {
|
|
6530
|
-
const [range, setRange] = (0,
|
|
6531
|
-
const [size, setSize] = (0,
|
|
6532
|
-
(0,
|
|
6557
|
+
const [range, setRange] = (0, import_react46.useState)(dataSource.range);
|
|
6558
|
+
const [size, setSize] = (0, import_react46.useState)(dataSource.size);
|
|
6559
|
+
(0, import_react46.useEffect)(() => {
|
|
6533
6560
|
setSize(dataSource.size);
|
|
6534
6561
|
dataSource.on("resize", setSize);
|
|
6535
6562
|
dataSource.on("range", setRange);
|
|
@@ -6552,8 +6579,8 @@ var DataSourceStats = ({
|
|
|
6552
6579
|
var import_core13 = require("@salt-ds/core");
|
|
6553
6580
|
|
|
6554
6581
|
// src/table-settings/useTableSettings.ts
|
|
6555
|
-
var
|
|
6556
|
-
var
|
|
6582
|
+
var import_vuu_utils48 = require("@vuu-ui/vuu-utils");
|
|
6583
|
+
var import_react47 = require("react");
|
|
6557
6584
|
var sortOrderFromAvailableColumns = (availableColumns, columns) => {
|
|
6558
6585
|
const sortedColumns = [];
|
|
6559
6586
|
for (const { name: name2 } of availableColumns) {
|
|
@@ -6569,7 +6596,7 @@ var buildColumnItems = (availableColumns, configuredColumns) => {
|
|
|
6569
6596
|
const configuredColumn = configuredColumns.find((col) => col.name === name2);
|
|
6570
6597
|
return {
|
|
6571
6598
|
hidden: configuredColumn == null ? void 0 : configuredColumn.hidden,
|
|
6572
|
-
isCalculated: (0,
|
|
6599
|
+
isCalculated: (0, import_vuu_utils48.isCalculatedColumn)(name2),
|
|
6573
6600
|
label: configuredColumn == null ? void 0 : configuredColumn.label,
|
|
6574
6601
|
name: name2,
|
|
6575
6602
|
serverDataType,
|
|
@@ -6583,18 +6610,18 @@ var useTableSettings = ({
|
|
|
6583
6610
|
onDataSourceConfigChange,
|
|
6584
6611
|
tableConfig: tableConfigProp
|
|
6585
6612
|
}) => {
|
|
6586
|
-
const [{ availableColumns, tableConfig }, setColumnState] = (0,
|
|
6613
|
+
const [{ availableColumns, tableConfig }, setColumnState] = (0, import_react47.useState)({
|
|
6587
6614
|
availableColumns: availableColumnsProp,
|
|
6588
6615
|
tableConfig: tableConfigProp
|
|
6589
6616
|
});
|
|
6590
|
-
const columnItems = (0,
|
|
6617
|
+
const columnItems = (0, import_react47.useMemo)(
|
|
6591
6618
|
() => buildColumnItems(availableColumns, tableConfig.columns),
|
|
6592
6619
|
[availableColumns, tableConfig.columns]
|
|
6593
6620
|
);
|
|
6594
|
-
const handleMoveListItem = (0,
|
|
6621
|
+
const handleMoveListItem = (0, import_react47.useCallback)(
|
|
6595
6622
|
(fromIndex, toIndex) => {
|
|
6596
6623
|
setColumnState((state) => {
|
|
6597
|
-
const newAvailableColumns = (0,
|
|
6624
|
+
const newAvailableColumns = (0, import_vuu_utils48.moveItem)(
|
|
6598
6625
|
state.availableColumns,
|
|
6599
6626
|
fromIndex,
|
|
6600
6627
|
toIndex
|
|
@@ -6614,7 +6641,7 @@ var useTableSettings = ({
|
|
|
6614
6641
|
},
|
|
6615
6642
|
[tableConfig.columns]
|
|
6616
6643
|
);
|
|
6617
|
-
const handleColumnChange = (0,
|
|
6644
|
+
const handleColumnChange = (0, import_react47.useCallback)(
|
|
6618
6645
|
(name2, property, value) => {
|
|
6619
6646
|
const columnItem = columnItems.find((col) => col.name === name2);
|
|
6620
6647
|
if (property === "subscribed") {
|
|
@@ -6625,7 +6652,7 @@ var useTableSettings = ({
|
|
|
6625
6652
|
tableConfig: {
|
|
6626
6653
|
...tableConfig,
|
|
6627
6654
|
columns: tableConfig.columns.filter(
|
|
6628
|
-
(0,
|
|
6655
|
+
(0, import_vuu_utils48.subscribedOnly)(subscribedColumns)
|
|
6629
6656
|
)
|
|
6630
6657
|
}
|
|
6631
6658
|
}));
|
|
@@ -6635,7 +6662,7 @@ var useTableSettings = ({
|
|
|
6635
6662
|
} else {
|
|
6636
6663
|
const newConfig = {
|
|
6637
6664
|
...tableConfig,
|
|
6638
|
-
columns: (0,
|
|
6665
|
+
columns: (0, import_vuu_utils48.addColumnToSubscribedColumns)(
|
|
6639
6666
|
tableConfig.columns,
|
|
6640
6667
|
availableColumns,
|
|
6641
6668
|
name2
|
|
@@ -6668,7 +6695,7 @@ var useTableSettings = ({
|
|
|
6668
6695
|
},
|
|
6669
6696
|
[availableColumns, columnItems, onDataSourceConfigChange, tableConfig]
|
|
6670
6697
|
);
|
|
6671
|
-
const handleChangeColumnLabels = (0,
|
|
6698
|
+
const handleChangeColumnLabels = (0, import_react47.useCallback)((evt) => {
|
|
6672
6699
|
const { value } = evt.target;
|
|
6673
6700
|
const columnFormatHeader = value === "0" ? void 0 : value === "1" ? "capitalize" : "uppercase";
|
|
6674
6701
|
setColumnState((state) => ({
|
|
@@ -6679,7 +6706,7 @@ var useTableSettings = ({
|
|
|
6679
6706
|
}
|
|
6680
6707
|
}));
|
|
6681
6708
|
}, []);
|
|
6682
|
-
const handleChangeTableAttribute = (0,
|
|
6709
|
+
const handleChangeTableAttribute = (0, import_react47.useCallback)(
|
|
6683
6710
|
(evt) => {
|
|
6684
6711
|
const { ariaChecked, value } = evt.target;
|
|
6685
6712
|
setColumnState((state) => ({
|
|
@@ -6692,7 +6719,7 @@ var useTableSettings = ({
|
|
|
6692
6719
|
},
|
|
6693
6720
|
[]
|
|
6694
6721
|
);
|
|
6695
|
-
(0,
|
|
6722
|
+
(0, import_vuu_utils48.useLayoutEffectSkipFirst)(() => {
|
|
6696
6723
|
onConfigChange == null ? void 0 : onConfigChange(tableConfig);
|
|
6697
6724
|
}, [onConfigChange, tableConfig]);
|
|
6698
6725
|
const columnLabelsValue = tableConfig.columnFormatHeader === void 0 ? 0 : tableConfig.columnFormatHeader === "capitalize" ? 1 : 2;
|