@machinemetrics/mm-react-components 0.2.3-0 → 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 +89 -32
- package/dist/App.d.ts.map +1 -1
- package/dist/README.md +303 -0
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/docs/GETTING_STARTED.md +285 -0
- package/dist/docs/TAILWIND_SETUP.md +8 -1
- package/dist/index.d.ts +6 -3
- 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 +1889 -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 +8 -0
- package/docs/TAILWIND_SETUP.md +8 -1
- package/package.json +25 -4
- package/src/themes/base.css +536 -0
- package/src/themes/complete.css +8 -0
- 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;
|
|
@@ -3916,6 +3916,43 @@ function activateCarbideTheme() {
|
|
|
3916
3916
|
document.documentElement.classList.add("carbide");
|
|
3917
3917
|
}
|
|
3918
3918
|
}
|
|
3919
|
+
function deactivateCarbideTheme() {
|
|
3920
|
+
if (typeof document !== "undefined") {
|
|
3921
|
+
document.documentElement.classList.remove("carbide");
|
|
3922
|
+
}
|
|
3923
|
+
}
|
|
3924
|
+
function toggleCarbideTheme() {
|
|
3925
|
+
if (typeof document !== "undefined") {
|
|
3926
|
+
document.documentElement.classList.toggle("carbide");
|
|
3927
|
+
}
|
|
3928
|
+
}
|
|
3929
|
+
function isCarbideThemeActive() {
|
|
3930
|
+
if (typeof document !== "undefined") {
|
|
3931
|
+
return document.documentElement.classList.contains("carbide");
|
|
3932
|
+
}
|
|
3933
|
+
return false;
|
|
3934
|
+
}
|
|
3935
|
+
function activateDarkMode() {
|
|
3936
|
+
if (typeof document !== "undefined") {
|
|
3937
|
+
document.documentElement.classList.add("dark");
|
|
3938
|
+
}
|
|
3939
|
+
}
|
|
3940
|
+
function deactivateDarkMode() {
|
|
3941
|
+
if (typeof document !== "undefined") {
|
|
3942
|
+
document.documentElement.classList.remove("dark");
|
|
3943
|
+
}
|
|
3944
|
+
}
|
|
3945
|
+
function toggleDarkMode() {
|
|
3946
|
+
if (typeof document !== "undefined") {
|
|
3947
|
+
document.documentElement.classList.toggle("dark");
|
|
3948
|
+
}
|
|
3949
|
+
}
|
|
3950
|
+
function isDarkModeActive() {
|
|
3951
|
+
if (typeof document !== "undefined") {
|
|
3952
|
+
return document.documentElement.classList.contains("dark");
|
|
3953
|
+
}
|
|
3954
|
+
return false;
|
|
3955
|
+
}
|
|
3919
3956
|
var NODES = [
|
|
3920
3957
|
"a",
|
|
3921
3958
|
"button",
|
|
@@ -8065,7 +8102,7 @@ function useCallbackRef$1(initialValue, callback) {
|
|
|
8065
8102
|
ref.callback = callback;
|
|
8066
8103
|
return ref.facade;
|
|
8067
8104
|
}
|
|
8068
|
-
var useIsomorphicLayoutEffect$
|
|
8105
|
+
var useIsomorphicLayoutEffect$3 = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
8069
8106
|
var currentValues = /* @__PURE__ */ new WeakMap();
|
|
8070
8107
|
function useMergeRefs(refs, defaultValue2) {
|
|
8071
8108
|
var callbackRef = useCallbackRef$1(null, function(newValue) {
|
|
@@ -8073,7 +8110,7 @@ function useMergeRefs(refs, defaultValue2) {
|
|
|
8073
8110
|
return assignRef(ref, newValue);
|
|
8074
8111
|
});
|
|
8075
8112
|
});
|
|
8076
|
-
useIsomorphicLayoutEffect$
|
|
8113
|
+
useIsomorphicLayoutEffect$3(function() {
|
|
8077
8114
|
var oldValue = currentValues.get(callbackRef);
|
|
8078
8115
|
if (oldValue) {
|
|
8079
8116
|
var prevRefs_1 = new Set(oldValue);
|
|
@@ -8459,10 +8496,10 @@ var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
|
8459
8496
|
break;
|
|
8460
8497
|
}
|
|
8461
8498
|
var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
|
|
8462
|
-
var
|
|
8463
|
-
if (position ||
|
|
8499
|
+
var elementScroll2 = scroll_1 - capacity - directionFactor * position;
|
|
8500
|
+
if (position || elementScroll2) {
|
|
8464
8501
|
if (elementCouldBeScrolled(axis, target)) {
|
|
8465
|
-
availableScroll +=
|
|
8502
|
+
availableScroll += elementScroll2;
|
|
8466
8503
|
availableScrollTop += position;
|
|
8467
8504
|
}
|
|
8468
8505
|
}
|
|
@@ -15270,7 +15307,7 @@ function testPlatform(re2) {
|
|
|
15270
15307
|
return typeof window !== "undefined" && window.navigator != null ? re2.test(window.navigator.platform) : void 0;
|
|
15271
15308
|
}
|
|
15272
15309
|
const KEYBOARD_BUFFER = 24;
|
|
15273
|
-
const useIsomorphicLayoutEffect$
|
|
15310
|
+
const useIsomorphicLayoutEffect$2 = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
15274
15311
|
function chain$1(...callbacks) {
|
|
15275
15312
|
return (...args) => {
|
|
15276
15313
|
for (let callback of callbacks) {
|
|
@@ -15309,7 +15346,7 @@ let preventScrollCount = 0;
|
|
|
15309
15346
|
let restore;
|
|
15310
15347
|
function usePreventScroll(options = {}) {
|
|
15311
15348
|
let { isDisabled } = options;
|
|
15312
|
-
useIsomorphicLayoutEffect$
|
|
15349
|
+
useIsomorphicLayoutEffect$2(() => {
|
|
15313
15350
|
if (isDisabled) {
|
|
15314
15351
|
return;
|
|
15315
15352
|
}
|
|
@@ -20074,10 +20111,10 @@ function getOwnerDocument(target) {
|
|
|
20074
20111
|
}
|
|
20075
20112
|
return document;
|
|
20076
20113
|
}
|
|
20077
|
-
const useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect;
|
|
20114
|
+
const useIsomorphicLayoutEffect$1 = canUseDOM ? useLayoutEffect : useEffect;
|
|
20078
20115
|
function useEvent(handler) {
|
|
20079
20116
|
const handlerRef = useRef(handler);
|
|
20080
|
-
useIsomorphicLayoutEffect(() => {
|
|
20117
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
20081
20118
|
handlerRef.current = handler;
|
|
20082
20119
|
});
|
|
20083
20120
|
return useCallback(function() {
|
|
@@ -20105,7 +20142,7 @@ function useLatestValue(value, dependencies) {
|
|
|
20105
20142
|
dependencies = [value];
|
|
20106
20143
|
}
|
|
20107
20144
|
const valueRef = useRef(value);
|
|
20108
|
-
useIsomorphicLayoutEffect(() => {
|
|
20145
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
20109
20146
|
if (valueRef.current !== value) {
|
|
20110
20147
|
valueRef.current = value;
|
|
20111
20148
|
}
|
|
@@ -22123,7 +22160,7 @@ function useRect(element, measure, fallbackRect) {
|
|
|
22123
22160
|
const resizeObserver = useResizeObserver({
|
|
22124
22161
|
callback: measureRect
|
|
22125
22162
|
});
|
|
22126
|
-
useIsomorphicLayoutEffect(() => {
|
|
22163
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
22127
22164
|
measureRect();
|
|
22128
22165
|
if (element) {
|
|
22129
22166
|
resizeObserver == null ? void 0 : resizeObserver.observe(element);
|
|
@@ -22297,7 +22334,7 @@ function useRects(elements, measure) {
|
|
|
22297
22334
|
const resizeObserver = useResizeObserver({
|
|
22298
22335
|
callback: measureRects
|
|
22299
22336
|
});
|
|
22300
|
-
useIsomorphicLayoutEffect(() => {
|
|
22337
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
22301
22338
|
resizeObserver == null ? void 0 : resizeObserver.disconnect();
|
|
22302
22339
|
measureRects();
|
|
22303
22340
|
elements.forEach((element) => resizeObserver == null ? void 0 : resizeObserver.observe(element));
|
|
@@ -22659,7 +22696,7 @@ function useLayoutShiftScrollCompensation(_ref) {
|
|
|
22659
22696
|
x: config,
|
|
22660
22697
|
y: config
|
|
22661
22698
|
} : config;
|
|
22662
|
-
useIsomorphicLayoutEffect(() => {
|
|
22699
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
22663
22700
|
const disabled = !x && !y;
|
|
22664
22701
|
if (disabled || !activeNode) {
|
|
22665
22702
|
initialized.current = false;
|
|
@@ -22703,7 +22740,7 @@ var Status;
|
|
|
22703
22740
|
Status2[Status2["Initializing"] = 1] = "Initializing";
|
|
22704
22741
|
Status2[Status2["Initialized"] = 2] = "Initialized";
|
|
22705
22742
|
})(Status || (Status = {}));
|
|
22706
|
-
const DndContext = /* @__PURE__ */ memo$
|
|
22743
|
+
const DndContext = /* @__PURE__ */ memo$2(function DndContext2(_ref) {
|
|
22707
22744
|
var _sensorContext$curren, _dragOverlay$nodeRef$, _dragOverlay$rect, _over$rect;
|
|
22708
22745
|
let {
|
|
22709
22746
|
id,
|
|
@@ -23020,7 +23057,7 @@ const DndContext = /* @__PURE__ */ memo$1(function DndContext2(_ref) {
|
|
|
23020
23057
|
}, [draggableNodes, instantiateSensor]);
|
|
23021
23058
|
const activators = useCombineActivators(sensors, bindActivatorToSensorInstantiator);
|
|
23022
23059
|
useSensorSetup(sensors);
|
|
23023
|
-
useIsomorphicLayoutEffect(() => {
|
|
23060
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
23024
23061
|
if (activeNodeRect && status === Status.Initializing) {
|
|
23025
23062
|
setStatus(Status.Initialized);
|
|
23026
23063
|
}
|
|
@@ -23104,7 +23141,7 @@ const DndContext = /* @__PURE__ */ memo$1(function DndContext2(_ref) {
|
|
|
23104
23141
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
23105
23142
|
[overId]
|
|
23106
23143
|
);
|
|
23107
|
-
useIsomorphicLayoutEffect(() => {
|
|
23144
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
23108
23145
|
sensorContext.current = {
|
|
23109
23146
|
activatorEvent,
|
|
23110
23147
|
active,
|
|
@@ -23231,7 +23268,7 @@ function useDraggable(_ref) {
|
|
|
23231
23268
|
const [activatorNode, setActivatorNodeRef] = useNodeRef();
|
|
23232
23269
|
const listeners = useSyntheticListeners(activators, id);
|
|
23233
23270
|
const dataRef = useLatestValue(data);
|
|
23234
|
-
useIsomorphicLayoutEffect(
|
|
23271
|
+
useIsomorphicLayoutEffect$1(
|
|
23235
23272
|
() => {
|
|
23236
23273
|
draggableNodes.set(id, {
|
|
23237
23274
|
id,
|
|
@@ -23615,7 +23652,7 @@ function SortableContext(_ref) {
|
|
|
23615
23652
|
const itemsHaveChanged = !itemsEqual(items, previousItemsRef.current);
|
|
23616
23653
|
const disableTransforms = overIndex !== -1 && activeIndex === -1 || itemsHaveChanged;
|
|
23617
23654
|
const disabled = normalizeDisabled(disabledProp);
|
|
23618
|
-
useIsomorphicLayoutEffect(() => {
|
|
23655
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
23619
23656
|
if (itemsHaveChanged && isDragging) {
|
|
23620
23657
|
measureDroppableContainers(items);
|
|
23621
23658
|
}
|
|
@@ -23696,7 +23733,7 @@ function useDerivedTransform(_ref) {
|
|
|
23696
23733
|
} = _ref;
|
|
23697
23734
|
const [derivedTransform, setDerivedtransform] = useState(null);
|
|
23698
23735
|
const previousIndex = useRef(index2);
|
|
23699
|
-
useIsomorphicLayoutEffect(() => {
|
|
23736
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
23700
23737
|
if (!disabled && index2 !== previousIndex.current && node.current) {
|
|
23701
23738
|
const initial = rect.current;
|
|
23702
23739
|
if (initial) {
|
|
@@ -24120,7 +24157,7 @@ function flattenBy(arr, getChildren) {
|
|
|
24120
24157
|
recurse(arr);
|
|
24121
24158
|
return flat;
|
|
24122
24159
|
}
|
|
24123
|
-
function memo(getDeps, fn, opts) {
|
|
24160
|
+
function memo$1(getDeps, fn, opts) {
|
|
24124
24161
|
let deps = [];
|
|
24125
24162
|
let result;
|
|
24126
24163
|
return (depArgs) => {
|
|
@@ -24178,7 +24215,7 @@ function createCell(table, row, column, columnId) {
|
|
|
24178
24215
|
column,
|
|
24179
24216
|
getValue: () => row.getValue(columnId),
|
|
24180
24217
|
renderValue: getRenderValue,
|
|
24181
|
-
getContext: memo(() => [table, column, row, cell], (table2, column2, row2, cell2) => ({
|
|
24218
|
+
getContext: memo$1(() => [table, column, row, cell], (table2, column2, row2, cell2) => ({
|
|
24182
24219
|
table: table2,
|
|
24183
24220
|
column: column2,
|
|
24184
24221
|
row: row2,
|
|
@@ -24234,11 +24271,11 @@ function createColumn(table, columnDef, depth, parent) {
|
|
|
24234
24271
|
depth,
|
|
24235
24272
|
columnDef: resolvedColumnDef,
|
|
24236
24273
|
columns: [],
|
|
24237
|
-
getFlatColumns: memo(() => [true], () => {
|
|
24274
|
+
getFlatColumns: memo$1(() => [true], () => {
|
|
24238
24275
|
var _column$columns;
|
|
24239
24276
|
return [column, ...(_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap((d) => d.getFlatColumns())];
|
|
24240
24277
|
}, getMemoOptions(table.options, "debugColumns", "column.getFlatColumns")),
|
|
24241
|
-
getLeafColumns: memo(() => [table._getOrderColumnsFn()], (orderColumns2) => {
|
|
24278
|
+
getLeafColumns: memo$1(() => [table._getOrderColumnsFn()], (orderColumns2) => {
|
|
24242
24279
|
var _column$columns2;
|
|
24243
24280
|
if ((_column$columns2 = column.columns) != null && _column$columns2.length) {
|
|
24244
24281
|
let leafColumns = column.columns.flatMap((column2) => column2.getLeafColumns());
|
|
@@ -24291,7 +24328,7 @@ function createHeader(table, column, options) {
|
|
|
24291
24328
|
}
|
|
24292
24329
|
const Headers = {
|
|
24293
24330
|
createTable: (table) => {
|
|
24294
|
-
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) => {
|
|
24295
24332
|
var _left$map$filter, _right$map$filter;
|
|
24296
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 : [];
|
|
24297
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 : [];
|
|
@@ -24299,71 +24336,71 @@ const Headers = {
|
|
|
24299
24336
|
const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table);
|
|
24300
24337
|
return headerGroups;
|
|
24301
24338
|
}, getMemoOptions(table.options, debug, "getHeaderGroups"));
|
|
24302
|
-
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) => {
|
|
24303
24340
|
leafColumns = leafColumns.filter((column) => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
|
|
24304
24341
|
return buildHeaderGroups(allColumns, leafColumns, table, "center");
|
|
24305
24342
|
}, getMemoOptions(table.options, debug, "getCenterHeaderGroups"));
|
|
24306
|
-
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) => {
|
|
24307
24344
|
var _left$map$filter2;
|
|
24308
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 : [];
|
|
24309
24346
|
return buildHeaderGroups(allColumns, orderedLeafColumns, table, "left");
|
|
24310
24347
|
}, getMemoOptions(table.options, debug, "getLeftHeaderGroups"));
|
|
24311
|
-
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) => {
|
|
24312
24349
|
var _right$map$filter2;
|
|
24313
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 : [];
|
|
24314
24351
|
return buildHeaderGroups(allColumns, orderedLeafColumns, table, "right");
|
|
24315
24352
|
}, getMemoOptions(table.options, debug, "getRightHeaderGroups"));
|
|
24316
|
-
table.getFooterGroups = memo(() => [table.getHeaderGroups()], (headerGroups) => {
|
|
24353
|
+
table.getFooterGroups = memo$1(() => [table.getHeaderGroups()], (headerGroups) => {
|
|
24317
24354
|
return [...headerGroups].reverse();
|
|
24318
24355
|
}, getMemoOptions(table.options, debug, "getFooterGroups"));
|
|
24319
|
-
table.getLeftFooterGroups = memo(() => [table.getLeftHeaderGroups()], (headerGroups) => {
|
|
24356
|
+
table.getLeftFooterGroups = memo$1(() => [table.getLeftHeaderGroups()], (headerGroups) => {
|
|
24320
24357
|
return [...headerGroups].reverse();
|
|
24321
24358
|
}, getMemoOptions(table.options, debug, "getLeftFooterGroups"));
|
|
24322
|
-
table.getCenterFooterGroups = memo(() => [table.getCenterHeaderGroups()], (headerGroups) => {
|
|
24359
|
+
table.getCenterFooterGroups = memo$1(() => [table.getCenterHeaderGroups()], (headerGroups) => {
|
|
24323
24360
|
return [...headerGroups].reverse();
|
|
24324
24361
|
}, getMemoOptions(table.options, debug, "getCenterFooterGroups"));
|
|
24325
|
-
table.getRightFooterGroups = memo(() => [table.getRightHeaderGroups()], (headerGroups) => {
|
|
24362
|
+
table.getRightFooterGroups = memo$1(() => [table.getRightHeaderGroups()], (headerGroups) => {
|
|
24326
24363
|
return [...headerGroups].reverse();
|
|
24327
24364
|
}, getMemoOptions(table.options, debug, "getRightFooterGroups"));
|
|
24328
|
-
table.getFlatHeaders = memo(() => [table.getHeaderGroups()], (headerGroups) => {
|
|
24365
|
+
table.getFlatHeaders = memo$1(() => [table.getHeaderGroups()], (headerGroups) => {
|
|
24329
24366
|
return headerGroups.map((headerGroup) => {
|
|
24330
24367
|
return headerGroup.headers;
|
|
24331
24368
|
}).flat();
|
|
24332
24369
|
}, getMemoOptions(table.options, debug, "getFlatHeaders"));
|
|
24333
|
-
table.getLeftFlatHeaders = memo(() => [table.getLeftHeaderGroups()], (left) => {
|
|
24370
|
+
table.getLeftFlatHeaders = memo$1(() => [table.getLeftHeaderGroups()], (left) => {
|
|
24334
24371
|
return left.map((headerGroup) => {
|
|
24335
24372
|
return headerGroup.headers;
|
|
24336
24373
|
}).flat();
|
|
24337
24374
|
}, getMemoOptions(table.options, debug, "getLeftFlatHeaders"));
|
|
24338
|
-
table.getCenterFlatHeaders = memo(() => [table.getCenterHeaderGroups()], (left) => {
|
|
24375
|
+
table.getCenterFlatHeaders = memo$1(() => [table.getCenterHeaderGroups()], (left) => {
|
|
24339
24376
|
return left.map((headerGroup) => {
|
|
24340
24377
|
return headerGroup.headers;
|
|
24341
24378
|
}).flat();
|
|
24342
24379
|
}, getMemoOptions(table.options, debug, "getCenterFlatHeaders"));
|
|
24343
|
-
table.getRightFlatHeaders = memo(() => [table.getRightHeaderGroups()], (left) => {
|
|
24380
|
+
table.getRightFlatHeaders = memo$1(() => [table.getRightHeaderGroups()], (left) => {
|
|
24344
24381
|
return left.map((headerGroup) => {
|
|
24345
24382
|
return headerGroup.headers;
|
|
24346
24383
|
}).flat();
|
|
24347
24384
|
}, getMemoOptions(table.options, debug, "getRightFlatHeaders"));
|
|
24348
|
-
table.getCenterLeafHeaders = memo(() => [table.getCenterFlatHeaders()], (flatHeaders) => {
|
|
24385
|
+
table.getCenterLeafHeaders = memo$1(() => [table.getCenterFlatHeaders()], (flatHeaders) => {
|
|
24349
24386
|
return flatHeaders.filter((header) => {
|
|
24350
24387
|
var _header$subHeaders;
|
|
24351
24388
|
return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length);
|
|
24352
24389
|
});
|
|
24353
24390
|
}, getMemoOptions(table.options, debug, "getCenterLeafHeaders"));
|
|
24354
|
-
table.getLeftLeafHeaders = memo(() => [table.getLeftFlatHeaders()], (flatHeaders) => {
|
|
24391
|
+
table.getLeftLeafHeaders = memo$1(() => [table.getLeftFlatHeaders()], (flatHeaders) => {
|
|
24355
24392
|
return flatHeaders.filter((header) => {
|
|
24356
24393
|
var _header$subHeaders2;
|
|
24357
24394
|
return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length);
|
|
24358
24395
|
});
|
|
24359
24396
|
}, getMemoOptions(table.options, debug, "getLeftLeafHeaders"));
|
|
24360
|
-
table.getRightLeafHeaders = memo(() => [table.getRightFlatHeaders()], (flatHeaders) => {
|
|
24397
|
+
table.getRightLeafHeaders = memo$1(() => [table.getRightFlatHeaders()], (flatHeaders) => {
|
|
24361
24398
|
return flatHeaders.filter((header) => {
|
|
24362
24399
|
var _header$subHeaders3;
|
|
24363
24400
|
return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length);
|
|
24364
24401
|
});
|
|
24365
24402
|
}, getMemoOptions(table.options, debug, "getRightLeafHeaders"));
|
|
24366
|
-
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) => {
|
|
24367
24404
|
var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;
|
|
24368
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) => {
|
|
24369
24406
|
return header.getLeafHeaders();
|
|
@@ -24518,12 +24555,12 @@ const createRow = (table, id, original, rowIndex, depth, subRows, parentId) => {
|
|
|
24518
24555
|
}
|
|
24519
24556
|
return parentRows.reverse();
|
|
24520
24557
|
},
|
|
24521
|
-
getAllCells: memo(() => [table.getAllLeafColumns()], (leafColumns) => {
|
|
24558
|
+
getAllCells: memo$1(() => [table.getAllLeafColumns()], (leafColumns) => {
|
|
24522
24559
|
return leafColumns.map((column) => {
|
|
24523
24560
|
return createCell(table, row, column, column.id);
|
|
24524
24561
|
});
|
|
24525
24562
|
}, getMemoOptions(table.options, "debugRows", "getAllCells")),
|
|
24526
|
-
_getAllCellsByColumnId: memo(() => [row.getAllCells()], (allCells) => {
|
|
24563
|
+
_getAllCellsByColumnId: memo$1(() => [row.getAllCells()], (allCells) => {
|
|
24527
24564
|
return allCells.reduce((acc, cell) => {
|
|
24528
24565
|
acc[cell.column.id] = cell;
|
|
24529
24566
|
return acc;
|
|
@@ -24989,7 +25026,7 @@ const ColumnOrdering = {
|
|
|
24989
25026
|
};
|
|
24990
25027
|
},
|
|
24991
25028
|
createColumn: (column, table) => {
|
|
24992
|
-
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"));
|
|
24993
25030
|
column.getIsFirstColumn = (position) => {
|
|
24994
25031
|
var _columns$;
|
|
24995
25032
|
const columns = _getVisibleLeafColumns(table, position);
|
|
@@ -25007,7 +25044,7 @@ const ColumnOrdering = {
|
|
|
25007
25044
|
var _table$initialState$c;
|
|
25008
25045
|
table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []);
|
|
25009
25046
|
};
|
|
25010
|
-
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) => {
|
|
25011
25048
|
let orderedColumns = [];
|
|
25012
25049
|
if (!(columnOrder != null && columnOrder.length)) {
|
|
25013
25050
|
orderedColumns = columns;
|
|
@@ -25092,18 +25129,18 @@ const ColumnPinning = {
|
|
|
25092
25129
|
};
|
|
25093
25130
|
},
|
|
25094
25131
|
createRow: (row, table) => {
|
|
25095
|
-
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) => {
|
|
25096
25133
|
const leftAndRight = [...left != null ? left : [], ...right != null ? right : []];
|
|
25097
25134
|
return allCells.filter((d) => !leftAndRight.includes(d.column.id));
|
|
25098
25135
|
}, getMemoOptions(table.options, "debugRows", "getCenterVisibleCells"));
|
|
25099
|
-
row.getLeftVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left], (allCells, left) => {
|
|
25136
|
+
row.getLeftVisibleCells = memo$1(() => [row._getAllVisibleCells(), table.getState().columnPinning.left], (allCells, left) => {
|
|
25100
25137
|
const cells = (left != null ? left : []).map((columnId) => allCells.find((cell) => cell.column.id === columnId)).filter(Boolean).map((d) => ({
|
|
25101
25138
|
...d,
|
|
25102
25139
|
position: "left"
|
|
25103
25140
|
}));
|
|
25104
25141
|
return cells;
|
|
25105
25142
|
}, getMemoOptions(table.options, "debugRows", "getLeftVisibleCells"));
|
|
25106
|
-
row.getRightVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => {
|
|
25143
|
+
row.getRightVisibleCells = memo$1(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => {
|
|
25107
25144
|
const cells = (right != null ? right : []).map((columnId) => allCells.find((cell) => cell.column.id === columnId)).filter(Boolean).map((d) => ({
|
|
25108
25145
|
...d,
|
|
25109
25146
|
position: "right"
|
|
@@ -25126,13 +25163,13 @@ const ColumnPinning = {
|
|
|
25126
25163
|
}
|
|
25127
25164
|
return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
|
|
25128
25165
|
};
|
|
25129
|
-
table.getLeftLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => {
|
|
25166
|
+
table.getLeftLeafColumns = memo$1(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => {
|
|
25130
25167
|
return (left != null ? left : []).map((columnId) => allColumns.find((column) => column.id === columnId)).filter(Boolean);
|
|
25131
25168
|
}, getMemoOptions(table.options, "debugColumns", "getLeftLeafColumns"));
|
|
25132
|
-
table.getRightLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => {
|
|
25169
|
+
table.getRightLeafColumns = memo$1(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => {
|
|
25133
25170
|
return (right != null ? right : []).map((columnId) => allColumns.find((column) => column.id === columnId)).filter(Boolean);
|
|
25134
25171
|
}, getMemoOptions(table.options, "debugColumns", "getRightLeafColumns"));
|
|
25135
|
-
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) => {
|
|
25136
25173
|
const leftAndRight = [...left != null ? left : [], ...right != null ? right : []];
|
|
25137
25174
|
return allColumns.filter((d) => !leftAndRight.includes(d.id));
|
|
25138
25175
|
}, getMemoOptions(table.options, "debugColumns", "getCenterLeafColumns"));
|
|
@@ -25179,8 +25216,8 @@ const ColumnSizing = {
|
|
|
25179
25216
|
const columnSize = table.getState().columnSizing[column.id];
|
|
25180
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);
|
|
25181
25218
|
};
|
|
25182
|
-
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"));
|
|
25183
|
-
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"));
|
|
25184
25221
|
column.resetSize = () => {
|
|
25185
25222
|
table.setColumnSizing((_ref2) => {
|
|
25186
25223
|
let {
|
|
@@ -25424,14 +25461,14 @@ const ColumnVisibility = {
|
|
|
25424
25461
|
};
|
|
25425
25462
|
},
|
|
25426
25463
|
createRow: (row, table) => {
|
|
25427
|
-
row._getAllVisibleCells = memo(() => [row.getAllCells(), table.getState().columnVisibility], (cells) => {
|
|
25464
|
+
row._getAllVisibleCells = memo$1(() => [row.getAllCells(), table.getState().columnVisibility], (cells) => {
|
|
25428
25465
|
return cells.filter((cell) => cell.column.getIsVisible());
|
|
25429
25466
|
}, getMemoOptions(table.options, "debugRows", "_getAllVisibleCells"));
|
|
25430
|
-
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"));
|
|
25431
25468
|
},
|
|
25432
25469
|
createTable: (table) => {
|
|
25433
25470
|
const makeVisibleColumnsMethod = (key, getColumns) => {
|
|
25434
|
-
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) => {
|
|
25435
25472
|
return columns.filter((d) => d.getIsVisible == null ? void 0 : d.getIsVisible());
|
|
25436
25473
|
}, getMemoOptions(table.options, "debugColumns", key));
|
|
25437
25474
|
};
|
|
@@ -25776,7 +25813,7 @@ const RowPagination = {
|
|
|
25776
25813
|
pageCount: newPageCount
|
|
25777
25814
|
};
|
|
25778
25815
|
});
|
|
25779
|
-
table.getPageOptions = memo(() => [table.getPageCount()], (pageCount) => {
|
|
25816
|
+
table.getPageOptions = memo$1(() => [table.getPageCount()], (pageCount) => {
|
|
25780
25817
|
let pageOptions = [];
|
|
25781
25818
|
if (pageCount && pageCount > 0) {
|
|
25782
25819
|
pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i);
|
|
@@ -25951,9 +25988,9 @@ const RowPinning = {
|
|
|
25951
25988
|
position
|
|
25952
25989
|
}));
|
|
25953
25990
|
};
|
|
25954
|
-
table.getTopRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.top], (allRows, topPinnedRowIds) => table._getPinnedRows(allRows, topPinnedRowIds, "top"), getMemoOptions(table.options, "debugRows", "getTopRows"));
|
|
25955
|
-
table.getBottomRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.bottom], (allRows, bottomPinnedRowIds) => table._getPinnedRows(allRows, bottomPinnedRowIds, "bottom"), getMemoOptions(table.options, "debugRows", "getBottomRows"));
|
|
25956
|
-
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) => {
|
|
25957
25994
|
const topAndBottom = /* @__PURE__ */ new Set([...top != null ? top : [], ...bottom != null ? bottom : []]);
|
|
25958
25995
|
return allRows.filter((d) => !topAndBottom.has(d.id));
|
|
25959
25996
|
}, getMemoOptions(table.options, "debugRows", "getCenterRows"));
|
|
@@ -26016,7 +26053,7 @@ const RowSelection = {
|
|
|
26016
26053
|
return rowSelection;
|
|
26017
26054
|
});
|
|
26018
26055
|
table.getPreSelectedRowModel = () => table.getCoreRowModel();
|
|
26019
|
-
table.getSelectedRowModel = memo(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => {
|
|
26056
|
+
table.getSelectedRowModel = memo$1(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => {
|
|
26020
26057
|
if (!Object.keys(rowSelection).length) {
|
|
26021
26058
|
return {
|
|
26022
26059
|
rows: [],
|
|
@@ -26026,7 +26063,7 @@ const RowSelection = {
|
|
|
26026
26063
|
}
|
|
26027
26064
|
return selectRowsFn(table, rowModel);
|
|
26028
26065
|
}, getMemoOptions(table.options, "debugTable", "getSelectedRowModel"));
|
|
26029
|
-
table.getFilteredSelectedRowModel = memo(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => {
|
|
26066
|
+
table.getFilteredSelectedRowModel = memo$1(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => {
|
|
26030
26067
|
if (!Object.keys(rowSelection).length) {
|
|
26031
26068
|
return {
|
|
26032
26069
|
rows: [],
|
|
@@ -26036,7 +26073,7 @@ const RowSelection = {
|
|
|
26036
26073
|
}
|
|
26037
26074
|
return selectRowsFn(table, rowModel);
|
|
26038
26075
|
}, getMemoOptions(table.options, "debugTable", "getFilteredSelectedRowModel"));
|
|
26039
|
-
table.getGroupedSelectedRowModel = memo(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => {
|
|
26076
|
+
table.getGroupedSelectedRowModel = memo$1(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => {
|
|
26040
26077
|
if (!Object.keys(rowSelection).length) {
|
|
26041
26078
|
return {
|
|
26042
26079
|
rows: [],
|
|
@@ -26605,7 +26642,7 @@ function createTable(options) {
|
|
|
26605
26642
|
}
|
|
26606
26643
|
return row;
|
|
26607
26644
|
},
|
|
26608
|
-
_getDefaultColumnDef: memo(() => [table.options.defaultColumn], (defaultColumn) => {
|
|
26645
|
+
_getDefaultColumnDef: memo$1(() => [table.options.defaultColumn], (defaultColumn) => {
|
|
26609
26646
|
var _defaultColumn;
|
|
26610
26647
|
defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
|
|
26611
26648
|
return {
|
|
@@ -26631,7 +26668,7 @@ function createTable(options) {
|
|
|
26631
26668
|
};
|
|
26632
26669
|
}, getMemoOptions(options, "debugColumns", "_getDefaultColumnDef")),
|
|
26633
26670
|
_getColumnDefs: () => table.options.columns,
|
|
26634
|
-
getAllColumns: memo(() => [table._getColumnDefs()], (columnDefs) => {
|
|
26671
|
+
getAllColumns: memo$1(() => [table._getColumnDefs()], (columnDefs) => {
|
|
26635
26672
|
const recurseColumns = function(columnDefs2, parent, depth) {
|
|
26636
26673
|
if (depth === void 0) {
|
|
26637
26674
|
depth = 0;
|
|
@@ -26645,18 +26682,18 @@ function createTable(options) {
|
|
|
26645
26682
|
};
|
|
26646
26683
|
return recurseColumns(columnDefs);
|
|
26647
26684
|
}, getMemoOptions(options, "debugColumns", "getAllColumns")),
|
|
26648
|
-
getAllFlatColumns: memo(() => [table.getAllColumns()], (allColumns) => {
|
|
26685
|
+
getAllFlatColumns: memo$1(() => [table.getAllColumns()], (allColumns) => {
|
|
26649
26686
|
return allColumns.flatMap((column) => {
|
|
26650
26687
|
return column.getFlatColumns();
|
|
26651
26688
|
});
|
|
26652
26689
|
}, getMemoOptions(options, "debugColumns", "getAllFlatColumns")),
|
|
26653
|
-
_getAllFlatColumnsById: memo(() => [table.getAllFlatColumns()], (flatColumns) => {
|
|
26690
|
+
_getAllFlatColumnsById: memo$1(() => [table.getAllFlatColumns()], (flatColumns) => {
|
|
26654
26691
|
return flatColumns.reduce((acc, column) => {
|
|
26655
26692
|
acc[column.id] = column;
|
|
26656
26693
|
return acc;
|
|
26657
26694
|
}, {});
|
|
26658
26695
|
}, getMemoOptions(options, "debugColumns", "getAllFlatColumnsById")),
|
|
26659
|
-
getAllLeafColumns: memo(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns2) => {
|
|
26696
|
+
getAllLeafColumns: memo$1(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns2) => {
|
|
26660
26697
|
let leafColumns = allColumns.flatMap((column) => column.getLeafColumns());
|
|
26661
26698
|
return orderColumns2(leafColumns);
|
|
26662
26699
|
}, getMemoOptions(options, "debugColumns", "getAllLeafColumns")),
|
|
@@ -26676,7 +26713,7 @@ function createTable(options) {
|
|
|
26676
26713
|
return table;
|
|
26677
26714
|
}
|
|
26678
26715
|
function getCoreRowModel() {
|
|
26679
|
-
return (table) => memo(() => [table.options.data], (data) => {
|
|
26716
|
+
return (table) => memo$1(() => [table.options.data], (data) => {
|
|
26680
26717
|
const rowModel = {
|
|
26681
26718
|
rows: [],
|
|
26682
26719
|
flatRows: [],
|
|
@@ -26809,7 +26846,7 @@ function filterRowModelFromRoot(rowsToFilter, filterRow, table) {
|
|
|
26809
26846
|
};
|
|
26810
26847
|
}
|
|
26811
26848
|
function getFacetedRowModel() {
|
|
26812
|
-
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) => {
|
|
26813
26850
|
if (!preRowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
|
|
26814
26851
|
return preRowModel;
|
|
26815
26852
|
}
|
|
@@ -26826,7 +26863,7 @@ function getFacetedRowModel() {
|
|
|
26826
26863
|
}, getMemoOptions(table.options, "debugTable", "getFacetedRowModel"));
|
|
26827
26864
|
}
|
|
26828
26865
|
function getFacetedUniqueValues() {
|
|
26829
|
-
return (table, columnId) => memo(() => {
|
|
26866
|
+
return (table, columnId) => memo$1(() => {
|
|
26830
26867
|
var _table$getColumn;
|
|
26831
26868
|
return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()];
|
|
26832
26869
|
}, (facetedRowModel) => {
|
|
@@ -26848,7 +26885,7 @@ function getFacetedUniqueValues() {
|
|
|
26848
26885
|
}, getMemoOptions(table.options, "debugTable", `getFacetedUniqueValues_${columnId}`));
|
|
26849
26886
|
}
|
|
26850
26887
|
function getFilteredRowModel() {
|
|
26851
|
-
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) => {
|
|
26852
26889
|
if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
|
|
26853
26890
|
for (let i = 0; i < rowModel.flatRows.length; i++) {
|
|
26854
26891
|
rowModel.flatRows[i].columnFilters = {};
|
|
@@ -26933,7 +26970,7 @@ function getFilteredRowModel() {
|
|
|
26933
26970
|
}, getMemoOptions(table.options, "debugTable", "getFilteredRowModel", () => table._autoResetPageIndex()));
|
|
26934
26971
|
}
|
|
26935
26972
|
function getPaginationRowModel(opts) {
|
|
26936
|
-
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) => {
|
|
26937
26974
|
if (!rowModel.rows.length) {
|
|
26938
26975
|
return rowModel;
|
|
26939
26976
|
}
|
|
@@ -26975,7 +27012,7 @@ function getPaginationRowModel(opts) {
|
|
|
26975
27012
|
}, getMemoOptions(table.options, "debugTable", "getPaginationRowModel"));
|
|
26976
27013
|
}
|
|
26977
27014
|
function getSortedRowModel() {
|
|
26978
|
-
return (table) => memo(() => [table.getState().sorting, table.getPreSortedRowModel()], (sorting, rowModel) => {
|
|
27015
|
+
return (table) => memo$1(() => [table.getState().sorting, table.getPreSortedRowModel()], (sorting, rowModel) => {
|
|
26979
27016
|
if (!rowModel.rows.length || !(sorting != null && sorting.length)) {
|
|
26980
27017
|
return rowModel;
|
|
26981
27018
|
}
|
|
@@ -29014,6 +29051,25 @@ function DataTableToolbar({
|
|
|
29014
29051
|
opts.belowControls ?? null
|
|
29015
29052
|
] });
|
|
29016
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
|
+
}
|
|
29017
29073
|
function resolveColumnOrder(registry, preferredOrder = []) {
|
|
29018
29074
|
if (preferredOrder.length) return preferredOrder;
|
|
29019
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));
|
|
@@ -29095,6 +29151,22 @@ function useDataTableState(config = {}) {
|
|
|
29095
29151
|
rowSelection: [rowSelection, setRowSelection]
|
|
29096
29152
|
};
|
|
29097
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
|
+
}
|
|
29098
29170
|
function useTableController(options) {
|
|
29099
29171
|
const { columns, data, columnRegistry, initialState: initialState2, tableId } = options;
|
|
29100
29172
|
const storageKey = tableId ? `mmrc:table:${tableId}` : void 0;
|
|
@@ -29284,6 +29356,10 @@ function exportTableToCSV(table, filename = "data.csv") {
|
|
|
29284
29356
|
URL.revokeObjectURL(url);
|
|
29285
29357
|
}
|
|
29286
29358
|
const TABLE_TOKENS = {
|
|
29359
|
+
defaultColumnWidth: 160,
|
|
29360
|
+
minColumnWidth: 96,
|
|
29361
|
+
maxColumnWidth: 420,
|
|
29362
|
+
toolbarGap: 8,
|
|
29287
29363
|
selectionColumnWidth: 44,
|
|
29288
29364
|
actionsColumnWidth: 64
|
|
29289
29365
|
};
|
|
@@ -29854,6 +29930,1494 @@ function DataTable({
|
|
|
29854
29930
|
isForcedEmpty ? null : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "border-t border-border bg-[var(--tablehead-bg)]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DataTablePagination, { table }) })
|
|
29855
29931
|
] });
|
|
29856
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
|
+
}
|
|
29857
31421
|
React.createContext(void 0);
|
|
29858
31422
|
const TableHead = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
29859
31423
|
"th",
|
|
@@ -29939,6 +31503,224 @@ const TableContainer = React.forwardRef(({ className, children, autoHeight = tru
|
|
|
29939
31503
|
);
|
|
29940
31504
|
});
|
|
29941
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
|
+
}
|
|
29942
31724
|
var PROGRESS_NAME = "Progress";
|
|
29943
31725
|
var DEFAULT_MAX = 100;
|
|
29944
31726
|
var [createProgressContext] = createContextScope(PROGRESS_NAME);
|
|
@@ -33610,6 +35392,10 @@ const DropzoneEmptyState = ({
|
|
|
33610
35392
|
] });
|
|
33611
35393
|
};
|
|
33612
35394
|
export {
|
|
35395
|
+
Accordion,
|
|
35396
|
+
AccordionContent,
|
|
35397
|
+
AccordionItem,
|
|
35398
|
+
AccordionTrigger,
|
|
33613
35399
|
Badge,
|
|
33614
35400
|
Button$1 as Button,
|
|
33615
35401
|
Calendar,
|
|
@@ -33619,6 +35405,8 @@ export {
|
|
|
33619
35405
|
CollapsibleTrigger,
|
|
33620
35406
|
DataTable,
|
|
33621
35407
|
DataTablePagination,
|
|
35408
|
+
DataTableToolbar,
|
|
35409
|
+
DateRangePicker,
|
|
33622
35410
|
Dialog,
|
|
33623
35411
|
DialogClose,
|
|
33624
35412
|
DialogContent,
|
|
@@ -33662,9 +35450,13 @@ export {
|
|
|
33662
35450
|
Label$2 as Label,
|
|
33663
35451
|
LabeledSlider,
|
|
33664
35452
|
PageHeader,
|
|
35453
|
+
Popover,
|
|
35454
|
+
PopoverContent,
|
|
35455
|
+
PopoverTrigger,
|
|
33665
35456
|
Progress,
|
|
33666
35457
|
RadioGroup$1 as RadioGroup,
|
|
33667
35458
|
RadioGroupItem,
|
|
35459
|
+
ResponsiveTable,
|
|
33668
35460
|
SearchInput,
|
|
33669
35461
|
Select$1 as Select,
|
|
33670
35462
|
SelectContent,
|
|
@@ -33687,6 +35479,7 @@ export {
|
|
|
33687
35479
|
Skeleton,
|
|
33688
35480
|
Slider,
|
|
33689
35481
|
Switch,
|
|
35482
|
+
TABLE_TOKENS,
|
|
33690
35483
|
Table,
|
|
33691
35484
|
TableBody,
|
|
33692
35485
|
TableCaption,
|
|
@@ -33705,8 +35498,29 @@ export {
|
|
|
33705
35498
|
TooltipProvider,
|
|
33706
35499
|
TooltipTrigger,
|
|
33707
35500
|
activateCarbideTheme,
|
|
35501
|
+
activateDarkMode,
|
|
33708
35502
|
badgeVariants,
|
|
33709
35503
|
buttonVariants,
|
|
33710
|
-
cn
|
|
35504
|
+
cn,
|
|
35505
|
+
createBadgeColumn,
|
|
35506
|
+
createColumnDescriptor,
|
|
35507
|
+
createColumnRegistry,
|
|
35508
|
+
createDateColumn,
|
|
35509
|
+
createMultiBadgeColumn,
|
|
35510
|
+
createNumericColumn,
|
|
35511
|
+
createSelectionColumn,
|
|
35512
|
+
createTextColumn,
|
|
35513
|
+
deactivateCarbideTheme,
|
|
35514
|
+
deactivateDarkMode,
|
|
35515
|
+
exportTableToCSV,
|
|
35516
|
+
isCarbideThemeActive,
|
|
35517
|
+
isDarkModeActive,
|
|
35518
|
+
resolveColumnOrder,
|
|
35519
|
+
resolveColumnVisibility,
|
|
35520
|
+
toggleCarbideTheme,
|
|
35521
|
+
toggleDarkMode,
|
|
35522
|
+
useBreakpoint,
|
|
35523
|
+
useDataTableState,
|
|
35524
|
+
useTableController
|
|
33711
35525
|
};
|
|
33712
35526
|
//# sourceMappingURL=mm-react-components.es.js.map
|