asma-ui-table 1.0.134 → 1.0.136
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/asma-ui-table.es.js +1362 -169
- package/dist/src/components/TableBody.d.ts +6 -3
- package/dist/src/components/TableRow.d.ts +3 -1
- package/dist/src/components/TableRows.d.ts +6 -3
- package/dist/src/components/table-header/TableHeader.d.ts +4 -2
- package/dist/src/components/table-header/TableHeaderCell.d.ts +1 -2
- package/dist/src/hooks/useColumnVirtualizer.d.ts +16 -0
- package/dist/src/hooks/useRowVirtualizer.d.ts +20 -0
- package/dist/style.css +1 -1
- package/package.json +2 -1
package/dist/asma-ui-table.es.js
CHANGED
|
@@ -5,9 +5,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
import * as React from "react";
|
|
8
|
-
import React__default, { useMemo, useLayoutEffect, useEffect, useRef, useCallback, useState, createContext, memo as memo$
|
|
8
|
+
import React__default, { useMemo, useLayoutEffect, useEffect, useRef, useCallback, useState, createContext, memo as memo$2, useReducer, useContext, createElement, Fragment } from "react";
|
|
9
9
|
import * as ReactDOM from "react-dom";
|
|
10
|
-
import ReactDOM__default, { unstable_batchedUpdates, createPortal } from "react-dom";
|
|
10
|
+
import ReactDOM__default, { unstable_batchedUpdates, createPortal, flushSync } from "react-dom";
|
|
11
11
|
import { twMerge } from "tailwind-merge";
|
|
12
12
|
import { MenuItem, Tooltip, Popover, Skeleton } from "@mui/material";
|
|
13
13
|
import PropTypes from "prop-types";
|
|
@@ -1021,10 +1021,10 @@ function getOwnerDocument(target) {
|
|
|
1021
1021
|
}
|
|
1022
1022
|
return document;
|
|
1023
1023
|
}
|
|
1024
|
-
const useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect;
|
|
1024
|
+
const useIsomorphicLayoutEffect$1 = canUseDOM ? useLayoutEffect : useEffect;
|
|
1025
1025
|
function useEvent(handler) {
|
|
1026
1026
|
const handlerRef = useRef(handler);
|
|
1027
|
-
useIsomorphicLayoutEffect(() => {
|
|
1027
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
1028
1028
|
handlerRef.current = handler;
|
|
1029
1029
|
});
|
|
1030
1030
|
return useCallback(function() {
|
|
@@ -1052,7 +1052,7 @@ function useLatestValue(value, dependencies) {
|
|
|
1052
1052
|
dependencies = [value];
|
|
1053
1053
|
}
|
|
1054
1054
|
const valueRef = useRef(value);
|
|
1055
|
-
useIsomorphicLayoutEffect(() => {
|
|
1055
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
1056
1056
|
if (valueRef.current !== value) {
|
|
1057
1057
|
valueRef.current = value;
|
|
1058
1058
|
}
|
|
@@ -2973,7 +2973,7 @@ function useRect(element, measure, fallbackRect) {
|
|
|
2973
2973
|
const resizeObserver = useResizeObserver({
|
|
2974
2974
|
callback: measureRect
|
|
2975
2975
|
});
|
|
2976
|
-
useIsomorphicLayoutEffect(() => {
|
|
2976
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
2977
2977
|
measureRect();
|
|
2978
2978
|
if (element) {
|
|
2979
2979
|
resizeObserver == null ? void 0 : resizeObserver.observe(element);
|
|
@@ -3156,7 +3156,7 @@ function useRects(elements, measure) {
|
|
|
3156
3156
|
if (elements.length > 0 && rects === defaultValue$2) {
|
|
3157
3157
|
measureRects();
|
|
3158
3158
|
}
|
|
3159
|
-
useIsomorphicLayoutEffect(() => {
|
|
3159
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
3160
3160
|
if (elements.length) {
|
|
3161
3161
|
elements.forEach((element) => resizeObserver == null ? void 0 : resizeObserver.observe(element));
|
|
3162
3162
|
} else {
|
|
@@ -3527,7 +3527,7 @@ function useLayoutShiftScrollCompensation(_ref) {
|
|
|
3527
3527
|
x: config2,
|
|
3528
3528
|
y: config2
|
|
3529
3529
|
} : config2;
|
|
3530
|
-
useIsomorphicLayoutEffect(() => {
|
|
3530
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
3531
3531
|
const disabled = !x && !y;
|
|
3532
3532
|
if (disabled || !activeNode) {
|
|
3533
3533
|
initialized.current = false;
|
|
@@ -3571,7 +3571,7 @@ var Status;
|
|
|
3571
3571
|
Status2[Status2["Initializing"] = 1] = "Initializing";
|
|
3572
3572
|
Status2[Status2["Initialized"] = 2] = "Initialized";
|
|
3573
3573
|
})(Status || (Status = {}));
|
|
3574
|
-
const DndContext = /* @__PURE__ */ memo$
|
|
3574
|
+
const DndContext = /* @__PURE__ */ memo$2(function DndContext2(_ref) {
|
|
3575
3575
|
var _sensorContext$curren, _dragOverlay$nodeRef$, _dragOverlay$rect, _over$rect;
|
|
3576
3576
|
let {
|
|
3577
3577
|
id,
|
|
@@ -3849,7 +3849,7 @@ const DndContext = /* @__PURE__ */ memo$1(function DndContext2(_ref) {
|
|
|
3849
3849
|
}, [draggableNodes, instantiateSensor]);
|
|
3850
3850
|
const activators = useCombineActivators(sensors, bindActivatorToSensorInstantiator);
|
|
3851
3851
|
useSensorSetup(sensors);
|
|
3852
|
-
useIsomorphicLayoutEffect(() => {
|
|
3852
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
3853
3853
|
if (activeNodeRect && status === Status.Initializing) {
|
|
3854
3854
|
setStatus(Status.Initialized);
|
|
3855
3855
|
}
|
|
@@ -3933,7 +3933,7 @@ const DndContext = /* @__PURE__ */ memo$1(function DndContext2(_ref) {
|
|
|
3933
3933
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3934
3934
|
[overId]
|
|
3935
3935
|
);
|
|
3936
|
-
useIsomorphicLayoutEffect(() => {
|
|
3936
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
3937
3937
|
sensorContext.current = {
|
|
3938
3938
|
activatorEvent,
|
|
3939
3939
|
active,
|
|
@@ -4060,7 +4060,7 @@ function useDraggable(_ref) {
|
|
|
4060
4060
|
const [activatorNode, setActivatorNodeRef] = useNodeRef();
|
|
4061
4061
|
const listeners = useSyntheticListeners(activators, id);
|
|
4062
4062
|
const dataRef = useLatestValue(data);
|
|
4063
|
-
useIsomorphicLayoutEffect(
|
|
4063
|
+
useIsomorphicLayoutEffect$1(
|
|
4064
4064
|
() => {
|
|
4065
4065
|
draggableNodes.set(id, {
|
|
4066
4066
|
id,
|
|
@@ -4180,7 +4180,7 @@ function useDroppable(_ref) {
|
|
|
4180
4180
|
resizeObserverConnected.current = false;
|
|
4181
4181
|
resizeObserver.observe(nodeRef.current);
|
|
4182
4182
|
}, [nodeRef, resizeObserver]);
|
|
4183
|
-
useIsomorphicLayoutEffect(
|
|
4183
|
+
useIsomorphicLayoutEffect$1(
|
|
4184
4184
|
() => {
|
|
4185
4185
|
dispatch({
|
|
4186
4186
|
type: Action.RegisterDroppable,
|
|
@@ -4419,7 +4419,7 @@ function SortableContext(_ref) {
|
|
|
4419
4419
|
const itemsHaveChanged = !itemsEqual(items, previousItemsRef.current);
|
|
4420
4420
|
const disableTransforms = overIndex !== -1 && activeIndex === -1 || itemsHaveChanged;
|
|
4421
4421
|
const disabled = normalizeDisabled(disabledProp);
|
|
4422
|
-
useIsomorphicLayoutEffect(() => {
|
|
4422
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
4423
4423
|
if (itemsHaveChanged && isDragging) {
|
|
4424
4424
|
measureDroppableContainers(items);
|
|
4425
4425
|
}
|
|
@@ -4500,7 +4500,7 @@ function useDerivedTransform(_ref) {
|
|
|
4500
4500
|
} = _ref;
|
|
4501
4501
|
const [derivedTransform, setDerivedtransform] = useState(null);
|
|
4502
4502
|
const previousIndex = useRef(index);
|
|
4503
|
-
useIsomorphicLayoutEffect(() => {
|
|
4503
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
4504
4504
|
if (!disabled && index !== previousIndex.current && node.current) {
|
|
4505
4505
|
const initial = rect.current;
|
|
4506
4506
|
if (initial) {
|
|
@@ -4841,7 +4841,7 @@ function flattenBy(arr, getChildren) {
|
|
|
4841
4841
|
recurse(arr);
|
|
4842
4842
|
return flat;
|
|
4843
4843
|
}
|
|
4844
|
-
function memo(getDeps, fn, opts) {
|
|
4844
|
+
function memo$1(getDeps, fn, opts) {
|
|
4845
4845
|
let deps = [];
|
|
4846
4846
|
let result;
|
|
4847
4847
|
return (depArgs) => {
|
|
@@ -4901,7 +4901,7 @@ function createCell(table, row, column, columnId) {
|
|
|
4901
4901
|
column,
|
|
4902
4902
|
getValue: () => row.getValue(columnId),
|
|
4903
4903
|
renderValue: getRenderValue,
|
|
4904
|
-
getContext: memo(() => [table, column, row, cell], (table2, column2, row2, cell2) => ({
|
|
4904
|
+
getContext: memo$1(() => [table, column, row, cell], (table2, column2, row2, cell2) => ({
|
|
4905
4905
|
table: table2,
|
|
4906
4906
|
column: column2,
|
|
4907
4907
|
row: row2,
|
|
@@ -4957,11 +4957,11 @@ function createColumn(table, columnDef, depth, parent) {
|
|
|
4957
4957
|
depth,
|
|
4958
4958
|
columnDef: resolvedColumnDef,
|
|
4959
4959
|
columns: [],
|
|
4960
|
-
getFlatColumns: memo(() => [true], () => {
|
|
4960
|
+
getFlatColumns: memo$1(() => [true], () => {
|
|
4961
4961
|
var _column$columns;
|
|
4962
4962
|
return [column, ...(_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap((d) => d.getFlatColumns())];
|
|
4963
4963
|
}, getMemoOptions(table.options, "debugColumns", "column.getFlatColumns")),
|
|
4964
|
-
getLeafColumns: memo(() => [table._getOrderColumnsFn()], (orderColumns2) => {
|
|
4964
|
+
getLeafColumns: memo$1(() => [table._getOrderColumnsFn()], (orderColumns2) => {
|
|
4965
4965
|
var _column$columns2;
|
|
4966
4966
|
if ((_column$columns2 = column.columns) != null && _column$columns2.length) {
|
|
4967
4967
|
let leafColumns = column.columns.flatMap((column2) => column2.getLeafColumns());
|
|
@@ -5014,7 +5014,7 @@ function createHeader(table, column, options) {
|
|
|
5014
5014
|
}
|
|
5015
5015
|
const Headers = {
|
|
5016
5016
|
createTable: (table) => {
|
|
5017
|
-
table.getHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
|
|
5017
|
+
table.getHeaderGroups = memo$1(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
|
|
5018
5018
|
var _left$map$filter, _right$map$filter;
|
|
5019
5019
|
const leftColumns = (_left$map$filter = left == null ? void 0 : left.map((columnId) => leafColumns.find((d) => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
|
|
5020
5020
|
const rightColumns = (_right$map$filter = right == null ? void 0 : right.map((columnId) => leafColumns.find((d) => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
|
|
@@ -5022,71 +5022,71 @@ const Headers = {
|
|
|
5022
5022
|
const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table);
|
|
5023
5023
|
return headerGroups;
|
|
5024
5024
|
}, getMemoOptions(table.options, debug, "getHeaderGroups"));
|
|
5025
|
-
table.getCenterHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
|
|
5025
|
+
table.getCenterHeaderGroups = memo$1(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
|
|
5026
5026
|
leafColumns = leafColumns.filter((column) => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
|
|
5027
5027
|
return buildHeaderGroups(allColumns, leafColumns, table, "center");
|
|
5028
5028
|
}, getMemoOptions(table.options, debug, "getCenterHeaderGroups"));
|
|
5029
|
-
table.getLeftHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => {
|
|
5029
|
+
table.getLeftHeaderGroups = memo$1(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => {
|
|
5030
5030
|
var _left$map$filter2;
|
|
5031
5031
|
const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map((columnId) => leafColumns.find((d) => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
|
|
5032
5032
|
return buildHeaderGroups(allColumns, orderedLeafColumns, table, "left");
|
|
5033
5033
|
}, getMemoOptions(table.options, debug, "getLeftHeaderGroups"));
|
|
5034
|
-
table.getRightHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => {
|
|
5034
|
+
table.getRightHeaderGroups = memo$1(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => {
|
|
5035
5035
|
var _right$map$filter2;
|
|
5036
5036
|
const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map((columnId) => leafColumns.find((d) => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];
|
|
5037
5037
|
return buildHeaderGroups(allColumns, orderedLeafColumns, table, "right");
|
|
5038
5038
|
}, getMemoOptions(table.options, debug, "getRightHeaderGroups"));
|
|
5039
|
-
table.getFooterGroups = memo(() => [table.getHeaderGroups()], (headerGroups) => {
|
|
5039
|
+
table.getFooterGroups = memo$1(() => [table.getHeaderGroups()], (headerGroups) => {
|
|
5040
5040
|
return [...headerGroups].reverse();
|
|
5041
5041
|
}, getMemoOptions(table.options, debug, "getFooterGroups"));
|
|
5042
|
-
table.getLeftFooterGroups = memo(() => [table.getLeftHeaderGroups()], (headerGroups) => {
|
|
5042
|
+
table.getLeftFooterGroups = memo$1(() => [table.getLeftHeaderGroups()], (headerGroups) => {
|
|
5043
5043
|
return [...headerGroups].reverse();
|
|
5044
5044
|
}, getMemoOptions(table.options, debug, "getLeftFooterGroups"));
|
|
5045
|
-
table.getCenterFooterGroups = memo(() => [table.getCenterHeaderGroups()], (headerGroups) => {
|
|
5045
|
+
table.getCenterFooterGroups = memo$1(() => [table.getCenterHeaderGroups()], (headerGroups) => {
|
|
5046
5046
|
return [...headerGroups].reverse();
|
|
5047
5047
|
}, getMemoOptions(table.options, debug, "getCenterFooterGroups"));
|
|
5048
|
-
table.getRightFooterGroups = memo(() => [table.getRightHeaderGroups()], (headerGroups) => {
|
|
5048
|
+
table.getRightFooterGroups = memo$1(() => [table.getRightHeaderGroups()], (headerGroups) => {
|
|
5049
5049
|
return [...headerGroups].reverse();
|
|
5050
5050
|
}, getMemoOptions(table.options, debug, "getRightFooterGroups"));
|
|
5051
|
-
table.getFlatHeaders = memo(() => [table.getHeaderGroups()], (headerGroups) => {
|
|
5051
|
+
table.getFlatHeaders = memo$1(() => [table.getHeaderGroups()], (headerGroups) => {
|
|
5052
5052
|
return headerGroups.map((headerGroup) => {
|
|
5053
5053
|
return headerGroup.headers;
|
|
5054
5054
|
}).flat();
|
|
5055
5055
|
}, getMemoOptions(table.options, debug, "getFlatHeaders"));
|
|
5056
|
-
table.getLeftFlatHeaders = memo(() => [table.getLeftHeaderGroups()], (left) => {
|
|
5056
|
+
table.getLeftFlatHeaders = memo$1(() => [table.getLeftHeaderGroups()], (left) => {
|
|
5057
5057
|
return left.map((headerGroup) => {
|
|
5058
5058
|
return headerGroup.headers;
|
|
5059
5059
|
}).flat();
|
|
5060
5060
|
}, getMemoOptions(table.options, debug, "getLeftFlatHeaders"));
|
|
5061
|
-
table.getCenterFlatHeaders = memo(() => [table.getCenterHeaderGroups()], (left) => {
|
|
5061
|
+
table.getCenterFlatHeaders = memo$1(() => [table.getCenterHeaderGroups()], (left) => {
|
|
5062
5062
|
return left.map((headerGroup) => {
|
|
5063
5063
|
return headerGroup.headers;
|
|
5064
5064
|
}).flat();
|
|
5065
5065
|
}, getMemoOptions(table.options, debug, "getCenterFlatHeaders"));
|
|
5066
|
-
table.getRightFlatHeaders = memo(() => [table.getRightHeaderGroups()], (left) => {
|
|
5066
|
+
table.getRightFlatHeaders = memo$1(() => [table.getRightHeaderGroups()], (left) => {
|
|
5067
5067
|
return left.map((headerGroup) => {
|
|
5068
5068
|
return headerGroup.headers;
|
|
5069
5069
|
}).flat();
|
|
5070
5070
|
}, getMemoOptions(table.options, debug, "getRightFlatHeaders"));
|
|
5071
|
-
table.getCenterLeafHeaders = memo(() => [table.getCenterFlatHeaders()], (flatHeaders) => {
|
|
5071
|
+
table.getCenterLeafHeaders = memo$1(() => [table.getCenterFlatHeaders()], (flatHeaders) => {
|
|
5072
5072
|
return flatHeaders.filter((header) => {
|
|
5073
5073
|
var _header$subHeaders;
|
|
5074
5074
|
return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length);
|
|
5075
5075
|
});
|
|
5076
5076
|
}, getMemoOptions(table.options, debug, "getCenterLeafHeaders"));
|
|
5077
|
-
table.getLeftLeafHeaders = memo(() => [table.getLeftFlatHeaders()], (flatHeaders) => {
|
|
5077
|
+
table.getLeftLeafHeaders = memo$1(() => [table.getLeftFlatHeaders()], (flatHeaders) => {
|
|
5078
5078
|
return flatHeaders.filter((header) => {
|
|
5079
5079
|
var _header$subHeaders2;
|
|
5080
5080
|
return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length);
|
|
5081
5081
|
});
|
|
5082
5082
|
}, getMemoOptions(table.options, debug, "getLeftLeafHeaders"));
|
|
5083
|
-
table.getRightLeafHeaders = memo(() => [table.getRightFlatHeaders()], (flatHeaders) => {
|
|
5083
|
+
table.getRightLeafHeaders = memo$1(() => [table.getRightFlatHeaders()], (flatHeaders) => {
|
|
5084
5084
|
return flatHeaders.filter((header) => {
|
|
5085
5085
|
var _header$subHeaders3;
|
|
5086
5086
|
return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length);
|
|
5087
5087
|
});
|
|
5088
5088
|
}, getMemoOptions(table.options, debug, "getRightLeafHeaders"));
|
|
5089
|
-
table.getLeafHeaders = memo(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => {
|
|
5089
|
+
table.getLeafHeaders = memo$1(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => {
|
|
5090
5090
|
var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;
|
|
5091
5091
|
return [...(_left$0$headers = (_left$ = left[0]) == null ? void 0 : _left$.headers) != null ? _left$0$headers : [], ...(_center$0$headers = (_center$ = center[0]) == null ? void 0 : _center$.headers) != null ? _center$0$headers : [], ...(_right$0$headers = (_right$ = right[0]) == null ? void 0 : _right$.headers) != null ? _right$0$headers : []].map((header) => {
|
|
5092
5092
|
return header.getLeafHeaders();
|
|
@@ -5242,12 +5242,12 @@ const createRow = (table, id, original, rowIndex, depth, subRows, parentId) => {
|
|
|
5242
5242
|
}
|
|
5243
5243
|
return parentRows.reverse();
|
|
5244
5244
|
},
|
|
5245
|
-
getAllCells: memo(() => [table.getAllLeafColumns()], (leafColumns) => {
|
|
5245
|
+
getAllCells: memo$1(() => [table.getAllLeafColumns()], (leafColumns) => {
|
|
5246
5246
|
return leafColumns.map((column) => {
|
|
5247
5247
|
return createCell(table, row, column, column.id);
|
|
5248
5248
|
});
|
|
5249
5249
|
}, getMemoOptions(table.options, "debugRows", "getAllCells")),
|
|
5250
|
-
_getAllCellsByColumnId: memo(() => [row.getAllCells()], (allCells) => {
|
|
5250
|
+
_getAllCellsByColumnId: memo$1(() => [row.getAllCells()], (allCells) => {
|
|
5251
5251
|
return allCells.reduce((acc, cell) => {
|
|
5252
5252
|
acc[cell.column.id] = cell;
|
|
5253
5253
|
return acc;
|
|
@@ -5718,7 +5718,7 @@ const ColumnOrdering = {
|
|
|
5718
5718
|
};
|
|
5719
5719
|
},
|
|
5720
5720
|
createColumn: (column, table) => {
|
|
5721
|
-
column.getIndex = memo((position) => [_getVisibleLeafColumns(table, position)], (columns) => columns.findIndex((d) => d.id === column.id), getMemoOptions(table.options, "debugColumns", "getIndex"));
|
|
5721
|
+
column.getIndex = memo$1((position) => [_getVisibleLeafColumns(table, position)], (columns) => columns.findIndex((d) => d.id === column.id), getMemoOptions(table.options, "debugColumns", "getIndex"));
|
|
5722
5722
|
column.getIsFirstColumn = (position) => {
|
|
5723
5723
|
var _columns$;
|
|
5724
5724
|
const columns = _getVisibleLeafColumns(table, position);
|
|
@@ -5736,7 +5736,7 @@ const ColumnOrdering = {
|
|
|
5736
5736
|
var _table$initialState$c;
|
|
5737
5737
|
table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []);
|
|
5738
5738
|
};
|
|
5739
|
-
table._getOrderColumnsFn = memo(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => (columns) => {
|
|
5739
|
+
table._getOrderColumnsFn = memo$1(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => (columns) => {
|
|
5740
5740
|
let orderedColumns = [];
|
|
5741
5741
|
if (!(columnOrder != null && columnOrder.length)) {
|
|
5742
5742
|
orderedColumns = columns;
|
|
@@ -5821,18 +5821,18 @@ const ColumnPinning = {
|
|
|
5821
5821
|
};
|
|
5822
5822
|
},
|
|
5823
5823
|
createRow: (row, table) => {
|
|
5824
|
-
row.getCenterVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => {
|
|
5824
|
+
row.getCenterVisibleCells = memo$1(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => {
|
|
5825
5825
|
const leftAndRight = [...left != null ? left : [], ...right != null ? right : []];
|
|
5826
5826
|
return allCells.filter((d) => !leftAndRight.includes(d.column.id));
|
|
5827
5827
|
}, getMemoOptions(table.options, "debugRows", "getCenterVisibleCells"));
|
|
5828
|
-
row.getLeftVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left], (allCells, left) => {
|
|
5828
|
+
row.getLeftVisibleCells = memo$1(() => [row._getAllVisibleCells(), table.getState().columnPinning.left], (allCells, left) => {
|
|
5829
5829
|
const cells = (left != null ? left : []).map((columnId) => allCells.find((cell) => cell.column.id === columnId)).filter(Boolean).map((d) => ({
|
|
5830
5830
|
...d,
|
|
5831
5831
|
position: "left"
|
|
5832
5832
|
}));
|
|
5833
5833
|
return cells;
|
|
5834
5834
|
}, getMemoOptions(table.options, "debugRows", "getLeftVisibleCells"));
|
|
5835
|
-
row.getRightVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => {
|
|
5835
|
+
row.getRightVisibleCells = memo$1(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => {
|
|
5836
5836
|
const cells = (right != null ? right : []).map((columnId) => allCells.find((cell) => cell.column.id === columnId)).filter(Boolean).map((d) => ({
|
|
5837
5837
|
...d,
|
|
5838
5838
|
position: "right"
|
|
@@ -5855,13 +5855,13 @@ const ColumnPinning = {
|
|
|
5855
5855
|
}
|
|
5856
5856
|
return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
|
|
5857
5857
|
};
|
|
5858
|
-
table.getLeftLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => {
|
|
5858
|
+
table.getLeftLeafColumns = memo$1(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => {
|
|
5859
5859
|
return (left != null ? left : []).map((columnId) => allColumns.find((column) => column.id === columnId)).filter(Boolean);
|
|
5860
5860
|
}, getMemoOptions(table.options, "debugColumns", "getLeftLeafColumns"));
|
|
5861
|
-
table.getRightLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => {
|
|
5861
|
+
table.getRightLeafColumns = memo$1(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => {
|
|
5862
5862
|
return (right != null ? right : []).map((columnId) => allColumns.find((column) => column.id === columnId)).filter(Boolean);
|
|
5863
5863
|
}, getMemoOptions(table.options, "debugColumns", "getRightLeafColumns"));
|
|
5864
|
-
table.getCenterLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => {
|
|
5864
|
+
table.getCenterLeafColumns = memo$1(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => {
|
|
5865
5865
|
const leftAndRight = [...left != null ? left : [], ...right != null ? right : []];
|
|
5866
5866
|
return allColumns.filter((d) => !leftAndRight.includes(d.id));
|
|
5867
5867
|
}, getMemoOptions(table.options, "debugColumns", "getCenterLeafColumns"));
|
|
@@ -5908,8 +5908,8 @@ const ColumnSizing = {
|
|
|
5908
5908
|
const columnSize = table.getState().columnSizing[column.id];
|
|
5909
5909
|
return Math.min(Math.max((_column$columnDef$min = column.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.columnDef.size) != null ? _ref : defaultColumnSizing.size), (_column$columnDef$max = column.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize);
|
|
5910
5910
|
};
|
|
5911
|
-
column.getStart = memo((position) => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(0, column.getIndex(position)).reduce((sum2, column2) => sum2 + column2.getSize(), 0), getMemoOptions(table.options, "debugColumns", "getStart"));
|
|
5912
|
-
column.getAfter = memo((position) => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(column.getIndex(position) + 1).reduce((sum2, column2) => sum2 + column2.getSize(), 0), getMemoOptions(table.options, "debugColumns", "getAfter"));
|
|
5911
|
+
column.getStart = memo$1((position) => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(0, column.getIndex(position)).reduce((sum2, column2) => sum2 + column2.getSize(), 0), getMemoOptions(table.options, "debugColumns", "getStart"));
|
|
5912
|
+
column.getAfter = memo$1((position) => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(column.getIndex(position) + 1).reduce((sum2, column2) => sum2 + column2.getSize(), 0), getMemoOptions(table.options, "debugColumns", "getAfter"));
|
|
5913
5913
|
column.resetSize = () => {
|
|
5914
5914
|
table.setColumnSizing((_ref2) => {
|
|
5915
5915
|
let {
|
|
@@ -6154,14 +6154,14 @@ const ColumnVisibility = {
|
|
|
6154
6154
|
};
|
|
6155
6155
|
},
|
|
6156
6156
|
createRow: (row, table) => {
|
|
6157
|
-
row._getAllVisibleCells = memo(() => [row.getAllCells(), table.getState().columnVisibility], (cells) => {
|
|
6157
|
+
row._getAllVisibleCells = memo$1(() => [row.getAllCells(), table.getState().columnVisibility], (cells) => {
|
|
6158
6158
|
return cells.filter((cell) => cell.column.getIsVisible());
|
|
6159
6159
|
}, getMemoOptions(table.options, "debugRows", "_getAllVisibleCells"));
|
|
6160
|
-
row.getVisibleCells = memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], getMemoOptions(table.options, "debugRows", "getVisibleCells"));
|
|
6160
|
+
row.getVisibleCells = memo$1(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], getMemoOptions(table.options, "debugRows", "getVisibleCells"));
|
|
6161
6161
|
},
|
|
6162
6162
|
createTable: (table) => {
|
|
6163
6163
|
const makeVisibleColumnsMethod = (key, getColumns) => {
|
|
6164
|
-
return memo(() => [getColumns(), getColumns().filter((d) => d.getIsVisible()).map((d) => d.id).join("_")], (columns) => {
|
|
6164
|
+
return memo$1(() => [getColumns(), getColumns().filter((d) => d.getIsVisible()).map((d) => d.id).join("_")], (columns) => {
|
|
6165
6165
|
return columns.filter((d) => d.getIsVisible == null ? void 0 : d.getIsVisible());
|
|
6166
6166
|
}, getMemoOptions(table.options, "debugColumns", key));
|
|
6167
6167
|
};
|
|
@@ -6509,7 +6509,7 @@ const RowPagination = {
|
|
|
6509
6509
|
pageCount: newPageCount
|
|
6510
6510
|
};
|
|
6511
6511
|
});
|
|
6512
|
-
table.getPageOptions = memo(() => [table.getPageCount()], (pageCount) => {
|
|
6512
|
+
table.getPageOptions = memo$1(() => [table.getPageCount()], (pageCount) => {
|
|
6513
6513
|
let pageOptions = [];
|
|
6514
6514
|
if (pageCount && pageCount > 0) {
|
|
6515
6515
|
pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i);
|
|
@@ -6685,9 +6685,9 @@ const RowPinning = {
|
|
|
6685
6685
|
position
|
|
6686
6686
|
}));
|
|
6687
6687
|
};
|
|
6688
|
-
table.getTopRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.top], (allRows, topPinnedRowIds) => table._getPinnedRows(allRows, topPinnedRowIds, "top"), getMemoOptions(table.options, "debugRows", "getTopRows"));
|
|
6689
|
-
table.getBottomRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.bottom], (allRows, bottomPinnedRowIds) => table._getPinnedRows(allRows, bottomPinnedRowIds, "bottom"), getMemoOptions(table.options, "debugRows", "getBottomRows"));
|
|
6690
|
-
table.getCenterRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.top, table.getState().rowPinning.bottom], (allRows, top, bottom) => {
|
|
6688
|
+
table.getTopRows = memo$1(() => [table.getRowModel().rows, table.getState().rowPinning.top], (allRows, topPinnedRowIds) => table._getPinnedRows(allRows, topPinnedRowIds, "top"), getMemoOptions(table.options, "debugRows", "getTopRows"));
|
|
6689
|
+
table.getBottomRows = memo$1(() => [table.getRowModel().rows, table.getState().rowPinning.bottom], (allRows, bottomPinnedRowIds) => table._getPinnedRows(allRows, bottomPinnedRowIds, "bottom"), getMemoOptions(table.options, "debugRows", "getBottomRows"));
|
|
6690
|
+
table.getCenterRows = memo$1(() => [table.getRowModel().rows, table.getState().rowPinning.top, table.getState().rowPinning.bottom], (allRows, top, bottom) => {
|
|
6691
6691
|
const topAndBottom = /* @__PURE__ */ new Set([...top != null ? top : [], ...bottom != null ? bottom : []]);
|
|
6692
6692
|
return allRows.filter((d) => !topAndBottom.has(d.id));
|
|
6693
6693
|
}, getMemoOptions(table.options, "debugRows", "getCenterRows"));
|
|
@@ -6750,7 +6750,7 @@ const RowSelection = {
|
|
|
6750
6750
|
return rowSelection;
|
|
6751
6751
|
});
|
|
6752
6752
|
table.getPreSelectedRowModel = () => table.getCoreRowModel();
|
|
6753
|
-
table.getSelectedRowModel = memo(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => {
|
|
6753
|
+
table.getSelectedRowModel = memo$1(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => {
|
|
6754
6754
|
if (!Object.keys(rowSelection).length) {
|
|
6755
6755
|
return {
|
|
6756
6756
|
rows: [],
|
|
@@ -6760,7 +6760,7 @@ const RowSelection = {
|
|
|
6760
6760
|
}
|
|
6761
6761
|
return selectRowsFn(table, rowModel);
|
|
6762
6762
|
}, getMemoOptions(table.options, "debugTable", "getSelectedRowModel"));
|
|
6763
|
-
table.getFilteredSelectedRowModel = memo(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => {
|
|
6763
|
+
table.getFilteredSelectedRowModel = memo$1(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => {
|
|
6764
6764
|
if (!Object.keys(rowSelection).length) {
|
|
6765
6765
|
return {
|
|
6766
6766
|
rows: [],
|
|
@@ -6770,7 +6770,7 @@ const RowSelection = {
|
|
|
6770
6770
|
}
|
|
6771
6771
|
return selectRowsFn(table, rowModel);
|
|
6772
6772
|
}, getMemoOptions(table.options, "debugTable", "getFilteredSelectedRowModel"));
|
|
6773
|
-
table.getGroupedSelectedRowModel = memo(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => {
|
|
6773
|
+
table.getGroupedSelectedRowModel = memo$1(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => {
|
|
6774
6774
|
if (!Object.keys(rowSelection).length) {
|
|
6775
6775
|
return {
|
|
6776
6776
|
rows: [],
|
|
@@ -7342,7 +7342,7 @@ function createTable(options) {
|
|
|
7342
7342
|
}
|
|
7343
7343
|
return row;
|
|
7344
7344
|
},
|
|
7345
|
-
_getDefaultColumnDef: memo(() => [table.options.defaultColumn], (defaultColumn) => {
|
|
7345
|
+
_getDefaultColumnDef: memo$1(() => [table.options.defaultColumn], (defaultColumn) => {
|
|
7346
7346
|
var _defaultColumn;
|
|
7347
7347
|
defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
|
|
7348
7348
|
return {
|
|
@@ -7368,7 +7368,7 @@ function createTable(options) {
|
|
|
7368
7368
|
};
|
|
7369
7369
|
}, getMemoOptions(options, "debugColumns", "_getDefaultColumnDef")),
|
|
7370
7370
|
_getColumnDefs: () => table.options.columns,
|
|
7371
|
-
getAllColumns: memo(() => [table._getColumnDefs()], (columnDefs) => {
|
|
7371
|
+
getAllColumns: memo$1(() => [table._getColumnDefs()], (columnDefs) => {
|
|
7372
7372
|
const recurseColumns = function(columnDefs2, parent, depth) {
|
|
7373
7373
|
if (depth === void 0) {
|
|
7374
7374
|
depth = 0;
|
|
@@ -7382,18 +7382,18 @@ function createTable(options) {
|
|
|
7382
7382
|
};
|
|
7383
7383
|
return recurseColumns(columnDefs);
|
|
7384
7384
|
}, getMemoOptions(options, "debugColumns", "getAllColumns")),
|
|
7385
|
-
getAllFlatColumns: memo(() => [table.getAllColumns()], (allColumns) => {
|
|
7385
|
+
getAllFlatColumns: memo$1(() => [table.getAllColumns()], (allColumns) => {
|
|
7386
7386
|
return allColumns.flatMap((column) => {
|
|
7387
7387
|
return column.getFlatColumns();
|
|
7388
7388
|
});
|
|
7389
7389
|
}, getMemoOptions(options, "debugColumns", "getAllFlatColumns")),
|
|
7390
|
-
_getAllFlatColumnsById: memo(() => [table.getAllFlatColumns()], (flatColumns) => {
|
|
7390
|
+
_getAllFlatColumnsById: memo$1(() => [table.getAllFlatColumns()], (flatColumns) => {
|
|
7391
7391
|
return flatColumns.reduce((acc, column) => {
|
|
7392
7392
|
acc[column.id] = column;
|
|
7393
7393
|
return acc;
|
|
7394
7394
|
}, {});
|
|
7395
7395
|
}, getMemoOptions(options, "debugColumns", "getAllFlatColumnsById")),
|
|
7396
|
-
getAllLeafColumns: memo(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns2) => {
|
|
7396
|
+
getAllLeafColumns: memo$1(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns2) => {
|
|
7397
7397
|
let leafColumns = allColumns.flatMap((column) => column.getLeafColumns());
|
|
7398
7398
|
return orderColumns2(leafColumns);
|
|
7399
7399
|
}, getMemoOptions(options, "debugColumns", "getAllLeafColumns")),
|
|
@@ -7413,7 +7413,7 @@ function createTable(options) {
|
|
|
7413
7413
|
return table;
|
|
7414
7414
|
}
|
|
7415
7415
|
function getCoreRowModel() {
|
|
7416
|
-
return (table) => memo(() => [table.options.data], (data) => {
|
|
7416
|
+
return (table) => memo$1(() => [table.options.data], (data) => {
|
|
7417
7417
|
const rowModel = {
|
|
7418
7418
|
rows: [],
|
|
7419
7419
|
flatRows: [],
|
|
@@ -7444,7 +7444,7 @@ function getCoreRowModel() {
|
|
|
7444
7444
|
}, getMemoOptions(table.options, "debugTable", "getRowModel", () => table._autoResetPageIndex()));
|
|
7445
7445
|
}
|
|
7446
7446
|
function getExpandedRowModel() {
|
|
7447
|
-
return (table) => memo(() => [table.getState().expanded, table.getPreExpandedRowModel(), table.options.paginateExpandedRows], (expanded, rowModel, paginateExpandedRows) => {
|
|
7447
|
+
return (table) => memo$1(() => [table.getState().expanded, table.getPreExpandedRowModel(), table.options.paginateExpandedRows], (expanded, rowModel, paginateExpandedRows) => {
|
|
7448
7448
|
if (!rowModel.rows.length || expanded !== true && !Object.keys(expanded != null ? expanded : {}).length) {
|
|
7449
7449
|
return rowModel;
|
|
7450
7450
|
}
|
|
@@ -7557,7 +7557,7 @@ function filterRowModelFromRoot(rowsToFilter, filterRow, table) {
|
|
|
7557
7557
|
};
|
|
7558
7558
|
}
|
|
7559
7559
|
function getFilteredRowModel() {
|
|
7560
|
-
return (table) => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter], (rowModel, columnFilters, globalFilter) => {
|
|
7560
|
+
return (table) => memo$1(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter], (rowModel, columnFilters, globalFilter) => {
|
|
7561
7561
|
if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
|
|
7562
7562
|
for (let i = 0; i < rowModel.flatRows.length; i++) {
|
|
7563
7563
|
rowModel.flatRows[i].columnFilters = {};
|
|
@@ -7642,7 +7642,7 @@ function getFilteredRowModel() {
|
|
|
7642
7642
|
}, getMemoOptions(table.options, "debugTable", "getFilteredRowModel", () => table._autoResetPageIndex()));
|
|
7643
7643
|
}
|
|
7644
7644
|
function getPaginationRowModel(opts) {
|
|
7645
|
-
return (table) => memo(() => [table.getState().pagination, table.getPrePaginationRowModel(), table.options.paginateExpandedRows ? void 0 : table.getState().expanded], (pagination, rowModel) => {
|
|
7645
|
+
return (table) => memo$1(() => [table.getState().pagination, table.getPrePaginationRowModel(), table.options.paginateExpandedRows ? void 0 : table.getState().expanded], (pagination, rowModel) => {
|
|
7646
7646
|
if (!rowModel.rows.length) {
|
|
7647
7647
|
return rowModel;
|
|
7648
7648
|
}
|
|
@@ -7684,7 +7684,7 @@ function getPaginationRowModel(opts) {
|
|
|
7684
7684
|
}, getMemoOptions(table.options, "debugTable", "getPaginationRowModel"));
|
|
7685
7685
|
}
|
|
7686
7686
|
function getSortedRowModel() {
|
|
7687
|
-
return (table) => memo(() => [table.getState().sorting, table.getPreSortedRowModel()], (sorting, rowModel) => {
|
|
7687
|
+
return (table) => memo$1(() => [table.getState().sorting, table.getPreSortedRowModel()], (sorting, rowModel) => {
|
|
7688
7688
|
if (!rowModel.rows.length || !(sorting != null && sorting.length)) {
|
|
7689
7689
|
return rowModel;
|
|
7690
7690
|
}
|
|
@@ -8033,21 +8033,20 @@ const useStyledTable = (props) => {
|
|
|
8033
8033
|
usePersistColumnOrder(table, persistColumnOrderKey);
|
|
8034
8034
|
return { table };
|
|
8035
8035
|
};
|
|
8036
|
-
const CheckboxWrapper = "
|
|
8037
|
-
const Checkbox = "
|
|
8038
|
-
const Indeterminate = "
|
|
8039
|
-
const ReadOnly = "
|
|
8040
|
-
const Indicator = "
|
|
8041
|
-
const HideWrapper = "
|
|
8042
|
-
const CheckboxHover = "
|
|
8043
|
-
const CheckboxRippleContainer = "
|
|
8044
|
-
const CheckboxRipple = "
|
|
8045
|
-
const ripple = "
|
|
8046
|
-
const IndeterminateMark = "_IndeterminateMark_1vrmq_168";
|
|
8036
|
+
const CheckboxWrapper = "_CheckboxWrapper_1b4zf_1";
|
|
8037
|
+
const Checkbox = "_Checkbox_1b4zf_1";
|
|
8038
|
+
const Indeterminate = "_Indeterminate_1b4zf_28";
|
|
8039
|
+
const ReadOnly = "_ReadOnly_1b4zf_55";
|
|
8040
|
+
const Indicator = "_Indicator_1b4zf_64";
|
|
8041
|
+
const HideWrapper = "_HideWrapper_1b4zf_68";
|
|
8042
|
+
const CheckboxHover = "_CheckboxHover_1b4zf_75";
|
|
8043
|
+
const CheckboxRippleContainer = "_CheckboxRippleContainer_1b4zf_75";
|
|
8044
|
+
const CheckboxRipple = "_CheckboxRipple_1b4zf_75";
|
|
8045
|
+
const ripple = "_ripple_1b4zf_1";
|
|
8047
8046
|
const styles$3 = {
|
|
8048
8047
|
CheckboxWrapper,
|
|
8049
|
-
"size-small": "_size-
|
|
8050
|
-
"size-medium": "_size-
|
|
8048
|
+
"size-small": "_size-small_1b4zf_11",
|
|
8049
|
+
"size-medium": "_size-medium_1b4zf_15",
|
|
8051
8050
|
Checkbox,
|
|
8052
8051
|
Indeterminate,
|
|
8053
8052
|
ReadOnly,
|
|
@@ -8056,8 +8055,7 @@ const styles$3 = {
|
|
|
8056
8055
|
CheckboxHover,
|
|
8057
8056
|
CheckboxRippleContainer,
|
|
8058
8057
|
CheckboxRipple,
|
|
8059
|
-
ripple
|
|
8060
|
-
IndeterminateMark
|
|
8058
|
+
ripple
|
|
8061
8059
|
};
|
|
8062
8060
|
function NOOP() {
|
|
8063
8061
|
}
|
|
@@ -8929,13 +8927,13 @@ function useField(params) {
|
|
|
8929
8927
|
name,
|
|
8930
8928
|
controlRef,
|
|
8931
8929
|
validityData: getCombinedFieldValidityData(validityData, invalid),
|
|
8932
|
-
validate(
|
|
8930
|
+
validate(flushSync2 = true) {
|
|
8933
8931
|
let nextValue = value;
|
|
8934
8932
|
if (nextValue === void 0) {
|
|
8935
8933
|
nextValue = getValue2();
|
|
8936
8934
|
}
|
|
8937
8935
|
markedDirtyRef.current = true;
|
|
8938
|
-
if (!
|
|
8936
|
+
if (!flushSync2) {
|
|
8939
8937
|
commit(nextValue);
|
|
8940
8938
|
} else {
|
|
8941
8939
|
ReactDOM.flushSync(() => commit(nextValue));
|
|
@@ -9572,6 +9570,10 @@ const CheckboxIndicator = /* @__PURE__ */ React.forwardRef(function CheckboxIndi
|
|
|
9572
9570
|
});
|
|
9573
9571
|
if (process.env.NODE_ENV !== "production")
|
|
9574
9572
|
CheckboxIndicator.displayName = "CheckboxIndicator";
|
|
9573
|
+
const IndeterminateIcon = (props) => /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { viewBox: "0 0 24 24", width: "100%", height: "100%", fill: "none", ...props, children: [
|
|
9574
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("title", { children: "Indeterminate icon" }),
|
|
9575
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M6 12H18", stroke: "currentColor", strokeWidth: props.strokeWidth ?? 3, strokeLinecap: "round" })
|
|
9576
|
+
] });
|
|
9575
9577
|
const CheckIcon$1 = (props) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
9576
9578
|
"svg",
|
|
9577
9579
|
{
|
|
@@ -9620,6 +9622,7 @@ const StyledCheckbox = ({
|
|
|
9620
9622
|
styles$3[`size-${size}`],
|
|
9621
9623
|
indeterminate && styles$3["Indeterminate"]
|
|
9622
9624
|
);
|
|
9625
|
+
const CheckboxIcon = indeterminate ? IndeterminateIcon : CheckIcon$1;
|
|
9623
9626
|
const rippleRef = React__default.useRef(null);
|
|
9624
9627
|
const handlePointerDown = React__default.useCallback(
|
|
9625
9628
|
(e) => {
|
|
@@ -9665,7 +9668,7 @@ const StyledCheckbox = ({
|
|
|
9665
9668
|
...props,
|
|
9666
9669
|
children: [
|
|
9667
9670
|
!isHideWrapper && isRippleEnabled && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ref: rippleRef, className: styles$3["CheckboxRippleContainer"] }),
|
|
9668
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: checkboxClasses, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CheckboxIndicator, { className: styles$3["Indicator"], children:
|
|
9671
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: checkboxClasses, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CheckboxIndicator, { className: styles$3["Indicator"], children: /* @__PURE__ */ jsxRuntimeExports.jsx(CheckboxIcon, { strokeWidth: size === "small" ? 3 : 2 }) }) })
|
|
9669
9672
|
]
|
|
9670
9673
|
}
|
|
9671
9674
|
);
|
|
@@ -13203,10 +13206,9 @@ function TableHeaderCell({
|
|
|
13203
13206
|
header,
|
|
13204
13207
|
tableCanResize = false,
|
|
13205
13208
|
left,
|
|
13206
|
-
hasFixedLeftColumn,
|
|
13207
13209
|
tableWidth
|
|
13208
13210
|
}) {
|
|
13209
|
-
const {
|
|
13211
|
+
const { hideHeader = false, enableResizing = false } = styledTableProps;
|
|
13210
13212
|
const ref = useRef(null);
|
|
13211
13213
|
const { isResizing: isResizing2, enableResizingFlag, disableResizingFlag } = useRootContext();
|
|
13212
13214
|
const isFixed2 = header.column.columnDef.fixedLeft;
|
|
@@ -13229,7 +13231,6 @@ function TableHeaderCell({
|
|
|
13229
13231
|
// *
|
|
13230
13232
|
// sticky actions
|
|
13231
13233
|
header.column.id === ACTIONS_COLUMN_ID && style$1["t-cell__actions"],
|
|
13232
|
-
hasFixedLeftColumn && Boolean(actions) && header.column.id === ACTIONS_COLUMN_ID && style$1["shadowed"],
|
|
13233
13234
|
isFixed2 && style$1["t-cell__fixed"]
|
|
13234
13235
|
),
|
|
13235
13236
|
style: {
|
|
@@ -13316,10 +13317,11 @@ function TableHeader({
|
|
|
13316
13317
|
table,
|
|
13317
13318
|
styledTableProps,
|
|
13318
13319
|
tableCanResize,
|
|
13319
|
-
tableWidth
|
|
13320
|
+
tableWidth,
|
|
13321
|
+
columnWindow: { paddingLeft, paddingRight, indexes }
|
|
13320
13322
|
}) {
|
|
13321
13323
|
const { stickyHeader = false, tableHeaderRef, tableHeaderStyle = {} } = styledTableProps;
|
|
13322
|
-
const
|
|
13324
|
+
const headerGroups = table.getHeaderGroups();
|
|
13323
13325
|
const styles2 = {
|
|
13324
13326
|
...tableHeaderStyle
|
|
13325
13327
|
};
|
|
@@ -13333,23 +13335,89 @@ function TableHeader({
|
|
|
13333
13335
|
),
|
|
13334
13336
|
style: styles2,
|
|
13335
13337
|
ref: tableHeaderRef,
|
|
13336
|
-
children:
|
|
13337
|
-
|
|
13338
|
-
|
|
13339
|
-
|
|
13340
|
-
|
|
13338
|
+
children: headerGroups.map((headerGroup) => {
|
|
13339
|
+
const positionedHeaders = headerGroup.headers.map((header, index, allHeaders) => ({
|
|
13340
|
+
header,
|
|
13341
|
+
left: allHeaders.slice(0, index).reduce((acc, col) => acc + (col.column.getSize() || 0), 0)
|
|
13342
|
+
}));
|
|
13343
|
+
const leftHeaders = positionedHeaders.filter(({ header }) => header.column.columnDef.fixedLeft);
|
|
13344
|
+
const centerHeaders = positionedHeaders.filter(
|
|
13345
|
+
({ header }) => !header.column.columnDef.fixedLeft && header.column.id !== ACTIONS_COLUMN_ID
|
|
13346
|
+
);
|
|
13347
|
+
const rightHeaders = positionedHeaders.filter(({ header }) => header.column.id === ACTIONS_COLUMN_ID);
|
|
13348
|
+
const centerHeadersToRender = indexes.reduce((acc, index) => {
|
|
13349
|
+
const header = centerHeaders[index];
|
|
13350
|
+
if (header) {
|
|
13351
|
+
acc.push(header);
|
|
13352
|
+
}
|
|
13353
|
+
return acc;
|
|
13354
|
+
}, []);
|
|
13355
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("tr", { children: [
|
|
13356
|
+
leftHeaders.map(({ header, left }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
13341
13357
|
TableHeaderCell,
|
|
13342
13358
|
{
|
|
13343
13359
|
styledTableProps,
|
|
13344
13360
|
header,
|
|
13345
13361
|
tableCanResize,
|
|
13346
|
-
left
|
|
13347
|
-
hasFixedLeftColumn,
|
|
13362
|
+
left,
|
|
13348
13363
|
tableWidth
|
|
13349
13364
|
},
|
|
13350
|
-
header.
|
|
13351
|
-
)
|
|
13352
|
-
|
|
13365
|
+
header.id
|
|
13366
|
+
)),
|
|
13367
|
+
paddingLeft > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
13368
|
+
"th",
|
|
13369
|
+
{
|
|
13370
|
+
"aria-hidden": true,
|
|
13371
|
+
style: {
|
|
13372
|
+
width: String(paddingLeft) + "px",
|
|
13373
|
+
minWidth: String(paddingLeft) + "px",
|
|
13374
|
+
maxWidth: String(paddingLeft) + "px",
|
|
13375
|
+
padding: 0,
|
|
13376
|
+
border: "none"
|
|
13377
|
+
}
|
|
13378
|
+
}
|
|
13379
|
+
),
|
|
13380
|
+
centerHeadersToRender.map((item) => {
|
|
13381
|
+
if (!item)
|
|
13382
|
+
return null;
|
|
13383
|
+
const { header, left } = item;
|
|
13384
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
13385
|
+
TableHeaderCell,
|
|
13386
|
+
{
|
|
13387
|
+
styledTableProps,
|
|
13388
|
+
header,
|
|
13389
|
+
tableCanResize,
|
|
13390
|
+
left,
|
|
13391
|
+
tableWidth
|
|
13392
|
+
},
|
|
13393
|
+
header.id
|
|
13394
|
+
);
|
|
13395
|
+
}),
|
|
13396
|
+
paddingRight > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
13397
|
+
"th",
|
|
13398
|
+
{
|
|
13399
|
+
"aria-hidden": true,
|
|
13400
|
+
style: {
|
|
13401
|
+
width: String(paddingRight) + "px",
|
|
13402
|
+
minWidth: String(paddingRight) + "px",
|
|
13403
|
+
maxWidth: String(paddingRight) + "px",
|
|
13404
|
+
padding: 0,
|
|
13405
|
+
border: "none"
|
|
13406
|
+
}
|
|
13407
|
+
}
|
|
13408
|
+
),
|
|
13409
|
+
rightHeaders.map(({ header, left }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
13410
|
+
TableHeaderCell,
|
|
13411
|
+
{
|
|
13412
|
+
styledTableProps,
|
|
13413
|
+
header,
|
|
13414
|
+
tableCanResize,
|
|
13415
|
+
left,
|
|
13416
|
+
tableWidth
|
|
13417
|
+
},
|
|
13418
|
+
header.id
|
|
13419
|
+
))
|
|
13420
|
+
] }, headerGroup.id);
|
|
13353
13421
|
})
|
|
13354
13422
|
}
|
|
13355
13423
|
);
|
|
@@ -13370,7 +13438,8 @@ const TableSkeleton = ({ colSpan, rowHeight = 48 }) => /* @__PURE__ */ jsxRuntim
|
|
|
13370
13438
|
function TableRow({
|
|
13371
13439
|
styledTableProps,
|
|
13372
13440
|
row,
|
|
13373
|
-
index
|
|
13441
|
+
index,
|
|
13442
|
+
columnWindow: { paddingLeft, paddingRight, indexes }
|
|
13374
13443
|
}) {
|
|
13375
13444
|
const {
|
|
13376
13445
|
loading,
|
|
@@ -13434,18 +13503,86 @@ function TableRow({
|
|
|
13434
13503
|
...cell,
|
|
13435
13504
|
left: allCells.slice(0, idx).reduce((acc, col) => acc + (col.column.getSize() || 0), 0)
|
|
13436
13505
|
}));
|
|
13437
|
-
const
|
|
13438
|
-
() => positionedCells.filter((
|
|
13506
|
+
const centerCells = useMemo(
|
|
13507
|
+
() => positionedCells.filter((cell) => !cell.column.columnDef.fixedLeft && cell.column.id !== ACTIONS_COLUMN_ID),
|
|
13508
|
+
[positionedCells]
|
|
13509
|
+
);
|
|
13510
|
+
const rightCells = useMemo(
|
|
13511
|
+
() => positionedCells.filter((cell) => cell.column.id === ACTIONS_COLUMN_ID),
|
|
13512
|
+
[positionedCells]
|
|
13513
|
+
);
|
|
13514
|
+
const leftCells = useMemo(
|
|
13515
|
+
() => positionedCells.filter((cell) => cell.column.columnDef.fixedLeft),
|
|
13439
13516
|
[positionedCells]
|
|
13440
13517
|
);
|
|
13441
13518
|
const spaceForCheckmark = !enableMultiRowSelection && !enableRowSelection && singleSelectionRow;
|
|
13442
13519
|
const singleSelection = row.getIsSelected() && spaceForCheckmark;
|
|
13443
13520
|
const hasRowClickHandler = onRowClick instanceof Function;
|
|
13521
|
+
const centerCellsToRender = indexes.length > 0 ? compact(indexes.map((index2) => centerCells[index2])) : centerCells;
|
|
13522
|
+
const renderCell = useCallback(
|
|
13523
|
+
(cell, renderIndex) => {
|
|
13524
|
+
var _a;
|
|
13525
|
+
const isActionsCell = cell.column.id === ACTIONS_COLUMN_ID;
|
|
13526
|
+
const isFixed2 = cell.column.columnDef.fixedLeft;
|
|
13527
|
+
const isLastFixedCell = cell.id === ((_a = leftCells.at(-1)) == null ? void 0 : _a.id);
|
|
13528
|
+
const isExpandedRow = row.isExpanded();
|
|
13529
|
+
const isFirstCell = renderIndex === 0;
|
|
13530
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
13531
|
+
"td",
|
|
13532
|
+
{
|
|
13533
|
+
className: clsx(
|
|
13534
|
+
style$1["t-cell"],
|
|
13535
|
+
hasRowClickHandler && "cursor-pointer",
|
|
13536
|
+
tdClassName,
|
|
13537
|
+
isActionsCell && style$1["action-cell"],
|
|
13538
|
+
isActionsCell && Boolean(actions) && leftCells.length && style$1["shadowed"],
|
|
13539
|
+
isActionsCell && ((getRowClassName == null ? void 0 : getRowClassName(row)) ? getRowClassName == null ? void 0 : getRowClassName(row) : style$1["action-cell-default-background"]),
|
|
13540
|
+
isFixed2 && style$1["fixed-cell"],
|
|
13541
|
+
isLastFixedCell && style$1["shadowed"],
|
|
13542
|
+
row.getIsSelected() && style$1["selected"],
|
|
13543
|
+
isFixed2 && ((getRowClassName == null ? void 0 : getRowClassName(row)) ? getRowClassName == null ? void 0 : getRowClassName(row) : style$1["fixed-cell-default-background"]),
|
|
13544
|
+
isExpandedRow && style$1["expanded_row"],
|
|
13545
|
+
(singleSelection || row.isFocused()) && style$1["single-selection"]
|
|
13546
|
+
),
|
|
13547
|
+
style: { left: isFixed2 ? cell.left : void 0 },
|
|
13548
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
13549
|
+
"div",
|
|
13550
|
+
{
|
|
13551
|
+
style: {
|
|
13552
|
+
display: "flex",
|
|
13553
|
+
alignItems: "center",
|
|
13554
|
+
minWidth: isFirstCell ? 32 : void 0,
|
|
13555
|
+
position: "relative"
|
|
13556
|
+
},
|
|
13557
|
+
children: [
|
|
13558
|
+
isFirstCell && singleSelection && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
13559
|
+
"span",
|
|
13560
|
+
{
|
|
13561
|
+
style: {
|
|
13562
|
+
display: "inline-flex",
|
|
13563
|
+
alignItems: "center",
|
|
13564
|
+
position: "absolute",
|
|
13565
|
+
left: 0,
|
|
13566
|
+
top: "50%",
|
|
13567
|
+
transform: "translateY(-50%)"
|
|
13568
|
+
},
|
|
13569
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Checkmark, {})
|
|
13570
|
+
}
|
|
13571
|
+
),
|
|
13572
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { marginLeft: isFirstCell && spaceForCheckmark ? 30 : 0, width: "100%" }, children: flexRender(cell.column.columnDef.cell, cell.getContext()) })
|
|
13573
|
+
]
|
|
13574
|
+
}
|
|
13575
|
+
)
|
|
13576
|
+
},
|
|
13577
|
+
cell.id
|
|
13578
|
+
);
|
|
13579
|
+
},
|
|
13580
|
+
[singleSelection, actions, getRowClassName, hasRowClickHandler, leftCells, row, spaceForCheckmark, tdClassName]
|
|
13581
|
+
);
|
|
13444
13582
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(Fragment, { children: [
|
|
13445
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
13583
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
13446
13584
|
"tr",
|
|
13447
13585
|
{
|
|
13448
|
-
role: "row",
|
|
13449
13586
|
"aria-selected": row.getIsSelected() || row.isFocused() ? "true" : "false",
|
|
13450
13587
|
tabIndex: row.isFocused() ? 0 : -1,
|
|
13451
13588
|
"data-index": index,
|
|
@@ -13479,65 +13616,39 @@ function TableRow({
|
|
|
13479
13616
|
break;
|
|
13480
13617
|
}
|
|
13481
13618
|
},
|
|
13482
|
-
children:
|
|
13483
|
-
|
|
13484
|
-
|
|
13485
|
-
const isFixed2 = cell.column.columnDef.fixedLeft;
|
|
13486
|
-
const isLastFixedCell = cell.id === ((_a = fixedColumns.at(-1)) == null ? void 0 : _a.id);
|
|
13487
|
-
const isExpandedRow = row.isExpanded();
|
|
13488
|
-
const isFirstCell = idx === 0;
|
|
13489
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
13619
|
+
children: [
|
|
13620
|
+
leftCells.map((cell, idx) => renderCell(cell, idx)),
|
|
13621
|
+
paddingLeft > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
13490
13622
|
"td",
|
|
13491
13623
|
{
|
|
13492
|
-
|
|
13493
|
-
|
|
13494
|
-
hasRowClickHandler && "cursor-pointer",
|
|
13495
|
-
tdClassName,
|
|
13496
|
-
isActionsCell && style$1["action-cell"],
|
|
13497
|
-
isActionsCell && Boolean(actions) && fixedColumns.length && style$1["shadowed"],
|
|
13498
|
-
isActionsCell && ((getRowClassName == null ? void 0 : getRowClassName(row)) ? getRowClassName == null ? void 0 : getRowClassName(row) : style$1["action-cell-default-background"]),
|
|
13499
|
-
isFixed2 && style$1["fixed-cell"],
|
|
13500
|
-
isLastFixedCell && style$1["shadowed"],
|
|
13501
|
-
row.getIsSelected() && style$1["selected"],
|
|
13502
|
-
isFixed2 && ((getRowClassName == null ? void 0 : getRowClassName(row)) ? getRowClassName == null ? void 0 : getRowClassName(row) : style$1["fixed-cell-default-background"]),
|
|
13503
|
-
isExpandedRow && style$1["expanded_row"],
|
|
13504
|
-
(singleSelection || row.isFocused()) && style$1["single-selection"]
|
|
13505
|
-
),
|
|
13624
|
+
"aria-hidden": true,
|
|
13625
|
+
className: style$1["t-cell"],
|
|
13506
13626
|
style: {
|
|
13507
|
-
|
|
13508
|
-
|
|
13509
|
-
|
|
13510
|
-
|
|
13511
|
-
|
|
13512
|
-
|
|
13513
|
-
|
|
13514
|
-
|
|
13515
|
-
|
|
13516
|
-
|
|
13517
|
-
|
|
13518
|
-
|
|
13519
|
-
|
|
13520
|
-
|
|
13521
|
-
|
|
13522
|
-
|
|
13523
|
-
|
|
13524
|
-
|
|
13525
|
-
|
|
13526
|
-
|
|
13527
|
-
|
|
13528
|
-
|
|
13529
|
-
|
|
13530
|
-
|
|
13531
|
-
|
|
13532
|
-
),
|
|
13533
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { marginLeft: isFirstCell && spaceForCheckmark ? 30 : 0, width: "100%" }, children: flexRender(cell.column.columnDef.cell, cell.getContext()) })
|
|
13534
|
-
]
|
|
13535
|
-
}
|
|
13536
|
-
)
|
|
13537
|
-
},
|
|
13538
|
-
cell.id
|
|
13539
|
-
);
|
|
13540
|
-
})
|
|
13627
|
+
width: String(paddingLeft) + "px",
|
|
13628
|
+
minWidth: String(paddingLeft) + "px",
|
|
13629
|
+
maxWidth: String(paddingLeft) + "px",
|
|
13630
|
+
padding: 0,
|
|
13631
|
+
border: "none"
|
|
13632
|
+
}
|
|
13633
|
+
}
|
|
13634
|
+
),
|
|
13635
|
+
centerCellsToRender.map((cell, idx) => renderCell(cell, leftCells.length + idx)),
|
|
13636
|
+
paddingRight > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
13637
|
+
"td",
|
|
13638
|
+
{
|
|
13639
|
+
"aria-hidden": true,
|
|
13640
|
+
className: style$1["t-cell"],
|
|
13641
|
+
style: {
|
|
13642
|
+
width: String(paddingRight) + "px",
|
|
13643
|
+
minWidth: String(paddingRight) + "px",
|
|
13644
|
+
maxWidth: String(paddingRight) + "px",
|
|
13645
|
+
padding: 0,
|
|
13646
|
+
border: "none"
|
|
13647
|
+
}
|
|
13648
|
+
}
|
|
13649
|
+
),
|
|
13650
|
+
rightCells.map((cell, idx) => renderCell(cell, leftCells.length + centerCellsToRender.length + idx))
|
|
13651
|
+
]
|
|
13541
13652
|
}
|
|
13542
13653
|
),
|
|
13543
13654
|
row.getIsExpanded() && /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: customSubRowData && renderSubRows && renderSubRows({
|
|
@@ -13546,7 +13657,7 @@ function TableRow({
|
|
|
13546
13657
|
}) })
|
|
13547
13658
|
] }, row.id);
|
|
13548
13659
|
}
|
|
13549
|
-
const Checkmark = () => /* @__PURE__ */ jsxRuntimeExports.
|
|
13660
|
+
const Checkmark = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
13550
13661
|
"svg",
|
|
13551
13662
|
{
|
|
13552
13663
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -13554,14 +13665,1047 @@ const Checkmark = () => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
|
13554
13665
|
height: "20",
|
|
13555
13666
|
viewBox: "0 2 22 22",
|
|
13556
13667
|
style: { color: "var(--colors-gama-500)" },
|
|
13557
|
-
children:
|
|
13668
|
+
children: [
|
|
13669
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("title", { children: "Checkmark" }),
|
|
13670
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { fill: "currentColor", d: "M21 7L9 19l-5.5-5.5l1.41-1.41L9 16.17L19.59 5.59z" })
|
|
13671
|
+
]
|
|
13558
13672
|
}
|
|
13559
13673
|
);
|
|
13560
|
-
function
|
|
13674
|
+
function memo(getDeps, fn, opts) {
|
|
13675
|
+
let deps = opts.initialDeps ?? [];
|
|
13676
|
+
let result;
|
|
13677
|
+
let isInitial = true;
|
|
13678
|
+
function memoizedFunction() {
|
|
13679
|
+
var _a, _b, _c;
|
|
13680
|
+
let depTime;
|
|
13681
|
+
if (opts.key && ((_a = opts.debug) == null ? void 0 : _a.call(opts)))
|
|
13682
|
+
depTime = Date.now();
|
|
13683
|
+
const newDeps = getDeps();
|
|
13684
|
+
const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep);
|
|
13685
|
+
if (!depsChanged) {
|
|
13686
|
+
return result;
|
|
13687
|
+
}
|
|
13688
|
+
deps = newDeps;
|
|
13689
|
+
let resultTime;
|
|
13690
|
+
if (opts.key && ((_b = opts.debug) == null ? void 0 : _b.call(opts)))
|
|
13691
|
+
resultTime = Date.now();
|
|
13692
|
+
result = fn(...newDeps);
|
|
13693
|
+
if (opts.key && ((_c = opts.debug) == null ? void 0 : _c.call(opts))) {
|
|
13694
|
+
const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
|
|
13695
|
+
const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
|
|
13696
|
+
const resultFpsPercentage = resultEndTime / 16;
|
|
13697
|
+
const pad = (str, num) => {
|
|
13698
|
+
str = String(str);
|
|
13699
|
+
while (str.length < num) {
|
|
13700
|
+
str = " " + str;
|
|
13701
|
+
}
|
|
13702
|
+
return str;
|
|
13703
|
+
};
|
|
13704
|
+
console.info(
|
|
13705
|
+
`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,
|
|
13706
|
+
`
|
|
13707
|
+
font-size: .6rem;
|
|
13708
|
+
font-weight: bold;
|
|
13709
|
+
color: hsl(${Math.max(
|
|
13710
|
+
0,
|
|
13711
|
+
Math.min(120 - 120 * resultFpsPercentage, 120)
|
|
13712
|
+
)}deg 100% 31%);`,
|
|
13713
|
+
opts == null ? void 0 : opts.key
|
|
13714
|
+
);
|
|
13715
|
+
}
|
|
13716
|
+
if ((opts == null ? void 0 : opts.onChange) && !(isInitial && opts.skipInitialOnChange)) {
|
|
13717
|
+
opts.onChange(result);
|
|
13718
|
+
}
|
|
13719
|
+
isInitial = false;
|
|
13720
|
+
return result;
|
|
13721
|
+
}
|
|
13722
|
+
memoizedFunction.updateDeps = (newDeps) => {
|
|
13723
|
+
deps = newDeps;
|
|
13724
|
+
};
|
|
13725
|
+
return memoizedFunction;
|
|
13726
|
+
}
|
|
13727
|
+
function notUndefined(value, msg) {
|
|
13728
|
+
if (value === void 0) {
|
|
13729
|
+
throw new Error(`Unexpected undefined${msg ? `: ${msg}` : ""}`);
|
|
13730
|
+
} else {
|
|
13731
|
+
return value;
|
|
13732
|
+
}
|
|
13733
|
+
}
|
|
13734
|
+
const approxEqual = (a, b) => Math.abs(a - b) < 1.01;
|
|
13735
|
+
const debounce = (targetWindow, fn, ms) => {
|
|
13736
|
+
let timeoutId;
|
|
13737
|
+
return function(...args) {
|
|
13738
|
+
targetWindow.clearTimeout(timeoutId);
|
|
13739
|
+
timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms);
|
|
13740
|
+
};
|
|
13741
|
+
};
|
|
13742
|
+
const getRect = (element) => {
|
|
13743
|
+
const { offsetWidth, offsetHeight } = element;
|
|
13744
|
+
return { width: offsetWidth, height: offsetHeight };
|
|
13745
|
+
};
|
|
13746
|
+
const defaultKeyExtractor = (index) => index;
|
|
13747
|
+
const defaultRangeExtractor = (range) => {
|
|
13748
|
+
const start = Math.max(range.startIndex - range.overscan, 0);
|
|
13749
|
+
const end = Math.min(range.endIndex + range.overscan, range.count - 1);
|
|
13750
|
+
const arr = [];
|
|
13751
|
+
for (let i = start; i <= end; i++) {
|
|
13752
|
+
arr.push(i);
|
|
13753
|
+
}
|
|
13754
|
+
return arr;
|
|
13755
|
+
};
|
|
13756
|
+
const observeElementRect = (instance, cb) => {
|
|
13757
|
+
const element = instance.scrollElement;
|
|
13758
|
+
if (!element) {
|
|
13759
|
+
return;
|
|
13760
|
+
}
|
|
13761
|
+
const targetWindow = instance.targetWindow;
|
|
13762
|
+
if (!targetWindow) {
|
|
13763
|
+
return;
|
|
13764
|
+
}
|
|
13765
|
+
const handler = (rect) => {
|
|
13766
|
+
const { width: width2, height: height2 } = rect;
|
|
13767
|
+
cb({ width: Math.round(width2), height: Math.round(height2) });
|
|
13768
|
+
};
|
|
13769
|
+
handler(getRect(element));
|
|
13770
|
+
if (!targetWindow.ResizeObserver) {
|
|
13771
|
+
return () => {
|
|
13772
|
+
};
|
|
13773
|
+
}
|
|
13774
|
+
const observer = new targetWindow.ResizeObserver((entries) => {
|
|
13775
|
+
const run = () => {
|
|
13776
|
+
const entry = entries[0];
|
|
13777
|
+
if (entry == null ? void 0 : entry.borderBoxSize) {
|
|
13778
|
+
const box = entry.borderBoxSize[0];
|
|
13779
|
+
if (box) {
|
|
13780
|
+
handler({ width: box.inlineSize, height: box.blockSize });
|
|
13781
|
+
return;
|
|
13782
|
+
}
|
|
13783
|
+
}
|
|
13784
|
+
handler(getRect(element));
|
|
13785
|
+
};
|
|
13786
|
+
instance.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run();
|
|
13787
|
+
});
|
|
13788
|
+
observer.observe(element, { box: "border-box" });
|
|
13789
|
+
return () => {
|
|
13790
|
+
observer.unobserve(element);
|
|
13791
|
+
};
|
|
13792
|
+
};
|
|
13793
|
+
const addEventListenerOptions = {
|
|
13794
|
+
passive: true
|
|
13795
|
+
};
|
|
13796
|
+
const supportsScrollend = typeof window == "undefined" ? true : "onscrollend" in window;
|
|
13797
|
+
const observeElementOffset = (instance, cb) => {
|
|
13798
|
+
const element = instance.scrollElement;
|
|
13799
|
+
if (!element) {
|
|
13800
|
+
return;
|
|
13801
|
+
}
|
|
13802
|
+
const targetWindow = instance.targetWindow;
|
|
13803
|
+
if (!targetWindow) {
|
|
13804
|
+
return;
|
|
13805
|
+
}
|
|
13806
|
+
let offset = 0;
|
|
13807
|
+
const fallback = instance.options.useScrollendEvent && supportsScrollend ? () => void 0 : debounce(
|
|
13808
|
+
targetWindow,
|
|
13809
|
+
() => {
|
|
13810
|
+
cb(offset, false);
|
|
13811
|
+
},
|
|
13812
|
+
instance.options.isScrollingResetDelay
|
|
13813
|
+
);
|
|
13814
|
+
const createHandler = (isScrolling) => () => {
|
|
13815
|
+
const { horizontal, isRtl } = instance.options;
|
|
13816
|
+
offset = horizontal ? element["scrollLeft"] * (isRtl && -1 || 1) : element["scrollTop"];
|
|
13817
|
+
fallback();
|
|
13818
|
+
cb(offset, isScrolling);
|
|
13819
|
+
};
|
|
13820
|
+
const handler = createHandler(true);
|
|
13821
|
+
const endHandler = createHandler(false);
|
|
13822
|
+
element.addEventListener("scroll", handler, addEventListenerOptions);
|
|
13823
|
+
const registerScrollendEvent = instance.options.useScrollendEvent && supportsScrollend;
|
|
13824
|
+
if (registerScrollendEvent) {
|
|
13825
|
+
element.addEventListener("scrollend", endHandler, addEventListenerOptions);
|
|
13826
|
+
}
|
|
13827
|
+
return () => {
|
|
13828
|
+
element.removeEventListener("scroll", handler);
|
|
13829
|
+
if (registerScrollendEvent) {
|
|
13830
|
+
element.removeEventListener("scrollend", endHandler);
|
|
13831
|
+
}
|
|
13832
|
+
};
|
|
13833
|
+
};
|
|
13834
|
+
const measureElement = (element, entry, instance) => {
|
|
13835
|
+
if (entry == null ? void 0 : entry.borderBoxSize) {
|
|
13836
|
+
const box = entry.borderBoxSize[0];
|
|
13837
|
+
if (box) {
|
|
13838
|
+
const size = Math.round(
|
|
13839
|
+
box[instance.options.horizontal ? "inlineSize" : "blockSize"]
|
|
13840
|
+
);
|
|
13841
|
+
return size;
|
|
13842
|
+
}
|
|
13843
|
+
}
|
|
13844
|
+
return element[instance.options.horizontal ? "offsetWidth" : "offsetHeight"];
|
|
13845
|
+
};
|
|
13846
|
+
const elementScroll = (offset, {
|
|
13847
|
+
adjustments = 0,
|
|
13848
|
+
behavior
|
|
13849
|
+
}, instance) => {
|
|
13850
|
+
var _a, _b;
|
|
13851
|
+
const toOffset = offset + adjustments;
|
|
13852
|
+
(_b = (_a = instance.scrollElement) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, {
|
|
13853
|
+
[instance.options.horizontal ? "left" : "top"]: toOffset,
|
|
13854
|
+
behavior
|
|
13855
|
+
});
|
|
13856
|
+
};
|
|
13857
|
+
class Virtualizer {
|
|
13858
|
+
constructor(opts) {
|
|
13859
|
+
this.unsubs = [];
|
|
13860
|
+
this.scrollElement = null;
|
|
13861
|
+
this.targetWindow = null;
|
|
13862
|
+
this.isScrolling = false;
|
|
13863
|
+
this.scrollState = null;
|
|
13864
|
+
this.measurementsCache = [];
|
|
13865
|
+
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
13866
|
+
this.laneAssignments = /* @__PURE__ */ new Map();
|
|
13867
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
13868
|
+
this.prevLanes = void 0;
|
|
13869
|
+
this.lanesChangedFlag = false;
|
|
13870
|
+
this.lanesSettling = false;
|
|
13871
|
+
this.scrollRect = null;
|
|
13872
|
+
this.scrollOffset = null;
|
|
13873
|
+
this.scrollDirection = null;
|
|
13874
|
+
this.scrollAdjustments = 0;
|
|
13875
|
+
this.elementsCache = /* @__PURE__ */ new Map();
|
|
13876
|
+
this.now = () => {
|
|
13877
|
+
var _a, _b, _c;
|
|
13878
|
+
return ((_c = (_b = (_a = this.targetWindow) == null ? void 0 : _a.performance) == null ? void 0 : _b.now) == null ? void 0 : _c.call(_b)) ?? Date.now();
|
|
13879
|
+
};
|
|
13880
|
+
this.observer = /* @__PURE__ */ (() => {
|
|
13881
|
+
let _ro = null;
|
|
13882
|
+
const get = () => {
|
|
13883
|
+
if (_ro) {
|
|
13884
|
+
return _ro;
|
|
13885
|
+
}
|
|
13886
|
+
if (!this.targetWindow || !this.targetWindow.ResizeObserver) {
|
|
13887
|
+
return null;
|
|
13888
|
+
}
|
|
13889
|
+
return _ro = new this.targetWindow.ResizeObserver((entries) => {
|
|
13890
|
+
entries.forEach((entry) => {
|
|
13891
|
+
const run = () => {
|
|
13892
|
+
this._measureElement(entry.target, entry);
|
|
13893
|
+
};
|
|
13894
|
+
this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run();
|
|
13895
|
+
});
|
|
13896
|
+
});
|
|
13897
|
+
};
|
|
13898
|
+
return {
|
|
13899
|
+
disconnect: () => {
|
|
13900
|
+
var _a;
|
|
13901
|
+
(_a = get()) == null ? void 0 : _a.disconnect();
|
|
13902
|
+
_ro = null;
|
|
13903
|
+
},
|
|
13904
|
+
observe: (target) => {
|
|
13905
|
+
var _a;
|
|
13906
|
+
return (_a = get()) == null ? void 0 : _a.observe(target, { box: "border-box" });
|
|
13907
|
+
},
|
|
13908
|
+
unobserve: (target) => {
|
|
13909
|
+
var _a;
|
|
13910
|
+
return (_a = get()) == null ? void 0 : _a.unobserve(target);
|
|
13911
|
+
}
|
|
13912
|
+
};
|
|
13913
|
+
})();
|
|
13914
|
+
this.range = null;
|
|
13915
|
+
this.setOptions = (opts2) => {
|
|
13916
|
+
Object.entries(opts2).forEach(([key, value]) => {
|
|
13917
|
+
if (typeof value === "undefined")
|
|
13918
|
+
delete opts2[key];
|
|
13919
|
+
});
|
|
13920
|
+
this.options = {
|
|
13921
|
+
debug: false,
|
|
13922
|
+
initialOffset: 0,
|
|
13923
|
+
overscan: 1,
|
|
13924
|
+
paddingStart: 0,
|
|
13925
|
+
paddingEnd: 0,
|
|
13926
|
+
scrollPaddingStart: 0,
|
|
13927
|
+
scrollPaddingEnd: 0,
|
|
13928
|
+
horizontal: false,
|
|
13929
|
+
getItemKey: defaultKeyExtractor,
|
|
13930
|
+
rangeExtractor: defaultRangeExtractor,
|
|
13931
|
+
onChange: () => {
|
|
13932
|
+
},
|
|
13933
|
+
measureElement,
|
|
13934
|
+
initialRect: { width: 0, height: 0 },
|
|
13935
|
+
scrollMargin: 0,
|
|
13936
|
+
gap: 0,
|
|
13937
|
+
indexAttribute: "data-index",
|
|
13938
|
+
initialMeasurementsCache: [],
|
|
13939
|
+
lanes: 1,
|
|
13940
|
+
isScrollingResetDelay: 150,
|
|
13941
|
+
enabled: true,
|
|
13942
|
+
isRtl: false,
|
|
13943
|
+
useScrollendEvent: false,
|
|
13944
|
+
useAnimationFrameWithResizeObserver: false,
|
|
13945
|
+
...opts2
|
|
13946
|
+
};
|
|
13947
|
+
};
|
|
13948
|
+
this.notify = (sync) => {
|
|
13949
|
+
var _a, _b;
|
|
13950
|
+
(_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, sync);
|
|
13951
|
+
};
|
|
13952
|
+
this.maybeNotify = memo(
|
|
13953
|
+
() => {
|
|
13954
|
+
this.calculateRange();
|
|
13955
|
+
return [
|
|
13956
|
+
this.isScrolling,
|
|
13957
|
+
this.range ? this.range.startIndex : null,
|
|
13958
|
+
this.range ? this.range.endIndex : null
|
|
13959
|
+
];
|
|
13960
|
+
},
|
|
13961
|
+
(isScrolling) => {
|
|
13962
|
+
this.notify(isScrolling);
|
|
13963
|
+
},
|
|
13964
|
+
{
|
|
13965
|
+
key: process.env.NODE_ENV !== "production" && "maybeNotify",
|
|
13966
|
+
debug: () => this.options.debug,
|
|
13967
|
+
initialDeps: [
|
|
13968
|
+
this.isScrolling,
|
|
13969
|
+
this.range ? this.range.startIndex : null,
|
|
13970
|
+
this.range ? this.range.endIndex : null
|
|
13971
|
+
]
|
|
13972
|
+
}
|
|
13973
|
+
);
|
|
13974
|
+
this.cleanup = () => {
|
|
13975
|
+
this.unsubs.filter(Boolean).forEach((d) => d());
|
|
13976
|
+
this.unsubs = [];
|
|
13977
|
+
this.observer.disconnect();
|
|
13978
|
+
if (this.rafId != null && this.targetWindow) {
|
|
13979
|
+
this.targetWindow.cancelAnimationFrame(this.rafId);
|
|
13980
|
+
this.rafId = null;
|
|
13981
|
+
}
|
|
13982
|
+
this.scrollState = null;
|
|
13983
|
+
this.scrollElement = null;
|
|
13984
|
+
this.targetWindow = null;
|
|
13985
|
+
};
|
|
13986
|
+
this._didMount = () => {
|
|
13987
|
+
return () => {
|
|
13988
|
+
this.cleanup();
|
|
13989
|
+
};
|
|
13990
|
+
};
|
|
13991
|
+
this._willUpdate = () => {
|
|
13992
|
+
var _a;
|
|
13993
|
+
const scrollElement = this.options.enabled ? this.options.getScrollElement() : null;
|
|
13994
|
+
if (this.scrollElement !== scrollElement) {
|
|
13995
|
+
this.cleanup();
|
|
13996
|
+
if (!scrollElement) {
|
|
13997
|
+
this.maybeNotify();
|
|
13998
|
+
return;
|
|
13999
|
+
}
|
|
14000
|
+
this.scrollElement = scrollElement;
|
|
14001
|
+
if (this.scrollElement && "ownerDocument" in this.scrollElement) {
|
|
14002
|
+
this.targetWindow = this.scrollElement.ownerDocument.defaultView;
|
|
14003
|
+
} else {
|
|
14004
|
+
this.targetWindow = ((_a = this.scrollElement) == null ? void 0 : _a.window) ?? null;
|
|
14005
|
+
}
|
|
14006
|
+
this.elementsCache.forEach((cached) => {
|
|
14007
|
+
this.observer.observe(cached);
|
|
14008
|
+
});
|
|
14009
|
+
this.unsubs.push(
|
|
14010
|
+
this.options.observeElementRect(this, (rect) => {
|
|
14011
|
+
this.scrollRect = rect;
|
|
14012
|
+
this.maybeNotify();
|
|
14013
|
+
})
|
|
14014
|
+
);
|
|
14015
|
+
this.unsubs.push(
|
|
14016
|
+
this.options.observeElementOffset(this, (offset, isScrolling) => {
|
|
14017
|
+
this.scrollAdjustments = 0;
|
|
14018
|
+
this.scrollDirection = isScrolling ? this.getScrollOffset() < offset ? "forward" : "backward" : null;
|
|
14019
|
+
this.scrollOffset = offset;
|
|
14020
|
+
this.isScrolling = isScrolling;
|
|
14021
|
+
if (this.scrollState) {
|
|
14022
|
+
this.scheduleScrollReconcile();
|
|
14023
|
+
}
|
|
14024
|
+
this.maybeNotify();
|
|
14025
|
+
})
|
|
14026
|
+
);
|
|
14027
|
+
this._scrollToOffset(this.getScrollOffset(), {
|
|
14028
|
+
adjustments: void 0,
|
|
14029
|
+
behavior: void 0
|
|
14030
|
+
});
|
|
14031
|
+
}
|
|
14032
|
+
};
|
|
14033
|
+
this.rafId = null;
|
|
14034
|
+
this.getSize = () => {
|
|
14035
|
+
if (!this.options.enabled) {
|
|
14036
|
+
this.scrollRect = null;
|
|
14037
|
+
return 0;
|
|
14038
|
+
}
|
|
14039
|
+
this.scrollRect = this.scrollRect ?? this.options.initialRect;
|
|
14040
|
+
return this.scrollRect[this.options.horizontal ? "width" : "height"];
|
|
14041
|
+
};
|
|
14042
|
+
this.getScrollOffset = () => {
|
|
14043
|
+
if (!this.options.enabled) {
|
|
14044
|
+
this.scrollOffset = null;
|
|
14045
|
+
return 0;
|
|
14046
|
+
}
|
|
14047
|
+
this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset === "function" ? this.options.initialOffset() : this.options.initialOffset);
|
|
14048
|
+
return this.scrollOffset;
|
|
14049
|
+
};
|
|
14050
|
+
this.getFurthestMeasurement = (measurements, index) => {
|
|
14051
|
+
const furthestMeasurementsFound = /* @__PURE__ */ new Map();
|
|
14052
|
+
const furthestMeasurements = /* @__PURE__ */ new Map();
|
|
14053
|
+
for (let m = index - 1; m >= 0; m--) {
|
|
14054
|
+
const measurement = measurements[m];
|
|
14055
|
+
if (furthestMeasurementsFound.has(measurement.lane)) {
|
|
14056
|
+
continue;
|
|
14057
|
+
}
|
|
14058
|
+
const previousFurthestMeasurement = furthestMeasurements.get(
|
|
14059
|
+
measurement.lane
|
|
14060
|
+
);
|
|
14061
|
+
if (previousFurthestMeasurement == null || measurement.end > previousFurthestMeasurement.end) {
|
|
14062
|
+
furthestMeasurements.set(measurement.lane, measurement);
|
|
14063
|
+
} else if (measurement.end < previousFurthestMeasurement.end) {
|
|
14064
|
+
furthestMeasurementsFound.set(measurement.lane, true);
|
|
14065
|
+
}
|
|
14066
|
+
if (furthestMeasurementsFound.size === this.options.lanes) {
|
|
14067
|
+
break;
|
|
14068
|
+
}
|
|
14069
|
+
}
|
|
14070
|
+
return furthestMeasurements.size === this.options.lanes ? Array.from(furthestMeasurements.values()).sort((a, b) => {
|
|
14071
|
+
if (a.end === b.end) {
|
|
14072
|
+
return a.index - b.index;
|
|
14073
|
+
}
|
|
14074
|
+
return a.end - b.end;
|
|
14075
|
+
})[0] : void 0;
|
|
14076
|
+
};
|
|
14077
|
+
this.getMeasurementOptions = memo(
|
|
14078
|
+
() => [
|
|
14079
|
+
this.options.count,
|
|
14080
|
+
this.options.paddingStart,
|
|
14081
|
+
this.options.scrollMargin,
|
|
14082
|
+
this.options.getItemKey,
|
|
14083
|
+
this.options.enabled,
|
|
14084
|
+
this.options.lanes
|
|
14085
|
+
],
|
|
14086
|
+
(count2, paddingStart, scrollMargin, getItemKey, enabled, lanes) => {
|
|
14087
|
+
const lanesChanged = this.prevLanes !== void 0 && this.prevLanes !== lanes;
|
|
14088
|
+
if (lanesChanged) {
|
|
14089
|
+
this.lanesChangedFlag = true;
|
|
14090
|
+
}
|
|
14091
|
+
this.prevLanes = lanes;
|
|
14092
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
14093
|
+
return {
|
|
14094
|
+
count: count2,
|
|
14095
|
+
paddingStart,
|
|
14096
|
+
scrollMargin,
|
|
14097
|
+
getItemKey,
|
|
14098
|
+
enabled,
|
|
14099
|
+
lanes
|
|
14100
|
+
};
|
|
14101
|
+
},
|
|
14102
|
+
{
|
|
14103
|
+
key: false
|
|
14104
|
+
}
|
|
14105
|
+
);
|
|
14106
|
+
this.getMeasurements = memo(
|
|
14107
|
+
() => [this.getMeasurementOptions(), this.itemSizeCache],
|
|
14108
|
+
({ count: count2, paddingStart, scrollMargin, getItemKey, enabled, lanes }, itemSizeCache) => {
|
|
14109
|
+
if (!enabled) {
|
|
14110
|
+
this.measurementsCache = [];
|
|
14111
|
+
this.itemSizeCache.clear();
|
|
14112
|
+
this.laneAssignments.clear();
|
|
14113
|
+
return [];
|
|
14114
|
+
}
|
|
14115
|
+
if (this.laneAssignments.size > count2) {
|
|
14116
|
+
for (const index of this.laneAssignments.keys()) {
|
|
14117
|
+
if (index >= count2) {
|
|
14118
|
+
this.laneAssignments.delete(index);
|
|
14119
|
+
}
|
|
14120
|
+
}
|
|
14121
|
+
}
|
|
14122
|
+
if (this.lanesChangedFlag) {
|
|
14123
|
+
this.lanesChangedFlag = false;
|
|
14124
|
+
this.lanesSettling = true;
|
|
14125
|
+
this.measurementsCache = [];
|
|
14126
|
+
this.itemSizeCache.clear();
|
|
14127
|
+
this.laneAssignments.clear();
|
|
14128
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
14129
|
+
}
|
|
14130
|
+
if (this.measurementsCache.length === 0 && !this.lanesSettling) {
|
|
14131
|
+
this.measurementsCache = this.options.initialMeasurementsCache;
|
|
14132
|
+
this.measurementsCache.forEach((item) => {
|
|
14133
|
+
this.itemSizeCache.set(item.key, item.size);
|
|
14134
|
+
});
|
|
14135
|
+
}
|
|
14136
|
+
const min2 = this.lanesSettling ? 0 : this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
|
|
14137
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
14138
|
+
if (this.lanesSettling && this.measurementsCache.length === count2) {
|
|
14139
|
+
this.lanesSettling = false;
|
|
14140
|
+
}
|
|
14141
|
+
const measurements = this.measurementsCache.slice(0, min2);
|
|
14142
|
+
const laneLastIndex = new Array(lanes).fill(
|
|
14143
|
+
void 0
|
|
14144
|
+
);
|
|
14145
|
+
for (let m = 0; m < min2; m++) {
|
|
14146
|
+
const item = measurements[m];
|
|
14147
|
+
if (item) {
|
|
14148
|
+
laneLastIndex[item.lane] = m;
|
|
14149
|
+
}
|
|
14150
|
+
}
|
|
14151
|
+
for (let i = min2; i < count2; i++) {
|
|
14152
|
+
const key = getItemKey(i);
|
|
14153
|
+
const cachedLane = this.laneAssignments.get(i);
|
|
14154
|
+
let lane;
|
|
14155
|
+
let start;
|
|
14156
|
+
if (cachedLane !== void 0 && this.options.lanes > 1) {
|
|
14157
|
+
lane = cachedLane;
|
|
14158
|
+
const prevIndex = laneLastIndex[lane];
|
|
14159
|
+
const prevInLane = prevIndex !== void 0 ? measurements[prevIndex] : void 0;
|
|
14160
|
+
start = prevInLane ? prevInLane.end + this.options.gap : paddingStart + scrollMargin;
|
|
14161
|
+
} else {
|
|
14162
|
+
const furthestMeasurement = this.options.lanes === 1 ? measurements[i - 1] : this.getFurthestMeasurement(measurements, i);
|
|
14163
|
+
start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
|
|
14164
|
+
lane = furthestMeasurement ? furthestMeasurement.lane : i % this.options.lanes;
|
|
14165
|
+
if (this.options.lanes > 1) {
|
|
14166
|
+
this.laneAssignments.set(i, lane);
|
|
14167
|
+
}
|
|
14168
|
+
}
|
|
14169
|
+
const measuredSize = itemSizeCache.get(key);
|
|
14170
|
+
const size = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i);
|
|
14171
|
+
const end = start + size;
|
|
14172
|
+
measurements[i] = {
|
|
14173
|
+
index: i,
|
|
14174
|
+
start,
|
|
14175
|
+
size,
|
|
14176
|
+
end,
|
|
14177
|
+
key,
|
|
14178
|
+
lane
|
|
14179
|
+
};
|
|
14180
|
+
laneLastIndex[lane] = i;
|
|
14181
|
+
}
|
|
14182
|
+
this.measurementsCache = measurements;
|
|
14183
|
+
return measurements;
|
|
14184
|
+
},
|
|
14185
|
+
{
|
|
14186
|
+
key: process.env.NODE_ENV !== "production" && "getMeasurements",
|
|
14187
|
+
debug: () => this.options.debug
|
|
14188
|
+
}
|
|
14189
|
+
);
|
|
14190
|
+
this.calculateRange = memo(
|
|
14191
|
+
() => [
|
|
14192
|
+
this.getMeasurements(),
|
|
14193
|
+
this.getSize(),
|
|
14194
|
+
this.getScrollOffset(),
|
|
14195
|
+
this.options.lanes
|
|
14196
|
+
],
|
|
14197
|
+
(measurements, outerSize, scrollOffset, lanes) => {
|
|
14198
|
+
return this.range = measurements.length > 0 && outerSize > 0 ? calculateRange({
|
|
14199
|
+
measurements,
|
|
14200
|
+
outerSize,
|
|
14201
|
+
scrollOffset,
|
|
14202
|
+
lanes
|
|
14203
|
+
}) : null;
|
|
14204
|
+
},
|
|
14205
|
+
{
|
|
14206
|
+
key: process.env.NODE_ENV !== "production" && "calculateRange",
|
|
14207
|
+
debug: () => this.options.debug
|
|
14208
|
+
}
|
|
14209
|
+
);
|
|
14210
|
+
this.getVirtualIndexes = memo(
|
|
14211
|
+
() => {
|
|
14212
|
+
let startIndex = null;
|
|
14213
|
+
let endIndex = null;
|
|
14214
|
+
const range = this.calculateRange();
|
|
14215
|
+
if (range) {
|
|
14216
|
+
startIndex = range.startIndex;
|
|
14217
|
+
endIndex = range.endIndex;
|
|
14218
|
+
}
|
|
14219
|
+
this.maybeNotify.updateDeps([this.isScrolling, startIndex, endIndex]);
|
|
14220
|
+
return [
|
|
14221
|
+
this.options.rangeExtractor,
|
|
14222
|
+
this.options.overscan,
|
|
14223
|
+
this.options.count,
|
|
14224
|
+
startIndex,
|
|
14225
|
+
endIndex
|
|
14226
|
+
];
|
|
14227
|
+
},
|
|
14228
|
+
(rangeExtractor, overscan, count2, startIndex, endIndex) => {
|
|
14229
|
+
return startIndex === null || endIndex === null ? [] : rangeExtractor({
|
|
14230
|
+
startIndex,
|
|
14231
|
+
endIndex,
|
|
14232
|
+
overscan,
|
|
14233
|
+
count: count2
|
|
14234
|
+
});
|
|
14235
|
+
},
|
|
14236
|
+
{
|
|
14237
|
+
key: process.env.NODE_ENV !== "production" && "getVirtualIndexes",
|
|
14238
|
+
debug: () => this.options.debug
|
|
14239
|
+
}
|
|
14240
|
+
);
|
|
14241
|
+
this.indexFromElement = (node) => {
|
|
14242
|
+
const attributeName = this.options.indexAttribute;
|
|
14243
|
+
const indexStr = node.getAttribute(attributeName);
|
|
14244
|
+
if (!indexStr) {
|
|
14245
|
+
console.warn(
|
|
14246
|
+
`Missing attribute name '${attributeName}={index}' on measured element.`
|
|
14247
|
+
);
|
|
14248
|
+
return -1;
|
|
14249
|
+
}
|
|
14250
|
+
return parseInt(indexStr, 10);
|
|
14251
|
+
};
|
|
14252
|
+
this.shouldMeasureDuringScroll = (index) => {
|
|
14253
|
+
var _a;
|
|
14254
|
+
if (!this.scrollState || this.scrollState.behavior !== "smooth") {
|
|
14255
|
+
return true;
|
|
14256
|
+
}
|
|
14257
|
+
const scrollIndex = this.scrollState.index ?? ((_a = this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)) == null ? void 0 : _a.index);
|
|
14258
|
+
if (scrollIndex !== void 0 && this.range) {
|
|
14259
|
+
const bufferSize = Math.max(
|
|
14260
|
+
this.options.overscan,
|
|
14261
|
+
Math.ceil((this.range.endIndex - this.range.startIndex) / 2)
|
|
14262
|
+
);
|
|
14263
|
+
const minIndex = Math.max(0, scrollIndex - bufferSize);
|
|
14264
|
+
const maxIndex = Math.min(
|
|
14265
|
+
this.options.count - 1,
|
|
14266
|
+
scrollIndex + bufferSize
|
|
14267
|
+
);
|
|
14268
|
+
return index >= minIndex && index <= maxIndex;
|
|
14269
|
+
}
|
|
14270
|
+
return true;
|
|
14271
|
+
};
|
|
14272
|
+
this._measureElement = (node, entry) => {
|
|
14273
|
+
if (!node.isConnected) {
|
|
14274
|
+
this.observer.unobserve(node);
|
|
14275
|
+
return;
|
|
14276
|
+
}
|
|
14277
|
+
const index = this.indexFromElement(node);
|
|
14278
|
+
const item = this.measurementsCache[index];
|
|
14279
|
+
if (!item) {
|
|
14280
|
+
return;
|
|
14281
|
+
}
|
|
14282
|
+
const key = item.key;
|
|
14283
|
+
const prevNode = this.elementsCache.get(key);
|
|
14284
|
+
if (prevNode !== node) {
|
|
14285
|
+
if (prevNode) {
|
|
14286
|
+
this.observer.unobserve(prevNode);
|
|
14287
|
+
}
|
|
14288
|
+
this.observer.observe(node);
|
|
14289
|
+
this.elementsCache.set(key, node);
|
|
14290
|
+
}
|
|
14291
|
+
if (this.shouldMeasureDuringScroll(index)) {
|
|
14292
|
+
this.resizeItem(index, this.options.measureElement(node, entry, this));
|
|
14293
|
+
}
|
|
14294
|
+
};
|
|
14295
|
+
this.resizeItem = (index, size) => {
|
|
14296
|
+
var _a;
|
|
14297
|
+
const item = this.measurementsCache[index];
|
|
14298
|
+
if (!item) {
|
|
14299
|
+
return;
|
|
14300
|
+
}
|
|
14301
|
+
const itemSize = this.itemSizeCache.get(item.key) ?? item.size;
|
|
14302
|
+
const delta = size - itemSize;
|
|
14303
|
+
if (delta !== 0) {
|
|
14304
|
+
if (((_a = this.scrollState) == null ? void 0 : _a.behavior) !== "smooth" && (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(item, delta, this) : item.start < this.getScrollOffset() + this.scrollAdjustments)) {
|
|
14305
|
+
if (process.env.NODE_ENV !== "production" && this.options.debug) {
|
|
14306
|
+
console.info("correction", delta);
|
|
14307
|
+
}
|
|
14308
|
+
this._scrollToOffset(this.getScrollOffset(), {
|
|
14309
|
+
adjustments: this.scrollAdjustments += delta,
|
|
14310
|
+
behavior: void 0
|
|
14311
|
+
});
|
|
14312
|
+
}
|
|
14313
|
+
this.pendingMeasuredCacheIndexes.push(item.index);
|
|
14314
|
+
this.itemSizeCache = new Map(this.itemSizeCache.set(item.key, size));
|
|
14315
|
+
this.notify(false);
|
|
14316
|
+
}
|
|
14317
|
+
};
|
|
14318
|
+
this.measureElement = (node) => {
|
|
14319
|
+
if (!node) {
|
|
14320
|
+
this.elementsCache.forEach((cached, key) => {
|
|
14321
|
+
if (!cached.isConnected) {
|
|
14322
|
+
this.observer.unobserve(cached);
|
|
14323
|
+
this.elementsCache.delete(key);
|
|
14324
|
+
}
|
|
14325
|
+
});
|
|
14326
|
+
return;
|
|
14327
|
+
}
|
|
14328
|
+
this._measureElement(node, void 0);
|
|
14329
|
+
};
|
|
14330
|
+
this.getVirtualItems = memo(
|
|
14331
|
+
() => [this.getVirtualIndexes(), this.getMeasurements()],
|
|
14332
|
+
(indexes, measurements) => {
|
|
14333
|
+
const virtualItems = [];
|
|
14334
|
+
for (let k = 0, len = indexes.length; k < len; k++) {
|
|
14335
|
+
const i = indexes[k];
|
|
14336
|
+
const measurement = measurements[i];
|
|
14337
|
+
virtualItems.push(measurement);
|
|
14338
|
+
}
|
|
14339
|
+
return virtualItems;
|
|
14340
|
+
},
|
|
14341
|
+
{
|
|
14342
|
+
key: process.env.NODE_ENV !== "production" && "getVirtualItems",
|
|
14343
|
+
debug: () => this.options.debug
|
|
14344
|
+
}
|
|
14345
|
+
);
|
|
14346
|
+
this.getVirtualItemForOffset = (offset) => {
|
|
14347
|
+
const measurements = this.getMeasurements();
|
|
14348
|
+
if (measurements.length === 0) {
|
|
14349
|
+
return void 0;
|
|
14350
|
+
}
|
|
14351
|
+
return notUndefined(
|
|
14352
|
+
measurements[findNearestBinarySearch(
|
|
14353
|
+
0,
|
|
14354
|
+
measurements.length - 1,
|
|
14355
|
+
(index) => notUndefined(measurements[index]).start,
|
|
14356
|
+
offset
|
|
14357
|
+
)]
|
|
14358
|
+
);
|
|
14359
|
+
};
|
|
14360
|
+
this.getMaxScrollOffset = () => {
|
|
14361
|
+
if (!this.scrollElement)
|
|
14362
|
+
return 0;
|
|
14363
|
+
if ("scrollHeight" in this.scrollElement) {
|
|
14364
|
+
return this.options.horizontal ? this.scrollElement.scrollWidth - this.scrollElement.clientWidth : this.scrollElement.scrollHeight - this.scrollElement.clientHeight;
|
|
14365
|
+
} else {
|
|
14366
|
+
const doc = this.scrollElement.document.documentElement;
|
|
14367
|
+
return this.options.horizontal ? doc.scrollWidth - this.scrollElement.innerWidth : doc.scrollHeight - this.scrollElement.innerHeight;
|
|
14368
|
+
}
|
|
14369
|
+
};
|
|
14370
|
+
this.getOffsetForAlignment = (toOffset, align, itemSize = 0) => {
|
|
14371
|
+
if (!this.scrollElement)
|
|
14372
|
+
return 0;
|
|
14373
|
+
const size = this.getSize();
|
|
14374
|
+
const scrollOffset = this.getScrollOffset();
|
|
14375
|
+
if (align === "auto") {
|
|
14376
|
+
align = toOffset >= scrollOffset + size ? "end" : "start";
|
|
14377
|
+
}
|
|
14378
|
+
if (align === "center") {
|
|
14379
|
+
toOffset += (itemSize - size) / 2;
|
|
14380
|
+
} else if (align === "end") {
|
|
14381
|
+
toOffset -= size;
|
|
14382
|
+
}
|
|
14383
|
+
const maxOffset = this.getMaxScrollOffset();
|
|
14384
|
+
return Math.max(Math.min(maxOffset, toOffset), 0);
|
|
14385
|
+
};
|
|
14386
|
+
this.getOffsetForIndex = (index, align = "auto") => {
|
|
14387
|
+
index = Math.max(0, Math.min(index, this.options.count - 1));
|
|
14388
|
+
const size = this.getSize();
|
|
14389
|
+
const scrollOffset = this.getScrollOffset();
|
|
14390
|
+
const item = this.measurementsCache[index];
|
|
14391
|
+
if (!item)
|
|
14392
|
+
return;
|
|
14393
|
+
if (align === "auto") {
|
|
14394
|
+
if (item.end >= scrollOffset + size - this.options.scrollPaddingEnd) {
|
|
14395
|
+
align = "end";
|
|
14396
|
+
} else if (item.start <= scrollOffset + this.options.scrollPaddingStart) {
|
|
14397
|
+
align = "start";
|
|
14398
|
+
} else {
|
|
14399
|
+
return [scrollOffset, align];
|
|
14400
|
+
}
|
|
14401
|
+
}
|
|
14402
|
+
if (align === "end" && index === this.options.count - 1) {
|
|
14403
|
+
return [this.getMaxScrollOffset(), align];
|
|
14404
|
+
}
|
|
14405
|
+
const toOffset = align === "end" ? item.end + this.options.scrollPaddingEnd : item.start - this.options.scrollPaddingStart;
|
|
14406
|
+
return [
|
|
14407
|
+
this.getOffsetForAlignment(toOffset, align, item.size),
|
|
14408
|
+
align
|
|
14409
|
+
];
|
|
14410
|
+
};
|
|
14411
|
+
this.scrollToOffset = (toOffset, { align = "start", behavior = "auto" } = {}) => {
|
|
14412
|
+
const offset = this.getOffsetForAlignment(toOffset, align);
|
|
14413
|
+
const now = this.now();
|
|
14414
|
+
this.scrollState = {
|
|
14415
|
+
index: null,
|
|
14416
|
+
align,
|
|
14417
|
+
behavior,
|
|
14418
|
+
startedAt: now,
|
|
14419
|
+
lastTargetOffset: offset,
|
|
14420
|
+
stableFrames: 0
|
|
14421
|
+
};
|
|
14422
|
+
this._scrollToOffset(offset, { adjustments: void 0, behavior });
|
|
14423
|
+
this.scheduleScrollReconcile();
|
|
14424
|
+
};
|
|
14425
|
+
this.scrollToIndex = (index, {
|
|
14426
|
+
align: initialAlign = "auto",
|
|
14427
|
+
behavior = "auto"
|
|
14428
|
+
} = {}) => {
|
|
14429
|
+
index = Math.max(0, Math.min(index, this.options.count - 1));
|
|
14430
|
+
const offsetInfo = this.getOffsetForIndex(index, initialAlign);
|
|
14431
|
+
if (!offsetInfo) {
|
|
14432
|
+
return;
|
|
14433
|
+
}
|
|
14434
|
+
const [offset, align] = offsetInfo;
|
|
14435
|
+
const now = this.now();
|
|
14436
|
+
this.scrollState = {
|
|
14437
|
+
index,
|
|
14438
|
+
align,
|
|
14439
|
+
behavior,
|
|
14440
|
+
startedAt: now,
|
|
14441
|
+
lastTargetOffset: offset,
|
|
14442
|
+
stableFrames: 0
|
|
14443
|
+
};
|
|
14444
|
+
this._scrollToOffset(offset, { adjustments: void 0, behavior });
|
|
14445
|
+
this.scheduleScrollReconcile();
|
|
14446
|
+
};
|
|
14447
|
+
this.scrollBy = (delta, { behavior = "auto" } = {}) => {
|
|
14448
|
+
const offset = this.getScrollOffset() + delta;
|
|
14449
|
+
const now = this.now();
|
|
14450
|
+
this.scrollState = {
|
|
14451
|
+
index: null,
|
|
14452
|
+
align: "start",
|
|
14453
|
+
behavior,
|
|
14454
|
+
startedAt: now,
|
|
14455
|
+
lastTargetOffset: offset,
|
|
14456
|
+
stableFrames: 0
|
|
14457
|
+
};
|
|
14458
|
+
this._scrollToOffset(offset, { adjustments: void 0, behavior });
|
|
14459
|
+
this.scheduleScrollReconcile();
|
|
14460
|
+
};
|
|
14461
|
+
this.getTotalSize = () => {
|
|
14462
|
+
var _a;
|
|
14463
|
+
const measurements = this.getMeasurements();
|
|
14464
|
+
let end;
|
|
14465
|
+
if (measurements.length === 0) {
|
|
14466
|
+
end = this.options.paddingStart;
|
|
14467
|
+
} else if (this.options.lanes === 1) {
|
|
14468
|
+
end = ((_a = measurements[measurements.length - 1]) == null ? void 0 : _a.end) ?? 0;
|
|
14469
|
+
} else {
|
|
14470
|
+
const endByLane = Array(this.options.lanes).fill(null);
|
|
14471
|
+
let endIndex = measurements.length - 1;
|
|
14472
|
+
while (endIndex >= 0 && endByLane.some((val) => val === null)) {
|
|
14473
|
+
const item = measurements[endIndex];
|
|
14474
|
+
if (endByLane[item.lane] === null) {
|
|
14475
|
+
endByLane[item.lane] = item.end;
|
|
14476
|
+
}
|
|
14477
|
+
endIndex--;
|
|
14478
|
+
}
|
|
14479
|
+
end = Math.max(...endByLane.filter((val) => val !== null));
|
|
14480
|
+
}
|
|
14481
|
+
return Math.max(
|
|
14482
|
+
end - this.options.scrollMargin + this.options.paddingEnd,
|
|
14483
|
+
0
|
|
14484
|
+
);
|
|
14485
|
+
};
|
|
14486
|
+
this._scrollToOffset = (offset, {
|
|
14487
|
+
adjustments,
|
|
14488
|
+
behavior
|
|
14489
|
+
}) => {
|
|
14490
|
+
this.options.scrollToFn(offset, { behavior, adjustments }, this);
|
|
14491
|
+
};
|
|
14492
|
+
this.measure = () => {
|
|
14493
|
+
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
14494
|
+
this.laneAssignments = /* @__PURE__ */ new Map();
|
|
14495
|
+
this.notify(false);
|
|
14496
|
+
};
|
|
14497
|
+
this.setOptions(opts);
|
|
14498
|
+
}
|
|
14499
|
+
scheduleScrollReconcile() {
|
|
14500
|
+
if (!this.targetWindow) {
|
|
14501
|
+
this.scrollState = null;
|
|
14502
|
+
return;
|
|
14503
|
+
}
|
|
14504
|
+
if (this.rafId != null)
|
|
14505
|
+
return;
|
|
14506
|
+
this.rafId = this.targetWindow.requestAnimationFrame(() => {
|
|
14507
|
+
this.rafId = null;
|
|
14508
|
+
this.reconcileScroll();
|
|
14509
|
+
});
|
|
14510
|
+
}
|
|
14511
|
+
reconcileScroll() {
|
|
14512
|
+
if (!this.scrollState)
|
|
14513
|
+
return;
|
|
14514
|
+
const el = this.scrollElement;
|
|
14515
|
+
if (!el)
|
|
14516
|
+
return;
|
|
14517
|
+
const MAX_RECONCILE_MS = 5e3;
|
|
14518
|
+
if (this.now() - this.scrollState.startedAt > MAX_RECONCILE_MS) {
|
|
14519
|
+
this.scrollState = null;
|
|
14520
|
+
return;
|
|
14521
|
+
}
|
|
14522
|
+
const offsetInfo = this.scrollState.index != null ? this.getOffsetForIndex(this.scrollState.index, this.scrollState.align) : void 0;
|
|
14523
|
+
const targetOffset = offsetInfo ? offsetInfo[0] : this.scrollState.lastTargetOffset;
|
|
14524
|
+
const STABLE_FRAMES = 1;
|
|
14525
|
+
const targetChanged = targetOffset !== this.scrollState.lastTargetOffset;
|
|
14526
|
+
if (!targetChanged && approxEqual(targetOffset, this.getScrollOffset())) {
|
|
14527
|
+
this.scrollState.stableFrames++;
|
|
14528
|
+
if (this.scrollState.stableFrames >= STABLE_FRAMES) {
|
|
14529
|
+
this.scrollState = null;
|
|
14530
|
+
return;
|
|
14531
|
+
}
|
|
14532
|
+
} else {
|
|
14533
|
+
this.scrollState.stableFrames = 0;
|
|
14534
|
+
if (targetChanged) {
|
|
14535
|
+
this.scrollState.lastTargetOffset = targetOffset;
|
|
14536
|
+
this.scrollState.behavior = "auto";
|
|
14537
|
+
this._scrollToOffset(targetOffset, {
|
|
14538
|
+
adjustments: void 0,
|
|
14539
|
+
behavior: "auto"
|
|
14540
|
+
});
|
|
14541
|
+
}
|
|
14542
|
+
}
|
|
14543
|
+
this.scheduleScrollReconcile();
|
|
14544
|
+
}
|
|
14545
|
+
}
|
|
14546
|
+
const findNearestBinarySearch = (low, high, getCurrentValue, value) => {
|
|
14547
|
+
while (low <= high) {
|
|
14548
|
+
const middle = (low + high) / 2 | 0;
|
|
14549
|
+
const currentValue = getCurrentValue(middle);
|
|
14550
|
+
if (currentValue < value) {
|
|
14551
|
+
low = middle + 1;
|
|
14552
|
+
} else if (currentValue > value) {
|
|
14553
|
+
high = middle - 1;
|
|
14554
|
+
} else {
|
|
14555
|
+
return middle;
|
|
14556
|
+
}
|
|
14557
|
+
}
|
|
14558
|
+
if (low > 0) {
|
|
14559
|
+
return low - 1;
|
|
14560
|
+
} else {
|
|
14561
|
+
return 0;
|
|
14562
|
+
}
|
|
14563
|
+
};
|
|
14564
|
+
function calculateRange({
|
|
14565
|
+
measurements,
|
|
14566
|
+
outerSize,
|
|
14567
|
+
scrollOffset,
|
|
14568
|
+
lanes
|
|
14569
|
+
}) {
|
|
14570
|
+
const lastIndex = measurements.length - 1;
|
|
14571
|
+
const getOffset = (index) => measurements[index].start;
|
|
14572
|
+
if (measurements.length <= lanes) {
|
|
14573
|
+
return {
|
|
14574
|
+
startIndex: 0,
|
|
14575
|
+
endIndex: lastIndex
|
|
14576
|
+
};
|
|
14577
|
+
}
|
|
14578
|
+
let startIndex = findNearestBinarySearch(
|
|
14579
|
+
0,
|
|
14580
|
+
lastIndex,
|
|
14581
|
+
getOffset,
|
|
14582
|
+
scrollOffset
|
|
14583
|
+
);
|
|
14584
|
+
let endIndex = startIndex;
|
|
14585
|
+
if (lanes === 1) {
|
|
14586
|
+
while (endIndex < lastIndex && measurements[endIndex].end < scrollOffset + outerSize) {
|
|
14587
|
+
endIndex++;
|
|
14588
|
+
}
|
|
14589
|
+
} else if (lanes > 1) {
|
|
14590
|
+
const endPerLane = Array(lanes).fill(0);
|
|
14591
|
+
while (endIndex < lastIndex && endPerLane.some((pos) => pos < scrollOffset + outerSize)) {
|
|
14592
|
+
const item = measurements[endIndex];
|
|
14593
|
+
endPerLane[item.lane] = item.end;
|
|
14594
|
+
endIndex++;
|
|
14595
|
+
}
|
|
14596
|
+
const startPerLane = Array(lanes).fill(scrollOffset + outerSize);
|
|
14597
|
+
while (startIndex >= 0 && startPerLane.some((pos) => pos >= scrollOffset)) {
|
|
14598
|
+
const item = measurements[startIndex];
|
|
14599
|
+
startPerLane[item.lane] = item.start;
|
|
14600
|
+
startIndex--;
|
|
14601
|
+
}
|
|
14602
|
+
startIndex = Math.max(0, startIndex - startIndex % lanes);
|
|
14603
|
+
endIndex = Math.min(lastIndex, endIndex + (lanes - 1 - endIndex % lanes));
|
|
14604
|
+
}
|
|
14605
|
+
return { startIndex, endIndex };
|
|
14606
|
+
}
|
|
14607
|
+
const useIsomorphicLayoutEffect = typeof document !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
14608
|
+
function useVirtualizerBase({
|
|
14609
|
+
useFlushSync = true,
|
|
14610
|
+
...options
|
|
14611
|
+
}) {
|
|
14612
|
+
const rerender = React.useReducer(() => ({}), {})[1];
|
|
14613
|
+
const resolvedOptions = {
|
|
14614
|
+
...options,
|
|
14615
|
+
onChange: (instance2, sync) => {
|
|
14616
|
+
var _a;
|
|
14617
|
+
if (useFlushSync && sync) {
|
|
14618
|
+
flushSync(rerender);
|
|
14619
|
+
} else {
|
|
14620
|
+
rerender();
|
|
14621
|
+
}
|
|
14622
|
+
(_a = options.onChange) == null ? void 0 : _a.call(options, instance2, sync);
|
|
14623
|
+
}
|
|
14624
|
+
};
|
|
14625
|
+
const [instance] = React.useState(
|
|
14626
|
+
() => new Virtualizer(resolvedOptions)
|
|
14627
|
+
);
|
|
14628
|
+
instance.setOptions(resolvedOptions);
|
|
14629
|
+
useIsomorphicLayoutEffect(() => {
|
|
14630
|
+
return instance._didMount();
|
|
14631
|
+
}, []);
|
|
14632
|
+
useIsomorphicLayoutEffect(() => {
|
|
14633
|
+
return instance._willUpdate();
|
|
14634
|
+
});
|
|
14635
|
+
return instance;
|
|
14636
|
+
}
|
|
14637
|
+
function useVirtualizer(options) {
|
|
14638
|
+
return useVirtualizerBase({
|
|
14639
|
+
observeElementRect,
|
|
14640
|
+
observeElementOffset,
|
|
14641
|
+
scrollToFn: elementScroll,
|
|
14642
|
+
...options
|
|
14643
|
+
});
|
|
14644
|
+
}
|
|
14645
|
+
function useRowVirtualizer({
|
|
14646
|
+
rows,
|
|
14647
|
+
rowHeight,
|
|
14648
|
+
scrollRef
|
|
14649
|
+
}) {
|
|
14650
|
+
var _a, _b;
|
|
14651
|
+
const rowVirtualizer = useVirtualizer({
|
|
14652
|
+
count: rows.length,
|
|
14653
|
+
getScrollElement: () => (scrollRef == null ? void 0 : scrollRef.current) || null,
|
|
14654
|
+
estimateSize: () => rowHeight,
|
|
14655
|
+
measureElement: typeof window !== "undefined" && navigator.userAgent.indexOf("Firefox") === -1 ? (element) => element == null ? void 0 : element.getBoundingClientRect().height : void 0,
|
|
14656
|
+
overscan: 10
|
|
14657
|
+
});
|
|
14658
|
+
const virtualRows = rowVirtualizer.getVirtualItems();
|
|
14659
|
+
const totalSize = rowVirtualizer.getTotalSize();
|
|
14660
|
+
return {
|
|
14661
|
+
rowWindow: {
|
|
14662
|
+
indexes: virtualRows.map((item) => item.index),
|
|
14663
|
+
paddingTop: ((_a = virtualRows[0]) == null ? void 0 : _a.start) ?? 0,
|
|
14664
|
+
paddingBottom: virtualRows.length ? Math.max(0, totalSize - (((_b = virtualRows[virtualRows.length - 1]) == null ? void 0 : _b.end) ?? 0)) : 0
|
|
14665
|
+
}
|
|
14666
|
+
};
|
|
14667
|
+
}
|
|
14668
|
+
function TableRows({
|
|
14669
|
+
styledTableProps,
|
|
14670
|
+
table,
|
|
14671
|
+
scrollRef,
|
|
14672
|
+
columnWindow
|
|
14673
|
+
}) {
|
|
13561
14674
|
const rows = styledTableProps.hideFooter ? table.getExpandedRowModel().rows : table.getRowModel().rows;
|
|
13562
|
-
|
|
14675
|
+
const rowHeight = styledTableProps.rowHeight || 48;
|
|
14676
|
+
const {
|
|
14677
|
+
rowWindow: { indexes, paddingBottom, paddingTop }
|
|
14678
|
+
} = useRowVirtualizer({
|
|
14679
|
+
rows,
|
|
14680
|
+
rowHeight,
|
|
14681
|
+
scrollRef
|
|
14682
|
+
});
|
|
14683
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
14684
|
+
paddingTop > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("tr", { style: { height: `${paddingTop}px` } }),
|
|
14685
|
+
indexes.map((index) => {
|
|
14686
|
+
const row = rows[index];
|
|
14687
|
+
if (!row)
|
|
14688
|
+
return null;
|
|
14689
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
14690
|
+
TableRow,
|
|
14691
|
+
{
|
|
14692
|
+
styledTableProps,
|
|
14693
|
+
row,
|
|
14694
|
+
index,
|
|
14695
|
+
columnWindow
|
|
14696
|
+
},
|
|
14697
|
+
row.id
|
|
14698
|
+
);
|
|
14699
|
+
}),
|
|
14700
|
+
paddingBottom > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("tr", { style: { height: `${paddingBottom}px` } })
|
|
14701
|
+
] });
|
|
13563
14702
|
}
|
|
13564
|
-
function TableBody({
|
|
14703
|
+
function TableBody({
|
|
14704
|
+
table,
|
|
14705
|
+
styledTableProps,
|
|
14706
|
+
scrollRef,
|
|
14707
|
+
columnWindow
|
|
14708
|
+
}) {
|
|
13565
14709
|
const { columns, data, loading, enableDnd, rowHeight } = styledTableProps;
|
|
13566
14710
|
const colSpan = table.getAllLeafColumns().length || columns.length || 1;
|
|
13567
14711
|
if (loading && data.length === 0) {
|
|
@@ -13570,7 +14714,23 @@ function TableBody({ table, styledTableProps }) {
|
|
|
13570
14714
|
if (data.length === 0) {
|
|
13571
14715
|
return null;
|
|
13572
14716
|
}
|
|
13573
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("tbody", { className: style$1["tbody"], children: enableDnd ? /* @__PURE__ */ jsxRuntimeExports.jsx(SortableContext, { items: data, strategy: verticalListSortingStrategy, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
14717
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("tbody", { className: style$1["tbody"], children: enableDnd ? /* @__PURE__ */ jsxRuntimeExports.jsx(SortableContext, { items: data, strategy: verticalListSortingStrategy, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
14718
|
+
TableRows,
|
|
14719
|
+
{
|
|
14720
|
+
table,
|
|
14721
|
+
styledTableProps,
|
|
14722
|
+
scrollRef,
|
|
14723
|
+
columnWindow
|
|
14724
|
+
}
|
|
14725
|
+
) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
14726
|
+
TableRows,
|
|
14727
|
+
{
|
|
14728
|
+
table,
|
|
14729
|
+
styledTableProps,
|
|
14730
|
+
scrollRef,
|
|
14731
|
+
columnWindow
|
|
14732
|
+
}
|
|
14733
|
+
) });
|
|
13574
14734
|
}
|
|
13575
14735
|
function LoadingIcon(props) {
|
|
13576
14736
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1rem", height: "1rem", viewBox: "0 0 24 24", ...props, children: [
|
|
@@ -13964,6 +15124,29 @@ function useElementHeightPx() {
|
|
|
13964
15124
|
}, []);
|
|
13965
15125
|
return { ref, heightPx };
|
|
13966
15126
|
}
|
|
15127
|
+
function useColumnVirtualizer(table, scrollRef) {
|
|
15128
|
+
var _a, _b;
|
|
15129
|
+
const centerColumns = table.getVisibleLeafColumns().filter((column) => !column.columnDef.fixedLeft && column.id !== ACTIONS_COLUMN_ID);
|
|
15130
|
+
const columnVirtualizer = useVirtualizer({
|
|
15131
|
+
count: centerColumns.length,
|
|
15132
|
+
getScrollElement: () => (scrollRef == null ? void 0 : scrollRef.current) || null,
|
|
15133
|
+
estimateSize: (index) => {
|
|
15134
|
+
var _a2, _b2;
|
|
15135
|
+
return ((_b2 = (_a2 = centerColumns[index]) == null ? void 0 : _a2.getSize) == null ? void 0 : _b2.call(_a2)) ?? 120;
|
|
15136
|
+
},
|
|
15137
|
+
horizontal: true,
|
|
15138
|
+
overscan: 2
|
|
15139
|
+
});
|
|
15140
|
+
const virtualColumns = columnVirtualizer.getVirtualItems();
|
|
15141
|
+
const totalSize = columnVirtualizer.getTotalSize();
|
|
15142
|
+
return {
|
|
15143
|
+
columnWindow: {
|
|
15144
|
+
indexes: virtualColumns.map((item) => item.index),
|
|
15145
|
+
paddingLeft: ((_a = virtualColumns[0]) == null ? void 0 : _a.start) ?? 0,
|
|
15146
|
+
paddingRight: virtualColumns.length ? Math.max(0, totalSize - (((_b = virtualColumns[virtualColumns.length - 1]) == null ? void 0 : _b.end) ?? 0)) : 0
|
|
15147
|
+
}
|
|
15148
|
+
};
|
|
15149
|
+
}
|
|
13967
15150
|
function DndProvider({
|
|
13968
15151
|
enabled,
|
|
13969
15152
|
data,
|
|
@@ -14044,6 +15227,7 @@ const StyledTable = (props) => {
|
|
|
14044
15227
|
showNoRowsOverlay && style$1["table-wrapper--no-rows"],
|
|
14045
15228
|
className
|
|
14046
15229
|
);
|
|
15230
|
+
const { columnWindow } = useColumnVirtualizer(table, tableScrollRef);
|
|
14047
15231
|
const TableMarkup = /* @__PURE__ */ jsxRuntimeExports.jsxs("table", { className: style$1["styled-table"], style: { width: table.getTotalSize(), minWidth: "100%" }, children: [
|
|
14048
15232
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
14049
15233
|
TableHeader,
|
|
@@ -14051,11 +15235,20 @@ const StyledTable = (props) => {
|
|
|
14051
15235
|
table,
|
|
14052
15236
|
styledTableProps: options,
|
|
14053
15237
|
tableCanResize: !!options.enableColumnResizing,
|
|
14054
|
-
tableWidth: null
|
|
15238
|
+
tableWidth: null,
|
|
15239
|
+
columnWindow
|
|
14055
15240
|
}
|
|
14056
15241
|
),
|
|
14057
15242
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Fetching, { fetching: !!fetching }),
|
|
14058
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
15243
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
15244
|
+
TableBody,
|
|
15245
|
+
{
|
|
15246
|
+
table,
|
|
15247
|
+
styledTableProps: options,
|
|
15248
|
+
scrollRef: tableScrollRef,
|
|
15249
|
+
columnWindow
|
|
15250
|
+
}
|
|
15251
|
+
)
|
|
14059
15252
|
] });
|
|
14060
15253
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(RootContextProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(DndProvider, { enabled: !!enableDnd, data, setData, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
14061
15254
|
"div",
|