@oliasoft-open-source/react-ui-library 4.18.0-beta-11 → 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/global.css +67 -66
- package/dist/index.js +2177 -2170
- 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,2046 +9501,1290 @@ 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
|
-
|
|
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
|
|
9587
|
+
};
|
|
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;
|
|
9593
|
+
};
|
|
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
|
+
]
|
|
9619
|
+
}
|
|
9620
|
+
);
|
|
9621
|
+
}
|
|
9622
|
+
);
|
|
9623
|
+
function useCombinedRefs() {
|
|
9624
|
+
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
9625
|
+
refs[_key] = arguments[_key];
|
|
9626
|
+
}
|
|
9627
|
+
return useMemo(
|
|
9628
|
+
() => (node2) => {
|
|
9629
|
+
refs.forEach((ref) => ref(node2));
|
|
9630
|
+
},
|
|
9631
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
9632
|
+
refs
|
|
9633
|
+
);
|
|
9546
9634
|
}
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
|
|
9550
|
-
|
|
9551
|
-
|
|
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;
|
|
9552
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;
|
|
9553
9656
|
}
|
|
9554
|
-
|
|
9555
|
-
const
|
|
9556
|
-
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
|
|
9560
|
-
|
|
9561
|
-
|
|
9562
|
-
|
|
9563
|
-
const defaultRangeExtractor = (range2) => {
|
|
9564
|
-
const start = Math.max(range2.startIndex - range2.overscan, 0);
|
|
9565
|
-
const end = Math.min(range2.endIndex + range2.overscan, range2.count - 1);
|
|
9566
|
-
const arr = [];
|
|
9567
|
-
for (let i = start; i <= end; i++) {
|
|
9568
|
-
arr.push(i);
|
|
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;
|
|
9569
9666
|
}
|
|
9570
|
-
return
|
|
9571
|
-
}
|
|
9572
|
-
|
|
9573
|
-
|
|
9574
|
-
|
|
9575
|
-
|
|
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;
|
|
9576
9675
|
}
|
|
9577
|
-
|
|
9578
|
-
|
|
9579
|
-
return;
|
|
9676
|
+
if (isWindow(target)) {
|
|
9677
|
+
return target.document;
|
|
9580
9678
|
}
|
|
9581
|
-
|
|
9582
|
-
|
|
9583
|
-
cb2({ width: Math.round(width2), height: Math.round(height2) });
|
|
9584
|
-
};
|
|
9585
|
-
handler(element.getBoundingClientRect());
|
|
9586
|
-
if (!targetWindow.ResizeObserver) {
|
|
9587
|
-
return () => {
|
|
9588
|
-
};
|
|
9679
|
+
if (!isNode(target)) {
|
|
9680
|
+
return document;
|
|
9589
9681
|
}
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
if (entry == null ? void 0 : entry.borderBoxSize) {
|
|
9593
|
-
const box = entry.borderBoxSize[0];
|
|
9594
|
-
if (box) {
|
|
9595
|
-
handler({ width: box.inlineSize, height: box.blockSize });
|
|
9596
|
-
return;
|
|
9597
|
-
}
|
|
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;
|
|
9682
|
+
if (isDocument(target)) {
|
|
9683
|
+
return target;
|
|
9614
9684
|
}
|
|
9615
|
-
|
|
9616
|
-
|
|
9617
|
-
return;
|
|
9685
|
+
if (isHTMLElement(target) || isSVGElement(target)) {
|
|
9686
|
+
return target.ownerDocument;
|
|
9618
9687
|
}
|
|
9619
|
-
|
|
9620
|
-
|
|
9621
|
-
|
|
9622
|
-
|
|
9623
|
-
|
|
9624
|
-
|
|
9625
|
-
|
|
9626
|
-
);
|
|
9627
|
-
|
|
9628
|
-
|
|
9629
|
-
|
|
9630
|
-
|
|
9631
|
-
|
|
9632
|
-
};
|
|
9633
|
-
|
|
9634
|
-
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
|
|
9638
|
-
|
|
9639
|
-
|
|
9640
|
-
|
|
9641
|
-
|
|
9642
|
-
|
|
9643
|
-
const measureElement = (element, entry, instance) => {
|
|
9644
|
-
if (entry == null ? void 0 : entry.borderBoxSize) {
|
|
9645
|
-
const box = entry.borderBoxSize[0];
|
|
9646
|
-
if (box) {
|
|
9647
|
-
const size2 = Math.round(
|
|
9648
|
-
box[instance.options.horizontal ? "inlineSize" : "blockSize"]
|
|
9649
|
-
);
|
|
9650
|
-
return size2;
|
|
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
|
-
|
|
9697
|
-
|
|
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];
|
|
9698
9822
|
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
|
-
}
|
|
9823
|
+
x: x2,
|
|
9824
|
+
y: y2
|
|
9712
9825
|
};
|
|
9713
|
-
}
|
|
9714
|
-
|
|
9715
|
-
|
|
9716
|
-
|
|
9717
|
-
|
|
9718
|
-
|
|
9719
|
-
|
|
9720
|
-
|
|
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
|
|
9826
|
+
} else if (event.changedTouches && event.changedTouches.length) {
|
|
9827
|
+
const {
|
|
9828
|
+
clientX: x2,
|
|
9829
|
+
clientY: y2
|
|
9830
|
+
} = event.changedTouches[0];
|
|
9831
|
+
return {
|
|
9832
|
+
x: x2,
|
|
9833
|
+
y: y2
|
|
9744
9834
|
};
|
|
9835
|
+
}
|
|
9836
|
+
}
|
|
9837
|
+
if (hasViewportRelativeCoordinates(event)) {
|
|
9838
|
+
return {
|
|
9839
|
+
x: event.clientX,
|
|
9840
|
+
y: event.clientY
|
|
9745
9841
|
};
|
|
9746
|
-
|
|
9747
|
-
|
|
9748
|
-
|
|
9749
|
-
|
|
9750
|
-
|
|
9751
|
-
|
|
9752
|
-
|
|
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;
|
|
9838
|
-
};
|
|
9839
|
-
this.getFurthestMeasurement = (measurements, index2) => {
|
|
9840
|
-
const furthestMeasurementsFound = /* @__PURE__ */ new Map();
|
|
9841
|
-
const furthestMeasurements = /* @__PURE__ */ new Map();
|
|
9842
|
-
for (let m2 = index2 - 1; m2 >= 0; m2--) {
|
|
9843
|
-
const measurement = measurements[m2];
|
|
9844
|
-
if (furthestMeasurementsFound.has(measurement.lane)) {
|
|
9845
|
-
continue;
|
|
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
|
-
}
|
|
9858
|
-
}
|
|
9859
|
-
return furthestMeasurements.size === this.options.lanes ? Array.from(furthestMeasurements.values()).sort((a2, b2) => {
|
|
9860
|
-
if (a2.end === b2.end) {
|
|
9861
|
-
return a2.index - b2.index;
|
|
9862
|
-
}
|
|
9863
|
-
return a2.end - b2.end;
|
|
9864
|
-
})[0] : void 0;
|
|
9865
|
-
};
|
|
9866
|
-
this.getMeasurementOptions = memo(
|
|
9867
|
-
() => [
|
|
9868
|
-
this.options.count,
|
|
9869
|
-
this.options.paddingStart,
|
|
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
|
|
9886
|
-
}
|
|
9887
|
-
);
|
|
9888
|
-
this.getMeasurements = memo(
|
|
9889
|
-
() => [this.getMeasurementOptions(), this.itemSizeCache],
|
|
9890
|
-
({ count, paddingStart, scrollMargin, getItemKey, enabled }, itemSizeCache) => {
|
|
9891
|
-
if (!enabled) {
|
|
9892
|
-
this.measurementsCache = [];
|
|
9893
|
-
this.itemSizeCache.clear();
|
|
9894
|
-
return [];
|
|
9895
|
-
}
|
|
9896
|
-
if (this.measurementsCache.length === 0) {
|
|
9897
|
-
this.measurementsCache = this.options.initialMeasurementsCache;
|
|
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
|
|
9842
|
+
}
|
|
9843
|
+
return null;
|
|
9844
|
+
}
|
|
9845
|
+
const CSS = /* @__PURE__ */ Object.freeze({
|
|
9846
|
+
Translate: {
|
|
9847
|
+
toString(transform) {
|
|
9848
|
+
if (!transform) {
|
|
9849
|
+
return;
|
|
9962
9850
|
}
|
|
9963
|
-
|
|
9964
|
-
|
|
9965
|
-
|
|
9966
|
-
|
|
9967
|
-
|
|
9968
|
-
|
|
9969
|
-
|
|
9970
|
-
|
|
9971
|
-
|
|
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;
|
|
9972
9862
|
}
|
|
9973
|
-
|
|
9974
|
-
|
|
9975
|
-
|
|
9976
|
-
|
|
9977
|
-
|
|
9978
|
-
|
|
9863
|
+
const {
|
|
9864
|
+
scaleX,
|
|
9865
|
+
scaleY
|
|
9866
|
+
} = transform;
|
|
9867
|
+
return "scaleX(" + scaleX + ") scaleY(" + scaleY + ")";
|
|
9868
|
+
}
|
|
9869
|
+
},
|
|
9870
|
+
Transform: {
|
|
9871
|
+
toString(transform) {
|
|
9872
|
+
if (!transform) {
|
|
9979
9873
|
return;
|
|
9980
9874
|
}
|
|
9981
|
-
|
|
9982
|
-
|
|
9983
|
-
|
|
9984
|
-
|
|
9985
|
-
|
|
9986
|
-
|
|
9987
|
-
|
|
9988
|
-
|
|
9989
|
-
|
|
9990
|
-
|
|
9991
|
-
|
|
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;
|
|
9875
|
+
return [CSS.Translate.toString(transform), CSS.Scale.toString(transform)].join(" ");
|
|
9876
|
+
}
|
|
9877
|
+
},
|
|
9878
|
+
Transition: {
|
|
9879
|
+
toString(_ref) {
|
|
9880
|
+
let {
|
|
9881
|
+
property,
|
|
9882
|
+
duration,
|
|
9883
|
+
easing
|
|
9884
|
+
} = _ref;
|
|
9885
|
+
return property + " " + duration + "ms " + easing;
|
|
10203
9886
|
}
|
|
10204
9887
|
}
|
|
10205
|
-
|
|
10206
|
-
|
|
10207
|
-
|
|
10208
|
-
|
|
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++;
|
|
9888
|
+
});
|
|
9889
|
+
const SELECTOR = "a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";
|
|
9890
|
+
function findFirstFocusableNode(element) {
|
|
9891
|
+
if (element.matches(SELECTOR)) {
|
|
9892
|
+
return element;
|
|
10222
9893
|
}
|
|
10223
|
-
return
|
|
9894
|
+
return element.querySelector(SELECTOR);
|
|
10224
9895
|
}
|
|
10225
|
-
const
|
|
10226
|
-
|
|
10227
|
-
|
|
10228
|
-
|
|
10229
|
-
|
|
10230
|
-
|
|
10231
|
-
|
|
10232
|
-
|
|
10233
|
-
|
|
10234
|
-
|
|
10235
|
-
|
|
10236
|
-
|
|
10237
|
-
|
|
10238
|
-
|
|
9896
|
+
const hiddenStyles = {
|
|
9897
|
+
display: "none"
|
|
9898
|
+
};
|
|
9899
|
+
function HiddenText(_ref) {
|
|
9900
|
+
let {
|
|
9901
|
+
id: id2,
|
|
9902
|
+
value
|
|
9903
|
+
} = _ref;
|
|
9904
|
+
return React__default.createElement("div", {
|
|
9905
|
+
id: id2,
|
|
9906
|
+
style: hiddenStyles
|
|
9907
|
+
}, value);
|
|
9908
|
+
}
|
|
9909
|
+
function LiveRegion(_ref) {
|
|
9910
|
+
let {
|
|
9911
|
+
id: id2,
|
|
9912
|
+
announcement,
|
|
9913
|
+
ariaLiveType = "assertive"
|
|
9914
|
+
} = _ref;
|
|
9915
|
+
const visuallyHidden = {
|
|
9916
|
+
position: "fixed",
|
|
9917
|
+
width: 1,
|
|
9918
|
+
height: 1,
|
|
9919
|
+
margin: -1,
|
|
9920
|
+
border: 0,
|
|
9921
|
+
padding: 0,
|
|
9922
|
+
overflow: "hidden",
|
|
9923
|
+
clip: "rect(0 0 0 0)",
|
|
9924
|
+
clipPath: "inset(100%)",
|
|
9925
|
+
whiteSpace: "nowrap"
|
|
10239
9926
|
};
|
|
10240
|
-
|
|
10241
|
-
|
|
10242
|
-
|
|
10243
|
-
|
|
10244
|
-
|
|
10245
|
-
|
|
9927
|
+
return React__default.createElement("div", {
|
|
9928
|
+
id: id2,
|
|
9929
|
+
style: visuallyHidden,
|
|
9930
|
+
role: "status",
|
|
9931
|
+
"aria-live": ariaLiveType,
|
|
9932
|
+
"aria-atomic": true
|
|
9933
|
+
}, announcement);
|
|
9934
|
+
}
|
|
9935
|
+
function useAnnouncement() {
|
|
9936
|
+
const [announcement, setAnnouncement] = useState("");
|
|
9937
|
+
const announce = useCallback((value) => {
|
|
9938
|
+
if (value != null) {
|
|
9939
|
+
setAnnouncement(value);
|
|
9940
|
+
}
|
|
10246
9941
|
}, []);
|
|
10247
|
-
|
|
10248
|
-
|
|
10249
|
-
|
|
10250
|
-
|
|
9942
|
+
return {
|
|
9943
|
+
announce,
|
|
9944
|
+
announcement
|
|
9945
|
+
};
|
|
10251
9946
|
}
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10255
|
-
|
|
10256
|
-
|
|
10257
|
-
|
|
10258
|
-
|
|
9947
|
+
const DndMonitorContext = /* @__PURE__ */ createContext(null);
|
|
9948
|
+
function useDndMonitor(listener) {
|
|
9949
|
+
const registerListener = useContext(DndMonitorContext);
|
|
9950
|
+
useEffect(() => {
|
|
9951
|
+
if (!registerListener) {
|
|
9952
|
+
throw new Error("useDndMonitor must be used within a children of <DndContext>");
|
|
9953
|
+
}
|
|
9954
|
+
const unsubscribe = registerListener(listener);
|
|
9955
|
+
return unsubscribe;
|
|
9956
|
+
}, [listener, registerListener]);
|
|
10259
9957
|
}
|
|
10260
|
-
|
|
10261
|
-
const
|
|
10262
|
-
const
|
|
10263
|
-
|
|
10264
|
-
|
|
10265
|
-
|
|
10266
|
-
const
|
|
10267
|
-
|
|
10268
|
-
|
|
10269
|
-
|
|
10270
|
-
|
|
10271
|
-
|
|
10272
|
-
|
|
10273
|
-
|
|
10274
|
-
|
|
10275
|
-
|
|
10276
|
-
|
|
10277
|
-
|
|
10278
|
-
const
|
|
10279
|
-
|
|
10280
|
-
const bold = "_bold_snjei_121";
|
|
10281
|
-
const toggleNarrow = "_toggleNarrow_snjei_132";
|
|
10282
|
-
const drag$1 = "_drag_snjei_150";
|
|
10283
|
-
const dragOverlay$1 = "_dragOverlay_snjei_171";
|
|
10284
|
-
const listContent = "_listContent_snjei_176";
|
|
10285
|
-
const action = "_action_snjei_203";
|
|
10286
|
-
const active$3 = "_active_snjei_206";
|
|
10287
|
-
const indented = "_indented_snjei_213";
|
|
10288
|
-
const disabled$5 = "_disabled_snjei_226";
|
|
10289
|
-
const label$6 = "_label_snjei_237";
|
|
10290
|
-
const details$2 = "_details_snjei_248";
|
|
10291
|
-
const metadata = "_metadata_snjei_249";
|
|
10292
|
-
const itemContent = "_itemContent_snjei_257";
|
|
10293
|
-
const indentIcon = "_indentIcon_snjei_264";
|
|
10294
|
-
const expandIcon = "_expandIcon_snjei_269";
|
|
10295
|
-
const expanded = "_expanded_snjei_276";
|
|
10296
|
-
const right$4 = "_right_snjei_279";
|
|
10297
|
-
const actions = "_actions_snjei_287";
|
|
10298
|
-
const hideScrollbar = "_hideScrollbar_snjei_67";
|
|
10299
|
-
const noPointerEvents = "_noPointerEvents_snjei_302";
|
|
10300
|
-
const virtualRows = "_virtualRows_snjei_305";
|
|
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
|
|
9958
|
+
function useDndMonitorProvider() {
|
|
9959
|
+
const [listeners] = useState(() => /* @__PURE__ */ new Set());
|
|
9960
|
+
const registerListener = useCallback((listener) => {
|
|
9961
|
+
listeners.add(listener);
|
|
9962
|
+
return () => listeners.delete(listener);
|
|
9963
|
+
}, [listeners]);
|
|
9964
|
+
const dispatch = useCallback((_ref) => {
|
|
9965
|
+
let {
|
|
9966
|
+
type,
|
|
9967
|
+
event
|
|
9968
|
+
} = _ref;
|
|
9969
|
+
listeners.forEach((listener) => {
|
|
9970
|
+
var _listener$type;
|
|
9971
|
+
return (_listener$type = listener[type]) == null ? void 0 : _listener$type.call(listener, event);
|
|
9972
|
+
});
|
|
9973
|
+
}, [listeners]);
|
|
9974
|
+
return [dispatch, registerListener];
|
|
9975
|
+
}
|
|
9976
|
+
const defaultScreenReaderInstructions = {
|
|
9977
|
+
draggable: "\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "
|
|
10343
9978
|
};
|
|
10344
|
-
const
|
|
10345
|
-
|
|
10346
|
-
|
|
10347
|
-
|
|
10348
|
-
|
|
9979
|
+
const defaultAnnouncements = {
|
|
9980
|
+
onDragStart(_ref) {
|
|
9981
|
+
let {
|
|
9982
|
+
active: active2
|
|
9983
|
+
} = _ref;
|
|
9984
|
+
return "Picked up draggable item " + active2.id + ".";
|
|
9985
|
+
},
|
|
9986
|
+
onDragOver(_ref2) {
|
|
9987
|
+
let {
|
|
9988
|
+
active: active2,
|
|
9989
|
+
over
|
|
9990
|
+
} = _ref2;
|
|
9991
|
+
if (over) {
|
|
9992
|
+
return "Draggable item " + active2.id + " was moved over droppable area " + over.id + ".";
|
|
9993
|
+
}
|
|
9994
|
+
return "Draggable item " + active2.id + " is no longer over a droppable area.";
|
|
9995
|
+
},
|
|
9996
|
+
onDragEnd(_ref3) {
|
|
9997
|
+
let {
|
|
9998
|
+
active: active2,
|
|
9999
|
+
over
|
|
10000
|
+
} = _ref3;
|
|
10001
|
+
if (over) {
|
|
10002
|
+
return "Draggable item " + active2.id + " was dropped over droppable area " + over.id;
|
|
10003
|
+
}
|
|
10004
|
+
return "Draggable item " + active2.id + " was dropped.";
|
|
10005
|
+
},
|
|
10006
|
+
onDragCancel(_ref4) {
|
|
10007
|
+
let {
|
|
10008
|
+
active: active2
|
|
10009
|
+
} = _ref4;
|
|
10010
|
+
return "Dragging was cancelled. Draggable item " + active2.id + " was dropped.";
|
|
10011
|
+
}
|
|
10349
10012
|
};
|
|
10350
|
-
|
|
10351
|
-
|
|
10352
|
-
|
|
10353
|
-
|
|
10354
|
-
|
|
10355
|
-
|
|
10013
|
+
function Accessibility(_ref) {
|
|
10014
|
+
let {
|
|
10015
|
+
announcements = defaultAnnouncements,
|
|
10016
|
+
container: container2,
|
|
10017
|
+
hiddenTextDescribedById,
|
|
10018
|
+
screenReaderInstructions = defaultScreenReaderInstructions
|
|
10019
|
+
} = _ref;
|
|
10020
|
+
const {
|
|
10021
|
+
announce,
|
|
10022
|
+
announcement
|
|
10023
|
+
} = useAnnouncement();
|
|
10024
|
+
const liveRegionId = useUniqueId("DndLiveRegion");
|
|
10025
|
+
const [mounted, setMounted] = useState(false);
|
|
10026
|
+
useEffect(() => {
|
|
10027
|
+
setMounted(true);
|
|
10028
|
+
}, []);
|
|
10029
|
+
useDndMonitor(useMemo(() => ({
|
|
10030
|
+
onDragStart(_ref2) {
|
|
10031
|
+
let {
|
|
10032
|
+
active: active2
|
|
10033
|
+
} = _ref2;
|
|
10034
|
+
announce(announcements.onDragStart({
|
|
10035
|
+
active: active2
|
|
10036
|
+
}));
|
|
10356
10037
|
},
|
|
10357
|
-
|
|
10358
|
-
|
|
10359
|
-
|
|
10360
|
-
|
|
10361
|
-
|
|
10362
|
-
|
|
10363
|
-
|
|
10364
|
-
|
|
10365
|
-
|
|
10366
|
-
|
|
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
|
-
]
|
|
10038
|
+
onDragMove(_ref3) {
|
|
10039
|
+
let {
|
|
10040
|
+
active: active2,
|
|
10041
|
+
over
|
|
10042
|
+
} = _ref3;
|
|
10043
|
+
if (announcements.onDragMove) {
|
|
10044
|
+
announce(announcements.onDragMove({
|
|
10045
|
+
active: active2,
|
|
10046
|
+
over
|
|
10047
|
+
}));
|
|
10375
10048
|
}
|
|
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
10049
|
},
|
|
10387
|
-
|
|
10388
|
-
|
|
10389
|
-
|
|
10050
|
+
onDragOver(_ref4) {
|
|
10051
|
+
let {
|
|
10052
|
+
active: active2,
|
|
10053
|
+
over
|
|
10054
|
+
} = _ref4;
|
|
10055
|
+
announce(announcements.onDragOver({
|
|
10056
|
+
active: active2,
|
|
10057
|
+
over
|
|
10058
|
+
}));
|
|
10059
|
+
},
|
|
10060
|
+
onDragEnd(_ref5) {
|
|
10061
|
+
let {
|
|
10062
|
+
active: active2,
|
|
10063
|
+
over
|
|
10064
|
+
} = _ref5;
|
|
10065
|
+
announce(announcements.onDragEnd({
|
|
10066
|
+
active: active2,
|
|
10067
|
+
over
|
|
10068
|
+
}));
|
|
10069
|
+
},
|
|
10070
|
+
onDragCancel(_ref6) {
|
|
10071
|
+
let {
|
|
10072
|
+
active: active2,
|
|
10073
|
+
over
|
|
10074
|
+
} = _ref6;
|
|
10075
|
+
announce(announcements.onDragCancel({
|
|
10076
|
+
active: active2,
|
|
10077
|
+
over
|
|
10078
|
+
}));
|
|
10079
|
+
}
|
|
10080
|
+
}), [announce, announcements]));
|
|
10081
|
+
if (!mounted) {
|
|
10082
|
+
return null;
|
|
10083
|
+
}
|
|
10084
|
+
const markup = React__default.createElement(React__default.Fragment, null, React__default.createElement(HiddenText, {
|
|
10085
|
+
id: hiddenTextDescribedById,
|
|
10086
|
+
value: screenReaderInstructions.draggable
|
|
10087
|
+
}), React__default.createElement(LiveRegion, {
|
|
10088
|
+
id: liveRegionId,
|
|
10089
|
+
announcement
|
|
10090
|
+
}));
|
|
10091
|
+
return container2 ? createPortal(markup, container2) : markup;
|
|
10390
10092
|
}
|
|
10391
|
-
|
|
10392
|
-
function
|
|
10393
|
-
|
|
10394
|
-
|
|
10395
|
-
|
|
10093
|
+
var Action;
|
|
10094
|
+
(function(Action2) {
|
|
10095
|
+
Action2["DragStart"] = "dragStart";
|
|
10096
|
+
Action2["DragMove"] = "dragMove";
|
|
10097
|
+
Action2["DragEnd"] = "dragEnd";
|
|
10098
|
+
Action2["DragCancel"] = "dragCancel";
|
|
10099
|
+
Action2["DragOver"] = "dragOver";
|
|
10100
|
+
Action2["RegisterDroppable"] = "registerDroppable";
|
|
10101
|
+
Action2["SetDroppableDisabled"] = "setDroppableDisabled";
|
|
10102
|
+
Action2["UnregisterDroppable"] = "unregisterDroppable";
|
|
10103
|
+
})(Action || (Action = {}));
|
|
10104
|
+
function noop$1() {
|
|
10396
10105
|
}
|
|
10397
|
-
|
|
10398
|
-
|
|
10106
|
+
const defaultCoordinates = /* @__PURE__ */ Object.freeze({
|
|
10107
|
+
x: 0,
|
|
10108
|
+
y: 0
|
|
10109
|
+
});
|
|
10110
|
+
function distanceBetween(p1, p2) {
|
|
10111
|
+
return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));
|
|
10399
10112
|
}
|
|
10400
|
-
function
|
|
10401
|
-
|
|
10402
|
-
if (!
|
|
10403
|
-
return
|
|
10404
|
-
}
|
|
10405
|
-
if (isWindow(target)) {
|
|
10406
|
-
return target;
|
|
10407
|
-
}
|
|
10408
|
-
if (!isNode(target)) {
|
|
10409
|
-
return window;
|
|
10113
|
+
function getRelativeTransformOrigin(event, rect) {
|
|
10114
|
+
const eventCoordinates = getEventCoordinates(event);
|
|
10115
|
+
if (!eventCoordinates) {
|
|
10116
|
+
return "0 0";
|
|
10410
10117
|
}
|
|
10411
|
-
|
|
10412
|
-
|
|
10413
|
-
|
|
10414
|
-
|
|
10415
|
-
|
|
10416
|
-
} = getWindow(node2);
|
|
10417
|
-
return node2 instanceof Document;
|
|
10118
|
+
const transformOrigin = {
|
|
10119
|
+
x: (eventCoordinates.x - rect.left) / rect.width * 100,
|
|
10120
|
+
y: (eventCoordinates.y - rect.top) / rect.height * 100
|
|
10121
|
+
};
|
|
10122
|
+
return transformOrigin.x + "% " + transformOrigin.y + "%";
|
|
10418
10123
|
}
|
|
10419
|
-
function
|
|
10420
|
-
|
|
10421
|
-
|
|
10422
|
-
|
|
10423
|
-
|
|
10124
|
+
function sortCollisionsAsc(_ref, _ref2) {
|
|
10125
|
+
let {
|
|
10126
|
+
data: {
|
|
10127
|
+
value: a2
|
|
10128
|
+
}
|
|
10129
|
+
} = _ref;
|
|
10130
|
+
let {
|
|
10131
|
+
data: {
|
|
10132
|
+
value: b2
|
|
10133
|
+
}
|
|
10134
|
+
} = _ref2;
|
|
10135
|
+
return a2 - b2;
|
|
10424
10136
|
}
|
|
10425
|
-
function
|
|
10426
|
-
|
|
10137
|
+
function sortCollisionsDesc(_ref3, _ref4) {
|
|
10138
|
+
let {
|
|
10139
|
+
data: {
|
|
10140
|
+
value: a2
|
|
10141
|
+
}
|
|
10142
|
+
} = _ref3;
|
|
10143
|
+
let {
|
|
10144
|
+
data: {
|
|
10145
|
+
value: b2
|
|
10146
|
+
}
|
|
10147
|
+
} = _ref4;
|
|
10148
|
+
return b2 - a2;
|
|
10427
10149
|
}
|
|
10428
|
-
function
|
|
10429
|
-
if (!
|
|
10430
|
-
return
|
|
10431
|
-
}
|
|
10432
|
-
if (isWindow(target)) {
|
|
10433
|
-
return target.document;
|
|
10434
|
-
}
|
|
10435
|
-
if (!isNode(target)) {
|
|
10436
|
-
return document;
|
|
10150
|
+
function getFirstCollision(collisions, property) {
|
|
10151
|
+
if (!collisions || collisions.length === 0) {
|
|
10152
|
+
return null;
|
|
10437
10153
|
}
|
|
10438
|
-
|
|
10439
|
-
|
|
10154
|
+
const [firstCollision] = collisions;
|
|
10155
|
+
return firstCollision[property];
|
|
10156
|
+
}
|
|
10157
|
+
function centerOfRectangle(rect, left2, top2) {
|
|
10158
|
+
if (left2 === void 0) {
|
|
10159
|
+
left2 = rect.left;
|
|
10440
10160
|
}
|
|
10441
|
-
if (
|
|
10442
|
-
|
|
10161
|
+
if (top2 === void 0) {
|
|
10162
|
+
top2 = rect.top;
|
|
10443
10163
|
}
|
|
10444
|
-
return
|
|
10164
|
+
return {
|
|
10165
|
+
x: left2 + rect.width * 0.5,
|
|
10166
|
+
y: top2 + rect.height * 0.5
|
|
10167
|
+
};
|
|
10445
10168
|
}
|
|
10446
|
-
const
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
}
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
|
|
10169
|
+
const closestCenter = (_ref) => {
|
|
10170
|
+
let {
|
|
10171
|
+
collisionRect,
|
|
10172
|
+
droppableRects,
|
|
10173
|
+
droppableContainers
|
|
10174
|
+
} = _ref;
|
|
10175
|
+
const centerRect = centerOfRectangle(collisionRect, collisionRect.left, collisionRect.top);
|
|
10176
|
+
const collisions = [];
|
|
10177
|
+
for (const droppableContainer of droppableContainers) {
|
|
10178
|
+
const {
|
|
10179
|
+
id: id2
|
|
10180
|
+
} = droppableContainer;
|
|
10181
|
+
const rect = droppableRects.get(id2);
|
|
10182
|
+
if (rect) {
|
|
10183
|
+
const distBetween = distanceBetween(centerOfRectangle(rect), centerRect);
|
|
10184
|
+
collisions.push({
|
|
10185
|
+
id: id2,
|
|
10186
|
+
data: {
|
|
10187
|
+
droppableContainer,
|
|
10188
|
+
value: distBetween
|
|
10189
|
+
}
|
|
10190
|
+
});
|
|
10455
10191
|
}
|
|
10456
|
-
|
|
10457
|
-
|
|
10192
|
+
}
|
|
10193
|
+
return collisions.sort(sortCollisionsAsc);
|
|
10194
|
+
};
|
|
10195
|
+
function getIntersectionRatio(entry, target) {
|
|
10196
|
+
const top2 = Math.max(target.top, entry.top);
|
|
10197
|
+
const left2 = Math.max(target.left, entry.left);
|
|
10198
|
+
const right2 = Math.min(target.left + target.width, entry.left + entry.width);
|
|
10199
|
+
const bottom2 = Math.min(target.top + target.height, entry.top + entry.height);
|
|
10200
|
+
const width2 = right2 - left2;
|
|
10201
|
+
const height2 = bottom2 - top2;
|
|
10202
|
+
if (left2 < right2 && top2 < bottom2) {
|
|
10203
|
+
const targetArea = target.width * target.height;
|
|
10204
|
+
const entryArea = entry.width * entry.height;
|
|
10205
|
+
const intersectionArea = width2 * height2;
|
|
10206
|
+
const intersectionRatio = intersectionArea / (targetArea + entryArea - intersectionArea);
|
|
10207
|
+
return Number(intersectionRatio.toFixed(4));
|
|
10208
|
+
}
|
|
10209
|
+
return 0;
|
|
10458
10210
|
}
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
|
|
10464
|
-
|
|
10465
|
-
|
|
10466
|
-
|
|
10467
|
-
|
|
10211
|
+
const rectIntersection = (_ref) => {
|
|
10212
|
+
let {
|
|
10213
|
+
collisionRect,
|
|
10214
|
+
droppableRects,
|
|
10215
|
+
droppableContainers
|
|
10216
|
+
} = _ref;
|
|
10217
|
+
const collisions = [];
|
|
10218
|
+
for (const droppableContainer of droppableContainers) {
|
|
10219
|
+
const {
|
|
10220
|
+
id: id2
|
|
10221
|
+
} = droppableContainer;
|
|
10222
|
+
const rect = droppableRects.get(id2);
|
|
10223
|
+
if (rect) {
|
|
10224
|
+
const intersectionRatio = getIntersectionRatio(rect, collisionRect);
|
|
10225
|
+
if (intersectionRatio > 0) {
|
|
10226
|
+
collisions.push({
|
|
10227
|
+
id: id2,
|
|
10228
|
+
data: {
|
|
10229
|
+
droppableContainer,
|
|
10230
|
+
value: intersectionRatio
|
|
10231
|
+
}
|
|
10232
|
+
});
|
|
10233
|
+
}
|
|
10468
10234
|
}
|
|
10469
|
-
}, []);
|
|
10470
|
-
return [set2, clear];
|
|
10471
|
-
}
|
|
10472
|
-
function useLatestValue(value, dependencies) {
|
|
10473
|
-
if (dependencies === void 0) {
|
|
10474
|
-
dependencies = [value];
|
|
10475
10235
|
}
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
|
-
|
|
10236
|
+
return collisions.sort(sortCollisionsDesc);
|
|
10237
|
+
};
|
|
10238
|
+
function adjustScale(transform, rect1, rect2) {
|
|
10239
|
+
return {
|
|
10240
|
+
...transform,
|
|
10241
|
+
scaleX: rect1 && rect2 ? rect1.width / rect2.width : 1,
|
|
10242
|
+
scaleY: rect1 && rect2 ? rect1.height / rect2.height : 1
|
|
10243
|
+
};
|
|
10483
10244
|
}
|
|
10484
|
-
function
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
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]);
|
|
10245
|
+
function getRectDelta(rect1, rect2) {
|
|
10246
|
+
return rect1 && rect2 ? {
|
|
10247
|
+
x: rect1.left - rect2.left,
|
|
10248
|
+
y: rect1.top - rect2.top
|
|
10249
|
+
} : defaultCoordinates;
|
|
10528
10250
|
}
|
|
10529
|
-
function
|
|
10530
|
-
return function(
|
|
10251
|
+
function createRectAdjustmentFn(modifier) {
|
|
10252
|
+
return function adjustClientRect(rect) {
|
|
10531
10253
|
for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
10532
10254
|
adjustments[_key - 1] = arguments[_key];
|
|
10533
10255
|
}
|
|
10534
|
-
return adjustments.reduce((
|
|
10535
|
-
|
|
10536
|
-
|
|
10537
|
-
|
|
10538
|
-
|
|
10539
|
-
|
|
10540
|
-
|
|
10541
|
-
|
|
10542
|
-
return accumulator;
|
|
10543
|
-
}, {
|
|
10544
|
-
...object2
|
|
10256
|
+
return adjustments.reduce((acc, adjustment) => ({
|
|
10257
|
+
...acc,
|
|
10258
|
+
top: acc.top + modifier * adjustment.y,
|
|
10259
|
+
bottom: acc.bottom + modifier * adjustment.y,
|
|
10260
|
+
left: acc.left + modifier * adjustment.x,
|
|
10261
|
+
right: acc.right + modifier * adjustment.x
|
|
10262
|
+
}), {
|
|
10263
|
+
...rect
|
|
10545
10264
|
});
|
|
10546
10265
|
};
|
|
10547
10266
|
}
|
|
10548
|
-
const
|
|
10549
|
-
|
|
10550
|
-
|
|
10551
|
-
|
|
10267
|
+
const getAdjustedRect = /* @__PURE__ */ createRectAdjustmentFn(1);
|
|
10268
|
+
function parseTransform(transform) {
|
|
10269
|
+
if (transform.startsWith("matrix3d(")) {
|
|
10270
|
+
const transformArray = transform.slice(9, -1).split(/, /);
|
|
10271
|
+
return {
|
|
10272
|
+
x: +transformArray[12],
|
|
10273
|
+
y: +transformArray[13],
|
|
10274
|
+
scaleX: +transformArray[0],
|
|
10275
|
+
scaleY: +transformArray[5]
|
|
10276
|
+
};
|
|
10277
|
+
} else if (transform.startsWith("matrix(")) {
|
|
10278
|
+
const transformArray = transform.slice(7, -1).split(/, /);
|
|
10279
|
+
return {
|
|
10280
|
+
x: +transformArray[4],
|
|
10281
|
+
y: +transformArray[5],
|
|
10282
|
+
scaleX: +transformArray[0],
|
|
10283
|
+
scaleY: +transformArray[3]
|
|
10284
|
+
};
|
|
10285
|
+
}
|
|
10286
|
+
return null;
|
|
10552
10287
|
}
|
|
10553
|
-
function
|
|
10554
|
-
|
|
10555
|
-
|
|
10288
|
+
function inverseTransform(rect, transform, transformOrigin) {
|
|
10289
|
+
const parsedTransform = parseTransform(transform);
|
|
10290
|
+
if (!parsedTransform) {
|
|
10291
|
+
return rect;
|
|
10556
10292
|
}
|
|
10557
10293
|
const {
|
|
10558
|
-
|
|
10559
|
-
|
|
10560
|
-
|
|
10294
|
+
scaleX,
|
|
10295
|
+
scaleY,
|
|
10296
|
+
x: translateX,
|
|
10297
|
+
y: translateY
|
|
10298
|
+
} = parsedTransform;
|
|
10299
|
+
const x2 = rect.left - translateX - (1 - scaleX) * parseFloat(transformOrigin);
|
|
10300
|
+
const y2 = rect.top - translateY - (1 - scaleY) * parseFloat(transformOrigin.slice(transformOrigin.indexOf(" ") + 1));
|
|
10301
|
+
const w2 = scaleX ? rect.width / scaleX : rect.width;
|
|
10302
|
+
const h = scaleY ? rect.height / scaleY : rect.height;
|
|
10303
|
+
return {
|
|
10304
|
+
width: w2,
|
|
10305
|
+
height: h,
|
|
10306
|
+
top: y2,
|
|
10307
|
+
right: x2 + w2,
|
|
10308
|
+
bottom: y2 + h,
|
|
10309
|
+
left: x2
|
|
10310
|
+
};
|
|
10561
10311
|
}
|
|
10562
|
-
|
|
10563
|
-
|
|
10564
|
-
|
|
10312
|
+
const defaultOptions$2 = {
|
|
10313
|
+
ignoreTransform: false
|
|
10314
|
+
};
|
|
10315
|
+
function getClientRect(element, options) {
|
|
10316
|
+
if (options === void 0) {
|
|
10317
|
+
options = defaultOptions$2;
|
|
10318
|
+
}
|
|
10319
|
+
let rect = element.getBoundingClientRect();
|
|
10320
|
+
if (options.ignoreTransform) {
|
|
10321
|
+
const {
|
|
10322
|
+
transform,
|
|
10323
|
+
transformOrigin
|
|
10324
|
+
} = getWindow(element).getComputedStyle(element);
|
|
10325
|
+
if (transform) {
|
|
10326
|
+
rect = inverseTransform(rect, transform, transformOrigin);
|
|
10327
|
+
}
|
|
10565
10328
|
}
|
|
10566
10329
|
const {
|
|
10567
|
-
|
|
10568
|
-
|
|
10569
|
-
|
|
10330
|
+
top: top2,
|
|
10331
|
+
left: left2,
|
|
10332
|
+
width: width2,
|
|
10333
|
+
height: height2,
|
|
10334
|
+
bottom: bottom2,
|
|
10335
|
+
right: right2
|
|
10336
|
+
} = rect;
|
|
10337
|
+
return {
|
|
10338
|
+
top: top2,
|
|
10339
|
+
left: left2,
|
|
10340
|
+
width: width2,
|
|
10341
|
+
height: height2,
|
|
10342
|
+
bottom: bottom2,
|
|
10343
|
+
right: right2
|
|
10344
|
+
};
|
|
10570
10345
|
}
|
|
10571
|
-
function
|
|
10572
|
-
|
|
10573
|
-
|
|
10574
|
-
|
|
10575
|
-
|
|
10576
|
-
|
|
10577
|
-
|
|
10578
|
-
|
|
10579
|
-
|
|
10580
|
-
|
|
10581
|
-
|
|
10582
|
-
|
|
10583
|
-
|
|
10584
|
-
|
|
10585
|
-
|
|
10586
|
-
|
|
10587
|
-
|
|
10588
|
-
|
|
10589
|
-
|
|
10590
|
-
|
|
10591
|
-
}
|
|
10346
|
+
function getTransformAgnosticClientRect(element) {
|
|
10347
|
+
return getClientRect(element, {
|
|
10348
|
+
ignoreTransform: true
|
|
10349
|
+
});
|
|
10350
|
+
}
|
|
10351
|
+
function getWindowClientRect(element) {
|
|
10352
|
+
const width2 = element.innerWidth;
|
|
10353
|
+
const height2 = element.innerHeight;
|
|
10354
|
+
return {
|
|
10355
|
+
top: 0,
|
|
10356
|
+
left: 0,
|
|
10357
|
+
right: width2,
|
|
10358
|
+
bottom: height2,
|
|
10359
|
+
width: width2,
|
|
10360
|
+
height: height2
|
|
10361
|
+
};
|
|
10362
|
+
}
|
|
10363
|
+
function isFixed(node2, computedStyle) {
|
|
10364
|
+
if (computedStyle === void 0) {
|
|
10365
|
+
computedStyle = getWindow(node2).getComputedStyle(node2);
|
|
10592
10366
|
}
|
|
10593
|
-
|
|
10594
|
-
|
|
10595
|
-
|
|
10596
|
-
|
|
10597
|
-
|
|
10367
|
+
return computedStyle.position === "fixed";
|
|
10368
|
+
}
|
|
10369
|
+
function isScrollable(element, computedStyle) {
|
|
10370
|
+
if (computedStyle === void 0) {
|
|
10371
|
+
computedStyle = getWindow(element).getComputedStyle(element);
|
|
10598
10372
|
}
|
|
10599
|
-
|
|
10373
|
+
const overflowRegex = /(auto|scroll|overlay)/;
|
|
10374
|
+
const properties2 = ["overflow", "overflowX", "overflowY"];
|
|
10375
|
+
return properties2.some((property) => {
|
|
10376
|
+
const value = computedStyle[property];
|
|
10377
|
+
return typeof value === "string" ? overflowRegex.test(value) : false;
|
|
10378
|
+
});
|
|
10600
10379
|
}
|
|
10601
|
-
|
|
10602
|
-
|
|
10603
|
-
|
|
10604
|
-
|
|
10605
|
-
|
|
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 + ")";
|
|
10380
|
+
function getScrollableAncestors(element, limit2) {
|
|
10381
|
+
const scrollParents = [];
|
|
10382
|
+
function findScrollableAncestors(node2) {
|
|
10383
|
+
if (limit2 != null && scrollParents.length >= limit2) {
|
|
10384
|
+
return scrollParents;
|
|
10624
10385
|
}
|
|
10625
|
-
|
|
10626
|
-
|
|
10627
|
-
toString(transform) {
|
|
10628
|
-
if (!transform) {
|
|
10629
|
-
return;
|
|
10630
|
-
}
|
|
10631
|
-
return [CSS.Translate.toString(transform), CSS.Scale.toString(transform)].join(" ");
|
|
10386
|
+
if (!node2) {
|
|
10387
|
+
return scrollParents;
|
|
10632
10388
|
}
|
|
10633
|
-
|
|
10634
|
-
|
|
10635
|
-
|
|
10636
|
-
|
|
10637
|
-
|
|
10638
|
-
|
|
10639
|
-
|
|
10640
|
-
|
|
10641
|
-
return
|
|
10389
|
+
if (isDocument(node2) && node2.scrollingElement != null && !scrollParents.includes(node2.scrollingElement)) {
|
|
10390
|
+
scrollParents.push(node2.scrollingElement);
|
|
10391
|
+
return scrollParents;
|
|
10392
|
+
}
|
|
10393
|
+
if (!isHTMLElement(node2) || isSVGElement(node2)) {
|
|
10394
|
+
return scrollParents;
|
|
10395
|
+
}
|
|
10396
|
+
if (scrollParents.includes(node2)) {
|
|
10397
|
+
return scrollParents;
|
|
10398
|
+
}
|
|
10399
|
+
const computedStyle = getWindow(element).getComputedStyle(node2);
|
|
10400
|
+
if (node2 !== element) {
|
|
10401
|
+
if (isScrollable(node2, computedStyle)) {
|
|
10402
|
+
scrollParents.push(node2);
|
|
10403
|
+
}
|
|
10404
|
+
}
|
|
10405
|
+
if (isFixed(node2, computedStyle)) {
|
|
10406
|
+
return scrollParents;
|
|
10642
10407
|
}
|
|
10408
|
+
return findScrollableAncestors(node2.parentNode);
|
|
10643
10409
|
}
|
|
10644
|
-
|
|
10645
|
-
|
|
10646
|
-
|
|
10647
|
-
|
|
10410
|
+
if (!element) {
|
|
10411
|
+
return scrollParents;
|
|
10412
|
+
}
|
|
10413
|
+
return findScrollableAncestors(element);
|
|
10414
|
+
}
|
|
10415
|
+
function getFirstScrollableAncestor(node2) {
|
|
10416
|
+
const [firstScrollableAncestor] = getScrollableAncestors(node2, 1);
|
|
10417
|
+
return firstScrollableAncestor != null ? firstScrollableAncestor : null;
|
|
10418
|
+
}
|
|
10419
|
+
function getScrollableElement(element) {
|
|
10420
|
+
if (!canUseDOM || !element) {
|
|
10421
|
+
return null;
|
|
10422
|
+
}
|
|
10423
|
+
if (isWindow(element)) {
|
|
10648
10424
|
return element;
|
|
10649
10425
|
}
|
|
10650
|
-
|
|
10426
|
+
if (!isNode(element)) {
|
|
10427
|
+
return null;
|
|
10428
|
+
}
|
|
10429
|
+
if (isDocument(element) || element === getOwnerDocument(element).scrollingElement) {
|
|
10430
|
+
return window;
|
|
10431
|
+
}
|
|
10432
|
+
if (isHTMLElement(element)) {
|
|
10433
|
+
return element;
|
|
10434
|
+
}
|
|
10435
|
+
return null;
|
|
10651
10436
|
}
|
|
10652
|
-
|
|
10653
|
-
|
|
10654
|
-
|
|
10655
|
-
|
|
10656
|
-
|
|
10657
|
-
id: id2,
|
|
10658
|
-
value
|
|
10659
|
-
} = _ref;
|
|
10660
|
-
return React__default.createElement("div", {
|
|
10661
|
-
id: id2,
|
|
10662
|
-
style: hiddenStyles
|
|
10663
|
-
}, value);
|
|
10437
|
+
function getScrollXCoordinate(element) {
|
|
10438
|
+
if (isWindow(element)) {
|
|
10439
|
+
return element.scrollX;
|
|
10440
|
+
}
|
|
10441
|
+
return element.scrollLeft;
|
|
10664
10442
|
}
|
|
10665
|
-
function
|
|
10666
|
-
|
|
10667
|
-
|
|
10668
|
-
|
|
10669
|
-
|
|
10670
|
-
} = _ref;
|
|
10671
|
-
const visuallyHidden = {
|
|
10672
|
-
position: "fixed",
|
|
10673
|
-
width: 1,
|
|
10674
|
-
height: 1,
|
|
10675
|
-
margin: -1,
|
|
10676
|
-
border: 0,
|
|
10677
|
-
padding: 0,
|
|
10678
|
-
overflow: "hidden",
|
|
10679
|
-
clip: "rect(0 0 0 0)",
|
|
10680
|
-
clipPath: "inset(100%)",
|
|
10681
|
-
whiteSpace: "nowrap"
|
|
10682
|
-
};
|
|
10683
|
-
return React__default.createElement("div", {
|
|
10684
|
-
id: id2,
|
|
10685
|
-
style: visuallyHidden,
|
|
10686
|
-
role: "status",
|
|
10687
|
-
"aria-live": ariaLiveType,
|
|
10688
|
-
"aria-atomic": true
|
|
10689
|
-
}, announcement);
|
|
10443
|
+
function getScrollYCoordinate(element) {
|
|
10444
|
+
if (isWindow(element)) {
|
|
10445
|
+
return element.scrollY;
|
|
10446
|
+
}
|
|
10447
|
+
return element.scrollTop;
|
|
10690
10448
|
}
|
|
10691
|
-
function
|
|
10692
|
-
const [announcement, setAnnouncement] = useState("");
|
|
10693
|
-
const announce = useCallback((value) => {
|
|
10694
|
-
if (value != null) {
|
|
10695
|
-
setAnnouncement(value);
|
|
10696
|
-
}
|
|
10697
|
-
}, []);
|
|
10449
|
+
function getScrollCoordinates(element) {
|
|
10698
10450
|
return {
|
|
10699
|
-
|
|
10700
|
-
|
|
10451
|
+
x: getScrollXCoordinate(element),
|
|
10452
|
+
y: getScrollYCoordinate(element)
|
|
10701
10453
|
};
|
|
10702
10454
|
}
|
|
10703
|
-
|
|
10704
|
-
function
|
|
10705
|
-
|
|
10706
|
-
|
|
10707
|
-
|
|
10708
|
-
|
|
10709
|
-
|
|
10710
|
-
|
|
10711
|
-
|
|
10712
|
-
|
|
10455
|
+
var Direction;
|
|
10456
|
+
(function(Direction2) {
|
|
10457
|
+
Direction2[Direction2["Forward"] = 1] = "Forward";
|
|
10458
|
+
Direction2[Direction2["Backward"] = -1] = "Backward";
|
|
10459
|
+
})(Direction || (Direction = {}));
|
|
10460
|
+
function isDocumentScrollingElement(element) {
|
|
10461
|
+
if (!canUseDOM || !element) {
|
|
10462
|
+
return false;
|
|
10463
|
+
}
|
|
10464
|
+
return element === document.scrollingElement;
|
|
10713
10465
|
}
|
|
10714
|
-
function
|
|
10715
|
-
const
|
|
10716
|
-
|
|
10717
|
-
|
|
10718
|
-
|
|
10719
|
-
|
|
10720
|
-
|
|
10721
|
-
|
|
10722
|
-
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
|
-
|
|
10728
|
-
|
|
10729
|
-
}
|
|
10730
|
-
|
|
10466
|
+
function getScrollPosition(scrollingContainer) {
|
|
10467
|
+
const minScroll = {
|
|
10468
|
+
x: 0,
|
|
10469
|
+
y: 0
|
|
10470
|
+
};
|
|
10471
|
+
const dimensions = isDocumentScrollingElement(scrollingContainer) ? {
|
|
10472
|
+
height: window.innerHeight,
|
|
10473
|
+
width: window.innerWidth
|
|
10474
|
+
} : {
|
|
10475
|
+
height: scrollingContainer.clientHeight,
|
|
10476
|
+
width: scrollingContainer.clientWidth
|
|
10477
|
+
};
|
|
10478
|
+
const maxScroll = {
|
|
10479
|
+
x: scrollingContainer.scrollWidth - dimensions.width,
|
|
10480
|
+
y: scrollingContainer.scrollHeight - dimensions.height
|
|
10481
|
+
};
|
|
10482
|
+
const isTop = scrollingContainer.scrollTop <= minScroll.y;
|
|
10483
|
+
const isLeft = scrollingContainer.scrollLeft <= minScroll.x;
|
|
10484
|
+
const isBottom = scrollingContainer.scrollTop >= maxScroll.y;
|
|
10485
|
+
const isRight = scrollingContainer.scrollLeft >= maxScroll.x;
|
|
10486
|
+
return {
|
|
10487
|
+
isTop,
|
|
10488
|
+
isLeft,
|
|
10489
|
+
isBottom,
|
|
10490
|
+
isRight,
|
|
10491
|
+
maxScroll,
|
|
10492
|
+
minScroll
|
|
10493
|
+
};
|
|
10731
10494
|
}
|
|
10732
|
-
const
|
|
10733
|
-
|
|
10734
|
-
|
|
10735
|
-
const defaultAnnouncements = {
|
|
10736
|
-
onDragStart(_ref) {
|
|
10737
|
-
let {
|
|
10738
|
-
active: active2
|
|
10739
|
-
} = _ref;
|
|
10740
|
-
return "Picked up draggable item " + active2.id + ".";
|
|
10741
|
-
},
|
|
10742
|
-
onDragOver(_ref2) {
|
|
10743
|
-
let {
|
|
10744
|
-
active: active2,
|
|
10745
|
-
over
|
|
10746
|
-
} = _ref2;
|
|
10747
|
-
if (over) {
|
|
10748
|
-
return "Draggable item " + active2.id + " was moved over droppable area " + over.id + ".";
|
|
10749
|
-
}
|
|
10750
|
-
return "Draggable item " + active2.id + " is no longer over a droppable area.";
|
|
10751
|
-
},
|
|
10752
|
-
onDragEnd(_ref3) {
|
|
10753
|
-
let {
|
|
10754
|
-
active: active2,
|
|
10755
|
-
over
|
|
10756
|
-
} = _ref3;
|
|
10757
|
-
if (over) {
|
|
10758
|
-
return "Draggable item " + active2.id + " was dropped over droppable area " + over.id;
|
|
10759
|
-
}
|
|
10760
|
-
return "Draggable item " + active2.id + " was dropped.";
|
|
10761
|
-
},
|
|
10762
|
-
onDragCancel(_ref4) {
|
|
10763
|
-
let {
|
|
10764
|
-
active: active2
|
|
10765
|
-
} = _ref4;
|
|
10766
|
-
return "Dragging was cancelled. Draggable item " + active2.id + " was dropped.";
|
|
10767
|
-
}
|
|
10495
|
+
const defaultThreshold = {
|
|
10496
|
+
x: 0.2,
|
|
10497
|
+
y: 0.2
|
|
10768
10498
|
};
|
|
10769
|
-
function
|
|
10499
|
+
function getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, _ref, acceleration, thresholdPercentage) {
|
|
10770
10500
|
let {
|
|
10771
|
-
|
|
10772
|
-
|
|
10773
|
-
|
|
10774
|
-
|
|
10501
|
+
top: top2,
|
|
10502
|
+
left: left2,
|
|
10503
|
+
right: right2,
|
|
10504
|
+
bottom: bottom2
|
|
10775
10505
|
} = _ref;
|
|
10506
|
+
if (acceleration === void 0) {
|
|
10507
|
+
acceleration = 10;
|
|
10508
|
+
}
|
|
10509
|
+
if (thresholdPercentage === void 0) {
|
|
10510
|
+
thresholdPercentage = defaultThreshold;
|
|
10511
|
+
}
|
|
10776
10512
|
const {
|
|
10777
|
-
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
|
|
10782
|
-
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
|
|
10790
|
-
|
|
10791
|
-
|
|
10792
|
-
|
|
10793
|
-
|
|
10794
|
-
|
|
10795
|
-
|
|
10796
|
-
|
|
10797
|
-
|
|
10798
|
-
|
|
10799
|
-
|
|
10800
|
-
announce(announcements.onDragMove({
|
|
10801
|
-
active: active2,
|
|
10802
|
-
over
|
|
10803
|
-
}));
|
|
10804
|
-
}
|
|
10805
|
-
},
|
|
10806
|
-
onDragOver(_ref4) {
|
|
10807
|
-
let {
|
|
10808
|
-
active: active2,
|
|
10809
|
-
over
|
|
10810
|
-
} = _ref4;
|
|
10811
|
-
announce(announcements.onDragOver({
|
|
10812
|
-
active: active2,
|
|
10813
|
-
over
|
|
10814
|
-
}));
|
|
10815
|
-
},
|
|
10816
|
-
onDragEnd(_ref5) {
|
|
10817
|
-
let {
|
|
10818
|
-
active: active2,
|
|
10819
|
-
over
|
|
10820
|
-
} = _ref5;
|
|
10821
|
-
announce(announcements.onDragEnd({
|
|
10822
|
-
active: active2,
|
|
10823
|
-
over
|
|
10824
|
-
}));
|
|
10825
|
-
},
|
|
10826
|
-
onDragCancel(_ref6) {
|
|
10827
|
-
let {
|
|
10828
|
-
active: active2,
|
|
10829
|
-
over
|
|
10830
|
-
} = _ref6;
|
|
10831
|
-
announce(announcements.onDragCancel({
|
|
10832
|
-
active: active2,
|
|
10833
|
-
over
|
|
10834
|
-
}));
|
|
10835
|
-
}
|
|
10836
|
-
}), [announce, announcements]));
|
|
10837
|
-
if (!mounted) {
|
|
10838
|
-
return null;
|
|
10513
|
+
isTop,
|
|
10514
|
+
isBottom,
|
|
10515
|
+
isLeft,
|
|
10516
|
+
isRight
|
|
10517
|
+
} = getScrollPosition(scrollContainer);
|
|
10518
|
+
const direction = {
|
|
10519
|
+
x: 0,
|
|
10520
|
+
y: 0
|
|
10521
|
+
};
|
|
10522
|
+
const speed = {
|
|
10523
|
+
x: 0,
|
|
10524
|
+
y: 0
|
|
10525
|
+
};
|
|
10526
|
+
const threshold = {
|
|
10527
|
+
height: scrollContainerRect.height * thresholdPercentage.y,
|
|
10528
|
+
width: scrollContainerRect.width * thresholdPercentage.x
|
|
10529
|
+
};
|
|
10530
|
+
if (!isTop && top2 <= scrollContainerRect.top + threshold.height) {
|
|
10531
|
+
direction.y = Direction.Backward;
|
|
10532
|
+
speed.y = acceleration * Math.abs((scrollContainerRect.top + threshold.height - top2) / threshold.height);
|
|
10533
|
+
} else if (!isBottom && bottom2 >= scrollContainerRect.bottom - threshold.height) {
|
|
10534
|
+
direction.y = Direction.Forward;
|
|
10535
|
+
speed.y = acceleration * Math.abs((scrollContainerRect.bottom - threshold.height - bottom2) / threshold.height);
|
|
10839
10536
|
}
|
|
10840
|
-
|
|
10841
|
-
|
|
10842
|
-
|
|
10843
|
-
}
|
|
10844
|
-
|
|
10845
|
-
|
|
10846
|
-
}
|
|
10847
|
-
return
|
|
10848
|
-
|
|
10849
|
-
|
|
10850
|
-
|
|
10851
|
-
Action2["DragStart"] = "dragStart";
|
|
10852
|
-
Action2["DragMove"] = "dragMove";
|
|
10853
|
-
Action2["DragEnd"] = "dragEnd";
|
|
10854
|
-
Action2["DragCancel"] = "dragCancel";
|
|
10855
|
-
Action2["DragOver"] = "dragOver";
|
|
10856
|
-
Action2["RegisterDroppable"] = "registerDroppable";
|
|
10857
|
-
Action2["SetDroppableDisabled"] = "setDroppableDisabled";
|
|
10858
|
-
Action2["UnregisterDroppable"] = "unregisterDroppable";
|
|
10859
|
-
})(Action || (Action = {}));
|
|
10860
|
-
function noop$1() {
|
|
10861
|
-
}
|
|
10862
|
-
const defaultCoordinates = /* @__PURE__ */ Object.freeze({
|
|
10863
|
-
x: 0,
|
|
10864
|
-
y: 0
|
|
10865
|
-
});
|
|
10866
|
-
function distanceBetween(p1, p2) {
|
|
10867
|
-
return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));
|
|
10537
|
+
if (!isRight && right2 >= scrollContainerRect.right - threshold.width) {
|
|
10538
|
+
direction.x = Direction.Forward;
|
|
10539
|
+
speed.x = acceleration * Math.abs((scrollContainerRect.right - threshold.width - right2) / threshold.width);
|
|
10540
|
+
} else if (!isLeft && left2 <= scrollContainerRect.left + threshold.width) {
|
|
10541
|
+
direction.x = Direction.Backward;
|
|
10542
|
+
speed.x = acceleration * Math.abs((scrollContainerRect.left + threshold.width - left2) / threshold.width);
|
|
10543
|
+
}
|
|
10544
|
+
return {
|
|
10545
|
+
direction,
|
|
10546
|
+
speed
|
|
10547
|
+
};
|
|
10868
10548
|
}
|
|
10869
|
-
function
|
|
10870
|
-
|
|
10871
|
-
|
|
10872
|
-
|
|
10549
|
+
function getScrollElementRect(element) {
|
|
10550
|
+
if (element === document.scrollingElement) {
|
|
10551
|
+
const {
|
|
10552
|
+
innerWidth: innerWidth2,
|
|
10553
|
+
innerHeight: innerHeight2
|
|
10554
|
+
} = window;
|
|
10555
|
+
return {
|
|
10556
|
+
top: 0,
|
|
10557
|
+
left: 0,
|
|
10558
|
+
right: innerWidth2,
|
|
10559
|
+
bottom: innerHeight2,
|
|
10560
|
+
width: innerWidth2,
|
|
10561
|
+
height: innerHeight2
|
|
10562
|
+
};
|
|
10873
10563
|
}
|
|
10874
|
-
const
|
|
10875
|
-
|
|
10876
|
-
|
|
10564
|
+
const {
|
|
10565
|
+
top: top2,
|
|
10566
|
+
left: left2,
|
|
10567
|
+
right: right2,
|
|
10568
|
+
bottom: bottom2
|
|
10569
|
+
} = element.getBoundingClientRect();
|
|
10570
|
+
return {
|
|
10571
|
+
top: top2,
|
|
10572
|
+
left: left2,
|
|
10573
|
+
right: right2,
|
|
10574
|
+
bottom: bottom2,
|
|
10575
|
+
width: element.clientWidth,
|
|
10576
|
+
height: element.clientHeight
|
|
10877
10577
|
};
|
|
10878
|
-
return transformOrigin.x + "% " + transformOrigin.y + "%";
|
|
10879
10578
|
}
|
|
10880
|
-
function
|
|
10881
|
-
|
|
10882
|
-
|
|
10883
|
-
|
|
10884
|
-
}
|
|
10885
|
-
} = _ref;
|
|
10886
|
-
let {
|
|
10887
|
-
data: {
|
|
10888
|
-
value: b2
|
|
10889
|
-
}
|
|
10890
|
-
} = _ref2;
|
|
10891
|
-
return a2 - b2;
|
|
10579
|
+
function getScrollOffsets(scrollableAncestors) {
|
|
10580
|
+
return scrollableAncestors.reduce((acc, node2) => {
|
|
10581
|
+
return add$1(acc, getScrollCoordinates(node2));
|
|
10582
|
+
}, defaultCoordinates);
|
|
10892
10583
|
}
|
|
10893
|
-
function
|
|
10894
|
-
|
|
10895
|
-
|
|
10896
|
-
|
|
10897
|
-
}
|
|
10898
|
-
} = _ref3;
|
|
10899
|
-
let {
|
|
10900
|
-
data: {
|
|
10901
|
-
value: b2
|
|
10902
|
-
}
|
|
10903
|
-
} = _ref4;
|
|
10904
|
-
return b2 - a2;
|
|
10584
|
+
function getScrollXOffset(scrollableAncestors) {
|
|
10585
|
+
return scrollableAncestors.reduce((acc, node2) => {
|
|
10586
|
+
return acc + getScrollXCoordinate(node2);
|
|
10587
|
+
}, 0);
|
|
10905
10588
|
}
|
|
10906
|
-
function
|
|
10907
|
-
|
|
10908
|
-
return
|
|
10909
|
-
}
|
|
10910
|
-
const [firstCollision] = collisions;
|
|
10911
|
-
return firstCollision[property];
|
|
10589
|
+
function getScrollYOffset(scrollableAncestors) {
|
|
10590
|
+
return scrollableAncestors.reduce((acc, node2) => {
|
|
10591
|
+
return acc + getScrollYCoordinate(node2);
|
|
10592
|
+
}, 0);
|
|
10912
10593
|
}
|
|
10913
|
-
function
|
|
10914
|
-
if (
|
|
10915
|
-
|
|
10594
|
+
function scrollIntoViewIfNeeded(element, measure) {
|
|
10595
|
+
if (measure === void 0) {
|
|
10596
|
+
measure = getClientRect;
|
|
10916
10597
|
}
|
|
10917
|
-
if (
|
|
10918
|
-
|
|
10598
|
+
if (!element) {
|
|
10599
|
+
return;
|
|
10919
10600
|
}
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
|
|
10925
|
-
|
|
10926
|
-
|
|
10927
|
-
|
|
10928
|
-
|
|
10929
|
-
droppableContainers
|
|
10930
|
-
} = _ref;
|
|
10931
|
-
const centerRect = centerOfRectangle(collisionRect, collisionRect.left, collisionRect.top);
|
|
10932
|
-
const collisions = [];
|
|
10933
|
-
for (const droppableContainer of droppableContainers) {
|
|
10934
|
-
const {
|
|
10935
|
-
id: id2
|
|
10936
|
-
} = droppableContainer;
|
|
10937
|
-
const rect = droppableRects.get(id2);
|
|
10938
|
-
if (rect) {
|
|
10939
|
-
const distBetween = distanceBetween(centerOfRectangle(rect), centerRect);
|
|
10940
|
-
collisions.push({
|
|
10941
|
-
id: id2,
|
|
10942
|
-
data: {
|
|
10943
|
-
droppableContainer,
|
|
10944
|
-
value: distBetween
|
|
10945
|
-
}
|
|
10946
|
-
});
|
|
10947
|
-
}
|
|
10601
|
+
const {
|
|
10602
|
+
top: top2,
|
|
10603
|
+
left: left2,
|
|
10604
|
+
bottom: bottom2,
|
|
10605
|
+
right: right2
|
|
10606
|
+
} = measure(element);
|
|
10607
|
+
const firstScrollableAncestor = getFirstScrollableAncestor(element);
|
|
10608
|
+
if (!firstScrollableAncestor) {
|
|
10609
|
+
return;
|
|
10948
10610
|
}
|
|
10949
|
-
|
|
10950
|
-
|
|
10951
|
-
|
|
10952
|
-
|
|
10953
|
-
|
|
10954
|
-
const right2 = Math.min(target.left + target.width, entry.left + entry.width);
|
|
10955
|
-
const bottom2 = Math.min(target.top + target.height, entry.top + entry.height);
|
|
10956
|
-
const width2 = right2 - left2;
|
|
10957
|
-
const height2 = bottom2 - top2;
|
|
10958
|
-
if (left2 < right2 && top2 < bottom2) {
|
|
10959
|
-
const targetArea = target.width * target.height;
|
|
10960
|
-
const entryArea = entry.width * entry.height;
|
|
10961
|
-
const intersectionArea = width2 * height2;
|
|
10962
|
-
const intersectionRatio = intersectionArea / (targetArea + entryArea - intersectionArea);
|
|
10963
|
-
return Number(intersectionRatio.toFixed(4));
|
|
10611
|
+
if (bottom2 <= 0 || right2 <= 0 || top2 >= window.innerHeight || left2 >= window.innerWidth) {
|
|
10612
|
+
element.scrollIntoView({
|
|
10613
|
+
block: "center",
|
|
10614
|
+
inline: "center"
|
|
10615
|
+
});
|
|
10964
10616
|
}
|
|
10965
|
-
return 0;
|
|
10966
10617
|
}
|
|
10967
|
-
const
|
|
10968
|
-
|
|
10969
|
-
|
|
10970
|
-
|
|
10971
|
-
|
|
10972
|
-
|
|
10973
|
-
|
|
10974
|
-
|
|
10975
|
-
|
|
10976
|
-
|
|
10977
|
-
|
|
10978
|
-
const
|
|
10979
|
-
|
|
10980
|
-
|
|
10981
|
-
|
|
10982
|
-
|
|
10983
|
-
|
|
10984
|
-
|
|
10985
|
-
|
|
10986
|
-
|
|
10987
|
-
|
|
10618
|
+
const properties = [["x", ["left", "right"], getScrollXOffset], ["y", ["top", "bottom"], getScrollYOffset]];
|
|
10619
|
+
class Rect {
|
|
10620
|
+
constructor(rect, element) {
|
|
10621
|
+
this.rect = void 0;
|
|
10622
|
+
this.width = void 0;
|
|
10623
|
+
this.height = void 0;
|
|
10624
|
+
this.top = void 0;
|
|
10625
|
+
this.bottom = void 0;
|
|
10626
|
+
this.right = void 0;
|
|
10627
|
+
this.left = void 0;
|
|
10628
|
+
const scrollableAncestors = getScrollableAncestors(element);
|
|
10629
|
+
const scrollOffsets = getScrollOffsets(scrollableAncestors);
|
|
10630
|
+
this.rect = {
|
|
10631
|
+
...rect
|
|
10632
|
+
};
|
|
10633
|
+
this.width = rect.width;
|
|
10634
|
+
this.height = rect.height;
|
|
10635
|
+
for (const [axis, keys2, getScrollOffset] of properties) {
|
|
10636
|
+
for (const key2 of keys2) {
|
|
10637
|
+
Object.defineProperty(this, key2, {
|
|
10638
|
+
get: () => {
|
|
10639
|
+
const currentOffsets = getScrollOffset(scrollableAncestors);
|
|
10640
|
+
const scrollOffsetsDeltla = scrollOffsets[axis] - currentOffsets;
|
|
10641
|
+
return this.rect[key2] + scrollOffsetsDeltla;
|
|
10642
|
+
},
|
|
10643
|
+
enumerable: true
|
|
10988
10644
|
});
|
|
10989
10645
|
}
|
|
10990
10646
|
}
|
|
10991
|
-
|
|
10992
|
-
|
|
10993
|
-
};
|
|
10994
|
-
function adjustScale(transform, rect1, rect2) {
|
|
10995
|
-
return {
|
|
10996
|
-
...transform,
|
|
10997
|
-
scaleX: rect1 && rect2 ? rect1.width / rect2.width : 1,
|
|
10998
|
-
scaleY: rect1 && rect2 ? rect1.height / rect2.height : 1
|
|
10999
|
-
};
|
|
11000
|
-
}
|
|
11001
|
-
function getRectDelta(rect1, rect2) {
|
|
11002
|
-
return rect1 && rect2 ? {
|
|
11003
|
-
x: rect1.left - rect2.left,
|
|
11004
|
-
y: rect1.top - rect2.top
|
|
11005
|
-
} : defaultCoordinates;
|
|
11006
|
-
}
|
|
11007
|
-
function createRectAdjustmentFn(modifier) {
|
|
11008
|
-
return function adjustClientRect(rect) {
|
|
11009
|
-
for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
11010
|
-
adjustments[_key - 1] = arguments[_key];
|
|
11011
|
-
}
|
|
11012
|
-
return adjustments.reduce((acc, adjustment) => ({
|
|
11013
|
-
...acc,
|
|
11014
|
-
top: acc.top + modifier * adjustment.y,
|
|
11015
|
-
bottom: acc.bottom + modifier * adjustment.y,
|
|
11016
|
-
left: acc.left + modifier * adjustment.x,
|
|
11017
|
-
right: acc.right + modifier * adjustment.x
|
|
11018
|
-
}), {
|
|
11019
|
-
...rect
|
|
10647
|
+
Object.defineProperty(this, "rect", {
|
|
10648
|
+
enumerable: false
|
|
11020
10649
|
});
|
|
11021
|
-
}
|
|
10650
|
+
}
|
|
11022
10651
|
}
|
|
11023
|
-
|
|
11024
|
-
|
|
11025
|
-
|
|
11026
|
-
|
|
11027
|
-
|
|
11028
|
-
|
|
11029
|
-
|
|
11030
|
-
|
|
11031
|
-
|
|
11032
|
-
};
|
|
11033
|
-
} else if (transform.startsWith("matrix(")) {
|
|
11034
|
-
const transformArray = transform.slice(7, -1).split(/, /);
|
|
11035
|
-
return {
|
|
11036
|
-
x: +transformArray[4],
|
|
11037
|
-
y: +transformArray[5],
|
|
11038
|
-
scaleX: +transformArray[0],
|
|
11039
|
-
scaleY: +transformArray[3]
|
|
10652
|
+
class Listeners {
|
|
10653
|
+
constructor(target) {
|
|
10654
|
+
this.target = void 0;
|
|
10655
|
+
this.listeners = [];
|
|
10656
|
+
this.removeAll = () => {
|
|
10657
|
+
this.listeners.forEach((listener) => {
|
|
10658
|
+
var _this$target;
|
|
10659
|
+
return (_this$target = this.target) == null ? void 0 : _this$target.removeEventListener(...listener);
|
|
10660
|
+
});
|
|
11040
10661
|
};
|
|
10662
|
+
this.target = target;
|
|
11041
10663
|
}
|
|
11042
|
-
|
|
11043
|
-
|
|
11044
|
-
|
|
11045
|
-
|
|
11046
|
-
if (!parsedTransform) {
|
|
11047
|
-
return rect;
|
|
10664
|
+
add(eventName, handler, options) {
|
|
10665
|
+
var _this$target2;
|
|
10666
|
+
(_this$target2 = this.target) == null ? void 0 : _this$target2.addEventListener(eventName, handler, options);
|
|
10667
|
+
this.listeners.push([eventName, handler, options]);
|
|
11048
10668
|
}
|
|
11049
|
-
const {
|
|
11050
|
-
scaleX,
|
|
11051
|
-
scaleY,
|
|
11052
|
-
x: translateX,
|
|
11053
|
-
y: translateY
|
|
11054
|
-
} = parsedTransform;
|
|
11055
|
-
const x2 = rect.left - translateX - (1 - scaleX) * parseFloat(transformOrigin);
|
|
11056
|
-
const y2 = rect.top - translateY - (1 - scaleY) * parseFloat(transformOrigin.slice(transformOrigin.indexOf(" ") + 1));
|
|
11057
|
-
const w2 = scaleX ? rect.width / scaleX : rect.width;
|
|
11058
|
-
const h = scaleY ? rect.height / scaleY : rect.height;
|
|
11059
|
-
return {
|
|
11060
|
-
width: w2,
|
|
11061
|
-
height: h,
|
|
11062
|
-
top: y2,
|
|
11063
|
-
right: x2 + w2,
|
|
11064
|
-
bottom: y2 + h,
|
|
11065
|
-
left: x2
|
|
11066
|
-
};
|
|
11067
10669
|
}
|
|
11068
|
-
|
|
11069
|
-
ignoreTransform: false
|
|
11070
|
-
};
|
|
11071
|
-
function getClientRect(element, options) {
|
|
11072
|
-
if (options === void 0) {
|
|
11073
|
-
options = defaultOptions$2;
|
|
11074
|
-
}
|
|
11075
|
-
let rect = element.getBoundingClientRect();
|
|
11076
|
-
if (options.ignoreTransform) {
|
|
11077
|
-
const {
|
|
11078
|
-
transform,
|
|
11079
|
-
transformOrigin
|
|
11080
|
-
} = getWindow(element).getComputedStyle(element);
|
|
11081
|
-
if (transform) {
|
|
11082
|
-
rect = inverseTransform(rect, transform, transformOrigin);
|
|
11083
|
-
}
|
|
11084
|
-
}
|
|
10670
|
+
function getEventListenerTarget(target) {
|
|
11085
10671
|
const {
|
|
11086
|
-
|
|
11087
|
-
|
|
11088
|
-
|
|
11089
|
-
height: height2,
|
|
11090
|
-
bottom: bottom2,
|
|
11091
|
-
right: right2
|
|
11092
|
-
} = rect;
|
|
11093
|
-
return {
|
|
11094
|
-
top: top2,
|
|
11095
|
-
left: left2,
|
|
11096
|
-
width: width2,
|
|
11097
|
-
height: height2,
|
|
11098
|
-
bottom: bottom2,
|
|
11099
|
-
right: right2
|
|
11100
|
-
};
|
|
11101
|
-
}
|
|
11102
|
-
function getTransformAgnosticClientRect(element) {
|
|
11103
|
-
return getClientRect(element, {
|
|
11104
|
-
ignoreTransform: true
|
|
11105
|
-
});
|
|
11106
|
-
}
|
|
11107
|
-
function getWindowClientRect(element) {
|
|
11108
|
-
const width2 = element.innerWidth;
|
|
11109
|
-
const height2 = element.innerHeight;
|
|
11110
|
-
return {
|
|
11111
|
-
top: 0,
|
|
11112
|
-
left: 0,
|
|
11113
|
-
right: width2,
|
|
11114
|
-
bottom: height2,
|
|
11115
|
-
width: width2,
|
|
11116
|
-
height: height2
|
|
11117
|
-
};
|
|
10672
|
+
EventTarget
|
|
10673
|
+
} = getWindow(target);
|
|
10674
|
+
return target instanceof EventTarget ? target : getOwnerDocument(target);
|
|
11118
10675
|
}
|
|
11119
|
-
function
|
|
11120
|
-
|
|
11121
|
-
|
|
10676
|
+
function hasExceededDistance(delta, measurement) {
|
|
10677
|
+
const dx = Math.abs(delta.x);
|
|
10678
|
+
const dy = Math.abs(delta.y);
|
|
10679
|
+
if (typeof measurement === "number") {
|
|
10680
|
+
return Math.sqrt(dx ** 2 + dy ** 2) > measurement;
|
|
11122
10681
|
}
|
|
11123
|
-
|
|
11124
|
-
|
|
11125
|
-
function isScrollable(element, computedStyle) {
|
|
11126
|
-
if (computedStyle === void 0) {
|
|
11127
|
-
computedStyle = getWindow(element).getComputedStyle(element);
|
|
10682
|
+
if ("x" in measurement && "y" in measurement) {
|
|
10683
|
+
return dx > measurement.x && dy > measurement.y;
|
|
11128
10684
|
}
|
|
11129
|
-
|
|
11130
|
-
|
|
11131
|
-
return properties2.some((property) => {
|
|
11132
|
-
const value = computedStyle[property];
|
|
11133
|
-
return typeof value === "string" ? overflowRegex.test(value) : false;
|
|
11134
|
-
});
|
|
11135
|
-
}
|
|
11136
|
-
function getScrollableAncestors(element, limit2) {
|
|
11137
|
-
const scrollParents = [];
|
|
11138
|
-
function findScrollableAncestors(node2) {
|
|
11139
|
-
if (limit2 != null && scrollParents.length >= limit2) {
|
|
11140
|
-
return scrollParents;
|
|
11141
|
-
}
|
|
11142
|
-
if (!node2) {
|
|
11143
|
-
return scrollParents;
|
|
11144
|
-
}
|
|
11145
|
-
if (isDocument(node2) && node2.scrollingElement != null && !scrollParents.includes(node2.scrollingElement)) {
|
|
11146
|
-
scrollParents.push(node2.scrollingElement);
|
|
11147
|
-
return scrollParents;
|
|
11148
|
-
}
|
|
11149
|
-
if (!isHTMLElement(node2) || isSVGElement(node2)) {
|
|
11150
|
-
return scrollParents;
|
|
11151
|
-
}
|
|
11152
|
-
if (scrollParents.includes(node2)) {
|
|
11153
|
-
return scrollParents;
|
|
11154
|
-
}
|
|
11155
|
-
const computedStyle = getWindow(element).getComputedStyle(node2);
|
|
11156
|
-
if (node2 !== element) {
|
|
11157
|
-
if (isScrollable(node2, computedStyle)) {
|
|
11158
|
-
scrollParents.push(node2);
|
|
11159
|
-
}
|
|
11160
|
-
}
|
|
11161
|
-
if (isFixed(node2, computedStyle)) {
|
|
11162
|
-
return scrollParents;
|
|
11163
|
-
}
|
|
11164
|
-
return findScrollableAncestors(node2.parentNode);
|
|
10685
|
+
if ("x" in measurement) {
|
|
10686
|
+
return dx > measurement.x;
|
|
11165
10687
|
}
|
|
11166
|
-
if (
|
|
11167
|
-
return
|
|
10688
|
+
if ("y" in measurement) {
|
|
10689
|
+
return dy > measurement.y;
|
|
11168
10690
|
}
|
|
11169
|
-
return
|
|
10691
|
+
return false;
|
|
11170
10692
|
}
|
|
11171
|
-
|
|
11172
|
-
|
|
11173
|
-
|
|
10693
|
+
var EventName;
|
|
10694
|
+
(function(EventName2) {
|
|
10695
|
+
EventName2["Click"] = "click";
|
|
10696
|
+
EventName2["DragStart"] = "dragstart";
|
|
10697
|
+
EventName2["Keydown"] = "keydown";
|
|
10698
|
+
EventName2["ContextMenu"] = "contextmenu";
|
|
10699
|
+
EventName2["Resize"] = "resize";
|
|
10700
|
+
EventName2["SelectionChange"] = "selectionchange";
|
|
10701
|
+
EventName2["VisibilityChange"] = "visibilitychange";
|
|
10702
|
+
})(EventName || (EventName = {}));
|
|
10703
|
+
function preventDefault(event) {
|
|
10704
|
+
event.preventDefault();
|
|
11174
10705
|
}
|
|
11175
|
-
function
|
|
11176
|
-
|
|
11177
|
-
return null;
|
|
11178
|
-
}
|
|
11179
|
-
if (isWindow(element)) {
|
|
11180
|
-
return element;
|
|
11181
|
-
}
|
|
11182
|
-
if (!isNode(element)) {
|
|
11183
|
-
return null;
|
|
11184
|
-
}
|
|
11185
|
-
if (isDocument(element) || element === getOwnerDocument(element).scrollingElement) {
|
|
11186
|
-
return window;
|
|
11187
|
-
}
|
|
11188
|
-
if (isHTMLElement(element)) {
|
|
11189
|
-
return element;
|
|
11190
|
-
}
|
|
11191
|
-
return null;
|
|
11192
|
-
}
|
|
11193
|
-
function getScrollXCoordinate(element) {
|
|
11194
|
-
if (isWindow(element)) {
|
|
11195
|
-
return element.scrollX;
|
|
11196
|
-
}
|
|
11197
|
-
return element.scrollLeft;
|
|
11198
|
-
}
|
|
11199
|
-
function getScrollYCoordinate(element) {
|
|
11200
|
-
if (isWindow(element)) {
|
|
11201
|
-
return element.scrollY;
|
|
11202
|
-
}
|
|
11203
|
-
return element.scrollTop;
|
|
11204
|
-
}
|
|
11205
|
-
function getScrollCoordinates(element) {
|
|
11206
|
-
return {
|
|
11207
|
-
x: getScrollXCoordinate(element),
|
|
11208
|
-
y: getScrollYCoordinate(element)
|
|
11209
|
-
};
|
|
11210
|
-
}
|
|
11211
|
-
var Direction;
|
|
11212
|
-
(function(Direction2) {
|
|
11213
|
-
Direction2[Direction2["Forward"] = 1] = "Forward";
|
|
11214
|
-
Direction2[Direction2["Backward"] = -1] = "Backward";
|
|
11215
|
-
})(Direction || (Direction = {}));
|
|
11216
|
-
function isDocumentScrollingElement(element) {
|
|
11217
|
-
if (!canUseDOM || !element) {
|
|
11218
|
-
return false;
|
|
11219
|
-
}
|
|
11220
|
-
return element === document.scrollingElement;
|
|
11221
|
-
}
|
|
11222
|
-
function getScrollPosition(scrollingContainer) {
|
|
11223
|
-
const minScroll = {
|
|
11224
|
-
x: 0,
|
|
11225
|
-
y: 0
|
|
11226
|
-
};
|
|
11227
|
-
const dimensions = isDocumentScrollingElement(scrollingContainer) ? {
|
|
11228
|
-
height: window.innerHeight,
|
|
11229
|
-
width: window.innerWidth
|
|
11230
|
-
} : {
|
|
11231
|
-
height: scrollingContainer.clientHeight,
|
|
11232
|
-
width: scrollingContainer.clientWidth
|
|
11233
|
-
};
|
|
11234
|
-
const maxScroll = {
|
|
11235
|
-
x: scrollingContainer.scrollWidth - dimensions.width,
|
|
11236
|
-
y: scrollingContainer.scrollHeight - dimensions.height
|
|
11237
|
-
};
|
|
11238
|
-
const isTop = scrollingContainer.scrollTop <= minScroll.y;
|
|
11239
|
-
const isLeft = scrollingContainer.scrollLeft <= minScroll.x;
|
|
11240
|
-
const isBottom = scrollingContainer.scrollTop >= maxScroll.y;
|
|
11241
|
-
const isRight = scrollingContainer.scrollLeft >= maxScroll.x;
|
|
11242
|
-
return {
|
|
11243
|
-
isTop,
|
|
11244
|
-
isLeft,
|
|
11245
|
-
isBottom,
|
|
11246
|
-
isRight,
|
|
11247
|
-
maxScroll,
|
|
11248
|
-
minScroll
|
|
11249
|
-
};
|
|
10706
|
+
function stopPropagation(event) {
|
|
10707
|
+
event.stopPropagation();
|
|
11250
10708
|
}
|
|
11251
|
-
|
|
11252
|
-
|
|
11253
|
-
|
|
10709
|
+
var KeyboardCode;
|
|
10710
|
+
(function(KeyboardCode2) {
|
|
10711
|
+
KeyboardCode2["Space"] = "Space";
|
|
10712
|
+
KeyboardCode2["Down"] = "ArrowDown";
|
|
10713
|
+
KeyboardCode2["Right"] = "ArrowRight";
|
|
10714
|
+
KeyboardCode2["Left"] = "ArrowLeft";
|
|
10715
|
+
KeyboardCode2["Up"] = "ArrowUp";
|
|
10716
|
+
KeyboardCode2["Esc"] = "Escape";
|
|
10717
|
+
KeyboardCode2["Enter"] = "Enter";
|
|
10718
|
+
})(KeyboardCode || (KeyboardCode = {}));
|
|
10719
|
+
const defaultKeyboardCodes = {
|
|
10720
|
+
start: [KeyboardCode.Space, KeyboardCode.Enter],
|
|
10721
|
+
cancel: [KeyboardCode.Esc],
|
|
10722
|
+
end: [KeyboardCode.Space, KeyboardCode.Enter]
|
|
11254
10723
|
};
|
|
11255
|
-
|
|
10724
|
+
const defaultKeyboardCoordinateGetter = (event, _ref) => {
|
|
11256
10725
|
let {
|
|
11257
|
-
|
|
11258
|
-
left: left2,
|
|
11259
|
-
right: right2,
|
|
11260
|
-
bottom: bottom2
|
|
10726
|
+
currentCoordinates
|
|
11261
10727
|
} = _ref;
|
|
11262
|
-
|
|
11263
|
-
|
|
11264
|
-
|
|
11265
|
-
|
|
11266
|
-
|
|
11267
|
-
|
|
11268
|
-
|
|
11269
|
-
|
|
11270
|
-
|
|
11271
|
-
|
|
11272
|
-
|
|
11273
|
-
|
|
11274
|
-
|
|
11275
|
-
|
|
11276
|
-
|
|
11277
|
-
|
|
11278
|
-
|
|
11279
|
-
|
|
11280
|
-
|
|
11281
|
-
|
|
11282
|
-
|
|
11283
|
-
height: scrollContainerRect.height * thresholdPercentage.y,
|
|
11284
|
-
width: scrollContainerRect.width * thresholdPercentage.x
|
|
11285
|
-
};
|
|
11286
|
-
if (!isTop && top2 <= scrollContainerRect.top + threshold.height) {
|
|
11287
|
-
direction.y = Direction.Backward;
|
|
11288
|
-
speed.y = acceleration * Math.abs((scrollContainerRect.top + threshold.height - top2) / threshold.height);
|
|
11289
|
-
} else if (!isBottom && bottom2 >= scrollContainerRect.bottom - threshold.height) {
|
|
11290
|
-
direction.y = Direction.Forward;
|
|
11291
|
-
speed.y = acceleration * Math.abs((scrollContainerRect.bottom - threshold.height - bottom2) / threshold.height);
|
|
11292
|
-
}
|
|
11293
|
-
if (!isRight && right2 >= scrollContainerRect.right - threshold.width) {
|
|
11294
|
-
direction.x = Direction.Forward;
|
|
11295
|
-
speed.x = acceleration * Math.abs((scrollContainerRect.right - threshold.width - right2) / threshold.width);
|
|
11296
|
-
} else if (!isLeft && left2 <= scrollContainerRect.left + threshold.width) {
|
|
11297
|
-
direction.x = Direction.Backward;
|
|
11298
|
-
speed.x = acceleration * Math.abs((scrollContainerRect.left + threshold.width - left2) / threshold.width);
|
|
10728
|
+
switch (event.code) {
|
|
10729
|
+
case KeyboardCode.Right:
|
|
10730
|
+
return {
|
|
10731
|
+
...currentCoordinates,
|
|
10732
|
+
x: currentCoordinates.x + 25
|
|
10733
|
+
};
|
|
10734
|
+
case KeyboardCode.Left:
|
|
10735
|
+
return {
|
|
10736
|
+
...currentCoordinates,
|
|
10737
|
+
x: currentCoordinates.x - 25
|
|
10738
|
+
};
|
|
10739
|
+
case KeyboardCode.Down:
|
|
10740
|
+
return {
|
|
10741
|
+
...currentCoordinates,
|
|
10742
|
+
y: currentCoordinates.y + 25
|
|
10743
|
+
};
|
|
10744
|
+
case KeyboardCode.Up:
|
|
10745
|
+
return {
|
|
10746
|
+
...currentCoordinates,
|
|
10747
|
+
y: currentCoordinates.y - 25
|
|
10748
|
+
};
|
|
11299
10749
|
}
|
|
11300
|
-
return
|
|
11301
|
-
|
|
11302
|
-
|
|
11303
|
-
|
|
11304
|
-
|
|
11305
|
-
|
|
11306
|
-
|
|
10750
|
+
return void 0;
|
|
10751
|
+
};
|
|
10752
|
+
class KeyboardSensor {
|
|
10753
|
+
constructor(props) {
|
|
10754
|
+
this.props = void 0;
|
|
10755
|
+
this.autoScrollEnabled = false;
|
|
10756
|
+
this.referenceCoordinates = void 0;
|
|
10757
|
+
this.listeners = void 0;
|
|
10758
|
+
this.windowListeners = void 0;
|
|
10759
|
+
this.props = props;
|
|
11307
10760
|
const {
|
|
11308
|
-
|
|
11309
|
-
|
|
11310
|
-
|
|
11311
|
-
|
|
11312
|
-
|
|
11313
|
-
|
|
11314
|
-
|
|
11315
|
-
|
|
11316
|
-
|
|
11317
|
-
|
|
11318
|
-
};
|
|
11319
|
-
}
|
|
11320
|
-
const {
|
|
11321
|
-
top: top2,
|
|
11322
|
-
left: left2,
|
|
11323
|
-
right: right2,
|
|
11324
|
-
bottom: bottom2
|
|
11325
|
-
} = element.getBoundingClientRect();
|
|
11326
|
-
return {
|
|
11327
|
-
top: top2,
|
|
11328
|
-
left: left2,
|
|
11329
|
-
right: right2,
|
|
11330
|
-
bottom: bottom2,
|
|
11331
|
-
width: element.clientWidth,
|
|
11332
|
-
height: element.clientHeight
|
|
11333
|
-
};
|
|
11334
|
-
}
|
|
11335
|
-
function getScrollOffsets(scrollableAncestors) {
|
|
11336
|
-
return scrollableAncestors.reduce((acc, node2) => {
|
|
11337
|
-
return add$1(acc, getScrollCoordinates(node2));
|
|
11338
|
-
}, defaultCoordinates);
|
|
11339
|
-
}
|
|
11340
|
-
function getScrollXOffset(scrollableAncestors) {
|
|
11341
|
-
return scrollableAncestors.reduce((acc, node2) => {
|
|
11342
|
-
return acc + getScrollXCoordinate(node2);
|
|
11343
|
-
}, 0);
|
|
11344
|
-
}
|
|
11345
|
-
function getScrollYOffset(scrollableAncestors) {
|
|
11346
|
-
return scrollableAncestors.reduce((acc, node2) => {
|
|
11347
|
-
return acc + getScrollYCoordinate(node2);
|
|
11348
|
-
}, 0);
|
|
11349
|
-
}
|
|
11350
|
-
function scrollIntoViewIfNeeded(element, measure) {
|
|
11351
|
-
if (measure === void 0) {
|
|
11352
|
-
measure = getClientRect;
|
|
10761
|
+
event: {
|
|
10762
|
+
target
|
|
10763
|
+
}
|
|
10764
|
+
} = props;
|
|
10765
|
+
this.props = props;
|
|
10766
|
+
this.listeners = new Listeners(getOwnerDocument(target));
|
|
10767
|
+
this.windowListeners = new Listeners(getWindow(target));
|
|
10768
|
+
this.handleKeyDown = this.handleKeyDown.bind(this);
|
|
10769
|
+
this.handleCancel = this.handleCancel.bind(this);
|
|
10770
|
+
this.attach();
|
|
11353
10771
|
}
|
|
11354
|
-
|
|
11355
|
-
|
|
10772
|
+
attach() {
|
|
10773
|
+
this.handleStart();
|
|
10774
|
+
this.windowListeners.add(EventName.Resize, this.handleCancel);
|
|
10775
|
+
this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);
|
|
10776
|
+
setTimeout(() => this.listeners.add(EventName.Keydown, this.handleKeyDown));
|
|
11356
10777
|
}
|
|
11357
|
-
|
|
11358
|
-
|
|
11359
|
-
|
|
11360
|
-
|
|
11361
|
-
|
|
11362
|
-
|
|
11363
|
-
|
|
11364
|
-
|
|
11365
|
-
|
|
11366
|
-
|
|
11367
|
-
if (bottom2 <= 0 || right2 <= 0 || top2 >= window.innerHeight || left2 >= window.innerWidth) {
|
|
11368
|
-
element.scrollIntoView({
|
|
11369
|
-
block: "center",
|
|
11370
|
-
inline: "center"
|
|
11371
|
-
});
|
|
11372
|
-
}
|
|
11373
|
-
}
|
|
11374
|
-
const properties = [["x", ["left", "right"], getScrollXOffset], ["y", ["top", "bottom"], getScrollYOffset]];
|
|
11375
|
-
class Rect {
|
|
11376
|
-
constructor(rect, element) {
|
|
11377
|
-
this.rect = void 0;
|
|
11378
|
-
this.width = void 0;
|
|
11379
|
-
this.height = void 0;
|
|
11380
|
-
this.top = void 0;
|
|
11381
|
-
this.bottom = void 0;
|
|
11382
|
-
this.right = void 0;
|
|
11383
|
-
this.left = void 0;
|
|
11384
|
-
const scrollableAncestors = getScrollableAncestors(element);
|
|
11385
|
-
const scrollOffsets = getScrollOffsets(scrollableAncestors);
|
|
11386
|
-
this.rect = {
|
|
11387
|
-
...rect
|
|
11388
|
-
};
|
|
11389
|
-
this.width = rect.width;
|
|
11390
|
-
this.height = rect.height;
|
|
11391
|
-
for (const [axis, keys2, getScrollOffset] of properties) {
|
|
11392
|
-
for (const key2 of keys2) {
|
|
11393
|
-
Object.defineProperty(this, key2, {
|
|
11394
|
-
get: () => {
|
|
11395
|
-
const currentOffsets = getScrollOffset(scrollableAncestors);
|
|
11396
|
-
const scrollOffsetsDeltla = scrollOffsets[axis] - currentOffsets;
|
|
11397
|
-
return this.rect[key2] + scrollOffsetsDeltla;
|
|
11398
|
-
},
|
|
11399
|
-
enumerable: true
|
|
11400
|
-
});
|
|
11401
|
-
}
|
|
11402
|
-
}
|
|
11403
|
-
Object.defineProperty(this, "rect", {
|
|
11404
|
-
enumerable: false
|
|
11405
|
-
});
|
|
11406
|
-
}
|
|
11407
|
-
}
|
|
11408
|
-
class Listeners {
|
|
11409
|
-
constructor(target) {
|
|
11410
|
-
this.target = void 0;
|
|
11411
|
-
this.listeners = [];
|
|
11412
|
-
this.removeAll = () => {
|
|
11413
|
-
this.listeners.forEach((listener) => {
|
|
11414
|
-
var _this$target;
|
|
11415
|
-
return (_this$target = this.target) == null ? void 0 : _this$target.removeEventListener(...listener);
|
|
11416
|
-
});
|
|
11417
|
-
};
|
|
11418
|
-
this.target = target;
|
|
11419
|
-
}
|
|
11420
|
-
add(eventName, handler, options) {
|
|
11421
|
-
var _this$target2;
|
|
11422
|
-
(_this$target2 = this.target) == null ? void 0 : _this$target2.addEventListener(eventName, handler, options);
|
|
11423
|
-
this.listeners.push([eventName, handler, options]);
|
|
11424
|
-
}
|
|
11425
|
-
}
|
|
11426
|
-
function getEventListenerTarget(target) {
|
|
11427
|
-
const {
|
|
11428
|
-
EventTarget
|
|
11429
|
-
} = getWindow(target);
|
|
11430
|
-
return target instanceof EventTarget ? target : getOwnerDocument(target);
|
|
11431
|
-
}
|
|
11432
|
-
function hasExceededDistance(delta, measurement) {
|
|
11433
|
-
const dx = Math.abs(delta.x);
|
|
11434
|
-
const dy = Math.abs(delta.y);
|
|
11435
|
-
if (typeof measurement === "number") {
|
|
11436
|
-
return Math.sqrt(dx ** 2 + dy ** 2) > measurement;
|
|
11437
|
-
}
|
|
11438
|
-
if ("x" in measurement && "y" in measurement) {
|
|
11439
|
-
return dx > measurement.x && dy > measurement.y;
|
|
11440
|
-
}
|
|
11441
|
-
if ("x" in measurement) {
|
|
11442
|
-
return dx > measurement.x;
|
|
11443
|
-
}
|
|
11444
|
-
if ("y" in measurement) {
|
|
11445
|
-
return dy > measurement.y;
|
|
11446
|
-
}
|
|
11447
|
-
return false;
|
|
11448
|
-
}
|
|
11449
|
-
var EventName;
|
|
11450
|
-
(function(EventName2) {
|
|
11451
|
-
EventName2["Click"] = "click";
|
|
11452
|
-
EventName2["DragStart"] = "dragstart";
|
|
11453
|
-
EventName2["Keydown"] = "keydown";
|
|
11454
|
-
EventName2["ContextMenu"] = "contextmenu";
|
|
11455
|
-
EventName2["Resize"] = "resize";
|
|
11456
|
-
EventName2["SelectionChange"] = "selectionchange";
|
|
11457
|
-
EventName2["VisibilityChange"] = "visibilitychange";
|
|
11458
|
-
})(EventName || (EventName = {}));
|
|
11459
|
-
function preventDefault(event) {
|
|
11460
|
-
event.preventDefault();
|
|
11461
|
-
}
|
|
11462
|
-
function stopPropagation(event) {
|
|
11463
|
-
event.stopPropagation();
|
|
11464
|
-
}
|
|
11465
|
-
var KeyboardCode;
|
|
11466
|
-
(function(KeyboardCode2) {
|
|
11467
|
-
KeyboardCode2["Space"] = "Space";
|
|
11468
|
-
KeyboardCode2["Down"] = "ArrowDown";
|
|
11469
|
-
KeyboardCode2["Right"] = "ArrowRight";
|
|
11470
|
-
KeyboardCode2["Left"] = "ArrowLeft";
|
|
11471
|
-
KeyboardCode2["Up"] = "ArrowUp";
|
|
11472
|
-
KeyboardCode2["Esc"] = "Escape";
|
|
11473
|
-
KeyboardCode2["Enter"] = "Enter";
|
|
11474
|
-
})(KeyboardCode || (KeyboardCode = {}));
|
|
11475
|
-
const defaultKeyboardCodes = {
|
|
11476
|
-
start: [KeyboardCode.Space, KeyboardCode.Enter],
|
|
11477
|
-
cancel: [KeyboardCode.Esc],
|
|
11478
|
-
end: [KeyboardCode.Space, KeyboardCode.Enter]
|
|
11479
|
-
};
|
|
11480
|
-
const defaultKeyboardCoordinateGetter = (event, _ref) => {
|
|
11481
|
-
let {
|
|
11482
|
-
currentCoordinates
|
|
11483
|
-
} = _ref;
|
|
11484
|
-
switch (event.code) {
|
|
11485
|
-
case KeyboardCode.Right:
|
|
11486
|
-
return {
|
|
11487
|
-
...currentCoordinates,
|
|
11488
|
-
x: currentCoordinates.x + 25
|
|
11489
|
-
};
|
|
11490
|
-
case KeyboardCode.Left:
|
|
11491
|
-
return {
|
|
11492
|
-
...currentCoordinates,
|
|
11493
|
-
x: currentCoordinates.x - 25
|
|
11494
|
-
};
|
|
11495
|
-
case KeyboardCode.Down:
|
|
11496
|
-
return {
|
|
11497
|
-
...currentCoordinates,
|
|
11498
|
-
y: currentCoordinates.y + 25
|
|
11499
|
-
};
|
|
11500
|
-
case KeyboardCode.Up:
|
|
11501
|
-
return {
|
|
11502
|
-
...currentCoordinates,
|
|
11503
|
-
y: currentCoordinates.y - 25
|
|
11504
|
-
};
|
|
11505
|
-
}
|
|
11506
|
-
return void 0;
|
|
11507
|
-
};
|
|
11508
|
-
class KeyboardSensor {
|
|
11509
|
-
constructor(props) {
|
|
11510
|
-
this.props = void 0;
|
|
11511
|
-
this.autoScrollEnabled = false;
|
|
11512
|
-
this.referenceCoordinates = void 0;
|
|
11513
|
-
this.listeners = void 0;
|
|
11514
|
-
this.windowListeners = void 0;
|
|
11515
|
-
this.props = props;
|
|
11516
|
-
const {
|
|
11517
|
-
event: {
|
|
11518
|
-
target
|
|
11519
|
-
}
|
|
11520
|
-
} = props;
|
|
11521
|
-
this.props = props;
|
|
11522
|
-
this.listeners = new Listeners(getOwnerDocument(target));
|
|
11523
|
-
this.windowListeners = new Listeners(getWindow(target));
|
|
11524
|
-
this.handleKeyDown = this.handleKeyDown.bind(this);
|
|
11525
|
-
this.handleCancel = this.handleCancel.bind(this);
|
|
11526
|
-
this.attach();
|
|
11527
|
-
}
|
|
11528
|
-
attach() {
|
|
11529
|
-
this.handleStart();
|
|
11530
|
-
this.windowListeners.add(EventName.Resize, this.handleCancel);
|
|
11531
|
-
this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);
|
|
11532
|
-
setTimeout(() => this.listeners.add(EventName.Keydown, this.handleKeyDown));
|
|
11533
|
-
}
|
|
11534
|
-
handleStart() {
|
|
11535
|
-
const {
|
|
11536
|
-
activeNode,
|
|
11537
|
-
onStart
|
|
11538
|
-
} = this.props;
|
|
11539
|
-
const node2 = activeNode.node.current;
|
|
11540
|
-
if (node2) {
|
|
11541
|
-
scrollIntoViewIfNeeded(node2);
|
|
11542
|
-
}
|
|
11543
|
-
onStart(defaultCoordinates);
|
|
10778
|
+
handleStart() {
|
|
10779
|
+
const {
|
|
10780
|
+
activeNode,
|
|
10781
|
+
onStart
|
|
10782
|
+
} = this.props;
|
|
10783
|
+
const node2 = activeNode.node.current;
|
|
10784
|
+
if (node2) {
|
|
10785
|
+
scrollIntoViewIfNeeded(node2);
|
|
10786
|
+
}
|
|
10787
|
+
onStart(defaultCoordinates);
|
|
11544
10788
|
}
|
|
11545
10789
|
handleKeyDown(event) {
|
|
11546
10790
|
if (isKeyboardEvent(event)) {
|
|
@@ -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) {
|
|
@@ -14478,199 +13722,1011 @@ const MetaContent = ({ item: item2 }) => {
|
|
|
14478
13722
|
"data-testid": testId && `${testId}-details`,
|
|
14479
13723
|
children: details2
|
|
14480
13724
|
}
|
|
14481
|
-
),
|
|
14482
|
-
metadata2 && /* @__PURE__ */ jsx(
|
|
14483
|
-
"span",
|
|
14484
|
-
{
|
|
14485
|
-
className: listStyles.metadata,
|
|
14486
|
-
"data-testid": testId && `${testId}-metadata`,
|
|
14487
|
-
children: metadata2
|
|
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;
|
|
13932
|
+
}
|
|
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
|
+
);
|
|
13959
|
+
}
|
|
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;
|
|
13969
|
+
}
|
|
13970
|
+
}
|
|
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);
|
|
14166
|
+
};
|
|
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
|
+
},
|
|
14179
|
+
{
|
|
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;
|
|
14397
|
+
}
|
|
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
|
]
|