asma-ui-table 1.0.139 → 1.0.141
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/asma-ui-table.es.js
CHANGED
|
@@ -9705,7 +9705,7 @@ function selectColumn(isFixed2, rowHeight) {
|
|
|
9705
9705
|
{
|
|
9706
9706
|
type: "button",
|
|
9707
9707
|
style: { height: rowHeight ? rowHeight : "auto" },
|
|
9708
|
-
className: "pl-2 flex items-center justify-start
|
|
9708
|
+
className: "pl-2 flex w-full items-center justify-start m-0 p-0",
|
|
9709
9709
|
onClick: () => cell.row.toggleSelected(),
|
|
9710
9710
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
9711
9711
|
StyledCheckbox,
|
|
@@ -13671,1458 +13671,1402 @@ const Checkmark = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
|
13671
13671
|
]
|
|
13672
13672
|
}
|
|
13673
13673
|
);
|
|
13674
|
-
function
|
|
13675
|
-
|
|
13676
|
-
|
|
13677
|
-
|
|
13678
|
-
|
|
13679
|
-
|
|
13680
|
-
|
|
13681
|
-
|
|
13682
|
-
|
|
13683
|
-
|
|
13684
|
-
|
|
13685
|
-
|
|
13686
|
-
|
|
13687
|
-
|
|
13688
|
-
|
|
13689
|
-
|
|
13690
|
-
|
|
13691
|
-
|
|
13692
|
-
result = fn(...newDeps);
|
|
13693
|
-
if (opts.key && ((_c = opts.debug) == null ? void 0 : _c.call(opts))) {
|
|
13694
|
-
const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
|
|
13695
|
-
const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
|
|
13696
|
-
const resultFpsPercentage = resultEndTime / 16;
|
|
13697
|
-
const pad = (str, num) => {
|
|
13698
|
-
str = String(str);
|
|
13699
|
-
while (str.length < num) {
|
|
13700
|
-
str = " " + str;
|
|
13701
|
-
}
|
|
13702
|
-
return str;
|
|
13703
|
-
};
|
|
13704
|
-
console.info(
|
|
13705
|
-
`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,
|
|
13706
|
-
`
|
|
13707
|
-
font-size: .6rem;
|
|
13708
|
-
font-weight: bold;
|
|
13709
|
-
color: hsl(${Math.max(
|
|
13710
|
-
0,
|
|
13711
|
-
Math.min(120 - 120 * resultFpsPercentage, 120)
|
|
13712
|
-
)}deg 100% 31%);`,
|
|
13713
|
-
opts == null ? void 0 : opts.key
|
|
13714
|
-
);
|
|
13715
|
-
}
|
|
13716
|
-
if ((opts == null ? void 0 : opts.onChange) && !(isInitial && opts.skipInitialOnChange)) {
|
|
13717
|
-
opts.onChange(result);
|
|
13718
|
-
}
|
|
13719
|
-
isInitial = false;
|
|
13720
|
-
return result;
|
|
13721
|
-
}
|
|
13722
|
-
memoizedFunction.updateDeps = (newDeps) => {
|
|
13723
|
-
deps = newDeps;
|
|
13724
|
-
};
|
|
13725
|
-
return memoizedFunction;
|
|
13726
|
-
}
|
|
13727
|
-
function notUndefined(value, msg) {
|
|
13728
|
-
if (value === void 0) {
|
|
13729
|
-
throw new Error(`Unexpected undefined${msg ? `: ${msg}` : ""}`);
|
|
13730
|
-
} else {
|
|
13731
|
-
return value;
|
|
13732
|
-
}
|
|
13674
|
+
function TableRows({
|
|
13675
|
+
styledTableProps,
|
|
13676
|
+
table,
|
|
13677
|
+
columnWindow
|
|
13678
|
+
}) {
|
|
13679
|
+
const rows = styledTableProps.hideFooter ? table.getExpandedRowModel().rows : table.getRowModel().rows;
|
|
13680
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: rows.map((row, index) => {
|
|
13681
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
13682
|
+
TableRow,
|
|
13683
|
+
{
|
|
13684
|
+
styledTableProps,
|
|
13685
|
+
row,
|
|
13686
|
+
index,
|
|
13687
|
+
columnWindow
|
|
13688
|
+
},
|
|
13689
|
+
row.id
|
|
13690
|
+
);
|
|
13691
|
+
}) });
|
|
13733
13692
|
}
|
|
13734
|
-
|
|
13735
|
-
|
|
13736
|
-
|
|
13737
|
-
|
|
13738
|
-
|
|
13739
|
-
|
|
13740
|
-
|
|
13741
|
-
|
|
13742
|
-
|
|
13743
|
-
const { offsetWidth, offsetHeight } = element;
|
|
13744
|
-
return { width: offsetWidth, height: offsetHeight };
|
|
13745
|
-
};
|
|
13746
|
-
const defaultKeyExtractor = (index) => index;
|
|
13747
|
-
const defaultRangeExtractor = (range) => {
|
|
13748
|
-
const start = Math.max(range.startIndex - range.overscan, 0);
|
|
13749
|
-
const end = Math.min(range.endIndex + range.overscan, range.count - 1);
|
|
13750
|
-
const arr = [];
|
|
13751
|
-
for (let i = start; i <= end; i++) {
|
|
13752
|
-
arr.push(i);
|
|
13753
|
-
}
|
|
13754
|
-
return arr;
|
|
13755
|
-
};
|
|
13756
|
-
const observeElementRect = (instance, cb) => {
|
|
13757
|
-
const element = instance.scrollElement;
|
|
13758
|
-
if (!element) {
|
|
13759
|
-
return;
|
|
13760
|
-
}
|
|
13761
|
-
const targetWindow = instance.targetWindow;
|
|
13762
|
-
if (!targetWindow) {
|
|
13763
|
-
return;
|
|
13693
|
+
function TableBody({
|
|
13694
|
+
table,
|
|
13695
|
+
styledTableProps,
|
|
13696
|
+
columnWindow
|
|
13697
|
+
}) {
|
|
13698
|
+
const { columns, data, loading, enableDnd, rowHeight } = styledTableProps;
|
|
13699
|
+
const colSpan = table.getAllLeafColumns().length || columns.length || 1;
|
|
13700
|
+
if (loading && data.length === 0) {
|
|
13701
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("tbody", { className: style$1["tbody"], children: /* @__PURE__ */ jsxRuntimeExports.jsx(TableSkeleton, { colSpan, rowHeight }) });
|
|
13764
13702
|
}
|
|
13765
|
-
|
|
13766
|
-
|
|
13767
|
-
cb({ width: Math.round(width2), height: Math.round(height2) });
|
|
13768
|
-
};
|
|
13769
|
-
handler(getRect(element));
|
|
13770
|
-
if (!targetWindow.ResizeObserver) {
|
|
13771
|
-
return () => {
|
|
13772
|
-
};
|
|
13703
|
+
if (data.length === 0) {
|
|
13704
|
+
return null;
|
|
13773
13705
|
}
|
|
13774
|
-
|
|
13775
|
-
|
|
13776
|
-
|
|
13777
|
-
|
|
13778
|
-
|
|
13779
|
-
|
|
13780
|
-
|
|
13781
|
-
|
|
13782
|
-
|
|
13706
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("tbody", { className: style$1["tbody"], children: enableDnd ? /* @__PURE__ */ jsxRuntimeExports.jsx(SortableContext, { items: data, strategy: verticalListSortingStrategy, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TableRows, { table, styledTableProps, columnWindow }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(TableRows, { table, styledTableProps, columnWindow }) });
|
|
13707
|
+
}
|
|
13708
|
+
function LoadingIcon(props) {
|
|
13709
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1rem", height: "1rem", viewBox: "0 0 24 24", ...props, children: [
|
|
13710
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
13711
|
+
"path",
|
|
13712
|
+
{
|
|
13713
|
+
fill: "currentColor",
|
|
13714
|
+
d: "M12 2A10 10 0 1 0 22 12A10 10 0 0 0 12 2Zm0 18a8 8 0 1 1 8-8A8 8 0 0 1 12 20Z",
|
|
13715
|
+
opacity: 0.5
|
|
13783
13716
|
}
|
|
13784
|
-
|
|
13785
|
-
|
|
13786
|
-
|
|
13787
|
-
|
|
13788
|
-
|
|
13789
|
-
|
|
13790
|
-
|
|
13791
|
-
|
|
13717
|
+
),
|
|
13718
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { fill: "currentColor", d: "M20 12h2A10 10 0 0 0 12 2V4A8 8 0 0 1 20 12Z", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
13719
|
+
"animateTransform",
|
|
13720
|
+
{
|
|
13721
|
+
attributeName: "transform",
|
|
13722
|
+
dur: "1s",
|
|
13723
|
+
from: "0 12 12",
|
|
13724
|
+
repeatCount: "indefinite",
|
|
13725
|
+
to: "360 12 12",
|
|
13726
|
+
type: "rotate"
|
|
13727
|
+
}
|
|
13728
|
+
) })
|
|
13729
|
+
] });
|
|
13730
|
+
}
|
|
13731
|
+
const Fetching = ({ fetching = false }) => {
|
|
13732
|
+
return fetching ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute z-10 bg-white/40 left-0 top-0 right-0 bottom-0 flex items-center justify-center ", children: /* @__PURE__ */ jsxRuntimeExports.jsx(LoadingIcon, { className: style$1["loading-icon"], width: 50, height: 50 }) }) : null;
|
|
13792
13733
|
};
|
|
13793
|
-
|
|
13794
|
-
|
|
13734
|
+
function ChevronRightIcon(props) {
|
|
13735
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1rem", height: "1rem", viewBox: "0 0 24 24", ...props, children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { fill: "currentColor", d: "M8.59 16.58L13.17 12L8.59 7.41L10 6l6 6l-6 6z" }) });
|
|
13736
|
+
}
|
|
13737
|
+
const style = {
|
|
13738
|
+
"table-pagination": "_table-pagination_pu6mb_1",
|
|
13739
|
+
"table-pagination__pages-list": "_table-pagination__pages-list_pu6mb_11",
|
|
13740
|
+
"table-pagination__pages-list__page": "_table-pagination__pages-list__page_pu6mb_16",
|
|
13741
|
+
"page-selected": "_page-selected_pu6mb_27",
|
|
13742
|
+
"check-icon": "_check-icon_pu6mb_30"
|
|
13795
13743
|
};
|
|
13796
|
-
|
|
13797
|
-
|
|
13798
|
-
|
|
13799
|
-
|
|
13800
|
-
|
|
13801
|
-
|
|
13802
|
-
|
|
13803
|
-
|
|
13804
|
-
|
|
13805
|
-
|
|
13806
|
-
|
|
13807
|
-
|
|
13808
|
-
|
|
13809
|
-
|
|
13810
|
-
|
|
13744
|
+
function ChevronLeftIcon(props) {
|
|
13745
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1rem", height: "1rem", viewBox: "0 0 24 24", ...props, children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { fill: "currentColor", d: "M15.41 16.58L10.83 12l4.58-4.59L14 6l-6 6l6 6z" }) });
|
|
13746
|
+
}
|
|
13747
|
+
function CheckIcon(props) {
|
|
13748
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1rem", height: "1rem", viewBox: "0 0 24 24", ...props, children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { fill: "currentColor", d: "M9 16.17L4.83 12l-1.42 1.41L9 19L21 7l-1.41-1.41z" }) });
|
|
13749
|
+
}
|
|
13750
|
+
const StyledMenuItem = (props) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
13751
|
+
MenuItem,
|
|
13752
|
+
{
|
|
13753
|
+
classes: { root: "flex gap-x-1" },
|
|
13754
|
+
sx: {
|
|
13755
|
+
padding: "8px",
|
|
13756
|
+
"&.Mui-selected": {
|
|
13757
|
+
backgroundColor: "var(--colors-gama-50)",
|
|
13758
|
+
"&:hover": { backgroundColor: "var(--colors-gama-50)" }
|
|
13759
|
+
}
|
|
13811
13760
|
},
|
|
13812
|
-
|
|
13813
|
-
|
|
13814
|
-
|
|
13815
|
-
|
|
13816
|
-
|
|
13817
|
-
|
|
13818
|
-
|
|
13819
|
-
|
|
13820
|
-
|
|
13821
|
-
|
|
13822
|
-
|
|
13823
|
-
|
|
13824
|
-
|
|
13825
|
-
element.addEventListener("scrollend", endHandler, addEventListenerOptions);
|
|
13826
|
-
}
|
|
13827
|
-
return () => {
|
|
13828
|
-
element.removeEventListener("scroll", handler);
|
|
13829
|
-
if (registerScrollendEvent) {
|
|
13830
|
-
element.removeEventListener("scrollend", endHandler);
|
|
13831
|
-
}
|
|
13832
|
-
};
|
|
13833
|
-
};
|
|
13834
|
-
const measureElement = (element, entry, instance) => {
|
|
13835
|
-
if (entry == null ? void 0 : entry.borderBoxSize) {
|
|
13836
|
-
const box = entry.borderBoxSize[0];
|
|
13837
|
-
if (box) {
|
|
13838
|
-
const size = Math.round(
|
|
13839
|
-
box[instance.options.horizontal ? "inlineSize" : "blockSize"]
|
|
13840
|
-
);
|
|
13841
|
-
return size;
|
|
13842
|
-
}
|
|
13761
|
+
...props,
|
|
13762
|
+
children: [
|
|
13763
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
13764
|
+
CheckIcon,
|
|
13765
|
+
{
|
|
13766
|
+
width: 24,
|
|
13767
|
+
height: 24,
|
|
13768
|
+
color: props.selected ? "var(--colors-gama-500)" : "transparent",
|
|
13769
|
+
style: { transition: "color 0.2s ease" }
|
|
13770
|
+
}
|
|
13771
|
+
),
|
|
13772
|
+
props.children
|
|
13773
|
+
]
|
|
13843
13774
|
}
|
|
13844
|
-
|
|
13845
|
-
|
|
13846
|
-
|
|
13847
|
-
|
|
13848
|
-
|
|
13849
|
-
|
|
13850
|
-
|
|
13851
|
-
const
|
|
13852
|
-
|
|
13853
|
-
|
|
13854
|
-
|
|
13855
|
-
|
|
13856
|
-
|
|
13857
|
-
|
|
13858
|
-
|
|
13859
|
-
|
|
13860
|
-
|
|
13861
|
-
|
|
13862
|
-
|
|
13863
|
-
|
|
13864
|
-
|
|
13865
|
-
|
|
13866
|
-
|
|
13867
|
-
|
|
13868
|
-
|
|
13869
|
-
|
|
13870
|
-
|
|
13871
|
-
|
|
13872
|
-
|
|
13873
|
-
this.scrollDirection = null;
|
|
13874
|
-
this.scrollAdjustments = 0;
|
|
13875
|
-
this.elementsCache = /* @__PURE__ */ new Map();
|
|
13876
|
-
this.now = () => {
|
|
13877
|
-
var _a, _b, _c;
|
|
13878
|
-
return ((_c = (_b = (_a = this.targetWindow) == null ? void 0 : _a.performance) == null ? void 0 : _b.now) == null ? void 0 : _c.call(_b)) ?? Date.now();
|
|
13879
|
-
};
|
|
13880
|
-
this.observer = /* @__PURE__ */ (() => {
|
|
13881
|
-
let _ro = null;
|
|
13882
|
-
const get = () => {
|
|
13883
|
-
if (_ro) {
|
|
13884
|
-
return _ro;
|
|
13885
|
-
}
|
|
13886
|
-
if (!this.targetWindow || !this.targetWindow.ResizeObserver) {
|
|
13887
|
-
return null;
|
|
13888
|
-
}
|
|
13889
|
-
return _ro = new this.targetWindow.ResizeObserver((entries) => {
|
|
13890
|
-
entries.forEach((entry) => {
|
|
13891
|
-
const run = () => {
|
|
13892
|
-
this._measureElement(entry.target, entry);
|
|
13893
|
-
};
|
|
13894
|
-
this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run();
|
|
13895
|
-
});
|
|
13896
|
-
});
|
|
13897
|
-
};
|
|
13898
|
-
return {
|
|
13899
|
-
disconnect: () => {
|
|
13900
|
-
var _a;
|
|
13901
|
-
(_a = get()) == null ? void 0 : _a.disconnect();
|
|
13902
|
-
_ro = null;
|
|
13903
|
-
},
|
|
13904
|
-
observe: (target) => {
|
|
13905
|
-
var _a;
|
|
13906
|
-
return (_a = get()) == null ? void 0 : _a.observe(target, { box: "border-box" });
|
|
13907
|
-
},
|
|
13908
|
-
unobserve: (target) => {
|
|
13909
|
-
var _a;
|
|
13910
|
-
return (_a = get()) == null ? void 0 : _a.unobserve(target);
|
|
13911
|
-
}
|
|
13912
|
-
};
|
|
13913
|
-
})();
|
|
13914
|
-
this.range = null;
|
|
13915
|
-
this.setOptions = (opts2) => {
|
|
13916
|
-
Object.entries(opts2).forEach(([key, value]) => {
|
|
13917
|
-
if (typeof value === "undefined")
|
|
13918
|
-
delete opts2[key];
|
|
13919
|
-
});
|
|
13920
|
-
this.options = {
|
|
13921
|
-
debug: false,
|
|
13922
|
-
initialOffset: 0,
|
|
13923
|
-
overscan: 1,
|
|
13924
|
-
paddingStart: 0,
|
|
13925
|
-
paddingEnd: 0,
|
|
13926
|
-
scrollPaddingStart: 0,
|
|
13927
|
-
scrollPaddingEnd: 0,
|
|
13928
|
-
horizontal: false,
|
|
13929
|
-
getItemKey: defaultKeyExtractor,
|
|
13930
|
-
rangeExtractor: defaultRangeExtractor,
|
|
13931
|
-
onChange: () => {
|
|
13932
|
-
},
|
|
13933
|
-
measureElement,
|
|
13934
|
-
initialRect: { width: 0, height: 0 },
|
|
13935
|
-
scrollMargin: 0,
|
|
13936
|
-
gap: 0,
|
|
13937
|
-
indexAttribute: "data-index",
|
|
13938
|
-
initialMeasurementsCache: [],
|
|
13939
|
-
lanes: 1,
|
|
13940
|
-
isScrollingResetDelay: 150,
|
|
13941
|
-
enabled: true,
|
|
13942
|
-
isRtl: false,
|
|
13943
|
-
useScrollendEvent: false,
|
|
13944
|
-
useAnimationFrameWithResizeObserver: false,
|
|
13945
|
-
...opts2
|
|
13946
|
-
};
|
|
13947
|
-
};
|
|
13948
|
-
this.notify = (sync) => {
|
|
13949
|
-
var _a, _b;
|
|
13950
|
-
(_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, sync);
|
|
13951
|
-
};
|
|
13952
|
-
this.maybeNotify = memo(
|
|
13953
|
-
() => {
|
|
13954
|
-
this.calculateRange();
|
|
13955
|
-
return [
|
|
13956
|
-
this.isScrolling,
|
|
13957
|
-
this.range ? this.range.startIndex : null,
|
|
13958
|
-
this.range ? this.range.endIndex : null
|
|
13959
|
-
];
|
|
13960
|
-
},
|
|
13961
|
-
(isScrolling) => {
|
|
13962
|
-
this.notify(isScrolling);
|
|
13963
|
-
},
|
|
13964
|
-
{
|
|
13965
|
-
key: process.env.NODE_ENV !== "production" && "maybeNotify",
|
|
13966
|
-
debug: () => this.options.debug,
|
|
13967
|
-
initialDeps: [
|
|
13968
|
-
this.isScrolling,
|
|
13969
|
-
this.range ? this.range.startIndex : null,
|
|
13970
|
-
this.range ? this.range.endIndex : null
|
|
13971
|
-
]
|
|
13972
|
-
}
|
|
13973
|
-
);
|
|
13974
|
-
this.cleanup = () => {
|
|
13975
|
-
this.unsubs.filter(Boolean).forEach((d) => d());
|
|
13976
|
-
this.unsubs = [];
|
|
13977
|
-
this.observer.disconnect();
|
|
13978
|
-
if (this.rafId != null && this.targetWindow) {
|
|
13979
|
-
this.targetWindow.cancelAnimationFrame(this.rafId);
|
|
13980
|
-
this.rafId = null;
|
|
13981
|
-
}
|
|
13982
|
-
this.scrollState = null;
|
|
13983
|
-
this.scrollElement = null;
|
|
13984
|
-
this.targetWindow = null;
|
|
13985
|
-
};
|
|
13986
|
-
this._didMount = () => {
|
|
13987
|
-
return () => {
|
|
13988
|
-
this.cleanup();
|
|
13989
|
-
};
|
|
13990
|
-
};
|
|
13991
|
-
this._willUpdate = () => {
|
|
13992
|
-
var _a;
|
|
13993
|
-
const scrollElement = this.options.enabled ? this.options.getScrollElement() : null;
|
|
13994
|
-
if (this.scrollElement !== scrollElement) {
|
|
13995
|
-
this.cleanup();
|
|
13996
|
-
if (!scrollElement) {
|
|
13997
|
-
this.maybeNotify();
|
|
13998
|
-
return;
|
|
13999
|
-
}
|
|
14000
|
-
this.scrollElement = scrollElement;
|
|
14001
|
-
if (this.scrollElement && "ownerDocument" in this.scrollElement) {
|
|
14002
|
-
this.targetWindow = this.scrollElement.ownerDocument.defaultView;
|
|
14003
|
-
} else {
|
|
14004
|
-
this.targetWindow = ((_a = this.scrollElement) == null ? void 0 : _a.window) ?? null;
|
|
14005
|
-
}
|
|
14006
|
-
this.elementsCache.forEach((cached) => {
|
|
14007
|
-
this.observer.observe(cached);
|
|
14008
|
-
});
|
|
14009
|
-
this.unsubs.push(
|
|
14010
|
-
this.options.observeElementRect(this, (rect) => {
|
|
14011
|
-
this.scrollRect = rect;
|
|
14012
|
-
this.maybeNotify();
|
|
14013
|
-
})
|
|
14014
|
-
);
|
|
14015
|
-
this.unsubs.push(
|
|
14016
|
-
this.options.observeElementOffset(this, (offset, isScrolling) => {
|
|
14017
|
-
this.scrollAdjustments = 0;
|
|
14018
|
-
this.scrollDirection = isScrolling ? this.getScrollOffset() < offset ? "forward" : "backward" : null;
|
|
14019
|
-
this.scrollOffset = offset;
|
|
14020
|
-
this.isScrolling = isScrolling;
|
|
14021
|
-
if (this.scrollState) {
|
|
14022
|
-
this.scheduleScrollReconcile();
|
|
14023
|
-
}
|
|
14024
|
-
this.maybeNotify();
|
|
14025
|
-
})
|
|
14026
|
-
);
|
|
14027
|
-
this._scrollToOffset(this.getScrollOffset(), {
|
|
14028
|
-
adjustments: void 0,
|
|
14029
|
-
behavior: void 0
|
|
14030
|
-
});
|
|
14031
|
-
}
|
|
14032
|
-
};
|
|
14033
|
-
this.rafId = null;
|
|
14034
|
-
this.getSize = () => {
|
|
14035
|
-
if (!this.options.enabled) {
|
|
14036
|
-
this.scrollRect = null;
|
|
14037
|
-
return 0;
|
|
14038
|
-
}
|
|
14039
|
-
this.scrollRect = this.scrollRect ?? this.options.initialRect;
|
|
14040
|
-
return this.scrollRect[this.options.horizontal ? "width" : "height"];
|
|
14041
|
-
};
|
|
14042
|
-
this.getScrollOffset = () => {
|
|
14043
|
-
if (!this.options.enabled) {
|
|
14044
|
-
this.scrollOffset = null;
|
|
14045
|
-
return 0;
|
|
14046
|
-
}
|
|
14047
|
-
this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset === "function" ? this.options.initialOffset() : this.options.initialOffset);
|
|
14048
|
-
return this.scrollOffset;
|
|
14049
|
-
};
|
|
14050
|
-
this.getFurthestMeasurement = (measurements, index) => {
|
|
14051
|
-
const furthestMeasurementsFound = /* @__PURE__ */ new Map();
|
|
14052
|
-
const furthestMeasurements = /* @__PURE__ */ new Map();
|
|
14053
|
-
for (let m = index - 1; m >= 0; m--) {
|
|
14054
|
-
const measurement = measurements[m];
|
|
14055
|
-
if (furthestMeasurementsFound.has(measurement.lane)) {
|
|
14056
|
-
continue;
|
|
14057
|
-
}
|
|
14058
|
-
const previousFurthestMeasurement = furthestMeasurements.get(
|
|
14059
|
-
measurement.lane
|
|
14060
|
-
);
|
|
14061
|
-
if (previousFurthestMeasurement == null || measurement.end > previousFurthestMeasurement.end) {
|
|
14062
|
-
furthestMeasurements.set(measurement.lane, measurement);
|
|
14063
|
-
} else if (measurement.end < previousFurthestMeasurement.end) {
|
|
14064
|
-
furthestMeasurementsFound.set(measurement.lane, true);
|
|
14065
|
-
}
|
|
14066
|
-
if (furthestMeasurementsFound.size === this.options.lanes) {
|
|
14067
|
-
break;
|
|
14068
|
-
}
|
|
14069
|
-
}
|
|
14070
|
-
return furthestMeasurements.size === this.options.lanes ? Array.from(furthestMeasurements.values()).sort((a, b) => {
|
|
14071
|
-
if (a.end === b.end) {
|
|
14072
|
-
return a.index - b.index;
|
|
14073
|
-
}
|
|
14074
|
-
return a.end - b.end;
|
|
14075
|
-
})[0] : void 0;
|
|
14076
|
-
};
|
|
14077
|
-
this.getMeasurementOptions = memo(
|
|
14078
|
-
() => [
|
|
14079
|
-
this.options.count,
|
|
14080
|
-
this.options.paddingStart,
|
|
14081
|
-
this.options.scrollMargin,
|
|
14082
|
-
this.options.getItemKey,
|
|
14083
|
-
this.options.enabled,
|
|
14084
|
-
this.options.lanes
|
|
14085
|
-
],
|
|
14086
|
-
(count2, paddingStart, scrollMargin, getItemKey, enabled, lanes) => {
|
|
14087
|
-
const lanesChanged = this.prevLanes !== void 0 && this.prevLanes !== lanes;
|
|
14088
|
-
if (lanesChanged) {
|
|
14089
|
-
this.lanesChangedFlag = true;
|
|
14090
|
-
}
|
|
14091
|
-
this.prevLanes = lanes;
|
|
14092
|
-
this.pendingMeasuredCacheIndexes = [];
|
|
14093
|
-
return {
|
|
14094
|
-
count: count2,
|
|
14095
|
-
paddingStart,
|
|
14096
|
-
scrollMargin,
|
|
14097
|
-
getItemKey,
|
|
14098
|
-
enabled,
|
|
14099
|
-
lanes
|
|
14100
|
-
};
|
|
14101
|
-
},
|
|
14102
|
-
{
|
|
14103
|
-
key: false
|
|
14104
|
-
}
|
|
14105
|
-
);
|
|
14106
|
-
this.getMeasurements = memo(
|
|
14107
|
-
() => [this.getMeasurementOptions(), this.itemSizeCache],
|
|
14108
|
-
({ count: count2, paddingStart, scrollMargin, getItemKey, enabled, lanes }, itemSizeCache) => {
|
|
14109
|
-
if (!enabled) {
|
|
14110
|
-
this.measurementsCache = [];
|
|
14111
|
-
this.itemSizeCache.clear();
|
|
14112
|
-
this.laneAssignments.clear();
|
|
14113
|
-
return [];
|
|
14114
|
-
}
|
|
14115
|
-
if (this.laneAssignments.size > count2) {
|
|
14116
|
-
for (const index of this.laneAssignments.keys()) {
|
|
14117
|
-
if (index >= count2) {
|
|
14118
|
-
this.laneAssignments.delete(index);
|
|
14119
|
-
}
|
|
14120
|
-
}
|
|
14121
|
-
}
|
|
14122
|
-
if (this.lanesChangedFlag) {
|
|
14123
|
-
this.lanesChangedFlag = false;
|
|
14124
|
-
this.lanesSettling = true;
|
|
14125
|
-
this.measurementsCache = [];
|
|
14126
|
-
this.itemSizeCache.clear();
|
|
14127
|
-
this.laneAssignments.clear();
|
|
14128
|
-
this.pendingMeasuredCacheIndexes = [];
|
|
14129
|
-
}
|
|
14130
|
-
if (this.measurementsCache.length === 0 && !this.lanesSettling) {
|
|
14131
|
-
this.measurementsCache = this.options.initialMeasurementsCache;
|
|
14132
|
-
this.measurementsCache.forEach((item) => {
|
|
14133
|
-
this.itemSizeCache.set(item.key, item.size);
|
|
14134
|
-
});
|
|
14135
|
-
}
|
|
14136
|
-
const min2 = this.lanesSettling ? 0 : this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
|
|
14137
|
-
this.pendingMeasuredCacheIndexes = [];
|
|
14138
|
-
if (this.lanesSettling && this.measurementsCache.length === count2) {
|
|
14139
|
-
this.lanesSettling = false;
|
|
14140
|
-
}
|
|
14141
|
-
const measurements = this.measurementsCache.slice(0, min2);
|
|
14142
|
-
const laneLastIndex = new Array(lanes).fill(
|
|
14143
|
-
void 0
|
|
14144
|
-
);
|
|
14145
|
-
for (let m = 0; m < min2; m++) {
|
|
14146
|
-
const item = measurements[m];
|
|
14147
|
-
if (item) {
|
|
14148
|
-
laneLastIndex[item.lane] = m;
|
|
14149
|
-
}
|
|
14150
|
-
}
|
|
14151
|
-
for (let i = min2; i < count2; i++) {
|
|
14152
|
-
const key = getItemKey(i);
|
|
14153
|
-
const cachedLane = this.laneAssignments.get(i);
|
|
14154
|
-
let lane;
|
|
14155
|
-
let start;
|
|
14156
|
-
if (cachedLane !== void 0 && this.options.lanes > 1) {
|
|
14157
|
-
lane = cachedLane;
|
|
14158
|
-
const prevIndex = laneLastIndex[lane];
|
|
14159
|
-
const prevInLane = prevIndex !== void 0 ? measurements[prevIndex] : void 0;
|
|
14160
|
-
start = prevInLane ? prevInLane.end + this.options.gap : paddingStart + scrollMargin;
|
|
14161
|
-
} else {
|
|
14162
|
-
const furthestMeasurement = this.options.lanes === 1 ? measurements[i - 1] : this.getFurthestMeasurement(measurements, i);
|
|
14163
|
-
start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
|
|
14164
|
-
lane = furthestMeasurement ? furthestMeasurement.lane : i % this.options.lanes;
|
|
14165
|
-
if (this.options.lanes > 1) {
|
|
14166
|
-
this.laneAssignments.set(i, lane);
|
|
14167
|
-
}
|
|
14168
|
-
}
|
|
14169
|
-
const measuredSize = itemSizeCache.get(key);
|
|
14170
|
-
const size = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i);
|
|
14171
|
-
const end = start + size;
|
|
14172
|
-
measurements[i] = {
|
|
14173
|
-
index: i,
|
|
14174
|
-
start,
|
|
14175
|
-
size,
|
|
14176
|
-
end,
|
|
14177
|
-
key,
|
|
14178
|
-
lane
|
|
14179
|
-
};
|
|
14180
|
-
laneLastIndex[lane] = i;
|
|
14181
|
-
}
|
|
14182
|
-
this.measurementsCache = measurements;
|
|
14183
|
-
return measurements;
|
|
14184
|
-
},
|
|
14185
|
-
{
|
|
14186
|
-
key: process.env.NODE_ENV !== "production" && "getMeasurements",
|
|
14187
|
-
debug: () => this.options.debug
|
|
14188
|
-
}
|
|
14189
|
-
);
|
|
14190
|
-
this.calculateRange = memo(
|
|
14191
|
-
() => [
|
|
14192
|
-
this.getMeasurements(),
|
|
14193
|
-
this.getSize(),
|
|
14194
|
-
this.getScrollOffset(),
|
|
14195
|
-
this.options.lanes
|
|
14196
|
-
],
|
|
14197
|
-
(measurements, outerSize, scrollOffset, lanes) => {
|
|
14198
|
-
return this.range = measurements.length > 0 && outerSize > 0 ? calculateRange({
|
|
14199
|
-
measurements,
|
|
14200
|
-
outerSize,
|
|
14201
|
-
scrollOffset,
|
|
14202
|
-
lanes
|
|
14203
|
-
}) : null;
|
|
14204
|
-
},
|
|
14205
|
-
{
|
|
14206
|
-
key: process.env.NODE_ENV !== "production" && "calculateRange",
|
|
14207
|
-
debug: () => this.options.debug
|
|
14208
|
-
}
|
|
14209
|
-
);
|
|
14210
|
-
this.getVirtualIndexes = memo(
|
|
14211
|
-
() => {
|
|
14212
|
-
let startIndex = null;
|
|
14213
|
-
let endIndex = null;
|
|
14214
|
-
const range = this.calculateRange();
|
|
14215
|
-
if (range) {
|
|
14216
|
-
startIndex = range.startIndex;
|
|
14217
|
-
endIndex = range.endIndex;
|
|
14218
|
-
}
|
|
14219
|
-
this.maybeNotify.updateDeps([this.isScrolling, startIndex, endIndex]);
|
|
14220
|
-
return [
|
|
14221
|
-
this.options.rangeExtractor,
|
|
14222
|
-
this.options.overscan,
|
|
14223
|
-
this.options.count,
|
|
14224
|
-
startIndex,
|
|
14225
|
-
endIndex
|
|
14226
|
-
];
|
|
14227
|
-
},
|
|
14228
|
-
(rangeExtractor, overscan, count2, startIndex, endIndex) => {
|
|
14229
|
-
return startIndex === null || endIndex === null ? [] : rangeExtractor({
|
|
14230
|
-
startIndex,
|
|
14231
|
-
endIndex,
|
|
14232
|
-
overscan,
|
|
14233
|
-
count: count2
|
|
14234
|
-
});
|
|
14235
|
-
},
|
|
14236
|
-
{
|
|
14237
|
-
key: process.env.NODE_ENV !== "production" && "getVirtualIndexes",
|
|
14238
|
-
debug: () => this.options.debug
|
|
14239
|
-
}
|
|
13775
|
+
);
|
|
13776
|
+
const amountOfRows = [10, 20, 50];
|
|
13777
|
+
function TablePagination({
|
|
13778
|
+
table,
|
|
13779
|
+
showRowSelect,
|
|
13780
|
+
locale
|
|
13781
|
+
}) {
|
|
13782
|
+
const { anchorEl, open, handleClose, handleOpen } = useToggleMenuVisibility();
|
|
13783
|
+
const {
|
|
13784
|
+
anchorEl: anchorElRows,
|
|
13785
|
+
open: openRows,
|
|
13786
|
+
handleClose: handleCloseRows,
|
|
13787
|
+
handleOpen: handleOpenRows
|
|
13788
|
+
} = useToggleMenuVisibility();
|
|
13789
|
+
const tablePaginationRef = useRef(null);
|
|
13790
|
+
const isNo = locale === "no";
|
|
13791
|
+
const popoverOrigin = useMemo(
|
|
13792
|
+
() => ({
|
|
13793
|
+
anchorOrigin: { vertical: -5, horizontal: "center" },
|
|
13794
|
+
transformOrigin: { vertical: "bottom", horizontal: "center" }
|
|
13795
|
+
}),
|
|
13796
|
+
[]
|
|
13797
|
+
);
|
|
13798
|
+
const scrollToTop = useCallback(() => {
|
|
13799
|
+
var _a;
|
|
13800
|
+
const asmaTableClass = style$1["asma-ui-table-styled-table"];
|
|
13801
|
+
const tableContainer = (_a = tablePaginationRef.current) == null ? void 0 : _a.closest(`.${asmaTableClass}`);
|
|
13802
|
+
const scrollContainer = tableContainer == null ? void 0 : tableContainer.querySelector(
|
|
13803
|
+
`.${style$1["table-scroll"]}, .${style$1["table-wrapper"]}`
|
|
14240
13804
|
);
|
|
14241
|
-
|
|
14242
|
-
|
|
14243
|
-
|
|
14244
|
-
|
|
14245
|
-
|
|
14246
|
-
|
|
14247
|
-
|
|
14248
|
-
|
|
14249
|
-
|
|
14250
|
-
|
|
14251
|
-
|
|
14252
|
-
|
|
14253
|
-
|
|
14254
|
-
|
|
14255
|
-
|
|
14256
|
-
|
|
14257
|
-
|
|
14258
|
-
|
|
14259
|
-
|
|
14260
|
-
|
|
14261
|
-
|
|
14262
|
-
|
|
14263
|
-
|
|
14264
|
-
|
|
14265
|
-
|
|
14266
|
-
|
|
14267
|
-
|
|
14268
|
-
|
|
14269
|
-
|
|
14270
|
-
|
|
14271
|
-
|
|
14272
|
-
|
|
14273
|
-
|
|
14274
|
-
|
|
14275
|
-
|
|
14276
|
-
|
|
14277
|
-
|
|
14278
|
-
|
|
14279
|
-
|
|
14280
|
-
|
|
14281
|
-
|
|
14282
|
-
|
|
14283
|
-
|
|
14284
|
-
|
|
14285
|
-
|
|
14286
|
-
|
|
14287
|
-
|
|
14288
|
-
|
|
14289
|
-
|
|
14290
|
-
}
|
|
14291
|
-
if (this.shouldMeasureDuringScroll(index)) {
|
|
14292
|
-
this.resizeItem(index, this.options.measureElement(node, entry, this));
|
|
14293
|
-
}
|
|
14294
|
-
};
|
|
14295
|
-
this.resizeItem = (index, size) => {
|
|
14296
|
-
var _a;
|
|
14297
|
-
const item = this.measurementsCache[index];
|
|
14298
|
-
if (!item) {
|
|
14299
|
-
return;
|
|
14300
|
-
}
|
|
14301
|
-
const itemSize = this.itemSizeCache.get(item.key) ?? item.size;
|
|
14302
|
-
const delta = size - itemSize;
|
|
14303
|
-
if (delta !== 0) {
|
|
14304
|
-
if (((_a = this.scrollState) == null ? void 0 : _a.behavior) !== "smooth" && (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(item, delta, this) : item.start < this.getScrollOffset() + this.scrollAdjustments)) {
|
|
14305
|
-
if (process.env.NODE_ENV !== "production" && this.options.debug) {
|
|
14306
|
-
console.info("correction", delta);
|
|
14307
|
-
}
|
|
14308
|
-
this._scrollToOffset(this.getScrollOffset(), {
|
|
14309
|
-
adjustments: this.scrollAdjustments += delta,
|
|
14310
|
-
behavior: void 0
|
|
14311
|
-
});
|
|
14312
|
-
}
|
|
14313
|
-
this.pendingMeasuredCacheIndexes.push(item.index);
|
|
14314
|
-
this.itemSizeCache = new Map(this.itemSizeCache.set(item.key, size));
|
|
14315
|
-
this.notify(false);
|
|
14316
|
-
}
|
|
14317
|
-
};
|
|
14318
|
-
this.measureElement = (node) => {
|
|
14319
|
-
if (!node) {
|
|
14320
|
-
this.elementsCache.forEach((cached, key) => {
|
|
14321
|
-
if (!cached.isConnected) {
|
|
14322
|
-
this.observer.unobserve(cached);
|
|
14323
|
-
this.elementsCache.delete(key);
|
|
14324
|
-
}
|
|
14325
|
-
});
|
|
14326
|
-
return;
|
|
14327
|
-
}
|
|
14328
|
-
this._measureElement(node, void 0);
|
|
14329
|
-
};
|
|
14330
|
-
this.getVirtualItems = memo(
|
|
14331
|
-
() => [this.getVirtualIndexes(), this.getMeasurements()],
|
|
14332
|
-
(indexes, measurements) => {
|
|
14333
|
-
const virtualItems = [];
|
|
14334
|
-
for (let k = 0, len = indexes.length; k < len; k++) {
|
|
14335
|
-
const i = indexes[k];
|
|
14336
|
-
const measurement = measurements[i];
|
|
14337
|
-
virtualItems.push(measurement);
|
|
13805
|
+
if (scrollContainer) {
|
|
13806
|
+
scrollContainer.scrollTo({ top: 0, behavior: "smooth" });
|
|
13807
|
+
}
|
|
13808
|
+
}, []);
|
|
13809
|
+
const pagesLength = table.getPageCount() || 1;
|
|
13810
|
+
const currentPage = table.getState().pagination.pageIndex + 1;
|
|
13811
|
+
const pages = useMemo(() => Array.from({ length: pagesLength }, (_, index) => index + 1), [pagesLength]);
|
|
13812
|
+
const pageSize = table.getState().pagination.pageSize;
|
|
13813
|
+
const amountOfRowsOptions = useMemo(() => {
|
|
13814
|
+
const optionsSet = /* @__PURE__ */ new Set([...amountOfRows, pageSize]);
|
|
13815
|
+
return Array.from(optionsSet).sort((a, b) => a - b);
|
|
13816
|
+
}, []);
|
|
13817
|
+
const handlePageChange = useCallback(
|
|
13818
|
+
(page) => {
|
|
13819
|
+
table.setPageIndex(page - 1);
|
|
13820
|
+
handleClose();
|
|
13821
|
+
scrollToTop();
|
|
13822
|
+
},
|
|
13823
|
+
[table, handleClose, scrollToTop]
|
|
13824
|
+
);
|
|
13825
|
+
const handleRowsChange = useCallback(
|
|
13826
|
+
(size) => {
|
|
13827
|
+
table.setPageSize(size);
|
|
13828
|
+
handleCloseRows();
|
|
13829
|
+
},
|
|
13830
|
+
[table, handleCloseRows]
|
|
13831
|
+
);
|
|
13832
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: tablePaginationRef, className: style["table-pagination"], children: [
|
|
13833
|
+
showRowSelect && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
13834
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
13835
|
+
StyledButton,
|
|
13836
|
+
{
|
|
13837
|
+
dataTest: "table-rows-count-button",
|
|
13838
|
+
variant: "outlined",
|
|
13839
|
+
size: "large",
|
|
13840
|
+
onClick: handleOpenRows,
|
|
13841
|
+
endIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
13842
|
+
ChevronDownIcon,
|
|
13843
|
+
{
|
|
13844
|
+
className: `${openRows ? "rotate-180" : "rotate-0"} transition-transform duration-300`,
|
|
13845
|
+
height: 24,
|
|
13846
|
+
width: 24
|
|
13847
|
+
}
|
|
13848
|
+
),
|
|
13849
|
+
children: [
|
|
13850
|
+
pageSize,
|
|
13851
|
+
" ",
|
|
13852
|
+
isNo ? "rader" : "rows"
|
|
13853
|
+
]
|
|
14338
13854
|
}
|
|
14339
|
-
|
|
14340
|
-
|
|
14341
|
-
|
|
14342
|
-
|
|
14343
|
-
|
|
14344
|
-
|
|
14345
|
-
|
|
14346
|
-
|
|
14347
|
-
|
|
14348
|
-
|
|
14349
|
-
|
|
14350
|
-
|
|
14351
|
-
|
|
14352
|
-
|
|
14353
|
-
|
|
14354
|
-
|
|
14355
|
-
|
|
14356
|
-
|
|
14357
|
-
|
|
14358
|
-
|
|
14359
|
-
|
|
14360
|
-
|
|
14361
|
-
|
|
14362
|
-
|
|
14363
|
-
|
|
14364
|
-
|
|
14365
|
-
|
|
14366
|
-
|
|
14367
|
-
|
|
14368
|
-
|
|
14369
|
-
|
|
14370
|
-
|
|
14371
|
-
|
|
14372
|
-
|
|
14373
|
-
|
|
14374
|
-
|
|
14375
|
-
if (align === "auto") {
|
|
14376
|
-
align = toOffset >= scrollOffset + size ? "end" : "start";
|
|
14377
|
-
}
|
|
14378
|
-
if (align === "center") {
|
|
14379
|
-
toOffset += (itemSize - size) / 2;
|
|
14380
|
-
} else if (align === "end") {
|
|
14381
|
-
toOffset -= size;
|
|
14382
|
-
}
|
|
14383
|
-
const maxOffset = this.getMaxScrollOffset();
|
|
14384
|
-
return Math.max(Math.min(maxOffset, toOffset), 0);
|
|
14385
|
-
};
|
|
14386
|
-
this.getOffsetForIndex = (index, align = "auto") => {
|
|
14387
|
-
index = Math.max(0, Math.min(index, this.options.count - 1));
|
|
14388
|
-
const size = this.getSize();
|
|
14389
|
-
const scrollOffset = this.getScrollOffset();
|
|
14390
|
-
const item = this.measurementsCache[index];
|
|
14391
|
-
if (!item)
|
|
14392
|
-
return;
|
|
14393
|
-
if (align === "auto") {
|
|
14394
|
-
if (item.end >= scrollOffset + size - this.options.scrollPaddingEnd) {
|
|
14395
|
-
align = "end";
|
|
14396
|
-
} else if (item.start <= scrollOffset + this.options.scrollPaddingStart) {
|
|
14397
|
-
align = "start";
|
|
14398
|
-
} else {
|
|
14399
|
-
return [scrollOffset, align];
|
|
13855
|
+
),
|
|
13856
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
13857
|
+
Popover,
|
|
13858
|
+
{
|
|
13859
|
+
open: openRows,
|
|
13860
|
+
anchorEl: anchorElRows,
|
|
13861
|
+
slotProps: {
|
|
13862
|
+
paper: {
|
|
13863
|
+
sx: {
|
|
13864
|
+
width: anchorElRows ? anchorElRows.clientWidth : void 0,
|
|
13865
|
+
maxHeight: 288,
|
|
13866
|
+
overflowY: "auto"
|
|
13867
|
+
}
|
|
13868
|
+
}
|
|
13869
|
+
},
|
|
13870
|
+
onClose: handleCloseRows,
|
|
13871
|
+
anchorOrigin: popoverOrigin.anchorOrigin,
|
|
13872
|
+
transformOrigin: popoverOrigin.transformOrigin,
|
|
13873
|
+
classes: { paper: "border border-solid border-delta-200 py-2" },
|
|
13874
|
+
children: amountOfRowsOptions.map((size) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
13875
|
+
StyledMenuItem,
|
|
13876
|
+
{
|
|
13877
|
+
onClick: (e) => {
|
|
13878
|
+
e.stopPropagation();
|
|
13879
|
+
e.preventDefault();
|
|
13880
|
+
handleRowsChange(size);
|
|
13881
|
+
},
|
|
13882
|
+
selected: pageSize === size,
|
|
13883
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-delta-700 text-sm font-normal", children: [
|
|
13884
|
+
size,
|
|
13885
|
+
" ",
|
|
13886
|
+
isNo ? "rader" : "rows"
|
|
13887
|
+
] })
|
|
13888
|
+
},
|
|
13889
|
+
size
|
|
13890
|
+
))
|
|
14400
13891
|
}
|
|
13892
|
+
)
|
|
13893
|
+
] }),
|
|
13894
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(StyledTooltip, { title: isNo ? "Nåværende side" : "Current Page", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
13895
|
+
StyledButton,
|
|
13896
|
+
{
|
|
13897
|
+
dataTest: "current-page-button",
|
|
13898
|
+
variant: "outlined",
|
|
13899
|
+
size: "large",
|
|
13900
|
+
onClick: handleOpen,
|
|
13901
|
+
endIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
13902
|
+
ChevronDownIcon,
|
|
13903
|
+
{
|
|
13904
|
+
className: `${open ? "rotate-180" : "rotate-0"} transition-transform duration-300`,
|
|
13905
|
+
height: 24,
|
|
13906
|
+
width: 24
|
|
13907
|
+
}
|
|
13908
|
+
),
|
|
13909
|
+
children: [
|
|
13910
|
+
isNo ? "Side" : "Page",
|
|
13911
|
+
" ",
|
|
13912
|
+
currentPage,
|
|
13913
|
+
" ",
|
|
13914
|
+
isNo ? "av" : "of",
|
|
13915
|
+
" ",
|
|
13916
|
+
pagesLength
|
|
13917
|
+
]
|
|
14401
13918
|
}
|
|
14402
|
-
|
|
14403
|
-
|
|
13919
|
+
) }) }),
|
|
13920
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
13921
|
+
Popover,
|
|
13922
|
+
{
|
|
13923
|
+
open,
|
|
13924
|
+
anchorEl,
|
|
13925
|
+
slotProps: {
|
|
13926
|
+
paper: {
|
|
13927
|
+
sx: {
|
|
13928
|
+
width: anchorEl ? anchorEl.clientWidth : void 0,
|
|
13929
|
+
maxHeight: 288,
|
|
13930
|
+
overflowY: "auto"
|
|
13931
|
+
}
|
|
13932
|
+
}
|
|
13933
|
+
},
|
|
13934
|
+
onClose: handleClose,
|
|
13935
|
+
anchorOrigin: popoverOrigin.anchorOrigin,
|
|
13936
|
+
transformOrigin: popoverOrigin.transformOrigin,
|
|
13937
|
+
classes: { paper: "border border-solid border-delta-200 py-2" },
|
|
13938
|
+
children: pages.map((page) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
13939
|
+
StyledMenuItem,
|
|
13940
|
+
{
|
|
13941
|
+
onClick: (e) => {
|
|
13942
|
+
e.stopPropagation();
|
|
13943
|
+
e.preventDefault();
|
|
13944
|
+
handlePageChange(page);
|
|
13945
|
+
},
|
|
13946
|
+
selected: page === currentPage,
|
|
13947
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-delta-700 text-sm font-normal", children: [
|
|
13948
|
+
isNo ? "Side" : "Page",
|
|
13949
|
+
" ",
|
|
13950
|
+
page
|
|
13951
|
+
] })
|
|
13952
|
+
},
|
|
13953
|
+
page
|
|
13954
|
+
))
|
|
14404
13955
|
}
|
|
14405
|
-
|
|
14406
|
-
|
|
14407
|
-
|
|
14408
|
-
|
|
14409
|
-
|
|
14410
|
-
|
|
14411
|
-
|
|
14412
|
-
|
|
14413
|
-
|
|
14414
|
-
|
|
14415
|
-
|
|
14416
|
-
|
|
14417
|
-
|
|
14418
|
-
startedAt: now,
|
|
14419
|
-
lastTargetOffset: offset,
|
|
14420
|
-
stableFrames: 0
|
|
14421
|
-
};
|
|
14422
|
-
this._scrollToOffset(offset, { adjustments: void 0, behavior });
|
|
14423
|
-
this.scheduleScrollReconcile();
|
|
14424
|
-
};
|
|
14425
|
-
this.scrollToIndex = (index, {
|
|
14426
|
-
align: initialAlign = "auto",
|
|
14427
|
-
behavior = "auto"
|
|
14428
|
-
} = {}) => {
|
|
14429
|
-
index = Math.max(0, Math.min(index, this.options.count - 1));
|
|
14430
|
-
const offsetInfo = this.getOffsetForIndex(index, initialAlign);
|
|
14431
|
-
if (!offsetInfo) {
|
|
14432
|
-
return;
|
|
13956
|
+
),
|
|
13957
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(StyledTooltip, { title: currentPage === 1 ? "" : isNo ? "Forrige side" : "Previous Page", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
13958
|
+
StyledButton,
|
|
13959
|
+
{
|
|
13960
|
+
dataTest: "prev-page-button",
|
|
13961
|
+
variant: "outlined",
|
|
13962
|
+
onClick: () => {
|
|
13963
|
+
table.previousPage();
|
|
13964
|
+
scrollToTop();
|
|
13965
|
+
},
|
|
13966
|
+
size: "large",
|
|
13967
|
+
disabled: !table.getCanPreviousPage(),
|
|
13968
|
+
startIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronLeftIcon, { height: 24, width: 24 })
|
|
14433
13969
|
}
|
|
14434
|
-
|
|
14435
|
-
|
|
14436
|
-
|
|
14437
|
-
|
|
14438
|
-
|
|
14439
|
-
|
|
14440
|
-
|
|
14441
|
-
|
|
14442
|
-
|
|
14443
|
-
|
|
14444
|
-
|
|
14445
|
-
|
|
14446
|
-
|
|
14447
|
-
this.scrollBy = (delta, { behavior = "auto" } = {}) => {
|
|
14448
|
-
const offset = this.getScrollOffset() + delta;
|
|
14449
|
-
const now = this.now();
|
|
14450
|
-
this.scrollState = {
|
|
14451
|
-
index: null,
|
|
14452
|
-
align: "start",
|
|
14453
|
-
behavior,
|
|
14454
|
-
startedAt: now,
|
|
14455
|
-
lastTargetOffset: offset,
|
|
14456
|
-
stableFrames: 0
|
|
14457
|
-
};
|
|
14458
|
-
this._scrollToOffset(offset, { adjustments: void 0, behavior });
|
|
14459
|
-
this.scheduleScrollReconcile();
|
|
14460
|
-
};
|
|
14461
|
-
this.getTotalSize = () => {
|
|
14462
|
-
var _a;
|
|
14463
|
-
const measurements = this.getMeasurements();
|
|
14464
|
-
let end;
|
|
14465
|
-
if (measurements.length === 0) {
|
|
14466
|
-
end = this.options.paddingStart;
|
|
14467
|
-
} else if (this.options.lanes === 1) {
|
|
14468
|
-
end = ((_a = measurements[measurements.length - 1]) == null ? void 0 : _a.end) ?? 0;
|
|
14469
|
-
} else {
|
|
14470
|
-
const endByLane = Array(this.options.lanes).fill(null);
|
|
14471
|
-
let endIndex = measurements.length - 1;
|
|
14472
|
-
while (endIndex >= 0 && endByLane.some((val) => val === null)) {
|
|
14473
|
-
const item = measurements[endIndex];
|
|
14474
|
-
if (endByLane[item.lane] === null) {
|
|
14475
|
-
endByLane[item.lane] = item.end;
|
|
14476
|
-
}
|
|
14477
|
-
endIndex--;
|
|
14478
|
-
}
|
|
14479
|
-
end = Math.max(...endByLane.filter((val) => val !== null));
|
|
13970
|
+
) }) }),
|
|
13971
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(StyledTooltip, { title: currentPage === pagesLength ? "" : isNo ? "Neste side" : "Next Page", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
13972
|
+
StyledButton,
|
|
13973
|
+
{
|
|
13974
|
+
dataTest: "next-page-button",
|
|
13975
|
+
variant: "outlined",
|
|
13976
|
+
onClick: () => {
|
|
13977
|
+
table.nextPage();
|
|
13978
|
+
scrollToTop();
|
|
13979
|
+
},
|
|
13980
|
+
size: "large",
|
|
13981
|
+
disabled: !table.getCanNextPage(),
|
|
13982
|
+
startIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRightIcon, { height: 24, width: 24 })
|
|
14480
13983
|
}
|
|
14481
|
-
|
|
14482
|
-
|
|
14483
|
-
|
|
14484
|
-
|
|
14485
|
-
|
|
14486
|
-
|
|
14487
|
-
|
|
14488
|
-
|
|
14489
|
-
|
|
14490
|
-
|
|
14491
|
-
|
|
14492
|
-
|
|
14493
|
-
|
|
14494
|
-
|
|
14495
|
-
|
|
14496
|
-
|
|
14497
|
-
|
|
14498
|
-
|
|
14499
|
-
|
|
14500
|
-
|
|
14501
|
-
|
|
14502
|
-
|
|
13984
|
+
) }) })
|
|
13985
|
+
] });
|
|
13986
|
+
}
|
|
13987
|
+
function TableFooter({
|
|
13988
|
+
table,
|
|
13989
|
+
styledTableProps,
|
|
13990
|
+
canShowStickyFooter
|
|
13991
|
+
}) {
|
|
13992
|
+
var _a, _b, _c;
|
|
13993
|
+
if (styledTableProps.hideFooter || styledTableProps.data.length === 0)
|
|
13994
|
+
return null;
|
|
13995
|
+
const paginationAlignLeft = styledTableProps.paginationAlignLeft;
|
|
13996
|
+
const pageSize = table.getState().pagination.pageSize;
|
|
13997
|
+
const totalRows = table.getFilteredRowModel().rows.length;
|
|
13998
|
+
const isManualPagination = !!table.options.manualPagination;
|
|
13999
|
+
const pagesLength = table.getPageCount() || 1;
|
|
14000
|
+
const shouldShowPagination = isManualPagination ? pagesLength > 1 : totalRows > pageSize;
|
|
14001
|
+
const footerNode = (_a = styledTableProps.footer) == null ? void 0 : _a.call(styledTableProps, table);
|
|
14002
|
+
const hasFooterNode = footerNode !== null && footerNode !== void 0 && footerNode !== false;
|
|
14003
|
+
const hasAnythingToRender = hasFooterNode || shouldShowPagination;
|
|
14004
|
+
if (!hasAnythingToRender)
|
|
14005
|
+
return null;
|
|
14006
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
14007
|
+
"div",
|
|
14008
|
+
{
|
|
14009
|
+
className: canShowStickyFooter ? style$1["table-footer--sticky"] : style$1["table-footer--inline"],
|
|
14010
|
+
style: paginationAlignLeft && {
|
|
14011
|
+
justifyContent: "flex-start"
|
|
14012
|
+
} || {},
|
|
14013
|
+
children: [
|
|
14014
|
+
!paginationAlignLeft && ((_b = styledTableProps.footer) == null ? void 0 : _b.call(styledTableProps, table)),
|
|
14015
|
+
shouldShowPagination && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
14016
|
+
TablePagination,
|
|
14017
|
+
{
|
|
14018
|
+
table,
|
|
14019
|
+
showRowSelect: !!styledTableProps.showRowCountSelect,
|
|
14020
|
+
locale: styledTableProps.locale || "en"
|
|
14021
|
+
}
|
|
14022
|
+
),
|
|
14023
|
+
paginationAlignLeft && ((_c = styledTableProps.footer) == null ? void 0 : _c.call(styledTableProps, table))
|
|
14024
|
+
]
|
|
14503
14025
|
}
|
|
14504
|
-
|
|
14026
|
+
);
|
|
14027
|
+
}
|
|
14028
|
+
function useProxyHorizontalScrollSync(enabled) {
|
|
14029
|
+
const tableScrollRef = useRef(null);
|
|
14030
|
+
const tableXRef = useRef(null);
|
|
14031
|
+
const hScrollRef = useRef(null);
|
|
14032
|
+
const hScrollContentRef = useRef(null);
|
|
14033
|
+
useLayoutEffect(() => {
|
|
14034
|
+
if (!enabled)
|
|
14505
14035
|
return;
|
|
14506
|
-
|
|
14507
|
-
|
|
14508
|
-
|
|
14509
|
-
|
|
14510
|
-
|
|
14511
|
-
reconcileScroll() {
|
|
14512
|
-
if (!this.scrollState)
|
|
14036
|
+
const tableScrollEl = tableScrollRef.current;
|
|
14037
|
+
const tableXEl = tableXRef.current;
|
|
14038
|
+
const hScrollEl = hScrollRef.current;
|
|
14039
|
+
const hScrollContentEl = hScrollContentRef.current;
|
|
14040
|
+
if (!tableScrollEl || !tableXEl || !hScrollEl || !hScrollContentEl)
|
|
14513
14041
|
return;
|
|
14514
|
-
|
|
14042
|
+
let syncing = false;
|
|
14043
|
+
const syncWidth = () => {
|
|
14044
|
+
hScrollContentEl.style.width = `${tableXEl.scrollWidth}px`;
|
|
14045
|
+
};
|
|
14046
|
+
const syncProxyFromTable = () => {
|
|
14047
|
+
if (syncing)
|
|
14048
|
+
return;
|
|
14049
|
+
syncing = true;
|
|
14050
|
+
hScrollEl.scrollLeft = tableXEl.scrollLeft;
|
|
14051
|
+
syncing = false;
|
|
14052
|
+
};
|
|
14053
|
+
const syncTableFromProxy = () => {
|
|
14054
|
+
if (syncing)
|
|
14055
|
+
return;
|
|
14056
|
+
syncing = true;
|
|
14057
|
+
tableXEl.scrollLeft = hScrollEl.scrollLeft;
|
|
14058
|
+
syncing = false;
|
|
14059
|
+
};
|
|
14060
|
+
syncWidth();
|
|
14061
|
+
syncProxyFromTable();
|
|
14062
|
+
tableXEl.addEventListener("scroll", syncProxyFromTable, { passive: true });
|
|
14063
|
+
hScrollEl.addEventListener("scroll", syncTableFromProxy, { passive: true });
|
|
14064
|
+
const ro = new ResizeObserver(syncWidth);
|
|
14065
|
+
ro.observe(tableXEl);
|
|
14066
|
+
return () => {
|
|
14067
|
+
tableXEl.removeEventListener("scroll", syncProxyFromTable);
|
|
14068
|
+
hScrollEl.removeEventListener("scroll", syncTableFromProxy);
|
|
14069
|
+
ro.disconnect();
|
|
14070
|
+
};
|
|
14071
|
+
}, [enabled]);
|
|
14072
|
+
return { tableScrollRef, tableXRef, hScrollRef, hScrollContentRef };
|
|
14073
|
+
}
|
|
14074
|
+
function useElementHeightPx() {
|
|
14075
|
+
const ref = useRef(null);
|
|
14076
|
+
const [heightPx, setHeightPx] = useState(0);
|
|
14077
|
+
useLayoutEffect(() => {
|
|
14078
|
+
const el = ref.current;
|
|
14515
14079
|
if (!el)
|
|
14516
14080
|
return;
|
|
14517
|
-
|
|
14518
|
-
|
|
14519
|
-
|
|
14520
|
-
|
|
14081
|
+
let rafId = 0;
|
|
14082
|
+
const commit = () => {
|
|
14083
|
+
const next = Math.round(el.getBoundingClientRect().height);
|
|
14084
|
+
setHeightPx((prev) => prev === next ? prev : next);
|
|
14085
|
+
};
|
|
14086
|
+
const measure = () => {
|
|
14087
|
+
cancelAnimationFrame(rafId);
|
|
14088
|
+
rafId = requestAnimationFrame(commit);
|
|
14089
|
+
};
|
|
14090
|
+
measure();
|
|
14091
|
+
const ro = new ResizeObserver(measure);
|
|
14092
|
+
ro.observe(el);
|
|
14093
|
+
return () => {
|
|
14094
|
+
cancelAnimationFrame(rafId);
|
|
14095
|
+
ro.disconnect();
|
|
14096
|
+
};
|
|
14097
|
+
}, []);
|
|
14098
|
+
return { ref, heightPx };
|
|
14099
|
+
}
|
|
14100
|
+
function memo(getDeps, fn, opts) {
|
|
14101
|
+
let deps = opts.initialDeps ?? [];
|
|
14102
|
+
let result;
|
|
14103
|
+
let isInitial = true;
|
|
14104
|
+
function memoizedFunction() {
|
|
14105
|
+
var _a, _b, _c;
|
|
14106
|
+
let depTime;
|
|
14107
|
+
if (opts.key && ((_a = opts.debug) == null ? void 0 : _a.call(opts)))
|
|
14108
|
+
depTime = Date.now();
|
|
14109
|
+
const newDeps = getDeps();
|
|
14110
|
+
const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep);
|
|
14111
|
+
if (!depsChanged) {
|
|
14112
|
+
return result;
|
|
14521
14113
|
}
|
|
14522
|
-
|
|
14523
|
-
|
|
14524
|
-
|
|
14525
|
-
|
|
14526
|
-
|
|
14527
|
-
|
|
14528
|
-
|
|
14529
|
-
|
|
14530
|
-
|
|
14531
|
-
|
|
14532
|
-
|
|
14533
|
-
|
|
14534
|
-
|
|
14535
|
-
|
|
14536
|
-
|
|
14537
|
-
|
|
14538
|
-
|
|
14539
|
-
|
|
14540
|
-
|
|
14541
|
-
|
|
14114
|
+
deps = newDeps;
|
|
14115
|
+
let resultTime;
|
|
14116
|
+
if (opts.key && ((_b = opts.debug) == null ? void 0 : _b.call(opts)))
|
|
14117
|
+
resultTime = Date.now();
|
|
14118
|
+
result = fn(...newDeps);
|
|
14119
|
+
if (opts.key && ((_c = opts.debug) == null ? void 0 : _c.call(opts))) {
|
|
14120
|
+
const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
|
|
14121
|
+
const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
|
|
14122
|
+
const resultFpsPercentage = resultEndTime / 16;
|
|
14123
|
+
const pad = (str, num) => {
|
|
14124
|
+
str = String(str);
|
|
14125
|
+
while (str.length < num) {
|
|
14126
|
+
str = " " + str;
|
|
14127
|
+
}
|
|
14128
|
+
return str;
|
|
14129
|
+
};
|
|
14130
|
+
console.info(
|
|
14131
|
+
`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,
|
|
14132
|
+
`
|
|
14133
|
+
font-size: .6rem;
|
|
14134
|
+
font-weight: bold;
|
|
14135
|
+
color: hsl(${Math.max(
|
|
14136
|
+
0,
|
|
14137
|
+
Math.min(120 - 120 * resultFpsPercentage, 120)
|
|
14138
|
+
)}deg 100% 31%);`,
|
|
14139
|
+
opts == null ? void 0 : opts.key
|
|
14140
|
+
);
|
|
14542
14141
|
}
|
|
14543
|
-
|
|
14544
|
-
|
|
14545
|
-
}
|
|
14546
|
-
const findNearestBinarySearch = (low, high, getCurrentValue, value) => {
|
|
14547
|
-
while (low <= high) {
|
|
14548
|
-
const middle = (low + high) / 2 | 0;
|
|
14549
|
-
const currentValue = getCurrentValue(middle);
|
|
14550
|
-
if (currentValue < value) {
|
|
14551
|
-
low = middle + 1;
|
|
14552
|
-
} else if (currentValue > value) {
|
|
14553
|
-
high = middle - 1;
|
|
14554
|
-
} else {
|
|
14555
|
-
return middle;
|
|
14142
|
+
if ((opts == null ? void 0 : opts.onChange) && !(isInitial && opts.skipInitialOnChange)) {
|
|
14143
|
+
opts.onChange(result);
|
|
14556
14144
|
}
|
|
14145
|
+
isInitial = false;
|
|
14146
|
+
return result;
|
|
14557
14147
|
}
|
|
14558
|
-
|
|
14559
|
-
|
|
14148
|
+
memoizedFunction.updateDeps = (newDeps) => {
|
|
14149
|
+
deps = newDeps;
|
|
14150
|
+
};
|
|
14151
|
+
return memoizedFunction;
|
|
14152
|
+
}
|
|
14153
|
+
function notUndefined(value, msg) {
|
|
14154
|
+
if (value === void 0) {
|
|
14155
|
+
throw new Error(`Unexpected undefined${msg ? `: ${msg}` : ""}`);
|
|
14560
14156
|
} else {
|
|
14561
|
-
return
|
|
14157
|
+
return value;
|
|
14562
14158
|
}
|
|
14159
|
+
}
|
|
14160
|
+
const approxEqual = (a, b) => Math.abs(a - b) < 1.01;
|
|
14161
|
+
const debounce = (targetWindow, fn, ms) => {
|
|
14162
|
+
let timeoutId;
|
|
14163
|
+
return function(...args) {
|
|
14164
|
+
targetWindow.clearTimeout(timeoutId);
|
|
14165
|
+
timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms);
|
|
14166
|
+
};
|
|
14563
14167
|
};
|
|
14564
|
-
|
|
14565
|
-
|
|
14566
|
-
|
|
14567
|
-
|
|
14568
|
-
|
|
14569
|
-
|
|
14570
|
-
const
|
|
14571
|
-
const
|
|
14572
|
-
|
|
14573
|
-
|
|
14574
|
-
|
|
14575
|
-
|
|
14168
|
+
const getRect = (element) => {
|
|
14169
|
+
const { offsetWidth, offsetHeight } = element;
|
|
14170
|
+
return { width: offsetWidth, height: offsetHeight };
|
|
14171
|
+
};
|
|
14172
|
+
const defaultKeyExtractor = (index) => index;
|
|
14173
|
+
const defaultRangeExtractor = (range) => {
|
|
14174
|
+
const start = Math.max(range.startIndex - range.overscan, 0);
|
|
14175
|
+
const end = Math.min(range.endIndex + range.overscan, range.count - 1);
|
|
14176
|
+
const arr = [];
|
|
14177
|
+
for (let i = start; i <= end; i++) {
|
|
14178
|
+
arr.push(i);
|
|
14179
|
+
}
|
|
14180
|
+
return arr;
|
|
14181
|
+
};
|
|
14182
|
+
const observeElementRect = (instance, cb) => {
|
|
14183
|
+
const element = instance.scrollElement;
|
|
14184
|
+
if (!element) {
|
|
14185
|
+
return;
|
|
14186
|
+
}
|
|
14187
|
+
const targetWindow = instance.targetWindow;
|
|
14188
|
+
if (!targetWindow) {
|
|
14189
|
+
return;
|
|
14190
|
+
}
|
|
14191
|
+
const handler = (rect) => {
|
|
14192
|
+
const { width: width2, height: height2 } = rect;
|
|
14193
|
+
cb({ width: Math.round(width2), height: Math.round(height2) });
|
|
14194
|
+
};
|
|
14195
|
+
handler(getRect(element));
|
|
14196
|
+
if (!targetWindow.ResizeObserver) {
|
|
14197
|
+
return () => {
|
|
14198
|
+
};
|
|
14199
|
+
}
|
|
14200
|
+
const observer = new targetWindow.ResizeObserver((entries) => {
|
|
14201
|
+
const run = () => {
|
|
14202
|
+
const entry = entries[0];
|
|
14203
|
+
if (entry == null ? void 0 : entry.borderBoxSize) {
|
|
14204
|
+
const box = entry.borderBoxSize[0];
|
|
14205
|
+
if (box) {
|
|
14206
|
+
handler({ width: box.inlineSize, height: box.blockSize });
|
|
14207
|
+
return;
|
|
14208
|
+
}
|
|
14209
|
+
}
|
|
14210
|
+
handler(getRect(element));
|
|
14576
14211
|
};
|
|
14212
|
+
instance.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run();
|
|
14213
|
+
});
|
|
14214
|
+
observer.observe(element, { box: "border-box" });
|
|
14215
|
+
return () => {
|
|
14216
|
+
observer.unobserve(element);
|
|
14217
|
+
};
|
|
14218
|
+
};
|
|
14219
|
+
const addEventListenerOptions = {
|
|
14220
|
+
passive: true
|
|
14221
|
+
};
|
|
14222
|
+
const supportsScrollend = typeof window == "undefined" ? true : "onscrollend" in window;
|
|
14223
|
+
const observeElementOffset = (instance, cb) => {
|
|
14224
|
+
const element = instance.scrollElement;
|
|
14225
|
+
if (!element) {
|
|
14226
|
+
return;
|
|
14227
|
+
}
|
|
14228
|
+
const targetWindow = instance.targetWindow;
|
|
14229
|
+
if (!targetWindow) {
|
|
14230
|
+
return;
|
|
14577
14231
|
}
|
|
14578
|
-
let
|
|
14579
|
-
|
|
14580
|
-
|
|
14581
|
-
|
|
14582
|
-
|
|
14232
|
+
let offset = 0;
|
|
14233
|
+
const fallback = instance.options.useScrollendEvent && supportsScrollend ? () => void 0 : debounce(
|
|
14234
|
+
targetWindow,
|
|
14235
|
+
() => {
|
|
14236
|
+
cb(offset, false);
|
|
14237
|
+
},
|
|
14238
|
+
instance.options.isScrollingResetDelay
|
|
14583
14239
|
);
|
|
14584
|
-
|
|
14585
|
-
|
|
14586
|
-
|
|
14587
|
-
|
|
14588
|
-
|
|
14589
|
-
}
|
|
14590
|
-
|
|
14591
|
-
|
|
14592
|
-
|
|
14593
|
-
|
|
14594
|
-
|
|
14595
|
-
|
|
14596
|
-
const startPerLane = Array(lanes).fill(scrollOffset + outerSize);
|
|
14597
|
-
while (startIndex >= 0 && startPerLane.some((pos) => pos >= scrollOffset)) {
|
|
14598
|
-
const item = measurements[startIndex];
|
|
14599
|
-
startPerLane[item.lane] = item.start;
|
|
14600
|
-
startIndex--;
|
|
14601
|
-
}
|
|
14602
|
-
startIndex = Math.max(0, startIndex - startIndex % lanes);
|
|
14603
|
-
endIndex = Math.min(lastIndex, endIndex + (lanes - 1 - endIndex % lanes));
|
|
14240
|
+
const createHandler = (isScrolling) => () => {
|
|
14241
|
+
const { horizontal, isRtl } = instance.options;
|
|
14242
|
+
offset = horizontal ? element["scrollLeft"] * (isRtl && -1 || 1) : element["scrollTop"];
|
|
14243
|
+
fallback();
|
|
14244
|
+
cb(offset, isScrolling);
|
|
14245
|
+
};
|
|
14246
|
+
const handler = createHandler(true);
|
|
14247
|
+
const endHandler = createHandler(false);
|
|
14248
|
+
element.addEventListener("scroll", handler, addEventListenerOptions);
|
|
14249
|
+
const registerScrollendEvent = instance.options.useScrollendEvent && supportsScrollend;
|
|
14250
|
+
if (registerScrollendEvent) {
|
|
14251
|
+
element.addEventListener("scrollend", endHandler, addEventListenerOptions);
|
|
14604
14252
|
}
|
|
14605
|
-
return
|
|
14606
|
-
|
|
14607
|
-
|
|
14608
|
-
|
|
14609
|
-
useFlushSync = true,
|
|
14610
|
-
...options
|
|
14611
|
-
}) {
|
|
14612
|
-
const rerender = React.useReducer(() => ({}), {})[1];
|
|
14613
|
-
const resolvedOptions = {
|
|
14614
|
-
...options,
|
|
14615
|
-
onChange: (instance2, sync) => {
|
|
14616
|
-
var _a;
|
|
14617
|
-
if (useFlushSync && sync) {
|
|
14618
|
-
flushSync(rerender);
|
|
14619
|
-
} else {
|
|
14620
|
-
rerender();
|
|
14621
|
-
}
|
|
14622
|
-
(_a = options.onChange) == null ? void 0 : _a.call(options, instance2, sync);
|
|
14253
|
+
return () => {
|
|
14254
|
+
element.removeEventListener("scroll", handler);
|
|
14255
|
+
if (registerScrollendEvent) {
|
|
14256
|
+
element.removeEventListener("scrollend", endHandler);
|
|
14623
14257
|
}
|
|
14624
14258
|
};
|
|
14625
|
-
|
|
14626
|
-
|
|
14627
|
-
)
|
|
14628
|
-
|
|
14629
|
-
|
|
14630
|
-
|
|
14631
|
-
|
|
14632
|
-
|
|
14633
|
-
|
|
14634
|
-
});
|
|
14635
|
-
return instance;
|
|
14636
|
-
}
|
|
14637
|
-
function useVirtualizer(options) {
|
|
14638
|
-
return useVirtualizerBase({
|
|
14639
|
-
observeElementRect,
|
|
14640
|
-
observeElementOffset,
|
|
14641
|
-
scrollToFn: elementScroll,
|
|
14642
|
-
...options
|
|
14643
|
-
});
|
|
14644
|
-
}
|
|
14645
|
-
function useRowVirtualizer({
|
|
14646
|
-
rows,
|
|
14647
|
-
rowHeight,
|
|
14648
|
-
scrollRef
|
|
14649
|
-
}) {
|
|
14650
|
-
var _a, _b;
|
|
14651
|
-
const rowVirtualizer = useVirtualizer({
|
|
14652
|
-
count: rows.length,
|
|
14653
|
-
getScrollElement: () => (scrollRef == null ? void 0 : scrollRef.current) || null,
|
|
14654
|
-
estimateSize: () => rowHeight,
|
|
14655
|
-
measureElement: typeof window !== "undefined" && navigator.userAgent.indexOf("Firefox") === -1 ? (element) => element == null ? void 0 : element.getBoundingClientRect().height : void 0,
|
|
14656
|
-
overscan: 10
|
|
14657
|
-
});
|
|
14658
|
-
const virtualRows = rowVirtualizer.getVirtualItems();
|
|
14659
|
-
const totalSize = rowVirtualizer.getTotalSize();
|
|
14660
|
-
return {
|
|
14661
|
-
rowWindow: {
|
|
14662
|
-
indexes: virtualRows.map((item) => item.index),
|
|
14663
|
-
paddingTop: ((_a = virtualRows[0]) == null ? void 0 : _a.start) ?? 0,
|
|
14664
|
-
paddingBottom: virtualRows.length ? Math.max(0, totalSize - (((_b = virtualRows[virtualRows.length - 1]) == null ? void 0 : _b.end) ?? 0)) : 0
|
|
14259
|
+
};
|
|
14260
|
+
const measureElement = (element, entry, instance) => {
|
|
14261
|
+
if (entry == null ? void 0 : entry.borderBoxSize) {
|
|
14262
|
+
const box = entry.borderBoxSize[0];
|
|
14263
|
+
if (box) {
|
|
14264
|
+
const size = Math.round(
|
|
14265
|
+
box[instance.options.horizontal ? "inlineSize" : "blockSize"]
|
|
14266
|
+
);
|
|
14267
|
+
return size;
|
|
14665
14268
|
}
|
|
14666
|
-
}
|
|
14667
|
-
|
|
14668
|
-
|
|
14669
|
-
|
|
14670
|
-
|
|
14671
|
-
|
|
14672
|
-
|
|
14673
|
-
|
|
14674
|
-
const
|
|
14675
|
-
|
|
14676
|
-
|
|
14677
|
-
|
|
14678
|
-
} = useRowVirtualizer({
|
|
14679
|
-
rows,
|
|
14680
|
-
rowHeight,
|
|
14681
|
-
scrollRef
|
|
14269
|
+
}
|
|
14270
|
+
return element[instance.options.horizontal ? "offsetWidth" : "offsetHeight"];
|
|
14271
|
+
};
|
|
14272
|
+
const elementScroll = (offset, {
|
|
14273
|
+
adjustments = 0,
|
|
14274
|
+
behavior
|
|
14275
|
+
}, instance) => {
|
|
14276
|
+
var _a, _b;
|
|
14277
|
+
const toOffset = offset + adjustments;
|
|
14278
|
+
(_b = (_a = instance.scrollElement) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, {
|
|
14279
|
+
[instance.options.horizontal ? "left" : "top"]: toOffset,
|
|
14280
|
+
behavior
|
|
14682
14281
|
});
|
|
14683
|
-
|
|
14684
|
-
|
|
14685
|
-
|
|
14686
|
-
|
|
14687
|
-
|
|
14688
|
-
|
|
14689
|
-
|
|
14690
|
-
|
|
14691
|
-
|
|
14692
|
-
|
|
14693
|
-
|
|
14694
|
-
|
|
14695
|
-
|
|
14282
|
+
};
|
|
14283
|
+
class Virtualizer {
|
|
14284
|
+
constructor(opts) {
|
|
14285
|
+
this.unsubs = [];
|
|
14286
|
+
this.scrollElement = null;
|
|
14287
|
+
this.targetWindow = null;
|
|
14288
|
+
this.isScrolling = false;
|
|
14289
|
+
this.scrollState = null;
|
|
14290
|
+
this.measurementsCache = [];
|
|
14291
|
+
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
14292
|
+
this.laneAssignments = /* @__PURE__ */ new Map();
|
|
14293
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
14294
|
+
this.prevLanes = void 0;
|
|
14295
|
+
this.lanesChangedFlag = false;
|
|
14296
|
+
this.lanesSettling = false;
|
|
14297
|
+
this.scrollRect = null;
|
|
14298
|
+
this.scrollOffset = null;
|
|
14299
|
+
this.scrollDirection = null;
|
|
14300
|
+
this.scrollAdjustments = 0;
|
|
14301
|
+
this.elementsCache = /* @__PURE__ */ new Map();
|
|
14302
|
+
this.now = () => {
|
|
14303
|
+
var _a, _b, _c;
|
|
14304
|
+
return ((_c = (_b = (_a = this.targetWindow) == null ? void 0 : _a.performance) == null ? void 0 : _b.now) == null ? void 0 : _c.call(_b)) ?? Date.now();
|
|
14305
|
+
};
|
|
14306
|
+
this.observer = /* @__PURE__ */ (() => {
|
|
14307
|
+
let _ro = null;
|
|
14308
|
+
const get = () => {
|
|
14309
|
+
if (_ro) {
|
|
14310
|
+
return _ro;
|
|
14311
|
+
}
|
|
14312
|
+
if (!this.targetWindow || !this.targetWindow.ResizeObserver) {
|
|
14313
|
+
return null;
|
|
14314
|
+
}
|
|
14315
|
+
return _ro = new this.targetWindow.ResizeObserver((entries) => {
|
|
14316
|
+
entries.forEach((entry) => {
|
|
14317
|
+
const run = () => {
|
|
14318
|
+
this._measureElement(entry.target, entry);
|
|
14319
|
+
};
|
|
14320
|
+
this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run();
|
|
14321
|
+
});
|
|
14322
|
+
});
|
|
14323
|
+
};
|
|
14324
|
+
return {
|
|
14325
|
+
disconnect: () => {
|
|
14326
|
+
var _a;
|
|
14327
|
+
(_a = get()) == null ? void 0 : _a.disconnect();
|
|
14328
|
+
_ro = null;
|
|
14696
14329
|
},
|
|
14697
|
-
|
|
14698
|
-
|
|
14699
|
-
|
|
14700
|
-
|
|
14701
|
-
|
|
14702
|
-
|
|
14703
|
-
|
|
14704
|
-
|
|
14705
|
-
|
|
14706
|
-
|
|
14707
|
-
|
|
14708
|
-
|
|
14709
|
-
|
|
14710
|
-
|
|
14711
|
-
|
|
14712
|
-
|
|
14713
|
-
|
|
14714
|
-
|
|
14715
|
-
|
|
14716
|
-
|
|
14717
|
-
|
|
14718
|
-
|
|
14719
|
-
|
|
14720
|
-
|
|
14721
|
-
|
|
14722
|
-
|
|
14723
|
-
|
|
14724
|
-
|
|
14725
|
-
|
|
14726
|
-
|
|
14727
|
-
|
|
14728
|
-
|
|
14729
|
-
|
|
14730
|
-
|
|
14731
|
-
|
|
14732
|
-
|
|
14733
|
-
|
|
14734
|
-
|
|
14735
|
-
|
|
14736
|
-
|
|
14737
|
-
|
|
14738
|
-
|
|
14330
|
+
observe: (target) => {
|
|
14331
|
+
var _a;
|
|
14332
|
+
return (_a = get()) == null ? void 0 : _a.observe(target, { box: "border-box" });
|
|
14333
|
+
},
|
|
14334
|
+
unobserve: (target) => {
|
|
14335
|
+
var _a;
|
|
14336
|
+
return (_a = get()) == null ? void 0 : _a.unobserve(target);
|
|
14337
|
+
}
|
|
14338
|
+
};
|
|
14339
|
+
})();
|
|
14340
|
+
this.range = null;
|
|
14341
|
+
this.setOptions = (opts2) => {
|
|
14342
|
+
Object.entries(opts2).forEach(([key, value]) => {
|
|
14343
|
+
if (typeof value === "undefined")
|
|
14344
|
+
delete opts2[key];
|
|
14345
|
+
});
|
|
14346
|
+
this.options = {
|
|
14347
|
+
debug: false,
|
|
14348
|
+
initialOffset: 0,
|
|
14349
|
+
overscan: 1,
|
|
14350
|
+
paddingStart: 0,
|
|
14351
|
+
paddingEnd: 0,
|
|
14352
|
+
scrollPaddingStart: 0,
|
|
14353
|
+
scrollPaddingEnd: 0,
|
|
14354
|
+
horizontal: false,
|
|
14355
|
+
getItemKey: defaultKeyExtractor,
|
|
14356
|
+
rangeExtractor: defaultRangeExtractor,
|
|
14357
|
+
onChange: () => {
|
|
14358
|
+
},
|
|
14359
|
+
measureElement,
|
|
14360
|
+
initialRect: { width: 0, height: 0 },
|
|
14361
|
+
scrollMargin: 0,
|
|
14362
|
+
gap: 0,
|
|
14363
|
+
indexAttribute: "data-index",
|
|
14364
|
+
initialMeasurementsCache: [],
|
|
14365
|
+
lanes: 1,
|
|
14366
|
+
isScrollingResetDelay: 150,
|
|
14367
|
+
enabled: true,
|
|
14368
|
+
isRtl: false,
|
|
14369
|
+
useScrollendEvent: false,
|
|
14370
|
+
useAnimationFrameWithResizeObserver: false,
|
|
14371
|
+
...opts2
|
|
14372
|
+
};
|
|
14373
|
+
};
|
|
14374
|
+
this.notify = (sync) => {
|
|
14375
|
+
var _a, _b;
|
|
14376
|
+
(_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, sync);
|
|
14377
|
+
};
|
|
14378
|
+
this.maybeNotify = memo(
|
|
14379
|
+
() => {
|
|
14380
|
+
this.calculateRange();
|
|
14381
|
+
return [
|
|
14382
|
+
this.isScrolling,
|
|
14383
|
+
this.range ? this.range.startIndex : null,
|
|
14384
|
+
this.range ? this.range.endIndex : null
|
|
14385
|
+
];
|
|
14386
|
+
},
|
|
14387
|
+
(isScrolling) => {
|
|
14388
|
+
this.notify(isScrolling);
|
|
14389
|
+
},
|
|
14739
14390
|
{
|
|
14740
|
-
|
|
14741
|
-
|
|
14742
|
-
|
|
14391
|
+
key: process.env.NODE_ENV !== "production" && "maybeNotify",
|
|
14392
|
+
debug: () => this.options.debug,
|
|
14393
|
+
initialDeps: [
|
|
14394
|
+
this.isScrolling,
|
|
14395
|
+
this.range ? this.range.startIndex : null,
|
|
14396
|
+
this.range ? this.range.endIndex : null
|
|
14397
|
+
]
|
|
14743
14398
|
}
|
|
14744
|
-
)
|
|
14745
|
-
|
|
14746
|
-
|
|
14747
|
-
|
|
14748
|
-
|
|
14749
|
-
|
|
14750
|
-
|
|
14751
|
-
|
|
14752
|
-
to: "360 12 12",
|
|
14753
|
-
type: "rotate"
|
|
14399
|
+
);
|
|
14400
|
+
this.cleanup = () => {
|
|
14401
|
+
this.unsubs.filter(Boolean).forEach((d) => d());
|
|
14402
|
+
this.unsubs = [];
|
|
14403
|
+
this.observer.disconnect();
|
|
14404
|
+
if (this.rafId != null && this.targetWindow) {
|
|
14405
|
+
this.targetWindow.cancelAnimationFrame(this.rafId);
|
|
14406
|
+
this.rafId = null;
|
|
14754
14407
|
}
|
|
14755
|
-
|
|
14756
|
-
|
|
14757
|
-
|
|
14758
|
-
|
|
14759
|
-
|
|
14760
|
-
|
|
14761
|
-
|
|
14762
|
-
|
|
14763
|
-
}
|
|
14764
|
-
|
|
14765
|
-
|
|
14766
|
-
|
|
14767
|
-
|
|
14768
|
-
|
|
14769
|
-
|
|
14770
|
-
|
|
14771
|
-
|
|
14772
|
-
|
|
14773
|
-
|
|
14774
|
-
|
|
14775
|
-
|
|
14776
|
-
}
|
|
14777
|
-
|
|
14778
|
-
|
|
14779
|
-
|
|
14780
|
-
|
|
14781
|
-
|
|
14782
|
-
|
|
14783
|
-
|
|
14784
|
-
|
|
14785
|
-
|
|
14408
|
+
this.scrollState = null;
|
|
14409
|
+
this.scrollElement = null;
|
|
14410
|
+
this.targetWindow = null;
|
|
14411
|
+
};
|
|
14412
|
+
this._didMount = () => {
|
|
14413
|
+
return () => {
|
|
14414
|
+
this.cleanup();
|
|
14415
|
+
};
|
|
14416
|
+
};
|
|
14417
|
+
this._willUpdate = () => {
|
|
14418
|
+
var _a;
|
|
14419
|
+
const scrollElement = this.options.enabled ? this.options.getScrollElement() : null;
|
|
14420
|
+
if (this.scrollElement !== scrollElement) {
|
|
14421
|
+
this.cleanup();
|
|
14422
|
+
if (!scrollElement) {
|
|
14423
|
+
this.maybeNotify();
|
|
14424
|
+
return;
|
|
14425
|
+
}
|
|
14426
|
+
this.scrollElement = scrollElement;
|
|
14427
|
+
if (this.scrollElement && "ownerDocument" in this.scrollElement) {
|
|
14428
|
+
this.targetWindow = this.scrollElement.ownerDocument.defaultView;
|
|
14429
|
+
} else {
|
|
14430
|
+
this.targetWindow = ((_a = this.scrollElement) == null ? void 0 : _a.window) ?? null;
|
|
14431
|
+
}
|
|
14432
|
+
this.elementsCache.forEach((cached) => {
|
|
14433
|
+
this.observer.observe(cached);
|
|
14434
|
+
});
|
|
14435
|
+
this.unsubs.push(
|
|
14436
|
+
this.options.observeElementRect(this, (rect) => {
|
|
14437
|
+
this.scrollRect = rect;
|
|
14438
|
+
this.maybeNotify();
|
|
14439
|
+
})
|
|
14440
|
+
);
|
|
14441
|
+
this.unsubs.push(
|
|
14442
|
+
this.options.observeElementOffset(this, (offset, isScrolling) => {
|
|
14443
|
+
this.scrollAdjustments = 0;
|
|
14444
|
+
this.scrollDirection = isScrolling ? this.getScrollOffset() < offset ? "forward" : "backward" : null;
|
|
14445
|
+
this.scrollOffset = offset;
|
|
14446
|
+
this.isScrolling = isScrolling;
|
|
14447
|
+
if (this.scrollState) {
|
|
14448
|
+
this.scheduleScrollReconcile();
|
|
14449
|
+
}
|
|
14450
|
+
this.maybeNotify();
|
|
14451
|
+
})
|
|
14452
|
+
);
|
|
14453
|
+
this._scrollToOffset(this.getScrollOffset(), {
|
|
14454
|
+
adjustments: void 0,
|
|
14455
|
+
behavior: void 0
|
|
14456
|
+
});
|
|
14786
14457
|
}
|
|
14787
|
-
}
|
|
14788
|
-
|
|
14789
|
-
|
|
14790
|
-
|
|
14791
|
-
|
|
14792
|
-
|
|
14793
|
-
|
|
14794
|
-
|
|
14795
|
-
|
|
14796
|
-
|
|
14458
|
+
};
|
|
14459
|
+
this.rafId = null;
|
|
14460
|
+
this.getSize = () => {
|
|
14461
|
+
if (!this.options.enabled) {
|
|
14462
|
+
this.scrollRect = null;
|
|
14463
|
+
return 0;
|
|
14464
|
+
}
|
|
14465
|
+
this.scrollRect = this.scrollRect ?? this.options.initialRect;
|
|
14466
|
+
return this.scrollRect[this.options.horizontal ? "width" : "height"];
|
|
14467
|
+
};
|
|
14468
|
+
this.getScrollOffset = () => {
|
|
14469
|
+
if (!this.options.enabled) {
|
|
14470
|
+
this.scrollOffset = null;
|
|
14471
|
+
return 0;
|
|
14472
|
+
}
|
|
14473
|
+
this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset === "function" ? this.options.initialOffset() : this.options.initialOffset);
|
|
14474
|
+
return this.scrollOffset;
|
|
14475
|
+
};
|
|
14476
|
+
this.getFurthestMeasurement = (measurements, index) => {
|
|
14477
|
+
const furthestMeasurementsFound = /* @__PURE__ */ new Map();
|
|
14478
|
+
const furthestMeasurements = /* @__PURE__ */ new Map();
|
|
14479
|
+
for (let m = index - 1; m >= 0; m--) {
|
|
14480
|
+
const measurement = measurements[m];
|
|
14481
|
+
if (furthestMeasurementsFound.has(measurement.lane)) {
|
|
14482
|
+
continue;
|
|
14797
14483
|
}
|
|
14798
|
-
|
|
14799
|
-
|
|
14800
|
-
|
|
14801
|
-
|
|
14802
|
-
);
|
|
14803
|
-
|
|
14804
|
-
|
|
14805
|
-
|
|
14806
|
-
|
|
14807
|
-
|
|
14808
|
-
}
|
|
14809
|
-
|
|
14810
|
-
|
|
14811
|
-
|
|
14812
|
-
|
|
14813
|
-
|
|
14814
|
-
|
|
14815
|
-
|
|
14816
|
-
|
|
14817
|
-
|
|
14818
|
-
|
|
14819
|
-
|
|
14820
|
-
|
|
14821
|
-
|
|
14822
|
-
|
|
14823
|
-
|
|
14824
|
-
|
|
14825
|
-
|
|
14826
|
-
|
|
14827
|
-
|
|
14828
|
-
|
|
14829
|
-
|
|
14830
|
-
|
|
14831
|
-
|
|
14832
|
-
|
|
14833
|
-
|
|
14834
|
-
|
|
14835
|
-
|
|
14836
|
-
|
|
14837
|
-
|
|
14838
|
-
|
|
14839
|
-
|
|
14840
|
-
|
|
14841
|
-
|
|
14842
|
-
|
|
14843
|
-
|
|
14844
|
-
|
|
14845
|
-
|
|
14846
|
-
|
|
14847
|
-
|
|
14848
|
-
|
|
14849
|
-
|
|
14850
|
-
|
|
14851
|
-
|
|
14852
|
-
|
|
14853
|
-
|
|
14854
|
-
|
|
14855
|
-
|
|
14856
|
-
|
|
14857
|
-
|
|
14858
|
-
|
|
14859
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: tablePaginationRef, className: style["table-pagination"], children: [
|
|
14860
|
-
showRowSelect && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
14861
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
14862
|
-
StyledButton,
|
|
14863
|
-
{
|
|
14864
|
-
dataTest: "table-rows-count-button",
|
|
14865
|
-
variant: "outlined",
|
|
14866
|
-
size: "large",
|
|
14867
|
-
onClick: handleOpenRows,
|
|
14868
|
-
endIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
14869
|
-
ChevronDownIcon,
|
|
14870
|
-
{
|
|
14871
|
-
className: `${openRows ? "rotate-180" : "rotate-0"} transition-transform duration-300`,
|
|
14872
|
-
height: 24,
|
|
14873
|
-
width: 24
|
|
14484
|
+
const previousFurthestMeasurement = furthestMeasurements.get(
|
|
14485
|
+
measurement.lane
|
|
14486
|
+
);
|
|
14487
|
+
if (previousFurthestMeasurement == null || measurement.end > previousFurthestMeasurement.end) {
|
|
14488
|
+
furthestMeasurements.set(measurement.lane, measurement);
|
|
14489
|
+
} else if (measurement.end < previousFurthestMeasurement.end) {
|
|
14490
|
+
furthestMeasurementsFound.set(measurement.lane, true);
|
|
14491
|
+
}
|
|
14492
|
+
if (furthestMeasurementsFound.size === this.options.lanes) {
|
|
14493
|
+
break;
|
|
14494
|
+
}
|
|
14495
|
+
}
|
|
14496
|
+
return furthestMeasurements.size === this.options.lanes ? Array.from(furthestMeasurements.values()).sort((a, b) => {
|
|
14497
|
+
if (a.end === b.end) {
|
|
14498
|
+
return a.index - b.index;
|
|
14499
|
+
}
|
|
14500
|
+
return a.end - b.end;
|
|
14501
|
+
})[0] : void 0;
|
|
14502
|
+
};
|
|
14503
|
+
this.getMeasurementOptions = memo(
|
|
14504
|
+
() => [
|
|
14505
|
+
this.options.count,
|
|
14506
|
+
this.options.paddingStart,
|
|
14507
|
+
this.options.scrollMargin,
|
|
14508
|
+
this.options.getItemKey,
|
|
14509
|
+
this.options.enabled,
|
|
14510
|
+
this.options.lanes
|
|
14511
|
+
],
|
|
14512
|
+
(count2, paddingStart, scrollMargin, getItemKey, enabled, lanes) => {
|
|
14513
|
+
const lanesChanged = this.prevLanes !== void 0 && this.prevLanes !== lanes;
|
|
14514
|
+
if (lanesChanged) {
|
|
14515
|
+
this.lanesChangedFlag = true;
|
|
14516
|
+
}
|
|
14517
|
+
this.prevLanes = lanes;
|
|
14518
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
14519
|
+
return {
|
|
14520
|
+
count: count2,
|
|
14521
|
+
paddingStart,
|
|
14522
|
+
scrollMargin,
|
|
14523
|
+
getItemKey,
|
|
14524
|
+
enabled,
|
|
14525
|
+
lanes
|
|
14526
|
+
};
|
|
14527
|
+
},
|
|
14528
|
+
{
|
|
14529
|
+
key: false
|
|
14530
|
+
}
|
|
14531
|
+
);
|
|
14532
|
+
this.getMeasurements = memo(
|
|
14533
|
+
() => [this.getMeasurementOptions(), this.itemSizeCache],
|
|
14534
|
+
({ count: count2, paddingStart, scrollMargin, getItemKey, enabled, lanes }, itemSizeCache) => {
|
|
14535
|
+
if (!enabled) {
|
|
14536
|
+
this.measurementsCache = [];
|
|
14537
|
+
this.itemSizeCache.clear();
|
|
14538
|
+
this.laneAssignments.clear();
|
|
14539
|
+
return [];
|
|
14540
|
+
}
|
|
14541
|
+
if (this.laneAssignments.size > count2) {
|
|
14542
|
+
for (const index of this.laneAssignments.keys()) {
|
|
14543
|
+
if (index >= count2) {
|
|
14544
|
+
this.laneAssignments.delete(index);
|
|
14874
14545
|
}
|
|
14875
|
-
|
|
14876
|
-
children: [
|
|
14877
|
-
pageSize,
|
|
14878
|
-
" ",
|
|
14879
|
-
isNo ? "rader" : "rows"
|
|
14880
|
-
]
|
|
14546
|
+
}
|
|
14881
14547
|
}
|
|
14882
|
-
|
|
14883
|
-
|
|
14884
|
-
|
|
14885
|
-
|
|
14886
|
-
|
|
14887
|
-
|
|
14888
|
-
|
|
14889
|
-
|
|
14890
|
-
|
|
14891
|
-
|
|
14892
|
-
|
|
14893
|
-
|
|
14894
|
-
|
|
14548
|
+
if (this.lanesChangedFlag) {
|
|
14549
|
+
this.lanesChangedFlag = false;
|
|
14550
|
+
this.lanesSettling = true;
|
|
14551
|
+
this.measurementsCache = [];
|
|
14552
|
+
this.itemSizeCache.clear();
|
|
14553
|
+
this.laneAssignments.clear();
|
|
14554
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
14555
|
+
}
|
|
14556
|
+
if (this.measurementsCache.length === 0 && !this.lanesSettling) {
|
|
14557
|
+
this.measurementsCache = this.options.initialMeasurementsCache;
|
|
14558
|
+
this.measurementsCache.forEach((item) => {
|
|
14559
|
+
this.itemSizeCache.set(item.key, item.size);
|
|
14560
|
+
});
|
|
14561
|
+
}
|
|
14562
|
+
const min2 = this.lanesSettling ? 0 : this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
|
|
14563
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
14564
|
+
if (this.lanesSettling && this.measurementsCache.length === count2) {
|
|
14565
|
+
this.lanesSettling = false;
|
|
14566
|
+
}
|
|
14567
|
+
const measurements = this.measurementsCache.slice(0, min2);
|
|
14568
|
+
const laneLastIndex = new Array(lanes).fill(
|
|
14569
|
+
void 0
|
|
14570
|
+
);
|
|
14571
|
+
for (let m = 0; m < min2; m++) {
|
|
14572
|
+
const item = measurements[m];
|
|
14573
|
+
if (item) {
|
|
14574
|
+
laneLastIndex[item.lane] = m;
|
|
14575
|
+
}
|
|
14576
|
+
}
|
|
14577
|
+
for (let i = min2; i < count2; i++) {
|
|
14578
|
+
const key = getItemKey(i);
|
|
14579
|
+
const cachedLane = this.laneAssignments.get(i);
|
|
14580
|
+
let lane;
|
|
14581
|
+
let start;
|
|
14582
|
+
if (cachedLane !== void 0 && this.options.lanes > 1) {
|
|
14583
|
+
lane = cachedLane;
|
|
14584
|
+
const prevIndex = laneLastIndex[lane];
|
|
14585
|
+
const prevInLane = prevIndex !== void 0 ? measurements[prevIndex] : void 0;
|
|
14586
|
+
start = prevInLane ? prevInLane.end + this.options.gap : paddingStart + scrollMargin;
|
|
14587
|
+
} else {
|
|
14588
|
+
const furthestMeasurement = this.options.lanes === 1 ? measurements[i - 1] : this.getFurthestMeasurement(measurements, i);
|
|
14589
|
+
start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
|
|
14590
|
+
lane = furthestMeasurement ? furthestMeasurement.lane : i % this.options.lanes;
|
|
14591
|
+
if (this.options.lanes > 1) {
|
|
14592
|
+
this.laneAssignments.set(i, lane);
|
|
14895
14593
|
}
|
|
14896
|
-
}
|
|
14897
|
-
|
|
14898
|
-
|
|
14899
|
-
|
|
14900
|
-
|
|
14901
|
-
|
|
14902
|
-
|
|
14903
|
-
|
|
14904
|
-
|
|
14905
|
-
|
|
14906
|
-
|
|
14907
|
-
|
|
14908
|
-
|
|
14909
|
-
selected: pageSize === size,
|
|
14910
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-delta-700 text-sm font-normal", children: [
|
|
14911
|
-
size,
|
|
14912
|
-
" ",
|
|
14913
|
-
isNo ? "rader" : "rows"
|
|
14914
|
-
] })
|
|
14915
|
-
},
|
|
14916
|
-
size
|
|
14917
|
-
))
|
|
14594
|
+
}
|
|
14595
|
+
const measuredSize = itemSizeCache.get(key);
|
|
14596
|
+
const size = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i);
|
|
14597
|
+
const end = start + size;
|
|
14598
|
+
measurements[i] = {
|
|
14599
|
+
index: i,
|
|
14600
|
+
start,
|
|
14601
|
+
size,
|
|
14602
|
+
end,
|
|
14603
|
+
key,
|
|
14604
|
+
lane
|
|
14605
|
+
};
|
|
14606
|
+
laneLastIndex[lane] = i;
|
|
14918
14607
|
}
|
|
14919
|
-
|
|
14920
|
-
|
|
14921
|
-
|
|
14922
|
-
StyledButton,
|
|
14608
|
+
this.measurementsCache = measurements;
|
|
14609
|
+
return measurements;
|
|
14610
|
+
},
|
|
14923
14611
|
{
|
|
14924
|
-
|
|
14925
|
-
|
|
14926
|
-
|
|
14927
|
-
|
|
14928
|
-
|
|
14929
|
-
|
|
14930
|
-
|
|
14931
|
-
|
|
14932
|
-
|
|
14933
|
-
|
|
14612
|
+
key: process.env.NODE_ENV !== "production" && "getMeasurements",
|
|
14613
|
+
debug: () => this.options.debug
|
|
14614
|
+
}
|
|
14615
|
+
);
|
|
14616
|
+
this.calculateRange = memo(
|
|
14617
|
+
() => [
|
|
14618
|
+
this.getMeasurements(),
|
|
14619
|
+
this.getSize(),
|
|
14620
|
+
this.getScrollOffset(),
|
|
14621
|
+
this.options.lanes
|
|
14622
|
+
],
|
|
14623
|
+
(measurements, outerSize, scrollOffset, lanes) => {
|
|
14624
|
+
return this.range = measurements.length > 0 && outerSize > 0 ? calculateRange({
|
|
14625
|
+
measurements,
|
|
14626
|
+
outerSize,
|
|
14627
|
+
scrollOffset,
|
|
14628
|
+
lanes
|
|
14629
|
+
}) : null;
|
|
14630
|
+
},
|
|
14631
|
+
{
|
|
14632
|
+
key: process.env.NODE_ENV !== "production" && "calculateRange",
|
|
14633
|
+
debug: () => this.options.debug
|
|
14634
|
+
}
|
|
14635
|
+
);
|
|
14636
|
+
this.getVirtualIndexes = memo(
|
|
14637
|
+
() => {
|
|
14638
|
+
let startIndex = null;
|
|
14639
|
+
let endIndex = null;
|
|
14640
|
+
const range = this.calculateRange();
|
|
14641
|
+
if (range) {
|
|
14642
|
+
startIndex = range.startIndex;
|
|
14643
|
+
endIndex = range.endIndex;
|
|
14644
|
+
}
|
|
14645
|
+
this.maybeNotify.updateDeps([this.isScrolling, startIndex, endIndex]);
|
|
14646
|
+
return [
|
|
14647
|
+
this.options.rangeExtractor,
|
|
14648
|
+
this.options.overscan,
|
|
14649
|
+
this.options.count,
|
|
14650
|
+
startIndex,
|
|
14651
|
+
endIndex
|
|
14652
|
+
];
|
|
14653
|
+
},
|
|
14654
|
+
(rangeExtractor, overscan, count2, startIndex, endIndex) => {
|
|
14655
|
+
return startIndex === null || endIndex === null ? [] : rangeExtractor({
|
|
14656
|
+
startIndex,
|
|
14657
|
+
endIndex,
|
|
14658
|
+
overscan,
|
|
14659
|
+
count: count2
|
|
14660
|
+
});
|
|
14661
|
+
},
|
|
14662
|
+
{
|
|
14663
|
+
key: process.env.NODE_ENV !== "production" && "getVirtualIndexes",
|
|
14664
|
+
debug: () => this.options.debug
|
|
14665
|
+
}
|
|
14666
|
+
);
|
|
14667
|
+
this.indexFromElement = (node) => {
|
|
14668
|
+
const attributeName = this.options.indexAttribute;
|
|
14669
|
+
const indexStr = node.getAttribute(attributeName);
|
|
14670
|
+
if (!indexStr) {
|
|
14671
|
+
console.warn(
|
|
14672
|
+
`Missing attribute name '${attributeName}={index}' on measured element.`
|
|
14673
|
+
);
|
|
14674
|
+
return -1;
|
|
14675
|
+
}
|
|
14676
|
+
return parseInt(indexStr, 10);
|
|
14677
|
+
};
|
|
14678
|
+
this.shouldMeasureDuringScroll = (index) => {
|
|
14679
|
+
var _a;
|
|
14680
|
+
if (!this.scrollState || this.scrollState.behavior !== "smooth") {
|
|
14681
|
+
return true;
|
|
14682
|
+
}
|
|
14683
|
+
const scrollIndex = this.scrollState.index ?? ((_a = this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)) == null ? void 0 : _a.index);
|
|
14684
|
+
if (scrollIndex !== void 0 && this.range) {
|
|
14685
|
+
const bufferSize = Math.max(
|
|
14686
|
+
this.options.overscan,
|
|
14687
|
+
Math.ceil((this.range.endIndex - this.range.startIndex) / 2)
|
|
14688
|
+
);
|
|
14689
|
+
const minIndex = Math.max(0, scrollIndex - bufferSize);
|
|
14690
|
+
const maxIndex = Math.min(
|
|
14691
|
+
this.options.count - 1,
|
|
14692
|
+
scrollIndex + bufferSize
|
|
14693
|
+
);
|
|
14694
|
+
return index >= minIndex && index <= maxIndex;
|
|
14695
|
+
}
|
|
14696
|
+
return true;
|
|
14697
|
+
};
|
|
14698
|
+
this._measureElement = (node, entry) => {
|
|
14699
|
+
if (!node.isConnected) {
|
|
14700
|
+
this.observer.unobserve(node);
|
|
14701
|
+
return;
|
|
14702
|
+
}
|
|
14703
|
+
const index = this.indexFromElement(node);
|
|
14704
|
+
const item = this.measurementsCache[index];
|
|
14705
|
+
if (!item) {
|
|
14706
|
+
return;
|
|
14707
|
+
}
|
|
14708
|
+
const key = item.key;
|
|
14709
|
+
const prevNode = this.elementsCache.get(key);
|
|
14710
|
+
if (prevNode !== node) {
|
|
14711
|
+
if (prevNode) {
|
|
14712
|
+
this.observer.unobserve(prevNode);
|
|
14713
|
+
}
|
|
14714
|
+
this.observer.observe(node);
|
|
14715
|
+
this.elementsCache.set(key, node);
|
|
14716
|
+
}
|
|
14717
|
+
if (this.shouldMeasureDuringScroll(index)) {
|
|
14718
|
+
this.resizeItem(index, this.options.measureElement(node, entry, this));
|
|
14719
|
+
}
|
|
14720
|
+
};
|
|
14721
|
+
this.resizeItem = (index, size) => {
|
|
14722
|
+
var _a;
|
|
14723
|
+
const item = this.measurementsCache[index];
|
|
14724
|
+
if (!item) {
|
|
14725
|
+
return;
|
|
14726
|
+
}
|
|
14727
|
+
const itemSize = this.itemSizeCache.get(item.key) ?? item.size;
|
|
14728
|
+
const delta = size - itemSize;
|
|
14729
|
+
if (delta !== 0) {
|
|
14730
|
+
if (((_a = this.scrollState) == null ? void 0 : _a.behavior) !== "smooth" && (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(item, delta, this) : item.start < this.getScrollOffset() + this.scrollAdjustments)) {
|
|
14731
|
+
if (process.env.NODE_ENV !== "production" && this.options.debug) {
|
|
14732
|
+
console.info("correction", delta);
|
|
14934
14733
|
}
|
|
14935
|
-
|
|
14936
|
-
|
|
14937
|
-
|
|
14938
|
-
|
|
14939
|
-
|
|
14940
|
-
|
|
14941
|
-
|
|
14942
|
-
|
|
14943
|
-
pagesLength
|
|
14944
|
-
]
|
|
14734
|
+
this._scrollToOffset(this.getScrollOffset(), {
|
|
14735
|
+
adjustments: this.scrollAdjustments += delta,
|
|
14736
|
+
behavior: void 0
|
|
14737
|
+
});
|
|
14738
|
+
}
|
|
14739
|
+
this.pendingMeasuredCacheIndexes.push(item.index);
|
|
14740
|
+
this.itemSizeCache = new Map(this.itemSizeCache.set(item.key, size));
|
|
14741
|
+
this.notify(false);
|
|
14945
14742
|
}
|
|
14946
|
-
|
|
14947
|
-
|
|
14948
|
-
|
|
14949
|
-
|
|
14950
|
-
|
|
14951
|
-
|
|
14952
|
-
|
|
14953
|
-
paper: {
|
|
14954
|
-
sx: {
|
|
14955
|
-
width: anchorEl ? anchorEl.clientWidth : void 0,
|
|
14956
|
-
maxHeight: 288,
|
|
14957
|
-
overflowY: "auto"
|
|
14958
|
-
}
|
|
14743
|
+
};
|
|
14744
|
+
this.measureElement = (node) => {
|
|
14745
|
+
if (!node) {
|
|
14746
|
+
this.elementsCache.forEach((cached, key) => {
|
|
14747
|
+
if (!cached.isConnected) {
|
|
14748
|
+
this.observer.unobserve(cached);
|
|
14749
|
+
this.elementsCache.delete(key);
|
|
14959
14750
|
}
|
|
14960
|
-
}
|
|
14961
|
-
|
|
14962
|
-
anchorOrigin: popoverOrigin.anchorOrigin,
|
|
14963
|
-
transformOrigin: popoverOrigin.transformOrigin,
|
|
14964
|
-
classes: { paper: "border border-solid border-delta-200 py-2" },
|
|
14965
|
-
children: pages.map((page) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
14966
|
-
StyledMenuItem,
|
|
14967
|
-
{
|
|
14968
|
-
onClick: (e) => {
|
|
14969
|
-
e.stopPropagation();
|
|
14970
|
-
e.preventDefault();
|
|
14971
|
-
handlePageChange(page);
|
|
14972
|
-
},
|
|
14973
|
-
selected: page === currentPage,
|
|
14974
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-delta-700 text-sm font-normal", children: [
|
|
14975
|
-
isNo ? "Side" : "Page",
|
|
14976
|
-
" ",
|
|
14977
|
-
page
|
|
14978
|
-
] })
|
|
14979
|
-
},
|
|
14980
|
-
page
|
|
14981
|
-
))
|
|
14751
|
+
});
|
|
14752
|
+
return;
|
|
14982
14753
|
}
|
|
14983
|
-
|
|
14984
|
-
|
|
14985
|
-
|
|
14754
|
+
this._measureElement(node, void 0);
|
|
14755
|
+
};
|
|
14756
|
+
this.getVirtualItems = memo(
|
|
14757
|
+
() => [this.getVirtualIndexes(), this.getMeasurements()],
|
|
14758
|
+
(indexes, measurements) => {
|
|
14759
|
+
const virtualItems = [];
|
|
14760
|
+
for (let k = 0, len = indexes.length; k < len; k++) {
|
|
14761
|
+
const i = indexes[k];
|
|
14762
|
+
const measurement = measurements[i];
|
|
14763
|
+
virtualItems.push(measurement);
|
|
14764
|
+
}
|
|
14765
|
+
return virtualItems;
|
|
14766
|
+
},
|
|
14986
14767
|
{
|
|
14987
|
-
|
|
14988
|
-
|
|
14989
|
-
onClick: () => {
|
|
14990
|
-
table.previousPage();
|
|
14991
|
-
scrollToTop();
|
|
14992
|
-
},
|
|
14993
|
-
size: "large",
|
|
14994
|
-
disabled: !table.getCanPreviousPage(),
|
|
14995
|
-
startIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronLeftIcon, { height: 24, width: 24 })
|
|
14768
|
+
key: process.env.NODE_ENV !== "production" && "getVirtualItems",
|
|
14769
|
+
debug: () => this.options.debug
|
|
14996
14770
|
}
|
|
14997
|
-
)
|
|
14998
|
-
|
|
14999
|
-
|
|
15000
|
-
{
|
|
15001
|
-
|
|
15002
|
-
variant: "outlined",
|
|
15003
|
-
onClick: () => {
|
|
15004
|
-
table.nextPage();
|
|
15005
|
-
scrollToTop();
|
|
15006
|
-
},
|
|
15007
|
-
size: "large",
|
|
15008
|
-
disabled: !table.getCanNextPage(),
|
|
15009
|
-
startIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRightIcon, { height: 24, width: 24 })
|
|
14771
|
+
);
|
|
14772
|
+
this.getVirtualItemForOffset = (offset) => {
|
|
14773
|
+
const measurements = this.getMeasurements();
|
|
14774
|
+
if (measurements.length === 0) {
|
|
14775
|
+
return void 0;
|
|
15010
14776
|
}
|
|
15011
|
-
|
|
15012
|
-
|
|
15013
|
-
|
|
15014
|
-
|
|
15015
|
-
|
|
15016
|
-
|
|
15017
|
-
|
|
15018
|
-
|
|
15019
|
-
|
|
15020
|
-
|
|
15021
|
-
|
|
15022
|
-
|
|
15023
|
-
|
|
15024
|
-
|
|
15025
|
-
|
|
15026
|
-
|
|
15027
|
-
|
|
15028
|
-
|
|
15029
|
-
|
|
15030
|
-
|
|
15031
|
-
|
|
15032
|
-
|
|
15033
|
-
|
|
15034
|
-
|
|
15035
|
-
|
|
15036
|
-
|
|
15037
|
-
|
|
15038
|
-
|
|
15039
|
-
|
|
15040
|
-
|
|
15041
|
-
|
|
15042
|
-
|
|
15043
|
-
|
|
15044
|
-
|
|
15045
|
-
|
|
15046
|
-
|
|
15047
|
-
|
|
15048
|
-
|
|
15049
|
-
|
|
15050
|
-
|
|
15051
|
-
|
|
15052
|
-
|
|
15053
|
-
|
|
15054
|
-
|
|
15055
|
-
|
|
15056
|
-
|
|
15057
|
-
|
|
15058
|
-
|
|
15059
|
-
|
|
15060
|
-
|
|
15061
|
-
|
|
15062
|
-
|
|
15063
|
-
|
|
15064
|
-
|
|
15065
|
-
|
|
15066
|
-
|
|
15067
|
-
|
|
15068
|
-
|
|
15069
|
-
|
|
15070
|
-
|
|
15071
|
-
|
|
14777
|
+
return notUndefined(
|
|
14778
|
+
measurements[findNearestBinarySearch(
|
|
14779
|
+
0,
|
|
14780
|
+
measurements.length - 1,
|
|
14781
|
+
(index) => notUndefined(measurements[index]).start,
|
|
14782
|
+
offset
|
|
14783
|
+
)]
|
|
14784
|
+
);
|
|
14785
|
+
};
|
|
14786
|
+
this.getMaxScrollOffset = () => {
|
|
14787
|
+
if (!this.scrollElement)
|
|
14788
|
+
return 0;
|
|
14789
|
+
if ("scrollHeight" in this.scrollElement) {
|
|
14790
|
+
return this.options.horizontal ? this.scrollElement.scrollWidth - this.scrollElement.clientWidth : this.scrollElement.scrollHeight - this.scrollElement.clientHeight;
|
|
14791
|
+
} else {
|
|
14792
|
+
const doc = this.scrollElement.document.documentElement;
|
|
14793
|
+
return this.options.horizontal ? doc.scrollWidth - this.scrollElement.innerWidth : doc.scrollHeight - this.scrollElement.innerHeight;
|
|
14794
|
+
}
|
|
14795
|
+
};
|
|
14796
|
+
this.getOffsetForAlignment = (toOffset, align, itemSize = 0) => {
|
|
14797
|
+
if (!this.scrollElement)
|
|
14798
|
+
return 0;
|
|
14799
|
+
const size = this.getSize();
|
|
14800
|
+
const scrollOffset = this.getScrollOffset();
|
|
14801
|
+
if (align === "auto") {
|
|
14802
|
+
align = toOffset >= scrollOffset + size ? "end" : "start";
|
|
14803
|
+
}
|
|
14804
|
+
if (align === "center") {
|
|
14805
|
+
toOffset += (itemSize - size) / 2;
|
|
14806
|
+
} else if (align === "end") {
|
|
14807
|
+
toOffset -= size;
|
|
14808
|
+
}
|
|
14809
|
+
const maxOffset = this.getMaxScrollOffset();
|
|
14810
|
+
return Math.max(Math.min(maxOffset, toOffset), 0);
|
|
14811
|
+
};
|
|
14812
|
+
this.getOffsetForIndex = (index, align = "auto") => {
|
|
14813
|
+
index = Math.max(0, Math.min(index, this.options.count - 1));
|
|
14814
|
+
const size = this.getSize();
|
|
14815
|
+
const scrollOffset = this.getScrollOffset();
|
|
14816
|
+
const item = this.measurementsCache[index];
|
|
14817
|
+
if (!item)
|
|
14818
|
+
return;
|
|
14819
|
+
if (align === "auto") {
|
|
14820
|
+
if (item.end >= scrollOffset + size - this.options.scrollPaddingEnd) {
|
|
14821
|
+
align = "end";
|
|
14822
|
+
} else if (item.start <= scrollOffset + this.options.scrollPaddingStart) {
|
|
14823
|
+
align = "start";
|
|
14824
|
+
} else {
|
|
14825
|
+
return [scrollOffset, align];
|
|
14826
|
+
}
|
|
14827
|
+
}
|
|
14828
|
+
if (align === "end" && index === this.options.count - 1) {
|
|
14829
|
+
return [this.getMaxScrollOffset(), align];
|
|
14830
|
+
}
|
|
14831
|
+
const toOffset = align === "end" ? item.end + this.options.scrollPaddingEnd : item.start - this.options.scrollPaddingStart;
|
|
14832
|
+
return [
|
|
14833
|
+
this.getOffsetForAlignment(toOffset, align, item.size),
|
|
14834
|
+
align
|
|
14835
|
+
];
|
|
14836
|
+
};
|
|
14837
|
+
this.scrollToOffset = (toOffset, { align = "start", behavior = "auto" } = {}) => {
|
|
14838
|
+
const offset = this.getOffsetForAlignment(toOffset, align);
|
|
14839
|
+
const now = this.now();
|
|
14840
|
+
this.scrollState = {
|
|
14841
|
+
index: null,
|
|
14842
|
+
align,
|
|
14843
|
+
behavior,
|
|
14844
|
+
startedAt: now,
|
|
14845
|
+
lastTargetOffset: offset,
|
|
14846
|
+
stableFrames: 0
|
|
14847
|
+
};
|
|
14848
|
+
this._scrollToOffset(offset, { adjustments: void 0, behavior });
|
|
14849
|
+
this.scheduleScrollReconcile();
|
|
15072
14850
|
};
|
|
15073
|
-
|
|
15074
|
-
|
|
14851
|
+
this.scrollToIndex = (index, {
|
|
14852
|
+
align: initialAlign = "auto",
|
|
14853
|
+
behavior = "auto"
|
|
14854
|
+
} = {}) => {
|
|
14855
|
+
index = Math.max(0, Math.min(index, this.options.count - 1));
|
|
14856
|
+
const offsetInfo = this.getOffsetForIndex(index, initialAlign);
|
|
14857
|
+
if (!offsetInfo) {
|
|
15075
14858
|
return;
|
|
15076
|
-
|
|
15077
|
-
|
|
15078
|
-
|
|
14859
|
+
}
|
|
14860
|
+
const [offset, align] = offsetInfo;
|
|
14861
|
+
const now = this.now();
|
|
14862
|
+
this.scrollState = {
|
|
14863
|
+
index,
|
|
14864
|
+
align,
|
|
14865
|
+
behavior,
|
|
14866
|
+
startedAt: now,
|
|
14867
|
+
lastTargetOffset: offset,
|
|
14868
|
+
stableFrames: 0
|
|
14869
|
+
};
|
|
14870
|
+
this._scrollToOffset(offset, { adjustments: void 0, behavior });
|
|
14871
|
+
this.scheduleScrollReconcile();
|
|
15079
14872
|
};
|
|
15080
|
-
|
|
15081
|
-
|
|
15082
|
-
|
|
15083
|
-
|
|
15084
|
-
|
|
15085
|
-
|
|
14873
|
+
this.scrollBy = (delta, { behavior = "auto" } = {}) => {
|
|
14874
|
+
const offset = this.getScrollOffset() + delta;
|
|
14875
|
+
const now = this.now();
|
|
14876
|
+
this.scrollState = {
|
|
14877
|
+
index: null,
|
|
14878
|
+
align: "start",
|
|
14879
|
+
behavior,
|
|
14880
|
+
startedAt: now,
|
|
14881
|
+
lastTargetOffset: offset,
|
|
14882
|
+
stableFrames: 0
|
|
14883
|
+
};
|
|
14884
|
+
this._scrollToOffset(offset, { adjustments: void 0, behavior });
|
|
14885
|
+
this.scheduleScrollReconcile();
|
|
15086
14886
|
};
|
|
15087
|
-
|
|
15088
|
-
|
|
15089
|
-
|
|
15090
|
-
|
|
15091
|
-
|
|
15092
|
-
|
|
15093
|
-
|
|
15094
|
-
|
|
15095
|
-
|
|
15096
|
-
|
|
14887
|
+
this.getTotalSize = () => {
|
|
14888
|
+
var _a;
|
|
14889
|
+
const measurements = this.getMeasurements();
|
|
14890
|
+
let end;
|
|
14891
|
+
if (measurements.length === 0) {
|
|
14892
|
+
end = this.options.paddingStart;
|
|
14893
|
+
} else if (this.options.lanes === 1) {
|
|
14894
|
+
end = ((_a = measurements[measurements.length - 1]) == null ? void 0 : _a.end) ?? 0;
|
|
14895
|
+
} else {
|
|
14896
|
+
const endByLane = Array(this.options.lanes).fill(null);
|
|
14897
|
+
let endIndex = measurements.length - 1;
|
|
14898
|
+
while (endIndex >= 0 && endByLane.some((val) => val === null)) {
|
|
14899
|
+
const item = measurements[endIndex];
|
|
14900
|
+
if (endByLane[item.lane] === null) {
|
|
14901
|
+
endByLane[item.lane] = item.end;
|
|
14902
|
+
}
|
|
14903
|
+
endIndex--;
|
|
14904
|
+
}
|
|
14905
|
+
end = Math.max(...endByLane.filter((val) => val !== null));
|
|
14906
|
+
}
|
|
14907
|
+
return Math.max(
|
|
14908
|
+
end - this.options.scrollMargin + this.options.paddingEnd,
|
|
14909
|
+
0
|
|
14910
|
+
);
|
|
15097
14911
|
};
|
|
15098
|
-
|
|
15099
|
-
|
|
15100
|
-
|
|
15101
|
-
|
|
15102
|
-
|
|
15103
|
-
const [heightPx, setHeightPx] = useState(0);
|
|
15104
|
-
useLayoutEffect(() => {
|
|
15105
|
-
const el = ref.current;
|
|
15106
|
-
if (!el)
|
|
15107
|
-
return;
|
|
15108
|
-
let rafId = 0;
|
|
15109
|
-
const commit = () => {
|
|
15110
|
-
const next = Math.round(el.getBoundingClientRect().height);
|
|
15111
|
-
setHeightPx((prev) => prev === next ? prev : next);
|
|
14912
|
+
this._scrollToOffset = (offset, {
|
|
14913
|
+
adjustments,
|
|
14914
|
+
behavior
|
|
14915
|
+
}) => {
|
|
14916
|
+
this.options.scrollToFn(offset, { behavior, adjustments }, this);
|
|
15112
14917
|
};
|
|
15113
|
-
|
|
15114
|
-
|
|
15115
|
-
|
|
14918
|
+
this.measure = () => {
|
|
14919
|
+
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
14920
|
+
this.laneAssignments = /* @__PURE__ */ new Map();
|
|
14921
|
+
this.notify(false);
|
|
15116
14922
|
};
|
|
15117
|
-
|
|
15118
|
-
|
|
15119
|
-
|
|
15120
|
-
|
|
15121
|
-
|
|
15122
|
-
|
|
14923
|
+
this.setOptions(opts);
|
|
14924
|
+
}
|
|
14925
|
+
scheduleScrollReconcile() {
|
|
14926
|
+
if (!this.targetWindow) {
|
|
14927
|
+
this.scrollState = null;
|
|
14928
|
+
return;
|
|
14929
|
+
}
|
|
14930
|
+
if (this.rafId != null)
|
|
14931
|
+
return;
|
|
14932
|
+
this.rafId = this.targetWindow.requestAnimationFrame(() => {
|
|
14933
|
+
this.rafId = null;
|
|
14934
|
+
this.reconcileScroll();
|
|
14935
|
+
});
|
|
14936
|
+
}
|
|
14937
|
+
reconcileScroll() {
|
|
14938
|
+
if (!this.scrollState)
|
|
14939
|
+
return;
|
|
14940
|
+
const el = this.scrollElement;
|
|
14941
|
+
if (!el)
|
|
14942
|
+
return;
|
|
14943
|
+
const MAX_RECONCILE_MS = 5e3;
|
|
14944
|
+
if (this.now() - this.scrollState.startedAt > MAX_RECONCILE_MS) {
|
|
14945
|
+
this.scrollState = null;
|
|
14946
|
+
return;
|
|
14947
|
+
}
|
|
14948
|
+
const offsetInfo = this.scrollState.index != null ? this.getOffsetForIndex(this.scrollState.index, this.scrollState.align) : void 0;
|
|
14949
|
+
const targetOffset = offsetInfo ? offsetInfo[0] : this.scrollState.lastTargetOffset;
|
|
14950
|
+
const STABLE_FRAMES = 1;
|
|
14951
|
+
const targetChanged = targetOffset !== this.scrollState.lastTargetOffset;
|
|
14952
|
+
if (!targetChanged && approxEqual(targetOffset, this.getScrollOffset())) {
|
|
14953
|
+
this.scrollState.stableFrames++;
|
|
14954
|
+
if (this.scrollState.stableFrames >= STABLE_FRAMES) {
|
|
14955
|
+
this.scrollState = null;
|
|
14956
|
+
return;
|
|
14957
|
+
}
|
|
14958
|
+
} else {
|
|
14959
|
+
this.scrollState.stableFrames = 0;
|
|
14960
|
+
if (targetChanged) {
|
|
14961
|
+
this.scrollState.lastTargetOffset = targetOffset;
|
|
14962
|
+
this.scrollState.behavior = "auto";
|
|
14963
|
+
this._scrollToOffset(targetOffset, {
|
|
14964
|
+
adjustments: void 0,
|
|
14965
|
+
behavior: "auto"
|
|
14966
|
+
});
|
|
14967
|
+
}
|
|
14968
|
+
}
|
|
14969
|
+
this.scheduleScrollReconcile();
|
|
14970
|
+
}
|
|
14971
|
+
}
|
|
14972
|
+
const findNearestBinarySearch = (low, high, getCurrentValue, value) => {
|
|
14973
|
+
while (low <= high) {
|
|
14974
|
+
const middle = (low + high) / 2 | 0;
|
|
14975
|
+
const currentValue = getCurrentValue(middle);
|
|
14976
|
+
if (currentValue < value) {
|
|
14977
|
+
low = middle + 1;
|
|
14978
|
+
} else if (currentValue > value) {
|
|
14979
|
+
high = middle - 1;
|
|
14980
|
+
} else {
|
|
14981
|
+
return middle;
|
|
14982
|
+
}
|
|
14983
|
+
}
|
|
14984
|
+
if (low > 0) {
|
|
14985
|
+
return low - 1;
|
|
14986
|
+
} else {
|
|
14987
|
+
return 0;
|
|
14988
|
+
}
|
|
14989
|
+
};
|
|
14990
|
+
function calculateRange({
|
|
14991
|
+
measurements,
|
|
14992
|
+
outerSize,
|
|
14993
|
+
scrollOffset,
|
|
14994
|
+
lanes
|
|
14995
|
+
}) {
|
|
14996
|
+
const lastIndex = measurements.length - 1;
|
|
14997
|
+
const getOffset = (index) => measurements[index].start;
|
|
14998
|
+
if (measurements.length <= lanes) {
|
|
14999
|
+
return {
|
|
15000
|
+
startIndex: 0,
|
|
15001
|
+
endIndex: lastIndex
|
|
15123
15002
|
};
|
|
15003
|
+
}
|
|
15004
|
+
let startIndex = findNearestBinarySearch(
|
|
15005
|
+
0,
|
|
15006
|
+
lastIndex,
|
|
15007
|
+
getOffset,
|
|
15008
|
+
scrollOffset
|
|
15009
|
+
);
|
|
15010
|
+
let endIndex = startIndex;
|
|
15011
|
+
if (lanes === 1) {
|
|
15012
|
+
while (endIndex < lastIndex && measurements[endIndex].end < scrollOffset + outerSize) {
|
|
15013
|
+
endIndex++;
|
|
15014
|
+
}
|
|
15015
|
+
} else if (lanes > 1) {
|
|
15016
|
+
const endPerLane = Array(lanes).fill(0);
|
|
15017
|
+
while (endIndex < lastIndex && endPerLane.some((pos) => pos < scrollOffset + outerSize)) {
|
|
15018
|
+
const item = measurements[endIndex];
|
|
15019
|
+
endPerLane[item.lane] = item.end;
|
|
15020
|
+
endIndex++;
|
|
15021
|
+
}
|
|
15022
|
+
const startPerLane = Array(lanes).fill(scrollOffset + outerSize);
|
|
15023
|
+
while (startIndex >= 0 && startPerLane.some((pos) => pos >= scrollOffset)) {
|
|
15024
|
+
const item = measurements[startIndex];
|
|
15025
|
+
startPerLane[item.lane] = item.start;
|
|
15026
|
+
startIndex--;
|
|
15027
|
+
}
|
|
15028
|
+
startIndex = Math.max(0, startIndex - startIndex % lanes);
|
|
15029
|
+
endIndex = Math.min(lastIndex, endIndex + (lanes - 1 - endIndex % lanes));
|
|
15030
|
+
}
|
|
15031
|
+
return { startIndex, endIndex };
|
|
15032
|
+
}
|
|
15033
|
+
const useIsomorphicLayoutEffect = typeof document !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
15034
|
+
function useVirtualizerBase({
|
|
15035
|
+
useFlushSync = true,
|
|
15036
|
+
...options
|
|
15037
|
+
}) {
|
|
15038
|
+
const rerender = React.useReducer(() => ({}), {})[1];
|
|
15039
|
+
const resolvedOptions = {
|
|
15040
|
+
...options,
|
|
15041
|
+
onChange: (instance2, sync) => {
|
|
15042
|
+
var _a;
|
|
15043
|
+
if (useFlushSync && sync) {
|
|
15044
|
+
flushSync(rerender);
|
|
15045
|
+
} else {
|
|
15046
|
+
rerender();
|
|
15047
|
+
}
|
|
15048
|
+
(_a = options.onChange) == null ? void 0 : _a.call(options, instance2, sync);
|
|
15049
|
+
}
|
|
15050
|
+
};
|
|
15051
|
+
const [instance] = React.useState(
|
|
15052
|
+
() => new Virtualizer(resolvedOptions)
|
|
15053
|
+
);
|
|
15054
|
+
instance.setOptions(resolvedOptions);
|
|
15055
|
+
useIsomorphicLayoutEffect(() => {
|
|
15056
|
+
return instance._didMount();
|
|
15124
15057
|
}, []);
|
|
15125
|
-
|
|
15058
|
+
useIsomorphicLayoutEffect(() => {
|
|
15059
|
+
return instance._willUpdate();
|
|
15060
|
+
});
|
|
15061
|
+
return instance;
|
|
15062
|
+
}
|
|
15063
|
+
function useVirtualizer(options) {
|
|
15064
|
+
return useVirtualizerBase({
|
|
15065
|
+
observeElementRect,
|
|
15066
|
+
observeElementOffset,
|
|
15067
|
+
scrollToFn: elementScroll,
|
|
15068
|
+
...options
|
|
15069
|
+
});
|
|
15126
15070
|
}
|
|
15127
15071
|
function useColumnVirtualizer({
|
|
15128
15072
|
table,
|
|
@@ -15254,7 +15198,7 @@ const StyledTable = (props) => {
|
|
|
15254
15198
|
}
|
|
15255
15199
|
),
|
|
15256
15200
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Fetching, { fetching: !!fetching }),
|
|
15257
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TableBody, { table, styledTableProps: options,
|
|
15201
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TableBody, { table, styledTableProps: options, columnWindow })
|
|
15258
15202
|
] });
|
|
15259
15203
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(RootContextProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(DndProvider, { enabled: !!enableDnd, data, setData, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
15260
15204
|
"div",
|