@eightshift/ui-components 1.0.6 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/{Button-eebLs4cp.js → Button-CbFrFO04.js} +5 -5
- package/dist/{Checkbox-BN0TEda-.js → Checkbox-Cv3pZDHg.js} +12 -16
- package/dist/{ColorSwatch-BrowHhTG.js → ColorSwatch-CNQmCQV8.js} +6 -7
- package/dist/{FieldError-ILxgMZy5.js → FieldError-J1-YPbi6.js} +2 -2
- package/dist/{FocusScope-B9b0VMib.js → FocusScope-Bw-IatMO.js} +79 -153
- package/dist/{GridList-CzpWxJsS.js → GridList-CEzzyr-l.js} +62 -90
- package/dist/{Group-Dkdm2-E7.js → Group-D3Qa6PrV.js} +3 -3
- package/dist/{Input-BJA4rmIo.js → Input-CX_rocyZ.js} +8 -8
- package/dist/{Label-9x5iLJ-Y.js → Label-Bg5O81Wb.js} +1 -1
- package/dist/{ListBox-D3Vr4vvC.js → ListBox-CCWXTj0t.js} +391 -598
- package/dist/{LiveAnnouncer-IsokfWQ5.js → LiveAnnouncer-D8h-3GrG.js} +12 -22
- package/dist/{NumberFormatter-LzoKy975.js → NumberFormatter-U_Gx0UDq.js} +26 -44
- package/dist/{Select-49a62830.esm-CKPmlkza.js → Select-49a62830.esm-BnlXlUnT.js} +92 -166
- package/dist/{SelectionManager-sedvcM-1.js → SelectionManager-XOAt-Ekx.js} +219 -401
- package/dist/{Separator-B6rnDabE.js → Separator-DZeg0KOr.js} +41 -72
- package/dist/{Slider-C5U5N7uM.js → Slider-fULMI0gI.js} +51 -82
- package/dist/{Text-Cyxp9ewv.js → Text-WqetJduR.js} +1 -1
- package/dist/{VisuallyHidden-BPJVSUyp.js → VisuallyHidden-Di1zXprL.js} +8 -11
- package/dist/{ariaHideOutside-ByKBPHmX.js → ariaHideOutside-Zn64-frS.js} +20 -36
- package/dist/assets/style.css +1 -1
- package/dist/assets/wp-font-enhancements.css +1 -1
- package/dist/assets/wp-ui-enhancements.css +1 -1
- package/dist/{button-idVI4jmd.js → button-CD8Q1eok.js} +17 -29
- package/dist/components/animated-visibility/animated-visibility.js +125 -113
- package/dist/components/base-control/base-control.js +3 -9
- package/dist/components/breakpoint-preview/breakpoint-preview.js +51 -108
- package/dist/components/button/button.js +6 -6
- package/dist/components/checkbox/checkbox.js +2 -2
- package/dist/components/color-pickers/color-picker.js +2 -2
- package/dist/components/color-pickers/color-swatch.js +5 -9
- package/dist/components/color-pickers/gradient-editor.js +15 -29
- package/dist/components/color-pickers/solid-color-picker.js +81 -128
- package/dist/components/component-toggle/component-toggle.js +4 -4
- package/dist/components/container-panel/container-panel.js +4 -11
- package/dist/components/draggable-list/draggable-list-item.js +4 -4
- package/dist/components/draggable-list/draggable-list.js +5 -5
- package/dist/components/expandable/expandable.js +45 -57
- package/dist/components/index.js +3 -3
- package/dist/components/input-field/input-field.js +11 -26
- package/dist/components/layout/hstack.js +2 -12
- package/dist/components/layout/vstack.js +2 -12
- package/dist/components/link-input/link-input.js +36 -53
- package/dist/components/list-box/list-box.js +4 -4
- package/dist/components/matrix-align/matrix-align.js +6 -10
- package/dist/components/menu/menu.js +101 -170
- package/dist/components/notice/notice.js +1 -1
- package/dist/components/number-picker/number-picker.js +15 -15
- package/dist/components/option-select/option-select.js +48 -64
- package/dist/components/options-panel/options-panel.js +3 -3
- package/dist/components/placeholders/file-placeholder.js +2 -2
- package/dist/components/placeholders/image-placeholder.js +1 -1
- package/dist/components/placeholders/media-placeholder.js +1 -1
- package/dist/components/popover/popover.js +4 -4
- package/dist/components/radio/radio.js +25 -38
- package/dist/components/repeater/repeater-item.js +6 -17
- package/dist/components/repeater/repeater.js +6 -7
- package/dist/components/responsive/responsive-legacy.js +6 -12
- package/dist/components/responsive/responsive.js +21 -48
- package/dist/components/responsive-preview/responsive-preview.js +1 -1
- package/dist/components/rich-label/rich-label.js +2 -8
- package/dist/components/select/async-multi-select.js +3 -3
- package/dist/components/select/async-single-select.js +2 -2
- package/dist/components/select/custom-select-default-components.js +2 -2
- package/dist/components/select/multi-select-components.js +2 -2
- package/dist/components/select/multi-select.js +3 -3
- package/dist/components/select/react-select-component-wrappers.js +9 -9
- package/dist/components/select/single-select.js +2 -2
- package/dist/components/select/styles.js +3 -10
- package/dist/components/slider/column-config-slider.js +4 -4
- package/dist/components/slider/slider.js +5 -8
- package/dist/components/slider/utils.js +2 -6
- package/dist/components/spacer/spacer.js +2 -7
- package/dist/components/tabs/tabs.js +29 -50
- package/dist/components/toggle/switch.js +8 -8
- package/dist/components/toggle/toggle.js +1 -1
- package/dist/components/toggle-button/toggle-button.js +8 -22
- package/dist/components/tooltip/tooltip.js +4 -4
- package/dist/{context-BAcFg5GO.js → context-4oSz1ItD.js} +10 -16
- package/dist/{default-i18n-Bk1GxDHz.js → default-i18n-BqwLkgZv.js} +21 -22
- package/dist/{filterDOMProps-DG2RfOUr.js → filterDOMProps-EDDcM64A.js} +1 -3
- package/dist/{focusSafely-B0hyd-S4.js → focusSafely-BS4dllCW.js} +85 -143
- package/dist/icons/generic-color-swatch.js +105 -13
- package/dist/icons/icons.js +31010 -3447
- package/dist/icons/jsx-svg.js +591 -953
- package/dist/{index-BDk0TPWz.js → index-CAPcSs9K.js} +1504 -2087
- package/dist/{index-a301f526.esm-BzTuHLdr.js → index-a301f526.esm-ByOfDxiG.js} +111 -183
- package/dist/index.js +3 -3
- package/dist/{intlStrings-Ctkp0HDc.js → intlStrings-Dxaeitoh.js} +35 -60
- package/dist/{isScrollable-PcyglExV.js → isScrollable-Dh9D9IOd.js} +1 -2
- package/dist/lite-DVmmD_-j.js +7 -0
- package/dist/{multi-select-components-nORKdJ-2.js → multi-select-components-7vKCF8dG.js} +3 -3
- package/dist/{number-rWqELA8W.js → number-CHmNj-oR.js} +3 -6
- package/dist/{popover-o2Q28Ljn.js → popover-Dk2o4S7K.js} +70 -112
- package/dist/{react-select-async.esm-CLj9uZTq.js → react-select-async.esm-5zW9Dv9E.js} +7 -11
- package/dist/{react-select.esm-3tyTZmrx.js → react-select.esm-Bi6uzjbT.js} +3 -3
- package/dist/{textSelection-BRZdHY-4.js → textSelection-exP_9srp.js} +5 -9
- package/dist/{tooltip-T6H9uF-Z.js → tooltip-BRQ4tvZL.js} +64 -111
- package/dist/{useButton-D-xACzEY.js → useButton-DbjDV_33.js} +19 -22
- package/dist/{useEvent-XlYPKgwX.js → useEvent-zvxfEnmK.js} +2 -3
- package/dist/{useFocusRing-CRx_hYC4.js → useFocusRing-SPRI0-SN.js} +1 -1
- package/dist/{useFocusable-CHfpEdlE.js → useFocusable-CLmhO94g.js} +5 -8
- package/dist/{useFormReset-aHn6-wRk.js → useFormReset-BVWgcyGO.js} +2 -3
- package/dist/{useFormValidationState-CdYmOaXI.js → useFormValidationState-CthG9Fbc.js} +20 -38
- package/dist/{useHasTabbableChild-domoFB7A.js → useHasTabbableChild--gkWUICh.js} +2 -2
- package/dist/{useLabel-DVhXVhtH.js → useLabel-g836T8kL.js} +3 -4
- package/dist/{useLabels-C7E5SkOi.js → useLabels-CfOtyOe2.js} +3 -5
- package/dist/{useListData-BelKu4kx.js → useListData-BpYQj7kK.js} +18 -32
- package/dist/{useListState-BRsq7O1C.js → useListState-DnWZa__1.js} +6 -12
- package/dist/{useLocalizedStringFormatter-WsEL47qR.js → useLocalizedStringFormatter-BQCMno9k.js} +12 -21
- package/dist/{useNumberFieldState-ZH2Qyyxh.js → useNumberFieldState-BegO5X6F.js} +75 -132
- package/dist/{useNumberFormatter-mhdYLxWQ.js → useNumberFormatter-DhOGEsEK.js} +2 -2
- package/dist/{usePress-B42RawCH.js → usePress-CScNeV3V.js} +92 -175
- package/dist/{useToggle-CExfZM8x.js → useToggle-6LnpaJ7-.js} +6 -7
- package/dist/{useToggleState-DghG5ImG.js → useToggleState-Cymkpac8.js} +3 -5
- package/dist/utilities/array-helpers.js +1 -1
- package/dist/utilities/index.js +1 -1
- package/dist/utilities/text-helpers.js +20 -20
- package/dist/{utils-DIBzm1e4.js → utils-Dc35LwuT.js} +49 -90
- package/package.json +96 -90
- package/dist/lite-pbIeT7tm.js +0 -8
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import React__default, { useState, useRef, useEffect, useMemo, forwardRef, useCallback, useContext, cloneElement, createContext } from "react";
|
|
2
|
-
import { r as reactDomExports } from "./index-
|
|
3
|
-
import { a as $9bf71ea28793e738$export$2d6ec8fc375ceafa } from "./FocusScope-
|
|
4
|
-
import { v as $c87311424ea30a05$export$e1865c3bedcd822b, o as $c87311424ea30a05$export$9ac100e40613ea10, h as $6a99195332edec8b$export$80f3e147d781571c, t as $507fabe10e71c6fb$export$630ff653c5ada6a9, m as $7215afc6de606d6b$export$de79e2c695e052f3, e as $458b0a5536c1a7cf$export$40bfa8c7b0832715 } from "./focusSafely-
|
|
5
|
-
import { g as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, d as $3ef42575df84b30b$export$9d1611c77c2fe928, o as $b5e257d569688ac6$export$535bd6ca7f90a273 } from "./utils-
|
|
6
|
-
import { $ as $f6c31cce2adf654f$export$45712eceda6fad21, b as $ea8dcbcb9ea1b556$export$9a302a45f65d0572, c as $ea8dcbcb9ea1b556$export$95185d699e05d4d7 } from "./usePress-
|
|
7
|
-
import { $ as $e9faafb641e167db$export$90fc3a17d93f704c } from "./useEvent-
|
|
8
|
-
import { $ as $cc38e7bd3fc7b213$export$2bb74740c4e19def } from "./isScrollable-
|
|
9
|
-
import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "./context-
|
|
10
|
-
import { $ as $03deb23ff14920c4$export$4eaf04e54aa8eed6 } from "./textSelection-
|
|
2
|
+
import { r as reactDomExports } from "./index-CAPcSs9K.js";
|
|
3
|
+
import { a as $9bf71ea28793e738$export$2d6ec8fc375ceafa } from "./FocusScope-Bw-IatMO.js";
|
|
4
|
+
import { v as $c87311424ea30a05$export$e1865c3bedcd822b, o as $c87311424ea30a05$export$9ac100e40613ea10, h as $6a99195332edec8b$export$80f3e147d781571c, t as $507fabe10e71c6fb$export$630ff653c5ada6a9, m as $7215afc6de606d6b$export$de79e2c695e052f3, e as $458b0a5536c1a7cf$export$40bfa8c7b0832715 } from "./focusSafely-BS4dllCW.js";
|
|
5
|
+
import { g as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, d as $3ef42575df84b30b$export$9d1611c77c2fe928, o as $b5e257d569688ac6$export$535bd6ca7f90a273 } from "./utils-Dc35LwuT.js";
|
|
6
|
+
import { $ as $f6c31cce2adf654f$export$45712eceda6fad21, b as $ea8dcbcb9ea1b556$export$9a302a45f65d0572, c as $ea8dcbcb9ea1b556$export$95185d699e05d4d7 } from "./usePress-CScNeV3V.js";
|
|
7
|
+
import { $ as $e9faafb641e167db$export$90fc3a17d93f704c } from "./useEvent-zvxfEnmK.js";
|
|
8
|
+
import { $ as $cc38e7bd3fc7b213$export$2bb74740c4e19def } from "./isScrollable-Dh9D9IOd.js";
|
|
9
|
+
import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "./context-4oSz1ItD.js";
|
|
10
|
+
import { $ as $03deb23ff14920c4$export$4eaf04e54aa8eed6 } from "./textSelection-exP_9srp.js";
|
|
11
11
|
function $a40c673dc9f6d9c7$export$94ed1c92c7beeb22(node, checkForOverflow) {
|
|
12
12
|
const scrollParents = [];
|
|
13
13
|
while (node && node !== document.documentElement) {
|
|
14
|
-
if ($cc38e7bd3fc7b213$export$2bb74740c4e19def(node, checkForOverflow))
|
|
15
|
-
scrollParents.push(node);
|
|
14
|
+
if ($cc38e7bd3fc7b213$export$2bb74740c4e19def(node, checkForOverflow)) scrollParents.push(node);
|
|
16
15
|
node = node.parentElement;
|
|
17
16
|
}
|
|
18
17
|
return scrollParents;
|
|
@@ -22,8 +21,7 @@ const $ef06256079686ba0$var$descriptionNodes = /* @__PURE__ */ new Map();
|
|
|
22
21
|
function $ef06256079686ba0$export$f8aeda7b10753fa1(description) {
|
|
23
22
|
let [id, setId] = useState();
|
|
24
23
|
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
25
|
-
if (!description)
|
|
26
|
-
return;
|
|
24
|
+
if (!description) return;
|
|
27
25
|
let desc = $ef06256079686ba0$var$descriptionNodes.get(description);
|
|
28
26
|
if (!desc) {
|
|
29
27
|
let id2 = `react-aria-description-${$ef06256079686ba0$var$descriptionId++}`;
|
|
@@ -38,8 +36,7 @@ function $ef06256079686ba0$export$f8aeda7b10753fa1(description) {
|
|
|
38
36
|
element: node
|
|
39
37
|
};
|
|
40
38
|
$ef06256079686ba0$var$descriptionNodes.set(description, desc);
|
|
41
|
-
} else
|
|
42
|
-
setId(desc.element.id);
|
|
39
|
+
} else setId(desc.element.id);
|
|
43
40
|
desc.refCount++;
|
|
44
41
|
return () => {
|
|
45
42
|
if (desc && --desc.refCount === 0) {
|
|
@@ -66,14 +63,10 @@ function $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollView, element) {
|
|
|
66
63
|
let borderAdjustedY = scrollView.scrollTop + parseInt(borderTopWidth, 10);
|
|
67
64
|
let maxX = borderAdjustedX + scrollView.clientWidth;
|
|
68
65
|
let maxY = borderAdjustedY + scrollView.clientHeight;
|
|
69
|
-
if (offsetX <= x)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (offsetY <= borderAdjustedY)
|
|
74
|
-
y = offsetY - parseInt(borderTopWidth, 10);
|
|
75
|
-
else if (offsetY + height > maxY)
|
|
76
|
-
y += offsetY + height - maxY;
|
|
66
|
+
if (offsetX <= x) x = offsetX - parseInt(borderLeftWidth, 10);
|
|
67
|
+
else if (offsetX + width > maxX) x += offsetX + width - maxX;
|
|
68
|
+
if (offsetY <= borderAdjustedY) y = offsetY - parseInt(borderTopWidth, 10);
|
|
69
|
+
else if (offsetY + height > maxY) y += offsetY + height - maxY;
|
|
77
70
|
scrollView.scrollLeft = x;
|
|
78
71
|
scrollView.scrollTop = y;
|
|
79
72
|
}
|
|
@@ -82,8 +75,7 @@ function $2f04cbc44ee30ce0$var$relativeOffset(ancestor, child, axis) {
|
|
|
82
75
|
let sum = 0;
|
|
83
76
|
while (child.offsetParent) {
|
|
84
77
|
sum += child[prop];
|
|
85
|
-
if (child.offsetParent === ancestor)
|
|
86
|
-
break;
|
|
78
|
+
if (child.offsetParent === ancestor) break;
|
|
87
79
|
else if (child.offsetParent.contains(ancestor)) {
|
|
88
80
|
sum -= ancestor[prop];
|
|
89
81
|
break;
|
|
@@ -115,8 +107,7 @@ function $2f04cbc44ee30ce0$export$c826860796309d1b(targetElement, opts) {
|
|
|
115
107
|
}
|
|
116
108
|
} else {
|
|
117
109
|
let scrollParents = $a40c673dc9f6d9c7$export$94ed1c92c7beeb22(targetElement);
|
|
118
|
-
for (let scrollParent of scrollParents)
|
|
119
|
-
$2f04cbc44ee30ce0$export$53a0910f038337bd(scrollParent, targetElement);
|
|
110
|
+
for (let scrollParent of scrollParents) $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollParent, targetElement);
|
|
120
111
|
}
|
|
121
112
|
}
|
|
122
113
|
}
|
|
@@ -130,20 +121,18 @@ function $8a26561d2877236e$export$c24ed0104d07eab9(props) {
|
|
|
130
121
|
onPressStart(e) {
|
|
131
122
|
e.continuePropagation();
|
|
132
123
|
if (e.pointerType === "mouse" || e.pointerType === "touch") {
|
|
133
|
-
if (onLongPressStart)
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
});
|
|
124
|
+
if (onLongPressStart) onLongPressStart({
|
|
125
|
+
...e,
|
|
126
|
+
type: "longpressstart"
|
|
127
|
+
});
|
|
138
128
|
timeRef.current = setTimeout(() => {
|
|
139
129
|
e.target.dispatchEvent(new PointerEvent("pointercancel", {
|
|
140
130
|
bubbles: true
|
|
141
131
|
}));
|
|
142
|
-
if (onLongPress)
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
});
|
|
132
|
+
if (onLongPress) onLongPress({
|
|
133
|
+
...e,
|
|
134
|
+
type: "longpress"
|
|
135
|
+
});
|
|
147
136
|
timeRef.current = void 0;
|
|
148
137
|
}, threshold);
|
|
149
138
|
if (e.pointerType === "touch") {
|
|
@@ -164,13 +153,11 @@ function $8a26561d2877236e$export$c24ed0104d07eab9(props) {
|
|
|
164
153
|
}
|
|
165
154
|
},
|
|
166
155
|
onPressEnd(e) {
|
|
167
|
-
if (timeRef.current)
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
type: "longpressend"
|
|
173
|
-
});
|
|
156
|
+
if (timeRef.current) clearTimeout(timeRef.current);
|
|
157
|
+
if (onLongPressEnd && (e.pointerType === "mouse" || e.pointerType === "touch")) onLongPressEnd({
|
|
158
|
+
...e,
|
|
159
|
+
type: "longpressend"
|
|
160
|
+
});
|
|
174
161
|
}
|
|
175
162
|
});
|
|
176
163
|
let descriptionProps = $ef06256079686ba0$export$f8aeda7b10753fa1(onLongPress && !isDisabled ? accessibilityDescription : void 0);
|
|
@@ -182,8 +169,7 @@ function $feb5ffebff200149$export$d3e3bd3e26688c04(e) {
|
|
|
182
169
|
return $c87311424ea30a05$export$e1865c3bedcd822b() ? e.altKey : e.ctrlKey;
|
|
183
170
|
}
|
|
184
171
|
function $feb5ffebff200149$export$16792effe837dba3(e) {
|
|
185
|
-
if ($c87311424ea30a05$export$9ac100e40613ea10())
|
|
186
|
-
return e.metaKey;
|
|
172
|
+
if ($c87311424ea30a05$export$9ac100e40613ea10()) return e.metaKey;
|
|
187
173
|
return e.ctrlKey;
|
|
188
174
|
}
|
|
189
175
|
const $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS = 1e3;
|
|
@@ -195,21 +181,17 @@ function $fb3050f43d946246$export$e32c88dfddc6e1d8(options) {
|
|
|
195
181
|
}).current;
|
|
196
182
|
let onKeyDown = (e) => {
|
|
197
183
|
let character = $fb3050f43d946246$var$getStringForKey(e.key);
|
|
198
|
-
if (!character || e.ctrlKey || e.metaKey || !e.currentTarget.contains(e.target))
|
|
199
|
-
return;
|
|
184
|
+
if (!character || e.ctrlKey || e.metaKey || !e.currentTarget.contains(e.target)) return;
|
|
200
185
|
if (character === " " && state.search.trim().length > 0) {
|
|
201
186
|
e.preventDefault();
|
|
202
|
-
if (!("continuePropagation" in e))
|
|
203
|
-
e.stopPropagation();
|
|
187
|
+
if (!("continuePropagation" in e)) e.stopPropagation();
|
|
204
188
|
}
|
|
205
189
|
state.search += character;
|
|
206
190
|
let key = keyboardDelegate.getKeyForSearch(state.search, selectionManager.focusedKey);
|
|
207
|
-
if (key == null)
|
|
208
|
-
key = keyboardDelegate.getKeyForSearch(state.search);
|
|
191
|
+
if (key == null) key = keyboardDelegate.getKeyForSearch(state.search);
|
|
209
192
|
if (key != null) {
|
|
210
193
|
selectionManager.setFocusedKey(key);
|
|
211
|
-
if (onTypeSelect)
|
|
212
|
-
onTypeSelect(key);
|
|
194
|
+
if (onTypeSelect) onTypeSelect(key);
|
|
213
195
|
}
|
|
214
196
|
clearTimeout(state.timeout);
|
|
215
197
|
state.timeout = setTimeout(() => {
|
|
@@ -225,8 +207,7 @@ function $fb3050f43d946246$export$e32c88dfddc6e1d8(options) {
|
|
|
225
207
|
};
|
|
226
208
|
}
|
|
227
209
|
function $fb3050f43d946246$var$getStringForKey(key) {
|
|
228
|
-
if (key.length === 1 || !/^[A-Z]/i.test(key))
|
|
229
|
-
return key;
|
|
210
|
+
if (key.length === 1 || !/^[A-Z]/i.test(key)) return key;
|
|
230
211
|
return "";
|
|
231
212
|
}
|
|
232
213
|
function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
@@ -234,10 +215,8 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
234
215
|
let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
|
|
235
216
|
let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572();
|
|
236
217
|
let onKeyDown = (e) => {
|
|
237
|
-
if (e.altKey && e.key === "Tab")
|
|
238
|
-
|
|
239
|
-
if (!ref.current.contains(e.target))
|
|
240
|
-
return;
|
|
218
|
+
if (e.altKey && e.key === "Tab") e.preventDefault();
|
|
219
|
+
if (!ref.current.contains(e.target)) return;
|
|
241
220
|
const navigateToKey = (key, childFocus) => {
|
|
242
221
|
if (key != null) {
|
|
243
222
|
if (manager.isLink(key) && linkBehavior === "selection" && selectOnFocus && !$feb5ffebff200149$export$d3e3bd3e26688c04(e)) {
|
|
@@ -250,12 +229,9 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
250
229
|
return;
|
|
251
230
|
}
|
|
252
231
|
manager.setFocusedKey(key, childFocus);
|
|
253
|
-
if (manager.isLink(key) && linkBehavior === "override")
|
|
254
|
-
|
|
255
|
-
if (
|
|
256
|
-
manager.extendSelection(key);
|
|
257
|
-
else if (selectOnFocus && !$feb5ffebff200149$export$d3e3bd3e26688c04(e))
|
|
258
|
-
manager.replaceSelection(key);
|
|
232
|
+
if (manager.isLink(key) && linkBehavior === "override") return;
|
|
233
|
+
if (e.shiftKey && manager.selectionMode === "multiple") manager.extendSelection(key);
|
|
234
|
+
else if (selectOnFocus && !$feb5ffebff200149$export$d3e3bd3e26688c04(e)) manager.replaceSelection(key);
|
|
259
235
|
}
|
|
260
236
|
};
|
|
261
237
|
switch (e.key) {
|
|
@@ -264,8 +240,7 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
264
240
|
var _delegate_getFirstKey, _delegate_getFirstKey1;
|
|
265
241
|
e.preventDefault();
|
|
266
242
|
let nextKey = manager.focusedKey != null ? delegate.getKeyBelow(manager.focusedKey) : (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate);
|
|
267
|
-
if (nextKey == null && shouldFocusWrap)
|
|
268
|
-
nextKey = (_delegate_getFirstKey1 = delegate.getFirstKey) === null || _delegate_getFirstKey1 === void 0 ? void 0 : _delegate_getFirstKey1.call(delegate, manager.focusedKey);
|
|
243
|
+
if (nextKey == null && shouldFocusWrap) nextKey = (_delegate_getFirstKey1 = delegate.getFirstKey) === null || _delegate_getFirstKey1 === void 0 ? void 0 : _delegate_getFirstKey1.call(delegate, manager.focusedKey);
|
|
269
244
|
navigateToKey(nextKey);
|
|
270
245
|
}
|
|
271
246
|
break;
|
|
@@ -274,8 +249,7 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
274
249
|
var _delegate_getLastKey, _delegate_getLastKey1;
|
|
275
250
|
e.preventDefault();
|
|
276
251
|
let nextKey = manager.focusedKey != null ? delegate.getKeyAbove(manager.focusedKey) : (_delegate_getLastKey = delegate.getLastKey) === null || _delegate_getLastKey === void 0 ? void 0 : _delegate_getLastKey.call(delegate);
|
|
277
|
-
if (nextKey == null && shouldFocusWrap)
|
|
278
|
-
nextKey = (_delegate_getLastKey1 = delegate.getLastKey) === null || _delegate_getLastKey1 === void 0 ? void 0 : _delegate_getLastKey1.call(delegate, manager.focusedKey);
|
|
252
|
+
if (nextKey == null && shouldFocusWrap) nextKey = (_delegate_getLastKey1 = delegate.getLastKey) === null || _delegate_getLastKey1 === void 0 ? void 0 : _delegate_getLastKey1.call(delegate, manager.focusedKey);
|
|
279
253
|
navigateToKey(nextKey);
|
|
280
254
|
}
|
|
281
255
|
break;
|
|
@@ -284,8 +258,7 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
284
258
|
var _delegate_getFirstKey2, _delegate_getLastKey2;
|
|
285
259
|
e.preventDefault();
|
|
286
260
|
let nextKey = delegate.getKeyLeftOf(manager.focusedKey);
|
|
287
|
-
if (nextKey == null && shouldFocusWrap)
|
|
288
|
-
nextKey = direction === "rtl" ? (_delegate_getFirstKey2 = delegate.getFirstKey) === null || _delegate_getFirstKey2 === void 0 ? void 0 : _delegate_getFirstKey2.call(delegate, manager.focusedKey) : (_delegate_getLastKey2 = delegate.getLastKey) === null || _delegate_getLastKey2 === void 0 ? void 0 : _delegate_getLastKey2.call(delegate, manager.focusedKey);
|
|
261
|
+
if (nextKey == null && shouldFocusWrap) nextKey = direction === "rtl" ? (_delegate_getFirstKey2 = delegate.getFirstKey) === null || _delegate_getFirstKey2 === void 0 ? void 0 : _delegate_getFirstKey2.call(delegate, manager.focusedKey) : (_delegate_getLastKey2 = delegate.getLastKey) === null || _delegate_getLastKey2 === void 0 ? void 0 : _delegate_getLastKey2.call(delegate, manager.focusedKey);
|
|
289
262
|
navigateToKey(nextKey, direction === "rtl" ? "first" : "last");
|
|
290
263
|
}
|
|
291
264
|
break;
|
|
@@ -294,8 +267,7 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
294
267
|
var _delegate_getLastKey3, _delegate_getFirstKey3;
|
|
295
268
|
e.preventDefault();
|
|
296
269
|
let nextKey = delegate.getKeyRightOf(manager.focusedKey);
|
|
297
|
-
if (nextKey == null && shouldFocusWrap)
|
|
298
|
-
nextKey = direction === "rtl" ? (_delegate_getLastKey3 = delegate.getLastKey) === null || _delegate_getLastKey3 === void 0 ? void 0 : _delegate_getLastKey3.call(delegate, manager.focusedKey) : (_delegate_getFirstKey3 = delegate.getFirstKey) === null || _delegate_getFirstKey3 === void 0 ? void 0 : _delegate_getFirstKey3.call(delegate, manager.focusedKey);
|
|
270
|
+
if (nextKey == null && shouldFocusWrap) nextKey = direction === "rtl" ? (_delegate_getLastKey3 = delegate.getLastKey) === null || _delegate_getLastKey3 === void 0 ? void 0 : _delegate_getLastKey3.call(delegate, manager.focusedKey) : (_delegate_getFirstKey3 = delegate.getFirstKey) === null || _delegate_getFirstKey3 === void 0 ? void 0 : _delegate_getFirstKey3.call(delegate, manager.focusedKey);
|
|
299
271
|
navigateToKey(nextKey, direction === "rtl" ? "last" : "first");
|
|
300
272
|
}
|
|
301
273
|
break;
|
|
@@ -304,10 +276,8 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
304
276
|
e.preventDefault();
|
|
305
277
|
let firstKey = delegate.getFirstKey(manager.focusedKey, $feb5ffebff200149$export$16792effe837dba3(e));
|
|
306
278
|
manager.setFocusedKey(firstKey);
|
|
307
|
-
if ($feb5ffebff200149$export$16792effe837dba3(e) && e.shiftKey && manager.selectionMode === "multiple")
|
|
308
|
-
|
|
309
|
-
else if (selectOnFocus)
|
|
310
|
-
manager.replaceSelection(firstKey);
|
|
279
|
+
if ($feb5ffebff200149$export$16792effe837dba3(e) && e.shiftKey && manager.selectionMode === "multiple") manager.extendSelection(firstKey);
|
|
280
|
+
else if (selectOnFocus) manager.replaceSelection(firstKey);
|
|
311
281
|
}
|
|
312
282
|
break;
|
|
313
283
|
case "End":
|
|
@@ -315,10 +285,8 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
315
285
|
e.preventDefault();
|
|
316
286
|
let lastKey = delegate.getLastKey(manager.focusedKey, $feb5ffebff200149$export$16792effe837dba3(e));
|
|
317
287
|
manager.setFocusedKey(lastKey);
|
|
318
|
-
if ($feb5ffebff200149$export$16792effe837dba3(e) && e.shiftKey && manager.selectionMode === "multiple")
|
|
319
|
-
|
|
320
|
-
else if (selectOnFocus)
|
|
321
|
-
manager.replaceSelection(lastKey);
|
|
288
|
+
if ($feb5ffebff200149$export$16792effe837dba3(e) && e.shiftKey && manager.selectionMode === "multiple") manager.extendSelection(lastKey);
|
|
289
|
+
else if (selectOnFocus) manager.replaceSelection(lastKey);
|
|
322
290
|
}
|
|
323
291
|
break;
|
|
324
292
|
case "PageDown":
|
|
@@ -350,8 +318,7 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
350
318
|
break;
|
|
351
319
|
case "Tab":
|
|
352
320
|
if (!allowsTabNavigation) {
|
|
353
|
-
if (e.shiftKey)
|
|
354
|
-
ref.current.focus();
|
|
321
|
+
if (e.shiftKey) ref.current.focus();
|
|
355
322
|
else {
|
|
356
323
|
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(ref.current, {
|
|
357
324
|
tabbable: true
|
|
@@ -360,11 +327,9 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
360
327
|
let last;
|
|
361
328
|
do {
|
|
362
329
|
last = walker.lastChild();
|
|
363
|
-
if (last)
|
|
364
|
-
next = last;
|
|
330
|
+
if (last) next = last;
|
|
365
331
|
} while (last);
|
|
366
|
-
if (next && !next.contains(document.activeElement))
|
|
367
|
-
$7215afc6de606d6b$export$de79e2c695e052f3(next);
|
|
332
|
+
if (next && !next.contains(document.activeElement)) $7215afc6de606d6b$export$de79e2c695e052f3(next);
|
|
368
333
|
}
|
|
369
334
|
break;
|
|
370
335
|
}
|
|
@@ -382,27 +347,22 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
382
347
|
});
|
|
383
348
|
let onFocus = (e) => {
|
|
384
349
|
if (manager.isFocused) {
|
|
385
|
-
if (!e.currentTarget.contains(e.target))
|
|
386
|
-
manager.setFocused(false);
|
|
350
|
+
if (!e.currentTarget.contains(e.target)) manager.setFocused(false);
|
|
387
351
|
return;
|
|
388
352
|
}
|
|
389
|
-
if (!e.currentTarget.contains(e.target))
|
|
390
|
-
return;
|
|
353
|
+
if (!e.currentTarget.contains(e.target)) return;
|
|
391
354
|
manager.setFocused(true);
|
|
392
355
|
if (manager.focusedKey == null) {
|
|
393
356
|
let navigateToFirstKey = (key) => {
|
|
394
357
|
if (key != null) {
|
|
395
358
|
manager.setFocusedKey(key);
|
|
396
|
-
if (selectOnFocus)
|
|
397
|
-
manager.replaceSelection(key);
|
|
359
|
+
if (selectOnFocus) manager.replaceSelection(key);
|
|
398
360
|
}
|
|
399
361
|
};
|
|
400
362
|
let relatedTarget = e.relatedTarget;
|
|
401
363
|
var _manager_lastSelectedKey, _manager_firstSelectedKey;
|
|
402
|
-
if (relatedTarget && e.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING)
|
|
403
|
-
|
|
404
|
-
else
|
|
405
|
-
navigateToFirstKey((_manager_firstSelectedKey = manager.firstSelectedKey) !== null && _manager_firstSelectedKey !== void 0 ? _manager_firstSelectedKey : delegate.getFirstKey());
|
|
364
|
+
if (relatedTarget && e.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING) navigateToFirstKey((_manager_lastSelectedKey = manager.lastSelectedKey) !== null && _manager_lastSelectedKey !== void 0 ? _manager_lastSelectedKey : delegate.getLastKey());
|
|
365
|
+
else navigateToFirstKey((_manager_firstSelectedKey = manager.firstSelectedKey) !== null && _manager_firstSelectedKey !== void 0 ? _manager_firstSelectedKey : delegate.getFirstKey());
|
|
406
366
|
} else if (!isVirtualized) {
|
|
407
367
|
scrollRef.current.scrollTop = scrollPos.current.top;
|
|
408
368
|
scrollRef.current.scrollLeft = scrollPos.current.left;
|
|
@@ -410,40 +370,33 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
410
370
|
if (!isVirtualized && manager.focusedKey != null) {
|
|
411
371
|
let element = scrollRef.current.querySelector(`[data-key="${CSS.escape(manager.focusedKey.toString())}"]`);
|
|
412
372
|
if (element) {
|
|
413
|
-
if (!element.contains(document.activeElement))
|
|
414
|
-
$7215afc6de606d6b$export$de79e2c695e052f3(element);
|
|
373
|
+
if (!element.contains(document.activeElement)) $7215afc6de606d6b$export$de79e2c695e052f3(element);
|
|
415
374
|
let modality = $507fabe10e71c6fb$export$630ff653c5ada6a9();
|
|
416
|
-
if (modality === "keyboard")
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
});
|
|
375
|
+
if (modality === "keyboard") $2f04cbc44ee30ce0$export$c826860796309d1b(element, {
|
|
376
|
+
containingElement: ref.current
|
|
377
|
+
});
|
|
420
378
|
}
|
|
421
379
|
}
|
|
422
380
|
};
|
|
423
381
|
let onBlur = (e) => {
|
|
424
|
-
if (!e.currentTarget.contains(e.relatedTarget))
|
|
425
|
-
manager.setFocused(false);
|
|
382
|
+
if (!e.currentTarget.contains(e.relatedTarget)) manager.setFocused(false);
|
|
426
383
|
};
|
|
427
384
|
const autoFocusRef = useRef(autoFocus);
|
|
428
385
|
useEffect(() => {
|
|
429
386
|
if (autoFocusRef.current) {
|
|
430
387
|
let focusedKey = null;
|
|
431
|
-
if (autoFocus === "first")
|
|
432
|
-
|
|
433
|
-
if (autoFocus === "last")
|
|
434
|
-
focusedKey = delegate.getLastKey();
|
|
388
|
+
if (autoFocus === "first") focusedKey = delegate.getFirstKey();
|
|
389
|
+
if (autoFocus === "last") focusedKey = delegate.getLastKey();
|
|
435
390
|
let selectedKeys = manager.selectedKeys;
|
|
436
391
|
if (selectedKeys.size) {
|
|
437
|
-
for (let key of selectedKeys)
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
}
|
|
392
|
+
for (let key of selectedKeys) if (manager.canSelectItem(key)) {
|
|
393
|
+
focusedKey = key;
|
|
394
|
+
break;
|
|
395
|
+
}
|
|
442
396
|
}
|
|
443
397
|
manager.setFocused(true);
|
|
444
398
|
manager.setFocusedKey(focusedKey);
|
|
445
|
-
if (focusedKey == null && !shouldUseVirtualFocus)
|
|
446
|
-
$6a99195332edec8b$export$80f3e147d781571c(ref.current);
|
|
399
|
+
if (focusedKey == null && !shouldUseVirtualFocus) $6a99195332edec8b$export$80f3e147d781571c(ref.current);
|
|
447
400
|
}
|
|
448
401
|
}, []);
|
|
449
402
|
let lastFocusedKey = useRef(manager.focusedKey);
|
|
@@ -452,16 +405,13 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
452
405
|
if (manager.isFocused && manager.focusedKey != null && (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current)) {
|
|
453
406
|
let element = scrollRef.current.querySelector(`[data-key="${CSS.escape(manager.focusedKey.toString())}"]`);
|
|
454
407
|
if (element && (modality === "keyboard" || autoFocusRef.current)) {
|
|
455
|
-
if (!isVirtualized)
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
containingElement: ref.current
|
|
460
|
-
});
|
|
408
|
+
if (!isVirtualized) $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollRef.current, element);
|
|
409
|
+
if (modality !== "virtual") $2f04cbc44ee30ce0$export$c826860796309d1b(element, {
|
|
410
|
+
containingElement: ref.current
|
|
411
|
+
});
|
|
461
412
|
}
|
|
462
413
|
}
|
|
463
|
-
if (manager.isFocused && manager.focusedKey == null && lastFocusedKey.current != null)
|
|
464
|
-
$6a99195332edec8b$export$80f3e147d781571c(ref.current);
|
|
414
|
+
if (manager.isFocused && manager.focusedKey == null && lastFocusedKey.current != null) $6a99195332edec8b$export$80f3e147d781571c(ref.current);
|
|
465
415
|
lastFocusedKey.current = manager.focusedKey;
|
|
466
416
|
autoFocusRef.current = false;
|
|
467
417
|
}, [
|
|
@@ -484,11 +434,9 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
484
434
|
keyboardDelegate: delegate,
|
|
485
435
|
selectionManager: manager
|
|
486
436
|
});
|
|
487
|
-
if (!disallowTypeAhead)
|
|
488
|
-
handlers = $3ef42575df84b30b$export$9d1611c77c2fe928(typeSelectProps, handlers);
|
|
437
|
+
if (!disallowTypeAhead) handlers = $3ef42575df84b30b$export$9d1611c77c2fe928(typeSelectProps, handlers);
|
|
489
438
|
let tabIndex;
|
|
490
|
-
if (!shouldUseVirtualFocus)
|
|
491
|
-
tabIndex = manager.focusedKey == null ? 0 : -1;
|
|
439
|
+
if (!shouldUseVirtualFocus) tabIndex = manager.focusedKey == null ? 0 : -1;
|
|
492
440
|
return {
|
|
493
441
|
collectionProps: {
|
|
494
442
|
...handlers,
|
|
@@ -500,40 +448,31 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
500
448
|
let { selectionManager: manager, key, ref, shouldSelectOnPressUp, shouldUseVirtualFocus, focus, isDisabled, onAction, allowsDifferentPressOrigin, linkBehavior = "action" } = options;
|
|
501
449
|
let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572();
|
|
502
450
|
let onSelect = (e) => {
|
|
503
|
-
if (e.pointerType === "keyboard" && $feb5ffebff200149$export$d3e3bd3e26688c04(e))
|
|
504
|
-
manager.toggleSelection(key);
|
|
451
|
+
if (e.pointerType === "keyboard" && $feb5ffebff200149$export$d3e3bd3e26688c04(e)) manager.toggleSelection(key);
|
|
505
452
|
else {
|
|
506
|
-
if (manager.selectionMode === "none")
|
|
507
|
-
return;
|
|
453
|
+
if (manager.selectionMode === "none") return;
|
|
508
454
|
if (manager.isLink(key)) {
|
|
509
455
|
if (linkBehavior === "selection") {
|
|
510
456
|
let itemProps2 = manager.getItemProps(key);
|
|
511
457
|
router.open(ref.current, e, itemProps2.href, itemProps2.routerOptions);
|
|
512
458
|
manager.setSelectedKeys(manager.selectedKeys);
|
|
513
459
|
return;
|
|
514
|
-
} else if (linkBehavior === "override" || linkBehavior === "none")
|
|
515
|
-
return;
|
|
460
|
+
} else if (linkBehavior === "override" || linkBehavior === "none") return;
|
|
516
461
|
}
|
|
517
462
|
if (manager.selectionMode === "single") {
|
|
518
|
-
if (manager.isSelected(key) && !manager.disallowEmptySelection)
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
manager.replaceSelection(key);
|
|
522
|
-
} else if (e && e.shiftKey)
|
|
523
|
-
manager.extendSelection(key);
|
|
463
|
+
if (manager.isSelected(key) && !manager.disallowEmptySelection) manager.toggleSelection(key);
|
|
464
|
+
else manager.replaceSelection(key);
|
|
465
|
+
} else if (e && e.shiftKey) manager.extendSelection(key);
|
|
524
466
|
else if (manager.selectionBehavior === "toggle" || e && ($feb5ffebff200149$export$16792effe837dba3(e) || e.pointerType === "touch" || e.pointerType === "virtual"))
|
|
525
467
|
manager.toggleSelection(key);
|
|
526
|
-
else
|
|
527
|
-
manager.replaceSelection(key);
|
|
468
|
+
else manager.replaceSelection(key);
|
|
528
469
|
}
|
|
529
470
|
};
|
|
530
471
|
useEffect(() => {
|
|
531
472
|
let isFocused = key === manager.focusedKey;
|
|
532
473
|
if (isFocused && manager.isFocused && !shouldUseVirtualFocus) {
|
|
533
|
-
if (focus)
|
|
534
|
-
|
|
535
|
-
else if (document.activeElement !== ref.current)
|
|
536
|
-
$6a99195332edec8b$export$80f3e147d781571c(ref.current);
|
|
474
|
+
if (focus) focus();
|
|
475
|
+
else if (document.activeElement !== ref.current) $6a99195332edec8b$export$80f3e147d781571c(ref.current);
|
|
537
476
|
}
|
|
538
477
|
}, [
|
|
539
478
|
ref,
|
|
@@ -545,18 +484,15 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
545
484
|
]);
|
|
546
485
|
isDisabled = isDisabled || manager.isDisabled(key);
|
|
547
486
|
let itemProps = {};
|
|
548
|
-
if (!shouldUseVirtualFocus && !isDisabled)
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
itemProps.onMouseDown = (e) => {
|
|
558
|
-
e.preventDefault();
|
|
559
|
-
};
|
|
487
|
+
if (!shouldUseVirtualFocus && !isDisabled) itemProps = {
|
|
488
|
+
tabIndex: key === manager.focusedKey ? 0 : -1,
|
|
489
|
+
onFocus(e) {
|
|
490
|
+
if (e.target === ref.current) manager.setFocusedKey(key);
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
else if (isDisabled) itemProps.onMouseDown = (e) => {
|
|
494
|
+
e.preventDefault();
|
|
495
|
+
};
|
|
560
496
|
let isLinkOverride = manager.isLink(key) && linkBehavior === "override";
|
|
561
497
|
let hasLinkAction = manager.isLink(key) && linkBehavior !== "selection" && linkBehavior !== "none";
|
|
562
498
|
let allowsSelection = !isDisabled && manager.canSelectItem(key) && !isLinkOverride;
|
|
@@ -569,8 +505,7 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
569
505
|
let longPressEnabledOnPressStart = useRef(false);
|
|
570
506
|
let hadPrimaryActionOnPressStart = useRef(false);
|
|
571
507
|
let performAction = (e) => {
|
|
572
|
-
if (onAction)
|
|
573
|
-
onAction();
|
|
508
|
+
if (onAction) onAction();
|
|
574
509
|
if (hasLinkAction) {
|
|
575
510
|
let itemProps2 = manager.getItemProps(key);
|
|
576
511
|
router.open(ref.current, e, itemProps2.href, itemProps2.routerOptions);
|
|
@@ -581,22 +516,17 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
581
516
|
itemPressProps.onPressStart = (e) => {
|
|
582
517
|
modality.current = e.pointerType;
|
|
583
518
|
longPressEnabledOnPressStart.current = longPressEnabled;
|
|
584
|
-
if (e.pointerType === "keyboard" && (!hasAction || $880e95eb8b93ba9a$var$isSelectionKey()))
|
|
585
|
-
|
|
519
|
+
if (e.pointerType === "keyboard" && (!hasAction || $880e95eb8b93ba9a$var$isSelectionKey())) onSelect(e);
|
|
520
|
+
};
|
|
521
|
+
if (!allowsDifferentPressOrigin) itemPressProps.onPress = (e) => {
|
|
522
|
+
if (hasPrimaryAction || hasSecondaryAction && e.pointerType !== "mouse") {
|
|
523
|
+
if (e.pointerType === "keyboard" && !$880e95eb8b93ba9a$var$isActionKey()) return;
|
|
524
|
+
performAction(e);
|
|
525
|
+
} else if (e.pointerType !== "keyboard" && allowsSelection) onSelect(e);
|
|
586
526
|
};
|
|
587
|
-
if (!allowsDifferentPressOrigin)
|
|
588
|
-
itemPressProps.onPress = (e) => {
|
|
589
|
-
if (hasPrimaryAction || hasSecondaryAction && e.pointerType !== "mouse") {
|
|
590
|
-
if (e.pointerType === "keyboard" && !$880e95eb8b93ba9a$var$isActionKey())
|
|
591
|
-
return;
|
|
592
|
-
performAction(e);
|
|
593
|
-
} else if (e.pointerType !== "keyboard" && allowsSelection)
|
|
594
|
-
onSelect(e);
|
|
595
|
-
};
|
|
596
527
|
else {
|
|
597
528
|
itemPressProps.onPressUp = hasPrimaryAction ? null : (e) => {
|
|
598
|
-
if (e.pointerType !== "keyboard" && allowsSelection)
|
|
599
|
-
onSelect(e);
|
|
529
|
+
if (e.pointerType !== "keyboard" && allowsSelection) onSelect(e);
|
|
600
530
|
};
|
|
601
531
|
itemPressProps.onPress = hasPrimaryAction ? performAction : null;
|
|
602
532
|
}
|
|
@@ -605,15 +535,12 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
605
535
|
modality.current = e.pointerType;
|
|
606
536
|
longPressEnabledOnPressStart.current = longPressEnabled;
|
|
607
537
|
hadPrimaryActionOnPressStart.current = hasPrimaryAction;
|
|
608
|
-
if (allowsSelection && (e.pointerType === "mouse" && !hasPrimaryAction || e.pointerType === "keyboard" && (!allowsActions || $880e95eb8b93ba9a$var$isSelectionKey())))
|
|
609
|
-
onSelect(e);
|
|
538
|
+
if (allowsSelection && (e.pointerType === "mouse" && !hasPrimaryAction || e.pointerType === "keyboard" && (!allowsActions || $880e95eb8b93ba9a$var$isSelectionKey()))) onSelect(e);
|
|
610
539
|
};
|
|
611
540
|
itemPressProps.onPress = (e) => {
|
|
612
541
|
if (e.pointerType === "touch" || e.pointerType === "pen" || e.pointerType === "virtual" || e.pointerType === "keyboard" && hasAction && $880e95eb8b93ba9a$var$isActionKey() || e.pointerType === "mouse" && hadPrimaryActionOnPressStart.current) {
|
|
613
|
-
if (hasAction)
|
|
614
|
-
|
|
615
|
-
else if (allowsSelection)
|
|
616
|
-
onSelect(e);
|
|
542
|
+
if (hasAction) performAction(e);
|
|
543
|
+
else if (allowsSelection) onSelect(e);
|
|
617
544
|
}
|
|
618
545
|
};
|
|
619
546
|
}
|
|
@@ -637,12 +564,10 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
637
564
|
}
|
|
638
565
|
});
|
|
639
566
|
let onDragStartCapture = (e) => {
|
|
640
|
-
if (modality.current === "touch" && longPressEnabledOnPressStart.current)
|
|
641
|
-
e.preventDefault();
|
|
567
|
+
if (modality.current === "touch" && longPressEnabledOnPressStart.current) e.preventDefault();
|
|
642
568
|
};
|
|
643
569
|
let onClick = manager.isLink(key) ? (e) => {
|
|
644
|
-
if (!$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening)
|
|
645
|
-
e.preventDefault();
|
|
570
|
+
if (!$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening) e.preventDefault();
|
|
646
571
|
} : void 0;
|
|
647
572
|
return {
|
|
648
573
|
itemProps: $3ef42575df84b30b$export$9d1611c77c2fe928(itemProps, allowsSelection || hasPrimaryAction ? pressProps : {}, longPressEnabled ? longPressProps : {}, {
|
|
@@ -674,14 +599,12 @@ class $eb2240fc39a57fa5$export$bf788dd355e3a401 {
|
|
|
674
599
|
*iterateCollection(props) {
|
|
675
600
|
let { children, items } = props;
|
|
676
601
|
if (typeof children === "function") {
|
|
677
|
-
if (!items)
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
renderer: children
|
|
684
|
-
});
|
|
602
|
+
if (!items) throw new Error("props.children was a function but props.items is missing");
|
|
603
|
+
for (let item of props.items) yield* this.getFullNode({
|
|
604
|
+
value: item
|
|
605
|
+
}, {
|
|
606
|
+
renderer: children
|
|
607
|
+
});
|
|
685
608
|
} else {
|
|
686
609
|
let items2 = [];
|
|
687
610
|
React__default.Children.forEach(children, (child) => {
|
|
@@ -701,16 +624,13 @@ class $eb2240fc39a57fa5$export$bf788dd355e3a401 {
|
|
|
701
624
|
}
|
|
702
625
|
}
|
|
703
626
|
getKey(item, partialNode, state, parentKey) {
|
|
704
|
-
if (item.key != null)
|
|
705
|
-
|
|
706
|
-
if (partialNode.type === "cell" && partialNode.key != null)
|
|
707
|
-
return `${parentKey}${partialNode.key}`;
|
|
627
|
+
if (item.key != null) return item.key;
|
|
628
|
+
if (partialNode.type === "cell" && partialNode.key != null) return `${parentKey}${partialNode.key}`;
|
|
708
629
|
let v = partialNode.value;
|
|
709
630
|
if (v != null) {
|
|
710
631
|
var _v_key;
|
|
711
632
|
let key = (_v_key = v.key) !== null && _v_key !== void 0 ? _v_key : v.id;
|
|
712
|
-
if (key == null)
|
|
713
|
-
throw new Error("No key found for item");
|
|
633
|
+
if (key == null) throw new Error("No key found for item");
|
|
714
634
|
return key;
|
|
715
635
|
}
|
|
716
636
|
return parentKey ? `${parentKey}.${partialNode.index}` : `$.${partialNode.index}`;
|
|
@@ -745,8 +665,7 @@ class $eb2240fc39a57fa5$export$bf788dd355e3a401 {
|
|
|
745
665
|
let childNode = result.value;
|
|
746
666
|
partialNode.index = index;
|
|
747
667
|
let nodeKey = childNode.key;
|
|
748
|
-
if (!nodeKey)
|
|
749
|
-
nodeKey = childNode.element ? null : this.getKey(element, partialNode, state, parentKey);
|
|
668
|
+
if (!nodeKey) nodeKey = childNode.element ? null : this.getKey(element, partialNode, state, parentKey);
|
|
750
669
|
let nodes = this.getFullNode({
|
|
751
670
|
...childNode,
|
|
752
671
|
key: nodeKey,
|
|
@@ -758,10 +677,8 @@ class $eb2240fc39a57fa5$export$bf788dd355e3a401 {
|
|
|
758
677
|
];
|
|
759
678
|
for (let node2 of children) {
|
|
760
679
|
node2.value = childNode.value || partialNode.value;
|
|
761
|
-
if (node2.value)
|
|
762
|
-
|
|
763
|
-
if (partialNode.type && node2.type !== partialNode.type)
|
|
764
|
-
throw new Error(`Unsupported type <${$eb2240fc39a57fa5$var$capitalize(node2.type)}> in <${$eb2240fc39a57fa5$var$capitalize(parentNode.type)}>. Only <${$eb2240fc39a57fa5$var$capitalize(partialNode.type)}> is supported.`);
|
|
680
|
+
if (node2.value) this.cache.set(node2.value, node2);
|
|
681
|
+
if (partialNode.type && node2.type !== partialNode.type) throw new Error(`Unsupported type <${$eb2240fc39a57fa5$var$capitalize(node2.type)}> in <${$eb2240fc39a57fa5$var$capitalize(parentNode.type)}>. Only <${$eb2240fc39a57fa5$var$capitalize(partialNode.type)}> is supported.`);
|
|
765
682
|
index++;
|
|
766
683
|
yield node2;
|
|
767
684
|
}
|
|
@@ -769,8 +686,7 @@ class $eb2240fc39a57fa5$export$bf788dd355e3a401 {
|
|
|
769
686
|
}
|
|
770
687
|
return;
|
|
771
688
|
}
|
|
772
|
-
if (partialNode.key == null)
|
|
773
|
-
return;
|
|
689
|
+
if (partialNode.key == null) return;
|
|
774
690
|
let builder = this;
|
|
775
691
|
let node = {
|
|
776
692
|
type: partialNode.type,
|
|
@@ -787,8 +703,7 @@ class $eb2240fc39a57fa5$export$bf788dd355e3a401 {
|
|
|
787
703
|
shouldInvalidate: partialNode.shouldInvalidate,
|
|
788
704
|
hasChildNodes: partialNode.hasChildNodes,
|
|
789
705
|
childNodes: $eb2240fc39a57fa5$var$iterable(function* () {
|
|
790
|
-
if (!partialNode.hasChildNodes)
|
|
791
|
-
return;
|
|
706
|
+
if (!partialNode.hasChildNodes) return;
|
|
792
707
|
let index = 0;
|
|
793
708
|
for (let child of partialNode.childNodes()) {
|
|
794
709
|
if (child.key != null)
|
|
@@ -813,10 +728,8 @@ function $eb2240fc39a57fa5$var$iterable(iterator) {
|
|
|
813
728
|
let iterable = null;
|
|
814
729
|
return {
|
|
815
730
|
*[Symbol.iterator]() {
|
|
816
|
-
for (let item of cache)
|
|
817
|
-
|
|
818
|
-
if (!iterable)
|
|
819
|
-
iterable = iterator();
|
|
731
|
+
for (let item of cache) yield item;
|
|
732
|
+
if (!iterable) iterable = iterator();
|
|
820
733
|
for (let item of iterable) {
|
|
821
734
|
cache.push(item);
|
|
822
735
|
yield item;
|
|
@@ -825,12 +738,9 @@ function $eb2240fc39a57fa5$var$iterable(iterator) {
|
|
|
825
738
|
};
|
|
826
739
|
}
|
|
827
740
|
function $eb2240fc39a57fa5$var$compose(outer, inner) {
|
|
828
|
-
if (outer && inner)
|
|
829
|
-
|
|
830
|
-
if (
|
|
831
|
-
return outer;
|
|
832
|
-
if (inner)
|
|
833
|
-
return inner;
|
|
741
|
+
if (outer && inner) return (element) => outer(inner(element));
|
|
742
|
+
if (outer) return outer;
|
|
743
|
+
if (inner) return inner;
|
|
834
744
|
}
|
|
835
745
|
function $eb2240fc39a57fa5$var$capitalize(str) {
|
|
836
746
|
return str[0].toUpperCase() + str.slice(1);
|
|
@@ -839,8 +749,7 @@ function $7613b1592d41b092$export$6cd28814d92fa9c9(props, factory, context) {
|
|
|
839
749
|
let builder = useMemo(() => new $eb2240fc39a57fa5$export$bf788dd355e3a401(), []);
|
|
840
750
|
let { children, items, collection } = props;
|
|
841
751
|
let result = useMemo(() => {
|
|
842
|
-
if (collection)
|
|
843
|
-
return collection;
|
|
752
|
+
if (collection) return collection;
|
|
844
753
|
let nodes = builder.build({
|
|
845
754
|
children,
|
|
846
755
|
items
|
|
@@ -857,8 +766,7 @@ function $7613b1592d41b092$export$6cd28814d92fa9c9(props, factory, context) {
|
|
|
857
766
|
return result;
|
|
858
767
|
}
|
|
859
768
|
function $c5a24bc478652b5f$export$1005530eda016c13(node, collection) {
|
|
860
|
-
if (typeof collection.getChildren === "function")
|
|
861
|
-
return collection.getChildren(node.key);
|
|
769
|
+
if (typeof collection.getChildren === "function") return collection.getChildren(node.key);
|
|
862
770
|
return node.childNodes;
|
|
863
771
|
}
|
|
864
772
|
function $c5a24bc478652b5f$export$fbdeaa6a76694f71(iterable) {
|
|
@@ -871,13 +779,11 @@ function $c5a24bc478652b5f$export$5f3398f8733f90e2(iterable, index) {
|
|
|
871
779
|
}
|
|
872
780
|
function $c5a24bc478652b5f$export$7475b2c64539e4cf(iterable) {
|
|
873
781
|
let lastItem = void 0;
|
|
874
|
-
for (let value of iterable)
|
|
875
|
-
lastItem = value;
|
|
782
|
+
for (let value of iterable) lastItem = value;
|
|
876
783
|
return lastItem;
|
|
877
784
|
}
|
|
878
785
|
function $c5a24bc478652b5f$export$8c434b3a7a4dad6(collection, a, b) {
|
|
879
|
-
if (a.parentKey === b.parentKey)
|
|
880
|
-
return a.index - b.index;
|
|
786
|
+
if (a.parentKey === b.parentKey) return a.index - b.index;
|
|
881
787
|
let aAncestors = [
|
|
882
788
|
...$c5a24bc478652b5f$var$getAncestors(collection, a),
|
|
883
789
|
a
|
|
@@ -892,10 +798,8 @@ function $c5a24bc478652b5f$export$8c434b3a7a4dad6(collection, a, b) {
|
|
|
892
798
|
b = bAncestors[firstNonMatchingAncestor];
|
|
893
799
|
return a.index - b.index;
|
|
894
800
|
}
|
|
895
|
-
if (aAncestors.findIndex((node) => node === b) >= 0)
|
|
896
|
-
|
|
897
|
-
else if (bAncestors.findIndex((node) => node === a) >= 0)
|
|
898
|
-
return -1;
|
|
801
|
+
if (aAncestors.findIndex((node) => node === b) >= 0) return 1;
|
|
802
|
+
else if (bAncestors.findIndex((node) => node === a) >= 0) return -1;
|
|
899
803
|
return -1;
|
|
900
804
|
}
|
|
901
805
|
function $c5a24bc478652b5f$var$getAncestors(collection, node) {
|
|
@@ -919,8 +823,7 @@ var useSyncExternalStoreShim_production_min = {};
|
|
|
919
823
|
*/
|
|
920
824
|
var hasRequiredUseSyncExternalStoreShim_production_min;
|
|
921
825
|
function requireUseSyncExternalStoreShim_production_min() {
|
|
922
|
-
if (hasRequiredUseSyncExternalStoreShim_production_min)
|
|
923
|
-
return useSyncExternalStoreShim_production_min;
|
|
826
|
+
if (hasRequiredUseSyncExternalStoreShim_production_min) return useSyncExternalStoreShim_production_min;
|
|
924
827
|
hasRequiredUseSyncExternalStoreShim_production_min = 1;
|
|
925
828
|
var e = React__default;
|
|
926
829
|
function h(a, b) {
|
|
@@ -972,8 +875,7 @@ var useSyncExternalStoreShim_development = {};
|
|
|
972
875
|
*/
|
|
973
876
|
var hasRequiredUseSyncExternalStoreShim_development;
|
|
974
877
|
function requireUseSyncExternalStoreShim_development() {
|
|
975
|
-
if (hasRequiredUseSyncExternalStoreShim_development)
|
|
976
|
-
return useSyncExternalStoreShim_development;
|
|
878
|
+
if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
|
|
977
879
|
hasRequiredUseSyncExternalStoreShim_development = 1;
|
|
978
880
|
if (process.env.NODE_ENV !== "production") {
|
|
979
881
|
(function() {
|
|
@@ -1185,10 +1087,8 @@ class $7135fc7d473fd974$var$BaseNode {
|
|
|
1185
1087
|
}
|
|
1186
1088
|
appendChild(child) {
|
|
1187
1089
|
this.ownerDocument.startTransaction();
|
|
1188
|
-
if (child.parentNode)
|
|
1189
|
-
|
|
1190
|
-
if (this.firstChild == null)
|
|
1191
|
-
this.firstChild = child;
|
|
1090
|
+
if (child.parentNode) child.parentNode.removeChild(child);
|
|
1091
|
+
if (this.firstChild == null) this.firstChild = child;
|
|
1192
1092
|
if (this.lastChild) {
|
|
1193
1093
|
this.lastChild.nextSibling = child;
|
|
1194
1094
|
child.index = this.lastChild.index + 1;
|
|
@@ -1207,18 +1107,14 @@ class $7135fc7d473fd974$var$BaseNode {
|
|
|
1207
1107
|
this.ownerDocument.queueUpdate();
|
|
1208
1108
|
}
|
|
1209
1109
|
insertBefore(newNode, referenceNode) {
|
|
1210
|
-
if (referenceNode == null)
|
|
1211
|
-
return this.appendChild(newNode);
|
|
1110
|
+
if (referenceNode == null) return this.appendChild(newNode);
|
|
1212
1111
|
this.ownerDocument.startTransaction();
|
|
1213
|
-
if (newNode.parentNode)
|
|
1214
|
-
newNode.parentNode.removeChild(newNode);
|
|
1112
|
+
if (newNode.parentNode) newNode.parentNode.removeChild(newNode);
|
|
1215
1113
|
newNode.nextSibling = referenceNode;
|
|
1216
1114
|
newNode.previousSibling = referenceNode.previousSibling;
|
|
1217
1115
|
newNode.index = referenceNode.index;
|
|
1218
|
-
if (this.firstChild === referenceNode)
|
|
1219
|
-
|
|
1220
|
-
else if (referenceNode.previousSibling)
|
|
1221
|
-
referenceNode.previousSibling.nextSibling = newNode;
|
|
1116
|
+
if (this.firstChild === referenceNode) this.firstChild = newNode;
|
|
1117
|
+
else if (referenceNode.previousSibling) referenceNode.previousSibling.nextSibling = newNode;
|
|
1222
1118
|
referenceNode.previousSibling = newNode;
|
|
1223
1119
|
newNode.parentNode = referenceNode.parentNode;
|
|
1224
1120
|
let node = referenceNode;
|
|
@@ -1226,28 +1122,22 @@ class $7135fc7d473fd974$var$BaseNode {
|
|
|
1226
1122
|
node.index++;
|
|
1227
1123
|
node = node.nextSibling;
|
|
1228
1124
|
}
|
|
1229
|
-
if (newNode.hasSetProps)
|
|
1230
|
-
this.ownerDocument.addNode(newNode);
|
|
1125
|
+
if (newNode.hasSetProps) this.ownerDocument.addNode(newNode);
|
|
1231
1126
|
this.ownerDocument.endTransaction();
|
|
1232
1127
|
this.ownerDocument.queueUpdate();
|
|
1233
1128
|
}
|
|
1234
1129
|
removeChild(child) {
|
|
1235
|
-
if (child.parentNode !== this)
|
|
1236
|
-
return;
|
|
1130
|
+
if (child.parentNode !== this) return;
|
|
1237
1131
|
this.ownerDocument.startTransaction();
|
|
1238
1132
|
let node = child.nextSibling;
|
|
1239
1133
|
while (node) {
|
|
1240
1134
|
node.index--;
|
|
1241
1135
|
node = node.nextSibling;
|
|
1242
1136
|
}
|
|
1243
|
-
if (child.nextSibling)
|
|
1244
|
-
|
|
1245
|
-
if (child.
|
|
1246
|
-
|
|
1247
|
-
if (this.firstChild === child)
|
|
1248
|
-
this.firstChild = child.nextSibling;
|
|
1249
|
-
if (this.lastChild === child)
|
|
1250
|
-
this.lastChild = child.previousSibling;
|
|
1137
|
+
if (child.nextSibling) child.nextSibling.previousSibling = child.previousSibling;
|
|
1138
|
+
if (child.previousSibling) child.previousSibling.nextSibling = child.nextSibling;
|
|
1139
|
+
if (this.firstChild === child) this.firstChild = child.nextSibling;
|
|
1140
|
+
if (this.lastChild === child) this.lastChild = child.previousSibling;
|
|
1251
1141
|
child.parentNode = null;
|
|
1252
1142
|
child.nextSibling = null;
|
|
1253
1143
|
child.previousSibling = null;
|
|
@@ -1278,8 +1168,7 @@ class $7135fc7d473fd974$export$dc064fe9e59310fd extends $7135fc7d473fd974$var$Ba
|
|
|
1278
1168
|
this.ownerDocument.markDirty(this);
|
|
1279
1169
|
}
|
|
1280
1170
|
get level() {
|
|
1281
|
-
if (this.parentNode instanceof $7135fc7d473fd974$export$dc064fe9e59310fd)
|
|
1282
|
-
return this.parentNode.level + (this.node.type === "item" ? 1 : 0);
|
|
1171
|
+
if (this.parentNode instanceof $7135fc7d473fd974$export$dc064fe9e59310fd) return this.parentNode.level + (this.node.type === "item" ? 1 : 0);
|
|
1283
1172
|
return 0;
|
|
1284
1173
|
}
|
|
1285
1174
|
updateNode() {
|
|
@@ -1307,8 +1196,7 @@ class $7135fc7d473fd974$export$dc064fe9e59310fd extends $7135fc7d473fd974$var$Ba
|
|
|
1307
1196
|
node.value = value;
|
|
1308
1197
|
node.textValue = textValue || (typeof rendered === "string" ? rendered : "") || obj["aria-label"] || "";
|
|
1309
1198
|
if (id != null && id !== node.key) {
|
|
1310
|
-
if (this.hasSetProps)
|
|
1311
|
-
throw new Error("Cannot change the id of an item");
|
|
1199
|
+
if (this.hasSetProps) throw new Error("Cannot change the id of an item");
|
|
1312
1200
|
node.key = id;
|
|
1313
1201
|
}
|
|
1314
1202
|
if (!this.hasSetProps) {
|
|
@@ -1367,12 +1255,10 @@ class $7135fc7d473fd974$export$408d25a4e12db025 {
|
|
|
1367
1255
|
}
|
|
1368
1256
|
getKeyBefore(key) {
|
|
1369
1257
|
let node = this.keyMap.get(key);
|
|
1370
|
-
if (!node)
|
|
1371
|
-
return null;
|
|
1258
|
+
if (!node) return null;
|
|
1372
1259
|
if (node.prevKey != null) {
|
|
1373
1260
|
node = this.keyMap.get(node.prevKey);
|
|
1374
|
-
while (node && node.type !== "item" && node.lastChildKey != null)
|
|
1375
|
-
node = this.keyMap.get(node.lastChildKey);
|
|
1261
|
+
while (node && node.type !== "item" && node.lastChildKey != null) node = this.keyMap.get(node.lastChildKey);
|
|
1376
1262
|
var _node_key;
|
|
1377
1263
|
return (_node_key = node === null || node === void 0 ? void 0 : node.key) !== null && _node_key !== void 0 ? _node_key : null;
|
|
1378
1264
|
}
|
|
@@ -1380,17 +1266,12 @@ class $7135fc7d473fd974$export$408d25a4e12db025 {
|
|
|
1380
1266
|
}
|
|
1381
1267
|
getKeyAfter(key) {
|
|
1382
1268
|
let node = this.keyMap.get(key);
|
|
1383
|
-
if (!node)
|
|
1384
|
-
|
|
1385
|
-
if (node.type !== "item" && node.firstChildKey != null)
|
|
1386
|
-
return node.firstChildKey;
|
|
1269
|
+
if (!node) return null;
|
|
1270
|
+
if (node.type !== "item" && node.firstChildKey != null) return node.firstChildKey;
|
|
1387
1271
|
while (node) {
|
|
1388
|
-
if (node.nextKey != null)
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
node = this.keyMap.get(node.parentKey);
|
|
1392
|
-
else
|
|
1393
|
-
return null;
|
|
1272
|
+
if (node.nextKey != null) return node.nextKey;
|
|
1273
|
+
if (node.parentKey != null) node = this.keyMap.get(node.parentKey);
|
|
1274
|
+
else return null;
|
|
1394
1275
|
}
|
|
1395
1276
|
return null;
|
|
1396
1277
|
}
|
|
@@ -1399,8 +1280,7 @@ class $7135fc7d473fd974$export$408d25a4e12db025 {
|
|
|
1399
1280
|
}
|
|
1400
1281
|
getLastKey() {
|
|
1401
1282
|
let node = this.lastKey != null ? this.keyMap.get(this.lastKey) : null;
|
|
1402
|
-
while ((node === null || node === void 0 ? void 0 : node.lastChildKey) != null)
|
|
1403
|
-
node = this.keyMap.get(node.lastChildKey);
|
|
1283
|
+
while ((node === null || node === void 0 ? void 0 : node.lastChildKey) != null) node = this.keyMap.get(node.lastChildKey);
|
|
1404
1284
|
var _node_key;
|
|
1405
1285
|
return (_node_key = node === null || node === void 0 ? void 0 : node.key) !== null && _node_key !== void 0 ? _node_key : null;
|
|
1406
1286
|
}
|
|
@@ -1420,18 +1300,15 @@ class $7135fc7d473fd974$export$408d25a4e12db025 {
|
|
|
1420
1300
|
return collection;
|
|
1421
1301
|
}
|
|
1422
1302
|
addNode(node) {
|
|
1423
|
-
if (this.frozen)
|
|
1424
|
-
throw new Error("Cannot add a node to a frozen collection");
|
|
1303
|
+
if (this.frozen) throw new Error("Cannot add a node to a frozen collection");
|
|
1425
1304
|
this.keyMap.set(node.key, node);
|
|
1426
1305
|
}
|
|
1427
1306
|
removeNode(key) {
|
|
1428
|
-
if (this.frozen)
|
|
1429
|
-
throw new Error("Cannot remove a node to a frozen collection");
|
|
1307
|
+
if (this.frozen) throw new Error("Cannot remove a node to a frozen collection");
|
|
1430
1308
|
this.keyMap.delete(key);
|
|
1431
1309
|
}
|
|
1432
1310
|
commit(firstKey, lastKey, isSSR = false) {
|
|
1433
|
-
if (this.frozen)
|
|
1434
|
-
throw new Error("Cannot commit a frozen collection");
|
|
1311
|
+
if (this.frozen) throw new Error("Cannot commit a frozen collection");
|
|
1435
1312
|
this.firstKey = firstKey;
|
|
1436
1313
|
this.lastKey = lastKey;
|
|
1437
1314
|
this.frozen = !isSSR;
|
|
@@ -1484,36 +1361,29 @@ class $7135fc7d473fd974$export$b34a105447964f9f extends $7135fc7d473fd974$var$Ba
|
|
|
1484
1361
|
let collection = this.getMutableCollection();
|
|
1485
1362
|
if (!collection.getItem(element.node.key)) {
|
|
1486
1363
|
collection.addNode(element.node);
|
|
1487
|
-
for (let child of element)
|
|
1488
|
-
this.addNode(child);
|
|
1364
|
+
for (let child of element) this.addNode(child);
|
|
1489
1365
|
}
|
|
1490
1366
|
this.markDirty(element);
|
|
1491
1367
|
}
|
|
1492
1368
|
removeNode(node) {
|
|
1493
|
-
for (let child of node)
|
|
1494
|
-
this.removeNode(child);
|
|
1369
|
+
for (let child of node) this.removeNode(child);
|
|
1495
1370
|
let collection = this.getMutableCollection();
|
|
1496
1371
|
collection.removeNode(node.node.key);
|
|
1497
1372
|
this.markDirty(node);
|
|
1498
1373
|
}
|
|
1499
1374
|
/** Finalizes the collection update, updating all nodes and freezing the collection. */
|
|
1500
1375
|
getCollection() {
|
|
1501
|
-
if (this.transactionCount > 0)
|
|
1502
|
-
return this.collection;
|
|
1376
|
+
if (this.transactionCount > 0) return this.collection;
|
|
1503
1377
|
this.updateCollection();
|
|
1504
1378
|
return this.collection;
|
|
1505
1379
|
}
|
|
1506
1380
|
updateCollection() {
|
|
1507
|
-
for (let element of this.dirtyNodes)
|
|
1508
|
-
if (element instanceof $7135fc7d473fd974$export$dc064fe9e59310fd && element.isConnected)
|
|
1509
|
-
element.updateNode();
|
|
1381
|
+
for (let element of this.dirtyNodes) if (element instanceof $7135fc7d473fd974$export$dc064fe9e59310fd && element.isConnected) element.updateNode();
|
|
1510
1382
|
this.dirtyNodes.clear();
|
|
1511
1383
|
if (this.mutatedNodes.size || this.collectionMutated) {
|
|
1512
1384
|
var _this_firstChild, _this_lastChild;
|
|
1513
1385
|
let collection = this.getMutableCollection();
|
|
1514
|
-
for (let element of this.mutatedNodes)
|
|
1515
|
-
if (element.isConnected)
|
|
1516
|
-
collection.addNode(element.node);
|
|
1386
|
+
for (let element of this.mutatedNodes) if (element.isConnected) collection.addNode(element.node);
|
|
1517
1387
|
var _this_firstChild_node_key, _this_lastChild_node_key;
|
|
1518
1388
|
collection.commit((_this_firstChild_node_key = (_this_firstChild = this.firstChild) === null || _this_firstChild === void 0 ? void 0 : _this_firstChild.node.key) !== null && _this_firstChild_node_key !== void 0 ? _this_firstChild_node_key : null, (_this_lastChild_node_key = (_this_lastChild = this.lastChild) === null || _this_lastChild === void 0 ? void 0 : _this_lastChild.node.key) !== null && _this_lastChild_node_key !== void 0 ? _this_lastChild_node_key : null, this.isSSR);
|
|
1519
1389
|
this.mutatedNodes.clear();
|
|
@@ -1521,10 +1391,8 @@ class $7135fc7d473fd974$export$b34a105447964f9f extends $7135fc7d473fd974$var$Ba
|
|
|
1521
1391
|
this.collectionMutated = false;
|
|
1522
1392
|
}
|
|
1523
1393
|
queueUpdate() {
|
|
1524
|
-
if (this.dirtyNodes.size === 0 || this.transactionCount > 0)
|
|
1525
|
-
|
|
1526
|
-
for (let fn of this.subscriptions)
|
|
1527
|
-
fn();
|
|
1394
|
+
if (this.dirtyNodes.size === 0 || this.transactionCount > 0) return;
|
|
1395
|
+
for (let fn of this.subscriptions) fn();
|
|
1528
1396
|
}
|
|
1529
1397
|
subscribe(fn) {
|
|
1530
1398
|
this.subscriptions.add(fn);
|
|
@@ -1565,10 +1433,8 @@ function $7135fc7d473fd974$export$727c8fc270210f13(props) {
|
|
|
1565
1433
|
rendered = children(item);
|
|
1566
1434
|
var _rendered_props_id, _ref;
|
|
1567
1435
|
let key = (_ref = (_rendered_props_id = rendered.props.id) !== null && _rendered_props_id !== void 0 ? _rendered_props_id : item.key) !== null && _ref !== void 0 ? _ref : item.id;
|
|
1568
|
-
if (key == null)
|
|
1569
|
-
|
|
1570
|
-
if (idScope)
|
|
1571
|
-
key = idScope + ":" + key;
|
|
1436
|
+
if (key == null) throw new Error("Could not determine key for item");
|
|
1437
|
+
if (idScope) key = idScope + ":" + key;
|
|
1572
1438
|
rendered = /* @__PURE__ */ cloneElement(rendered, addIdAndValue ? {
|
|
1573
1439
|
key,
|
|
1574
1440
|
id: key,
|
|
@@ -1581,8 +1447,7 @@ function $7135fc7d473fd974$export$727c8fc270210f13(props) {
|
|
|
1581
1447
|
res.push(rendered);
|
|
1582
1448
|
}
|
|
1583
1449
|
return res;
|
|
1584
|
-
} else if (typeof children !== "function")
|
|
1585
|
-
return children;
|
|
1450
|
+
} else if (typeof children !== "function") return children;
|
|
1586
1451
|
}, [
|
|
1587
1452
|
children,
|
|
1588
1453
|
items,
|
|
@@ -1718,11 +1583,9 @@ class $e40ea825a81a3709$export$52baac22726c72bf extends Set {
|
|
|
1718
1583
|
}
|
|
1719
1584
|
}
|
|
1720
1585
|
function $7af3f5b51489e0b5$var$equalSets(setA, setB) {
|
|
1721
|
-
if (setA.size !== setB.size)
|
|
1722
|
-
return false;
|
|
1586
|
+
if (setA.size !== setB.size) return false;
|
|
1723
1587
|
for (let item of setA) {
|
|
1724
|
-
if (!setB.has(item))
|
|
1725
|
-
return false;
|
|
1588
|
+
if (!setB.has(item)) return false;
|
|
1726
1589
|
}
|
|
1727
1590
|
return true;
|
|
1728
1591
|
}
|
|
@@ -1744,8 +1607,7 @@ function $7af3f5b51489e0b5$export$253fe78d46329472(props) {
|
|
|
1744
1607
|
props.disabledKeys
|
|
1745
1608
|
]);
|
|
1746
1609
|
let [selectionBehavior, setSelectionBehavior] = useState(selectionBehaviorProp);
|
|
1747
|
-
if (selectionBehaviorProp === "replace" && selectionBehavior === "toggle" && typeof selectedKeys === "object" && selectedKeys.size === 0)
|
|
1748
|
-
setSelectionBehavior("replace");
|
|
1610
|
+
if (selectionBehaviorProp === "replace" && selectionBehavior === "toggle" && typeof selectedKeys === "object" && selectedKeys.size === 0) setSelectionBehavior("replace");
|
|
1749
1611
|
let lastSelectionBehavior = useRef(selectionBehaviorProp);
|
|
1750
1612
|
useEffect(() => {
|
|
1751
1613
|
if (selectionBehaviorProp !== lastSelectionBehavior.current) {
|
|
@@ -1780,16 +1642,14 @@ function $7af3f5b51489e0b5$export$253fe78d46329472(props) {
|
|
|
1780
1642
|
},
|
|
1781
1643
|
selectedKeys,
|
|
1782
1644
|
setSelectedKeys(keys) {
|
|
1783
|
-
if (allowDuplicateSelectionEvents || !$7af3f5b51489e0b5$var$equalSets(keys, selectedKeys))
|
|
1784
|
-
setSelectedKeys(keys);
|
|
1645
|
+
if (allowDuplicateSelectionEvents || !$7af3f5b51489e0b5$var$equalSets(keys, selectedKeys)) setSelectedKeys(keys);
|
|
1785
1646
|
},
|
|
1786
1647
|
disabledKeys: disabledKeysProp,
|
|
1787
1648
|
disabledBehavior
|
|
1788
1649
|
};
|
|
1789
1650
|
}
|
|
1790
1651
|
function $7af3f5b51489e0b5$var$convertSelection(selection, defaultValue) {
|
|
1791
|
-
if (!selection)
|
|
1792
|
-
return defaultValue;
|
|
1652
|
+
if (!selection) return defaultValue;
|
|
1793
1653
|
return selection === "all" ? "all" : new $e40ea825a81a3709$export$52baac22726c72bf(selection);
|
|
1794
1654
|
}
|
|
1795
1655
|
class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
@@ -1843,8 +1703,7 @@ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
|
1843
1703
|
* Sets the focused key.
|
|
1844
1704
|
*/
|
|
1845
1705
|
setFocusedKey(key, childFocusStrategy) {
|
|
1846
|
-
if (key == null || this.collection.getItem(key))
|
|
1847
|
-
this.state.setFocusedKey(key, childFocusStrategy);
|
|
1706
|
+
if (key == null || this.collection.getItem(key)) this.state.setFocusedKey(key, childFocusStrategy);
|
|
1848
1707
|
}
|
|
1849
1708
|
/**
|
|
1850
1709
|
* The currently selected keys in the collection.
|
|
@@ -1863,8 +1722,7 @@ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
|
1863
1722
|
* Returns whether a key is selected.
|
|
1864
1723
|
*/
|
|
1865
1724
|
isSelected(key) {
|
|
1866
|
-
if (this.state.selectionMode === "none")
|
|
1867
|
-
return false;
|
|
1725
|
+
if (this.state.selectionMode === "none") return false;
|
|
1868
1726
|
key = this.getKey(key);
|
|
1869
1727
|
return this.state.selectedKeys === "all" ? this.canSelectItem(key) : this.state.selectedKeys.has(key);
|
|
1870
1728
|
}
|
|
@@ -1878,12 +1736,9 @@ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
|
1878
1736
|
* Whether all items in the collection are selected.
|
|
1879
1737
|
*/
|
|
1880
1738
|
get isSelectAll() {
|
|
1881
|
-
if (this.isEmpty)
|
|
1882
|
-
|
|
1883
|
-
if (this.
|
|
1884
|
-
return true;
|
|
1885
|
-
if (this._isSelectAll != null)
|
|
1886
|
-
return this._isSelectAll;
|
|
1739
|
+
if (this.isEmpty) return false;
|
|
1740
|
+
if (this.state.selectedKeys === "all") return true;
|
|
1741
|
+
if (this._isSelectAll != null) return this._isSelectAll;
|
|
1887
1742
|
let allKeys = this.getSelectAllKeys();
|
|
1888
1743
|
let selectedKeys = this.state.selectedKeys;
|
|
1889
1744
|
this._isSelectAll = allKeys.every((k) => selectedKeys.has(k));
|
|
@@ -1893,8 +1748,7 @@ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
|
1893
1748
|
let first = null;
|
|
1894
1749
|
for (let key of this.state.selectedKeys) {
|
|
1895
1750
|
let item = this.collection.getItem(key);
|
|
1896
|
-
if (!first || item && $c5a24bc478652b5f$export$8c434b3a7a4dad6(this.collection, item, first) < 0)
|
|
1897
|
-
first = item;
|
|
1751
|
+
if (!first || item && $c5a24bc478652b5f$export$8c434b3a7a4dad6(this.collection, item, first) < 0) first = item;
|
|
1898
1752
|
}
|
|
1899
1753
|
return first === null || first === void 0 ? void 0 : first.key;
|
|
1900
1754
|
}
|
|
@@ -1902,8 +1756,7 @@ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
|
1902
1756
|
let last = null;
|
|
1903
1757
|
for (let key of this.state.selectedKeys) {
|
|
1904
1758
|
let item = this.collection.getItem(key);
|
|
1905
|
-
if (!last || item && $c5a24bc478652b5f$export$8c434b3a7a4dad6(this.collection, item, last) > 0)
|
|
1906
|
-
last = item;
|
|
1759
|
+
if (!last || item && $c5a24bc478652b5f$export$8c434b3a7a4dad6(this.collection, item, last) > 0) last = item;
|
|
1907
1760
|
}
|
|
1908
1761
|
return last === null || last === void 0 ? void 0 : last.key;
|
|
1909
1762
|
}
|
|
@@ -1917,27 +1770,22 @@ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
|
1917
1770
|
* Extends the selection to the given key.
|
|
1918
1771
|
*/
|
|
1919
1772
|
extendSelection(toKey) {
|
|
1920
|
-
if (this.selectionMode === "none")
|
|
1921
|
-
return;
|
|
1773
|
+
if (this.selectionMode === "none") return;
|
|
1922
1774
|
if (this.selectionMode === "single") {
|
|
1923
1775
|
this.replaceSelection(toKey);
|
|
1924
1776
|
return;
|
|
1925
1777
|
}
|
|
1926
1778
|
toKey = this.getKey(toKey);
|
|
1927
1779
|
let selection;
|
|
1928
|
-
if (this.state.selectedKeys === "all")
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
], toKey, toKey);
|
|
1780
|
+
if (this.state.selectedKeys === "all") selection = new $e40ea825a81a3709$export$52baac22726c72bf([
|
|
1781
|
+
toKey
|
|
1782
|
+
], toKey, toKey);
|
|
1932
1783
|
else {
|
|
1933
1784
|
let selectedKeys = this.state.selectedKeys;
|
|
1934
1785
|
let anchorKey = selectedKeys.anchorKey || toKey;
|
|
1935
1786
|
selection = new $e40ea825a81a3709$export$52baac22726c72bf(selectedKeys, anchorKey, toKey);
|
|
1936
|
-
for (let key of this.getKeyRange(anchorKey, selectedKeys.currentKey || toKey))
|
|
1937
|
-
|
|
1938
|
-
for (let key of this.getKeyRange(toKey, anchorKey))
|
|
1939
|
-
if (this.canSelectItem(key))
|
|
1940
|
-
selection.add(key);
|
|
1787
|
+
for (let key of this.getKeyRange(anchorKey, selectedKeys.currentKey || toKey)) selection.delete(key);
|
|
1788
|
+
for (let key of this.getKeyRange(toKey, anchorKey)) if (this.canSelectItem(key)) selection.add(key);
|
|
1941
1789
|
}
|
|
1942
1790
|
this.state.setSelectedKeys(selection);
|
|
1943
1791
|
}
|
|
@@ -1945,8 +1793,7 @@ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
|
1945
1793
|
let fromItem = this.collection.getItem(from);
|
|
1946
1794
|
let toItem = this.collection.getItem(to);
|
|
1947
1795
|
if (fromItem && toItem) {
|
|
1948
|
-
if ($c5a24bc478652b5f$export$8c434b3a7a4dad6(this.collection, fromItem, toItem) <= 0)
|
|
1949
|
-
return this.getKeyRangeInternal(from, to);
|
|
1796
|
+
if ($c5a24bc478652b5f$export$8c434b3a7a4dad6(this.collection, fromItem, toItem) <= 0) return this.getKeyRangeInternal(from, to);
|
|
1950
1797
|
return this.getKeyRangeInternal(to, from);
|
|
1951
1798
|
}
|
|
1952
1799
|
return [];
|
|
@@ -1956,10 +1803,8 @@ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
|
1956
1803
|
let key = from;
|
|
1957
1804
|
while (key) {
|
|
1958
1805
|
let item = this.collection.getItem(key);
|
|
1959
|
-
if (item && item.type === "item" || item.type === "cell" && this.allowsCellSelection)
|
|
1960
|
-
|
|
1961
|
-
if (key === to)
|
|
1962
|
-
return keys;
|
|
1806
|
+
if (item && item.type === "item" || item.type === "cell" && this.allowsCellSelection) keys.push(key);
|
|
1807
|
+
if (key === to) return keys;
|
|
1963
1808
|
key = this.collection.getKeyAfter(key);
|
|
1964
1809
|
}
|
|
1965
1810
|
return [];
|
|
@@ -1968,48 +1813,39 @@ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
|
1968
1813
|
let item = this.collection.getItem(key);
|
|
1969
1814
|
if (!item)
|
|
1970
1815
|
return key;
|
|
1971
|
-
if (item.type === "cell" && this.allowsCellSelection)
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
item = this.collection.getItem(item.parentKey);
|
|
1975
|
-
if (!item || item.type !== "item")
|
|
1976
|
-
return null;
|
|
1816
|
+
if (item.type === "cell" && this.allowsCellSelection) return key;
|
|
1817
|
+
while (item.type !== "item" && item.parentKey != null) item = this.collection.getItem(item.parentKey);
|
|
1818
|
+
if (!item || item.type !== "item") return null;
|
|
1977
1819
|
return item.key;
|
|
1978
1820
|
}
|
|
1979
1821
|
/**
|
|
1980
1822
|
* Toggles whether the given key is selected.
|
|
1981
1823
|
*/
|
|
1982
1824
|
toggleSelection(key) {
|
|
1983
|
-
if (this.selectionMode === "none")
|
|
1984
|
-
return;
|
|
1825
|
+
if (this.selectionMode === "none") return;
|
|
1985
1826
|
if (this.selectionMode === "single" && !this.isSelected(key)) {
|
|
1986
1827
|
this.replaceSelection(key);
|
|
1987
1828
|
return;
|
|
1988
1829
|
}
|
|
1989
1830
|
key = this.getKey(key);
|
|
1990
|
-
if (key == null)
|
|
1991
|
-
return;
|
|
1831
|
+
if (key == null) return;
|
|
1992
1832
|
let keys = new $e40ea825a81a3709$export$52baac22726c72bf(this.state.selectedKeys === "all" ? this.getSelectAllKeys() : this.state.selectedKeys);
|
|
1993
|
-
if (keys.has(key))
|
|
1994
|
-
keys.delete(key);
|
|
1833
|
+
if (keys.has(key)) keys.delete(key);
|
|
1995
1834
|
else if (this.canSelectItem(key)) {
|
|
1996
1835
|
keys.add(key);
|
|
1997
1836
|
keys.anchorKey = key;
|
|
1998
1837
|
keys.currentKey = key;
|
|
1999
1838
|
}
|
|
2000
|
-
if (this.disallowEmptySelection && keys.size === 0)
|
|
2001
|
-
return;
|
|
1839
|
+
if (this.disallowEmptySelection && keys.size === 0) return;
|
|
2002
1840
|
this.state.setSelectedKeys(keys);
|
|
2003
1841
|
}
|
|
2004
1842
|
/**
|
|
2005
1843
|
* Replaces the selection with only the given key.
|
|
2006
1844
|
*/
|
|
2007
1845
|
replaceSelection(key) {
|
|
2008
|
-
if (this.selectionMode === "none")
|
|
2009
|
-
return;
|
|
1846
|
+
if (this.selectionMode === "none") return;
|
|
2010
1847
|
key = this.getKey(key);
|
|
2011
|
-
if (key == null)
|
|
2012
|
-
return;
|
|
1848
|
+
if (key == null) return;
|
|
2013
1849
|
let selection = this.canSelectItem(key) ? new $e40ea825a81a3709$export$52baac22726c72bf([
|
|
2014
1850
|
key
|
|
2015
1851
|
], key, key) : new $e40ea825a81a3709$export$52baac22726c72bf();
|
|
@@ -2019,15 +1855,13 @@ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
|
2019
1855
|
* Replaces the selection with the given keys.
|
|
2020
1856
|
*/
|
|
2021
1857
|
setSelectedKeys(keys) {
|
|
2022
|
-
if (this.selectionMode === "none")
|
|
2023
|
-
return;
|
|
1858
|
+
if (this.selectionMode === "none") return;
|
|
2024
1859
|
let selection = new $e40ea825a81a3709$export$52baac22726c72bf();
|
|
2025
1860
|
for (let key of keys) {
|
|
2026
1861
|
key = this.getKey(key);
|
|
2027
1862
|
if (key != null) {
|
|
2028
1863
|
selection.add(key);
|
|
2029
|
-
if (this.selectionMode === "single")
|
|
2030
|
-
break;
|
|
1864
|
+
if (this.selectionMode === "single") break;
|
|
2031
1865
|
}
|
|
2032
1866
|
}
|
|
2033
1867
|
this.state.setSelectedKeys(selection);
|
|
@@ -2038,10 +1872,8 @@ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
|
2038
1872
|
while (key) {
|
|
2039
1873
|
if (this.canSelectItem(key)) {
|
|
2040
1874
|
let item = this.collection.getItem(key);
|
|
2041
|
-
if (item.type === "item")
|
|
2042
|
-
|
|
2043
|
-
if (item.hasChildNodes && (this.allowsCellSelection || item.type !== "item"))
|
|
2044
|
-
addKeys($c5a24bc478652b5f$export$fbdeaa6a76694f71($c5a24bc478652b5f$export$1005530eda016c13(item, this.collection)).key);
|
|
1875
|
+
if (item.type === "item") keys.push(key);
|
|
1876
|
+
if (item.hasChildNodes && (this.allowsCellSelection || item.type !== "item")) addKeys($c5a24bc478652b5f$export$fbdeaa6a76694f71($c5a24bc478652b5f$export$1005530eda016c13(item, this.collection)).key);
|
|
2045
1877
|
}
|
|
2046
1878
|
key = this.collection.getKeyAfter(key);
|
|
2047
1879
|
}
|
|
@@ -2053,64 +1885,50 @@ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
|
|
|
2053
1885
|
* Selects all items in the collection.
|
|
2054
1886
|
*/
|
|
2055
1887
|
selectAll() {
|
|
2056
|
-
if (!this.isSelectAll && this.selectionMode === "multiple")
|
|
2057
|
-
this.state.setSelectedKeys("all");
|
|
1888
|
+
if (!this.isSelectAll && this.selectionMode === "multiple") this.state.setSelectedKeys("all");
|
|
2058
1889
|
}
|
|
2059
1890
|
/**
|
|
2060
1891
|
* Removes all keys from the selection.
|
|
2061
1892
|
*/
|
|
2062
1893
|
clearSelection() {
|
|
2063
|
-
if (!this.disallowEmptySelection && (this.state.selectedKeys === "all" || this.state.selectedKeys.size > 0))
|
|
2064
|
-
this.state.setSelectedKeys(new $e40ea825a81a3709$export$52baac22726c72bf());
|
|
1894
|
+
if (!this.disallowEmptySelection && (this.state.selectedKeys === "all" || this.state.selectedKeys.size > 0)) this.state.setSelectedKeys(new $e40ea825a81a3709$export$52baac22726c72bf());
|
|
2065
1895
|
}
|
|
2066
1896
|
/**
|
|
2067
1897
|
* Toggles between select all and an empty selection.
|
|
2068
1898
|
*/
|
|
2069
1899
|
toggleSelectAll() {
|
|
2070
|
-
if (this.isSelectAll)
|
|
2071
|
-
|
|
2072
|
-
else
|
|
2073
|
-
this.selectAll();
|
|
1900
|
+
if (this.isSelectAll) this.clearSelection();
|
|
1901
|
+
else this.selectAll();
|
|
2074
1902
|
}
|
|
2075
1903
|
select(key, e) {
|
|
2076
|
-
if (this.selectionMode === "none")
|
|
2077
|
-
return;
|
|
1904
|
+
if (this.selectionMode === "none") return;
|
|
2078
1905
|
if (this.selectionMode === "single") {
|
|
2079
|
-
if (this.isSelected(key) && !this.disallowEmptySelection)
|
|
2080
|
-
|
|
2081
|
-
else
|
|
2082
|
-
this.replaceSelection(key);
|
|
1906
|
+
if (this.isSelected(key) && !this.disallowEmptySelection) this.toggleSelection(key);
|
|
1907
|
+
else this.replaceSelection(key);
|
|
2083
1908
|
} else if (this.selectionBehavior === "toggle" || e && (e.pointerType === "touch" || e.pointerType === "virtual"))
|
|
2084
1909
|
this.toggleSelection(key);
|
|
2085
|
-
else
|
|
2086
|
-
this.replaceSelection(key);
|
|
1910
|
+
else this.replaceSelection(key);
|
|
2087
1911
|
}
|
|
2088
1912
|
/**
|
|
2089
1913
|
* Returns whether the current selection is equal to the given selection.
|
|
2090
1914
|
*/
|
|
2091
1915
|
isSelectionEqual(selection) {
|
|
2092
|
-
if (selection === this.state.selectedKeys)
|
|
2093
|
-
return true;
|
|
1916
|
+
if (selection === this.state.selectedKeys) return true;
|
|
2094
1917
|
let selectedKeys = this.selectedKeys;
|
|
2095
|
-
if (selection.size !== selectedKeys.size)
|
|
2096
|
-
return false;
|
|
1918
|
+
if (selection.size !== selectedKeys.size) return false;
|
|
2097
1919
|
for (let key of selection) {
|
|
2098
|
-
if (!selectedKeys.has(key))
|
|
2099
|
-
return false;
|
|
1920
|
+
if (!selectedKeys.has(key)) return false;
|
|
2100
1921
|
}
|
|
2101
1922
|
for (let key of selectedKeys) {
|
|
2102
|
-
if (!selection.has(key))
|
|
2103
|
-
return false;
|
|
1923
|
+
if (!selection.has(key)) return false;
|
|
2104
1924
|
}
|
|
2105
1925
|
return true;
|
|
2106
1926
|
}
|
|
2107
1927
|
canSelectItem(key) {
|
|
2108
1928
|
var _item_props;
|
|
2109
|
-
if (this.state.selectionMode === "none" || this.state.disabledKeys.has(key))
|
|
2110
|
-
return false;
|
|
1929
|
+
if (this.state.selectionMode === "none" || this.state.disabledKeys.has(key)) return false;
|
|
2111
1930
|
let item = this.collection.getItem(key);
|
|
2112
|
-
if (!item || (item === null || item === void 0 ? void 0 : (_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.isDisabled) || item.type === "cell" && !this.allowsCellSelection)
|
|
2113
|
-
return false;
|
|
1931
|
+
if (!item || (item === null || item === void 0 ? void 0 : (_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.isDisabled) || item.type === "cell" && !this.allowsCellSelection) return false;
|
|
2114
1932
|
return true;
|
|
2115
1933
|
}
|
|
2116
1934
|
isDisabled(key) {
|