@oliasoft-open-source/react-ui-library 4.18.0-beta-12 → 4.18.0-beta-13
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/index.js +1414 -1407
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import * as React$4 from "react";
|
|
|
14
14
|
import React__default, { useContext, isValidElement, useState, useRef, useEffect, useCallback, createElement, forwardRef, useMemo, useLayoutEffect as useLayoutEffect$1, createContext, useReducer, useDebugValue, Fragment as Fragment$2, memo as memo$1, cloneElement as cloneElement$1, PureComponent, useImperativeHandle } from "react";
|
|
15
15
|
import * as PropTypes from "prop-types";
|
|
16
16
|
import PropTypes__default from "prop-types";
|
|
17
|
-
import ReactDOM, { createPortal, flushSync as flushSync$1,
|
|
17
|
+
import ReactDOM, { createPortal, unstable_batchedUpdates, flushSync as flushSync$1, render } from "react-dom";
|
|
18
18
|
import { noop as noop$2, set, get as get$2, isString as isString$3, isNumber as isNumber$1, isBoolean as isBoolean$1, isFunction as isFunction$3, isEmpty, isArray as isArray$1, toNumber, debounce as debounce$3, isObject as isObject$5, isEqual as isEqual$3 } from "lodash";
|
|
19
19
|
import { toString as toString$1, isScientificStringNum, roundToPrecision, toNum, validateNumber, cleanNumStr, stripLeadingZeros, roundToFixed, roundByMagnitude, unitFromQuantity, getUnit, KNOWN_UNITS, ALT_UNITS, isValueWithUnit, getValue, withUnit, convertSamePrecision, convertAndGetValue, split as split$1, label as label$b, isValidNum, getAltUnitsListByQuantity, altUnitsList, withPrettyUnitLabel, getUnitsForQuantity, roundByMagnitudeToFixed } from "@oliasoft-open-source/units";
|
|
20
20
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
@@ -9501,1132 +9501,376 @@ const InputGroupAddon = ({
|
|
|
9501
9501
|
})();
|
|
9502
9502
|
return /* @__PURE__ */ jsx("span", { className: cx$2(styles$u.addon, order2, small2 ? styles$u.small : ""), children });
|
|
9503
9503
|
};
|
|
9504
|
-
|
|
9505
|
-
|
|
9506
|
-
|
|
9507
|
-
|
|
9508
|
-
|
|
9509
|
-
|
|
9510
|
-
|
|
9511
|
-
|
|
9512
|
-
|
|
9513
|
-
|
|
9514
|
-
|
|
9515
|
-
|
|
9516
|
-
|
|
9517
|
-
|
|
9518
|
-
|
|
9519
|
-
|
|
9520
|
-
|
|
9521
|
-
|
|
9522
|
-
|
|
9523
|
-
|
|
9524
|
-
|
|
9525
|
-
|
|
9526
|
-
|
|
9527
|
-
|
|
9528
|
-
|
|
9529
|
-
|
|
9530
|
-
|
|
9531
|
-
|
|
9532
|
-
|
|
9533
|
-
|
|
9534
|
-
|
|
9535
|
-
|
|
9536
|
-
|
|
9537
|
-
|
|
9538
|
-
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
|
|
9560
|
-
|
|
9504
|
+
const inputInTable$8 = "_inputInTable_4cdnv_1";
|
|
9505
|
+
const inputHover$8 = "_inputHover_4cdnv_13";
|
|
9506
|
+
const inputFocus$8 = "_inputFocus_4cdnv_18";
|
|
9507
|
+
const inputError$8 = "_inputError_4cdnv_25";
|
|
9508
|
+
const inputWarning$8 = "_inputWarning_4cdnv_26";
|
|
9509
|
+
const inputDisabled$8 = "_inputDisabled_4cdnv_61";
|
|
9510
|
+
const hideScrollbars$8 = "_hideScrollbars_4cdnv_67";
|
|
9511
|
+
const list$1 = "_list_4cdnv_77";
|
|
9512
|
+
const bordered$1 = "_bordered_4cdnv_83";
|
|
9513
|
+
const virtualRow = "_virtualRow_4cdnv_87";
|
|
9514
|
+
const item$4 = "_item_4cdnv_87";
|
|
9515
|
+
const header$1 = "_header_4cdnv_90";
|
|
9516
|
+
const headerTitle = "_headerTitle_4cdnv_90";
|
|
9517
|
+
const heading$3 = "_heading_4cdnv_91";
|
|
9518
|
+
const itemHeader = "_itemHeader_4cdnv_91";
|
|
9519
|
+
const narrow = "_narrow_4cdnv_94";
|
|
9520
|
+
const stickyHeader = "_stickyHeader_4cdnv_98";
|
|
9521
|
+
const title$3 = "_title_4cdnv_109";
|
|
9522
|
+
const name = "_name_4cdnv_115";
|
|
9523
|
+
const iconTooltipMargin = "_iconTooltipMargin_4cdnv_119";
|
|
9524
|
+
const bold = "_bold_4cdnv_122";
|
|
9525
|
+
const toggleNarrow = "_toggleNarrow_4cdnv_133";
|
|
9526
|
+
const drag$1 = "_drag_4cdnv_151";
|
|
9527
|
+
const dragOverlay$1 = "_dragOverlay_4cdnv_172";
|
|
9528
|
+
const listContent = "_listContent_4cdnv_177";
|
|
9529
|
+
const action = "_action_4cdnv_204";
|
|
9530
|
+
const active$3 = "_active_4cdnv_207";
|
|
9531
|
+
const indented = "_indented_4cdnv_214";
|
|
9532
|
+
const disabled$5 = "_disabled_4cdnv_227";
|
|
9533
|
+
const label$6 = "_label_4cdnv_238";
|
|
9534
|
+
const details$2 = "_details_4cdnv_249";
|
|
9535
|
+
const metadata = "_metadata_4cdnv_250";
|
|
9536
|
+
const itemContent = "_itemContent_4cdnv_258";
|
|
9537
|
+
const indentIcon = "_indentIcon_4cdnv_265";
|
|
9538
|
+
const expandIcon = "_expandIcon_4cdnv_270";
|
|
9539
|
+
const expanded = "_expanded_4cdnv_277";
|
|
9540
|
+
const right$4 = "_right_4cdnv_280";
|
|
9541
|
+
const actions = "_actions_4cdnv_288";
|
|
9542
|
+
const hideScrollbar = "_hideScrollbar_4cdnv_67";
|
|
9543
|
+
const noPointerEvents = "_noPointerEvents_4cdnv_303";
|
|
9544
|
+
const virtualRows = "_virtualRows_4cdnv_306";
|
|
9545
|
+
const listStyles = {
|
|
9546
|
+
inputInTable: inputInTable$8,
|
|
9547
|
+
inputHover: inputHover$8,
|
|
9548
|
+
inputFocus: inputFocus$8,
|
|
9549
|
+
inputError: inputError$8,
|
|
9550
|
+
inputWarning: inputWarning$8,
|
|
9551
|
+
inputDisabled: inputDisabled$8,
|
|
9552
|
+
hideScrollbars: hideScrollbars$8,
|
|
9553
|
+
list: list$1,
|
|
9554
|
+
bordered: bordered$1,
|
|
9555
|
+
virtualRow,
|
|
9556
|
+
item: item$4,
|
|
9557
|
+
header: header$1,
|
|
9558
|
+
headerTitle,
|
|
9559
|
+
heading: heading$3,
|
|
9560
|
+
itemHeader,
|
|
9561
|
+
narrow,
|
|
9562
|
+
stickyHeader,
|
|
9563
|
+
title: title$3,
|
|
9564
|
+
name,
|
|
9565
|
+
iconTooltipMargin,
|
|
9566
|
+
bold,
|
|
9567
|
+
toggleNarrow,
|
|
9568
|
+
drag: drag$1,
|
|
9569
|
+
dragOverlay: dragOverlay$1,
|
|
9570
|
+
listContent,
|
|
9571
|
+
action,
|
|
9572
|
+
active: active$3,
|
|
9573
|
+
indented,
|
|
9574
|
+
disabled: disabled$5,
|
|
9575
|
+
label: label$6,
|
|
9576
|
+
details: details$2,
|
|
9577
|
+
metadata,
|
|
9578
|
+
itemContent,
|
|
9579
|
+
indentIcon,
|
|
9580
|
+
expandIcon,
|
|
9581
|
+
expanded,
|
|
9582
|
+
right: right$4,
|
|
9583
|
+
actions,
|
|
9584
|
+
hideScrollbar,
|
|
9585
|
+
noPointerEvents,
|
|
9586
|
+
virtualRows
|
|
9561
9587
|
};
|
|
9562
|
-
const
|
|
9563
|
-
|
|
9564
|
-
|
|
9565
|
-
|
|
9566
|
-
|
|
9567
|
-
for (let i = start; i <= end; i++) {
|
|
9568
|
-
arr.push(i);
|
|
9569
|
-
}
|
|
9570
|
-
return arr;
|
|
9588
|
+
const ToggleNarrow = ({
|
|
9589
|
+
toggleNarrow: toggleNarrow2,
|
|
9590
|
+
onClickToggleNarrow
|
|
9591
|
+
}) => {
|
|
9592
|
+
return toggleNarrow2 ? /* @__PURE__ */ jsx("a", { className: listStyles.toggleNarrow, onClick: onClickToggleNarrow, children: /* @__PURE__ */ jsx(Icon, { icon: IconType.CHEVRON_LEFT }) }) : null;
|
|
9571
9593
|
};
|
|
9572
|
-
const
|
|
9573
|
-
|
|
9574
|
-
|
|
9575
|
-
|
|
9576
|
-
|
|
9577
|
-
|
|
9578
|
-
|
|
9579
|
-
|
|
9580
|
-
}
|
|
9581
|
-
|
|
9582
|
-
|
|
9583
|
-
|
|
9584
|
-
|
|
9585
|
-
|
|
9586
|
-
|
|
9587
|
-
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
|
|
9596
|
-
|
|
9594
|
+
const ListHeading = forwardRef(
|
|
9595
|
+
({
|
|
9596
|
+
name: name2,
|
|
9597
|
+
actions: actions2 = [],
|
|
9598
|
+
toggleNarrow: toggleNarrow2 = false,
|
|
9599
|
+
onToggleNarrow = () => {
|
|
9600
|
+
},
|
|
9601
|
+
stickyHeader: stickyHeader2
|
|
9602
|
+
}, listHeadingRef) => {
|
|
9603
|
+
return /* @__PURE__ */ jsxs(
|
|
9604
|
+
"div",
|
|
9605
|
+
{
|
|
9606
|
+
ref: listHeadingRef,
|
|
9607
|
+
className: cx$2(listStyles.header, stickyHeader2 ? listStyles.stickyHeader : ""),
|
|
9608
|
+
children: [
|
|
9609
|
+
/* @__PURE__ */ jsx(
|
|
9610
|
+
ToggleNarrow,
|
|
9611
|
+
{
|
|
9612
|
+
toggleNarrow: toggleNarrow2,
|
|
9613
|
+
onClickToggleNarrow: onToggleNarrow
|
|
9614
|
+
}
|
|
9615
|
+
),
|
|
9616
|
+
name2 && /* @__PURE__ */ jsx("div", { className: listStyles.headerTitle, children: /* @__PURE__ */ jsx(Heading$2, { top: true, marginBottom: 0, children: name2 }) }),
|
|
9617
|
+
/* @__PURE__ */ jsx("div", { className: listStyles.right, children: /* @__PURE__ */ jsx("div", { className: listStyles.actions, children: /* @__PURE__ */ jsx(Actions, { actions: actions2 }) }) })
|
|
9618
|
+
]
|
|
9597
9619
|
}
|
|
9598
|
-
|
|
9599
|
-
handler(element.getBoundingClientRect());
|
|
9600
|
-
});
|
|
9601
|
-
observer.observe(element, { box: "border-box" });
|
|
9602
|
-
return () => {
|
|
9603
|
-
observer.unobserve(element);
|
|
9604
|
-
};
|
|
9605
|
-
};
|
|
9606
|
-
const addEventListenerOptions = {
|
|
9607
|
-
passive: true
|
|
9608
|
-
};
|
|
9609
|
-
const supportsScrollend = typeof window == "undefined" ? true : "onscrollend" in window;
|
|
9610
|
-
const observeElementOffset = (instance, cb2) => {
|
|
9611
|
-
const element = instance.scrollElement;
|
|
9612
|
-
if (!element) {
|
|
9613
|
-
return;
|
|
9620
|
+
);
|
|
9614
9621
|
}
|
|
9615
|
-
|
|
9616
|
-
|
|
9617
|
-
|
|
9622
|
+
);
|
|
9623
|
+
function useCombinedRefs() {
|
|
9624
|
+
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
9625
|
+
refs[_key] = arguments[_key];
|
|
9618
9626
|
}
|
|
9619
|
-
|
|
9620
|
-
|
|
9621
|
-
|
|
9622
|
-
() => {
|
|
9623
|
-
cb2(offset, false);
|
|
9627
|
+
return useMemo(
|
|
9628
|
+
() => (node2) => {
|
|
9629
|
+
refs.forEach((ref) => ref(node2));
|
|
9624
9630
|
},
|
|
9625
|
-
|
|
9631
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
9632
|
+
refs
|
|
9626
9633
|
);
|
|
9627
|
-
|
|
9628
|
-
|
|
9629
|
-
|
|
9630
|
-
|
|
9631
|
-
|
|
9632
|
-
|
|
9633
|
-
|
|
9634
|
-
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
|
|
9638
|
-
|
|
9639
|
-
|
|
9640
|
-
|
|
9641
|
-
}
|
|
9642
|
-
|
|
9643
|
-
|
|
9644
|
-
|
|
9645
|
-
|
|
9646
|
-
|
|
9647
|
-
|
|
9648
|
-
|
|
9649
|
-
|
|
9650
|
-
|
|
9634
|
+
}
|
|
9635
|
+
const canUseDOM = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
9636
|
+
function isWindow(element) {
|
|
9637
|
+
const elementString = Object.prototype.toString.call(element);
|
|
9638
|
+
return elementString === "[object Window]" || // In Electron context the Window object serializes to [object global]
|
|
9639
|
+
elementString === "[object global]";
|
|
9640
|
+
}
|
|
9641
|
+
function isNode(node2) {
|
|
9642
|
+
return "nodeType" in node2;
|
|
9643
|
+
}
|
|
9644
|
+
function getWindow(target) {
|
|
9645
|
+
var _target$ownerDocument, _target$ownerDocument2;
|
|
9646
|
+
if (!target) {
|
|
9647
|
+
return window;
|
|
9648
|
+
}
|
|
9649
|
+
if (isWindow(target)) {
|
|
9650
|
+
return target;
|
|
9651
|
+
}
|
|
9652
|
+
if (!isNode(target)) {
|
|
9653
|
+
return window;
|
|
9654
|
+
}
|
|
9655
|
+
return (_target$ownerDocument = (_target$ownerDocument2 = target.ownerDocument) == null ? void 0 : _target$ownerDocument2.defaultView) != null ? _target$ownerDocument : window;
|
|
9656
|
+
}
|
|
9657
|
+
function isDocument(node2) {
|
|
9658
|
+
const {
|
|
9659
|
+
Document
|
|
9660
|
+
} = getWindow(node2);
|
|
9661
|
+
return node2 instanceof Document;
|
|
9662
|
+
}
|
|
9663
|
+
function isHTMLElement(node2) {
|
|
9664
|
+
if (isWindow(node2)) {
|
|
9665
|
+
return false;
|
|
9666
|
+
}
|
|
9667
|
+
return node2 instanceof getWindow(node2).HTMLElement;
|
|
9668
|
+
}
|
|
9669
|
+
function isSVGElement(node2) {
|
|
9670
|
+
return node2 instanceof getWindow(node2).SVGElement;
|
|
9671
|
+
}
|
|
9672
|
+
function getOwnerDocument(target) {
|
|
9673
|
+
if (!target) {
|
|
9674
|
+
return document;
|
|
9675
|
+
}
|
|
9676
|
+
if (isWindow(target)) {
|
|
9677
|
+
return target.document;
|
|
9678
|
+
}
|
|
9679
|
+
if (!isNode(target)) {
|
|
9680
|
+
return document;
|
|
9681
|
+
}
|
|
9682
|
+
if (isDocument(target)) {
|
|
9683
|
+
return target;
|
|
9684
|
+
}
|
|
9685
|
+
if (isHTMLElement(target) || isSVGElement(target)) {
|
|
9686
|
+
return target.ownerDocument;
|
|
9687
|
+
}
|
|
9688
|
+
return document;
|
|
9689
|
+
}
|
|
9690
|
+
const useIsomorphicLayoutEffect$5 = canUseDOM ? useLayoutEffect$1 : useEffect;
|
|
9691
|
+
function useEvent$1(handler) {
|
|
9692
|
+
const handlerRef = useRef(handler);
|
|
9693
|
+
useIsomorphicLayoutEffect$5(() => {
|
|
9694
|
+
handlerRef.current = handler;
|
|
9695
|
+
});
|
|
9696
|
+
return useCallback(function() {
|
|
9697
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
9698
|
+
args[_key] = arguments[_key];
|
|
9699
|
+
}
|
|
9700
|
+
return handlerRef.current == null ? void 0 : handlerRef.current(...args);
|
|
9701
|
+
}, []);
|
|
9702
|
+
}
|
|
9703
|
+
function useInterval() {
|
|
9704
|
+
const intervalRef = useRef(null);
|
|
9705
|
+
const set2 = useCallback((listener, duration) => {
|
|
9706
|
+
intervalRef.current = setInterval(listener, duration);
|
|
9707
|
+
}, []);
|
|
9708
|
+
const clear = useCallback(() => {
|
|
9709
|
+
if (intervalRef.current !== null) {
|
|
9710
|
+
clearInterval(intervalRef.current);
|
|
9711
|
+
intervalRef.current = null;
|
|
9651
9712
|
}
|
|
9713
|
+
}, []);
|
|
9714
|
+
return [set2, clear];
|
|
9715
|
+
}
|
|
9716
|
+
function useLatestValue(value, dependencies) {
|
|
9717
|
+
if (dependencies === void 0) {
|
|
9718
|
+
dependencies = [value];
|
|
9652
9719
|
}
|
|
9653
|
-
|
|
9654
|
-
|
|
9720
|
+
const valueRef = useRef(value);
|
|
9721
|
+
useIsomorphicLayoutEffect$5(() => {
|
|
9722
|
+
if (valueRef.current !== value) {
|
|
9723
|
+
valueRef.current = value;
|
|
9724
|
+
}
|
|
9725
|
+
}, dependencies);
|
|
9726
|
+
return valueRef;
|
|
9727
|
+
}
|
|
9728
|
+
function useLazyMemo(callback, dependencies) {
|
|
9729
|
+
const valueRef = useRef();
|
|
9730
|
+
return useMemo(
|
|
9731
|
+
() => {
|
|
9732
|
+
const newValue = callback(valueRef.current);
|
|
9733
|
+
valueRef.current = newValue;
|
|
9734
|
+
return newValue;
|
|
9735
|
+
},
|
|
9736
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
9737
|
+
[...dependencies]
|
|
9655
9738
|
);
|
|
9656
|
-
}
|
|
9657
|
-
|
|
9658
|
-
|
|
9659
|
-
|
|
9660
|
-
|
|
9661
|
-
|
|
9662
|
-
|
|
9663
|
-
|
|
9664
|
-
|
|
9665
|
-
|
|
9666
|
-
|
|
9667
|
-
|
|
9668
|
-
|
|
9669
|
-
|
|
9670
|
-
|
|
9671
|
-
|
|
9672
|
-
|
|
9673
|
-
|
|
9674
|
-
|
|
9675
|
-
|
|
9676
|
-
|
|
9677
|
-
|
|
9678
|
-
|
|
9679
|
-
|
|
9680
|
-
|
|
9681
|
-
|
|
9682
|
-
|
|
9683
|
-
|
|
9684
|
-
|
|
9685
|
-
|
|
9686
|
-
|
|
9687
|
-
|
|
9688
|
-
|
|
9689
|
-
|
|
9690
|
-
|
|
9739
|
+
}
|
|
9740
|
+
function useNodeRef(onChange) {
|
|
9741
|
+
const onChangeHandler = useEvent$1(onChange);
|
|
9742
|
+
const node2 = useRef(null);
|
|
9743
|
+
const setNodeRef = useCallback(
|
|
9744
|
+
(element) => {
|
|
9745
|
+
if (element !== node2.current) {
|
|
9746
|
+
onChangeHandler == null ? void 0 : onChangeHandler(element, node2.current);
|
|
9747
|
+
}
|
|
9748
|
+
node2.current = element;
|
|
9749
|
+
},
|
|
9750
|
+
//eslint-disable-next-line
|
|
9751
|
+
[]
|
|
9752
|
+
);
|
|
9753
|
+
return [node2, setNodeRef];
|
|
9754
|
+
}
|
|
9755
|
+
function usePrevious$3(value) {
|
|
9756
|
+
const ref = useRef();
|
|
9757
|
+
useEffect(() => {
|
|
9758
|
+
ref.current = value;
|
|
9759
|
+
}, [value]);
|
|
9760
|
+
return ref.current;
|
|
9761
|
+
}
|
|
9762
|
+
let ids = {};
|
|
9763
|
+
function useUniqueId(prefix2, value) {
|
|
9764
|
+
return useMemo(() => {
|
|
9765
|
+
if (value) {
|
|
9766
|
+
return value;
|
|
9767
|
+
}
|
|
9768
|
+
const id2 = ids[prefix2] == null ? 0 : ids[prefix2] + 1;
|
|
9769
|
+
ids[prefix2] = id2;
|
|
9770
|
+
return prefix2 + "-" + id2;
|
|
9771
|
+
}, [prefix2, value]);
|
|
9772
|
+
}
|
|
9773
|
+
function createAdjustmentFn(modifier) {
|
|
9774
|
+
return function(object2) {
|
|
9775
|
+
for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
9776
|
+
adjustments[_key - 1] = arguments[_key];
|
|
9777
|
+
}
|
|
9778
|
+
return adjustments.reduce((accumulator, adjustment) => {
|
|
9779
|
+
const entries2 = Object.entries(adjustment);
|
|
9780
|
+
for (const [key2, valueAdjustment] of entries2) {
|
|
9781
|
+
const value = accumulator[key2];
|
|
9782
|
+
if (value != null) {
|
|
9783
|
+
accumulator[key2] = value + modifier * valueAdjustment;
|
|
9691
9784
|
}
|
|
9692
|
-
|
|
9693
|
-
|
|
9694
|
-
|
|
9695
|
-
|
|
9696
|
-
|
|
9785
|
+
}
|
|
9786
|
+
return accumulator;
|
|
9787
|
+
}, {
|
|
9788
|
+
...object2
|
|
9789
|
+
});
|
|
9790
|
+
};
|
|
9791
|
+
}
|
|
9792
|
+
const add$1 = /* @__PURE__ */ createAdjustmentFn(1);
|
|
9793
|
+
const subtract$1 = /* @__PURE__ */ createAdjustmentFn(-1);
|
|
9794
|
+
function hasViewportRelativeCoordinates(event) {
|
|
9795
|
+
return "clientX" in event && "clientY" in event;
|
|
9796
|
+
}
|
|
9797
|
+
function isKeyboardEvent(event) {
|
|
9798
|
+
if (!event) {
|
|
9799
|
+
return false;
|
|
9800
|
+
}
|
|
9801
|
+
const {
|
|
9802
|
+
KeyboardEvent: KeyboardEvent2
|
|
9803
|
+
} = getWindow(event.target);
|
|
9804
|
+
return KeyboardEvent2 && event instanceof KeyboardEvent2;
|
|
9805
|
+
}
|
|
9806
|
+
function isTouchEvent$2(event) {
|
|
9807
|
+
if (!event) {
|
|
9808
|
+
return false;
|
|
9809
|
+
}
|
|
9810
|
+
const {
|
|
9811
|
+
TouchEvent
|
|
9812
|
+
} = getWindow(event.target);
|
|
9813
|
+
return TouchEvent && event instanceof TouchEvent;
|
|
9814
|
+
}
|
|
9815
|
+
function getEventCoordinates(event) {
|
|
9816
|
+
if (isTouchEvent$2(event)) {
|
|
9817
|
+
if (event.touches && event.touches.length) {
|
|
9818
|
+
const {
|
|
9819
|
+
clientX: x2,
|
|
9820
|
+
clientY: y2
|
|
9821
|
+
} = event.touches[0];
|
|
9822
|
+
return {
|
|
9823
|
+
x: x2,
|
|
9824
|
+
y: y2
|
|
9697
9825
|
};
|
|
9826
|
+
} else if (event.changedTouches && event.changedTouches.length) {
|
|
9827
|
+
const {
|
|
9828
|
+
clientX: x2,
|
|
9829
|
+
clientY: y2
|
|
9830
|
+
} = event.changedTouches[0];
|
|
9698
9831
|
return {
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
(_a2 = get3()) == null ? void 0 : _a2.disconnect();
|
|
9702
|
-
_ro = null;
|
|
9703
|
-
},
|
|
9704
|
-
observe: (target) => {
|
|
9705
|
-
var _a2;
|
|
9706
|
-
return (_a2 = get3()) == null ? void 0 : _a2.observe(target, { box: "border-box" });
|
|
9707
|
-
},
|
|
9708
|
-
unobserve: (target) => {
|
|
9709
|
-
var _a2;
|
|
9710
|
-
return (_a2 = get3()) == null ? void 0 : _a2.unobserve(target);
|
|
9711
|
-
}
|
|
9832
|
+
x: x2,
|
|
9833
|
+
y: y2
|
|
9712
9834
|
};
|
|
9713
|
-
}
|
|
9714
|
-
|
|
9715
|
-
|
|
9716
|
-
|
|
9717
|
-
|
|
9718
|
-
|
|
9719
|
-
this.options = {
|
|
9720
|
-
debug: false,
|
|
9721
|
-
initialOffset: 0,
|
|
9722
|
-
overscan: 1,
|
|
9723
|
-
paddingStart: 0,
|
|
9724
|
-
paddingEnd: 0,
|
|
9725
|
-
scrollPaddingStart: 0,
|
|
9726
|
-
scrollPaddingEnd: 0,
|
|
9727
|
-
horizontal: false,
|
|
9728
|
-
getItemKey: defaultKeyExtractor,
|
|
9729
|
-
rangeExtractor: defaultRangeExtractor,
|
|
9730
|
-
onChange: () => {
|
|
9731
|
-
},
|
|
9732
|
-
measureElement,
|
|
9733
|
-
initialRect: { width: 0, height: 0 },
|
|
9734
|
-
scrollMargin: 0,
|
|
9735
|
-
gap: 0,
|
|
9736
|
-
indexAttribute: "data-index",
|
|
9737
|
-
initialMeasurementsCache: [],
|
|
9738
|
-
lanes: 1,
|
|
9739
|
-
isScrollingResetDelay: 150,
|
|
9740
|
-
enabled: true,
|
|
9741
|
-
isRtl: false,
|
|
9742
|
-
useScrollendEvent: true,
|
|
9743
|
-
...opts2
|
|
9744
|
-
};
|
|
9745
|
-
};
|
|
9746
|
-
this.notify = (sync2) => {
|
|
9747
|
-
var _a2, _b;
|
|
9748
|
-
(_b = (_a2 = this.options).onChange) == null ? void 0 : _b.call(_a2, this, sync2);
|
|
9749
|
-
};
|
|
9750
|
-
this.maybeNotify = memo(
|
|
9751
|
-
() => {
|
|
9752
|
-
this.calculateRange();
|
|
9753
|
-
return [
|
|
9754
|
-
this.isScrolling,
|
|
9755
|
-
this.range ? this.range.startIndex : null,
|
|
9756
|
-
this.range ? this.range.endIndex : null
|
|
9757
|
-
];
|
|
9758
|
-
},
|
|
9759
|
-
(isScrolling) => {
|
|
9760
|
-
this.notify(isScrolling);
|
|
9761
|
-
},
|
|
9762
|
-
{
|
|
9763
|
-
key: process.env.NODE_ENV !== "production" && "maybeNotify",
|
|
9764
|
-
debug: () => this.options.debug,
|
|
9765
|
-
initialDeps: [
|
|
9766
|
-
this.isScrolling,
|
|
9767
|
-
this.range ? this.range.startIndex : null,
|
|
9768
|
-
this.range ? this.range.endIndex : null
|
|
9769
|
-
]
|
|
9770
|
-
}
|
|
9771
|
-
);
|
|
9772
|
-
this.cleanup = () => {
|
|
9773
|
-
this.unsubs.filter(Boolean).forEach((d2) => d2());
|
|
9774
|
-
this.unsubs = [];
|
|
9775
|
-
this.observer.disconnect();
|
|
9776
|
-
this.scrollElement = null;
|
|
9777
|
-
this.targetWindow = null;
|
|
9778
|
-
};
|
|
9779
|
-
this._didMount = () => {
|
|
9780
|
-
return () => {
|
|
9781
|
-
this.cleanup();
|
|
9782
|
-
};
|
|
9783
|
-
};
|
|
9784
|
-
this._willUpdate = () => {
|
|
9785
|
-
var _a2;
|
|
9786
|
-
const scrollElement = this.options.enabled ? this.options.getScrollElement() : null;
|
|
9787
|
-
if (this.scrollElement !== scrollElement) {
|
|
9788
|
-
this.cleanup();
|
|
9789
|
-
if (!scrollElement) {
|
|
9790
|
-
this.maybeNotify();
|
|
9791
|
-
return;
|
|
9792
|
-
}
|
|
9793
|
-
this.scrollElement = scrollElement;
|
|
9794
|
-
if (this.scrollElement && "ownerDocument" in this.scrollElement) {
|
|
9795
|
-
this.targetWindow = this.scrollElement.ownerDocument.defaultView;
|
|
9796
|
-
} else {
|
|
9797
|
-
this.targetWindow = ((_a2 = this.scrollElement) == null ? void 0 : _a2.window) ?? null;
|
|
9798
|
-
}
|
|
9799
|
-
this.elementsCache.forEach((cached) => {
|
|
9800
|
-
this.observer.observe(cached);
|
|
9801
|
-
});
|
|
9802
|
-
this._scrollToOffset(this.getScrollOffset(), {
|
|
9803
|
-
adjustments: void 0,
|
|
9804
|
-
behavior: void 0
|
|
9805
|
-
});
|
|
9806
|
-
this.unsubs.push(
|
|
9807
|
-
this.options.observeElementRect(this, (rect) => {
|
|
9808
|
-
this.scrollRect = rect;
|
|
9809
|
-
this.maybeNotify();
|
|
9810
|
-
})
|
|
9811
|
-
);
|
|
9812
|
-
this.unsubs.push(
|
|
9813
|
-
this.options.observeElementOffset(this, (offset, isScrolling) => {
|
|
9814
|
-
this.scrollAdjustments = 0;
|
|
9815
|
-
this.scrollDirection = isScrolling ? this.getScrollOffset() < offset ? "forward" : "backward" : null;
|
|
9816
|
-
this.scrollOffset = offset;
|
|
9817
|
-
this.isScrolling = isScrolling;
|
|
9818
|
-
this.maybeNotify();
|
|
9819
|
-
})
|
|
9820
|
-
);
|
|
9821
|
-
}
|
|
9822
|
-
};
|
|
9823
|
-
this.getSize = () => {
|
|
9824
|
-
if (!this.options.enabled) {
|
|
9825
|
-
this.scrollRect = null;
|
|
9826
|
-
return 0;
|
|
9827
|
-
}
|
|
9828
|
-
this.scrollRect = this.scrollRect ?? this.options.initialRect;
|
|
9829
|
-
return this.scrollRect[this.options.horizontal ? "width" : "height"];
|
|
9830
|
-
};
|
|
9831
|
-
this.getScrollOffset = () => {
|
|
9832
|
-
if (!this.options.enabled) {
|
|
9833
|
-
this.scrollOffset = null;
|
|
9834
|
-
return 0;
|
|
9835
|
-
}
|
|
9836
|
-
this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset === "function" ? this.options.initialOffset() : this.options.initialOffset);
|
|
9837
|
-
return this.scrollOffset;
|
|
9835
|
+
}
|
|
9836
|
+
}
|
|
9837
|
+
if (hasViewportRelativeCoordinates(event)) {
|
|
9838
|
+
return {
|
|
9839
|
+
x: event.clientX,
|
|
9840
|
+
y: event.clientY
|
|
9838
9841
|
};
|
|
9839
|
-
|
|
9840
|
-
|
|
9841
|
-
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
const previousFurthestMeasurement = furthestMeasurements.get(
|
|
9848
|
-
measurement.lane
|
|
9849
|
-
);
|
|
9850
|
-
if (previousFurthestMeasurement == null || measurement.end > previousFurthestMeasurement.end) {
|
|
9851
|
-
furthestMeasurements.set(measurement.lane, measurement);
|
|
9852
|
-
} else if (measurement.end < previousFurthestMeasurement.end) {
|
|
9853
|
-
furthestMeasurementsFound.set(measurement.lane, true);
|
|
9854
|
-
}
|
|
9855
|
-
if (furthestMeasurementsFound.size === this.options.lanes) {
|
|
9856
|
-
break;
|
|
9857
|
-
}
|
|
9842
|
+
}
|
|
9843
|
+
return null;
|
|
9844
|
+
}
|
|
9845
|
+
const CSS = /* @__PURE__ */ Object.freeze({
|
|
9846
|
+
Translate: {
|
|
9847
|
+
toString(transform) {
|
|
9848
|
+
if (!transform) {
|
|
9849
|
+
return;
|
|
9858
9850
|
}
|
|
9859
|
-
|
|
9860
|
-
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
|
|
9864
|
-
|
|
9865
|
-
|
|
9866
|
-
|
|
9867
|
-
|
|
9868
|
-
|
|
9869
|
-
|
|
9870
|
-
this.options.scrollMargin,
|
|
9871
|
-
this.options.getItemKey,
|
|
9872
|
-
this.options.enabled
|
|
9873
|
-
],
|
|
9874
|
-
(count, paddingStart, scrollMargin, getItemKey, enabled) => {
|
|
9875
|
-
this.pendingMeasuredCacheIndexes = [];
|
|
9876
|
-
return {
|
|
9877
|
-
count,
|
|
9878
|
-
paddingStart,
|
|
9879
|
-
scrollMargin,
|
|
9880
|
-
getItemKey,
|
|
9881
|
-
enabled
|
|
9882
|
-
};
|
|
9883
|
-
},
|
|
9884
|
-
{
|
|
9885
|
-
key: false
|
|
9851
|
+
const {
|
|
9852
|
+
x: x2,
|
|
9853
|
+
y: y2
|
|
9854
|
+
} = transform;
|
|
9855
|
+
return "translate3d(" + (x2 ? Math.round(x2) : 0) + "px, " + (y2 ? Math.round(y2) : 0) + "px, 0)";
|
|
9856
|
+
}
|
|
9857
|
+
},
|
|
9858
|
+
Scale: {
|
|
9859
|
+
toString(transform) {
|
|
9860
|
+
if (!transform) {
|
|
9861
|
+
return;
|
|
9886
9862
|
}
|
|
9887
|
-
|
|
9888
|
-
|
|
9889
|
-
|
|
9890
|
-
|
|
9891
|
-
|
|
9892
|
-
|
|
9893
|
-
|
|
9894
|
-
|
|
9895
|
-
|
|
9896
|
-
|
|
9897
|
-
|
|
9898
|
-
this.measurementsCache.forEach((item2) => {
|
|
9899
|
-
this.itemSizeCache.set(item2.key, item2.size);
|
|
9900
|
-
});
|
|
9901
|
-
}
|
|
9902
|
-
const min = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
|
|
9903
|
-
this.pendingMeasuredCacheIndexes = [];
|
|
9904
|
-
const measurements = this.measurementsCache.slice(0, min);
|
|
9905
|
-
for (let i = min; i < count; i++) {
|
|
9906
|
-
const key2 = getItemKey(i);
|
|
9907
|
-
const furthestMeasurement = this.options.lanes === 1 ? measurements[i - 1] : this.getFurthestMeasurement(measurements, i);
|
|
9908
|
-
const start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
|
|
9909
|
-
const measuredSize = itemSizeCache.get(key2);
|
|
9910
|
-
const size2 = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i);
|
|
9911
|
-
const end = start + size2;
|
|
9912
|
-
const lane = furthestMeasurement ? furthestMeasurement.lane : i % this.options.lanes;
|
|
9913
|
-
measurements[i] = {
|
|
9914
|
-
index: i,
|
|
9915
|
-
start,
|
|
9916
|
-
size: size2,
|
|
9917
|
-
end,
|
|
9918
|
-
key: key2,
|
|
9919
|
-
lane
|
|
9920
|
-
};
|
|
9921
|
-
}
|
|
9922
|
-
this.measurementsCache = measurements;
|
|
9923
|
-
return measurements;
|
|
9924
|
-
},
|
|
9925
|
-
{
|
|
9926
|
-
key: process.env.NODE_ENV !== "production" && "getMeasurements",
|
|
9927
|
-
debug: () => this.options.debug
|
|
9928
|
-
}
|
|
9929
|
-
);
|
|
9930
|
-
this.calculateRange = memo(
|
|
9931
|
-
() => [this.getMeasurements(), this.getSize(), this.getScrollOffset()],
|
|
9932
|
-
(measurements, outerSize, scrollOffset) => {
|
|
9933
|
-
return this.range = measurements.length > 0 && outerSize > 0 ? calculateRange({
|
|
9934
|
-
measurements,
|
|
9935
|
-
outerSize,
|
|
9936
|
-
scrollOffset
|
|
9937
|
-
}) : null;
|
|
9938
|
-
},
|
|
9939
|
-
{
|
|
9940
|
-
key: process.env.NODE_ENV !== "production" && "calculateRange",
|
|
9941
|
-
debug: () => this.options.debug
|
|
9942
|
-
}
|
|
9943
|
-
);
|
|
9944
|
-
this.getIndexes = memo(
|
|
9945
|
-
() => [
|
|
9946
|
-
this.options.rangeExtractor,
|
|
9947
|
-
this.calculateRange(),
|
|
9948
|
-
this.options.overscan,
|
|
9949
|
-
this.options.count
|
|
9950
|
-
],
|
|
9951
|
-
(rangeExtractor, range2, overscan, count) => {
|
|
9952
|
-
return range2 === null ? [] : rangeExtractor({
|
|
9953
|
-
startIndex: range2.startIndex,
|
|
9954
|
-
endIndex: range2.endIndex,
|
|
9955
|
-
overscan,
|
|
9956
|
-
count
|
|
9957
|
-
});
|
|
9958
|
-
},
|
|
9959
|
-
{
|
|
9960
|
-
key: process.env.NODE_ENV !== "production" && "getIndexes",
|
|
9961
|
-
debug: () => this.options.debug
|
|
9962
|
-
}
|
|
9963
|
-
);
|
|
9964
|
-
this.indexFromElement = (node2) => {
|
|
9965
|
-
const attributeName = this.options.indexAttribute;
|
|
9966
|
-
const indexStr = node2.getAttribute(attributeName);
|
|
9967
|
-
if (!indexStr) {
|
|
9968
|
-
console.warn(
|
|
9969
|
-
`Missing attribute name '${attributeName}={index}' on measured element.`
|
|
9970
|
-
);
|
|
9971
|
-
return -1;
|
|
9972
|
-
}
|
|
9973
|
-
return parseInt(indexStr, 10);
|
|
9974
|
-
};
|
|
9975
|
-
this._measureElement = (node2, entry) => {
|
|
9976
|
-
const index2 = this.indexFromElement(node2);
|
|
9977
|
-
const item2 = this.measurementsCache[index2];
|
|
9978
|
-
if (!item2) {
|
|
9979
|
-
return;
|
|
9980
|
-
}
|
|
9981
|
-
const key2 = item2.key;
|
|
9982
|
-
const prevNode = this.elementsCache.get(key2);
|
|
9983
|
-
if (prevNode !== node2) {
|
|
9984
|
-
if (prevNode) {
|
|
9985
|
-
this.observer.unobserve(prevNode);
|
|
9986
|
-
}
|
|
9987
|
-
this.observer.observe(node2);
|
|
9988
|
-
this.elementsCache.set(key2, node2);
|
|
9989
|
-
}
|
|
9990
|
-
if (node2.isConnected) {
|
|
9991
|
-
this.resizeItem(index2, this.options.measureElement(node2, entry, this));
|
|
9992
|
-
}
|
|
9993
|
-
};
|
|
9994
|
-
this.resizeItem = (index2, size2) => {
|
|
9995
|
-
const item2 = this.measurementsCache[index2];
|
|
9996
|
-
if (!item2) {
|
|
9997
|
-
return;
|
|
9998
|
-
}
|
|
9999
|
-
const itemSize = this.itemSizeCache.get(item2.key) ?? item2.size;
|
|
10000
|
-
const delta = size2 - itemSize;
|
|
10001
|
-
if (delta !== 0) {
|
|
10002
|
-
if (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(item2, delta, this) : item2.start < this.getScrollOffset() + this.scrollAdjustments) {
|
|
10003
|
-
if (process.env.NODE_ENV !== "production" && this.options.debug) {
|
|
10004
|
-
console.info("correction", delta);
|
|
10005
|
-
}
|
|
10006
|
-
this._scrollToOffset(this.getScrollOffset(), {
|
|
10007
|
-
adjustments: this.scrollAdjustments += delta,
|
|
10008
|
-
behavior: void 0
|
|
10009
|
-
});
|
|
10010
|
-
}
|
|
10011
|
-
this.pendingMeasuredCacheIndexes.push(item2.index);
|
|
10012
|
-
this.itemSizeCache = new Map(this.itemSizeCache.set(item2.key, size2));
|
|
10013
|
-
this.notify(false);
|
|
10014
|
-
}
|
|
10015
|
-
};
|
|
10016
|
-
this.measureElement = (node2) => {
|
|
10017
|
-
if (!node2) {
|
|
10018
|
-
this.elementsCache.forEach((cached, key2) => {
|
|
10019
|
-
if (!cached.isConnected) {
|
|
10020
|
-
this.observer.unobserve(cached);
|
|
10021
|
-
this.elementsCache.delete(key2);
|
|
10022
|
-
}
|
|
10023
|
-
});
|
|
10024
|
-
return;
|
|
10025
|
-
}
|
|
10026
|
-
this._measureElement(node2, void 0);
|
|
10027
|
-
};
|
|
10028
|
-
this.getVirtualItems = memo(
|
|
10029
|
-
() => [this.getIndexes(), this.getMeasurements()],
|
|
10030
|
-
(indexes, measurements) => {
|
|
10031
|
-
const virtualItems = [];
|
|
10032
|
-
for (let k2 = 0, len = indexes.length; k2 < len; k2++) {
|
|
10033
|
-
const i = indexes[k2];
|
|
10034
|
-
const measurement = measurements[i];
|
|
10035
|
-
virtualItems.push(measurement);
|
|
10036
|
-
}
|
|
10037
|
-
return virtualItems;
|
|
10038
|
-
},
|
|
10039
|
-
{
|
|
10040
|
-
key: process.env.NODE_ENV !== "production" && "getVirtualItems",
|
|
10041
|
-
debug: () => this.options.debug
|
|
10042
|
-
}
|
|
10043
|
-
);
|
|
10044
|
-
this.getVirtualItemForOffset = (offset) => {
|
|
10045
|
-
const measurements = this.getMeasurements();
|
|
10046
|
-
if (measurements.length === 0) {
|
|
10047
|
-
return void 0;
|
|
10048
|
-
}
|
|
10049
|
-
return notUndefined(
|
|
10050
|
-
measurements[findNearestBinarySearch(
|
|
10051
|
-
0,
|
|
10052
|
-
measurements.length - 1,
|
|
10053
|
-
(index2) => notUndefined(measurements[index2]).start,
|
|
10054
|
-
offset
|
|
10055
|
-
)]
|
|
10056
|
-
);
|
|
10057
|
-
};
|
|
10058
|
-
this.getOffsetForAlignment = (toOffset, align) => {
|
|
10059
|
-
const size2 = this.getSize();
|
|
10060
|
-
const scrollOffset = this.getScrollOffset();
|
|
10061
|
-
if (align === "auto") {
|
|
10062
|
-
if (toOffset <= scrollOffset) {
|
|
10063
|
-
align = "start";
|
|
10064
|
-
} else if (toOffset >= scrollOffset + size2) {
|
|
10065
|
-
align = "end";
|
|
10066
|
-
} else {
|
|
10067
|
-
align = "start";
|
|
10068
|
-
}
|
|
10069
|
-
}
|
|
10070
|
-
if (align === "start") {
|
|
10071
|
-
toOffset = toOffset;
|
|
10072
|
-
} else if (align === "end") {
|
|
10073
|
-
toOffset = toOffset - size2;
|
|
10074
|
-
} else if (align === "center") {
|
|
10075
|
-
toOffset = toOffset - size2 / 2;
|
|
10076
|
-
}
|
|
10077
|
-
const scrollSizeProp = this.options.horizontal ? "scrollWidth" : "scrollHeight";
|
|
10078
|
-
const scrollSize = this.scrollElement ? "document" in this.scrollElement ? this.scrollElement.document.documentElement[scrollSizeProp] : this.scrollElement[scrollSizeProp] : 0;
|
|
10079
|
-
const maxOffset = scrollSize - size2;
|
|
10080
|
-
return Math.max(Math.min(maxOffset, toOffset), 0);
|
|
10081
|
-
};
|
|
10082
|
-
this.getOffsetForIndex = (index2, align = "auto") => {
|
|
10083
|
-
index2 = Math.max(0, Math.min(index2, this.options.count - 1));
|
|
10084
|
-
const item2 = this.measurementsCache[index2];
|
|
10085
|
-
if (!item2) {
|
|
10086
|
-
return void 0;
|
|
10087
|
-
}
|
|
10088
|
-
const size2 = this.getSize();
|
|
10089
|
-
const scrollOffset = this.getScrollOffset();
|
|
10090
|
-
if (align === "auto") {
|
|
10091
|
-
if (item2.end >= scrollOffset + size2 - this.options.scrollPaddingEnd) {
|
|
10092
|
-
align = "end";
|
|
10093
|
-
} else if (item2.start <= scrollOffset + this.options.scrollPaddingStart) {
|
|
10094
|
-
align = "start";
|
|
10095
|
-
} else {
|
|
10096
|
-
return [scrollOffset, align];
|
|
10097
|
-
}
|
|
10098
|
-
}
|
|
10099
|
-
const toOffset = align === "end" ? item2.end + this.options.scrollPaddingEnd : item2.start - this.options.scrollPaddingStart;
|
|
10100
|
-
return [this.getOffsetForAlignment(toOffset, align), align];
|
|
10101
|
-
};
|
|
10102
|
-
this.isDynamicMode = () => this.elementsCache.size > 0;
|
|
10103
|
-
this.cancelScrollToIndex = () => {
|
|
10104
|
-
if (this.scrollToIndexTimeoutId !== null && this.targetWindow) {
|
|
10105
|
-
this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId);
|
|
10106
|
-
this.scrollToIndexTimeoutId = null;
|
|
10107
|
-
}
|
|
10108
|
-
};
|
|
10109
|
-
this.scrollToOffset = (toOffset, { align = "start", behavior } = {}) => {
|
|
10110
|
-
this.cancelScrollToIndex();
|
|
10111
|
-
if (behavior === "smooth" && this.isDynamicMode()) {
|
|
10112
|
-
console.warn(
|
|
10113
|
-
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
|
10114
|
-
);
|
|
10115
|
-
}
|
|
10116
|
-
this._scrollToOffset(this.getOffsetForAlignment(toOffset, align), {
|
|
10117
|
-
adjustments: void 0,
|
|
10118
|
-
behavior
|
|
10119
|
-
});
|
|
10120
|
-
};
|
|
10121
|
-
this.scrollToIndex = (index2, { align: initialAlign = "auto", behavior } = {}) => {
|
|
10122
|
-
index2 = Math.max(0, Math.min(index2, this.options.count - 1));
|
|
10123
|
-
this.cancelScrollToIndex();
|
|
10124
|
-
if (behavior === "smooth" && this.isDynamicMode()) {
|
|
10125
|
-
console.warn(
|
|
10126
|
-
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
|
10127
|
-
);
|
|
10128
|
-
}
|
|
10129
|
-
const offsetAndAlign = this.getOffsetForIndex(index2, initialAlign);
|
|
10130
|
-
if (!offsetAndAlign) return;
|
|
10131
|
-
const [offset, align] = offsetAndAlign;
|
|
10132
|
-
this._scrollToOffset(offset, { adjustments: void 0, behavior });
|
|
10133
|
-
if (behavior !== "smooth" && this.isDynamicMode() && this.targetWindow) {
|
|
10134
|
-
this.scrollToIndexTimeoutId = this.targetWindow.setTimeout(() => {
|
|
10135
|
-
this.scrollToIndexTimeoutId = null;
|
|
10136
|
-
const elementInDOM = this.elementsCache.has(
|
|
10137
|
-
this.options.getItemKey(index2)
|
|
10138
|
-
);
|
|
10139
|
-
if (elementInDOM) {
|
|
10140
|
-
const [latestOffset] = notUndefined(
|
|
10141
|
-
this.getOffsetForIndex(index2, align)
|
|
10142
|
-
);
|
|
10143
|
-
if (!approxEqual(latestOffset, this.getScrollOffset())) {
|
|
10144
|
-
this.scrollToIndex(index2, { align, behavior });
|
|
10145
|
-
}
|
|
10146
|
-
} else {
|
|
10147
|
-
this.scrollToIndex(index2, { align, behavior });
|
|
10148
|
-
}
|
|
10149
|
-
});
|
|
10150
|
-
}
|
|
10151
|
-
};
|
|
10152
|
-
this.scrollBy = (delta, { behavior } = {}) => {
|
|
10153
|
-
this.cancelScrollToIndex();
|
|
10154
|
-
if (behavior === "smooth" && this.isDynamicMode()) {
|
|
10155
|
-
console.warn(
|
|
10156
|
-
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
|
10157
|
-
);
|
|
10158
|
-
}
|
|
10159
|
-
this._scrollToOffset(this.getScrollOffset() + delta, {
|
|
10160
|
-
adjustments: void 0,
|
|
10161
|
-
behavior
|
|
10162
|
-
});
|
|
10163
|
-
};
|
|
10164
|
-
this.getTotalSize = () => {
|
|
10165
|
-
var _a2;
|
|
10166
|
-
const measurements = this.getMeasurements();
|
|
10167
|
-
let end;
|
|
10168
|
-
if (measurements.length === 0) {
|
|
10169
|
-
end = this.options.paddingStart;
|
|
10170
|
-
} else {
|
|
10171
|
-
end = this.options.lanes === 1 ? ((_a2 = measurements[measurements.length - 1]) == null ? void 0 : _a2.end) ?? 0 : Math.max(
|
|
10172
|
-
...measurements.slice(-this.options.lanes).map((m2) => m2.end)
|
|
10173
|
-
);
|
|
10174
|
-
}
|
|
10175
|
-
return Math.max(
|
|
10176
|
-
end - this.options.scrollMargin + this.options.paddingEnd,
|
|
10177
|
-
0
|
|
10178
|
-
);
|
|
10179
|
-
};
|
|
10180
|
-
this._scrollToOffset = (offset, {
|
|
10181
|
-
adjustments,
|
|
10182
|
-
behavior
|
|
10183
|
-
}) => {
|
|
10184
|
-
this.options.scrollToFn(offset, { behavior, adjustments }, this);
|
|
10185
|
-
};
|
|
10186
|
-
this.measure = () => {
|
|
10187
|
-
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
10188
|
-
this.notify(false);
|
|
10189
|
-
};
|
|
10190
|
-
this.setOptions(opts);
|
|
10191
|
-
}
|
|
10192
|
-
}
|
|
10193
|
-
const findNearestBinarySearch = (low, high, getCurrentValue, value) => {
|
|
10194
|
-
while (low <= high) {
|
|
10195
|
-
const middle = (low + high) / 2 | 0;
|
|
10196
|
-
const currentValue = getCurrentValue(middle);
|
|
10197
|
-
if (currentValue < value) {
|
|
10198
|
-
low = middle + 1;
|
|
10199
|
-
} else if (currentValue > value) {
|
|
10200
|
-
high = middle - 1;
|
|
10201
|
-
} else {
|
|
10202
|
-
return middle;
|
|
10203
|
-
}
|
|
10204
|
-
}
|
|
10205
|
-
if (low > 0) {
|
|
10206
|
-
return low - 1;
|
|
10207
|
-
} else {
|
|
10208
|
-
return 0;
|
|
10209
|
-
}
|
|
10210
|
-
};
|
|
10211
|
-
function calculateRange({
|
|
10212
|
-
measurements,
|
|
10213
|
-
outerSize,
|
|
10214
|
-
scrollOffset
|
|
10215
|
-
}) {
|
|
10216
|
-
const count = measurements.length - 1;
|
|
10217
|
-
const getOffset2 = (index2) => measurements[index2].start;
|
|
10218
|
-
const startIndex = findNearestBinarySearch(0, count, getOffset2, scrollOffset);
|
|
10219
|
-
let endIndex = startIndex;
|
|
10220
|
-
while (endIndex < count && measurements[endIndex].end < scrollOffset + outerSize) {
|
|
10221
|
-
endIndex++;
|
|
10222
|
-
}
|
|
10223
|
-
return { startIndex, endIndex };
|
|
10224
|
-
}
|
|
10225
|
-
const useIsomorphicLayoutEffect$5 = typeof document !== "undefined" ? React$4.useLayoutEffect : React$4.useEffect;
|
|
10226
|
-
function useVirtualizerBase(options) {
|
|
10227
|
-
const rerender = React$4.useReducer(() => ({}), {})[1];
|
|
10228
|
-
const resolvedOptions = {
|
|
10229
|
-
...options,
|
|
10230
|
-
onChange: (instance2, sync2) => {
|
|
10231
|
-
var _a2;
|
|
10232
|
-
if (sync2) {
|
|
10233
|
-
flushSync$1(rerender);
|
|
10234
|
-
} else {
|
|
10235
|
-
rerender();
|
|
10236
|
-
}
|
|
10237
|
-
(_a2 = options.onChange) == null ? void 0 : _a2.call(options, instance2, sync2);
|
|
10238
|
-
}
|
|
10239
|
-
};
|
|
10240
|
-
const [instance] = React$4.useState(
|
|
10241
|
-
() => new Virtualizer(resolvedOptions)
|
|
10242
|
-
);
|
|
10243
|
-
instance.setOptions(resolvedOptions);
|
|
10244
|
-
React$4.useEffect(() => {
|
|
10245
|
-
return instance._didMount();
|
|
10246
|
-
}, []);
|
|
10247
|
-
useIsomorphicLayoutEffect$5(() => {
|
|
10248
|
-
return instance._willUpdate();
|
|
10249
|
-
});
|
|
10250
|
-
return instance;
|
|
10251
|
-
}
|
|
10252
|
-
function useVirtualizer(options) {
|
|
10253
|
-
return useVirtualizerBase({
|
|
10254
|
-
observeElementRect,
|
|
10255
|
-
observeElementOffset,
|
|
10256
|
-
scrollToFn: elementScroll,
|
|
10257
|
-
...options
|
|
10258
|
-
});
|
|
10259
|
-
}
|
|
10260
|
-
const inputInTable$8 = "_inputInTable_4cdnv_1";
|
|
10261
|
-
const inputHover$8 = "_inputHover_4cdnv_13";
|
|
10262
|
-
const inputFocus$8 = "_inputFocus_4cdnv_18";
|
|
10263
|
-
const inputError$8 = "_inputError_4cdnv_25";
|
|
10264
|
-
const inputWarning$8 = "_inputWarning_4cdnv_26";
|
|
10265
|
-
const inputDisabled$8 = "_inputDisabled_4cdnv_61";
|
|
10266
|
-
const hideScrollbars$8 = "_hideScrollbars_4cdnv_67";
|
|
10267
|
-
const list$1 = "_list_4cdnv_77";
|
|
10268
|
-
const bordered$1 = "_bordered_4cdnv_83";
|
|
10269
|
-
const virtualRow = "_virtualRow_4cdnv_87";
|
|
10270
|
-
const item$4 = "_item_4cdnv_87";
|
|
10271
|
-
const header$1 = "_header_4cdnv_90";
|
|
10272
|
-
const headerTitle = "_headerTitle_4cdnv_90";
|
|
10273
|
-
const heading$3 = "_heading_4cdnv_91";
|
|
10274
|
-
const itemHeader = "_itemHeader_4cdnv_91";
|
|
10275
|
-
const narrow = "_narrow_4cdnv_94";
|
|
10276
|
-
const stickyHeader = "_stickyHeader_4cdnv_98";
|
|
10277
|
-
const title$3 = "_title_4cdnv_109";
|
|
10278
|
-
const name = "_name_4cdnv_115";
|
|
10279
|
-
const iconTooltipMargin = "_iconTooltipMargin_4cdnv_119";
|
|
10280
|
-
const bold = "_bold_4cdnv_122";
|
|
10281
|
-
const toggleNarrow = "_toggleNarrow_4cdnv_133";
|
|
10282
|
-
const drag$1 = "_drag_4cdnv_151";
|
|
10283
|
-
const dragOverlay$1 = "_dragOverlay_4cdnv_172";
|
|
10284
|
-
const listContent = "_listContent_4cdnv_177";
|
|
10285
|
-
const action = "_action_4cdnv_204";
|
|
10286
|
-
const active$3 = "_active_4cdnv_207";
|
|
10287
|
-
const indented = "_indented_4cdnv_214";
|
|
10288
|
-
const disabled$5 = "_disabled_4cdnv_227";
|
|
10289
|
-
const label$6 = "_label_4cdnv_238";
|
|
10290
|
-
const details$2 = "_details_4cdnv_249";
|
|
10291
|
-
const metadata = "_metadata_4cdnv_250";
|
|
10292
|
-
const itemContent = "_itemContent_4cdnv_258";
|
|
10293
|
-
const indentIcon = "_indentIcon_4cdnv_265";
|
|
10294
|
-
const expandIcon = "_expandIcon_4cdnv_270";
|
|
10295
|
-
const expanded = "_expanded_4cdnv_277";
|
|
10296
|
-
const right$4 = "_right_4cdnv_280";
|
|
10297
|
-
const actions = "_actions_4cdnv_288";
|
|
10298
|
-
const hideScrollbar = "_hideScrollbar_4cdnv_67";
|
|
10299
|
-
const noPointerEvents = "_noPointerEvents_4cdnv_303";
|
|
10300
|
-
const virtualRows = "_virtualRows_4cdnv_306";
|
|
10301
|
-
const listStyles = {
|
|
10302
|
-
inputInTable: inputInTable$8,
|
|
10303
|
-
inputHover: inputHover$8,
|
|
10304
|
-
inputFocus: inputFocus$8,
|
|
10305
|
-
inputError: inputError$8,
|
|
10306
|
-
inputWarning: inputWarning$8,
|
|
10307
|
-
inputDisabled: inputDisabled$8,
|
|
10308
|
-
hideScrollbars: hideScrollbars$8,
|
|
10309
|
-
list: list$1,
|
|
10310
|
-
bordered: bordered$1,
|
|
10311
|
-
virtualRow,
|
|
10312
|
-
item: item$4,
|
|
10313
|
-
header: header$1,
|
|
10314
|
-
headerTitle,
|
|
10315
|
-
heading: heading$3,
|
|
10316
|
-
itemHeader,
|
|
10317
|
-
narrow,
|
|
10318
|
-
stickyHeader,
|
|
10319
|
-
title: title$3,
|
|
10320
|
-
name,
|
|
10321
|
-
iconTooltipMargin,
|
|
10322
|
-
bold,
|
|
10323
|
-
toggleNarrow,
|
|
10324
|
-
drag: drag$1,
|
|
10325
|
-
dragOverlay: dragOverlay$1,
|
|
10326
|
-
listContent,
|
|
10327
|
-
action,
|
|
10328
|
-
active: active$3,
|
|
10329
|
-
indented,
|
|
10330
|
-
disabled: disabled$5,
|
|
10331
|
-
label: label$6,
|
|
10332
|
-
details: details$2,
|
|
10333
|
-
metadata,
|
|
10334
|
-
itemContent,
|
|
10335
|
-
indentIcon,
|
|
10336
|
-
expandIcon,
|
|
10337
|
-
expanded,
|
|
10338
|
-
right: right$4,
|
|
10339
|
-
actions,
|
|
10340
|
-
hideScrollbar,
|
|
10341
|
-
noPointerEvents,
|
|
10342
|
-
virtualRows
|
|
10343
|
-
};
|
|
10344
|
-
const ToggleNarrow = ({
|
|
10345
|
-
toggleNarrow: toggleNarrow2,
|
|
10346
|
-
onClickToggleNarrow
|
|
10347
|
-
}) => {
|
|
10348
|
-
return toggleNarrow2 ? /* @__PURE__ */ jsx("a", { className: listStyles.toggleNarrow, onClick: onClickToggleNarrow, children: /* @__PURE__ */ jsx(Icon, { icon: IconType.CHEVRON_LEFT }) }) : null;
|
|
10349
|
-
};
|
|
10350
|
-
const ListHeading = forwardRef(
|
|
10351
|
-
({
|
|
10352
|
-
name: name2,
|
|
10353
|
-
actions: actions2 = [],
|
|
10354
|
-
toggleNarrow: toggleNarrow2 = false,
|
|
10355
|
-
onToggleNarrow = () => {
|
|
10356
|
-
},
|
|
10357
|
-
stickyHeader: stickyHeader2
|
|
10358
|
-
}, listHeadingRef) => {
|
|
10359
|
-
return /* @__PURE__ */ jsxs(
|
|
10360
|
-
"div",
|
|
10361
|
-
{
|
|
10362
|
-
ref: listHeadingRef,
|
|
10363
|
-
className: cx$2(listStyles.header, stickyHeader2 ? listStyles.stickyHeader : ""),
|
|
10364
|
-
children: [
|
|
10365
|
-
/* @__PURE__ */ jsx(
|
|
10366
|
-
ToggleNarrow,
|
|
10367
|
-
{
|
|
10368
|
-
toggleNarrow: toggleNarrow2,
|
|
10369
|
-
onClickToggleNarrow: onToggleNarrow
|
|
10370
|
-
}
|
|
10371
|
-
),
|
|
10372
|
-
name2 && /* @__PURE__ */ jsx("div", { className: listStyles.headerTitle, children: /* @__PURE__ */ jsx(Heading$2, { top: true, marginBottom: 0, children: name2 }) }),
|
|
10373
|
-
/* @__PURE__ */ jsx("div", { className: listStyles.right, children: /* @__PURE__ */ jsx("div", { className: listStyles.actions, children: /* @__PURE__ */ jsx(Actions, { actions: actions2 }) }) })
|
|
10374
|
-
]
|
|
10375
|
-
}
|
|
10376
|
-
);
|
|
10377
|
-
}
|
|
10378
|
-
);
|
|
10379
|
-
function useCombinedRefs() {
|
|
10380
|
-
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
10381
|
-
refs[_key] = arguments[_key];
|
|
10382
|
-
}
|
|
10383
|
-
return useMemo(
|
|
10384
|
-
() => (node2) => {
|
|
10385
|
-
refs.forEach((ref) => ref(node2));
|
|
10386
|
-
},
|
|
10387
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
10388
|
-
refs
|
|
10389
|
-
);
|
|
10390
|
-
}
|
|
10391
|
-
const canUseDOM = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
10392
|
-
function isWindow(element) {
|
|
10393
|
-
const elementString = Object.prototype.toString.call(element);
|
|
10394
|
-
return elementString === "[object Window]" || // In Electron context the Window object serializes to [object global]
|
|
10395
|
-
elementString === "[object global]";
|
|
10396
|
-
}
|
|
10397
|
-
function isNode(node2) {
|
|
10398
|
-
return "nodeType" in node2;
|
|
10399
|
-
}
|
|
10400
|
-
function getWindow(target) {
|
|
10401
|
-
var _target$ownerDocument, _target$ownerDocument2;
|
|
10402
|
-
if (!target) {
|
|
10403
|
-
return window;
|
|
10404
|
-
}
|
|
10405
|
-
if (isWindow(target)) {
|
|
10406
|
-
return target;
|
|
10407
|
-
}
|
|
10408
|
-
if (!isNode(target)) {
|
|
10409
|
-
return window;
|
|
10410
|
-
}
|
|
10411
|
-
return (_target$ownerDocument = (_target$ownerDocument2 = target.ownerDocument) == null ? void 0 : _target$ownerDocument2.defaultView) != null ? _target$ownerDocument : window;
|
|
10412
|
-
}
|
|
10413
|
-
function isDocument(node2) {
|
|
10414
|
-
const {
|
|
10415
|
-
Document
|
|
10416
|
-
} = getWindow(node2);
|
|
10417
|
-
return node2 instanceof Document;
|
|
10418
|
-
}
|
|
10419
|
-
function isHTMLElement(node2) {
|
|
10420
|
-
if (isWindow(node2)) {
|
|
10421
|
-
return false;
|
|
10422
|
-
}
|
|
10423
|
-
return node2 instanceof getWindow(node2).HTMLElement;
|
|
10424
|
-
}
|
|
10425
|
-
function isSVGElement(node2) {
|
|
10426
|
-
return node2 instanceof getWindow(node2).SVGElement;
|
|
10427
|
-
}
|
|
10428
|
-
function getOwnerDocument(target) {
|
|
10429
|
-
if (!target) {
|
|
10430
|
-
return document;
|
|
10431
|
-
}
|
|
10432
|
-
if (isWindow(target)) {
|
|
10433
|
-
return target.document;
|
|
10434
|
-
}
|
|
10435
|
-
if (!isNode(target)) {
|
|
10436
|
-
return document;
|
|
10437
|
-
}
|
|
10438
|
-
if (isDocument(target)) {
|
|
10439
|
-
return target;
|
|
10440
|
-
}
|
|
10441
|
-
if (isHTMLElement(target) || isSVGElement(target)) {
|
|
10442
|
-
return target.ownerDocument;
|
|
10443
|
-
}
|
|
10444
|
-
return document;
|
|
10445
|
-
}
|
|
10446
|
-
const useIsomorphicLayoutEffect$4 = canUseDOM ? useLayoutEffect$1 : useEffect;
|
|
10447
|
-
function useEvent$1(handler) {
|
|
10448
|
-
const handlerRef = useRef(handler);
|
|
10449
|
-
useIsomorphicLayoutEffect$4(() => {
|
|
10450
|
-
handlerRef.current = handler;
|
|
10451
|
-
});
|
|
10452
|
-
return useCallback(function() {
|
|
10453
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
10454
|
-
args[_key] = arguments[_key];
|
|
10455
|
-
}
|
|
10456
|
-
return handlerRef.current == null ? void 0 : handlerRef.current(...args);
|
|
10457
|
-
}, []);
|
|
10458
|
-
}
|
|
10459
|
-
function useInterval() {
|
|
10460
|
-
const intervalRef = useRef(null);
|
|
10461
|
-
const set2 = useCallback((listener, duration) => {
|
|
10462
|
-
intervalRef.current = setInterval(listener, duration);
|
|
10463
|
-
}, []);
|
|
10464
|
-
const clear = useCallback(() => {
|
|
10465
|
-
if (intervalRef.current !== null) {
|
|
10466
|
-
clearInterval(intervalRef.current);
|
|
10467
|
-
intervalRef.current = null;
|
|
10468
|
-
}
|
|
10469
|
-
}, []);
|
|
10470
|
-
return [set2, clear];
|
|
10471
|
-
}
|
|
10472
|
-
function useLatestValue(value, dependencies) {
|
|
10473
|
-
if (dependencies === void 0) {
|
|
10474
|
-
dependencies = [value];
|
|
10475
|
-
}
|
|
10476
|
-
const valueRef = useRef(value);
|
|
10477
|
-
useIsomorphicLayoutEffect$4(() => {
|
|
10478
|
-
if (valueRef.current !== value) {
|
|
10479
|
-
valueRef.current = value;
|
|
10480
|
-
}
|
|
10481
|
-
}, dependencies);
|
|
10482
|
-
return valueRef;
|
|
10483
|
-
}
|
|
10484
|
-
function useLazyMemo(callback, dependencies) {
|
|
10485
|
-
const valueRef = useRef();
|
|
10486
|
-
return useMemo(
|
|
10487
|
-
() => {
|
|
10488
|
-
const newValue = callback(valueRef.current);
|
|
10489
|
-
valueRef.current = newValue;
|
|
10490
|
-
return newValue;
|
|
10491
|
-
},
|
|
10492
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
10493
|
-
[...dependencies]
|
|
10494
|
-
);
|
|
10495
|
-
}
|
|
10496
|
-
function useNodeRef(onChange) {
|
|
10497
|
-
const onChangeHandler = useEvent$1(onChange);
|
|
10498
|
-
const node2 = useRef(null);
|
|
10499
|
-
const setNodeRef = useCallback(
|
|
10500
|
-
(element) => {
|
|
10501
|
-
if (element !== node2.current) {
|
|
10502
|
-
onChangeHandler == null ? void 0 : onChangeHandler(element, node2.current);
|
|
10503
|
-
}
|
|
10504
|
-
node2.current = element;
|
|
10505
|
-
},
|
|
10506
|
-
//eslint-disable-next-line
|
|
10507
|
-
[]
|
|
10508
|
-
);
|
|
10509
|
-
return [node2, setNodeRef];
|
|
10510
|
-
}
|
|
10511
|
-
function usePrevious$3(value) {
|
|
10512
|
-
const ref = useRef();
|
|
10513
|
-
useEffect(() => {
|
|
10514
|
-
ref.current = value;
|
|
10515
|
-
}, [value]);
|
|
10516
|
-
return ref.current;
|
|
10517
|
-
}
|
|
10518
|
-
let ids = {};
|
|
10519
|
-
function useUniqueId(prefix2, value) {
|
|
10520
|
-
return useMemo(() => {
|
|
10521
|
-
if (value) {
|
|
10522
|
-
return value;
|
|
10523
|
-
}
|
|
10524
|
-
const id2 = ids[prefix2] == null ? 0 : ids[prefix2] + 1;
|
|
10525
|
-
ids[prefix2] = id2;
|
|
10526
|
-
return prefix2 + "-" + id2;
|
|
10527
|
-
}, [prefix2, value]);
|
|
10528
|
-
}
|
|
10529
|
-
function createAdjustmentFn(modifier) {
|
|
10530
|
-
return function(object2) {
|
|
10531
|
-
for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
10532
|
-
adjustments[_key - 1] = arguments[_key];
|
|
10533
|
-
}
|
|
10534
|
-
return adjustments.reduce((accumulator, adjustment) => {
|
|
10535
|
-
const entries2 = Object.entries(adjustment);
|
|
10536
|
-
for (const [key2, valueAdjustment] of entries2) {
|
|
10537
|
-
const value = accumulator[key2];
|
|
10538
|
-
if (value != null) {
|
|
10539
|
-
accumulator[key2] = value + modifier * valueAdjustment;
|
|
10540
|
-
}
|
|
10541
|
-
}
|
|
10542
|
-
return accumulator;
|
|
10543
|
-
}, {
|
|
10544
|
-
...object2
|
|
10545
|
-
});
|
|
10546
|
-
};
|
|
10547
|
-
}
|
|
10548
|
-
const add$1 = /* @__PURE__ */ createAdjustmentFn(1);
|
|
10549
|
-
const subtract$1 = /* @__PURE__ */ createAdjustmentFn(-1);
|
|
10550
|
-
function hasViewportRelativeCoordinates(event) {
|
|
10551
|
-
return "clientX" in event && "clientY" in event;
|
|
10552
|
-
}
|
|
10553
|
-
function isKeyboardEvent(event) {
|
|
10554
|
-
if (!event) {
|
|
10555
|
-
return false;
|
|
10556
|
-
}
|
|
10557
|
-
const {
|
|
10558
|
-
KeyboardEvent: KeyboardEvent2
|
|
10559
|
-
} = getWindow(event.target);
|
|
10560
|
-
return KeyboardEvent2 && event instanceof KeyboardEvent2;
|
|
10561
|
-
}
|
|
10562
|
-
function isTouchEvent$2(event) {
|
|
10563
|
-
if (!event) {
|
|
10564
|
-
return false;
|
|
10565
|
-
}
|
|
10566
|
-
const {
|
|
10567
|
-
TouchEvent
|
|
10568
|
-
} = getWindow(event.target);
|
|
10569
|
-
return TouchEvent && event instanceof TouchEvent;
|
|
10570
|
-
}
|
|
10571
|
-
function getEventCoordinates(event) {
|
|
10572
|
-
if (isTouchEvent$2(event)) {
|
|
10573
|
-
if (event.touches && event.touches.length) {
|
|
10574
|
-
const {
|
|
10575
|
-
clientX: x2,
|
|
10576
|
-
clientY: y2
|
|
10577
|
-
} = event.touches[0];
|
|
10578
|
-
return {
|
|
10579
|
-
x: x2,
|
|
10580
|
-
y: y2
|
|
10581
|
-
};
|
|
10582
|
-
} else if (event.changedTouches && event.changedTouches.length) {
|
|
10583
|
-
const {
|
|
10584
|
-
clientX: x2,
|
|
10585
|
-
clientY: y2
|
|
10586
|
-
} = event.changedTouches[0];
|
|
10587
|
-
return {
|
|
10588
|
-
x: x2,
|
|
10589
|
-
y: y2
|
|
10590
|
-
};
|
|
10591
|
-
}
|
|
10592
|
-
}
|
|
10593
|
-
if (hasViewportRelativeCoordinates(event)) {
|
|
10594
|
-
return {
|
|
10595
|
-
x: event.clientX,
|
|
10596
|
-
y: event.clientY
|
|
10597
|
-
};
|
|
10598
|
-
}
|
|
10599
|
-
return null;
|
|
10600
|
-
}
|
|
10601
|
-
const CSS = /* @__PURE__ */ Object.freeze({
|
|
10602
|
-
Translate: {
|
|
10603
|
-
toString(transform) {
|
|
10604
|
-
if (!transform) {
|
|
10605
|
-
return;
|
|
10606
|
-
}
|
|
10607
|
-
const {
|
|
10608
|
-
x: x2,
|
|
10609
|
-
y: y2
|
|
10610
|
-
} = transform;
|
|
10611
|
-
return "translate3d(" + (x2 ? Math.round(x2) : 0) + "px, " + (y2 ? Math.round(y2) : 0) + "px, 0)";
|
|
10612
|
-
}
|
|
10613
|
-
},
|
|
10614
|
-
Scale: {
|
|
10615
|
-
toString(transform) {
|
|
10616
|
-
if (!transform) {
|
|
10617
|
-
return;
|
|
10618
|
-
}
|
|
10619
|
-
const {
|
|
10620
|
-
scaleX,
|
|
10621
|
-
scaleY
|
|
10622
|
-
} = transform;
|
|
10623
|
-
return "scaleX(" + scaleX + ") scaleY(" + scaleY + ")";
|
|
10624
|
-
}
|
|
10625
|
-
},
|
|
10626
|
-
Transform: {
|
|
10627
|
-
toString(transform) {
|
|
10628
|
-
if (!transform) {
|
|
10629
|
-
return;
|
|
9863
|
+
const {
|
|
9864
|
+
scaleX,
|
|
9865
|
+
scaleY
|
|
9866
|
+
} = transform;
|
|
9867
|
+
return "scaleX(" + scaleX + ") scaleY(" + scaleY + ")";
|
|
9868
|
+
}
|
|
9869
|
+
},
|
|
9870
|
+
Transform: {
|
|
9871
|
+
toString(transform) {
|
|
9872
|
+
if (!transform) {
|
|
9873
|
+
return;
|
|
10630
9874
|
}
|
|
10631
9875
|
return [CSS.Translate.toString(transform), CSS.Scale.toString(transform)].join(" ");
|
|
10632
9876
|
}
|
|
@@ -12386,7 +11630,7 @@ function useRect(element, measure, fallbackRect) {
|
|
|
12386
11630
|
const resizeObserver = useResizeObserver({
|
|
12387
11631
|
callback: measureRect
|
|
12388
11632
|
});
|
|
12389
|
-
useIsomorphicLayoutEffect$
|
|
11633
|
+
useIsomorphicLayoutEffect$5(() => {
|
|
12390
11634
|
measureRect();
|
|
12391
11635
|
if (element) {
|
|
12392
11636
|
resizeObserver == null ? void 0 : resizeObserver.observe(element);
|
|
@@ -12569,7 +11813,7 @@ function useRects(elements, measure) {
|
|
|
12569
11813
|
if (elements.length > 0 && rects === defaultValue$2) {
|
|
12570
11814
|
measureRects();
|
|
12571
11815
|
}
|
|
12572
|
-
useIsomorphicLayoutEffect$
|
|
11816
|
+
useIsomorphicLayoutEffect$5(() => {
|
|
12573
11817
|
if (elements.length) {
|
|
12574
11818
|
elements.forEach((element) => resizeObserver == null ? void 0 : resizeObserver.observe(element));
|
|
12575
11819
|
} else {
|
|
@@ -12940,7 +12184,7 @@ function useLayoutShiftScrollCompensation(_ref) {
|
|
|
12940
12184
|
x: config,
|
|
12941
12185
|
y: config
|
|
12942
12186
|
} : config;
|
|
12943
|
-
useIsomorphicLayoutEffect$
|
|
12187
|
+
useIsomorphicLayoutEffect$5(() => {
|
|
12944
12188
|
const disabled2 = !x2 && !y2;
|
|
12945
12189
|
if (disabled2 || !activeNode) {
|
|
12946
12190
|
initialized.current = false;
|
|
@@ -13262,7 +12506,7 @@ const DndContext$1 = /* @__PURE__ */ memo$1(function DndContext(_ref) {
|
|
|
13262
12506
|
}, [draggableNodes, instantiateSensor]);
|
|
13263
12507
|
const activators = useCombineActivators(sensors, bindActivatorToSensorInstantiator);
|
|
13264
12508
|
useSensorSetup(sensors);
|
|
13265
|
-
useIsomorphicLayoutEffect$
|
|
12509
|
+
useIsomorphicLayoutEffect$5(() => {
|
|
13266
12510
|
if (activeNodeRect && status === Status.Initializing) {
|
|
13267
12511
|
setStatus(Status.Initialized);
|
|
13268
12512
|
}
|
|
@@ -13346,7 +12590,7 @@ const DndContext$1 = /* @__PURE__ */ memo$1(function DndContext(_ref) {
|
|
|
13346
12590
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
13347
12591
|
[overId]
|
|
13348
12592
|
);
|
|
13349
|
-
useIsomorphicLayoutEffect$
|
|
12593
|
+
useIsomorphicLayoutEffect$5(() => {
|
|
13350
12594
|
sensorContext.current = {
|
|
13351
12595
|
activatorEvent,
|
|
13352
12596
|
active: active2,
|
|
@@ -13473,7 +12717,7 @@ function useDraggable(_ref) {
|
|
|
13473
12717
|
const [activatorNode, setActivatorNodeRef] = useNodeRef();
|
|
13474
12718
|
const listeners = useSyntheticListeners(activators, id2);
|
|
13475
12719
|
const dataRef = useLatestValue(data);
|
|
13476
|
-
useIsomorphicLayoutEffect$
|
|
12720
|
+
useIsomorphicLayoutEffect$5(
|
|
13477
12721
|
() => {
|
|
13478
12722
|
draggableNodes.set(id2, {
|
|
13479
12723
|
id: id2,
|
|
@@ -13593,7 +12837,7 @@ function useDroppable(_ref) {
|
|
|
13593
12837
|
resizeObserverConnected.current = false;
|
|
13594
12838
|
resizeObserver.observe(nodeRef.current);
|
|
13595
12839
|
}, [nodeRef, resizeObserver]);
|
|
13596
|
-
useIsomorphicLayoutEffect$
|
|
12840
|
+
useIsomorphicLayoutEffect$5(
|
|
13597
12841
|
() => {
|
|
13598
12842
|
dispatch({
|
|
13599
12843
|
type: Action.RegisterDroppable,
|
|
@@ -13646,7 +12890,7 @@ function AnimationManager(_ref) {
|
|
|
13646
12890
|
if (!children && !clonedChildren && previousChildren) {
|
|
13647
12891
|
setClonedChildren(previousChildren);
|
|
13648
12892
|
}
|
|
13649
|
-
useIsomorphicLayoutEffect$
|
|
12893
|
+
useIsomorphicLayoutEffect$5(() => {
|
|
13650
12894
|
if (!element) {
|
|
13651
12895
|
return;
|
|
13652
12896
|
}
|
|
@@ -14146,7 +13390,7 @@ function SortableContext(_ref) {
|
|
|
14146
13390
|
const itemsHaveChanged = !itemsEqual(items, previousItemsRef.current);
|
|
14147
13391
|
const disableTransforms = overIndex !== -1 && activeIndex === -1 || itemsHaveChanged;
|
|
14148
13392
|
const disabled2 = normalizeDisabled(disabledProp);
|
|
14149
|
-
useIsomorphicLayoutEffect$
|
|
13393
|
+
useIsomorphicLayoutEffect$5(() => {
|
|
14150
13394
|
if (itemsHaveChanged && isDragging) {
|
|
14151
13395
|
measureDroppableContainers(items);
|
|
14152
13396
|
}
|
|
@@ -14227,7 +13471,7 @@ function useDerivedTransform(_ref) {
|
|
|
14227
13471
|
} = _ref;
|
|
14228
13472
|
const [derivedTransform, setDerivedtransform] = useState(null);
|
|
14229
13473
|
const previousIndex = useRef(index2);
|
|
14230
|
-
useIsomorphicLayoutEffect$
|
|
13474
|
+
useIsomorphicLayoutEffect$5(() => {
|
|
14231
13475
|
if (!disabled2 && index2 !== previousIndex.current && node2.current) {
|
|
14232
13476
|
const initial = rect.current;
|
|
14233
13477
|
if (initial) {
|
|
@@ -14426,251 +13670,1063 @@ function useSortable(_ref) {
|
|
|
14426
13670
|
) {
|
|
14427
13671
|
return disabledTransition;
|
|
14428
13672
|
}
|
|
14429
|
-
if (shouldDisplaceDragSource && !isKeyboardEvent(activatorEvent) || !transition) {
|
|
14430
|
-
return void 0;
|
|
13673
|
+
if (shouldDisplaceDragSource && !isKeyboardEvent(activatorEvent) || !transition) {
|
|
13674
|
+
return void 0;
|
|
13675
|
+
}
|
|
13676
|
+
if (isSorting || shouldAnimateLayoutChanges) {
|
|
13677
|
+
return CSS.Transition.toString({
|
|
13678
|
+
...transition,
|
|
13679
|
+
property: transitionProperty
|
|
13680
|
+
});
|
|
13681
|
+
}
|
|
13682
|
+
return void 0;
|
|
13683
|
+
}
|
|
13684
|
+
}
|
|
13685
|
+
function normalizeLocalDisabled(localDisabled, globalDisabled) {
|
|
13686
|
+
var _localDisabled$dragga, _localDisabled$droppa;
|
|
13687
|
+
if (typeof localDisabled === "boolean") {
|
|
13688
|
+
return {
|
|
13689
|
+
draggable: localDisabled,
|
|
13690
|
+
// Backwards compatibility
|
|
13691
|
+
droppable: false
|
|
13692
|
+
};
|
|
13693
|
+
}
|
|
13694
|
+
return {
|
|
13695
|
+
draggable: (_localDisabled$dragga = localDisabled == null ? void 0 : localDisabled.draggable) != null ? _localDisabled$dragga : globalDisabled.draggable,
|
|
13696
|
+
droppable: (_localDisabled$droppa = localDisabled == null ? void 0 : localDisabled.droppable) != null ? _localDisabled$droppa : globalDisabled.droppable
|
|
13697
|
+
};
|
|
13698
|
+
}
|
|
13699
|
+
[KeyboardCode.Down, KeyboardCode.Right, KeyboardCode.Up, KeyboardCode.Left];
|
|
13700
|
+
const Label$1 = ({ label: label2 }) => {
|
|
13701
|
+
return label2 ? /* @__PURE__ */ jsx("span", { className: listStyles.label, children: /* @__PURE__ */ jsx(Badge, { color: label2.color, title: label2.value, small: label2.small }) }) : null;
|
|
13702
|
+
};
|
|
13703
|
+
const Name = ({ name: name2, icon: icon2, testId }) => {
|
|
13704
|
+
const newIcon = icon2 && /* @__PURE__ */ jsx(Icon, { icon: icon2.icon, color: icon2.color || "#db2828" });
|
|
13705
|
+
return /* @__PURE__ */ jsxs("span", { className: cx$2(listStyles.name, listStyles.bold), "data-testid": testId, children: [
|
|
13706
|
+
name2,
|
|
13707
|
+
icon2 && icon2.tooltip && icon2.tooltip.text ? /* @__PURE__ */ jsx("span", { className: listStyles.iconTooltipMargin, children: /* @__PURE__ */ jsx(Tooltip, { text: icon2.tooltip.text, maxWidth: "350px", children: newIcon }) }) : icon2 && icon2.icon && /* @__PURE__ */ jsx("span", { className: listStyles.iconTooltipMargin, children: newIcon })
|
|
13708
|
+
] });
|
|
13709
|
+
};
|
|
13710
|
+
const MetaContent = ({ item: item2 }) => {
|
|
13711
|
+
const { name: name2, icon: icon2, details: details2, metadata: metadata2, invalid, testId } = item2;
|
|
13712
|
+
let renderedName = /* @__PURE__ */ jsx(Name, { name: name2, icon: icon2, testId: testId && `${testId}-name` });
|
|
13713
|
+
if (invalid) {
|
|
13714
|
+
renderedName = /* @__PURE__ */ jsx(Badge, { small: true, margin: "-2px", title: "!", children: renderedName });
|
|
13715
|
+
}
|
|
13716
|
+
return /* @__PURE__ */ jsxs("span", { className: listStyles.title, children: [
|
|
13717
|
+
renderedName,
|
|
13718
|
+
details2 && /* @__PURE__ */ jsx(
|
|
13719
|
+
"span",
|
|
13720
|
+
{
|
|
13721
|
+
className: listStyles.details,
|
|
13722
|
+
"data-testid": testId && `${testId}-details`,
|
|
13723
|
+
children: details2
|
|
13724
|
+
}
|
|
13725
|
+
),
|
|
13726
|
+
metadata2 && /* @__PURE__ */ jsx(
|
|
13727
|
+
"span",
|
|
13728
|
+
{
|
|
13729
|
+
className: listStyles.metadata,
|
|
13730
|
+
"data-testid": testId && `${testId}-metadata`,
|
|
13731
|
+
children: metadata2
|
|
13732
|
+
}
|
|
13733
|
+
)
|
|
13734
|
+
] });
|
|
13735
|
+
};
|
|
13736
|
+
const MetaCount = ({ item: item2 }) => {
|
|
13737
|
+
return item2.metaCount !== void 0 ? /* @__PURE__ */ jsx(Badge, { color: "rgba(0,0,0,0.25)", title: item2.metaCount }) : null;
|
|
13738
|
+
};
|
|
13739
|
+
const ItemContent = ({ item: item2, expanding }) => {
|
|
13740
|
+
const onClick = (evt) => {
|
|
13741
|
+
evt.preventDefault();
|
|
13742
|
+
evt.stopPropagation();
|
|
13743
|
+
};
|
|
13744
|
+
return expanding && item2.active && item2.content ? /* @__PURE__ */ jsx("div", { className: listStyles.itemContent, onClick, children: item2.content }) : null;
|
|
13745
|
+
};
|
|
13746
|
+
const ListSubheading = forwardRef(({ item: item2, index: index2 }, listRowRefs) => {
|
|
13747
|
+
const disabledContext = useContext(DisabledContext);
|
|
13748
|
+
const { actions: actions2, disabled: disabled2, expanded: expanded2, onClick, title: title2, name: name2, icon: icon2, testId } = item2;
|
|
13749
|
+
return /* @__PURE__ */ jsx(
|
|
13750
|
+
"div",
|
|
13751
|
+
{
|
|
13752
|
+
ref: (el2) => {
|
|
13753
|
+
if (listRowRefs && "current" in listRowRefs && Array.isArray(listRowRefs.current) && index2 !== void 0) {
|
|
13754
|
+
listRowRefs.current[index2] = el2;
|
|
13755
|
+
}
|
|
13756
|
+
},
|
|
13757
|
+
"data-testid": testId ?? null,
|
|
13758
|
+
className: cx$2(
|
|
13759
|
+
listStyles.item,
|
|
13760
|
+
listStyles.heading,
|
|
13761
|
+
disabled2 || disabledContext ? listStyles.disabled : "",
|
|
13762
|
+
onClick ? listStyles.action : ""
|
|
13763
|
+
),
|
|
13764
|
+
onClick: (evt) => {
|
|
13765
|
+
if (onClick) {
|
|
13766
|
+
onClick(evt);
|
|
13767
|
+
}
|
|
13768
|
+
},
|
|
13769
|
+
title: title2,
|
|
13770
|
+
children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { className: listStyles.itemHeader, children: [
|
|
13771
|
+
typeof expanded2 === "boolean" && /* @__PURE__ */ jsx("div", { className: cx$2(listStyles.expandIcon, expanded2 && listStyles.expanded), children: /* @__PURE__ */ jsx(Icon, { icon: IconType.CHEVRON_RIGHT }) }),
|
|
13772
|
+
/* @__PURE__ */ jsx(Name, { name: name2, icon: icon2 }),
|
|
13773
|
+
/* @__PURE__ */ jsxs("div", { className: listStyles.right, children: [
|
|
13774
|
+
/* @__PURE__ */ jsx(MetaCount, { item: item2 }),
|
|
13775
|
+
!(disabled2 || disabledContext) && actions2 && /* @__PURE__ */ jsx("div", { className: listStyles.actions, children: /* @__PURE__ */ jsx(Actions, { actions: item2.actions ?? [] }) })
|
|
13776
|
+
] })
|
|
13777
|
+
] }) })
|
|
13778
|
+
}
|
|
13779
|
+
);
|
|
13780
|
+
});
|
|
13781
|
+
const ListRow = forwardRef(
|
|
13782
|
+
({ item: item2, index: index2, expanding, invokeEditOnRowClick, draggable }, listRowRefs) => {
|
|
13783
|
+
const disabledContext = useContext(DisabledContext);
|
|
13784
|
+
const listElement = (index22, item22, style, attributes, listeners, setNodeRef) => {
|
|
13785
|
+
const edit2 = item22.actions && item22.actions.find(
|
|
13786
|
+
(a2) => {
|
|
13787
|
+
var _a2;
|
|
13788
|
+
return a2.label && ((_a2 = String(a2.label)) == null ? void 0 : _a2.toLowerCase()) === "edit";
|
|
13789
|
+
}
|
|
13790
|
+
);
|
|
13791
|
+
const hasOnClick = !!(edit2 || item22.url || item22.onClick);
|
|
13792
|
+
const indent = item22.level && item22.level > 1 ? (item22.level - 1) * 20 : 0;
|
|
13793
|
+
const Component2 = item22.component || "a";
|
|
13794
|
+
return /* @__PURE__ */ jsx(
|
|
13795
|
+
Component2,
|
|
13796
|
+
{
|
|
13797
|
+
href: item22.url,
|
|
13798
|
+
to: item22.url,
|
|
13799
|
+
ref: setNodeRef,
|
|
13800
|
+
style,
|
|
13801
|
+
className: cx$2(
|
|
13802
|
+
listStyles.item,
|
|
13803
|
+
item22.active ? listStyles.active : "",
|
|
13804
|
+
item22.disabled || disabledContext ? listStyles.disabled : "",
|
|
13805
|
+
hasOnClick ? listStyles.action : ""
|
|
13806
|
+
),
|
|
13807
|
+
onClick: (evt) => {
|
|
13808
|
+
if (invokeEditOnRowClick && edit2) {
|
|
13809
|
+
if (edit2.onClick) edit2.onClick(evt, item22.id);
|
|
13810
|
+
}
|
|
13811
|
+
if (item22.onClick) {
|
|
13812
|
+
return item22.onClick(evt);
|
|
13813
|
+
}
|
|
13814
|
+
},
|
|
13815
|
+
"data-id": index22,
|
|
13816
|
+
title: item22.title,
|
|
13817
|
+
"data-testid": item22.testId,
|
|
13818
|
+
children: /* @__PURE__ */ jsxs(
|
|
13819
|
+
"div",
|
|
13820
|
+
{
|
|
13821
|
+
ref: (el2) => {
|
|
13822
|
+
if (listRowRefs && "current" in listRowRefs && Array.isArray(listRowRefs.current) && index22 !== void 0) {
|
|
13823
|
+
listRowRefs.current[index22] = el2;
|
|
13824
|
+
}
|
|
13825
|
+
},
|
|
13826
|
+
style: { paddingLeft: indent },
|
|
13827
|
+
children: [
|
|
13828
|
+
/* @__PURE__ */ jsxs("div", { className: listStyles.itemHeader, children: [
|
|
13829
|
+
draggable && /* @__PURE__ */ jsx("div", { className: listStyles.drag, ...attributes, ...listeners, children: /* @__PURE__ */ jsx(Icon, { icon: IconType.DRAG }) }),
|
|
13830
|
+
item22.level && item22.level > 0 ? /* @__PURE__ */ jsx("div", { className: listStyles.indentIcon, children: /* @__PURE__ */ jsx(Icon, { icon: IconType.INDENT }) }) : null,
|
|
13831
|
+
/* @__PURE__ */ jsx(Label$1, { label: item22.label }),
|
|
13832
|
+
/* @__PURE__ */ jsx(MetaContent, { item: item22 }),
|
|
13833
|
+
/* @__PURE__ */ jsxs("div", { className: listStyles.right, children: [
|
|
13834
|
+
/* @__PURE__ */ jsx(MetaCount, { item: item22 }),
|
|
13835
|
+
!(item22.disabled || disabledContext) && item22.actions && /* @__PURE__ */ jsx("div", { className: listStyles.actions, children: /* @__PURE__ */ jsx(Actions, { actions: item22.actions }) })
|
|
13836
|
+
] })
|
|
13837
|
+
] }),
|
|
13838
|
+
/* @__PURE__ */ jsx(ItemContent, { item: item22, expanding })
|
|
13839
|
+
]
|
|
13840
|
+
}
|
|
13841
|
+
)
|
|
13842
|
+
},
|
|
13843
|
+
index22
|
|
13844
|
+
);
|
|
13845
|
+
};
|
|
13846
|
+
const listElementWithDrag = (index22, item22) => {
|
|
13847
|
+
const {
|
|
13848
|
+
attributes,
|
|
13849
|
+
listeners,
|
|
13850
|
+
setNodeRef,
|
|
13851
|
+
transform,
|
|
13852
|
+
transition,
|
|
13853
|
+
isDragging
|
|
13854
|
+
} = useSortable({
|
|
13855
|
+
id: index22.toString(),
|
|
13856
|
+
animateLayoutChanges: () => false
|
|
13857
|
+
});
|
|
13858
|
+
const style = {
|
|
13859
|
+
transform: CSS.Translate.toString(transform),
|
|
13860
|
+
transition,
|
|
13861
|
+
opacity: isDragging ? 0 : 1
|
|
13862
|
+
};
|
|
13863
|
+
return listElement(index22, item22, style, attributes, listeners, setNodeRef);
|
|
13864
|
+
};
|
|
13865
|
+
const isSubheading = item2.type === "Heading";
|
|
13866
|
+
return isSubheading ? /* @__PURE__ */ jsx(ListSubheading, { ref: listRowRefs, item: item2, index: index2 }, index2) : draggable ? listElementWithDrag(index2, item2) : listElement(index2, item2);
|
|
13867
|
+
}
|
|
13868
|
+
);
|
|
13869
|
+
const ListDragWrapper = ({
|
|
13870
|
+
children,
|
|
13871
|
+
draggable,
|
|
13872
|
+
list: list2,
|
|
13873
|
+
onListReorder
|
|
13874
|
+
}) => {
|
|
13875
|
+
const [dragIndex, setDragIndex] = useState(null);
|
|
13876
|
+
if (!draggable) {
|
|
13877
|
+
return children;
|
|
13878
|
+
}
|
|
13879
|
+
const handleDragStart2 = (event) => {
|
|
13880
|
+
setDragIndex(event.active.id);
|
|
13881
|
+
};
|
|
13882
|
+
const handleDragEnd = (event) => {
|
|
13883
|
+
setDragIndex(null);
|
|
13884
|
+
const { active: active2, over } = event;
|
|
13885
|
+
const from3 = active2 == null ? void 0 : active2.id;
|
|
13886
|
+
const to2 = over == null ? void 0 : over.id;
|
|
13887
|
+
if (from3 !== to2) {
|
|
13888
|
+
onListReorder({
|
|
13889
|
+
from: Number(from3),
|
|
13890
|
+
to: Number(to2)
|
|
13891
|
+
});
|
|
13892
|
+
}
|
|
13893
|
+
};
|
|
13894
|
+
const itemIds = useMemo(
|
|
13895
|
+
() => list2.items.map((_2, index2) => index2.toString()),
|
|
13896
|
+
[list2.items]
|
|
13897
|
+
);
|
|
13898
|
+
return /* @__PURE__ */ jsxs(
|
|
13899
|
+
DndContext$1,
|
|
13900
|
+
{
|
|
13901
|
+
collisionDetection: closestCenter,
|
|
13902
|
+
onDragStart: handleDragStart2,
|
|
13903
|
+
onDragEnd: handleDragEnd,
|
|
13904
|
+
children: [
|
|
13905
|
+
/* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy: verticalListSortingStrategy, children }),
|
|
13906
|
+
!!dragIndex && createPortal(
|
|
13907
|
+
/* @__PURE__ */ jsx(DragOverlay, { dropAnimation: null, children: /* @__PURE__ */ jsx("div", { className: listStyles.dragOverlay, children: /* @__PURE__ */ jsx(
|
|
13908
|
+
ListRow,
|
|
13909
|
+
{
|
|
13910
|
+
draggable,
|
|
13911
|
+
item: list2.items[Number(dragIndex)],
|
|
13912
|
+
index: Number(dragIndex)
|
|
13913
|
+
}
|
|
13914
|
+
) }) }),
|
|
13915
|
+
document.body
|
|
13916
|
+
)
|
|
13917
|
+
]
|
|
13918
|
+
}
|
|
13919
|
+
);
|
|
13920
|
+
};
|
|
13921
|
+
function memo(getDeps, fn, opts) {
|
|
13922
|
+
let deps = opts.initialDeps ?? [];
|
|
13923
|
+
let result;
|
|
13924
|
+
return () => {
|
|
13925
|
+
var _a2, _b, _c, _d;
|
|
13926
|
+
let depTime;
|
|
13927
|
+
if (opts.key && ((_a2 = opts.debug) == null ? void 0 : _a2.call(opts))) depTime = Date.now();
|
|
13928
|
+
const newDeps = getDeps();
|
|
13929
|
+
const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index2) => deps[index2] !== dep);
|
|
13930
|
+
if (!depsChanged) {
|
|
13931
|
+
return result;
|
|
14431
13932
|
}
|
|
14432
|
-
|
|
14433
|
-
|
|
14434
|
-
|
|
14435
|
-
|
|
14436
|
-
|
|
13933
|
+
deps = newDeps;
|
|
13934
|
+
let resultTime;
|
|
13935
|
+
if (opts.key && ((_b = opts.debug) == null ? void 0 : _b.call(opts))) resultTime = Date.now();
|
|
13936
|
+
result = fn(...newDeps);
|
|
13937
|
+
if (opts.key && ((_c = opts.debug) == null ? void 0 : _c.call(opts))) {
|
|
13938
|
+
const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
|
|
13939
|
+
const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
|
|
13940
|
+
const resultFpsPercentage = resultEndTime / 16;
|
|
13941
|
+
const pad = (str, num) => {
|
|
13942
|
+
str = String(str);
|
|
13943
|
+
while (str.length < num) {
|
|
13944
|
+
str = " " + str;
|
|
13945
|
+
}
|
|
13946
|
+
return str;
|
|
13947
|
+
};
|
|
13948
|
+
console.info(
|
|
13949
|
+
`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,
|
|
13950
|
+
`
|
|
13951
|
+
font-size: .6rem;
|
|
13952
|
+
font-weight: bold;
|
|
13953
|
+
color: hsl(${Math.max(
|
|
13954
|
+
0,
|
|
13955
|
+
Math.min(120 - 120 * resultFpsPercentage, 120)
|
|
13956
|
+
)}deg 100% 31%);`,
|
|
13957
|
+
opts == null ? void 0 : opts.key
|
|
13958
|
+
);
|
|
14437
13959
|
}
|
|
14438
|
-
|
|
13960
|
+
(_d = opts == null ? void 0 : opts.onChange) == null ? void 0 : _d.call(opts, result);
|
|
13961
|
+
return result;
|
|
13962
|
+
};
|
|
13963
|
+
}
|
|
13964
|
+
function notUndefined(value, msg2) {
|
|
13965
|
+
if (value === void 0) {
|
|
13966
|
+
throw new Error(`Unexpected undefined${""}`);
|
|
13967
|
+
} else {
|
|
13968
|
+
return value;
|
|
14439
13969
|
}
|
|
14440
13970
|
}
|
|
14441
|
-
|
|
14442
|
-
|
|
14443
|
-
|
|
14444
|
-
|
|
14445
|
-
|
|
14446
|
-
|
|
14447
|
-
|
|
13971
|
+
const approxEqual = (a2, b2) => Math.abs(a2 - b2) < 1;
|
|
13972
|
+
const debounce$2 = (targetWindow, fn, ms2) => {
|
|
13973
|
+
let timeoutId;
|
|
13974
|
+
return function(...args) {
|
|
13975
|
+
targetWindow.clearTimeout(timeoutId);
|
|
13976
|
+
timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms2);
|
|
13977
|
+
};
|
|
13978
|
+
};
|
|
13979
|
+
const defaultKeyExtractor = (index2) => index2;
|
|
13980
|
+
const defaultRangeExtractor = (range2) => {
|
|
13981
|
+
const start = Math.max(range2.startIndex - range2.overscan, 0);
|
|
13982
|
+
const end = Math.min(range2.endIndex + range2.overscan, range2.count - 1);
|
|
13983
|
+
const arr = [];
|
|
13984
|
+
for (let i = start; i <= end; i++) {
|
|
13985
|
+
arr.push(i);
|
|
13986
|
+
}
|
|
13987
|
+
return arr;
|
|
13988
|
+
};
|
|
13989
|
+
const observeElementRect = (instance, cb2) => {
|
|
13990
|
+
const element = instance.scrollElement;
|
|
13991
|
+
if (!element) {
|
|
13992
|
+
return;
|
|
13993
|
+
}
|
|
13994
|
+
const targetWindow = instance.targetWindow;
|
|
13995
|
+
if (!targetWindow) {
|
|
13996
|
+
return;
|
|
13997
|
+
}
|
|
13998
|
+
const handler = (rect) => {
|
|
13999
|
+
const { width: width2, height: height2 } = rect;
|
|
14000
|
+
cb2({ width: Math.round(width2), height: Math.round(height2) });
|
|
14001
|
+
};
|
|
14002
|
+
handler(element.getBoundingClientRect());
|
|
14003
|
+
if (!targetWindow.ResizeObserver) {
|
|
14004
|
+
return () => {
|
|
14005
|
+
};
|
|
14006
|
+
}
|
|
14007
|
+
const observer = new targetWindow.ResizeObserver((entries2) => {
|
|
14008
|
+
const entry = entries2[0];
|
|
14009
|
+
if (entry == null ? void 0 : entry.borderBoxSize) {
|
|
14010
|
+
const box = entry.borderBoxSize[0];
|
|
14011
|
+
if (box) {
|
|
14012
|
+
handler({ width: box.inlineSize, height: box.blockSize });
|
|
14013
|
+
return;
|
|
14014
|
+
}
|
|
14015
|
+
}
|
|
14016
|
+
handler(element.getBoundingClientRect());
|
|
14017
|
+
});
|
|
14018
|
+
observer.observe(element, { box: "border-box" });
|
|
14019
|
+
return () => {
|
|
14020
|
+
observer.unobserve(element);
|
|
14021
|
+
};
|
|
14022
|
+
};
|
|
14023
|
+
const addEventListenerOptions = {
|
|
14024
|
+
passive: true
|
|
14025
|
+
};
|
|
14026
|
+
const supportsScrollend = typeof window == "undefined" ? true : "onscrollend" in window;
|
|
14027
|
+
const observeElementOffset = (instance, cb2) => {
|
|
14028
|
+
const element = instance.scrollElement;
|
|
14029
|
+
if (!element) {
|
|
14030
|
+
return;
|
|
14031
|
+
}
|
|
14032
|
+
const targetWindow = instance.targetWindow;
|
|
14033
|
+
if (!targetWindow) {
|
|
14034
|
+
return;
|
|
14035
|
+
}
|
|
14036
|
+
let offset = 0;
|
|
14037
|
+
const fallback = instance.options.useScrollendEvent && supportsScrollend ? () => void 0 : debounce$2(
|
|
14038
|
+
targetWindow,
|
|
14039
|
+
() => {
|
|
14040
|
+
cb2(offset, false);
|
|
14041
|
+
},
|
|
14042
|
+
instance.options.isScrollingResetDelay
|
|
14043
|
+
);
|
|
14044
|
+
const createHandler = (isScrolling) => () => {
|
|
14045
|
+
const { horizontal, isRtl } = instance.options;
|
|
14046
|
+
offset = horizontal ? element["scrollLeft"] * (isRtl && -1 || 1) : element["scrollTop"];
|
|
14047
|
+
fallback();
|
|
14048
|
+
cb2(offset, isScrolling);
|
|
14049
|
+
};
|
|
14050
|
+
const handler = createHandler(true);
|
|
14051
|
+
const endHandler = createHandler(false);
|
|
14052
|
+
endHandler();
|
|
14053
|
+
element.addEventListener("scroll", handler, addEventListenerOptions);
|
|
14054
|
+
element.addEventListener("scrollend", endHandler, addEventListenerOptions);
|
|
14055
|
+
return () => {
|
|
14056
|
+
element.removeEventListener("scroll", handler);
|
|
14057
|
+
element.removeEventListener("scrollend", endHandler);
|
|
14058
|
+
};
|
|
14059
|
+
};
|
|
14060
|
+
const measureElement = (element, entry, instance) => {
|
|
14061
|
+
if (entry == null ? void 0 : entry.borderBoxSize) {
|
|
14062
|
+
const box = entry.borderBoxSize[0];
|
|
14063
|
+
if (box) {
|
|
14064
|
+
const size2 = Math.round(
|
|
14065
|
+
box[instance.options.horizontal ? "inlineSize" : "blockSize"]
|
|
14066
|
+
);
|
|
14067
|
+
return size2;
|
|
14068
|
+
}
|
|
14069
|
+
}
|
|
14070
|
+
return Math.round(
|
|
14071
|
+
element.getBoundingClientRect()[instance.options.horizontal ? "width" : "height"]
|
|
14072
|
+
);
|
|
14073
|
+
};
|
|
14074
|
+
const elementScroll = (offset, {
|
|
14075
|
+
adjustments = 0,
|
|
14076
|
+
behavior
|
|
14077
|
+
}, instance) => {
|
|
14078
|
+
var _a2, _b;
|
|
14079
|
+
const toOffset = offset + adjustments;
|
|
14080
|
+
(_b = (_a2 = instance.scrollElement) == null ? void 0 : _a2.scrollTo) == null ? void 0 : _b.call(_a2, {
|
|
14081
|
+
[instance.options.horizontal ? "left" : "top"]: toOffset,
|
|
14082
|
+
behavior
|
|
14083
|
+
});
|
|
14084
|
+
};
|
|
14085
|
+
class Virtualizer {
|
|
14086
|
+
constructor(opts) {
|
|
14087
|
+
this.unsubs = [];
|
|
14088
|
+
this.scrollElement = null;
|
|
14089
|
+
this.targetWindow = null;
|
|
14090
|
+
this.isScrolling = false;
|
|
14091
|
+
this.scrollToIndexTimeoutId = null;
|
|
14092
|
+
this.measurementsCache = [];
|
|
14093
|
+
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
14094
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
14095
|
+
this.scrollRect = null;
|
|
14096
|
+
this.scrollOffset = null;
|
|
14097
|
+
this.scrollDirection = null;
|
|
14098
|
+
this.scrollAdjustments = 0;
|
|
14099
|
+
this.elementsCache = /* @__PURE__ */ new Map();
|
|
14100
|
+
this.observer = /* @__PURE__ */ (() => {
|
|
14101
|
+
let _ro = null;
|
|
14102
|
+
const get3 = () => {
|
|
14103
|
+
if (_ro) {
|
|
14104
|
+
return _ro;
|
|
14105
|
+
}
|
|
14106
|
+
if (!this.targetWindow || !this.targetWindow.ResizeObserver) {
|
|
14107
|
+
return null;
|
|
14108
|
+
}
|
|
14109
|
+
return _ro = new this.targetWindow.ResizeObserver((entries2) => {
|
|
14110
|
+
entries2.forEach((entry) => {
|
|
14111
|
+
this._measureElement(entry.target, entry);
|
|
14112
|
+
});
|
|
14113
|
+
});
|
|
14114
|
+
};
|
|
14115
|
+
return {
|
|
14116
|
+
disconnect: () => {
|
|
14117
|
+
var _a2;
|
|
14118
|
+
(_a2 = get3()) == null ? void 0 : _a2.disconnect();
|
|
14119
|
+
_ro = null;
|
|
14120
|
+
},
|
|
14121
|
+
observe: (target) => {
|
|
14122
|
+
var _a2;
|
|
14123
|
+
return (_a2 = get3()) == null ? void 0 : _a2.observe(target, { box: "border-box" });
|
|
14124
|
+
},
|
|
14125
|
+
unobserve: (target) => {
|
|
14126
|
+
var _a2;
|
|
14127
|
+
return (_a2 = get3()) == null ? void 0 : _a2.unobserve(target);
|
|
14128
|
+
}
|
|
14129
|
+
};
|
|
14130
|
+
})();
|
|
14131
|
+
this.range = null;
|
|
14132
|
+
this.setOptions = (opts2) => {
|
|
14133
|
+
Object.entries(opts2).forEach(([key2, value]) => {
|
|
14134
|
+
if (typeof value === "undefined") delete opts2[key2];
|
|
14135
|
+
});
|
|
14136
|
+
this.options = {
|
|
14137
|
+
debug: false,
|
|
14138
|
+
initialOffset: 0,
|
|
14139
|
+
overscan: 1,
|
|
14140
|
+
paddingStart: 0,
|
|
14141
|
+
paddingEnd: 0,
|
|
14142
|
+
scrollPaddingStart: 0,
|
|
14143
|
+
scrollPaddingEnd: 0,
|
|
14144
|
+
horizontal: false,
|
|
14145
|
+
getItemKey: defaultKeyExtractor,
|
|
14146
|
+
rangeExtractor: defaultRangeExtractor,
|
|
14147
|
+
onChange: () => {
|
|
14148
|
+
},
|
|
14149
|
+
measureElement,
|
|
14150
|
+
initialRect: { width: 0, height: 0 },
|
|
14151
|
+
scrollMargin: 0,
|
|
14152
|
+
gap: 0,
|
|
14153
|
+
indexAttribute: "data-index",
|
|
14154
|
+
initialMeasurementsCache: [],
|
|
14155
|
+
lanes: 1,
|
|
14156
|
+
isScrollingResetDelay: 150,
|
|
14157
|
+
enabled: true,
|
|
14158
|
+
isRtl: false,
|
|
14159
|
+
useScrollendEvent: true,
|
|
14160
|
+
...opts2
|
|
14161
|
+
};
|
|
14162
|
+
};
|
|
14163
|
+
this.notify = (sync2) => {
|
|
14164
|
+
var _a2, _b;
|
|
14165
|
+
(_b = (_a2 = this.options).onChange) == null ? void 0 : _b.call(_a2, this, sync2);
|
|
14448
14166
|
};
|
|
14449
|
-
|
|
14450
|
-
|
|
14451
|
-
|
|
14452
|
-
|
|
14453
|
-
|
|
14454
|
-
|
|
14455
|
-
|
|
14456
|
-
|
|
14457
|
-
|
|
14458
|
-
|
|
14459
|
-
|
|
14460
|
-
|
|
14461
|
-
return /* @__PURE__ */ jsxs("span", { className: cx$2(listStyles.name, listStyles.bold), "data-testid": testId, children: [
|
|
14462
|
-
name2,
|
|
14463
|
-
icon2 && icon2.tooltip && icon2.tooltip.text ? /* @__PURE__ */ jsx("span", { className: listStyles.iconTooltipMargin, children: /* @__PURE__ */ jsx(Tooltip, { text: icon2.tooltip.text, maxWidth: "350px", children: newIcon }) }) : icon2 && icon2.icon && /* @__PURE__ */ jsx("span", { className: listStyles.iconTooltipMargin, children: newIcon })
|
|
14464
|
-
] });
|
|
14465
|
-
};
|
|
14466
|
-
const MetaContent = ({ item: item2 }) => {
|
|
14467
|
-
const { name: name2, icon: icon2, details: details2, metadata: metadata2, invalid, testId } = item2;
|
|
14468
|
-
let renderedName = /* @__PURE__ */ jsx(Name, { name: name2, icon: icon2, testId: testId && `${testId}-name` });
|
|
14469
|
-
if (invalid) {
|
|
14470
|
-
renderedName = /* @__PURE__ */ jsx(Badge, { small: true, margin: "-2px", title: "!", children: renderedName });
|
|
14471
|
-
}
|
|
14472
|
-
return /* @__PURE__ */ jsxs("span", { className: listStyles.title, children: [
|
|
14473
|
-
renderedName,
|
|
14474
|
-
details2 && /* @__PURE__ */ jsx(
|
|
14475
|
-
"span",
|
|
14167
|
+
this.maybeNotify = memo(
|
|
14168
|
+
() => {
|
|
14169
|
+
this.calculateRange();
|
|
14170
|
+
return [
|
|
14171
|
+
this.isScrolling,
|
|
14172
|
+
this.range ? this.range.startIndex : null,
|
|
14173
|
+
this.range ? this.range.endIndex : null
|
|
14174
|
+
];
|
|
14175
|
+
},
|
|
14176
|
+
(isScrolling) => {
|
|
14177
|
+
this.notify(isScrolling);
|
|
14178
|
+
},
|
|
14476
14179
|
{
|
|
14477
|
-
|
|
14478
|
-
|
|
14479
|
-
|
|
14180
|
+
key: process.env.NODE_ENV !== "production" && "maybeNotify",
|
|
14181
|
+
debug: () => this.options.debug,
|
|
14182
|
+
initialDeps: [
|
|
14183
|
+
this.isScrolling,
|
|
14184
|
+
this.range ? this.range.startIndex : null,
|
|
14185
|
+
this.range ? this.range.endIndex : null
|
|
14186
|
+
]
|
|
14187
|
+
}
|
|
14188
|
+
);
|
|
14189
|
+
this.cleanup = () => {
|
|
14190
|
+
this.unsubs.filter(Boolean).forEach((d2) => d2());
|
|
14191
|
+
this.unsubs = [];
|
|
14192
|
+
this.observer.disconnect();
|
|
14193
|
+
this.scrollElement = null;
|
|
14194
|
+
this.targetWindow = null;
|
|
14195
|
+
};
|
|
14196
|
+
this._didMount = () => {
|
|
14197
|
+
return () => {
|
|
14198
|
+
this.cleanup();
|
|
14199
|
+
};
|
|
14200
|
+
};
|
|
14201
|
+
this._willUpdate = () => {
|
|
14202
|
+
var _a2;
|
|
14203
|
+
const scrollElement = this.options.enabled ? this.options.getScrollElement() : null;
|
|
14204
|
+
if (this.scrollElement !== scrollElement) {
|
|
14205
|
+
this.cleanup();
|
|
14206
|
+
if (!scrollElement) {
|
|
14207
|
+
this.maybeNotify();
|
|
14208
|
+
return;
|
|
14209
|
+
}
|
|
14210
|
+
this.scrollElement = scrollElement;
|
|
14211
|
+
if (this.scrollElement && "ownerDocument" in this.scrollElement) {
|
|
14212
|
+
this.targetWindow = this.scrollElement.ownerDocument.defaultView;
|
|
14213
|
+
} else {
|
|
14214
|
+
this.targetWindow = ((_a2 = this.scrollElement) == null ? void 0 : _a2.window) ?? null;
|
|
14215
|
+
}
|
|
14216
|
+
this.elementsCache.forEach((cached) => {
|
|
14217
|
+
this.observer.observe(cached);
|
|
14218
|
+
});
|
|
14219
|
+
this._scrollToOffset(this.getScrollOffset(), {
|
|
14220
|
+
adjustments: void 0,
|
|
14221
|
+
behavior: void 0
|
|
14222
|
+
});
|
|
14223
|
+
this.unsubs.push(
|
|
14224
|
+
this.options.observeElementRect(this, (rect) => {
|
|
14225
|
+
this.scrollRect = rect;
|
|
14226
|
+
this.maybeNotify();
|
|
14227
|
+
})
|
|
14228
|
+
);
|
|
14229
|
+
this.unsubs.push(
|
|
14230
|
+
this.options.observeElementOffset(this, (offset, isScrolling) => {
|
|
14231
|
+
this.scrollAdjustments = 0;
|
|
14232
|
+
this.scrollDirection = isScrolling ? this.getScrollOffset() < offset ? "forward" : "backward" : null;
|
|
14233
|
+
this.scrollOffset = offset;
|
|
14234
|
+
this.isScrolling = isScrolling;
|
|
14235
|
+
this.maybeNotify();
|
|
14236
|
+
})
|
|
14237
|
+
);
|
|
14238
|
+
}
|
|
14239
|
+
};
|
|
14240
|
+
this.getSize = () => {
|
|
14241
|
+
if (!this.options.enabled) {
|
|
14242
|
+
this.scrollRect = null;
|
|
14243
|
+
return 0;
|
|
14244
|
+
}
|
|
14245
|
+
this.scrollRect = this.scrollRect ?? this.options.initialRect;
|
|
14246
|
+
return this.scrollRect[this.options.horizontal ? "width" : "height"];
|
|
14247
|
+
};
|
|
14248
|
+
this.getScrollOffset = () => {
|
|
14249
|
+
if (!this.options.enabled) {
|
|
14250
|
+
this.scrollOffset = null;
|
|
14251
|
+
return 0;
|
|
14252
|
+
}
|
|
14253
|
+
this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset === "function" ? this.options.initialOffset() : this.options.initialOffset);
|
|
14254
|
+
return this.scrollOffset;
|
|
14255
|
+
};
|
|
14256
|
+
this.getFurthestMeasurement = (measurements, index2) => {
|
|
14257
|
+
const furthestMeasurementsFound = /* @__PURE__ */ new Map();
|
|
14258
|
+
const furthestMeasurements = /* @__PURE__ */ new Map();
|
|
14259
|
+
for (let m2 = index2 - 1; m2 >= 0; m2--) {
|
|
14260
|
+
const measurement = measurements[m2];
|
|
14261
|
+
if (furthestMeasurementsFound.has(measurement.lane)) {
|
|
14262
|
+
continue;
|
|
14263
|
+
}
|
|
14264
|
+
const previousFurthestMeasurement = furthestMeasurements.get(
|
|
14265
|
+
measurement.lane
|
|
14266
|
+
);
|
|
14267
|
+
if (previousFurthestMeasurement == null || measurement.end > previousFurthestMeasurement.end) {
|
|
14268
|
+
furthestMeasurements.set(measurement.lane, measurement);
|
|
14269
|
+
} else if (measurement.end < previousFurthestMeasurement.end) {
|
|
14270
|
+
furthestMeasurementsFound.set(measurement.lane, true);
|
|
14271
|
+
}
|
|
14272
|
+
if (furthestMeasurementsFound.size === this.options.lanes) {
|
|
14273
|
+
break;
|
|
14274
|
+
}
|
|
14275
|
+
}
|
|
14276
|
+
return furthestMeasurements.size === this.options.lanes ? Array.from(furthestMeasurements.values()).sort((a2, b2) => {
|
|
14277
|
+
if (a2.end === b2.end) {
|
|
14278
|
+
return a2.index - b2.index;
|
|
14279
|
+
}
|
|
14280
|
+
return a2.end - b2.end;
|
|
14281
|
+
})[0] : void 0;
|
|
14282
|
+
};
|
|
14283
|
+
this.getMeasurementOptions = memo(
|
|
14284
|
+
() => [
|
|
14285
|
+
this.options.count,
|
|
14286
|
+
this.options.paddingStart,
|
|
14287
|
+
this.options.scrollMargin,
|
|
14288
|
+
this.options.getItemKey,
|
|
14289
|
+
this.options.enabled
|
|
14290
|
+
],
|
|
14291
|
+
(count, paddingStart, scrollMargin, getItemKey, enabled) => {
|
|
14292
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
14293
|
+
return {
|
|
14294
|
+
count,
|
|
14295
|
+
paddingStart,
|
|
14296
|
+
scrollMargin,
|
|
14297
|
+
getItemKey,
|
|
14298
|
+
enabled
|
|
14299
|
+
};
|
|
14300
|
+
},
|
|
14301
|
+
{
|
|
14302
|
+
key: false
|
|
14303
|
+
}
|
|
14304
|
+
);
|
|
14305
|
+
this.getMeasurements = memo(
|
|
14306
|
+
() => [this.getMeasurementOptions(), this.itemSizeCache],
|
|
14307
|
+
({ count, paddingStart, scrollMargin, getItemKey, enabled }, itemSizeCache) => {
|
|
14308
|
+
if (!enabled) {
|
|
14309
|
+
this.measurementsCache = [];
|
|
14310
|
+
this.itemSizeCache.clear();
|
|
14311
|
+
return [];
|
|
14312
|
+
}
|
|
14313
|
+
if (this.measurementsCache.length === 0) {
|
|
14314
|
+
this.measurementsCache = this.options.initialMeasurementsCache;
|
|
14315
|
+
this.measurementsCache.forEach((item2) => {
|
|
14316
|
+
this.itemSizeCache.set(item2.key, item2.size);
|
|
14317
|
+
});
|
|
14318
|
+
}
|
|
14319
|
+
const min = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
|
|
14320
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
14321
|
+
const measurements = this.measurementsCache.slice(0, min);
|
|
14322
|
+
for (let i = min; i < count; i++) {
|
|
14323
|
+
const key2 = getItemKey(i);
|
|
14324
|
+
const furthestMeasurement = this.options.lanes === 1 ? measurements[i - 1] : this.getFurthestMeasurement(measurements, i);
|
|
14325
|
+
const start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
|
|
14326
|
+
const measuredSize = itemSizeCache.get(key2);
|
|
14327
|
+
const size2 = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i);
|
|
14328
|
+
const end = start + size2;
|
|
14329
|
+
const lane = furthestMeasurement ? furthestMeasurement.lane : i % this.options.lanes;
|
|
14330
|
+
measurements[i] = {
|
|
14331
|
+
index: i,
|
|
14332
|
+
start,
|
|
14333
|
+
size: size2,
|
|
14334
|
+
end,
|
|
14335
|
+
key: key2,
|
|
14336
|
+
lane
|
|
14337
|
+
};
|
|
14338
|
+
}
|
|
14339
|
+
this.measurementsCache = measurements;
|
|
14340
|
+
return measurements;
|
|
14341
|
+
},
|
|
14342
|
+
{
|
|
14343
|
+
key: process.env.NODE_ENV !== "production" && "getMeasurements",
|
|
14344
|
+
debug: () => this.options.debug
|
|
14345
|
+
}
|
|
14346
|
+
);
|
|
14347
|
+
this.calculateRange = memo(
|
|
14348
|
+
() => [this.getMeasurements(), this.getSize(), this.getScrollOffset()],
|
|
14349
|
+
(measurements, outerSize, scrollOffset) => {
|
|
14350
|
+
return this.range = measurements.length > 0 && outerSize > 0 ? calculateRange({
|
|
14351
|
+
measurements,
|
|
14352
|
+
outerSize,
|
|
14353
|
+
scrollOffset
|
|
14354
|
+
}) : null;
|
|
14355
|
+
},
|
|
14356
|
+
{
|
|
14357
|
+
key: process.env.NODE_ENV !== "production" && "calculateRange",
|
|
14358
|
+
debug: () => this.options.debug
|
|
14359
|
+
}
|
|
14360
|
+
);
|
|
14361
|
+
this.getIndexes = memo(
|
|
14362
|
+
() => [
|
|
14363
|
+
this.options.rangeExtractor,
|
|
14364
|
+
this.calculateRange(),
|
|
14365
|
+
this.options.overscan,
|
|
14366
|
+
this.options.count
|
|
14367
|
+
],
|
|
14368
|
+
(rangeExtractor, range2, overscan, count) => {
|
|
14369
|
+
return range2 === null ? [] : rangeExtractor({
|
|
14370
|
+
startIndex: range2.startIndex,
|
|
14371
|
+
endIndex: range2.endIndex,
|
|
14372
|
+
overscan,
|
|
14373
|
+
count
|
|
14374
|
+
});
|
|
14375
|
+
},
|
|
14376
|
+
{
|
|
14377
|
+
key: process.env.NODE_ENV !== "production" && "getIndexes",
|
|
14378
|
+
debug: () => this.options.debug
|
|
14379
|
+
}
|
|
14380
|
+
);
|
|
14381
|
+
this.indexFromElement = (node2) => {
|
|
14382
|
+
const attributeName = this.options.indexAttribute;
|
|
14383
|
+
const indexStr = node2.getAttribute(attributeName);
|
|
14384
|
+
if (!indexStr) {
|
|
14385
|
+
console.warn(
|
|
14386
|
+
`Missing attribute name '${attributeName}={index}' on measured element.`
|
|
14387
|
+
);
|
|
14388
|
+
return -1;
|
|
14389
|
+
}
|
|
14390
|
+
return parseInt(indexStr, 10);
|
|
14391
|
+
};
|
|
14392
|
+
this._measureElement = (node2, entry) => {
|
|
14393
|
+
const index2 = this.indexFromElement(node2);
|
|
14394
|
+
const item2 = this.measurementsCache[index2];
|
|
14395
|
+
if (!item2) {
|
|
14396
|
+
return;
|
|
14480
14397
|
}
|
|
14481
|
-
|
|
14482
|
-
|
|
14483
|
-
|
|
14484
|
-
|
|
14485
|
-
|
|
14486
|
-
|
|
14487
|
-
|
|
14398
|
+
const key2 = item2.key;
|
|
14399
|
+
const prevNode = this.elementsCache.get(key2);
|
|
14400
|
+
if (prevNode !== node2) {
|
|
14401
|
+
if (prevNode) {
|
|
14402
|
+
this.observer.unobserve(prevNode);
|
|
14403
|
+
}
|
|
14404
|
+
this.observer.observe(node2);
|
|
14405
|
+
this.elementsCache.set(key2, node2);
|
|
14488
14406
|
}
|
|
14489
|
-
|
|
14490
|
-
|
|
14491
|
-
}
|
|
14492
|
-
|
|
14493
|
-
|
|
14494
|
-
|
|
14495
|
-
|
|
14496
|
-
|
|
14497
|
-
|
|
14498
|
-
|
|
14499
|
-
|
|
14500
|
-
|
|
14501
|
-
|
|
14502
|
-
|
|
14503
|
-
|
|
14504
|
-
|
|
14505
|
-
|
|
14506
|
-
|
|
14507
|
-
|
|
14508
|
-
|
|
14509
|
-
if (listRowRefs && "current" in listRowRefs && Array.isArray(listRowRefs.current) && index2 !== void 0) {
|
|
14510
|
-
listRowRefs.current[index2] = el2;
|
|
14407
|
+
if (node2.isConnected) {
|
|
14408
|
+
this.resizeItem(index2, this.options.measureElement(node2, entry, this));
|
|
14409
|
+
}
|
|
14410
|
+
};
|
|
14411
|
+
this.resizeItem = (index2, size2) => {
|
|
14412
|
+
const item2 = this.measurementsCache[index2];
|
|
14413
|
+
if (!item2) {
|
|
14414
|
+
return;
|
|
14415
|
+
}
|
|
14416
|
+
const itemSize = this.itemSizeCache.get(item2.key) ?? item2.size;
|
|
14417
|
+
const delta = size2 - itemSize;
|
|
14418
|
+
if (delta !== 0) {
|
|
14419
|
+
if (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(item2, delta, this) : item2.start < this.getScrollOffset() + this.scrollAdjustments) {
|
|
14420
|
+
if (process.env.NODE_ENV !== "production" && this.options.debug) {
|
|
14421
|
+
console.info("correction", delta);
|
|
14422
|
+
}
|
|
14423
|
+
this._scrollToOffset(this.getScrollOffset(), {
|
|
14424
|
+
adjustments: this.scrollAdjustments += delta,
|
|
14425
|
+
behavior: void 0
|
|
14426
|
+
});
|
|
14511
14427
|
}
|
|
14512
|
-
|
|
14513
|
-
|
|
14514
|
-
|
|
14515
|
-
|
|
14516
|
-
|
|
14517
|
-
|
|
14518
|
-
|
|
14519
|
-
|
|
14520
|
-
|
|
14521
|
-
|
|
14522
|
-
|
|
14428
|
+
this.pendingMeasuredCacheIndexes.push(item2.index);
|
|
14429
|
+
this.itemSizeCache = new Map(this.itemSizeCache.set(item2.key, size2));
|
|
14430
|
+
this.notify(false);
|
|
14431
|
+
}
|
|
14432
|
+
};
|
|
14433
|
+
this.measureElement = (node2) => {
|
|
14434
|
+
if (!node2) {
|
|
14435
|
+
this.elementsCache.forEach((cached, key2) => {
|
|
14436
|
+
if (!cached.isConnected) {
|
|
14437
|
+
this.observer.unobserve(cached);
|
|
14438
|
+
this.elementsCache.delete(key2);
|
|
14439
|
+
}
|
|
14440
|
+
});
|
|
14441
|
+
return;
|
|
14442
|
+
}
|
|
14443
|
+
this._measureElement(node2, void 0);
|
|
14444
|
+
};
|
|
14445
|
+
this.getVirtualItems = memo(
|
|
14446
|
+
() => [this.getIndexes(), this.getMeasurements()],
|
|
14447
|
+
(indexes, measurements) => {
|
|
14448
|
+
const virtualItems = [];
|
|
14449
|
+
for (let k2 = 0, len = indexes.length; k2 < len; k2++) {
|
|
14450
|
+
const i = indexes[k2];
|
|
14451
|
+
const measurement = measurements[i];
|
|
14452
|
+
virtualItems.push(measurement);
|
|
14523
14453
|
}
|
|
14454
|
+
return virtualItems;
|
|
14524
14455
|
},
|
|
14525
|
-
|
|
14526
|
-
|
|
14527
|
-
|
|
14528
|
-
|
|
14529
|
-
|
|
14530
|
-
|
|
14531
|
-
|
|
14532
|
-
|
|
14533
|
-
|
|
14534
|
-
|
|
14535
|
-
|
|
14536
|
-
|
|
14537
|
-
|
|
14538
|
-
|
|
14539
|
-
|
|
14540
|
-
|
|
14541
|
-
|
|
14542
|
-
(a2) => {
|
|
14543
|
-
var _a2;
|
|
14544
|
-
return a2.label && ((_a2 = String(a2.label)) == null ? void 0 : _a2.toLowerCase()) === "edit";
|
|
14545
|
-
}
|
|
14456
|
+
{
|
|
14457
|
+
key: process.env.NODE_ENV !== "production" && "getVirtualItems",
|
|
14458
|
+
debug: () => this.options.debug
|
|
14459
|
+
}
|
|
14460
|
+
);
|
|
14461
|
+
this.getVirtualItemForOffset = (offset) => {
|
|
14462
|
+
const measurements = this.getMeasurements();
|
|
14463
|
+
if (measurements.length === 0) {
|
|
14464
|
+
return void 0;
|
|
14465
|
+
}
|
|
14466
|
+
return notUndefined(
|
|
14467
|
+
measurements[findNearestBinarySearch(
|
|
14468
|
+
0,
|
|
14469
|
+
measurements.length - 1,
|
|
14470
|
+
(index2) => notUndefined(measurements[index2]).start,
|
|
14471
|
+
offset
|
|
14472
|
+
)]
|
|
14546
14473
|
);
|
|
14547
|
-
|
|
14548
|
-
|
|
14549
|
-
const
|
|
14550
|
-
|
|
14551
|
-
|
|
14552
|
-
{
|
|
14553
|
-
|
|
14554
|
-
|
|
14555
|
-
|
|
14556
|
-
|
|
14557
|
-
|
|
14558
|
-
|
|
14559
|
-
|
|
14560
|
-
|
|
14561
|
-
|
|
14562
|
-
|
|
14563
|
-
|
|
14564
|
-
|
|
14565
|
-
|
|
14566
|
-
|
|
14567
|
-
|
|
14568
|
-
|
|
14569
|
-
|
|
14570
|
-
|
|
14571
|
-
|
|
14572
|
-
|
|
14573
|
-
|
|
14574
|
-
|
|
14575
|
-
|
|
14576
|
-
|
|
14577
|
-
|
|
14578
|
-
|
|
14579
|
-
|
|
14580
|
-
|
|
14581
|
-
|
|
14582
|
-
|
|
14583
|
-
|
|
14584
|
-
|
|
14585
|
-
|
|
14586
|
-
|
|
14587
|
-
|
|
14588
|
-
|
|
14589
|
-
|
|
14590
|
-
|
|
14591
|
-
|
|
14592
|
-
|
|
14593
|
-
|
|
14594
|
-
|
|
14595
|
-
|
|
14474
|
+
};
|
|
14475
|
+
this.getOffsetForAlignment = (toOffset, align) => {
|
|
14476
|
+
const size2 = this.getSize();
|
|
14477
|
+
const scrollOffset = this.getScrollOffset();
|
|
14478
|
+
if (align === "auto") {
|
|
14479
|
+
if (toOffset <= scrollOffset) {
|
|
14480
|
+
align = "start";
|
|
14481
|
+
} else if (toOffset >= scrollOffset + size2) {
|
|
14482
|
+
align = "end";
|
|
14483
|
+
} else {
|
|
14484
|
+
align = "start";
|
|
14485
|
+
}
|
|
14486
|
+
}
|
|
14487
|
+
if (align === "start") {
|
|
14488
|
+
toOffset = toOffset;
|
|
14489
|
+
} else if (align === "end") {
|
|
14490
|
+
toOffset = toOffset - size2;
|
|
14491
|
+
} else if (align === "center") {
|
|
14492
|
+
toOffset = toOffset - size2 / 2;
|
|
14493
|
+
}
|
|
14494
|
+
const scrollSizeProp = this.options.horizontal ? "scrollWidth" : "scrollHeight";
|
|
14495
|
+
const scrollSize = this.scrollElement ? "document" in this.scrollElement ? this.scrollElement.document.documentElement[scrollSizeProp] : this.scrollElement[scrollSizeProp] : 0;
|
|
14496
|
+
const maxOffset = scrollSize - size2;
|
|
14497
|
+
return Math.max(Math.min(maxOffset, toOffset), 0);
|
|
14498
|
+
};
|
|
14499
|
+
this.getOffsetForIndex = (index2, align = "auto") => {
|
|
14500
|
+
index2 = Math.max(0, Math.min(index2, this.options.count - 1));
|
|
14501
|
+
const item2 = this.measurementsCache[index2];
|
|
14502
|
+
if (!item2) {
|
|
14503
|
+
return void 0;
|
|
14504
|
+
}
|
|
14505
|
+
const size2 = this.getSize();
|
|
14506
|
+
const scrollOffset = this.getScrollOffset();
|
|
14507
|
+
if (align === "auto") {
|
|
14508
|
+
if (item2.end >= scrollOffset + size2 - this.options.scrollPaddingEnd) {
|
|
14509
|
+
align = "end";
|
|
14510
|
+
} else if (item2.start <= scrollOffset + this.options.scrollPaddingStart) {
|
|
14511
|
+
align = "start";
|
|
14512
|
+
} else {
|
|
14513
|
+
return [scrollOffset, align];
|
|
14514
|
+
}
|
|
14515
|
+
}
|
|
14516
|
+
const toOffset = align === "end" ? item2.end + this.options.scrollPaddingEnd : item2.start - this.options.scrollPaddingStart;
|
|
14517
|
+
return [this.getOffsetForAlignment(toOffset, align), align];
|
|
14518
|
+
};
|
|
14519
|
+
this.isDynamicMode = () => this.elementsCache.size > 0;
|
|
14520
|
+
this.cancelScrollToIndex = () => {
|
|
14521
|
+
if (this.scrollToIndexTimeoutId !== null && this.targetWindow) {
|
|
14522
|
+
this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId);
|
|
14523
|
+
this.scrollToIndexTimeoutId = null;
|
|
14524
|
+
}
|
|
14525
|
+
};
|
|
14526
|
+
this.scrollToOffset = (toOffset, { align = "start", behavior } = {}) => {
|
|
14527
|
+
this.cancelScrollToIndex();
|
|
14528
|
+
if (behavior === "smooth" && this.isDynamicMode()) {
|
|
14529
|
+
console.warn(
|
|
14530
|
+
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
|
14531
|
+
);
|
|
14532
|
+
}
|
|
14533
|
+
this._scrollToOffset(this.getOffsetForAlignment(toOffset, align), {
|
|
14534
|
+
adjustments: void 0,
|
|
14535
|
+
behavior
|
|
14536
|
+
});
|
|
14537
|
+
};
|
|
14538
|
+
this.scrollToIndex = (index2, { align: initialAlign = "auto", behavior } = {}) => {
|
|
14539
|
+
index2 = Math.max(0, Math.min(index2, this.options.count - 1));
|
|
14540
|
+
this.cancelScrollToIndex();
|
|
14541
|
+
if (behavior === "smooth" && this.isDynamicMode()) {
|
|
14542
|
+
console.warn(
|
|
14543
|
+
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
|
14544
|
+
);
|
|
14545
|
+
}
|
|
14546
|
+
const offsetAndAlign = this.getOffsetForIndex(index2, initialAlign);
|
|
14547
|
+
if (!offsetAndAlign) return;
|
|
14548
|
+
const [offset, align] = offsetAndAlign;
|
|
14549
|
+
this._scrollToOffset(offset, { adjustments: void 0, behavior });
|
|
14550
|
+
if (behavior !== "smooth" && this.isDynamicMode() && this.targetWindow) {
|
|
14551
|
+
this.scrollToIndexTimeoutId = this.targetWindow.setTimeout(() => {
|
|
14552
|
+
this.scrollToIndexTimeoutId = null;
|
|
14553
|
+
const elementInDOM = this.elementsCache.has(
|
|
14554
|
+
this.options.getItemKey(index2)
|
|
14555
|
+
);
|
|
14556
|
+
if (elementInDOM) {
|
|
14557
|
+
const [latestOffset] = notUndefined(
|
|
14558
|
+
this.getOffsetForIndex(index2, align)
|
|
14559
|
+
);
|
|
14560
|
+
if (!approxEqual(latestOffset, this.getScrollOffset())) {
|
|
14561
|
+
this.scrollToIndex(index2, { align, behavior });
|
|
14596
14562
|
}
|
|
14597
|
-
|
|
14598
|
-
|
|
14599
|
-
|
|
14600
|
-
|
|
14563
|
+
} else {
|
|
14564
|
+
this.scrollToIndex(index2, { align, behavior });
|
|
14565
|
+
}
|
|
14566
|
+
});
|
|
14567
|
+
}
|
|
14601
14568
|
};
|
|
14602
|
-
|
|
14603
|
-
|
|
14604
|
-
|
|
14605
|
-
|
|
14606
|
-
|
|
14607
|
-
|
|
14608
|
-
|
|
14609
|
-
|
|
14610
|
-
|
|
14611
|
-
|
|
14612
|
-
animateLayoutChanges: () => false
|
|
14569
|
+
this.scrollBy = (delta, { behavior } = {}) => {
|
|
14570
|
+
this.cancelScrollToIndex();
|
|
14571
|
+
if (behavior === "smooth" && this.isDynamicMode()) {
|
|
14572
|
+
console.warn(
|
|
14573
|
+
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
|
14574
|
+
);
|
|
14575
|
+
}
|
|
14576
|
+
this._scrollToOffset(this.getScrollOffset() + delta, {
|
|
14577
|
+
adjustments: void 0,
|
|
14578
|
+
behavior
|
|
14613
14579
|
});
|
|
14614
|
-
const style = {
|
|
14615
|
-
transform: CSS.Translate.toString(transform),
|
|
14616
|
-
transition,
|
|
14617
|
-
opacity: isDragging ? 0 : 1
|
|
14618
|
-
};
|
|
14619
|
-
return listElement(index22, item22, style, attributes, listeners, setNodeRef);
|
|
14620
14580
|
};
|
|
14621
|
-
|
|
14622
|
-
|
|
14581
|
+
this.getTotalSize = () => {
|
|
14582
|
+
var _a2;
|
|
14583
|
+
const measurements = this.getMeasurements();
|
|
14584
|
+
let end;
|
|
14585
|
+
if (measurements.length === 0) {
|
|
14586
|
+
end = this.options.paddingStart;
|
|
14587
|
+
} else {
|
|
14588
|
+
end = this.options.lanes === 1 ? ((_a2 = measurements[measurements.length - 1]) == null ? void 0 : _a2.end) ?? 0 : Math.max(
|
|
14589
|
+
...measurements.slice(-this.options.lanes).map((m2) => m2.end)
|
|
14590
|
+
);
|
|
14591
|
+
}
|
|
14592
|
+
return Math.max(
|
|
14593
|
+
end - this.options.scrollMargin + this.options.paddingEnd,
|
|
14594
|
+
0
|
|
14595
|
+
);
|
|
14596
|
+
};
|
|
14597
|
+
this._scrollToOffset = (offset, {
|
|
14598
|
+
adjustments,
|
|
14599
|
+
behavior
|
|
14600
|
+
}) => {
|
|
14601
|
+
this.options.scrollToFn(offset, { behavior, adjustments }, this);
|
|
14602
|
+
};
|
|
14603
|
+
this.measure = () => {
|
|
14604
|
+
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
14605
|
+
this.notify(false);
|
|
14606
|
+
};
|
|
14607
|
+
this.setOptions(opts);
|
|
14623
14608
|
}
|
|
14624
|
-
|
|
14625
|
-
const
|
|
14626
|
-
|
|
14627
|
-
|
|
14628
|
-
|
|
14629
|
-
|
|
14630
|
-
|
|
14631
|
-
|
|
14632
|
-
|
|
14633
|
-
|
|
14609
|
+
}
|
|
14610
|
+
const findNearestBinarySearch = (low, high, getCurrentValue, value) => {
|
|
14611
|
+
while (low <= high) {
|
|
14612
|
+
const middle = (low + high) / 2 | 0;
|
|
14613
|
+
const currentValue = getCurrentValue(middle);
|
|
14614
|
+
if (currentValue < value) {
|
|
14615
|
+
low = middle + 1;
|
|
14616
|
+
} else if (currentValue > value) {
|
|
14617
|
+
high = middle - 1;
|
|
14618
|
+
} else {
|
|
14619
|
+
return middle;
|
|
14620
|
+
}
|
|
14634
14621
|
}
|
|
14635
|
-
|
|
14636
|
-
|
|
14622
|
+
if (low > 0) {
|
|
14623
|
+
return low - 1;
|
|
14624
|
+
} else {
|
|
14625
|
+
return 0;
|
|
14626
|
+
}
|
|
14627
|
+
};
|
|
14628
|
+
function calculateRange({
|
|
14629
|
+
measurements,
|
|
14630
|
+
outerSize,
|
|
14631
|
+
scrollOffset
|
|
14632
|
+
}) {
|
|
14633
|
+
const count = measurements.length - 1;
|
|
14634
|
+
const getOffset2 = (index2) => measurements[index2].start;
|
|
14635
|
+
const startIndex = findNearestBinarySearch(0, count, getOffset2, scrollOffset);
|
|
14636
|
+
let endIndex = startIndex;
|
|
14637
|
+
while (endIndex < count && measurements[endIndex].end < scrollOffset + outerSize) {
|
|
14638
|
+
endIndex++;
|
|
14639
|
+
}
|
|
14640
|
+
return { startIndex, endIndex };
|
|
14641
|
+
}
|
|
14642
|
+
const useIsomorphicLayoutEffect$4 = typeof document !== "undefined" ? React$4.useLayoutEffect : React$4.useEffect;
|
|
14643
|
+
function useVirtualizerBase(options) {
|
|
14644
|
+
const rerender = React$4.useReducer(() => ({}), {})[1];
|
|
14645
|
+
const resolvedOptions = {
|
|
14646
|
+
...options,
|
|
14647
|
+
onChange: (instance2, sync2) => {
|
|
14648
|
+
var _a2;
|
|
14649
|
+
if (sync2) {
|
|
14650
|
+
flushSync$1(rerender);
|
|
14651
|
+
} else {
|
|
14652
|
+
rerender();
|
|
14653
|
+
}
|
|
14654
|
+
(_a2 = options.onChange) == null ? void 0 : _a2.call(options, instance2, sync2);
|
|
14655
|
+
}
|
|
14637
14656
|
};
|
|
14638
|
-
const
|
|
14639
|
-
|
|
14640
|
-
|
|
14641
|
-
|
|
14642
|
-
|
|
14643
|
-
|
|
14644
|
-
|
|
14645
|
-
|
|
14646
|
-
|
|
14657
|
+
const [instance] = React$4.useState(
|
|
14658
|
+
() => new Virtualizer(resolvedOptions)
|
|
14659
|
+
);
|
|
14660
|
+
instance.setOptions(resolvedOptions);
|
|
14661
|
+
React$4.useEffect(() => {
|
|
14662
|
+
return instance._didMount();
|
|
14663
|
+
}, []);
|
|
14664
|
+
useIsomorphicLayoutEffect$4(() => {
|
|
14665
|
+
return instance._willUpdate();
|
|
14666
|
+
});
|
|
14667
|
+
return instance;
|
|
14668
|
+
}
|
|
14669
|
+
function useVirtualizer(options) {
|
|
14670
|
+
return useVirtualizerBase({
|
|
14671
|
+
observeElementRect,
|
|
14672
|
+
observeElementOffset,
|
|
14673
|
+
scrollToFn: elementScroll,
|
|
14674
|
+
...options
|
|
14675
|
+
});
|
|
14676
|
+
}
|
|
14677
|
+
const ListScrollWrapper = ({
|
|
14678
|
+
items,
|
|
14679
|
+
scrollDetails,
|
|
14680
|
+
children
|
|
14681
|
+
}) => {
|
|
14682
|
+
const { hideScrollbar: hideScrollbar2, triggerScrollToActiveItem } = scrollDetails;
|
|
14683
|
+
const listContainerRef = useRef(null);
|
|
14684
|
+
const estimateItemHeight = () => {
|
|
14685
|
+
let height2 = 37;
|
|
14686
|
+
if (items.length > 0) {
|
|
14687
|
+
const item2 = items[items.length - 1];
|
|
14688
|
+
if (item2.details) height2 += 20;
|
|
14689
|
+
if (item2.metadata) height2 += 20;
|
|
14690
|
+
}
|
|
14691
|
+
return height2;
|
|
14692
|
+
};
|
|
14693
|
+
const virtualizer = useVirtualizer({
|
|
14694
|
+
count: items.length,
|
|
14695
|
+
getScrollElement: () => listContainerRef.current,
|
|
14696
|
+
estimateSize: useCallback(estimateItemHeight, []),
|
|
14697
|
+
overscan: 5
|
|
14698
|
+
});
|
|
14699
|
+
const findFirstActiveItemIndex = (items2) => items2.findIndex((item2) => item2.active === true);
|
|
14700
|
+
const setScrollToActiveItem = (activeItemIndex) => {
|
|
14701
|
+
if (activeItemIndex >= 0) {
|
|
14702
|
+
virtualizer.scrollToIndex(activeItemIndex, {
|
|
14703
|
+
align: "center",
|
|
14704
|
+
behavior: "smooth"
|
|
14647
14705
|
});
|
|
14648
14706
|
}
|
|
14649
14707
|
};
|
|
14650
|
-
|
|
14651
|
-
|
|
14652
|
-
|
|
14653
|
-
|
|
14654
|
-
|
|
14655
|
-
|
|
14708
|
+
useEffect(() => {
|
|
14709
|
+
if (triggerScrollToActiveItem) {
|
|
14710
|
+
const activeItemIndex = findFirstActiveItemIndex(items);
|
|
14711
|
+
setScrollToActiveItem(activeItemIndex);
|
|
14712
|
+
}
|
|
14713
|
+
}, [triggerScrollToActiveItem]);
|
|
14714
|
+
return /* @__PURE__ */ jsx(
|
|
14715
|
+
"div",
|
|
14656
14716
|
{
|
|
14657
|
-
|
|
14658
|
-
|
|
14659
|
-
|
|
14660
|
-
|
|
14661
|
-
|
|
14662
|
-
|
|
14663
|
-
|
|
14664
|
-
|
|
14665
|
-
|
|
14666
|
-
|
|
14667
|
-
|
|
14668
|
-
|
|
14669
|
-
|
|
14670
|
-
) }) }),
|
|
14671
|
-
document.body
|
|
14672
|
-
)
|
|
14673
|
-
]
|
|
14717
|
+
className: cx$2(
|
|
14718
|
+
listStyles.listContent,
|
|
14719
|
+
hideScrollbar2 ? listStyles.hideScrollbar : ""
|
|
14720
|
+
),
|
|
14721
|
+
ref: listContainerRef,
|
|
14722
|
+
children: /* @__PURE__ */ jsx(
|
|
14723
|
+
"div",
|
|
14724
|
+
{
|
|
14725
|
+
className: listStyles.virtualRows,
|
|
14726
|
+
style: { height: `${virtualizer.getTotalSize()}px` },
|
|
14727
|
+
children: children({ virtualizer })
|
|
14728
|
+
}
|
|
14729
|
+
)
|
|
14674
14730
|
}
|
|
14675
14731
|
);
|
|
14676
14732
|
};
|
|
@@ -14696,38 +14752,6 @@ const List = ({
|
|
|
14696
14752
|
triggerScrollToActiveItem: false
|
|
14697
14753
|
}
|
|
14698
14754
|
}) => {
|
|
14699
|
-
const { hideScrollbar: hideScrollbar2, triggerScrollToActiveItem } = scrollDetails;
|
|
14700
|
-
const listContainerRef = useRef(null);
|
|
14701
|
-
const estimateItemHeight = () => {
|
|
14702
|
-
let height22 = 37;
|
|
14703
|
-
if (list2.items.length > 0) {
|
|
14704
|
-
const item2 = list2.items[list2.items.length - 1];
|
|
14705
|
-
if (item2.details) height22 += 20;
|
|
14706
|
-
if (item2.metadata) height22 += 20;
|
|
14707
|
-
}
|
|
14708
|
-
return height22;
|
|
14709
|
-
};
|
|
14710
|
-
const virtualizer = useVirtualizer({
|
|
14711
|
-
count: list2.items.length,
|
|
14712
|
-
getScrollElement: () => listContainerRef.current,
|
|
14713
|
-
estimateSize: useCallback(estimateItemHeight, []),
|
|
14714
|
-
overscan: 5
|
|
14715
|
-
});
|
|
14716
|
-
const findFirstActiveItemIndex = (items) => items.findIndex((item2) => item2.active === true);
|
|
14717
|
-
const setScrollToActiveItem = (activeItemIndex) => {
|
|
14718
|
-
if (activeItemIndex >= 0) {
|
|
14719
|
-
virtualizer.scrollToIndex(activeItemIndex, {
|
|
14720
|
-
align: "center",
|
|
14721
|
-
behavior: "smooth"
|
|
14722
|
-
});
|
|
14723
|
-
}
|
|
14724
|
-
};
|
|
14725
|
-
useEffect(() => {
|
|
14726
|
-
if (triggerScrollToActiveItem) {
|
|
14727
|
-
const activeItemIndex = findFirstActiveItemIndex(list2 == null ? void 0 : list2.items);
|
|
14728
|
-
setScrollToActiveItem(activeItemIndex);
|
|
14729
|
-
}
|
|
14730
|
-
}, [triggerScrollToActiveItem]);
|
|
14731
14755
|
return /* @__PURE__ */ jsxs(
|
|
14732
14756
|
"div",
|
|
14733
14757
|
{
|
|
@@ -14756,45 +14780,28 @@ const List = ({
|
|
|
14756
14780
|
draggable,
|
|
14757
14781
|
list: list2,
|
|
14758
14782
|
onListReorder,
|
|
14759
|
-
children: /* @__PURE__ */ jsx(
|
|
14783
|
+
children: /* @__PURE__ */ jsx(ListScrollWrapper, { items: list2.items, scrollDetails, children: ({ virtualizer }) => virtualizer.getVirtualItems().map((virtualRow2) => /* @__PURE__ */ jsx(
|
|
14760
14784
|
"div",
|
|
14761
14785
|
{
|
|
14762
|
-
|
|
14763
|
-
|
|
14764
|
-
|
|
14765
|
-
|
|
14766
|
-
|
|
14786
|
+
"data-index": virtualRow2.index,
|
|
14787
|
+
className: listStyles.virtualRow,
|
|
14788
|
+
style: {
|
|
14789
|
+
transform: `translateY(${virtualRow2.start}px)`
|
|
14790
|
+
},
|
|
14791
|
+
ref: virtualizer.measureElement,
|
|
14767
14792
|
children: /* @__PURE__ */ jsx(
|
|
14768
|
-
|
|
14793
|
+
ListRow,
|
|
14769
14794
|
{
|
|
14770
|
-
|
|
14771
|
-
|
|
14772
|
-
|
|
14773
|
-
|
|
14774
|
-
|
|
14775
|
-
"data-index": virtualRow2.index,
|
|
14776
|
-
className: listStyles.virtualRow,
|
|
14777
|
-
style: {
|
|
14778
|
-
transform: `translateY(${virtualRow2.start}px)`
|
|
14779
|
-
},
|
|
14780
|
-
ref: virtualizer.measureElement,
|
|
14781
|
-
children: /* @__PURE__ */ jsx(
|
|
14782
|
-
ListRow,
|
|
14783
|
-
{
|
|
14784
|
-
index: virtualRow2.index,
|
|
14785
|
-
draggable,
|
|
14786
|
-
item: list2.items[virtualRow2.index],
|
|
14787
|
-
expanding,
|
|
14788
|
-
invokeEditOnRowClick
|
|
14789
|
-
}
|
|
14790
|
-
)
|
|
14791
|
-
},
|
|
14792
|
-
virtualRow2.key
|
|
14793
|
-
))
|
|
14795
|
+
index: virtualRow2.index,
|
|
14796
|
+
draggable,
|
|
14797
|
+
item: list2.items[virtualRow2.index],
|
|
14798
|
+
expanding,
|
|
14799
|
+
invokeEditOnRowClick
|
|
14794
14800
|
}
|
|
14795
14801
|
)
|
|
14796
|
-
}
|
|
14797
|
-
|
|
14802
|
+
},
|
|
14803
|
+
virtualRow2.key
|
|
14804
|
+
)) })
|
|
14798
14805
|
}
|
|
14799
14806
|
)
|
|
14800
14807
|
]
|