@machinemetrics/mm-react-components 0.2.3-1 → 0.2.3-2
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/README.md +51 -14
- package/dist/App.d.ts.map +1 -1
- package/dist/README.md +51 -14
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/docs/GETTING_STARTED.md +285 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/main.d.ts +2 -2
- package/dist/main.d.ts.map +1 -1
- package/dist/mm-react-components.es.js +1837 -75
- package/dist/mm-react-components.es.js.map +1 -1
- package/dist/mm-react-components.umd.js +10 -10
- package/dist/mm-react-components.umd.js.map +1 -1
- package/dist/preview/CheckboxPreview.d.ts.map +1 -1
- package/dist/preview/DataTablePreview.d.ts.map +1 -1
- package/dist/preview/InputPreview.d.ts.map +1 -1
- package/dist/preview/LabelPreview.d.ts.map +1 -1
- package/dist/preview/RadioGroupPreview.d.ts.map +1 -1
- package/dist/preview/TabsPreview.d.ts.map +1 -1
- package/dist/preview/data-table/data-table-preview_column-content.d.ts +1 -1
- package/dist/preview/data-table/data-table-preview_column-content.d.ts.map +1 -1
- package/dist/preview/page-header/PageHeaderPreview.d.ts.map +1 -1
- package/dist/themes/base.css +536 -0
- package/dist/themes/complete.css +2 -2
- package/package.json +21 -2
- package/src/themes/base.css +536 -0
- package/src/themes/complete.css +2 -2
- package/dist/tailwind.config.export.js +0 -153
- package/tailwind.config.export.js +0 -153
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import React__default, { forwardRef, createElement, useLayoutEffect, useState, useCallback, useEffect, useMemo, createContext, useContext, useRef, memo as memo$
|
|
2
|
+
import React__default, { forwardRef, createElement, useLayoutEffect, useState, useCallback, useEffect, useMemo, createContext, useContext, useRef, memo as memo$2, useReducer, useImperativeHandle, Fragment } from "react";
|
|
3
3
|
import * as ReactDOM from "react-dom";
|
|
4
|
-
import ReactDOM__default, { unstable_batchedUpdates, createPortal } from "react-dom";
|
|
4
|
+
import ReactDOM__default, { unstable_batchedUpdates, createPortal, flushSync } from "react-dom";
|
|
5
5
|
function r(e) {
|
|
6
6
|
var t, f, n = "";
|
|
7
7
|
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
@@ -8102,7 +8102,7 @@ function useCallbackRef$1(initialValue, callback) {
|
|
|
8102
8102
|
ref.callback = callback;
|
|
8103
8103
|
return ref.facade;
|
|
8104
8104
|
}
|
|
8105
|
-
var useIsomorphicLayoutEffect$
|
|
8105
|
+
var useIsomorphicLayoutEffect$3 = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
8106
8106
|
var currentValues = /* @__PURE__ */ new WeakMap();
|
|
8107
8107
|
function useMergeRefs(refs, defaultValue2) {
|
|
8108
8108
|
var callbackRef = useCallbackRef$1(null, function(newValue) {
|
|
@@ -8110,7 +8110,7 @@ function useMergeRefs(refs, defaultValue2) {
|
|
|
8110
8110
|
return assignRef(ref, newValue);
|
|
8111
8111
|
});
|
|
8112
8112
|
});
|
|
8113
|
-
useIsomorphicLayoutEffect$
|
|
8113
|
+
useIsomorphicLayoutEffect$3(function() {
|
|
8114
8114
|
var oldValue = currentValues.get(callbackRef);
|
|
8115
8115
|
if (oldValue) {
|
|
8116
8116
|
var prevRefs_1 = new Set(oldValue);
|
|
@@ -8496,10 +8496,10 @@ var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
|
8496
8496
|
break;
|
|
8497
8497
|
}
|
|
8498
8498
|
var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
|
|
8499
|
-
var
|
|
8500
|
-
if (position ||
|
|
8499
|
+
var elementScroll2 = scroll_1 - capacity - directionFactor * position;
|
|
8500
|
+
if (position || elementScroll2) {
|
|
8501
8501
|
if (elementCouldBeScrolled(axis, target)) {
|
|
8502
|
-
availableScroll +=
|
|
8502
|
+
availableScroll += elementScroll2;
|
|
8503
8503
|
availableScrollTop += position;
|
|
8504
8504
|
}
|
|
8505
8505
|
}
|
|
@@ -15307,7 +15307,7 @@ function testPlatform(re2) {
|
|
|
15307
15307
|
return typeof window !== "undefined" && window.navigator != null ? re2.test(window.navigator.platform) : void 0;
|
|
15308
15308
|
}
|
|
15309
15309
|
const KEYBOARD_BUFFER = 24;
|
|
15310
|
-
const useIsomorphicLayoutEffect$
|
|
15310
|
+
const useIsomorphicLayoutEffect$2 = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
15311
15311
|
function chain$1(...callbacks) {
|
|
15312
15312
|
return (...args) => {
|
|
15313
15313
|
for (let callback of callbacks) {
|
|
@@ -15346,7 +15346,7 @@ let preventScrollCount = 0;
|
|
|
15346
15346
|
let restore;
|
|
15347
15347
|
function usePreventScroll(options = {}) {
|
|
15348
15348
|
let { isDisabled } = options;
|
|
15349
|
-
useIsomorphicLayoutEffect$
|
|
15349
|
+
useIsomorphicLayoutEffect$2(() => {
|
|
15350
15350
|
if (isDisabled) {
|
|
15351
15351
|
return;
|
|
15352
15352
|
}
|
|
@@ -20111,10 +20111,10 @@ function getOwnerDocument(target) {
|
|
|
20111
20111
|
}
|
|
20112
20112
|
return document;
|
|
20113
20113
|
}
|
|
20114
|
-
const useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect;
|
|
20114
|
+
const useIsomorphicLayoutEffect$1 = canUseDOM ? useLayoutEffect : useEffect;
|
|
20115
20115
|
function useEvent(handler) {
|
|
20116
20116
|
const handlerRef = useRef(handler);
|
|
20117
|
-
useIsomorphicLayoutEffect(() => {
|
|
20117
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
20118
20118
|
handlerRef.current = handler;
|
|
20119
20119
|
});
|
|
20120
20120
|
return useCallback(function() {
|
|
@@ -20142,7 +20142,7 @@ function useLatestValue(value, dependencies) {
|
|
|
20142
20142
|
dependencies = [value];
|
|
20143
20143
|
}
|
|
20144
20144
|
const valueRef = useRef(value);
|
|
20145
|
-
useIsomorphicLayoutEffect(() => {
|
|
20145
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
20146
20146
|
if (valueRef.current !== value) {
|
|
20147
20147
|
valueRef.current = value;
|
|
20148
20148
|
}
|
|
@@ -22160,7 +22160,7 @@ function useRect(element, measure, fallbackRect) {
|
|
|
22160
22160
|
const resizeObserver = useResizeObserver({
|
|
22161
22161
|
callback: measureRect
|
|
22162
22162
|
});
|
|
22163
|
-
useIsomorphicLayoutEffect(() => {
|
|
22163
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
22164
22164
|
measureRect();
|
|
22165
22165
|
if (element) {
|
|
22166
22166
|
resizeObserver == null ? void 0 : resizeObserver.observe(element);
|
|
@@ -22334,7 +22334,7 @@ function useRects(elements, measure) {
|
|
|
22334
22334
|
const resizeObserver = useResizeObserver({
|
|
22335
22335
|
callback: measureRects
|
|
22336
22336
|
});
|
|
22337
|
-
useIsomorphicLayoutEffect(() => {
|
|
22337
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
22338
22338
|
resizeObserver == null ? void 0 : resizeObserver.disconnect();
|
|
22339
22339
|
measureRects();
|
|
22340
22340
|
elements.forEach((element) => resizeObserver == null ? void 0 : resizeObserver.observe(element));
|
|
@@ -22696,7 +22696,7 @@ function useLayoutShiftScrollCompensation(_ref) {
|
|
|
22696
22696
|
x: config,
|
|
22697
22697
|
y: config
|
|
22698
22698
|
} : config;
|
|
22699
|
-
useIsomorphicLayoutEffect(() => {
|
|
22699
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
22700
22700
|
const disabled = !x && !y;
|
|
22701
22701
|
if (disabled || !activeNode) {
|
|
22702
22702
|
initialized.current = false;
|
|
@@ -22740,7 +22740,7 @@ var Status;
|
|
|
22740
22740
|
Status2[Status2["Initializing"] = 1] = "Initializing";
|
|
22741
22741
|
Status2[Status2["Initialized"] = 2] = "Initialized";
|
|
22742
22742
|
})(Status || (Status = {}));
|
|
22743
|
-
const DndContext = /* @__PURE__ */ memo$
|
|
22743
|
+
const DndContext = /* @__PURE__ */ memo$2(function DndContext2(_ref) {
|
|
22744
22744
|
var _sensorContext$curren, _dragOverlay$nodeRef$, _dragOverlay$rect, _over$rect;
|
|
22745
22745
|
let {
|
|
22746
22746
|
id,
|
|
@@ -23057,7 +23057,7 @@ const DndContext = /* @__PURE__ */ memo$1(function DndContext2(_ref) {
|
|
|
23057
23057
|
}, [draggableNodes, instantiateSensor]);
|
|
23058
23058
|
const activators = useCombineActivators(sensors, bindActivatorToSensorInstantiator);
|
|
23059
23059
|
useSensorSetup(sensors);
|
|
23060
|
-
useIsomorphicLayoutEffect(() => {
|
|
23060
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
23061
23061
|
if (activeNodeRect && status === Status.Initializing) {
|
|
23062
23062
|
setStatus(Status.Initialized);
|
|
23063
23063
|
}
|
|
@@ -23141,7 +23141,7 @@ const DndContext = /* @__PURE__ */ memo$1(function DndContext2(_ref) {
|
|
|
23141
23141
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
23142
23142
|
[overId]
|
|
23143
23143
|
);
|
|
23144
|
-
useIsomorphicLayoutEffect(() => {
|
|
23144
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
23145
23145
|
sensorContext.current = {
|
|
23146
23146
|
activatorEvent,
|
|
23147
23147
|
active,
|
|
@@ -23268,7 +23268,7 @@ function useDraggable(_ref) {
|
|
|
23268
23268
|
const [activatorNode, setActivatorNodeRef] = useNodeRef();
|
|
23269
23269
|
const listeners = useSyntheticListeners(activators, id);
|
|
23270
23270
|
const dataRef = useLatestValue(data);
|
|
23271
|
-
useIsomorphicLayoutEffect(
|
|
23271
|
+
useIsomorphicLayoutEffect$1(
|
|
23272
23272
|
() => {
|
|
23273
23273
|
draggableNodes.set(id, {
|
|
23274
23274
|
id,
|
|
@@ -23652,7 +23652,7 @@ function SortableContext(_ref) {
|
|
|
23652
23652
|
const itemsHaveChanged = !itemsEqual(items, previousItemsRef.current);
|
|
23653
23653
|
const disableTransforms = overIndex !== -1 && activeIndex === -1 || itemsHaveChanged;
|
|
23654
23654
|
const disabled = normalizeDisabled(disabledProp);
|
|
23655
|
-
useIsomorphicLayoutEffect(() => {
|
|
23655
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
23656
23656
|
if (itemsHaveChanged && isDragging) {
|
|
23657
23657
|
measureDroppableContainers(items);
|
|
23658
23658
|
}
|
|
@@ -23733,7 +23733,7 @@ function useDerivedTransform(_ref) {
|
|
|
23733
23733
|
} = _ref;
|
|
23734
23734
|
const [derivedTransform, setDerivedtransform] = useState(null);
|
|
23735
23735
|
const previousIndex = useRef(index2);
|
|
23736
|
-
useIsomorphicLayoutEffect(() => {
|
|
23736
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
23737
23737
|
if (!disabled && index2 !== previousIndex.current && node.current) {
|
|
23738
23738
|
const initial = rect.current;
|
|
23739
23739
|
if (initial) {
|
|
@@ -24157,7 +24157,7 @@ function flattenBy(arr, getChildren) {
|
|
|
24157
24157
|
recurse(arr);
|
|
24158
24158
|
return flat;
|
|
24159
24159
|
}
|
|
24160
|
-
function memo(getDeps, fn, opts) {
|
|
24160
|
+
function memo$1(getDeps, fn, opts) {
|
|
24161
24161
|
let deps = [];
|
|
24162
24162
|
let result;
|
|
24163
24163
|
return (depArgs) => {
|
|
@@ -24215,7 +24215,7 @@ function createCell(table, row, column, columnId) {
|
|
|
24215
24215
|
column,
|
|
24216
24216
|
getValue: () => row.getValue(columnId),
|
|
24217
24217
|
renderValue: getRenderValue,
|
|
24218
|
-
getContext: memo(() => [table, column, row, cell], (table2, column2, row2, cell2) => ({
|
|
24218
|
+
getContext: memo$1(() => [table, column, row, cell], (table2, column2, row2, cell2) => ({
|
|
24219
24219
|
table: table2,
|
|
24220
24220
|
column: column2,
|
|
24221
24221
|
row: row2,
|
|
@@ -24271,11 +24271,11 @@ function createColumn(table, columnDef, depth, parent) {
|
|
|
24271
24271
|
depth,
|
|
24272
24272
|
columnDef: resolvedColumnDef,
|
|
24273
24273
|
columns: [],
|
|
24274
|
-
getFlatColumns: memo(() => [true], () => {
|
|
24274
|
+
getFlatColumns: memo$1(() => [true], () => {
|
|
24275
24275
|
var _column$columns;
|
|
24276
24276
|
return [column, ...(_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap((d) => d.getFlatColumns())];
|
|
24277
24277
|
}, getMemoOptions(table.options, "debugColumns", "column.getFlatColumns")),
|
|
24278
|
-
getLeafColumns: memo(() => [table._getOrderColumnsFn()], (orderColumns2) => {
|
|
24278
|
+
getLeafColumns: memo$1(() => [table._getOrderColumnsFn()], (orderColumns2) => {
|
|
24279
24279
|
var _column$columns2;
|
|
24280
24280
|
if ((_column$columns2 = column.columns) != null && _column$columns2.length) {
|
|
24281
24281
|
let leafColumns = column.columns.flatMap((column2) => column2.getLeafColumns());
|
|
@@ -24328,7 +24328,7 @@ function createHeader(table, column, options) {
|
|
|
24328
24328
|
}
|
|
24329
24329
|
const Headers = {
|
|
24330
24330
|
createTable: (table) => {
|
|
24331
|
-
table.getHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
|
|
24331
|
+
table.getHeaderGroups = memo$1(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
|
|
24332
24332
|
var _left$map$filter, _right$map$filter;
|
|
24333
24333
|
const leftColumns = (_left$map$filter = left == null ? void 0 : left.map((columnId) => leafColumns.find((d) => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
|
|
24334
24334
|
const rightColumns = (_right$map$filter = right == null ? void 0 : right.map((columnId) => leafColumns.find((d) => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
|
|
@@ -24336,71 +24336,71 @@ const Headers = {
|
|
|
24336
24336
|
const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table);
|
|
24337
24337
|
return headerGroups;
|
|
24338
24338
|
}, getMemoOptions(table.options, debug, "getHeaderGroups"));
|
|
24339
|
-
table.getCenterHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
|
|
24339
|
+
table.getCenterHeaderGroups = memo$1(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
|
|
24340
24340
|
leafColumns = leafColumns.filter((column) => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
|
|
24341
24341
|
return buildHeaderGroups(allColumns, leafColumns, table, "center");
|
|
24342
24342
|
}, getMemoOptions(table.options, debug, "getCenterHeaderGroups"));
|
|
24343
|
-
table.getLeftHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => {
|
|
24343
|
+
table.getLeftHeaderGroups = memo$1(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => {
|
|
24344
24344
|
var _left$map$filter2;
|
|
24345
24345
|
const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map((columnId) => leafColumns.find((d) => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
|
|
24346
24346
|
return buildHeaderGroups(allColumns, orderedLeafColumns, table, "left");
|
|
24347
24347
|
}, getMemoOptions(table.options, debug, "getLeftHeaderGroups"));
|
|
24348
|
-
table.getRightHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => {
|
|
24348
|
+
table.getRightHeaderGroups = memo$1(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => {
|
|
24349
24349
|
var _right$map$filter2;
|
|
24350
24350
|
const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map((columnId) => leafColumns.find((d) => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];
|
|
24351
24351
|
return buildHeaderGroups(allColumns, orderedLeafColumns, table, "right");
|
|
24352
24352
|
}, getMemoOptions(table.options, debug, "getRightHeaderGroups"));
|
|
24353
|
-
table.getFooterGroups = memo(() => [table.getHeaderGroups()], (headerGroups) => {
|
|
24353
|
+
table.getFooterGroups = memo$1(() => [table.getHeaderGroups()], (headerGroups) => {
|
|
24354
24354
|
return [...headerGroups].reverse();
|
|
24355
24355
|
}, getMemoOptions(table.options, debug, "getFooterGroups"));
|
|
24356
|
-
table.getLeftFooterGroups = memo(() => [table.getLeftHeaderGroups()], (headerGroups) => {
|
|
24356
|
+
table.getLeftFooterGroups = memo$1(() => [table.getLeftHeaderGroups()], (headerGroups) => {
|
|
24357
24357
|
return [...headerGroups].reverse();
|
|
24358
24358
|
}, getMemoOptions(table.options, debug, "getLeftFooterGroups"));
|
|
24359
|
-
table.getCenterFooterGroups = memo(() => [table.getCenterHeaderGroups()], (headerGroups) => {
|
|
24359
|
+
table.getCenterFooterGroups = memo$1(() => [table.getCenterHeaderGroups()], (headerGroups) => {
|
|
24360
24360
|
return [...headerGroups].reverse();
|
|
24361
24361
|
}, getMemoOptions(table.options, debug, "getCenterFooterGroups"));
|
|
24362
|
-
table.getRightFooterGroups = memo(() => [table.getRightHeaderGroups()], (headerGroups) => {
|
|
24362
|
+
table.getRightFooterGroups = memo$1(() => [table.getRightHeaderGroups()], (headerGroups) => {
|
|
24363
24363
|
return [...headerGroups].reverse();
|
|
24364
24364
|
}, getMemoOptions(table.options, debug, "getRightFooterGroups"));
|
|
24365
|
-
table.getFlatHeaders = memo(() => [table.getHeaderGroups()], (headerGroups) => {
|
|
24365
|
+
table.getFlatHeaders = memo$1(() => [table.getHeaderGroups()], (headerGroups) => {
|
|
24366
24366
|
return headerGroups.map((headerGroup) => {
|
|
24367
24367
|
return headerGroup.headers;
|
|
24368
24368
|
}).flat();
|
|
24369
24369
|
}, getMemoOptions(table.options, debug, "getFlatHeaders"));
|
|
24370
|
-
table.getLeftFlatHeaders = memo(() => [table.getLeftHeaderGroups()], (left) => {
|
|
24370
|
+
table.getLeftFlatHeaders = memo$1(() => [table.getLeftHeaderGroups()], (left) => {
|
|
24371
24371
|
return left.map((headerGroup) => {
|
|
24372
24372
|
return headerGroup.headers;
|
|
24373
24373
|
}).flat();
|
|
24374
24374
|
}, getMemoOptions(table.options, debug, "getLeftFlatHeaders"));
|
|
24375
|
-
table.getCenterFlatHeaders = memo(() => [table.getCenterHeaderGroups()], (left) => {
|
|
24375
|
+
table.getCenterFlatHeaders = memo$1(() => [table.getCenterHeaderGroups()], (left) => {
|
|
24376
24376
|
return left.map((headerGroup) => {
|
|
24377
24377
|
return headerGroup.headers;
|
|
24378
24378
|
}).flat();
|
|
24379
24379
|
}, getMemoOptions(table.options, debug, "getCenterFlatHeaders"));
|
|
24380
|
-
table.getRightFlatHeaders = memo(() => [table.getRightHeaderGroups()], (left) => {
|
|
24380
|
+
table.getRightFlatHeaders = memo$1(() => [table.getRightHeaderGroups()], (left) => {
|
|
24381
24381
|
return left.map((headerGroup) => {
|
|
24382
24382
|
return headerGroup.headers;
|
|
24383
24383
|
}).flat();
|
|
24384
24384
|
}, getMemoOptions(table.options, debug, "getRightFlatHeaders"));
|
|
24385
|
-
table.getCenterLeafHeaders = memo(() => [table.getCenterFlatHeaders()], (flatHeaders) => {
|
|
24385
|
+
table.getCenterLeafHeaders = memo$1(() => [table.getCenterFlatHeaders()], (flatHeaders) => {
|
|
24386
24386
|
return flatHeaders.filter((header) => {
|
|
24387
24387
|
var _header$subHeaders;
|
|
24388
24388
|
return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length);
|
|
24389
24389
|
});
|
|
24390
24390
|
}, getMemoOptions(table.options, debug, "getCenterLeafHeaders"));
|
|
24391
|
-
table.getLeftLeafHeaders = memo(() => [table.getLeftFlatHeaders()], (flatHeaders) => {
|
|
24391
|
+
table.getLeftLeafHeaders = memo$1(() => [table.getLeftFlatHeaders()], (flatHeaders) => {
|
|
24392
24392
|
return flatHeaders.filter((header) => {
|
|
24393
24393
|
var _header$subHeaders2;
|
|
24394
24394
|
return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length);
|
|
24395
24395
|
});
|
|
24396
24396
|
}, getMemoOptions(table.options, debug, "getLeftLeafHeaders"));
|
|
24397
|
-
table.getRightLeafHeaders = memo(() => [table.getRightFlatHeaders()], (flatHeaders) => {
|
|
24397
|
+
table.getRightLeafHeaders = memo$1(() => [table.getRightFlatHeaders()], (flatHeaders) => {
|
|
24398
24398
|
return flatHeaders.filter((header) => {
|
|
24399
24399
|
var _header$subHeaders3;
|
|
24400
24400
|
return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length);
|
|
24401
24401
|
});
|
|
24402
24402
|
}, getMemoOptions(table.options, debug, "getRightLeafHeaders"));
|
|
24403
|
-
table.getLeafHeaders = memo(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => {
|
|
24403
|
+
table.getLeafHeaders = memo$1(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => {
|
|
24404
24404
|
var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;
|
|
24405
24405
|
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) => {
|
|
24406
24406
|
return header.getLeafHeaders();
|
|
@@ -24555,12 +24555,12 @@ const createRow = (table, id, original, rowIndex, depth, subRows, parentId) => {
|
|
|
24555
24555
|
}
|
|
24556
24556
|
return parentRows.reverse();
|
|
24557
24557
|
},
|
|
24558
|
-
getAllCells: memo(() => [table.getAllLeafColumns()], (leafColumns) => {
|
|
24558
|
+
getAllCells: memo$1(() => [table.getAllLeafColumns()], (leafColumns) => {
|
|
24559
24559
|
return leafColumns.map((column) => {
|
|
24560
24560
|
return createCell(table, row, column, column.id);
|
|
24561
24561
|
});
|
|
24562
24562
|
}, getMemoOptions(table.options, "debugRows", "getAllCells")),
|
|
24563
|
-
_getAllCellsByColumnId: memo(() => [row.getAllCells()], (allCells) => {
|
|
24563
|
+
_getAllCellsByColumnId: memo$1(() => [row.getAllCells()], (allCells) => {
|
|
24564
24564
|
return allCells.reduce((acc, cell) => {
|
|
24565
24565
|
acc[cell.column.id] = cell;
|
|
24566
24566
|
return acc;
|
|
@@ -25026,7 +25026,7 @@ const ColumnOrdering = {
|
|
|
25026
25026
|
};
|
|
25027
25027
|
},
|
|
25028
25028
|
createColumn: (column, table) => {
|
|
25029
|
-
column.getIndex = memo((position) => [_getVisibleLeafColumns(table, position)], (columns) => columns.findIndex((d) => d.id === column.id), getMemoOptions(table.options, "debugColumns", "getIndex"));
|
|
25029
|
+
column.getIndex = memo$1((position) => [_getVisibleLeafColumns(table, position)], (columns) => columns.findIndex((d) => d.id === column.id), getMemoOptions(table.options, "debugColumns", "getIndex"));
|
|
25030
25030
|
column.getIsFirstColumn = (position) => {
|
|
25031
25031
|
var _columns$;
|
|
25032
25032
|
const columns = _getVisibleLeafColumns(table, position);
|
|
@@ -25044,7 +25044,7 @@ const ColumnOrdering = {
|
|
|
25044
25044
|
var _table$initialState$c;
|
|
25045
25045
|
table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []);
|
|
25046
25046
|
};
|
|
25047
|
-
table._getOrderColumnsFn = memo(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => (columns) => {
|
|
25047
|
+
table._getOrderColumnsFn = memo$1(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => (columns) => {
|
|
25048
25048
|
let orderedColumns = [];
|
|
25049
25049
|
if (!(columnOrder != null && columnOrder.length)) {
|
|
25050
25050
|
orderedColumns = columns;
|
|
@@ -25129,18 +25129,18 @@ const ColumnPinning = {
|
|
|
25129
25129
|
};
|
|
25130
25130
|
},
|
|
25131
25131
|
createRow: (row, table) => {
|
|
25132
|
-
row.getCenterVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => {
|
|
25132
|
+
row.getCenterVisibleCells = memo$1(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => {
|
|
25133
25133
|
const leftAndRight = [...left != null ? left : [], ...right != null ? right : []];
|
|
25134
25134
|
return allCells.filter((d) => !leftAndRight.includes(d.column.id));
|
|
25135
25135
|
}, getMemoOptions(table.options, "debugRows", "getCenterVisibleCells"));
|
|
25136
|
-
row.getLeftVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left], (allCells, left) => {
|
|
25136
|
+
row.getLeftVisibleCells = memo$1(() => [row._getAllVisibleCells(), table.getState().columnPinning.left], (allCells, left) => {
|
|
25137
25137
|
const cells = (left != null ? left : []).map((columnId) => allCells.find((cell) => cell.column.id === columnId)).filter(Boolean).map((d) => ({
|
|
25138
25138
|
...d,
|
|
25139
25139
|
position: "left"
|
|
25140
25140
|
}));
|
|
25141
25141
|
return cells;
|
|
25142
25142
|
}, getMemoOptions(table.options, "debugRows", "getLeftVisibleCells"));
|
|
25143
|
-
row.getRightVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => {
|
|
25143
|
+
row.getRightVisibleCells = memo$1(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => {
|
|
25144
25144
|
const cells = (right != null ? right : []).map((columnId) => allCells.find((cell) => cell.column.id === columnId)).filter(Boolean).map((d) => ({
|
|
25145
25145
|
...d,
|
|
25146
25146
|
position: "right"
|
|
@@ -25163,13 +25163,13 @@ const ColumnPinning = {
|
|
|
25163
25163
|
}
|
|
25164
25164
|
return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
|
|
25165
25165
|
};
|
|
25166
|
-
table.getLeftLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => {
|
|
25166
|
+
table.getLeftLeafColumns = memo$1(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => {
|
|
25167
25167
|
return (left != null ? left : []).map((columnId) => allColumns.find((column) => column.id === columnId)).filter(Boolean);
|
|
25168
25168
|
}, getMemoOptions(table.options, "debugColumns", "getLeftLeafColumns"));
|
|
25169
|
-
table.getRightLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => {
|
|
25169
|
+
table.getRightLeafColumns = memo$1(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => {
|
|
25170
25170
|
return (right != null ? right : []).map((columnId) => allColumns.find((column) => column.id === columnId)).filter(Boolean);
|
|
25171
25171
|
}, getMemoOptions(table.options, "debugColumns", "getRightLeafColumns"));
|
|
25172
|
-
table.getCenterLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => {
|
|
25172
|
+
table.getCenterLeafColumns = memo$1(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => {
|
|
25173
25173
|
const leftAndRight = [...left != null ? left : [], ...right != null ? right : []];
|
|
25174
25174
|
return allColumns.filter((d) => !leftAndRight.includes(d.id));
|
|
25175
25175
|
}, getMemoOptions(table.options, "debugColumns", "getCenterLeafColumns"));
|
|
@@ -25216,8 +25216,8 @@ const ColumnSizing = {
|
|
|
25216
25216
|
const columnSize = table.getState().columnSizing[column.id];
|
|
25217
25217
|
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);
|
|
25218
25218
|
};
|
|
25219
|
-
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"));
|
|
25220
|
-
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"));
|
|
25219
|
+
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"));
|
|
25220
|
+
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"));
|
|
25221
25221
|
column.resetSize = () => {
|
|
25222
25222
|
table.setColumnSizing((_ref2) => {
|
|
25223
25223
|
let {
|
|
@@ -25461,14 +25461,14 @@ const ColumnVisibility = {
|
|
|
25461
25461
|
};
|
|
25462
25462
|
},
|
|
25463
25463
|
createRow: (row, table) => {
|
|
25464
|
-
row._getAllVisibleCells = memo(() => [row.getAllCells(), table.getState().columnVisibility], (cells) => {
|
|
25464
|
+
row._getAllVisibleCells = memo$1(() => [row.getAllCells(), table.getState().columnVisibility], (cells) => {
|
|
25465
25465
|
return cells.filter((cell) => cell.column.getIsVisible());
|
|
25466
25466
|
}, getMemoOptions(table.options, "debugRows", "_getAllVisibleCells"));
|
|
25467
|
-
row.getVisibleCells = memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], getMemoOptions(table.options, "debugRows", "getVisibleCells"));
|
|
25467
|
+
row.getVisibleCells = memo$1(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], getMemoOptions(table.options, "debugRows", "getVisibleCells"));
|
|
25468
25468
|
},
|
|
25469
25469
|
createTable: (table) => {
|
|
25470
25470
|
const makeVisibleColumnsMethod = (key, getColumns) => {
|
|
25471
|
-
return memo(() => [getColumns(), getColumns().filter((d) => d.getIsVisible()).map((d) => d.id).join("_")], (columns) => {
|
|
25471
|
+
return memo$1(() => [getColumns(), getColumns().filter((d) => d.getIsVisible()).map((d) => d.id).join("_")], (columns) => {
|
|
25472
25472
|
return columns.filter((d) => d.getIsVisible == null ? void 0 : d.getIsVisible());
|
|
25473
25473
|
}, getMemoOptions(table.options, "debugColumns", key));
|
|
25474
25474
|
};
|
|
@@ -25813,7 +25813,7 @@ const RowPagination = {
|
|
|
25813
25813
|
pageCount: newPageCount
|
|
25814
25814
|
};
|
|
25815
25815
|
});
|
|
25816
|
-
table.getPageOptions = memo(() => [table.getPageCount()], (pageCount) => {
|
|
25816
|
+
table.getPageOptions = memo$1(() => [table.getPageCount()], (pageCount) => {
|
|
25817
25817
|
let pageOptions = [];
|
|
25818
25818
|
if (pageCount && pageCount > 0) {
|
|
25819
25819
|
pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i);
|
|
@@ -25988,9 +25988,9 @@ const RowPinning = {
|
|
|
25988
25988
|
position
|
|
25989
25989
|
}));
|
|
25990
25990
|
};
|
|
25991
|
-
table.getTopRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.top], (allRows, topPinnedRowIds) => table._getPinnedRows(allRows, topPinnedRowIds, "top"), getMemoOptions(table.options, "debugRows", "getTopRows"));
|
|
25992
|
-
table.getBottomRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.bottom], (allRows, bottomPinnedRowIds) => table._getPinnedRows(allRows, bottomPinnedRowIds, "bottom"), getMemoOptions(table.options, "debugRows", "getBottomRows"));
|
|
25993
|
-
table.getCenterRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.top, table.getState().rowPinning.bottom], (allRows, top, bottom) => {
|
|
25991
|
+
table.getTopRows = memo$1(() => [table.getRowModel().rows, table.getState().rowPinning.top], (allRows, topPinnedRowIds) => table._getPinnedRows(allRows, topPinnedRowIds, "top"), getMemoOptions(table.options, "debugRows", "getTopRows"));
|
|
25992
|
+
table.getBottomRows = memo$1(() => [table.getRowModel().rows, table.getState().rowPinning.bottom], (allRows, bottomPinnedRowIds) => table._getPinnedRows(allRows, bottomPinnedRowIds, "bottom"), getMemoOptions(table.options, "debugRows", "getBottomRows"));
|
|
25993
|
+
table.getCenterRows = memo$1(() => [table.getRowModel().rows, table.getState().rowPinning.top, table.getState().rowPinning.bottom], (allRows, top, bottom) => {
|
|
25994
25994
|
const topAndBottom = /* @__PURE__ */ new Set([...top != null ? top : [], ...bottom != null ? bottom : []]);
|
|
25995
25995
|
return allRows.filter((d) => !topAndBottom.has(d.id));
|
|
25996
25996
|
}, getMemoOptions(table.options, "debugRows", "getCenterRows"));
|
|
@@ -26053,7 +26053,7 @@ const RowSelection = {
|
|
|
26053
26053
|
return rowSelection;
|
|
26054
26054
|
});
|
|
26055
26055
|
table.getPreSelectedRowModel = () => table.getCoreRowModel();
|
|
26056
|
-
table.getSelectedRowModel = memo(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => {
|
|
26056
|
+
table.getSelectedRowModel = memo$1(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => {
|
|
26057
26057
|
if (!Object.keys(rowSelection).length) {
|
|
26058
26058
|
return {
|
|
26059
26059
|
rows: [],
|
|
@@ -26063,7 +26063,7 @@ const RowSelection = {
|
|
|
26063
26063
|
}
|
|
26064
26064
|
return selectRowsFn(table, rowModel);
|
|
26065
26065
|
}, getMemoOptions(table.options, "debugTable", "getSelectedRowModel"));
|
|
26066
|
-
table.getFilteredSelectedRowModel = memo(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => {
|
|
26066
|
+
table.getFilteredSelectedRowModel = memo$1(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => {
|
|
26067
26067
|
if (!Object.keys(rowSelection).length) {
|
|
26068
26068
|
return {
|
|
26069
26069
|
rows: [],
|
|
@@ -26073,7 +26073,7 @@ const RowSelection = {
|
|
|
26073
26073
|
}
|
|
26074
26074
|
return selectRowsFn(table, rowModel);
|
|
26075
26075
|
}, getMemoOptions(table.options, "debugTable", "getFilteredSelectedRowModel"));
|
|
26076
|
-
table.getGroupedSelectedRowModel = memo(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => {
|
|
26076
|
+
table.getGroupedSelectedRowModel = memo$1(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => {
|
|
26077
26077
|
if (!Object.keys(rowSelection).length) {
|
|
26078
26078
|
return {
|
|
26079
26079
|
rows: [],
|
|
@@ -26642,7 +26642,7 @@ function createTable(options) {
|
|
|
26642
26642
|
}
|
|
26643
26643
|
return row;
|
|
26644
26644
|
},
|
|
26645
|
-
_getDefaultColumnDef: memo(() => [table.options.defaultColumn], (defaultColumn) => {
|
|
26645
|
+
_getDefaultColumnDef: memo$1(() => [table.options.defaultColumn], (defaultColumn) => {
|
|
26646
26646
|
var _defaultColumn;
|
|
26647
26647
|
defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
|
|
26648
26648
|
return {
|
|
@@ -26668,7 +26668,7 @@ function createTable(options) {
|
|
|
26668
26668
|
};
|
|
26669
26669
|
}, getMemoOptions(options, "debugColumns", "_getDefaultColumnDef")),
|
|
26670
26670
|
_getColumnDefs: () => table.options.columns,
|
|
26671
|
-
getAllColumns: memo(() => [table._getColumnDefs()], (columnDefs) => {
|
|
26671
|
+
getAllColumns: memo$1(() => [table._getColumnDefs()], (columnDefs) => {
|
|
26672
26672
|
const recurseColumns = function(columnDefs2, parent, depth) {
|
|
26673
26673
|
if (depth === void 0) {
|
|
26674
26674
|
depth = 0;
|
|
@@ -26682,18 +26682,18 @@ function createTable(options) {
|
|
|
26682
26682
|
};
|
|
26683
26683
|
return recurseColumns(columnDefs);
|
|
26684
26684
|
}, getMemoOptions(options, "debugColumns", "getAllColumns")),
|
|
26685
|
-
getAllFlatColumns: memo(() => [table.getAllColumns()], (allColumns) => {
|
|
26685
|
+
getAllFlatColumns: memo$1(() => [table.getAllColumns()], (allColumns) => {
|
|
26686
26686
|
return allColumns.flatMap((column) => {
|
|
26687
26687
|
return column.getFlatColumns();
|
|
26688
26688
|
});
|
|
26689
26689
|
}, getMemoOptions(options, "debugColumns", "getAllFlatColumns")),
|
|
26690
|
-
_getAllFlatColumnsById: memo(() => [table.getAllFlatColumns()], (flatColumns) => {
|
|
26690
|
+
_getAllFlatColumnsById: memo$1(() => [table.getAllFlatColumns()], (flatColumns) => {
|
|
26691
26691
|
return flatColumns.reduce((acc, column) => {
|
|
26692
26692
|
acc[column.id] = column;
|
|
26693
26693
|
return acc;
|
|
26694
26694
|
}, {});
|
|
26695
26695
|
}, getMemoOptions(options, "debugColumns", "getAllFlatColumnsById")),
|
|
26696
|
-
getAllLeafColumns: memo(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns2) => {
|
|
26696
|
+
getAllLeafColumns: memo$1(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns2) => {
|
|
26697
26697
|
let leafColumns = allColumns.flatMap((column) => column.getLeafColumns());
|
|
26698
26698
|
return orderColumns2(leafColumns);
|
|
26699
26699
|
}, getMemoOptions(options, "debugColumns", "getAllLeafColumns")),
|
|
@@ -26713,7 +26713,7 @@ function createTable(options) {
|
|
|
26713
26713
|
return table;
|
|
26714
26714
|
}
|
|
26715
26715
|
function getCoreRowModel() {
|
|
26716
|
-
return (table) => memo(() => [table.options.data], (data) => {
|
|
26716
|
+
return (table) => memo$1(() => [table.options.data], (data) => {
|
|
26717
26717
|
const rowModel = {
|
|
26718
26718
|
rows: [],
|
|
26719
26719
|
flatRows: [],
|
|
@@ -26846,7 +26846,7 @@ function filterRowModelFromRoot(rowsToFilter, filterRow, table) {
|
|
|
26846
26846
|
};
|
|
26847
26847
|
}
|
|
26848
26848
|
function getFacetedRowModel() {
|
|
26849
|
-
return (table, columnId) => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter, table.getFilteredRowModel()], (preRowModel, columnFilters, globalFilter) => {
|
|
26849
|
+
return (table, columnId) => memo$1(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter, table.getFilteredRowModel()], (preRowModel, columnFilters, globalFilter) => {
|
|
26850
26850
|
if (!preRowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
|
|
26851
26851
|
return preRowModel;
|
|
26852
26852
|
}
|
|
@@ -26863,7 +26863,7 @@ function getFacetedRowModel() {
|
|
|
26863
26863
|
}, getMemoOptions(table.options, "debugTable", "getFacetedRowModel"));
|
|
26864
26864
|
}
|
|
26865
26865
|
function getFacetedUniqueValues() {
|
|
26866
|
-
return (table, columnId) => memo(() => {
|
|
26866
|
+
return (table, columnId) => memo$1(() => {
|
|
26867
26867
|
var _table$getColumn;
|
|
26868
26868
|
return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()];
|
|
26869
26869
|
}, (facetedRowModel) => {
|
|
@@ -26885,7 +26885,7 @@ function getFacetedUniqueValues() {
|
|
|
26885
26885
|
}, getMemoOptions(table.options, "debugTable", `getFacetedUniqueValues_${columnId}`));
|
|
26886
26886
|
}
|
|
26887
26887
|
function getFilteredRowModel() {
|
|
26888
|
-
return (table) => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter], (rowModel, columnFilters, globalFilter) => {
|
|
26888
|
+
return (table) => memo$1(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter], (rowModel, columnFilters, globalFilter) => {
|
|
26889
26889
|
if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
|
|
26890
26890
|
for (let i = 0; i < rowModel.flatRows.length; i++) {
|
|
26891
26891
|
rowModel.flatRows[i].columnFilters = {};
|
|
@@ -26970,7 +26970,7 @@ function getFilteredRowModel() {
|
|
|
26970
26970
|
}, getMemoOptions(table.options, "debugTable", "getFilteredRowModel", () => table._autoResetPageIndex()));
|
|
26971
26971
|
}
|
|
26972
26972
|
function getPaginationRowModel(opts) {
|
|
26973
|
-
return (table) => memo(() => [table.getState().pagination, table.getPrePaginationRowModel(), table.options.paginateExpandedRows ? void 0 : table.getState().expanded], (pagination, rowModel) => {
|
|
26973
|
+
return (table) => memo$1(() => [table.getState().pagination, table.getPrePaginationRowModel(), table.options.paginateExpandedRows ? void 0 : table.getState().expanded], (pagination, rowModel) => {
|
|
26974
26974
|
if (!rowModel.rows.length) {
|
|
26975
26975
|
return rowModel;
|
|
26976
26976
|
}
|
|
@@ -27012,7 +27012,7 @@ function getPaginationRowModel(opts) {
|
|
|
27012
27012
|
}, getMemoOptions(table.options, "debugTable", "getPaginationRowModel"));
|
|
27013
27013
|
}
|
|
27014
27014
|
function getSortedRowModel() {
|
|
27015
|
-
return (table) => memo(() => [table.getState().sorting, table.getPreSortedRowModel()], (sorting, rowModel) => {
|
|
27015
|
+
return (table) => memo$1(() => [table.getState().sorting, table.getPreSortedRowModel()], (sorting, rowModel) => {
|
|
27016
27016
|
if (!rowModel.rows.length || !(sorting != null && sorting.length)) {
|
|
27017
27017
|
return rowModel;
|
|
27018
27018
|
}
|
|
@@ -29051,6 +29051,25 @@ function DataTableToolbar({
|
|
|
29051
29051
|
opts.belowControls ?? null
|
|
29052
29052
|
] });
|
|
29053
29053
|
}
|
|
29054
|
+
function createColumnRegistry(descriptors) {
|
|
29055
|
+
return descriptors.reduce((acc, item) => {
|
|
29056
|
+
const key = item.defaults.id ?? item.columnDef.id;
|
|
29057
|
+
if (!key) {
|
|
29058
|
+
throw new Error("Column descriptors must define an id.");
|
|
29059
|
+
}
|
|
29060
|
+
acc[key] = {
|
|
29061
|
+
columnDef: {
|
|
29062
|
+
...item.columnDef,
|
|
29063
|
+
id: item.columnDef.id ?? key
|
|
29064
|
+
},
|
|
29065
|
+
defaults: {
|
|
29066
|
+
...item.defaults,
|
|
29067
|
+
id: key
|
|
29068
|
+
}
|
|
29069
|
+
};
|
|
29070
|
+
return acc;
|
|
29071
|
+
}, {});
|
|
29072
|
+
}
|
|
29054
29073
|
function resolveColumnOrder(registry, preferredOrder = []) {
|
|
29055
29074
|
if (preferredOrder.length) return preferredOrder;
|
|
29056
29075
|
return Object.values(registry).sort((a, b) => (a.defaults.order ?? 0) - (b.defaults.order ?? 0)).map((col) => col.defaults.id || col.columnDef.id || "").filter((id) => Boolean(id));
|
|
@@ -29132,6 +29151,22 @@ function useDataTableState(config = {}) {
|
|
|
29132
29151
|
rowSelection: [rowSelection, setRowSelection]
|
|
29133
29152
|
};
|
|
29134
29153
|
}
|
|
29154
|
+
const QUERY = "(max-width: 768px)";
|
|
29155
|
+
function useBreakpoint(query = QUERY) {
|
|
29156
|
+
const getMatches = React.useCallback(() => {
|
|
29157
|
+
if (typeof window === "undefined") return false;
|
|
29158
|
+
return window.matchMedia(query).matches;
|
|
29159
|
+
}, [query]);
|
|
29160
|
+
const [matches, setMatches] = React.useState(getMatches);
|
|
29161
|
+
React.useEffect(() => {
|
|
29162
|
+
const mediaQueryList = window.matchMedia(query);
|
|
29163
|
+
const listener = (event) => setMatches(event.matches);
|
|
29164
|
+
mediaQueryList.addEventListener("change", listener);
|
|
29165
|
+
setMatches(mediaQueryList.matches);
|
|
29166
|
+
return () => mediaQueryList.removeEventListener("change", listener);
|
|
29167
|
+
}, [query]);
|
|
29168
|
+
return matches;
|
|
29169
|
+
}
|
|
29135
29170
|
function useTableController(options) {
|
|
29136
29171
|
const { columns, data, columnRegistry, initialState: initialState2, tableId } = options;
|
|
29137
29172
|
const storageKey = tableId ? `mmrc:table:${tableId}` : void 0;
|
|
@@ -29321,6 +29356,10 @@ function exportTableToCSV(table, filename = "data.csv") {
|
|
|
29321
29356
|
URL.revokeObjectURL(url);
|
|
29322
29357
|
}
|
|
29323
29358
|
const TABLE_TOKENS = {
|
|
29359
|
+
defaultColumnWidth: 160,
|
|
29360
|
+
minColumnWidth: 96,
|
|
29361
|
+
maxColumnWidth: 420,
|
|
29362
|
+
toolbarGap: 8,
|
|
29324
29363
|
selectionColumnWidth: 44,
|
|
29325
29364
|
actionsColumnWidth: 64
|
|
29326
29365
|
};
|
|
@@ -29891,6 +29930,1494 @@ function DataTable({
|
|
|
29891
29930
|
isForcedEmpty ? null : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "border-t border-border bg-[var(--tablehead-bg)]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DataTablePagination, { table }) })
|
|
29892
29931
|
] });
|
|
29893
29932
|
}
|
|
29933
|
+
const ALIGNMENT_PRESETS = {
|
|
29934
|
+
NAME: "left",
|
|
29935
|
+
DESCRIPTION: "left",
|
|
29936
|
+
CATEGORY: "left",
|
|
29937
|
+
STATUS: "left",
|
|
29938
|
+
QUANTITY: "right",
|
|
29939
|
+
AMOUNT: "right",
|
|
29940
|
+
COUNT: "right",
|
|
29941
|
+
TOTAL: "right",
|
|
29942
|
+
PERCENTAGE: "right",
|
|
29943
|
+
RATE: "right",
|
|
29944
|
+
PROGRESS: "right",
|
|
29945
|
+
DATE: "left",
|
|
29946
|
+
ID: "left",
|
|
29947
|
+
REFERENCE: "left",
|
|
29948
|
+
ICON: "center",
|
|
29949
|
+
CHECKBOX: "center",
|
|
29950
|
+
BUTTON: "center"
|
|
29951
|
+
};
|
|
29952
|
+
const presetMatchers = [
|
|
29953
|
+
{ match: (key) => key === "CURRENT_OPERATION", align: "left" },
|
|
29954
|
+
{
|
|
29955
|
+
match: (key) => key === "PART_OPERATION" || key === "PARTOPERATION",
|
|
29956
|
+
align: "left"
|
|
29957
|
+
},
|
|
29958
|
+
{
|
|
29959
|
+
match: (key) => key === "ORDER_OPERATION" || key === "ORDEROPERATION",
|
|
29960
|
+
align: "left"
|
|
29961
|
+
},
|
|
29962
|
+
{
|
|
29963
|
+
match: (key) => key === "OPERATION_TYPE" || key === "OPERATIONTYPE",
|
|
29964
|
+
align: "left"
|
|
29965
|
+
},
|
|
29966
|
+
{
|
|
29967
|
+
match: (key) => key.includes("PARTS") && !key.includes("REF") || key === "GOODPARTS" || key === "BADPARTS",
|
|
29968
|
+
align: "right"
|
|
29969
|
+
},
|
|
29970
|
+
{
|
|
29971
|
+
match: (key) => key.includes("REJECTS") && !key.includes("REF"),
|
|
29972
|
+
align: "right"
|
|
29973
|
+
},
|
|
29974
|
+
{
|
|
29975
|
+
match: (key) => key.includes("QUANTITY") && !key.includes("REF"),
|
|
29976
|
+
align: "right"
|
|
29977
|
+
},
|
|
29978
|
+
{
|
|
29979
|
+
match: (key) => (key.includes("COUNT") || key.includes("TOTAL") || key.includes("ACTIVE") && key.includes("ORDERS")) && !key.includes("REF"),
|
|
29980
|
+
align: "right"
|
|
29981
|
+
},
|
|
29982
|
+
{
|
|
29983
|
+
match: (key) => key.includes("RATE") && !key.includes("REF"),
|
|
29984
|
+
align: "right"
|
|
29985
|
+
},
|
|
29986
|
+
{
|
|
29987
|
+
match: (key) => key.includes("PERCENTAGE") && !key.includes("REF"),
|
|
29988
|
+
align: "right"
|
|
29989
|
+
},
|
|
29990
|
+
{
|
|
29991
|
+
match: (key) => key.includes("RATIO") || key === "SETUP_PRODUCTION_RATIO",
|
|
29992
|
+
align: "right"
|
|
29993
|
+
},
|
|
29994
|
+
{
|
|
29995
|
+
match: (key) => key.includes("OPERATIONS") && key.includes("TOTAL"),
|
|
29996
|
+
align: "right"
|
|
29997
|
+
},
|
|
29998
|
+
{
|
|
29999
|
+
match: (key) => key.includes("OPERATIONS") && key.includes("COMPLETED"),
|
|
30000
|
+
align: "right"
|
|
30001
|
+
},
|
|
30002
|
+
{
|
|
30003
|
+
match: (key) => key.includes("DURATION") || key === "DURATION",
|
|
30004
|
+
align: "right"
|
|
30005
|
+
},
|
|
30006
|
+
{
|
|
30007
|
+
match: (key) => key.includes("CYCLE") && key.includes("TIME"),
|
|
30008
|
+
align: "right"
|
|
30009
|
+
},
|
|
30010
|
+
{
|
|
30011
|
+
match: (key) => key.includes("SETUP") && key.includes("TIME"),
|
|
30012
|
+
align: "right"
|
|
30013
|
+
},
|
|
30014
|
+
{
|
|
30015
|
+
match: (key) => key.includes("TIME") && !key.includes("DATE") && !key.includes("STAMP"),
|
|
30016
|
+
align: "right"
|
|
30017
|
+
},
|
|
30018
|
+
{
|
|
30019
|
+
match: (key) => key.includes("ORDER") || key.includes("NUMBER"),
|
|
30020
|
+
align: "left"
|
|
30021
|
+
},
|
|
30022
|
+
{
|
|
30023
|
+
match: (key) => key.includes("EMPLOYEE") && key.includes("ID"),
|
|
30024
|
+
align: "left"
|
|
30025
|
+
},
|
|
30026
|
+
{
|
|
30027
|
+
match: (key) => key.includes("RESOURCE") && key.includes("ID"),
|
|
30028
|
+
align: "left"
|
|
30029
|
+
},
|
|
30030
|
+
{
|
|
30031
|
+
match: (key) => key.includes("DATE") || key.includes("TIME"),
|
|
30032
|
+
align: "left"
|
|
30033
|
+
},
|
|
30034
|
+
{
|
|
30035
|
+
match: (key) => key.includes("START") || key.includes("END"),
|
|
30036
|
+
align: "left"
|
|
30037
|
+
},
|
|
30038
|
+
{
|
|
30039
|
+
match: (key) => key.includes("CLOCKIN") || key.includes("CLOCKOUT"),
|
|
30040
|
+
align: "left"
|
|
30041
|
+
},
|
|
30042
|
+
{
|
|
30043
|
+
match: (key) => key.includes("ID") || key.includes("REF") || key.includes("CODE"),
|
|
30044
|
+
align: "left"
|
|
30045
|
+
},
|
|
30046
|
+
{
|
|
30047
|
+
match: (key) => key.includes("NAME") || key.includes("DESCRIPTION"),
|
|
30048
|
+
align: "left"
|
|
30049
|
+
},
|
|
30050
|
+
{
|
|
30051
|
+
match: (key) => key.includes("CATEGORY") || key === "CATEGORY",
|
|
30052
|
+
align: "left"
|
|
30053
|
+
},
|
|
30054
|
+
{
|
|
30055
|
+
match: (key) => key.includes("OPERATION"),
|
|
30056
|
+
align: "left"
|
|
30057
|
+
},
|
|
30058
|
+
{
|
|
30059
|
+
match: (key) => key.includes("ORDEROP"),
|
|
30060
|
+
align: "left"
|
|
30061
|
+
},
|
|
30062
|
+
{
|
|
30063
|
+
match: (key) => key.includes("PARTOPERATION"),
|
|
30064
|
+
align: "left"
|
|
30065
|
+
},
|
|
30066
|
+
{
|
|
30067
|
+
match: (key) => key.includes("WORKORDEROPERATIONREF"),
|
|
30068
|
+
align: "left"
|
|
30069
|
+
},
|
|
30070
|
+
{
|
|
30071
|
+
match: (key) => key.includes("OPERATIONTYPE"),
|
|
30072
|
+
align: "left"
|
|
30073
|
+
},
|
|
30074
|
+
{
|
|
30075
|
+
match: (key) => key.includes("LOT") || key === "LOT",
|
|
30076
|
+
align: "left"
|
|
30077
|
+
},
|
|
30078
|
+
{
|
|
30079
|
+
match: (key) => key.includes("SPLIT") || key === "SPLIT",
|
|
30080
|
+
align: "left"
|
|
30081
|
+
},
|
|
30082
|
+
{
|
|
30083
|
+
match: (key) => key.includes("SUB") || key === "SUB",
|
|
30084
|
+
align: "left"
|
|
30085
|
+
},
|
|
30086
|
+
{
|
|
30087
|
+
match: (key) => key.includes("SEQ") || key === "SEQUENCENUMBER" || key === "SEQUENCE",
|
|
30088
|
+
align: "left"
|
|
30089
|
+
},
|
|
30090
|
+
{
|
|
30091
|
+
match: (key) => key.includes("ACTIVITY") || key.includes("STATUS"),
|
|
30092
|
+
align: "left"
|
|
30093
|
+
},
|
|
30094
|
+
{
|
|
30095
|
+
match: (key) => key.includes("STATE") || key.includes("TYPE"),
|
|
30096
|
+
align: "left"
|
|
30097
|
+
}
|
|
30098
|
+
];
|
|
30099
|
+
function getPresetAlignment(columnKey) {
|
|
30100
|
+
if (!columnKey) return null;
|
|
30101
|
+
const key = columnKey.toUpperCase();
|
|
30102
|
+
if (ALIGNMENT_PRESETS[key]) {
|
|
30103
|
+
return ALIGNMENT_PRESETS[key];
|
|
30104
|
+
}
|
|
30105
|
+
const matcher = presetMatchers.find((preset) => preset.match(key));
|
|
30106
|
+
return matcher ? matcher.align : null;
|
|
30107
|
+
}
|
|
30108
|
+
function applyFilterConfig(columnDef, filter) {
|
|
30109
|
+
if (!filter) return;
|
|
30110
|
+
if (columnDef.enableColumnFilter !== false) {
|
|
30111
|
+
columnDef.enableColumnFilter = true;
|
|
30112
|
+
}
|
|
30113
|
+
if (columnDef.filterFn) return;
|
|
30114
|
+
const asFilterFn = (fn) => {
|
|
30115
|
+
columnDef.filterFn = fn;
|
|
30116
|
+
};
|
|
30117
|
+
switch (filter.type) {
|
|
30118
|
+
case "select":
|
|
30119
|
+
asFilterFn((row, columnId, filterValue) => {
|
|
30120
|
+
if (filterValue == null || filterValue === "") return true;
|
|
30121
|
+
const cellValue = row.getValue(columnId);
|
|
30122
|
+
if (cellValue == null) return false;
|
|
30123
|
+
const values = Array.isArray(filterValue) ? filterValue.map(String) : [String(filterValue)];
|
|
30124
|
+
if (values.length === 0) return true;
|
|
30125
|
+
return values.includes(String(cellValue));
|
|
30126
|
+
});
|
|
30127
|
+
break;
|
|
30128
|
+
case "multi-select":
|
|
30129
|
+
asFilterFn((row, columnId, filterValue) => {
|
|
30130
|
+
if (!Array.isArray(filterValue) || filterValue.length === 0)
|
|
30131
|
+
return true;
|
|
30132
|
+
const cellValue = row.getValue(columnId);
|
|
30133
|
+
if (cellValue == null) return false;
|
|
30134
|
+
const values = Array.isArray(cellValue) ? cellValue.map(String) : [String(cellValue)];
|
|
30135
|
+
const targets = filterValue.map(String);
|
|
30136
|
+
return values.some((value) => targets.includes(value));
|
|
30137
|
+
});
|
|
30138
|
+
break;
|
|
30139
|
+
case "numeric-range":
|
|
30140
|
+
asFilterFn((row, columnId, filterValue) => {
|
|
30141
|
+
if (!Array.isArray(filterValue) || filterValue.length === 0)
|
|
30142
|
+
return true;
|
|
30143
|
+
const [min2, max2] = filterValue;
|
|
30144
|
+
if (min2 == null && max2 == null) return true;
|
|
30145
|
+
const rawValue = row.getValue(columnId);
|
|
30146
|
+
if (rawValue == null) return false;
|
|
30147
|
+
const numeric = typeof rawValue === "number" ? rawValue : Number(rawValue);
|
|
30148
|
+
if (Number.isNaN(numeric)) return false;
|
|
30149
|
+
if (min2 != null && numeric < min2) return false;
|
|
30150
|
+
if (max2 != null && numeric > max2) return false;
|
|
30151
|
+
return true;
|
|
30152
|
+
});
|
|
30153
|
+
break;
|
|
30154
|
+
case "date-range":
|
|
30155
|
+
asFilterFn((row, columnId, filterValue) => {
|
|
30156
|
+
if (!Array.isArray(filterValue) || filterValue.length === 0)
|
|
30157
|
+
return true;
|
|
30158
|
+
const [start, end] = filterValue;
|
|
30159
|
+
if (!start && !end) return true;
|
|
30160
|
+
const rawValue = row.getValue(columnId);
|
|
30161
|
+
if (!rawValue) return false;
|
|
30162
|
+
const valueDate = rawValue instanceof Date ? rawValue : new Date(rawValue);
|
|
30163
|
+
if (Number.isNaN(valueDate.getTime())) return false;
|
|
30164
|
+
if (start) {
|
|
30165
|
+
const startDate = new Date(start);
|
|
30166
|
+
if (!Number.isNaN(startDate.getTime()) && valueDate < startDate)
|
|
30167
|
+
return false;
|
|
30168
|
+
}
|
|
30169
|
+
if (end) {
|
|
30170
|
+
const endDate = new Date(end);
|
|
30171
|
+
if (!Number.isNaN(endDate.getTime()) && valueDate > endDate)
|
|
30172
|
+
return false;
|
|
30173
|
+
}
|
|
30174
|
+
return true;
|
|
30175
|
+
});
|
|
30176
|
+
break;
|
|
30177
|
+
case "text":
|
|
30178
|
+
asFilterFn((row, columnId, filterValue) => {
|
|
30179
|
+
if (filterValue == null) return true;
|
|
30180
|
+
const cellValue = row.getValue(columnId);
|
|
30181
|
+
if (cellValue == null) return false;
|
|
30182
|
+
if (Array.isArray(filterValue)) {
|
|
30183
|
+
const targets = filterValue.map((v) => String(v).toLowerCase());
|
|
30184
|
+
if (targets.length === 0) return true;
|
|
30185
|
+
if (Array.isArray(cellValue)) {
|
|
30186
|
+
return cellValue.map((v) => String(v).toLowerCase()).some((v) => targets.includes(v));
|
|
30187
|
+
}
|
|
30188
|
+
return targets.includes(String(cellValue).toLowerCase());
|
|
30189
|
+
}
|
|
30190
|
+
const query = String(filterValue).toLowerCase();
|
|
30191
|
+
if (Array.isArray(cellValue)) {
|
|
30192
|
+
return cellValue.map(String).some((v) => v.toLowerCase().includes(query));
|
|
30193
|
+
}
|
|
30194
|
+
return String(cellValue).toLowerCase().includes(query);
|
|
30195
|
+
});
|
|
30196
|
+
break;
|
|
30197
|
+
}
|
|
30198
|
+
}
|
|
30199
|
+
function createColumnDescriptor(options) {
|
|
30200
|
+
const { id, column, ...defaults } = options;
|
|
30201
|
+
const meta = { ...column.meta };
|
|
30202
|
+
if (defaults.align && meta.align === void 0) {
|
|
30203
|
+
meta.align = defaults.align;
|
|
30204
|
+
}
|
|
30205
|
+
if (defaults.helpText && meta.helpText === void 0) {
|
|
30206
|
+
meta.helpText = defaults.helpText;
|
|
30207
|
+
}
|
|
30208
|
+
const columnDef = {
|
|
30209
|
+
...column,
|
|
30210
|
+
id: column.id ?? id,
|
|
30211
|
+
meta
|
|
30212
|
+
};
|
|
30213
|
+
if (defaults.width != null && columnDef.size == null) {
|
|
30214
|
+
columnDef.size = defaults.width;
|
|
30215
|
+
}
|
|
30216
|
+
if (defaults.minWidth != null && columnDef.minSize == null) {
|
|
30217
|
+
columnDef.minSize = defaults.minWidth;
|
|
30218
|
+
}
|
|
30219
|
+
if (defaults.maxWidth != null && columnDef.maxSize == null) {
|
|
30220
|
+
columnDef.maxSize = defaults.maxWidth;
|
|
30221
|
+
}
|
|
30222
|
+
if (defaults.hideable === false && columnDef.enableHiding == null) {
|
|
30223
|
+
columnDef.enableHiding = false;
|
|
30224
|
+
}
|
|
30225
|
+
applyFilterConfig(columnDef, defaults.filter);
|
|
30226
|
+
return {
|
|
30227
|
+
columnDef,
|
|
30228
|
+
defaults: {
|
|
30229
|
+
id,
|
|
30230
|
+
visible: true,
|
|
30231
|
+
hideable: true,
|
|
30232
|
+
...defaults
|
|
30233
|
+
}
|
|
30234
|
+
};
|
|
30235
|
+
}
|
|
30236
|
+
function createTextColumn(options) {
|
|
30237
|
+
const columnDef = options.column ?? {
|
|
30238
|
+
accessorKey: options.accessorKey ?? options.id,
|
|
30239
|
+
header: options.header,
|
|
30240
|
+
cell: options.cell
|
|
30241
|
+
};
|
|
30242
|
+
const align = options.defaults?.align ?? getPresetAlignment(options.id) ?? "left";
|
|
30243
|
+
return createColumnDescriptor({
|
|
30244
|
+
id: options.id,
|
|
30245
|
+
column: columnDef,
|
|
30246
|
+
width: options.defaults?.width ?? TABLE_TOKENS.defaultColumnWidth,
|
|
30247
|
+
// Text columns get a larger minimum than numeric columns for readability
|
|
30248
|
+
minWidth: options.defaults?.minWidth ?? TABLE_TOKENS.defaultColumnWidth,
|
|
30249
|
+
maxWidth: options.defaults?.maxWidth,
|
|
30250
|
+
align,
|
|
30251
|
+
...options.defaults
|
|
30252
|
+
});
|
|
30253
|
+
}
|
|
30254
|
+
function createNumericColumn(options) {
|
|
30255
|
+
const { format: format2 = "decimal", decimals = 1, formatter } = options;
|
|
30256
|
+
const formatterFn = formatter ?? ((value) => {
|
|
30257
|
+
if (value == null) return "";
|
|
30258
|
+
switch (format2) {
|
|
30259
|
+
case "integer":
|
|
30260
|
+
return Math.round(value).toLocaleString();
|
|
30261
|
+
case "percent":
|
|
30262
|
+
return `${value.toFixed(decimals)}%`;
|
|
30263
|
+
case "decimal":
|
|
30264
|
+
default:
|
|
30265
|
+
return value.toFixed(decimals);
|
|
30266
|
+
}
|
|
30267
|
+
});
|
|
30268
|
+
return createColumnDescriptor({
|
|
30269
|
+
id: options.id,
|
|
30270
|
+
column: {
|
|
30271
|
+
accessorKey: options.accessorKey ?? options.id,
|
|
30272
|
+
header: options.header,
|
|
30273
|
+
cell: ({ row }) => {
|
|
30274
|
+
const value = row.getValue(options.id);
|
|
30275
|
+
return formatterFn(value);
|
|
30276
|
+
},
|
|
30277
|
+
enableResizing: true,
|
|
30278
|
+
enablePinning: true
|
|
30279
|
+
},
|
|
30280
|
+
// Numeric columns default to a narrower width; minWidth already 96
|
|
30281
|
+
width: options.width ?? TABLE_TOKENS.minColumnWidth,
|
|
30282
|
+
minWidth: options.minWidth ?? TABLE_TOKENS.minColumnWidth,
|
|
30283
|
+
maxWidth: options.maxWidth,
|
|
30284
|
+
align: options.align ?? "right",
|
|
30285
|
+
order: options.order,
|
|
30286
|
+
visible: options.visible,
|
|
30287
|
+
hideable: options.hideable,
|
|
30288
|
+
mobileRole: options.mobileRole,
|
|
30289
|
+
sortKey: options.sortKey,
|
|
30290
|
+
filterKey: options.filterKey,
|
|
30291
|
+
filter: options.filter
|
|
30292
|
+
});
|
|
30293
|
+
}
|
|
30294
|
+
function createBadgeColumn(options) {
|
|
30295
|
+
return createColumnDescriptor({
|
|
30296
|
+
id: options.id,
|
|
30297
|
+
column: {
|
|
30298
|
+
accessorKey: options.accessorKey ?? options.id,
|
|
30299
|
+
header: options.header,
|
|
30300
|
+
cell: ({ row }) => {
|
|
30301
|
+
const value = row.getValue(options.id);
|
|
30302
|
+
if (!value) return null;
|
|
30303
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: options.variantMap?.[value], className: "capitalize", children: options.labelMap[value] ?? value });
|
|
30304
|
+
},
|
|
30305
|
+
enableResizing: true,
|
|
30306
|
+
enablePinning: true
|
|
30307
|
+
},
|
|
30308
|
+
width: options.width ?? 160,
|
|
30309
|
+
minWidth: options.minWidth ?? 140,
|
|
30310
|
+
maxWidth: options.maxWidth,
|
|
30311
|
+
align: options.align ?? "left",
|
|
30312
|
+
order: options.order,
|
|
30313
|
+
visible: options.visible,
|
|
30314
|
+
hideable: options.hideable,
|
|
30315
|
+
mobileRole: options.mobileRole,
|
|
30316
|
+
sortKey: options.sortKey,
|
|
30317
|
+
filterKey: options.filterKey,
|
|
30318
|
+
filter: options.filter
|
|
30319
|
+
});
|
|
30320
|
+
}
|
|
30321
|
+
function createSelectionColumn(options = {}) {
|
|
30322
|
+
const {
|
|
30323
|
+
id = "select",
|
|
30324
|
+
size: size2 = TABLE_TOKENS.selectionColumnWidth,
|
|
30325
|
+
minSize = TABLE_TOKENS.selectionColumnWidth,
|
|
30326
|
+
maxSize = TABLE_TOKENS.selectionColumnWidth,
|
|
30327
|
+
order = 0
|
|
30328
|
+
} = options;
|
|
30329
|
+
return createColumnDescriptor({
|
|
30330
|
+
id,
|
|
30331
|
+
column: {
|
|
30332
|
+
id,
|
|
30333
|
+
header: ({ table }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
30334
|
+
Checkbox,
|
|
30335
|
+
{
|
|
30336
|
+
checked: table.getIsAllPageRowsSelected(),
|
|
30337
|
+
onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value),
|
|
30338
|
+
"aria-label": "Select all rows",
|
|
30339
|
+
className: "translate-y-[2px]"
|
|
30340
|
+
}
|
|
30341
|
+
),
|
|
30342
|
+
cell: ({ row }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
30343
|
+
Checkbox,
|
|
30344
|
+
{
|
|
30345
|
+
checked: row.getIsSelected(),
|
|
30346
|
+
onCheckedChange: (value) => row.toggleSelected(!!value),
|
|
30347
|
+
"aria-label": "Select row",
|
|
30348
|
+
className: "translate-y-[2px]"
|
|
30349
|
+
}
|
|
30350
|
+
),
|
|
30351
|
+
enableSorting: false,
|
|
30352
|
+
enableHiding: false,
|
|
30353
|
+
enableResizing: false,
|
|
30354
|
+
enablePinning: false
|
|
30355
|
+
},
|
|
30356
|
+
order,
|
|
30357
|
+
align: "center",
|
|
30358
|
+
width: size2,
|
|
30359
|
+
minWidth: minSize,
|
|
30360
|
+
maxWidth: maxSize,
|
|
30361
|
+
hideable: false
|
|
30362
|
+
});
|
|
30363
|
+
}
|
|
30364
|
+
function createMultiBadgeColumn(options) {
|
|
30365
|
+
return createColumnDescriptor({
|
|
30366
|
+
id: options.id,
|
|
30367
|
+
column: {
|
|
30368
|
+
accessorKey: options.accessorKey ?? options.id,
|
|
30369
|
+
header: options.header,
|
|
30370
|
+
enableSorting: false,
|
|
30371
|
+
cell: ({ row }) => {
|
|
30372
|
+
const values = row.getValue(options.id);
|
|
30373
|
+
if (!values || values.length === 0) return null;
|
|
30374
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "inline-flex items-center gap-1 whitespace-nowrap", children: values.map((value, idx) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
30375
|
+
Badge,
|
|
30376
|
+
{
|
|
30377
|
+
variant: options.variantMap?.[value],
|
|
30378
|
+
children: options.labelMap?.[value] ?? String(value)
|
|
30379
|
+
},
|
|
30380
|
+
`${String(value)}-${idx}`
|
|
30381
|
+
)) });
|
|
30382
|
+
},
|
|
30383
|
+
enableResizing: true,
|
|
30384
|
+
enablePinning: true
|
|
30385
|
+
},
|
|
30386
|
+
width: options.width ?? 240,
|
|
30387
|
+
minWidth: options.minWidth ?? 200,
|
|
30388
|
+
maxWidth: options.maxWidth,
|
|
30389
|
+
align: options.align ?? "left",
|
|
30390
|
+
order: options.order,
|
|
30391
|
+
visible: options.visible,
|
|
30392
|
+
hideable: options.hideable,
|
|
30393
|
+
mobileRole: options.mobileRole,
|
|
30394
|
+
sortKey: options.sortKey,
|
|
30395
|
+
filterKey: options.filterKey,
|
|
30396
|
+
filter: options.filter
|
|
30397
|
+
});
|
|
30398
|
+
}
|
|
30399
|
+
function createDateColumn(options) {
|
|
30400
|
+
const formatter = options.formatter ?? new Intl.DateTimeFormat("en-US", {
|
|
30401
|
+
year: "numeric",
|
|
30402
|
+
month: "short",
|
|
30403
|
+
day: "numeric"
|
|
30404
|
+
});
|
|
30405
|
+
return createColumnDescriptor({
|
|
30406
|
+
id: options.id,
|
|
30407
|
+
column: {
|
|
30408
|
+
accessorKey: options.accessorKey ?? options.id,
|
|
30409
|
+
header: options.header,
|
|
30410
|
+
enableSorting: true,
|
|
30411
|
+
cell: ({ row }) => {
|
|
30412
|
+
const raw = row.getValue(options.id);
|
|
30413
|
+
if (!raw) return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-muted-foreground", children: "—" });
|
|
30414
|
+
const date = raw instanceof Date ? raw : new Date(raw);
|
|
30415
|
+
const valid = !Number.isNaN(date.getTime());
|
|
30416
|
+
if (!valid) return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: String(raw) });
|
|
30417
|
+
if (typeof options.format === "function") {
|
|
30418
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: options.format(date) });
|
|
30419
|
+
}
|
|
30420
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: formatter.format(date) });
|
|
30421
|
+
},
|
|
30422
|
+
sortingFn: (rowA, rowB, id) => {
|
|
30423
|
+
const a = rowA.getValue(id);
|
|
30424
|
+
const b = rowB.getValue(id);
|
|
30425
|
+
const da = a instanceof Date ? a : new Date(a);
|
|
30426
|
+
const db = b instanceof Date ? b : new Date(b);
|
|
30427
|
+
return da.getTime() - db.getTime();
|
|
30428
|
+
},
|
|
30429
|
+
enableResizing: true,
|
|
30430
|
+
enablePinning: true
|
|
30431
|
+
},
|
|
30432
|
+
// Global default: fixed 216px for all date/time columns
|
|
30433
|
+
width: options.width ?? 216,
|
|
30434
|
+
minWidth: options.minWidth ?? 216,
|
|
30435
|
+
maxWidth: options.maxWidth ?? 216,
|
|
30436
|
+
align: options.align ?? "left",
|
|
30437
|
+
order: options.order,
|
|
30438
|
+
visible: options.visible,
|
|
30439
|
+
hideable: options.hideable,
|
|
30440
|
+
mobileRole: options.mobileRole,
|
|
30441
|
+
sortKey: options.sortKey,
|
|
30442
|
+
filterKey: options.filterKey,
|
|
30443
|
+
// Do NOT add a default filter; developer opts-in by providing options.filter
|
|
30444
|
+
filter: options.filter
|
|
30445
|
+
});
|
|
30446
|
+
}
|
|
30447
|
+
function getDescriptorId(descriptor) {
|
|
30448
|
+
return descriptor.defaults.id ?? descriptor.columnDef.id ?? descriptor.columnDef.accessorKey ?? "";
|
|
30449
|
+
}
|
|
30450
|
+
function getDisplayLabel(descriptor) {
|
|
30451
|
+
const meta = descriptor.columnDef.meta;
|
|
30452
|
+
if (meta?.mobileLabel) return meta.mobileLabel;
|
|
30453
|
+
if (meta?.label) return meta.label;
|
|
30454
|
+
const header = descriptor.columnDef.header;
|
|
30455
|
+
if (typeof header === "string") return header;
|
|
30456
|
+
const id = getDescriptorId(descriptor);
|
|
30457
|
+
return id.replace(/[-_]/g, " ").replace(/\b\w/g, (char) => char.toUpperCase());
|
|
30458
|
+
}
|
|
30459
|
+
function RowCard({
|
|
30460
|
+
row,
|
|
30461
|
+
columnRegistry,
|
|
30462
|
+
className
|
|
30463
|
+
}) {
|
|
30464
|
+
const visibleCells = row.getVisibleCells();
|
|
30465
|
+
const cellMap = new Map(visibleCells.map((cell) => [cell.column.id, cell]));
|
|
30466
|
+
const registryById = columnRegistry ? columnRegistry : null;
|
|
30467
|
+
const descriptors = visibleCells.map(
|
|
30468
|
+
(cell) => {
|
|
30469
|
+
const id = cell.column.id;
|
|
30470
|
+
const fromRegistry = registryById ? registryById[id] : void 0;
|
|
30471
|
+
if (fromRegistry) return fromRegistry;
|
|
30472
|
+
return {
|
|
30473
|
+
columnDef: cell.column.columnDef,
|
|
30474
|
+
defaults: { id }
|
|
30475
|
+
};
|
|
30476
|
+
}
|
|
30477
|
+
);
|
|
30478
|
+
function renderCellValue(cell) {
|
|
30479
|
+
return flexRender(cell.column.columnDef.cell, cell.getContext());
|
|
30480
|
+
}
|
|
30481
|
+
function normalizeAlignment(node) {
|
|
30482
|
+
if (React.isValidElement(node)) {
|
|
30483
|
+
const props = {
|
|
30484
|
+
...node.props
|
|
30485
|
+
};
|
|
30486
|
+
if (typeof props.className === "string") {
|
|
30487
|
+
const cls = props.className;
|
|
30488
|
+
const replaced = cls.replace(/\bjustify-end\b/g, "justify-start").replace(/\bjustify-between\b/g, "justify-start").replace(/\btext-right\b/g, "text-left").replace(/\btext-center\b/g, "text-left").replace(/\bml-auto\b/g, "");
|
|
30489
|
+
props.className = replaced;
|
|
30490
|
+
}
|
|
30491
|
+
if (props.children) {
|
|
30492
|
+
props.children = React.Children.map(
|
|
30493
|
+
props.children,
|
|
30494
|
+
(child) => normalizeAlignment(child)
|
|
30495
|
+
);
|
|
30496
|
+
}
|
|
30497
|
+
return React.cloneElement(node, props);
|
|
30498
|
+
}
|
|
30499
|
+
if (Array.isArray(node)) {
|
|
30500
|
+
return node.map((n, i) => /* @__PURE__ */ jsxRuntimeExports.jsx(React.Fragment, { children: normalizeAlignment(n) }, i));
|
|
30501
|
+
}
|
|
30502
|
+
return node;
|
|
30503
|
+
}
|
|
30504
|
+
const title = descriptors.find(
|
|
30505
|
+
(item) => item.defaults.mobileRole === "title"
|
|
30506
|
+
);
|
|
30507
|
+
const subtitle = descriptors.find(
|
|
30508
|
+
(item) => item.defaults.mobileRole === "subtitle"
|
|
30509
|
+
);
|
|
30510
|
+
const badges = descriptors.filter(
|
|
30511
|
+
(item) => item.defaults.mobileRole === "badge"
|
|
30512
|
+
);
|
|
30513
|
+
const selectionDescriptor = descriptors.find(
|
|
30514
|
+
(item) => getDescriptorId(item) === "select"
|
|
30515
|
+
);
|
|
30516
|
+
const selectionId = selectionDescriptor ? getDescriptorId(selectionDescriptor) : void 0;
|
|
30517
|
+
const selectionCell = selectionId ? cellMap.get(selectionId) : void 0;
|
|
30518
|
+
const remaining = descriptors.filter((item) => {
|
|
30519
|
+
const role = item.defaults.mobileRole ?? "";
|
|
30520
|
+
const id = getDescriptorId(item);
|
|
30521
|
+
if (id === selectionId) return false;
|
|
30522
|
+
return !["title", "subtitle", "badge"].includes(role);
|
|
30523
|
+
});
|
|
30524
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
30525
|
+
"article",
|
|
30526
|
+
{
|
|
30527
|
+
className: cn(
|
|
30528
|
+
"mmc-row-card rounded-lg border border-border bg-card text-card-foreground shadow-sm p-4 space-y-3",
|
|
30529
|
+
className
|
|
30530
|
+
),
|
|
30531
|
+
role: "group",
|
|
30532
|
+
"aria-label": (() => {
|
|
30533
|
+
const parts = [];
|
|
30534
|
+
if (title) {
|
|
30535
|
+
const id = getDescriptorId(title);
|
|
30536
|
+
const value = row.getValue(id);
|
|
30537
|
+
if (value != null) parts.push(String(value));
|
|
30538
|
+
}
|
|
30539
|
+
if (subtitle) {
|
|
30540
|
+
const id = getDescriptorId(subtitle);
|
|
30541
|
+
const value = row.getValue(id);
|
|
30542
|
+
if (value != null) parts.push(String(value));
|
|
30543
|
+
}
|
|
30544
|
+
return parts.join(" — ") || "Row";
|
|
30545
|
+
})(),
|
|
30546
|
+
"data-slot": "row-card",
|
|
30547
|
+
children: [
|
|
30548
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("header", { className: "mmc-row-card__header flex items-start justify-between gap-3", children: [
|
|
30549
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mmc-row-card__header-left flex items-start gap-3", children: [
|
|
30550
|
+
selectionCell ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mmc-row-card__selection pt-1", children: renderCellValue(selectionCell) }) : null,
|
|
30551
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mmc-row-card__title-wrap space-y-1", children: [
|
|
30552
|
+
title ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mmc-row-card__title text-base font-medium", children: (() => {
|
|
30553
|
+
const id = getDescriptorId(title);
|
|
30554
|
+
const cell = cellMap.get(id);
|
|
30555
|
+
return cell ? renderCellValue(cell) : row.getValue(id);
|
|
30556
|
+
})() }) : null,
|
|
30557
|
+
subtitle ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mmc-row-card__subtitle text-sm text-muted-foreground", children: (() => {
|
|
30558
|
+
const id = getDescriptorId(subtitle);
|
|
30559
|
+
const cell = cellMap.get(id);
|
|
30560
|
+
return cell ? renderCellValue(cell) : row.getValue(id);
|
|
30561
|
+
})() }) : null
|
|
30562
|
+
] })
|
|
30563
|
+
] }),
|
|
30564
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
30565
|
+
"div",
|
|
30566
|
+
{
|
|
30567
|
+
className: "mmc-row-card__badges flex flex-wrap items-center gap-2",
|
|
30568
|
+
"aria-label": "Status",
|
|
30569
|
+
children: badges.map((badge) => {
|
|
30570
|
+
const id = getDescriptorId(badge);
|
|
30571
|
+
const cell = cellMap.get(id);
|
|
30572
|
+
if (!cell) return null;
|
|
30573
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mmc-row-card__badge text-sm font-medium", children: renderCellValue(cell) }, id);
|
|
30574
|
+
})
|
|
30575
|
+
}
|
|
30576
|
+
)
|
|
30577
|
+
] }),
|
|
30578
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("dl", { className: "mmc-row-card__details grid grid-cols-2 gap-3 text-sm sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4", children: remaining.map((item) => {
|
|
30579
|
+
const id = getDescriptorId(item);
|
|
30580
|
+
const cell = cellMap.get(id);
|
|
30581
|
+
if (!cell) return null;
|
|
30582
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mmc-row-card__detail flex flex-col gap-1", children: [
|
|
30583
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("dt", { className: "mmc-row-card__label text-xs text-muted-foreground", children: getDisplayLabel(item) }),
|
|
30584
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("dd", { className: "mmc-row-card__value m-0 w-full text-left flex items-center justify-start", children: normalizeAlignment(
|
|
30585
|
+
renderCellValue(cell)
|
|
30586
|
+
) })
|
|
30587
|
+
] }, id);
|
|
30588
|
+
}) })
|
|
30589
|
+
]
|
|
30590
|
+
}
|
|
30591
|
+
);
|
|
30592
|
+
}
|
|
30593
|
+
function memo(getDeps, fn, opts) {
|
|
30594
|
+
let deps = opts.initialDeps ?? [];
|
|
30595
|
+
let result;
|
|
30596
|
+
function memoizedFunction() {
|
|
30597
|
+
var _a, _b, _c, _d;
|
|
30598
|
+
let depTime;
|
|
30599
|
+
if (opts.key && ((_a = opts.debug) == null ? void 0 : _a.call(opts))) depTime = Date.now();
|
|
30600
|
+
const newDeps = getDeps();
|
|
30601
|
+
const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index2) => deps[index2] !== dep);
|
|
30602
|
+
if (!depsChanged) {
|
|
30603
|
+
return result;
|
|
30604
|
+
}
|
|
30605
|
+
deps = newDeps;
|
|
30606
|
+
let resultTime;
|
|
30607
|
+
if (opts.key && ((_b = opts.debug) == null ? void 0 : _b.call(opts))) resultTime = Date.now();
|
|
30608
|
+
result = fn(...newDeps);
|
|
30609
|
+
if (opts.key && ((_c = opts.debug) == null ? void 0 : _c.call(opts))) {
|
|
30610
|
+
const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
|
|
30611
|
+
const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
|
|
30612
|
+
const resultFpsPercentage = resultEndTime / 16;
|
|
30613
|
+
const pad = (str, num) => {
|
|
30614
|
+
str = String(str);
|
|
30615
|
+
while (str.length < num) {
|
|
30616
|
+
str = " " + str;
|
|
30617
|
+
}
|
|
30618
|
+
return str;
|
|
30619
|
+
};
|
|
30620
|
+
console.info(
|
|
30621
|
+
`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,
|
|
30622
|
+
`
|
|
30623
|
+
font-size: .6rem;
|
|
30624
|
+
font-weight: bold;
|
|
30625
|
+
color: hsl(${Math.max(
|
|
30626
|
+
0,
|
|
30627
|
+
Math.min(120 - 120 * resultFpsPercentage, 120)
|
|
30628
|
+
)}deg 100% 31%);`,
|
|
30629
|
+
opts == null ? void 0 : opts.key
|
|
30630
|
+
);
|
|
30631
|
+
}
|
|
30632
|
+
(_d = opts == null ? void 0 : opts.onChange) == null ? void 0 : _d.call(opts, result);
|
|
30633
|
+
return result;
|
|
30634
|
+
}
|
|
30635
|
+
memoizedFunction.updateDeps = (newDeps) => {
|
|
30636
|
+
deps = newDeps;
|
|
30637
|
+
};
|
|
30638
|
+
return memoizedFunction;
|
|
30639
|
+
}
|
|
30640
|
+
function notUndefined(value, msg) {
|
|
30641
|
+
if (value === void 0) {
|
|
30642
|
+
throw new Error(`Unexpected undefined${""}`);
|
|
30643
|
+
} else {
|
|
30644
|
+
return value;
|
|
30645
|
+
}
|
|
30646
|
+
}
|
|
30647
|
+
const approxEqual = (a, b) => Math.abs(a - b) < 1.01;
|
|
30648
|
+
const debounce = (targetWindow, fn, ms) => {
|
|
30649
|
+
let timeoutId;
|
|
30650
|
+
return function(...args) {
|
|
30651
|
+
targetWindow.clearTimeout(timeoutId);
|
|
30652
|
+
timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms);
|
|
30653
|
+
};
|
|
30654
|
+
};
|
|
30655
|
+
const getRect = (element) => {
|
|
30656
|
+
const { offsetWidth, offsetHeight } = element;
|
|
30657
|
+
return { width: offsetWidth, height: offsetHeight };
|
|
30658
|
+
};
|
|
30659
|
+
const defaultKeyExtractor = (index2) => index2;
|
|
30660
|
+
const defaultRangeExtractor = (range) => {
|
|
30661
|
+
const start = Math.max(range.startIndex - range.overscan, 0);
|
|
30662
|
+
const end = Math.min(range.endIndex + range.overscan, range.count - 1);
|
|
30663
|
+
const arr = [];
|
|
30664
|
+
for (let i = start; i <= end; i++) {
|
|
30665
|
+
arr.push(i);
|
|
30666
|
+
}
|
|
30667
|
+
return arr;
|
|
30668
|
+
};
|
|
30669
|
+
const observeElementRect = (instance, cb) => {
|
|
30670
|
+
const element = instance.scrollElement;
|
|
30671
|
+
if (!element) {
|
|
30672
|
+
return;
|
|
30673
|
+
}
|
|
30674
|
+
const targetWindow = instance.targetWindow;
|
|
30675
|
+
if (!targetWindow) {
|
|
30676
|
+
return;
|
|
30677
|
+
}
|
|
30678
|
+
const handler = (rect) => {
|
|
30679
|
+
const { width, height } = rect;
|
|
30680
|
+
cb({ width: Math.round(width), height: Math.round(height) });
|
|
30681
|
+
};
|
|
30682
|
+
handler(getRect(element));
|
|
30683
|
+
if (!targetWindow.ResizeObserver) {
|
|
30684
|
+
return () => {
|
|
30685
|
+
};
|
|
30686
|
+
}
|
|
30687
|
+
const observer = new targetWindow.ResizeObserver((entries) => {
|
|
30688
|
+
const run = () => {
|
|
30689
|
+
const entry = entries[0];
|
|
30690
|
+
if (entry == null ? void 0 : entry.borderBoxSize) {
|
|
30691
|
+
const box = entry.borderBoxSize[0];
|
|
30692
|
+
if (box) {
|
|
30693
|
+
handler({ width: box.inlineSize, height: box.blockSize });
|
|
30694
|
+
return;
|
|
30695
|
+
}
|
|
30696
|
+
}
|
|
30697
|
+
handler(getRect(element));
|
|
30698
|
+
};
|
|
30699
|
+
instance.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run();
|
|
30700
|
+
});
|
|
30701
|
+
observer.observe(element, { box: "border-box" });
|
|
30702
|
+
return () => {
|
|
30703
|
+
observer.unobserve(element);
|
|
30704
|
+
};
|
|
30705
|
+
};
|
|
30706
|
+
const addEventListenerOptions = {
|
|
30707
|
+
passive: true
|
|
30708
|
+
};
|
|
30709
|
+
const supportsScrollend = typeof window == "undefined" ? true : "onscrollend" in window;
|
|
30710
|
+
const observeElementOffset = (instance, cb) => {
|
|
30711
|
+
const element = instance.scrollElement;
|
|
30712
|
+
if (!element) {
|
|
30713
|
+
return;
|
|
30714
|
+
}
|
|
30715
|
+
const targetWindow = instance.targetWindow;
|
|
30716
|
+
if (!targetWindow) {
|
|
30717
|
+
return;
|
|
30718
|
+
}
|
|
30719
|
+
let offset2 = 0;
|
|
30720
|
+
const fallback = instance.options.useScrollendEvent && supportsScrollend ? () => void 0 : debounce(
|
|
30721
|
+
targetWindow,
|
|
30722
|
+
() => {
|
|
30723
|
+
cb(offset2, false);
|
|
30724
|
+
},
|
|
30725
|
+
instance.options.isScrollingResetDelay
|
|
30726
|
+
);
|
|
30727
|
+
const createHandler = (isScrolling) => () => {
|
|
30728
|
+
const { horizontal, isRtl } = instance.options;
|
|
30729
|
+
offset2 = horizontal ? element["scrollLeft"] * (isRtl && -1 || 1) : element["scrollTop"];
|
|
30730
|
+
fallback();
|
|
30731
|
+
cb(offset2, isScrolling);
|
|
30732
|
+
};
|
|
30733
|
+
const handler = createHandler(true);
|
|
30734
|
+
const endHandler = createHandler(false);
|
|
30735
|
+
endHandler();
|
|
30736
|
+
element.addEventListener("scroll", handler, addEventListenerOptions);
|
|
30737
|
+
const registerScrollendEvent = instance.options.useScrollendEvent && supportsScrollend;
|
|
30738
|
+
if (registerScrollendEvent) {
|
|
30739
|
+
element.addEventListener("scrollend", endHandler, addEventListenerOptions);
|
|
30740
|
+
}
|
|
30741
|
+
return () => {
|
|
30742
|
+
element.removeEventListener("scroll", handler);
|
|
30743
|
+
if (registerScrollendEvent) {
|
|
30744
|
+
element.removeEventListener("scrollend", endHandler);
|
|
30745
|
+
}
|
|
30746
|
+
};
|
|
30747
|
+
};
|
|
30748
|
+
const measureElement = (element, entry, instance) => {
|
|
30749
|
+
if (entry == null ? void 0 : entry.borderBoxSize) {
|
|
30750
|
+
const box = entry.borderBoxSize[0];
|
|
30751
|
+
if (box) {
|
|
30752
|
+
const size2 = Math.round(
|
|
30753
|
+
box[instance.options.horizontal ? "inlineSize" : "blockSize"]
|
|
30754
|
+
);
|
|
30755
|
+
return size2;
|
|
30756
|
+
}
|
|
30757
|
+
}
|
|
30758
|
+
return element[instance.options.horizontal ? "offsetWidth" : "offsetHeight"];
|
|
30759
|
+
};
|
|
30760
|
+
const elementScroll = (offset2, {
|
|
30761
|
+
adjustments = 0,
|
|
30762
|
+
behavior
|
|
30763
|
+
}, instance) => {
|
|
30764
|
+
var _a, _b;
|
|
30765
|
+
const toOffset = offset2 + adjustments;
|
|
30766
|
+
(_b = (_a = instance.scrollElement) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, {
|
|
30767
|
+
[instance.options.horizontal ? "left" : "top"]: toOffset,
|
|
30768
|
+
behavior
|
|
30769
|
+
});
|
|
30770
|
+
};
|
|
30771
|
+
class Virtualizer {
|
|
30772
|
+
constructor(opts) {
|
|
30773
|
+
this.unsubs = [];
|
|
30774
|
+
this.scrollElement = null;
|
|
30775
|
+
this.targetWindow = null;
|
|
30776
|
+
this.isScrolling = false;
|
|
30777
|
+
this.measurementsCache = [];
|
|
30778
|
+
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
30779
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
30780
|
+
this.scrollRect = null;
|
|
30781
|
+
this.scrollOffset = null;
|
|
30782
|
+
this.scrollDirection = null;
|
|
30783
|
+
this.scrollAdjustments = 0;
|
|
30784
|
+
this.elementsCache = /* @__PURE__ */ new Map();
|
|
30785
|
+
this.observer = /* @__PURE__ */ (() => {
|
|
30786
|
+
let _ro = null;
|
|
30787
|
+
const get = () => {
|
|
30788
|
+
if (_ro) {
|
|
30789
|
+
return _ro;
|
|
30790
|
+
}
|
|
30791
|
+
if (!this.targetWindow || !this.targetWindow.ResizeObserver) {
|
|
30792
|
+
return null;
|
|
30793
|
+
}
|
|
30794
|
+
return _ro = new this.targetWindow.ResizeObserver((entries) => {
|
|
30795
|
+
entries.forEach((entry) => {
|
|
30796
|
+
const run = () => {
|
|
30797
|
+
this._measureElement(entry.target, entry);
|
|
30798
|
+
};
|
|
30799
|
+
this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run();
|
|
30800
|
+
});
|
|
30801
|
+
});
|
|
30802
|
+
};
|
|
30803
|
+
return {
|
|
30804
|
+
disconnect: () => {
|
|
30805
|
+
var _a;
|
|
30806
|
+
(_a = get()) == null ? void 0 : _a.disconnect();
|
|
30807
|
+
_ro = null;
|
|
30808
|
+
},
|
|
30809
|
+
observe: (target) => {
|
|
30810
|
+
var _a;
|
|
30811
|
+
return (_a = get()) == null ? void 0 : _a.observe(target, { box: "border-box" });
|
|
30812
|
+
},
|
|
30813
|
+
unobserve: (target) => {
|
|
30814
|
+
var _a;
|
|
30815
|
+
return (_a = get()) == null ? void 0 : _a.unobserve(target);
|
|
30816
|
+
}
|
|
30817
|
+
};
|
|
30818
|
+
})();
|
|
30819
|
+
this.range = null;
|
|
30820
|
+
this.setOptions = (opts2) => {
|
|
30821
|
+
Object.entries(opts2).forEach(([key, value]) => {
|
|
30822
|
+
if (typeof value === "undefined") delete opts2[key];
|
|
30823
|
+
});
|
|
30824
|
+
this.options = {
|
|
30825
|
+
debug: false,
|
|
30826
|
+
initialOffset: 0,
|
|
30827
|
+
overscan: 1,
|
|
30828
|
+
paddingStart: 0,
|
|
30829
|
+
paddingEnd: 0,
|
|
30830
|
+
scrollPaddingStart: 0,
|
|
30831
|
+
scrollPaddingEnd: 0,
|
|
30832
|
+
horizontal: false,
|
|
30833
|
+
getItemKey: defaultKeyExtractor,
|
|
30834
|
+
rangeExtractor: defaultRangeExtractor,
|
|
30835
|
+
onChange: () => {
|
|
30836
|
+
},
|
|
30837
|
+
measureElement,
|
|
30838
|
+
initialRect: { width: 0, height: 0 },
|
|
30839
|
+
scrollMargin: 0,
|
|
30840
|
+
gap: 0,
|
|
30841
|
+
indexAttribute: "data-index",
|
|
30842
|
+
initialMeasurementsCache: [],
|
|
30843
|
+
lanes: 1,
|
|
30844
|
+
isScrollingResetDelay: 150,
|
|
30845
|
+
enabled: true,
|
|
30846
|
+
isRtl: false,
|
|
30847
|
+
useScrollendEvent: false,
|
|
30848
|
+
useAnimationFrameWithResizeObserver: false,
|
|
30849
|
+
...opts2
|
|
30850
|
+
};
|
|
30851
|
+
};
|
|
30852
|
+
this.notify = (sync) => {
|
|
30853
|
+
var _a, _b;
|
|
30854
|
+
(_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, sync);
|
|
30855
|
+
};
|
|
30856
|
+
this.maybeNotify = memo(
|
|
30857
|
+
() => {
|
|
30858
|
+
this.calculateRange();
|
|
30859
|
+
return [
|
|
30860
|
+
this.isScrolling,
|
|
30861
|
+
this.range ? this.range.startIndex : null,
|
|
30862
|
+
this.range ? this.range.endIndex : null
|
|
30863
|
+
];
|
|
30864
|
+
},
|
|
30865
|
+
(isScrolling) => {
|
|
30866
|
+
this.notify(isScrolling);
|
|
30867
|
+
},
|
|
30868
|
+
{
|
|
30869
|
+
key: process.env.NODE_ENV !== "production" && "maybeNotify",
|
|
30870
|
+
debug: () => this.options.debug,
|
|
30871
|
+
initialDeps: [
|
|
30872
|
+
this.isScrolling,
|
|
30873
|
+
this.range ? this.range.startIndex : null,
|
|
30874
|
+
this.range ? this.range.endIndex : null
|
|
30875
|
+
]
|
|
30876
|
+
}
|
|
30877
|
+
);
|
|
30878
|
+
this.cleanup = () => {
|
|
30879
|
+
this.unsubs.filter(Boolean).forEach((d) => d());
|
|
30880
|
+
this.unsubs = [];
|
|
30881
|
+
this.observer.disconnect();
|
|
30882
|
+
this.scrollElement = null;
|
|
30883
|
+
this.targetWindow = null;
|
|
30884
|
+
};
|
|
30885
|
+
this._didMount = () => {
|
|
30886
|
+
return () => {
|
|
30887
|
+
this.cleanup();
|
|
30888
|
+
};
|
|
30889
|
+
};
|
|
30890
|
+
this._willUpdate = () => {
|
|
30891
|
+
var _a;
|
|
30892
|
+
const scrollElement = this.options.enabled ? this.options.getScrollElement() : null;
|
|
30893
|
+
if (this.scrollElement !== scrollElement) {
|
|
30894
|
+
this.cleanup();
|
|
30895
|
+
if (!scrollElement) {
|
|
30896
|
+
this.maybeNotify();
|
|
30897
|
+
return;
|
|
30898
|
+
}
|
|
30899
|
+
this.scrollElement = scrollElement;
|
|
30900
|
+
if (this.scrollElement && "ownerDocument" in this.scrollElement) {
|
|
30901
|
+
this.targetWindow = this.scrollElement.ownerDocument.defaultView;
|
|
30902
|
+
} else {
|
|
30903
|
+
this.targetWindow = ((_a = this.scrollElement) == null ? void 0 : _a.window) ?? null;
|
|
30904
|
+
}
|
|
30905
|
+
this.elementsCache.forEach((cached) => {
|
|
30906
|
+
this.observer.observe(cached);
|
|
30907
|
+
});
|
|
30908
|
+
this._scrollToOffset(this.getScrollOffset(), {
|
|
30909
|
+
adjustments: void 0,
|
|
30910
|
+
behavior: void 0
|
|
30911
|
+
});
|
|
30912
|
+
this.unsubs.push(
|
|
30913
|
+
this.options.observeElementRect(this, (rect) => {
|
|
30914
|
+
this.scrollRect = rect;
|
|
30915
|
+
this.maybeNotify();
|
|
30916
|
+
})
|
|
30917
|
+
);
|
|
30918
|
+
this.unsubs.push(
|
|
30919
|
+
this.options.observeElementOffset(this, (offset2, isScrolling) => {
|
|
30920
|
+
this.scrollAdjustments = 0;
|
|
30921
|
+
this.scrollDirection = isScrolling ? this.getScrollOffset() < offset2 ? "forward" : "backward" : null;
|
|
30922
|
+
this.scrollOffset = offset2;
|
|
30923
|
+
this.isScrolling = isScrolling;
|
|
30924
|
+
this.maybeNotify();
|
|
30925
|
+
})
|
|
30926
|
+
);
|
|
30927
|
+
}
|
|
30928
|
+
};
|
|
30929
|
+
this.getSize = () => {
|
|
30930
|
+
if (!this.options.enabled) {
|
|
30931
|
+
this.scrollRect = null;
|
|
30932
|
+
return 0;
|
|
30933
|
+
}
|
|
30934
|
+
this.scrollRect = this.scrollRect ?? this.options.initialRect;
|
|
30935
|
+
return this.scrollRect[this.options.horizontal ? "width" : "height"];
|
|
30936
|
+
};
|
|
30937
|
+
this.getScrollOffset = () => {
|
|
30938
|
+
if (!this.options.enabled) {
|
|
30939
|
+
this.scrollOffset = null;
|
|
30940
|
+
return 0;
|
|
30941
|
+
}
|
|
30942
|
+
this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset === "function" ? this.options.initialOffset() : this.options.initialOffset);
|
|
30943
|
+
return this.scrollOffset;
|
|
30944
|
+
};
|
|
30945
|
+
this.getFurthestMeasurement = (measurements, index2) => {
|
|
30946
|
+
const furthestMeasurementsFound = /* @__PURE__ */ new Map();
|
|
30947
|
+
const furthestMeasurements = /* @__PURE__ */ new Map();
|
|
30948
|
+
for (let m = index2 - 1; m >= 0; m--) {
|
|
30949
|
+
const measurement = measurements[m];
|
|
30950
|
+
if (furthestMeasurementsFound.has(measurement.lane)) {
|
|
30951
|
+
continue;
|
|
30952
|
+
}
|
|
30953
|
+
const previousFurthestMeasurement = furthestMeasurements.get(
|
|
30954
|
+
measurement.lane
|
|
30955
|
+
);
|
|
30956
|
+
if (previousFurthestMeasurement == null || measurement.end > previousFurthestMeasurement.end) {
|
|
30957
|
+
furthestMeasurements.set(measurement.lane, measurement);
|
|
30958
|
+
} else if (measurement.end < previousFurthestMeasurement.end) {
|
|
30959
|
+
furthestMeasurementsFound.set(measurement.lane, true);
|
|
30960
|
+
}
|
|
30961
|
+
if (furthestMeasurementsFound.size === this.options.lanes) {
|
|
30962
|
+
break;
|
|
30963
|
+
}
|
|
30964
|
+
}
|
|
30965
|
+
return furthestMeasurements.size === this.options.lanes ? Array.from(furthestMeasurements.values()).sort((a, b) => {
|
|
30966
|
+
if (a.end === b.end) {
|
|
30967
|
+
return a.index - b.index;
|
|
30968
|
+
}
|
|
30969
|
+
return a.end - b.end;
|
|
30970
|
+
})[0] : void 0;
|
|
30971
|
+
};
|
|
30972
|
+
this.getMeasurementOptions = memo(
|
|
30973
|
+
() => [
|
|
30974
|
+
this.options.count,
|
|
30975
|
+
this.options.paddingStart,
|
|
30976
|
+
this.options.scrollMargin,
|
|
30977
|
+
this.options.getItemKey,
|
|
30978
|
+
this.options.enabled
|
|
30979
|
+
],
|
|
30980
|
+
(count2, paddingStart, scrollMargin, getItemKey, enabled) => {
|
|
30981
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
30982
|
+
return {
|
|
30983
|
+
count: count2,
|
|
30984
|
+
paddingStart,
|
|
30985
|
+
scrollMargin,
|
|
30986
|
+
getItemKey,
|
|
30987
|
+
enabled
|
|
30988
|
+
};
|
|
30989
|
+
},
|
|
30990
|
+
{
|
|
30991
|
+
key: false
|
|
30992
|
+
}
|
|
30993
|
+
);
|
|
30994
|
+
this.getMeasurements = memo(
|
|
30995
|
+
() => [this.getMeasurementOptions(), this.itemSizeCache],
|
|
30996
|
+
({ count: count2, paddingStart, scrollMargin, getItemKey, enabled }, itemSizeCache) => {
|
|
30997
|
+
if (!enabled) {
|
|
30998
|
+
this.measurementsCache = [];
|
|
30999
|
+
this.itemSizeCache.clear();
|
|
31000
|
+
return [];
|
|
31001
|
+
}
|
|
31002
|
+
if (this.measurementsCache.length === 0) {
|
|
31003
|
+
this.measurementsCache = this.options.initialMeasurementsCache;
|
|
31004
|
+
this.measurementsCache.forEach((item) => {
|
|
31005
|
+
this.itemSizeCache.set(item.key, item.size);
|
|
31006
|
+
});
|
|
31007
|
+
}
|
|
31008
|
+
const min2 = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
|
|
31009
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
31010
|
+
const measurements = this.measurementsCache.slice(0, min2);
|
|
31011
|
+
for (let i = min2; i < count2; i++) {
|
|
31012
|
+
const key = getItemKey(i);
|
|
31013
|
+
const furthestMeasurement = this.options.lanes === 1 ? measurements[i - 1] : this.getFurthestMeasurement(measurements, i);
|
|
31014
|
+
const start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
|
|
31015
|
+
const measuredSize = itemSizeCache.get(key);
|
|
31016
|
+
const size2 = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i);
|
|
31017
|
+
const end = start + size2;
|
|
31018
|
+
const lane = furthestMeasurement ? furthestMeasurement.lane : i % this.options.lanes;
|
|
31019
|
+
measurements[i] = {
|
|
31020
|
+
index: i,
|
|
31021
|
+
start,
|
|
31022
|
+
size: size2,
|
|
31023
|
+
end,
|
|
31024
|
+
key,
|
|
31025
|
+
lane
|
|
31026
|
+
};
|
|
31027
|
+
}
|
|
31028
|
+
this.measurementsCache = measurements;
|
|
31029
|
+
return measurements;
|
|
31030
|
+
},
|
|
31031
|
+
{
|
|
31032
|
+
key: process.env.NODE_ENV !== "production" && "getMeasurements",
|
|
31033
|
+
debug: () => this.options.debug
|
|
31034
|
+
}
|
|
31035
|
+
);
|
|
31036
|
+
this.calculateRange = memo(
|
|
31037
|
+
() => [
|
|
31038
|
+
this.getMeasurements(),
|
|
31039
|
+
this.getSize(),
|
|
31040
|
+
this.getScrollOffset(),
|
|
31041
|
+
this.options.lanes
|
|
31042
|
+
],
|
|
31043
|
+
(measurements, outerSize, scrollOffset, lanes) => {
|
|
31044
|
+
return this.range = measurements.length > 0 && outerSize > 0 ? calculateRange({
|
|
31045
|
+
measurements,
|
|
31046
|
+
outerSize,
|
|
31047
|
+
scrollOffset,
|
|
31048
|
+
lanes
|
|
31049
|
+
}) : null;
|
|
31050
|
+
},
|
|
31051
|
+
{
|
|
31052
|
+
key: process.env.NODE_ENV !== "production" && "calculateRange",
|
|
31053
|
+
debug: () => this.options.debug
|
|
31054
|
+
}
|
|
31055
|
+
);
|
|
31056
|
+
this.getVirtualIndexes = memo(
|
|
31057
|
+
() => {
|
|
31058
|
+
let startIndex = null;
|
|
31059
|
+
let endIndex = null;
|
|
31060
|
+
const range = this.calculateRange();
|
|
31061
|
+
if (range) {
|
|
31062
|
+
startIndex = range.startIndex;
|
|
31063
|
+
endIndex = range.endIndex;
|
|
31064
|
+
}
|
|
31065
|
+
this.maybeNotify.updateDeps([this.isScrolling, startIndex, endIndex]);
|
|
31066
|
+
return [
|
|
31067
|
+
this.options.rangeExtractor,
|
|
31068
|
+
this.options.overscan,
|
|
31069
|
+
this.options.count,
|
|
31070
|
+
startIndex,
|
|
31071
|
+
endIndex
|
|
31072
|
+
];
|
|
31073
|
+
},
|
|
31074
|
+
(rangeExtractor, overscan, count2, startIndex, endIndex) => {
|
|
31075
|
+
return startIndex === null || endIndex === null ? [] : rangeExtractor({
|
|
31076
|
+
startIndex,
|
|
31077
|
+
endIndex,
|
|
31078
|
+
overscan,
|
|
31079
|
+
count: count2
|
|
31080
|
+
});
|
|
31081
|
+
},
|
|
31082
|
+
{
|
|
31083
|
+
key: process.env.NODE_ENV !== "production" && "getVirtualIndexes",
|
|
31084
|
+
debug: () => this.options.debug
|
|
31085
|
+
}
|
|
31086
|
+
);
|
|
31087
|
+
this.indexFromElement = (node) => {
|
|
31088
|
+
const attributeName = this.options.indexAttribute;
|
|
31089
|
+
const indexStr = node.getAttribute(attributeName);
|
|
31090
|
+
if (!indexStr) {
|
|
31091
|
+
console.warn(
|
|
31092
|
+
`Missing attribute name '${attributeName}={index}' on measured element.`
|
|
31093
|
+
);
|
|
31094
|
+
return -1;
|
|
31095
|
+
}
|
|
31096
|
+
return parseInt(indexStr, 10);
|
|
31097
|
+
};
|
|
31098
|
+
this._measureElement = (node, entry) => {
|
|
31099
|
+
const index2 = this.indexFromElement(node);
|
|
31100
|
+
const item = this.measurementsCache[index2];
|
|
31101
|
+
if (!item) {
|
|
31102
|
+
return;
|
|
31103
|
+
}
|
|
31104
|
+
const key = item.key;
|
|
31105
|
+
const prevNode = this.elementsCache.get(key);
|
|
31106
|
+
if (prevNode !== node) {
|
|
31107
|
+
if (prevNode) {
|
|
31108
|
+
this.observer.unobserve(prevNode);
|
|
31109
|
+
}
|
|
31110
|
+
this.observer.observe(node);
|
|
31111
|
+
this.elementsCache.set(key, node);
|
|
31112
|
+
}
|
|
31113
|
+
if (node.isConnected) {
|
|
31114
|
+
this.resizeItem(index2, this.options.measureElement(node, entry, this));
|
|
31115
|
+
}
|
|
31116
|
+
};
|
|
31117
|
+
this.resizeItem = (index2, size2) => {
|
|
31118
|
+
const item = this.measurementsCache[index2];
|
|
31119
|
+
if (!item) {
|
|
31120
|
+
return;
|
|
31121
|
+
}
|
|
31122
|
+
const itemSize = this.itemSizeCache.get(item.key) ?? item.size;
|
|
31123
|
+
const delta = size2 - itemSize;
|
|
31124
|
+
if (delta !== 0) {
|
|
31125
|
+
if (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(item, delta, this) : item.start < this.getScrollOffset() + this.scrollAdjustments) {
|
|
31126
|
+
if (process.env.NODE_ENV !== "production" && this.options.debug) {
|
|
31127
|
+
console.info("correction", delta);
|
|
31128
|
+
}
|
|
31129
|
+
this._scrollToOffset(this.getScrollOffset(), {
|
|
31130
|
+
adjustments: this.scrollAdjustments += delta,
|
|
31131
|
+
behavior: void 0
|
|
31132
|
+
});
|
|
31133
|
+
}
|
|
31134
|
+
this.pendingMeasuredCacheIndexes.push(item.index);
|
|
31135
|
+
this.itemSizeCache = new Map(this.itemSizeCache.set(item.key, size2));
|
|
31136
|
+
this.notify(false);
|
|
31137
|
+
}
|
|
31138
|
+
};
|
|
31139
|
+
this.measureElement = (node) => {
|
|
31140
|
+
if (!node) {
|
|
31141
|
+
this.elementsCache.forEach((cached, key) => {
|
|
31142
|
+
if (!cached.isConnected) {
|
|
31143
|
+
this.observer.unobserve(cached);
|
|
31144
|
+
this.elementsCache.delete(key);
|
|
31145
|
+
}
|
|
31146
|
+
});
|
|
31147
|
+
return;
|
|
31148
|
+
}
|
|
31149
|
+
this._measureElement(node, void 0);
|
|
31150
|
+
};
|
|
31151
|
+
this.getVirtualItems = memo(
|
|
31152
|
+
() => [this.getVirtualIndexes(), this.getMeasurements()],
|
|
31153
|
+
(indexes, measurements) => {
|
|
31154
|
+
const virtualItems = [];
|
|
31155
|
+
for (let k = 0, len = indexes.length; k < len; k++) {
|
|
31156
|
+
const i = indexes[k];
|
|
31157
|
+
const measurement = measurements[i];
|
|
31158
|
+
virtualItems.push(measurement);
|
|
31159
|
+
}
|
|
31160
|
+
return virtualItems;
|
|
31161
|
+
},
|
|
31162
|
+
{
|
|
31163
|
+
key: process.env.NODE_ENV !== "production" && "getVirtualItems",
|
|
31164
|
+
debug: () => this.options.debug
|
|
31165
|
+
}
|
|
31166
|
+
);
|
|
31167
|
+
this.getVirtualItemForOffset = (offset2) => {
|
|
31168
|
+
const measurements = this.getMeasurements();
|
|
31169
|
+
if (measurements.length === 0) {
|
|
31170
|
+
return void 0;
|
|
31171
|
+
}
|
|
31172
|
+
return notUndefined(
|
|
31173
|
+
measurements[findNearestBinarySearch(
|
|
31174
|
+
0,
|
|
31175
|
+
measurements.length - 1,
|
|
31176
|
+
(index2) => notUndefined(measurements[index2]).start,
|
|
31177
|
+
offset2
|
|
31178
|
+
)]
|
|
31179
|
+
);
|
|
31180
|
+
};
|
|
31181
|
+
this.getOffsetForAlignment = (toOffset, align, itemSize = 0) => {
|
|
31182
|
+
const size2 = this.getSize();
|
|
31183
|
+
const scrollOffset = this.getScrollOffset();
|
|
31184
|
+
if (align === "auto") {
|
|
31185
|
+
align = toOffset >= scrollOffset + size2 ? "end" : "start";
|
|
31186
|
+
}
|
|
31187
|
+
if (align === "center") {
|
|
31188
|
+
toOffset += (itemSize - size2) / 2;
|
|
31189
|
+
} else if (align === "end") {
|
|
31190
|
+
toOffset -= size2;
|
|
31191
|
+
}
|
|
31192
|
+
const maxOffset = this.getTotalSize() + this.options.scrollMargin - size2;
|
|
31193
|
+
return Math.max(Math.min(maxOffset, toOffset), 0);
|
|
31194
|
+
};
|
|
31195
|
+
this.getOffsetForIndex = (index2, align = "auto") => {
|
|
31196
|
+
index2 = Math.max(0, Math.min(index2, this.options.count - 1));
|
|
31197
|
+
const item = this.measurementsCache[index2];
|
|
31198
|
+
if (!item) {
|
|
31199
|
+
return void 0;
|
|
31200
|
+
}
|
|
31201
|
+
const size2 = this.getSize();
|
|
31202
|
+
const scrollOffset = this.getScrollOffset();
|
|
31203
|
+
if (align === "auto") {
|
|
31204
|
+
if (item.end >= scrollOffset + size2 - this.options.scrollPaddingEnd) {
|
|
31205
|
+
align = "end";
|
|
31206
|
+
} else if (item.start <= scrollOffset + this.options.scrollPaddingStart) {
|
|
31207
|
+
align = "start";
|
|
31208
|
+
} else {
|
|
31209
|
+
return [scrollOffset, align];
|
|
31210
|
+
}
|
|
31211
|
+
}
|
|
31212
|
+
const toOffset = align === "end" ? item.end + this.options.scrollPaddingEnd : item.start - this.options.scrollPaddingStart;
|
|
31213
|
+
return [
|
|
31214
|
+
this.getOffsetForAlignment(toOffset, align, item.size),
|
|
31215
|
+
align
|
|
31216
|
+
];
|
|
31217
|
+
};
|
|
31218
|
+
this.isDynamicMode = () => this.elementsCache.size > 0;
|
|
31219
|
+
this.scrollToOffset = (toOffset, { align = "start", behavior } = {}) => {
|
|
31220
|
+
if (behavior === "smooth" && this.isDynamicMode()) {
|
|
31221
|
+
console.warn(
|
|
31222
|
+
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
|
31223
|
+
);
|
|
31224
|
+
}
|
|
31225
|
+
this._scrollToOffset(this.getOffsetForAlignment(toOffset, align), {
|
|
31226
|
+
adjustments: void 0,
|
|
31227
|
+
behavior
|
|
31228
|
+
});
|
|
31229
|
+
};
|
|
31230
|
+
this.scrollToIndex = (index2, { align: initialAlign = "auto", behavior } = {}) => {
|
|
31231
|
+
if (behavior === "smooth" && this.isDynamicMode()) {
|
|
31232
|
+
console.warn(
|
|
31233
|
+
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
|
31234
|
+
);
|
|
31235
|
+
}
|
|
31236
|
+
index2 = Math.max(0, Math.min(index2, this.options.count - 1));
|
|
31237
|
+
let attempts = 0;
|
|
31238
|
+
const maxAttempts = 10;
|
|
31239
|
+
const tryScroll = (currentAlign) => {
|
|
31240
|
+
if (!this.targetWindow) return;
|
|
31241
|
+
const offsetInfo = this.getOffsetForIndex(index2, currentAlign);
|
|
31242
|
+
if (!offsetInfo) {
|
|
31243
|
+
console.warn("Failed to get offset for index:", index2);
|
|
31244
|
+
return;
|
|
31245
|
+
}
|
|
31246
|
+
const [offset2, align] = offsetInfo;
|
|
31247
|
+
this._scrollToOffset(offset2, { adjustments: void 0, behavior });
|
|
31248
|
+
this.targetWindow.requestAnimationFrame(() => {
|
|
31249
|
+
const currentOffset = this.getScrollOffset();
|
|
31250
|
+
const afterInfo = this.getOffsetForIndex(index2, align);
|
|
31251
|
+
if (!afterInfo) {
|
|
31252
|
+
console.warn("Failed to get offset for index:", index2);
|
|
31253
|
+
return;
|
|
31254
|
+
}
|
|
31255
|
+
if (!approxEqual(afterInfo[0], currentOffset)) {
|
|
31256
|
+
scheduleRetry(align);
|
|
31257
|
+
}
|
|
31258
|
+
});
|
|
31259
|
+
};
|
|
31260
|
+
const scheduleRetry = (align) => {
|
|
31261
|
+
if (!this.targetWindow) return;
|
|
31262
|
+
attempts++;
|
|
31263
|
+
if (attempts < maxAttempts) {
|
|
31264
|
+
if (process.env.NODE_ENV !== "production" && this.options.debug) {
|
|
31265
|
+
console.info("Schedule retry", attempts, maxAttempts);
|
|
31266
|
+
}
|
|
31267
|
+
this.targetWindow.requestAnimationFrame(() => tryScroll(align));
|
|
31268
|
+
} else {
|
|
31269
|
+
console.warn(
|
|
31270
|
+
`Failed to scroll to index ${index2} after ${maxAttempts} attempts.`
|
|
31271
|
+
);
|
|
31272
|
+
}
|
|
31273
|
+
};
|
|
31274
|
+
tryScroll(initialAlign);
|
|
31275
|
+
};
|
|
31276
|
+
this.scrollBy = (delta, { behavior } = {}) => {
|
|
31277
|
+
if (behavior === "smooth" && this.isDynamicMode()) {
|
|
31278
|
+
console.warn(
|
|
31279
|
+
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
|
31280
|
+
);
|
|
31281
|
+
}
|
|
31282
|
+
this._scrollToOffset(this.getScrollOffset() + delta, {
|
|
31283
|
+
adjustments: void 0,
|
|
31284
|
+
behavior
|
|
31285
|
+
});
|
|
31286
|
+
};
|
|
31287
|
+
this.getTotalSize = () => {
|
|
31288
|
+
var _a;
|
|
31289
|
+
const measurements = this.getMeasurements();
|
|
31290
|
+
let end;
|
|
31291
|
+
if (measurements.length === 0) {
|
|
31292
|
+
end = this.options.paddingStart;
|
|
31293
|
+
} else if (this.options.lanes === 1) {
|
|
31294
|
+
end = ((_a = measurements[measurements.length - 1]) == null ? void 0 : _a.end) ?? 0;
|
|
31295
|
+
} else {
|
|
31296
|
+
const endByLane = Array(this.options.lanes).fill(null);
|
|
31297
|
+
let endIndex = measurements.length - 1;
|
|
31298
|
+
while (endIndex >= 0 && endByLane.some((val) => val === null)) {
|
|
31299
|
+
const item = measurements[endIndex];
|
|
31300
|
+
if (endByLane[item.lane] === null) {
|
|
31301
|
+
endByLane[item.lane] = item.end;
|
|
31302
|
+
}
|
|
31303
|
+
endIndex--;
|
|
31304
|
+
}
|
|
31305
|
+
end = Math.max(...endByLane.filter((val) => val !== null));
|
|
31306
|
+
}
|
|
31307
|
+
return Math.max(
|
|
31308
|
+
end - this.options.scrollMargin + this.options.paddingEnd,
|
|
31309
|
+
0
|
|
31310
|
+
);
|
|
31311
|
+
};
|
|
31312
|
+
this._scrollToOffset = (offset2, {
|
|
31313
|
+
adjustments,
|
|
31314
|
+
behavior
|
|
31315
|
+
}) => {
|
|
31316
|
+
this.options.scrollToFn(offset2, { behavior, adjustments }, this);
|
|
31317
|
+
};
|
|
31318
|
+
this.measure = () => {
|
|
31319
|
+
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
31320
|
+
this.notify(false);
|
|
31321
|
+
};
|
|
31322
|
+
this.setOptions(opts);
|
|
31323
|
+
}
|
|
31324
|
+
}
|
|
31325
|
+
const findNearestBinarySearch = (low, high, getCurrentValue, value) => {
|
|
31326
|
+
while (low <= high) {
|
|
31327
|
+
const middle = (low + high) / 2 | 0;
|
|
31328
|
+
const currentValue = getCurrentValue(middle);
|
|
31329
|
+
if (currentValue < value) {
|
|
31330
|
+
low = middle + 1;
|
|
31331
|
+
} else if (currentValue > value) {
|
|
31332
|
+
high = middle - 1;
|
|
31333
|
+
} else {
|
|
31334
|
+
return middle;
|
|
31335
|
+
}
|
|
31336
|
+
}
|
|
31337
|
+
if (low > 0) {
|
|
31338
|
+
return low - 1;
|
|
31339
|
+
} else {
|
|
31340
|
+
return 0;
|
|
31341
|
+
}
|
|
31342
|
+
};
|
|
31343
|
+
function calculateRange({
|
|
31344
|
+
measurements,
|
|
31345
|
+
outerSize,
|
|
31346
|
+
scrollOffset,
|
|
31347
|
+
lanes
|
|
31348
|
+
}) {
|
|
31349
|
+
const lastIndex = measurements.length - 1;
|
|
31350
|
+
const getOffset2 = (index2) => measurements[index2].start;
|
|
31351
|
+
if (measurements.length <= lanes) {
|
|
31352
|
+
return {
|
|
31353
|
+
startIndex: 0,
|
|
31354
|
+
endIndex: lastIndex
|
|
31355
|
+
};
|
|
31356
|
+
}
|
|
31357
|
+
let startIndex = findNearestBinarySearch(
|
|
31358
|
+
0,
|
|
31359
|
+
lastIndex,
|
|
31360
|
+
getOffset2,
|
|
31361
|
+
scrollOffset
|
|
31362
|
+
);
|
|
31363
|
+
let endIndex = startIndex;
|
|
31364
|
+
if (lanes === 1) {
|
|
31365
|
+
while (endIndex < lastIndex && measurements[endIndex].end < scrollOffset + outerSize) {
|
|
31366
|
+
endIndex++;
|
|
31367
|
+
}
|
|
31368
|
+
} else if (lanes > 1) {
|
|
31369
|
+
const endPerLane = Array(lanes).fill(0);
|
|
31370
|
+
while (endIndex < lastIndex && endPerLane.some((pos) => pos < scrollOffset + outerSize)) {
|
|
31371
|
+
const item = measurements[endIndex];
|
|
31372
|
+
endPerLane[item.lane] = item.end;
|
|
31373
|
+
endIndex++;
|
|
31374
|
+
}
|
|
31375
|
+
const startPerLane = Array(lanes).fill(scrollOffset + outerSize);
|
|
31376
|
+
while (startIndex >= 0 && startPerLane.some((pos) => pos >= scrollOffset)) {
|
|
31377
|
+
const item = measurements[startIndex];
|
|
31378
|
+
startPerLane[item.lane] = item.start;
|
|
31379
|
+
startIndex--;
|
|
31380
|
+
}
|
|
31381
|
+
startIndex = Math.max(0, startIndex - startIndex % lanes);
|
|
31382
|
+
endIndex = Math.min(lastIndex, endIndex + (lanes - 1 - endIndex % lanes));
|
|
31383
|
+
}
|
|
31384
|
+
return { startIndex, endIndex };
|
|
31385
|
+
}
|
|
31386
|
+
const useIsomorphicLayoutEffect = typeof document !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
31387
|
+
function useVirtualizerBase(options) {
|
|
31388
|
+
const rerender = React.useReducer(() => ({}), {})[1];
|
|
31389
|
+
const resolvedOptions = {
|
|
31390
|
+
...options,
|
|
31391
|
+
onChange: (instance2, sync) => {
|
|
31392
|
+
var _a;
|
|
31393
|
+
if (sync) {
|
|
31394
|
+
flushSync(rerender);
|
|
31395
|
+
} else {
|
|
31396
|
+
rerender();
|
|
31397
|
+
}
|
|
31398
|
+
(_a = options.onChange) == null ? void 0 : _a.call(options, instance2, sync);
|
|
31399
|
+
}
|
|
31400
|
+
};
|
|
31401
|
+
const [instance] = React.useState(
|
|
31402
|
+
() => new Virtualizer(resolvedOptions)
|
|
31403
|
+
);
|
|
31404
|
+
instance.setOptions(resolvedOptions);
|
|
31405
|
+
useIsomorphicLayoutEffect(() => {
|
|
31406
|
+
return instance._didMount();
|
|
31407
|
+
}, []);
|
|
31408
|
+
useIsomorphicLayoutEffect(() => {
|
|
31409
|
+
return instance._willUpdate();
|
|
31410
|
+
});
|
|
31411
|
+
return instance;
|
|
31412
|
+
}
|
|
31413
|
+
function useVirtualizer(options) {
|
|
31414
|
+
return useVirtualizerBase({
|
|
31415
|
+
observeElementRect,
|
|
31416
|
+
observeElementOffset,
|
|
31417
|
+
scrollToFn: elementScroll,
|
|
31418
|
+
...options
|
|
31419
|
+
});
|
|
31420
|
+
}
|
|
29894
31421
|
React.createContext(void 0);
|
|
29895
31422
|
const TableHead = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
29896
31423
|
"th",
|
|
@@ -29976,6 +31503,224 @@ const TableContainer = React.forwardRef(({ className, children, autoHeight = tru
|
|
|
29976
31503
|
);
|
|
29977
31504
|
});
|
|
29978
31505
|
TableContainer.displayName = "TableContainer";
|
|
31506
|
+
function ResponsiveTable({
|
|
31507
|
+
columns,
|
|
31508
|
+
data,
|
|
31509
|
+
loading,
|
|
31510
|
+
columnRegistry,
|
|
31511
|
+
initialState: initialState2,
|
|
31512
|
+
breakpoint = "(max-width: 768px)",
|
|
31513
|
+
enableMobileVirtualization = true,
|
|
31514
|
+
virtualizeAt = 500,
|
|
31515
|
+
overscan = 8,
|
|
31516
|
+
tableId,
|
|
31517
|
+
toolbarOptions,
|
|
31518
|
+
emptyState,
|
|
31519
|
+
forceEmptyState
|
|
31520
|
+
}) {
|
|
31521
|
+
const isMobile = useBreakpoint(breakpoint);
|
|
31522
|
+
if (!isMobile) {
|
|
31523
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(TableContainer, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
31524
|
+
DataTable,
|
|
31525
|
+
{
|
|
31526
|
+
columns,
|
|
31527
|
+
data,
|
|
31528
|
+
loading,
|
|
31529
|
+
columnRegistry,
|
|
31530
|
+
initialState: initialState2,
|
|
31531
|
+
tableId,
|
|
31532
|
+
toolbar: toolbarOptions,
|
|
31533
|
+
emptyState,
|
|
31534
|
+
forceEmptyState
|
|
31535
|
+
}
|
|
31536
|
+
) });
|
|
31537
|
+
}
|
|
31538
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(TableContainer, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
31539
|
+
MobileTableInternal,
|
|
31540
|
+
{
|
|
31541
|
+
columns,
|
|
31542
|
+
data,
|
|
31543
|
+
loading,
|
|
31544
|
+
columnRegistry,
|
|
31545
|
+
initialState: initialState2,
|
|
31546
|
+
tableId,
|
|
31547
|
+
enableMobileVirtualization,
|
|
31548
|
+
virtualizeAt,
|
|
31549
|
+
overscan,
|
|
31550
|
+
toolbarOptions,
|
|
31551
|
+
emptyState,
|
|
31552
|
+
forceEmptyState
|
|
31553
|
+
}
|
|
31554
|
+
) });
|
|
31555
|
+
}
|
|
31556
|
+
function MobileTableInternal({
|
|
31557
|
+
columns,
|
|
31558
|
+
data,
|
|
31559
|
+
loading,
|
|
31560
|
+
columnRegistry,
|
|
31561
|
+
initialState: initialState2,
|
|
31562
|
+
tableId,
|
|
31563
|
+
enableMobileVirtualization = true,
|
|
31564
|
+
virtualizeAt = 500,
|
|
31565
|
+
overscan = 8,
|
|
31566
|
+
toolbarOptions,
|
|
31567
|
+
emptyState,
|
|
31568
|
+
forceEmptyState
|
|
31569
|
+
}) {
|
|
31570
|
+
const { table, globalFilter, setGlobalFilter, handleResetColumns } = useTableController({
|
|
31571
|
+
columns,
|
|
31572
|
+
data,
|
|
31573
|
+
columnRegistry,
|
|
31574
|
+
initialState: initialState2,
|
|
31575
|
+
tableId
|
|
31576
|
+
});
|
|
31577
|
+
const parentRef = React.useRef(null);
|
|
31578
|
+
const rows = table.getRowModel().rows;
|
|
31579
|
+
const shouldVirtualize = !loading && enableMobileVirtualization && rows.length >= virtualizeAt;
|
|
31580
|
+
const virtualizer = useVirtualizer({
|
|
31581
|
+
count: shouldVirtualize ? rows.length : 0,
|
|
31582
|
+
getScrollElement: () => parentRef.current,
|
|
31583
|
+
estimateSize: () => 128,
|
|
31584
|
+
overscan
|
|
31585
|
+
});
|
|
31586
|
+
const isForcedEmpty = !loading && Boolean(forceEmptyState) && Boolean(emptyState);
|
|
31587
|
+
const renderCards = () => {
|
|
31588
|
+
if (loading) {
|
|
31589
|
+
return [0, 1, 2].map((index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
31590
|
+
"div",
|
|
31591
|
+
{
|
|
31592
|
+
className: "mmc-row-card mmc-row-card--skeleton rounded-lg border border-border bg-card p-4 space-y-3",
|
|
31593
|
+
role: "group",
|
|
31594
|
+
"aria-label": "Loading row",
|
|
31595
|
+
"aria-busy": "true",
|
|
31596
|
+
"aria-live": "polite",
|
|
31597
|
+
children: [
|
|
31598
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
31599
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-4 w-1/2" }),
|
|
31600
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-5 w-12" })
|
|
31601
|
+
] }),
|
|
31602
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
|
|
31603
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-3 w-3/4" }),
|
|
31604
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-3 w-2/3" }),
|
|
31605
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-3 w-1/2" })
|
|
31606
|
+
] })
|
|
31607
|
+
]
|
|
31608
|
+
},
|
|
31609
|
+
index2
|
|
31610
|
+
));
|
|
31611
|
+
}
|
|
31612
|
+
if (!rows.length && !isForcedEmpty) {
|
|
31613
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
31614
|
+
"div",
|
|
31615
|
+
{
|
|
31616
|
+
className: "mmc-row-card-list__empty rounded-lg border border-dashed border-border py-10 text-center text-sm text-muted-foreground",
|
|
31617
|
+
role: "status",
|
|
31618
|
+
"aria-live": "polite",
|
|
31619
|
+
children: [
|
|
31620
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "No results" }),
|
|
31621
|
+
"No results."
|
|
31622
|
+
]
|
|
31623
|
+
}
|
|
31624
|
+
);
|
|
31625
|
+
}
|
|
31626
|
+
if (!shouldVirtualize) {
|
|
31627
|
+
return rows.map((row) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
31628
|
+
RowCard,
|
|
31629
|
+
{
|
|
31630
|
+
row,
|
|
31631
|
+
columnRegistry,
|
|
31632
|
+
className: "mmc-row-card--item w-full"
|
|
31633
|
+
},
|
|
31634
|
+
row.id
|
|
31635
|
+
));
|
|
31636
|
+
}
|
|
31637
|
+
const items = virtualizer.getVirtualItems();
|
|
31638
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { height: virtualizer.getTotalSize(), position: "relative" }, children: items.map((vi) => {
|
|
31639
|
+
const row = rows[vi.index];
|
|
31640
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
31641
|
+
"div",
|
|
31642
|
+
{
|
|
31643
|
+
style: {
|
|
31644
|
+
position: "absolute",
|
|
31645
|
+
top: 0,
|
|
31646
|
+
left: 0,
|
|
31647
|
+
right: 0,
|
|
31648
|
+
transform: `translateY(${vi.start}px)`
|
|
31649
|
+
},
|
|
31650
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
31651
|
+
RowCard,
|
|
31652
|
+
{
|
|
31653
|
+
row,
|
|
31654
|
+
columnRegistry,
|
|
31655
|
+
className: "mmc-row-card--item w-full"
|
|
31656
|
+
}
|
|
31657
|
+
)
|
|
31658
|
+
},
|
|
31659
|
+
row.id
|
|
31660
|
+
);
|
|
31661
|
+
}) });
|
|
31662
|
+
};
|
|
31663
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
31664
|
+
"section",
|
|
31665
|
+
{
|
|
31666
|
+
className: "mmc-responsive-table w-full h-full flex flex-col min-h-0 space-y-4",
|
|
31667
|
+
"aria-label": "Data table (mobile)",
|
|
31668
|
+
children: [
|
|
31669
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
31670
|
+
DataTableToolbar,
|
|
31671
|
+
{
|
|
31672
|
+
table,
|
|
31673
|
+
loading,
|
|
31674
|
+
globalFilter,
|
|
31675
|
+
onGlobalFilterChange: setGlobalFilter,
|
|
31676
|
+
onResetColumns: handleResetColumns,
|
|
31677
|
+
columnRegistry,
|
|
31678
|
+
onExport: () => exportTableToCSV(table),
|
|
31679
|
+
options: toolbarOptions
|
|
31680
|
+
}
|
|
31681
|
+
),
|
|
31682
|
+
table.getFilteredSelectedRowModel().rows.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 mb-2 px-1", children: [
|
|
31683
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm", children: [
|
|
31684
|
+
table.getFilteredSelectedRowModel().rows.length,
|
|
31685
|
+
" selected"
|
|
31686
|
+
] }),
|
|
31687
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
31688
|
+
Button$1,
|
|
31689
|
+
{
|
|
31690
|
+
variant: "destructive",
|
|
31691
|
+
size: "sm",
|
|
31692
|
+
onClick: () => {
|
|
31693
|
+
alert(
|
|
31694
|
+
`Delete ${table.getFilteredSelectedRowModel().rows.length} row(s)`
|
|
31695
|
+
);
|
|
31696
|
+
},
|
|
31697
|
+
children: "Delete"
|
|
31698
|
+
}
|
|
31699
|
+
)
|
|
31700
|
+
] }),
|
|
31701
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
31702
|
+
"div",
|
|
31703
|
+
{
|
|
31704
|
+
ref: parentRef,
|
|
31705
|
+
className: "mmc-row-card-list space-y-3 overflow-auto flex-1 min-h-0",
|
|
31706
|
+
role: "list",
|
|
31707
|
+
"aria-label": "Rows",
|
|
31708
|
+
children: isForcedEmpty ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
31709
|
+
"div",
|
|
31710
|
+
{
|
|
31711
|
+
className: "mmc-table-empty flex h-full w-full items-center justify-center",
|
|
31712
|
+
role: "region",
|
|
31713
|
+
"aria-label": "Empty state",
|
|
31714
|
+
children: emptyState
|
|
31715
|
+
}
|
|
31716
|
+
) : renderCards()
|
|
31717
|
+
}
|
|
31718
|
+
),
|
|
31719
|
+
isForcedEmpty ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(DataTablePagination, { table })
|
|
31720
|
+
]
|
|
31721
|
+
}
|
|
31722
|
+
);
|
|
31723
|
+
}
|
|
29979
31724
|
var PROGRESS_NAME = "Progress";
|
|
29980
31725
|
var DEFAULT_MAX = 100;
|
|
29981
31726
|
var [createProgressContext] = createContextScope(PROGRESS_NAME);
|
|
@@ -33660,6 +35405,7 @@ export {
|
|
|
33660
35405
|
CollapsibleTrigger,
|
|
33661
35406
|
DataTable,
|
|
33662
35407
|
DataTablePagination,
|
|
35408
|
+
DataTableToolbar,
|
|
33663
35409
|
DateRangePicker,
|
|
33664
35410
|
Dialog,
|
|
33665
35411
|
DialogClose,
|
|
@@ -33710,6 +35456,7 @@ export {
|
|
|
33710
35456
|
Progress,
|
|
33711
35457
|
RadioGroup$1 as RadioGroup,
|
|
33712
35458
|
RadioGroupItem,
|
|
35459
|
+
ResponsiveTable,
|
|
33713
35460
|
SearchInput,
|
|
33714
35461
|
Select$1 as Select,
|
|
33715
35462
|
SelectContent,
|
|
@@ -33732,6 +35479,7 @@ export {
|
|
|
33732
35479
|
Skeleton,
|
|
33733
35480
|
Slider,
|
|
33734
35481
|
Switch,
|
|
35482
|
+
TABLE_TOKENS,
|
|
33735
35483
|
Table,
|
|
33736
35484
|
TableBody,
|
|
33737
35485
|
TableCaption,
|
|
@@ -33754,11 +35502,25 @@ export {
|
|
|
33754
35502
|
badgeVariants,
|
|
33755
35503
|
buttonVariants,
|
|
33756
35504
|
cn,
|
|
35505
|
+
createBadgeColumn,
|
|
35506
|
+
createColumnDescriptor,
|
|
35507
|
+
createColumnRegistry,
|
|
35508
|
+
createDateColumn,
|
|
35509
|
+
createMultiBadgeColumn,
|
|
35510
|
+
createNumericColumn,
|
|
35511
|
+
createSelectionColumn,
|
|
35512
|
+
createTextColumn,
|
|
33757
35513
|
deactivateCarbideTheme,
|
|
33758
35514
|
deactivateDarkMode,
|
|
35515
|
+
exportTableToCSV,
|
|
33759
35516
|
isCarbideThemeActive,
|
|
33760
35517
|
isDarkModeActive,
|
|
35518
|
+
resolveColumnOrder,
|
|
35519
|
+
resolveColumnVisibility,
|
|
33761
35520
|
toggleCarbideTheme,
|
|
33762
|
-
toggleDarkMode
|
|
35521
|
+
toggleDarkMode,
|
|
35522
|
+
useBreakpoint,
|
|
35523
|
+
useDataTableState,
|
|
35524
|
+
useTableController
|
|
33763
35525
|
};
|
|
33764
35526
|
//# sourceMappingURL=mm-react-components.es.js.map
|