@fibrae/semi-foundation 0.6.0 → 0.8.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/dist/base/index.d.ts +2 -1
- package/dist/base/index.js +2 -1
- package/dist/base/overlay-session.d.ts +16 -0
- package/dist/base/overlay-session.js +36 -0
- package/dist/components/audio-player/foundation.js +1 -1
- package/dist/components/auto-complete/constants.d.ts +3 -1
- package/dist/components/auto-complete/foundation.d.ts +1 -1
- package/dist/components/auto-complete/foundation.js +15 -16
- package/dist/components/badge/constants.d.ts +3 -1
- package/dist/components/button/constants.d.ts +3 -1
- package/dist/components/card/constants.d.ts +3 -1
- package/dist/components/cascader/constants.d.ts +2 -0
- package/dist/components/cascader/foundation.d.ts +2 -4
- package/dist/components/cascader/foundation.js +4 -1
- package/dist/components/color-picker/foundation.d.ts +2 -0
- package/dist/components/color-picker/foundation.js +5 -0
- package/dist/components/cropper/constants.d.ts +2 -0
- package/dist/components/date-picker/_utils/index.d.ts +1 -2
- package/dist/components/date-picker/_utils/index.js +1 -2
- package/dist/components/date-picker/_utils/is-timestamp.js +1 -1
- package/dist/components/date-picker/_utils/parse-value.js +1 -1
- package/dist/components/date-picker/_utils/picker-type.js +1 -1
- package/dist/components/date-picker/constants.d.ts +2 -0
- package/dist/components/date-picker/foundation.d.ts +3 -4
- package/dist/components/date-picker/foundation.js +8 -3
- package/dist/components/date-picker/input-foundation.d.ts +1 -0
- package/dist/components/date-picker/input-foundation.js +1 -1
- package/dist/components/date-picker/month-foundation.d.ts +1 -1
- package/dist/components/date-picker/month-foundation.js +1 -0
- package/dist/components/date-picker/months-grid-foundation.d.ts +1 -1
- package/dist/components/date-picker/months-grid-foundation.js +1 -1
- package/dist/components/descriptions/constants.d.ts +3 -1
- package/dist/components/dropdown/constants.d.ts +2 -0
- package/dist/components/dropdown/menu-foundation.d.ts +1 -1
- package/dist/components/empty/constants.d.ts +3 -1
- package/dist/components/feedback/constants.d.ts +3 -1
- package/dist/components/form/form.css +47 -2
- package/dist/components/form/form.scss +44 -2
- package/dist/components/form/foundation.d.ts +2 -1
- package/dist/components/form/foundation.js +63 -3
- package/dist/components/form/interface.d.ts +9 -1
- package/dist/components/form/json-schema.d.ts +35 -2
- package/dist/components/form/json-schema.js +75 -8
- package/dist/components/form/variables.scss +4 -0
- package/dist/components/highlight/constants.d.ts +3 -1
- package/dist/components/image/constants.d.ts +5 -1
- package/dist/components/image/preview-inner-foundation.js +6 -15
- package/dist/components/input/constants.d.ts +5 -1
- package/dist/components/input-number/constants.d.ts +3 -1
- package/dist/components/modal/constants.d.ts +3 -1
- package/dist/components/modal/modal-content-foundation.d.ts +3 -3
- package/dist/components/modal/modal-content-foundation.js +5 -3
- package/dist/components/modal/modal-foundation.d.ts +0 -2
- package/dist/components/modal/modal-foundation.js +6 -16
- package/dist/components/navigation/constants.d.ts +4 -0
- package/dist/components/overflow-list/constants.d.ts +2 -0
- package/dist/components/pagination/foundation.d.ts +1 -1
- package/dist/components/popconfirm/constants.d.ts +3 -1
- package/dist/components/popover/constants.d.ts +2 -0
- package/dist/components/radio/constants.d.ts +3 -1
- package/dist/components/scroll-list/item-foundation.js +1 -0
- package/dist/components/select/constants.d.ts +2 -0
- package/dist/components/select/foundation.d.ts +0 -3
- package/dist/components/select/foundation.js +31 -56
- package/dist/components/select/select.css +3 -3
- package/dist/components/select/select.scss +8 -3
- package/dist/components/side-sheet/constants.d.ts +2 -0
- package/dist/components/side-sheet/side-sheet-foundation.d.ts +6 -4
- package/dist/components/side-sheet/side-sheet-foundation.js +33 -23
- package/dist/components/slider/constants.d.ts +3 -1
- package/dist/components/slider/foundation.d.ts +6 -6
- package/dist/components/slider/foundation.js +9 -6
- package/dist/components/spin/constants.d.ts +3 -1
- package/dist/components/table/constants.d.ts +2 -0
- package/dist/components/table/foundation.d.ts +8 -0
- package/dist/components/table/foundation.js +12 -0
- package/dist/components/table/rtl.scss +5 -0
- package/dist/components/table/table.css +123 -0
- package/dist/components/table/table.scss +174 -0
- package/dist/components/tabs/constants.d.ts +2 -0
- package/dist/components/tabs/foundation.js +19 -60
- package/dist/components/time-picker/combobox-options.js +1 -1
- package/dist/components/time-picker/constants.d.ts +2 -0
- package/dist/components/time-picker/foundation.d.ts +3 -1
- package/dist/components/time-picker/foundation.js +7 -1
- package/dist/components/toast/toast.css +1 -1
- package/dist/components/toast/toast.scss +2 -1
- package/dist/components/tooltip/constants.d.ts +2 -0
- package/dist/components/tooltip/foundation.d.ts +13 -15
- package/dist/components/tooltip/foundation.js +54 -15
- package/dist/components/tooltip/tooltip.css +1 -1
- package/dist/components/tooltip/tooltip.scss +4 -2
- package/dist/components/tree/constants.d.ts +2 -0
- package/dist/components/tree/foundation.d.ts +17 -3
- package/dist/components/tree/foundation.js +37 -2
- package/dist/components/tree/shared.d.ts +37 -0
- package/dist/components/tree/shared.js +42 -1
- package/dist/components/tree-select/constants.d.ts +2 -0
- package/dist/components/tree-select/foundation.d.ts +15 -10
- package/dist/components/tree-select/foundation.js +44 -7
- package/dist/components/upload/constants.d.ts +3 -1
- package/dist/components/upload/utils.d.ts +5 -0
- package/dist/components/upload/utils.js +8 -2
- package/dist/components/video-player/foundation.js +1 -1
- package/dist/components/video-player/utils.d.ts +0 -2
- package/dist/components/video-player/utils.js +1 -14
- package/dist/locale/interface.d.ts +6 -0
- package/dist/locale/source/en_US.js +4 -1
- package/dist/locale/source/zh_CN.js +4 -1
- package/dist/utils/a11y.d.ts +9 -0
- package/dist/utils/a11y.js +19 -1
- package/dist/utils/date-fns-extra.d.ts +1 -0
- package/dist/utils/date-fns-extra.js +4 -1
- package/dist/utils/index.d.ts +4 -3
- package/dist/utils/index.js +4 -3
- package/dist/utils/media.d.ts +2 -0
- package/dist/utils/media.js +15 -0
- package/dist/utils/scroll-lock.d.ts +4 -3
- package/dist/utils/scroll-lock.js +15 -11
- package/dist/utils/supports.d.ts +2 -0
- package/dist/utils/supports.js +7 -1
- package/package.json +2 -2
- package/dist/components/date-picker/_utils/is-valid-date.d.ts +0 -1
- package/dist/components/date-picker/_utils/is-valid-date.js +0 -5
|
@@ -2,6 +2,7 @@ import FocusTrapHandle from "../../base/focus-handle.js";
|
|
|
2
2
|
import BaseFoundation from "../../base/foundation.js";
|
|
3
3
|
import PopupLifecycle from "../../base/popup-lifecycle.js";
|
|
4
4
|
import ReleaseHolder from "../../base/release-holder.js";
|
|
5
|
+
import { isEventInside } from "../../utils/dom.js";
|
|
5
6
|
import { openLayer, popupTriggerSelector } from "../../utils/layer.js";
|
|
6
7
|
import warning from "../../utils/warning.js";
|
|
7
8
|
import { adjustPosition } from "./adjust-position.js";
|
|
@@ -42,6 +43,9 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
42
43
|
#focusTrap = null;
|
|
43
44
|
#requestedVisible;
|
|
44
45
|
#hidesOnClickOutside = false;
|
|
46
|
+
#clickOutside = null;
|
|
47
|
+
#pressedInside = null;
|
|
48
|
+
#lastPopup = null;
|
|
45
49
|
#stopTracking = null;
|
|
46
50
|
#triggerVisible = true;
|
|
47
51
|
#applied = null;
|
|
@@ -84,7 +88,8 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
84
88
|
batch.forEach((tooltip, i) => tooltip.#apply(layouts[i]));
|
|
85
89
|
}
|
|
86
90
|
#handleClickOutside = (e) => {
|
|
87
|
-
|
|
91
|
+
const popup = this.adapter.getPortalContainer();
|
|
92
|
+
if (!popup || this.adapter.isEventInTrigger(e) || e === this.#pressedInside || isEventInside(e, popup, ...this.adapter.getNestedPopups())) return;
|
|
88
93
|
this.adapter.notifyClickOutSide(e);
|
|
89
94
|
if (this.#hidesOnClickOutside) this.hide();
|
|
90
95
|
};
|
|
@@ -119,6 +124,13 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
119
124
|
const { mouseEnterDelay, mouseLeaveDelay } = this.getProps();
|
|
120
125
|
warning((mouseLeaveDelay ?? 0) < (mouseEnterDelay ?? 0), strings.LEAVE_DELAY_WARNING);
|
|
121
126
|
}
|
|
127
|
+
#waitAnimations(beforeRead) {
|
|
128
|
+
const read = () => {
|
|
129
|
+
const animations = this.adapter.getPortalContainer()?.getAnimations() ?? [];
|
|
130
|
+
return animations.length ? Promise.allSettled(animations.map((animation) => animation.finished)) : null;
|
|
131
|
+
};
|
|
132
|
+
return beforeRead ? beforeRead.then(read) : read();
|
|
133
|
+
}
|
|
122
134
|
#afterAnimations(wait, step) {
|
|
123
135
|
const current = this.#syncStep;
|
|
124
136
|
const run = () => {
|
|
@@ -127,6 +139,14 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
127
139
|
if (wait) wait.then(run);
|
|
128
140
|
else run();
|
|
129
141
|
}
|
|
142
|
+
#showPopover() {
|
|
143
|
+
const popup = this.adapter.getPortalContainer();
|
|
144
|
+
if (popup && !popup.matches(":popover-open")) popup.showPopover();
|
|
145
|
+
this.#lastPopup = popup ?? this.#lastPopup;
|
|
146
|
+
}
|
|
147
|
+
#hidePopover() {
|
|
148
|
+
(this.adapter.getPortalContainer() ?? this.#lastPopup)?.hidePopover();
|
|
149
|
+
}
|
|
130
150
|
#updateStateIfCursorOnTrigger() {
|
|
131
151
|
if (this.adapter.isTriggerHovered()) this.getState("triggerEventSet")[TRIGGER_EVENT_NAMES.mouseEnter]?.();
|
|
132
152
|
}
|
|
@@ -151,15 +171,15 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
151
171
|
this.adapter.notifyOpen();
|
|
152
172
|
this.#reportVisibleChange(true);
|
|
153
173
|
}
|
|
154
|
-
#enter() {
|
|
174
|
+
#enter(beforeRead) {
|
|
155
175
|
this.#layer.hold(() => openLayer({
|
|
156
176
|
element: this.adapter.getPortalContainer(),
|
|
157
177
|
modal: false,
|
|
158
178
|
onEscape: this.handleEscape
|
|
159
179
|
}));
|
|
160
|
-
this
|
|
180
|
+
this.#showPopover();
|
|
161
181
|
this.#handleShown();
|
|
162
|
-
const entering = this
|
|
182
|
+
const entering = this.#waitAnimations(beforeRead);
|
|
163
183
|
this.#openTimer = setTimeout(() => {
|
|
164
184
|
if (!this.#openedHandled) {
|
|
165
185
|
this.#openedHandled = true;
|
|
@@ -170,11 +190,11 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
170
190
|
});
|
|
171
191
|
});
|
|
172
192
|
}
|
|
173
|
-
#leave() {
|
|
193
|
+
#leave(beforeRead) {
|
|
174
194
|
this.#layer.release();
|
|
175
|
-
this.#afterAnimations(this
|
|
195
|
+
this.#afterAnimations(this.#waitAnimations(beforeRead), () => {
|
|
176
196
|
if (this.getState("transitionState") !== "leave") return;
|
|
177
|
-
this
|
|
197
|
+
this.#hidePopover();
|
|
178
198
|
if (!this.getProp("keepDOM")) this.#removePortal();
|
|
179
199
|
this.#lifecycle.ended(() => this.adapter.notifyAfterClose());
|
|
180
200
|
});
|
|
@@ -184,7 +204,16 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
184
204
|
const hides = trigger === "click" || clickTriggerToHide || trigger === "contextMenu";
|
|
185
205
|
if (hides || trigger === "custom") {
|
|
186
206
|
this.#hidesOnClickOutside = hides;
|
|
187
|
-
this
|
|
207
|
+
this.#unwatchClickOutside();
|
|
208
|
+
const openingPress = window.event;
|
|
209
|
+
this.#clickOutside = (e) => e !== openingPress && this.adapter.batch(() => this.#handleClickOutside(e));
|
|
210
|
+
window.addEventListener("mousedown", this.#clickOutside);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
#unwatchClickOutside() {
|
|
214
|
+
if (this.#clickOutside) {
|
|
215
|
+
window.removeEventListener("mousedown", this.#clickOutside);
|
|
216
|
+
this.#clickOutside = null;
|
|
188
217
|
}
|
|
189
218
|
}
|
|
190
219
|
#generateEvent(types) {
|
|
@@ -629,12 +658,12 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
629
658
|
clearTimeout(this.#openTimer);
|
|
630
659
|
clearTimeout(this.#cursorTimer);
|
|
631
660
|
this.#layer.release();
|
|
632
|
-
if (this.getState("isInsert")) this
|
|
661
|
+
if (this.getState("isInsert")) this.#hidePopover();
|
|
633
662
|
if (this.getState("transitionState") === "leave" && !this.getProp("keepDOM")) this.#removePortal();
|
|
634
663
|
this.#mounted = false;
|
|
635
664
|
this.#requestedVisible = void 0;
|
|
636
665
|
this.#endTracking();
|
|
637
|
-
this
|
|
666
|
+
this.#unwatchClickOutside();
|
|
638
667
|
this.#clearDelayTimer();
|
|
639
668
|
}
|
|
640
669
|
handlePropsChange(prev) {
|
|
@@ -650,15 +679,17 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
650
679
|
* Hosts call this after every commit that changes `isInsert`, `transitionState` or the popup element, and again
|
|
651
680
|
* when a hidden popup shows again (Activity, KeepAlive), with the popup in the document. Entering shows the
|
|
652
681
|
* popover, positions it, checks a hover opening a task later and reports afterOpen once the enter animation ends;
|
|
653
|
-
* leaving waits for the exit animation, hides the popover, unmounts it unless
|
|
682
|
+
* leaving releases the Escape layer at once, waits for the exit animation, hides the popover, unmounts it unless
|
|
683
|
+
* keepDOM and reports afterClose. The animations are read once `beforeRead` settles when a host passes one: the
|
|
684
|
+
* phase's DOM is not there yet (Svelte), or what follows must not run inside the closing event (Solid).
|
|
654
685
|
*/
|
|
655
|
-
syncPopup = () => {
|
|
686
|
+
syncPopup = (beforeRead) => {
|
|
656
687
|
this.#syncStep++;
|
|
657
688
|
clearTimeout(this.#openTimer);
|
|
658
689
|
if (!this.getState("isInsert") || !this.adapter.getPortalContainer()) return;
|
|
659
690
|
const phase = this.getState("transitionState");
|
|
660
|
-
if (phase === "enter") this.#enter();
|
|
661
|
-
else if (phase === "leave") this.#leave();
|
|
691
|
+
if (phase === "enter") this.#enter(beforeRead);
|
|
692
|
+
else if (phase === "leave") this.#leave(beforeRead);
|
|
662
693
|
};
|
|
663
694
|
/** Hosts call this when the component unmounts for good, not when it is only hidden: reports a close still owed */
|
|
664
695
|
handleUnmount = () => {
|
|
@@ -711,16 +742,24 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
711
742
|
this.#open = false;
|
|
712
743
|
this.#clearDelayTimer();
|
|
713
744
|
if (!this.#mounted) return;
|
|
714
|
-
this
|
|
745
|
+
this.#unwatchClickOutside();
|
|
715
746
|
this.#endTracking();
|
|
716
747
|
if (wasOpen || this.getState("visible")) {
|
|
717
748
|
this.setState({
|
|
718
749
|
transitionState: "leave",
|
|
719
750
|
visible: false
|
|
720
751
|
});
|
|
752
|
+
if (!this.#openReported) {
|
|
753
|
+
this.#openReported = true;
|
|
754
|
+
this.#reportVisibleChange(true);
|
|
755
|
+
}
|
|
721
756
|
this.#reportVisibleChange(false);
|
|
722
757
|
}
|
|
723
758
|
};
|
|
759
|
+
/** Hosts call this from a capture-phase mousedown on the popup content: a press bound for a nested popup portaled out of this DOM */
|
|
760
|
+
markPressInside = (e) => {
|
|
761
|
+
this.#pressedInside = e;
|
|
762
|
+
};
|
|
724
763
|
/**
|
|
725
764
|
* Escape that reaches the popup through the overlay stack (utils/layer) while it is the top layer, wherever the
|
|
726
765
|
* focus is. Returns whether the popup took the key; one that does not leaves it to the layer below.
|
|
@@ -16,8 +16,10 @@ $module-icon: #{$module}-icon-arrow;
|
|
|
16
16
|
@include focus-ring;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
// utils/layer.ts marks a popup a modal layer covers: the top layer would otherwise paint it above the modal's mask
|
|
20
|
-
|
|
19
|
+
// utils/layer.ts marks a popup a modal layer covers: the top layer would otherwise paint it above the modal's mask. A
|
|
20
|
+
// closed popover is not in the top layer and may be a box the page shows (a sidebar that is a drawer only on narrow
|
|
21
|
+
// screens); the mask covers it already
|
|
22
|
+
:popover-open[data-semi-covered] {
|
|
21
23
|
visibility: hidden;
|
|
22
24
|
}
|
|
23
25
|
|
|
@@ -2,6 +2,8 @@ export declare const cssClasses: {
|
|
|
2
2
|
PREFIX: string;
|
|
3
3
|
PREFIX_OPTION: string;
|
|
4
4
|
};
|
|
5
|
+
/** Keys of `classNames` and `styles`; the root element takes `className` and `style` */
|
|
6
|
+
export type TreePart = 'search';
|
|
5
7
|
export declare const strings: {
|
|
6
8
|
JSON_KEY_SPLIT: string;
|
|
7
9
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from "../../base/foundation.js";
|
|
2
2
|
import "../../base/index.js";
|
|
3
|
+
import { TreeKeyEvent } from "./shared.js";
|
|
3
4
|
import { KeyMapProps } from "./tree-util.js";
|
|
4
5
|
export interface BasicTreeNodeProps {
|
|
5
6
|
[x: string]: any;
|
|
@@ -180,10 +181,8 @@ export interface BasicTreeProps {
|
|
|
180
181
|
renderDraggingNode?: (nodeInstance: HTMLElement, node: BasicTreeNodeData) => HTMLElement;
|
|
181
182
|
renderFullLabel?: (renderFullLabelProps: BasicRenderFullLabelProps) => any;
|
|
182
183
|
renderLabel?: (label?: any, treeNode?: BasicTreeNodeData) => any;
|
|
183
|
-
searchClassName?: string;
|
|
184
184
|
searchPlaceholder?: string;
|
|
185
185
|
searchRender?: ((searchRenderProps: BasicSearchRenderProps) => any) | false;
|
|
186
|
-
searchStyle?: any;
|
|
187
186
|
showClear?: boolean;
|
|
188
187
|
showFilteredOnly?: boolean;
|
|
189
188
|
showLine?: boolean;
|
|
@@ -226,6 +225,12 @@ export interface BasicTreeInnerData {
|
|
|
226
225
|
dragNodesKeys: Set<string>;
|
|
227
226
|
dragOverNodeKey: string | null;
|
|
228
227
|
dropPosition: number | null;
|
|
228
|
+
/** The row the keyboard or the pointer last moved to; aria-activedescendant follows it while the row is shown */
|
|
229
|
+
keyboardKey: string | null;
|
|
230
|
+
}
|
|
231
|
+
/** The foundation context a host passes: the reading direction, which flips Left and Right */
|
|
232
|
+
export interface TreeContext {
|
|
233
|
+
direction?: 'ltr' | 'rtl';
|
|
229
234
|
}
|
|
230
235
|
export interface BasicExpandedOtherProps {
|
|
231
236
|
expanded: boolean;
|
|
@@ -234,7 +239,7 @@ export interface BasicExpandedOtherProps {
|
|
|
234
239
|
/** The members of a drag event the foundation reads; DOM events and React synthetic events both satisfy it */
|
|
235
240
|
export type TreeDragEvent = Pick<DragEvent, 'dataTransfer' | 'clientY'>;
|
|
236
241
|
/** E is the host's node mouse event (right or double click), which the foundation only passes through */
|
|
237
|
-
export interface TreeAdapter<E = unknown> extends DefaultAdapter<BasicTreeProps, BasicTreeInnerData> {
|
|
242
|
+
export interface TreeAdapter<E = unknown> extends DefaultAdapter<BasicTreeProps, BasicTreeInnerData, TreeContext> {
|
|
238
243
|
notifyExpand: (expandedKeys: string[], { expanded, node }: BasicExpandedOtherProps) => void;
|
|
239
244
|
notifySelect: (selectKey: string, bool: boolean, node: BasicTreeNodeData) => void;
|
|
240
245
|
notifyChange: (value: BasicValue) => void;
|
|
@@ -250,6 +255,8 @@ export interface TreeAdapter<E = unknown> extends DefaultAdapter<BasicTreeProps,
|
|
|
250
255
|
notifyDrop: (props: BasicOnDragProps) => void;
|
|
251
256
|
/** Scrolls the virtualized list to a row of flattenNodes, found by key once the rendered rows catch up with a search */
|
|
252
257
|
scrollToNode: (key: string, align: ScrollAlign) => void;
|
|
258
|
+
/** Scrolls the row a key moved to into view; `index` is its place in flattenNodes */
|
|
259
|
+
revealRow: (index: number, key: string) => void;
|
|
253
260
|
}
|
|
254
261
|
export default class TreeFoundation<E = unknown> extends BaseFoundation<TreeAdapter<E>, BasicTreeProps, BasicTreeInnerData> {
|
|
255
262
|
#private;
|
|
@@ -262,6 +269,8 @@ export default class TreeFoundation<E = unknown> extends BaseFoundation<TreeAdap
|
|
|
262
269
|
/** The state that props imply, given the previous state; null when nothing changed (see `deriveTreeState`) */
|
|
263
270
|
static deriveState(props: BasicTreeProps, prevState: BasicTreeInnerData): Partial<BasicTreeInnerData> | null;
|
|
264
271
|
static getInitialState(props: BasicTreeProps): BasicTreeInnerData;
|
|
272
|
+
/** The row the keys act on: the keyboard row while it is shown, else the first selected row, else the first */
|
|
273
|
+
static getActiveIndex({ flattenNodes, selectedKeys, keyboardKey }: Pick<BasicTreeInnerData, 'flattenNodes' | 'selectedKeys' | 'keyboardKey'>): number;
|
|
265
274
|
destroy(): void;
|
|
266
275
|
/** Writes the state derived from new props back, so handlers read what was rendered */
|
|
267
276
|
syncDerivedState: (derived: Partial<BasicTreeInnerData>) => void;
|
|
@@ -270,6 +279,11 @@ export default class TreeFoundation<E = unknown> extends BaseFoundation<TreeAdap
|
|
|
270
279
|
align?: ScrollAlign;
|
|
271
280
|
}) => void;
|
|
272
281
|
handleInputChange: (sugInput: string) => void;
|
|
282
|
+
/**
|
|
283
|
+
* The keys of an APG tree view on role="tree", acting on the active row; a key on a tabbable control inside a row
|
|
284
|
+
* belongs to that control. Returns whether the key was handled.
|
|
285
|
+
*/
|
|
286
|
+
handleKeyDown: (e: TreeKeyEvent) => boolean;
|
|
273
287
|
handleNodeSelect: (e: unknown, treeNode: BasicTreeNodeProps) => void;
|
|
274
288
|
handleNodeRightClick: (e: E, treeNode: BasicTreeNodeProps) => void;
|
|
275
289
|
handleNodeDoubleClick: (e: E, treeNode: BasicTreeNodeProps) => void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import BaseFoundation from "../../base/foundation.js";
|
|
2
|
+
import { Typeahead } from "../../utils/a11y.js";
|
|
2
3
|
import { strings } from "./constants.js";
|
|
3
|
-
import { deriveTreeState, getMultipleChange, getMultipleSelectResult, getSearchState, isTreeNodeLeaf, loadTreeNode } from "./shared.js";
|
|
4
|
+
import { buildRowProps, deriveTreeState, getMultipleChange, getMultipleSelectResult, getSearchState, getTreeActiveIndex, handleTreeKeyDown, isRowControlKey, isTreeNodeLeaf, loadTreeNode } from "./shared.js";
|
|
4
5
|
import { calcDropActualPosition, calcDropRelativePosition, flattenTreeData, getDragNodesKeys, getMotionKeys, getValueOrKey, normalizedArr } from "./tree-util.js";
|
|
5
6
|
import { throttle } from "es-toolkit";
|
|
6
7
|
import { get, pick as pick$1 } from "es-toolkit/compat";
|
|
@@ -13,6 +14,7 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
|
|
|
13
14
|
#dragNode = null;
|
|
14
15
|
#dragEnterTimers = /* @__PURE__ */ new Set();
|
|
15
16
|
#autoExpandTimer;
|
|
17
|
+
#typeahead = new Typeahead();
|
|
16
18
|
/**
|
|
17
19
|
* Every prop `deriveState` reads, which it keeps as `prevProps`. They change state during render, so there is no
|
|
18
20
|
* `handlePropsChange`; a prop deriveState starts reading goes on this list too.
|
|
@@ -191,13 +193,19 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
|
|
|
191
193
|
dragging: false,
|
|
192
194
|
dragNodesKeys: /* @__PURE__ */ new Set(),
|
|
193
195
|
dragOverNodeKey: null,
|
|
194
|
-
dropPosition: null
|
|
196
|
+
dropPosition: null,
|
|
197
|
+
keyboardKey: null
|
|
195
198
|
};
|
|
196
199
|
return {
|
|
197
200
|
...state,
|
|
198
201
|
...TreeFoundation.deriveState(props, state)
|
|
199
202
|
};
|
|
200
203
|
}
|
|
204
|
+
/** The row the keys act on: the keyboard row while it is shown, else the first selected row, else the first */
|
|
205
|
+
static getActiveIndex({ flattenNodes, selectedKeys, keyboardKey }) {
|
|
206
|
+
const selected = flattenNodes.findIndex((node) => selectedKeys.includes(node.key));
|
|
207
|
+
return getTreeActiveIndex(flattenNodes, keyboardKey, Math.max(selected, 0));
|
|
208
|
+
}
|
|
201
209
|
destroy() {
|
|
202
210
|
super.destroy();
|
|
203
211
|
this.#throttledDragOverUpdate.cancel();
|
|
@@ -216,18 +224,45 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
|
|
|
216
224
|
this.adapter.notifySearch(sugInput, [...state.filteredExpandedKeys]);
|
|
217
225
|
this.setState(state);
|
|
218
226
|
};
|
|
227
|
+
/**
|
|
228
|
+
* The keys of an APG tree view on role="tree", acting on the active row; a key on a tabbable control inside a row
|
|
229
|
+
* belongs to that control. Returns whether the key was handled.
|
|
230
|
+
*/
|
|
231
|
+
handleKeyDown = (e) => {
|
|
232
|
+
if (isRowControlKey(e)) return false;
|
|
233
|
+
const state = this.getStates();
|
|
234
|
+
return handleTreeKeyDown(e, {
|
|
235
|
+
rows: state.flattenNodes,
|
|
236
|
+
activeIndex: TreeFoundation.getActiveIndex(state),
|
|
237
|
+
editing: false,
|
|
238
|
+
rtl: this.getContext("direction") === "rtl",
|
|
239
|
+
hasLoadData: Boolean(this.getProp("loadData")),
|
|
240
|
+
rowProps: (row) => buildRowProps(row, state, this.getProps()),
|
|
241
|
+
typeahead: this.#typeahead,
|
|
242
|
+
moveTo: (index, key) => {
|
|
243
|
+
this.setState({ keyboardKey: key });
|
|
244
|
+
this.adapter.revealRow(index, key);
|
|
245
|
+
},
|
|
246
|
+
select: this.handleNodeSelect,
|
|
247
|
+
expand: this.handleNodeExpand
|
|
248
|
+
});
|
|
249
|
+
};
|
|
219
250
|
handleNodeSelect = (e, treeNode) => {
|
|
251
|
+
this.setState({ keyboardKey: treeNode.eventKey });
|
|
220
252
|
if (this.#isDisabled(treeNode)) return;
|
|
221
253
|
if (!this.#isMultiple()) this.#handleSingleSelect(e, treeNode);
|
|
222
254
|
else this.#handleMultipleSelect(e, treeNode);
|
|
223
255
|
};
|
|
224
256
|
handleNodeRightClick = (e, treeNode) => {
|
|
257
|
+
this.setState({ keyboardKey: treeNode.eventKey });
|
|
225
258
|
this.adapter.notifyRightClick(e, treeNode.data);
|
|
226
259
|
};
|
|
227
260
|
handleNodeDoubleClick = (e, treeNode) => {
|
|
261
|
+
this.setState({ keyboardKey: treeNode.eventKey });
|
|
228
262
|
this.adapter.notifyDoubleClick(e, treeNode.data);
|
|
229
263
|
};
|
|
230
264
|
handleNodeExpand = (_e, treeNode) => {
|
|
265
|
+
this.setState({ keyboardKey: treeNode.eventKey });
|
|
231
266
|
const { loadData } = this.getProps();
|
|
232
267
|
if (!loadData && (!treeNode.children || !treeNode.children.length)) return;
|
|
233
268
|
if (isTreeNodeLeaf(treeNode, loadData)) return;
|
|
@@ -94,6 +94,43 @@ export declare function getTreeKeyboardAction<T extends BasicFlattenNode>(event:
|
|
|
94
94
|
isLeaf: (row: T) => boolean;
|
|
95
95
|
rtl: boolean;
|
|
96
96
|
}, typeahead: Typeahead): TreeKeyboardAction | null;
|
|
97
|
+
/** The row the keys act on: the one the keyboard or the pointer moved to while it is shown, else `defaultIndex` (-1 for none) */
|
|
98
|
+
export declare function getTreeActiveIndex(rows: BasicFlattenNode[], keyboardKey: string | null, defaultIndex: number): number;
|
|
99
|
+
/** The members of a key event the tree keys read; DOM events and React synthetic events both satisfy it */
|
|
100
|
+
export type TreeKeyEvent = Pick<KeyboardEvent, 'key' | 'ctrlKey' | 'metaKey' | 'altKey' | 'preventDefault' | 'target' | 'currentTarget'>;
|
|
101
|
+
export interface TreeKeyDownOptions<E, T extends BasicFlattenNode, R> {
|
|
102
|
+
rows: T[];
|
|
103
|
+
activeIndex: number;
|
|
104
|
+
/** The key goes to a text field (a combobox's search input): only Up, Down and Enter act on the tree */
|
|
105
|
+
editing: boolean;
|
|
106
|
+
rtl: boolean;
|
|
107
|
+
hasLoadData: boolean;
|
|
108
|
+
/** The props a row renders with, null for a row with nothing to act on */
|
|
109
|
+
rowProps: (row: T) => R | null;
|
|
110
|
+
/** One per tree, since the typed string belongs to that tree */
|
|
111
|
+
typeahead: Typeahead;
|
|
112
|
+
moveTo: (index: number, key: string) => void;
|
|
113
|
+
/** Enter, and Space outside a text field: selects, or checks in a multiple tree */
|
|
114
|
+
select: (event: E, row: R) => void;
|
|
115
|
+
expand: (event: E, row: R) => void;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The keys of an APG tree view on its active row, which aria-activedescendant points at while focus stays on the tree
|
|
119
|
+
* or the combobox (see `getTreeKeyboardAction`). Returns whether the key was handled; a handled key is prevented.
|
|
120
|
+
*/
|
|
121
|
+
export declare function handleTreeKeyDown<E extends TreeKeyEvent, T extends BasicFlattenNode, R extends Pick<BasicTreeNodeProps, 'expanded' | 'isLeaf' | 'children' | 'loaded'>>(event: E, { rows, activeIndex, editing, rtl, hasLoadData, rowProps, typeahead, moveTo, select, expand }: TreeKeyDownOptions<E, T, R>): boolean;
|
|
122
|
+
/** Whether a key on the tree comes from a tabbable control inside a row, which handles its own keys */
|
|
123
|
+
export declare function isRowControlKey({ target, currentTarget }: Pick<Event, 'target' | 'currentTarget'>): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Focus arriving in a tree that keeps it on itself. A click focuses the tabindex=-1 element it lands on (the virtual
|
|
126
|
+
* scroller, a row's checkbox), so the tree takes focus back and aria-activedescendant and the row's focus ring keep
|
|
127
|
+
* working. Keyboard focus on the tree calls `reveal`, since a virtual list may not have rendered the active row;
|
|
128
|
+
* pointer focus does not, because scrolling back to the stale active row would unmount the clicked row.
|
|
129
|
+
*/
|
|
130
|
+
export declare function handleTreeFocusIn({ target, currentTarget: tree }: {
|
|
131
|
+
target: EventTarget | null;
|
|
132
|
+
currentTarget: HTMLElement;
|
|
133
|
+
}, reveal: () => void): void;
|
|
97
134
|
/**
|
|
98
135
|
* The node for a selected key missing from treeData: found in the object value (onChangeWithObject), else built from
|
|
99
136
|
* the key. The label goes under keyMaps.label, then TreeSelect's treeNodeLabelProp, then 'label'.
|
|
@@ -231,6 +231,47 @@ function getTreeKeyboardAction(event, rows, activeIndex, editing, { isRow, isExp
|
|
|
231
231
|
if (action && action.type !== "move" && !hasRow) return { type: "none" };
|
|
232
232
|
return action;
|
|
233
233
|
}
|
|
234
|
+
/** The row the keys act on: the one the keyboard or the pointer moved to while it is shown, else `defaultIndex` (-1 for none) */
|
|
235
|
+
function getTreeActiveIndex(rows, keyboardKey, defaultIndex) {
|
|
236
|
+
const index = rows.findIndex((row) => row.key === keyboardKey);
|
|
237
|
+
return index === -1 ? defaultIndex : index;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* The keys of an APG tree view on its active row, which aria-activedescendant points at while focus stays on the tree
|
|
241
|
+
* or the combobox (see `getTreeKeyboardAction`). Returns whether the key was handled; a handled key is prevented.
|
|
242
|
+
*/
|
|
243
|
+
function handleTreeKeyDown(event, { rows, activeIndex, editing, rtl, hasLoadData, rowProps, typeahead, moveTo, select, expand }) {
|
|
244
|
+
const action = getTreeKeyboardAction(event, rows, activeIndex, editing, {
|
|
245
|
+
isRow: (row) => rowProps(row) !== null,
|
|
246
|
+
isExpanded: (row) => Boolean(rowProps(row)?.expanded),
|
|
247
|
+
isLeaf: (row) => isTreeNodeLeaf(rowProps(row) ?? {}, hasLoadData),
|
|
248
|
+
rtl
|
|
249
|
+
}, typeahead);
|
|
250
|
+
if (!action) return false;
|
|
251
|
+
event.preventDefault();
|
|
252
|
+
const row = rows[activeIndex] ? rowProps(rows[activeIndex]) : null;
|
|
253
|
+
if (action.type === "move") moveTo(action.index, rows[action.index].key);
|
|
254
|
+
else if (row && action.type === "select") select(event, row);
|
|
255
|
+
else if (row && action.type !== "none") expand(event, row);
|
|
256
|
+
return true;
|
|
257
|
+
}
|
|
258
|
+
/** Whether a key on the tree comes from a tabbable control inside a row, which handles its own keys */
|
|
259
|
+
function isRowControlKey({ target, currentTarget }) {
|
|
260
|
+
return target !== currentTarget && (target instanceof HTMLElement || target instanceof SVGElement) && target.tabIndex >= 0;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Focus arriving in a tree that keeps it on itself. A click focuses the tabindex=-1 element it lands on (the virtual
|
|
264
|
+
* scroller, a row's checkbox), so the tree takes focus back and aria-activedescendant and the row's focus ring keep
|
|
265
|
+
* working. Keyboard focus on the tree calls `reveal`, since a virtual list may not have rendered the active row;
|
|
266
|
+
* pointer focus does not, because scrolling back to the stale active row would unmount the clicked row.
|
|
267
|
+
*/
|
|
268
|
+
function handleTreeFocusIn({ target, currentTarget: tree }, reveal) {
|
|
269
|
+
if (target !== tree) {
|
|
270
|
+
if ((target instanceof HTMLElement || target instanceof SVGElement) && target.tabIndex < 0) tree.focus({ preventScroll: true });
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
if (tree.matches(":focus-visible")) reveal();
|
|
274
|
+
}
|
|
234
275
|
/**
|
|
235
276
|
* The node for a selected key missing from treeData: found in the object value (onChangeWithObject), else built from
|
|
236
277
|
* the key. The label goes under keyMaps.label, then TreeSelect's treeNodeLabelProp, then 'label'.
|
|
@@ -562,4 +603,4 @@ function getMultipleSelectResult({ checked, eventKey }, { disableStrictly, check
|
|
|
562
603
|
}
|
|
563
604
|
return null;
|
|
564
605
|
}
|
|
565
|
-
export { buildRowProps, calcCheckedStatus, calcRelatedCheckedKeys, deriveExpandedKeys, deriveSearchingState, deriveTreeState, getCheckedState, getClearedSelection, getDataForKeyNotInKeyEntities, getMultipleChange, getMultipleSelectResult, getNodeData, getSearchState, getTransitionNodes, getTreeKeyAction, getTreeKeyboardAction, getTreeLabelClassMap, getTreeNodeProps, getTreeRowAria, getTreeRowClassMap, isTreeNodeLeaf, loadTreeNode, nodeId, sameKeys };
|
|
606
|
+
export { buildRowProps, calcCheckedStatus, calcRelatedCheckedKeys, deriveExpandedKeys, deriveSearchingState, deriveTreeState, getCheckedState, getClearedSelection, getDataForKeyNotInKeyEntities, getMultipleChange, getMultipleSelectResult, getNodeData, getSearchState, getTransitionNodes, getTreeActiveIndex, getTreeKeyAction, getTreeKeyboardAction, getTreeLabelClassMap, getTreeNodeProps, getTreeRowAria, getTreeRowClassMap, handleTreeFocusIn, handleTreeKeyDown, isRowControlKey, isTreeNodeLeaf, loadTreeNode, nodeId, sameKeys };
|
|
@@ -3,6 +3,8 @@ export declare const cssClasses: {
|
|
|
3
3
|
PREFIX_TREE: string;
|
|
4
4
|
PREFIX_OPTION: string;
|
|
5
5
|
};
|
|
6
|
+
/** Keys of `classNames` and `styles`; the root element takes `className` and `style` */
|
|
7
|
+
export type TreeSelectPart = 'dropdown' | 'optionList';
|
|
6
8
|
export declare const strings: {
|
|
7
9
|
readonly SIZE_SET: readonly ["small", "large", "default"];
|
|
8
10
|
readonly SEARCH_POSITION_DROPDOWN: "dropdown";
|
|
@@ -2,7 +2,8 @@ import BaseFoundation, { DefaultAdapter } from "../../base/foundation.js";
|
|
|
2
2
|
import { ValidateStatus } from "../../base/constants.js";
|
|
3
3
|
import "../../base/index.js";
|
|
4
4
|
import { Size } from "../../utils/type.js";
|
|
5
|
-
import { BasicExpandedOtherProps, BasicTreeInnerData, BasicTreeNodeData, BasicTreeNodeProps, BasicTreeProps } from "../tree/foundation.js";
|
|
5
|
+
import { BasicExpandedOtherProps, BasicTreeInnerData, BasicTreeNodeData, BasicTreeNodeProps, BasicTreeProps, TreeContext } from "../tree/foundation.js";
|
|
6
|
+
import { TreeKeyEvent } from "../tree/shared.js";
|
|
6
7
|
import { strings } from "./constants.js";
|
|
7
8
|
export type BasicRenderSelectedItemInMultiple = (treeNode: BasicTreeNodeData, otherProps: {
|
|
8
9
|
index: number | string;
|
|
@@ -38,13 +39,10 @@ export interface BasicTreeSelectProps extends Pick<BasicTreeProps, 'virtualize'
|
|
|
38
39
|
autoAdjustOverflow?: boolean;
|
|
39
40
|
clickToHide?: boolean;
|
|
40
41
|
defaultOpen?: boolean;
|
|
41
|
-
dropdownClassName?: string;
|
|
42
42
|
dropdownMatchSelectWidth?: boolean;
|
|
43
|
-
dropdownStyle?: any;
|
|
44
43
|
insetLabel?: any;
|
|
45
44
|
maxTagCount?: number;
|
|
46
45
|
motionExpand?: boolean;
|
|
47
|
-
optionListStyle?: any;
|
|
48
46
|
outerBottomSlot?: any;
|
|
49
47
|
outerTopSlot?: any;
|
|
50
48
|
placeholder?: string;
|
|
@@ -74,7 +72,7 @@ export interface BasicTreeSelectProps extends Pick<BasicTreeProps, 'virtualize'
|
|
|
74
72
|
onVisibleChange?: (isVisible: boolean) => void;
|
|
75
73
|
onLoad?: (keys: Set<string>, data: BasicTreeNodeData) => void;
|
|
76
74
|
}
|
|
77
|
-
export interface BasicTreeSelectInnerData extends Pick<BasicTreeInnerData, 'keyEntities' | 'treeData' | 'flattenNodes' | 'cachedFlattenNodes' | 'selectedKeys' | 'checkedKeys' | 'halfCheckedKeys' | 'motionKeys' | 'motionType' | 'expandedKeys' | 'filteredKeys' | 'filteredExpandedKeys' | 'filteredShownKeys' | 'cachedKeyValuePairs' | 'inputValue' | 'disabledKeys' | 'loadedKeys' | 'loadingKeys' | 'realCheckedKeys'> {
|
|
75
|
+
export interface BasicTreeSelectInnerData extends Pick<BasicTreeInnerData, 'keyEntities' | 'treeData' | 'flattenNodes' | 'cachedFlattenNodes' | 'selectedKeys' | 'checkedKeys' | 'halfCheckedKeys' | 'motionKeys' | 'motionType' | 'expandedKeys' | 'filteredKeys' | 'filteredExpandedKeys' | 'filteredShownKeys' | 'cachedKeyValuePairs' | 'inputValue' | 'disabledKeys' | 'loadedKeys' | 'loadingKeys' | 'realCheckedKeys' | 'keyboardKey'> {
|
|
78
76
|
inputTriggerFocus: boolean;
|
|
79
77
|
isOpen: boolean;
|
|
80
78
|
prevProps: BasicTreeSelectProps | null;
|
|
@@ -84,10 +82,9 @@ export interface BasicTreeSelectInnerData extends Pick<BasicTreeInnerData, 'keyE
|
|
|
84
82
|
* E is the host's trigger click or key event, passed on to onFocus and onBlur; focus entering or leaving passes the
|
|
85
83
|
* native FocusEvent, a mousedown outside blurs with the native MouseEvent
|
|
86
84
|
*/
|
|
87
|
-
export interface TreeSelectAdapter<P extends BasicTreeSelectProps = BasicTreeSelectProps, S extends BasicTreeSelectInnerData = BasicTreeSelectInnerData, E = unknown> extends DefaultAdapter<P, S> {
|
|
85
|
+
export interface TreeSelectAdapter<P extends BasicTreeSelectProps = BasicTreeSelectProps, S extends BasicTreeSelectInnerData = BasicTreeSelectInnerData, E = unknown> extends DefaultAdapter<P, S, TreeContext> {
|
|
88
86
|
notifySelect: (selectedKey: string, selected: boolean, selectedNode: BasicTreeNodeData) => void;
|
|
89
87
|
notifySearch: (input: string, filteredExpandedKeys: string[], filteredNodes: BasicTreeNodeData[]) => void;
|
|
90
|
-
/** Called right after `isOpen` is written; a host resets its own view state of the dropdown (the active row) here */
|
|
91
88
|
notifyVisibleChange: (visible: boolean) => void;
|
|
92
89
|
notifyClear: (e: any) => void;
|
|
93
90
|
notifyChange: BasicOnChangeWithBasic;
|
|
@@ -101,6 +98,8 @@ export interface TreeSelectAdapter<P extends BasicTreeSelectProps = BasicTreeSel
|
|
|
101
98
|
/** Focuses the element on the trigger that takes the keyboard: its search input, its tags or the trigger itself */
|
|
102
99
|
focusTrigger: () => void;
|
|
103
100
|
isInTrigger: (node?: EventTarget | null) => boolean;
|
|
101
|
+
/** Scrolls the row a key moved to into view; `index` is its place in flattenNodes, and the list may not be mounted yet */
|
|
102
|
+
revealRow: (index: number, key: string) => void;
|
|
104
103
|
}
|
|
105
104
|
export default class TreeSelectFoundation<P extends BasicTreeSelectProps = BasicTreeSelectProps, S extends BasicTreeSelectInnerData = BasicTreeSelectInnerData, E = unknown> extends BaseFoundation<TreeSelectAdapter<P, S, E>, P, S> {
|
|
106
105
|
#private;
|
|
@@ -113,6 +112,8 @@ export default class TreeSelectFoundation<P extends BasicTreeSelectProps = Basic
|
|
|
113
112
|
/** The state that props imply, given the previous state; null when nothing changed (see `deriveTreeState`) */
|
|
114
113
|
static deriveState(props: BasicTreeSelectProps, prevState: BasicTreeSelectInnerData): Partial<BasicTreeSelectInnerData> | null;
|
|
115
114
|
static getInitialState(props: BasicTreeSelectProps): BasicTreeSelectInnerData;
|
|
115
|
+
/** The row the keys act on, -1 for none: an APG combobox opens without an active option */
|
|
116
|
+
static getActiveIndex({ flattenNodes, keyboardKey }: Pick<BasicTreeSelectInnerData, 'flattenNodes' | 'keyboardKey'>): number;
|
|
116
117
|
/** The keys the trigger shows: the selection, or in multiple mode the checked keys merged as onChange reports them */
|
|
117
118
|
static getTriggerKeys(props: Pick<BasicTreeSelectProps, 'multiple' | 'checkRelation' | 'autoMergeValue' | 'leafOnly'>, { checkedKeys, realCheckedKeys, keyEntities, selectedKeys }: Pick<BasicTreeSelectInnerData, 'selectedKeys' | 'checkedKeys' | 'realCheckedKeys' | 'keyEntities'>): string[];
|
|
118
119
|
static hasValue(props: Pick<BasicTreeSelectProps, 'multiple' | 'checkRelation'>, { selectedKeys, checkedKeys, realCheckedKeys }: Pick<BasicTreeSelectInnerData, 'selectedKeys' | 'checkedKeys' | 'realCheckedKeys'>): boolean;
|
|
@@ -144,10 +145,14 @@ export default class TreeSelectFoundation<P extends BasicTreeSelectProps = Basic
|
|
|
144
145
|
/**
|
|
145
146
|
* Enter toggles the popup like a click; Down and Up open a closed one (APG combobox). Outside a text field (the
|
|
146
147
|
* select-only combobox) Space toggles it like Enter, and Home and End open a closed one: the view moves to the
|
|
147
|
-
* first or the last row
|
|
148
|
-
* view there.
|
|
148
|
+
* first or the last row.
|
|
149
149
|
*/
|
|
150
|
-
handleSelectionKeyDown: (e: E & Pick<KeyboardEvent, "
|
|
150
|
+
handleSelectionKeyDown: (e: E & TreeKeyEvent & Pick<KeyboardEvent, "detail">) => void;
|
|
151
|
+
/**
|
|
152
|
+
* Tree keys of the open popup (APG combobox with a tree popup), acting on the active row while the focus stays on
|
|
153
|
+
* the combobox. In a text field only Up, Down and Enter act on the tree. Returns whether the key was handled.
|
|
154
|
+
*/
|
|
155
|
+
handleRowKeyDown: (e: E & TreeKeyEvent) => boolean;
|
|
151
156
|
handleClear: (e?: E) => void;
|
|
152
157
|
removeTag: (eventKey: BasicTreeNodeData["key"]) => void;
|
|
153
158
|
handleNodeSelect: (e: E, treeNode: BasicTreeNodeProps) => void;
|