@fibrae/semi-foundation 0.1.1 → 0.3.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/anchor/foundation.d.ts +1 -4
- package/dist/anchor/foundation.js +21 -22
- package/dist/audio-player/foundation.d.ts +10 -13
- package/dist/audio-player/foundation.js +19 -20
- package/dist/auto-complete/foundation.d.ts +12 -14
- package/dist/auto-complete/foundation.js +51 -52
- package/dist/avatar/foundation.d.ts +5 -6
- package/dist/avatar/foundation.js +16 -16
- package/dist/avatar/variables.scss +0 -1
- package/dist/backtop/foundation.d.ts +2 -5
- package/dist/backtop/foundation.js +7 -8
- package/dist/banner/foundation.d.ts +1 -1
- package/dist/banner/foundation.js +4 -4
- package/dist/base/auto-close-foundation.d.ts +8 -9
- package/dist/base/auto-close-foundation.js +15 -15
- package/dist/base/foundation.d.ts +4 -4
- package/dist/base/foundation.js +12 -11
- package/dist/base/list-store.d.ts +0 -1
- package/dist/breadcrumb/foundation.d.ts +5 -5
- package/dist/breadcrumb/foundation.js +9 -10
- package/dist/breadcrumb/item-foundation.d.ts +3 -3
- package/dist/breadcrumb/item-foundation.js +6 -6
- package/dist/calendar/event-util.d.ts +0 -10
- package/dist/calendar/event-util.js +1 -11
- package/dist/calendar/foundation.d.ts +1 -6
- package/dist/calendar/foundation.js +5 -9
- package/dist/calendar/month-foundation.d.ts +2 -3
- package/dist/calendar/month-foundation.js +6 -7
- package/dist/carousel/foundation.d.ts +17 -19
- package/dist/carousel/foundation.js +51 -51
- package/dist/cascader/foundation.d.ts +36 -32
- package/dist/cascader/foundation.js +145 -132
- package/dist/cascader/util.d.ts +1 -8
- package/dist/cascader/util.js +1 -8
- package/dist/checkbox/checkbox-foundation.d.ts +3 -7
- package/dist/checkbox/checkbox-foundation.js +15 -17
- package/dist/checkbox/checkbox-group-foundation.d.ts +2 -3
- package/dist/checkbox/checkbox-group-foundation.js +8 -8
- package/dist/code-highlight/index.d.ts +1 -2
- package/dist/code-highlight/index.js +3 -3
- package/dist/collapse/foundation.d.ts +2 -2
- package/dist/collapse/foundation.js +7 -7
- package/dist/collapsible/foundation.d.ts +3 -3
- package/dist/collapsible/foundation.js +8 -8
- package/dist/color-picker/alpha-slider-foundation.d.ts +2 -4
- package/dist/color-picker/alpha-slider-foundation.js +10 -10
- package/dist/color-picker/color-choose-area-foundation.d.ts +2 -5
- package/dist/color-picker/color-choose-area-foundation.js +14 -14
- package/dist/color-picker/color-picker.scss +0 -2
- package/dist/color-picker/color-slider-foundation.d.ts +2 -4
- package/dist/color-picker/color-slider-foundation.js +10 -10
- package/dist/color-picker/data-part-foundation.d.ts +5 -5
- package/dist/color-picker/data-part-foundation.js +11 -11
- package/dist/color-picker/foundation.d.ts +4 -4
- package/dist/color-picker/foundation.js +10 -10
- package/dist/color-picker/interface.d.ts +0 -1
- package/dist/config-provider/breakpoint-observer.d.ts +3 -3
- package/dist/config-provider/breakpoint-observer.js +6 -6
- package/dist/config-provider/responsive-types.d.ts +0 -16
- package/dist/cropper/foundation.d.ts +15 -16
- package/dist/cropper/foundation.js +26 -24
- package/dist/date-picker/_utils/get-default-picker-date.d.ts +0 -3
- package/dist/date-picker/_utils/get-default-picker-date.js +0 -3
- package/dist/date-picker/_utils/get-inset-input-format-token.d.ts +0 -2
- package/dist/date-picker/_utils/get-inset-input-format-token.js +0 -2
- package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.d.ts +0 -2
- package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.js +0 -2
- package/dist/date-picker/_utils/parser.d.ts +0 -3
- package/dist/date-picker/_utils/parser.js +0 -7
- package/dist/date-picker/_utils/picker-type.d.ts +1 -3
- package/dist/date-picker/_utils/picker-type.js +0 -2
- package/dist/date-picker/_utils/to-callback-args.d.ts +0 -1
- package/dist/date-picker/_utils/to-callback-args.js +0 -1
- package/dist/date-picker/date-picker.scss +0 -3
- package/dist/date-picker/foundation.d.ts +39 -58
- package/dist/date-picker/foundation.js +126 -153
- package/dist/date-picker/input-foundation.d.ts +10 -16
- package/dist/date-picker/input-foundation.js +28 -30
- package/dist/date-picker/month-foundation.d.ts +0 -3
- package/dist/date-picker/month-foundation.js +0 -2
- package/dist/date-picker/months-grid-foundation.d.ts +17 -26
- package/dist/date-picker/months-grid-foundation.js +65 -75
- package/dist/date-picker/year-and-month-foundation.d.ts +3 -3
- package/dist/date-picker/year-and-month-foundation.js +11 -11
- package/dist/drag-move/foundation.d.ts +2 -3
- package/dist/drag-move/foundation.js +15 -13
- package/dist/dropdown/foundation.d.ts +8 -7
- package/dist/dropdown/foundation.js +32 -28
- package/dist/dropdown/menu-foundation.d.ts +1 -2
- package/dist/dropdown/menu-foundation.js +11 -11
- package/dist/feedback/foundation.d.ts +9 -10
- package/dist/feedback/foundation.js +33 -33
- package/dist/feedback/variables.scss +1 -5
- package/dist/float-button/float-button.css +0 -1
- package/dist/float-button/float-button.scss +0 -2
- package/dist/form/form-api-proxy.d.ts +8 -7
- package/dist/form/form-api-proxy.js +25 -25
- package/dist/form/form.scss +0 -12
- package/dist/form/foundation.d.ts +5 -5
- package/dist/form/foundation.js +60 -76
- package/dist/form/interface.d.ts +2 -15
- package/dist/form/utils.d.ts +0 -8
- package/dist/form/utils.js +0 -7
- package/dist/form/variables.scss +1 -4
- package/dist/grid/variables.scss +0 -10
- package/dist/highlight/foundation.d.ts +0 -2
- package/dist/highlight/foundation.js +1 -3
- package/dist/hot-keys/foundation.d.ts +2 -3
- package/dist/hot-keys/foundation.js +5 -5
- package/dist/image/image-foundation.d.ts +4 -6
- package/dist/image/image-foundation.js +10 -10
- package/dist/image/preview-footer-foundation.d.ts +3 -4
- package/dist/image/preview-footer-foundation.js +10 -10
- package/dist/image/preview-foundation.d.ts +0 -3
- package/dist/image/preview-foundation.js +7 -6
- package/dist/image/preview-image-foundation.d.ts +6 -9
- package/dist/image/preview-image-foundation.js +14 -14
- package/dist/image/preview-inner-foundation.d.ts +9 -10
- package/dist/image/preview-inner-foundation.js +38 -38
- package/dist/input/foundation.d.ts +10 -11
- package/dist/input/foundation.js +47 -49
- package/dist/input/text-entry-foundation.d.ts +3 -5
- package/dist/input/text-entry-foundation.js +14 -15
- package/dist/input/textarea-foundation.d.ts +7 -8
- package/dist/input/textarea-foundation.js +36 -36
- package/dist/input-number/caret.d.ts +0 -1
- package/dist/input-number/caret.js +0 -1
- package/dist/input-number/foundation.d.ts +16 -19
- package/dist/input-number/foundation.js +54 -58
- package/dist/json-viewer/foundation.d.ts +8 -10
- package/dist/json-viewer/foundation.js +23 -24
- package/dist/locale/interface.d.ts +0 -3
- package/dist/lottie/foundation.d.ts +1 -1
- package/dist/lottie/foundation.js +4 -4
- package/dist/markdown-render/foundation.d.ts +2 -7
- package/dist/markdown-render/foundation.js +5 -9
- package/dist/modal/modal-content-foundation.d.ts +7 -7
- package/dist/modal/modal-content-foundation.js +20 -20
- package/dist/modal/modal-foundation.d.ts +6 -6
- package/dist/modal/modal-foundation.js +24 -24
- package/dist/navigation/foundation.d.ts +1 -8
- package/dist/navigation/foundation.js +14 -20
- package/dist/navigation/item-foundation.d.ts +1 -1
- package/dist/navigation/item-foundation.js +8 -8
- package/dist/navigation/sub-nav-foundation.d.ts +3 -4
- package/dist/navigation/sub-nav-foundation.js +17 -17
- package/dist/notification/notification-list-foundation.d.ts +7 -8
- package/dist/notification/notification-list-foundation.js +12 -13
- package/dist/notification/variables.scss +0 -1
- package/dist/overflow-list/foundation.d.ts +4 -6
- package/dist/overflow-list/foundation.js +18 -19
- package/dist/pagination/foundation.d.ts +8 -10
- package/dist/pagination/foundation.js +28 -28
- package/dist/pincode/foundation.d.ts +6 -9
- package/dist/pincode/foundation.js +23 -26
- package/dist/popconfirm/popconfirm-foundation.d.ts +7 -9
- package/dist/popconfirm/popconfirm-foundation.js +26 -26
- package/dist/progress/generates.d.ts +1 -4
- package/dist/progress/generates.js +1 -4
- package/dist/progress/utils.d.ts +1 -1
- package/dist/progress/utils.js +1 -1
- package/dist/radio/radio-foundation.d.ts +5 -9
- package/dist/radio/radio-foundation.js +15 -16
- package/dist/radio/radio-group-foundation.d.ts +2 -3
- package/dist/radio/radio-group-foundation.js +9 -9
- package/dist/rating/foundation.d.ts +10 -15
- package/dist/rating/foundation.js +35 -38
- package/dist/resizable/group/index.d.ts +6 -10
- package/dist/resizable/group/index.js +40 -44
- package/dist/resizable/resizable.scss +0 -1
- package/dist/resizable/single/index.d.ts +3 -7
- package/dist/resizable/single/index.js +10 -13
- package/dist/scroll-list/item-foundation.d.ts +7 -9
- package/dist/scroll-list/item-foundation.js +35 -36
- package/dist/scroll-list/variables.scss +1 -6
- package/dist/select/foundation.d.ts +42 -57
- package/dist/select/foundation.js +214 -279
- package/dist/select/option-foundation.d.ts +23 -28
- package/dist/select/option-foundation.js +10 -19
- package/dist/select/variables.scss +1 -8
- package/dist/side-sheet/side-sheet-foundation.d.ts +7 -12
- package/dist/side-sheet/side-sheet-foundation.js +23 -27
- package/dist/side-sheet/variables.scss +1 -3
- package/dist/slider/foundation.d.ts +17 -28
- package/dist/slider/foundation.js +47 -59
- package/dist/slider/variables.scss +1 -5
- package/dist/sortable/accessibility.d.ts +1 -1
- package/dist/sortable/accessibility.js +2 -2
- package/dist/spin/foundation.d.ts +2 -4
- package/dist/spin/foundation.js +6 -7
- package/dist/spin/variables.scss +1 -3
- package/dist/steps/utils.d.ts +1 -1
- package/dist/switch/foundation.d.ts +2 -3
- package/dist/switch/foundation.js +7 -7
- package/dist/switch/switch.scss +1 -1
- package/dist/switch/variables.scss +1 -5
- package/dist/table/foundation.d.ts +24 -33
- package/dist/table/foundation.js +144 -108
- package/dist/table/table.scss +0 -1
- package/dist/table/utils.d.ts +2 -10
- package/dist/table/utils.js +0 -13
- package/dist/table/variables.scss +1 -5
- package/dist/tabs/foundation.d.ts +5 -14
- package/dist/tabs/foundation.js +17 -21
- package/dist/tabs/tabs.scss +1 -1
- package/dist/tag/focus.js +0 -1
- package/dist/tag-input/foundation.d.ts +11 -13
- package/dist/tag-input/foundation.js +52 -53
- package/dist/tag-input/tag-input.scss +0 -1
- package/dist/tag-input/utils/tag-focus.d.ts +0 -1
- package/dist/tag-input/utils/tag-focus.js +0 -1
- package/dist/time-picker/combox-foundation.d.ts +3 -11
- package/dist/time-picker/combox-foundation.js +3 -10
- package/dist/time-picker/foundation.d.ts +13 -23
- package/dist/time-picker/foundation.js +39 -48
- package/dist/time-picker/input-foundation.d.ts +4 -4
- package/dist/time-picker/input-foundation.js +13 -13
- package/dist/time-picker/utils/index.d.ts +0 -11
- package/dist/time-picker/utils/index.js +0 -11
- package/dist/toast/toast-list-foundation.d.ts +7 -7
- package/dist/toast/toast-list-foundation.js +14 -14
- package/dist/tooltip/adjust-position.d.ts +1 -2
- package/dist/tooltip/constants.d.ts +0 -3
- package/dist/tooltip/constants.js +0 -3
- package/dist/tooltip/foundation.d.ts +9 -12
- package/dist/tooltip/foundation.js +67 -63
- package/dist/tooltip/position.scss +0 -1
- package/dist/transfer/foundation.d.ts +22 -13
- package/dist/transfer/foundation.js +38 -24
- package/dist/tree/foundation.d.ts +14 -16
- package/dist/tree/foundation.js +61 -62
- package/dist/tree/shared.d.ts +2 -4
- package/dist/tree/shared.js +0 -2
- package/dist/tree/tree-util.d.ts +0 -5
- package/dist/tree/tree-util.js +0 -5
- package/dist/tree-select/foundation.d.ts +26 -22
- package/dist/tree-select/foundation.js +91 -86
- package/dist/typography/ellipsis.d.ts +5 -7
- package/dist/typography/ellipsis.js +8 -10
- package/dist/typography/format-numeral.d.ts +1 -1
- package/dist/typography/format-numeral.js +2 -2
- package/dist/typography/typography.scss +0 -1
- package/dist/upload/constants.d.ts +1 -1
- package/dist/upload/foundation.d.ts +17 -23
- package/dist/upload/foundation.js +93 -103
- package/dist/upload/utils.d.ts +3 -8
- package/dist/upload/utils.js +6 -11
- package/dist/user-guide/foundation.d.ts +3 -5
- package/dist/user-guide/foundation.js +19 -19
- package/dist/utils/a11y.d.ts +2 -6
- package/dist/utils/a11y.js +1 -4
- package/dist/utils/announcer.d.ts +2 -2
- package/dist/utils/announcer.js +4 -4
- package/dist/utils/array.d.ts +0 -6
- package/dist/utils/array.js +0 -6
- package/dist/utils/date-fns-extra.js +1 -5
- package/dist/utils/dom.d.ts +0 -1
- package/dist/utils/dom.js +0 -1
- package/dist/utils/escape-html.js +0 -3
- package/dist/utils/field-sizing.d.ts +0 -2
- package/dist/utils/field-sizing.js +0 -2
- package/dist/utils/focus-handle.d.ts +1 -2
- package/dist/utils/focus-handle.js +1 -3
- package/dist/utils/focus-scope.d.ts +5 -6
- package/dist/utils/focus-scope.js +10 -11
- package/dist/utils/is-promise.d.ts +1 -1
- package/dist/utils/release-holder.d.ts +2 -2
- package/dist/utils/release-holder.js +4 -4
- package/dist/utils/scroll-lock.d.ts +3 -4
- package/dist/utils/scroll-lock.js +3 -4
- package/dist/utils/tween.d.ts +0 -1
- package/dist/utils/tween.js +0 -1
- package/dist/utils/uuid.d.ts +0 -1
- package/dist/utils/uuid.js +0 -1
- package/dist/utils/warning.d.ts +0 -1
- package/dist/utils/warning.js +0 -1
- package/dist/video-player/foundation.d.ts +15 -15
- package/dist/video-player/foundation.js +89 -89
- package/dist/video-player/progress-foundation.d.ts +2 -3
- package/dist/video-player/progress-foundation.js +12 -13
- package/dist/video-player/variables.scss +1 -1
- package/package.json +2 -2
|
@@ -16,10 +16,10 @@ const readViewport = () => ({
|
|
|
16
16
|
width: document.documentElement.clientWidth,
|
|
17
17
|
height: document.documentElement.clientHeight
|
|
18
18
|
});
|
|
19
|
-
|
|
19
|
+
function isInside(node, target) {
|
|
20
20
|
for (let current = node; current; current = current instanceof ShadowRoot ? current.host : current.parentNode) if (current === target) return true;
|
|
21
21
|
return false;
|
|
22
|
-
}
|
|
22
|
+
}
|
|
23
23
|
var Tooltip = class Tooltip extends BaseFoundation {
|
|
24
24
|
static #tracking = /* @__PURE__ */ new Set();
|
|
25
25
|
static #pending = /* @__PURE__ */ new Set();
|
|
@@ -42,7 +42,7 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
42
42
|
}
|
|
43
43
|
static #handleScroll(event) {
|
|
44
44
|
for (const tooltip of Tooltip.#tracking) {
|
|
45
|
-
const trigger = tooltip.
|
|
45
|
+
const trigger = tooltip.adapter.getTriggerElement();
|
|
46
46
|
if (!trigger || isInside(trigger, event.target)) Tooltip.#pending.add(tooltip);
|
|
47
47
|
}
|
|
48
48
|
Tooltip.#schedule();
|
|
@@ -63,8 +63,8 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
63
63
|
batch.forEach((tooltip, i) => tooltip.#apply(layouts[i]));
|
|
64
64
|
}
|
|
65
65
|
#handleClickOutside = (e) => {
|
|
66
|
-
if (!this.
|
|
67
|
-
this.
|
|
66
|
+
if (!this.adapter.getPortalContainer() || this.adapter.isEventInTrigger(e) || this.adapter.isEventInPopup(e)) return;
|
|
67
|
+
this.adapter.notifyClickOutSide(e);
|
|
68
68
|
if (this.#hidesOnClickOutside) this.hide();
|
|
69
69
|
};
|
|
70
70
|
#bindEvent() {
|
|
@@ -74,10 +74,10 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
74
74
|
this.#bindPortalEvent(portalEventSet);
|
|
75
75
|
}
|
|
76
76
|
#bindTriggerEvent(triggerEventSet) {
|
|
77
|
-
this.
|
|
77
|
+
this.adapter.registerTriggerEvent(triggerEventSet);
|
|
78
78
|
}
|
|
79
79
|
#bindPortalEvent(portalEventSet) {
|
|
80
|
-
this.
|
|
80
|
+
this.adapter.registerPortalEvent(portalEventSet);
|
|
81
81
|
}
|
|
82
82
|
#generateEvent(types) {
|
|
83
83
|
const triggerEventSet = {};
|
|
@@ -152,13 +152,13 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
152
152
|
#handleTriggerKeydown(event) {
|
|
153
153
|
const key = event?.key;
|
|
154
154
|
if (this.getProp("disableArrowKeyDown") || key !== "ArrowUp" && key !== "ArrowDown") return;
|
|
155
|
-
const focusableElements = FocusTrapHandle.getFocusableElements(this.
|
|
155
|
+
const focusableElements = FocusTrapHandle.getFocusableElements(this.adapter.getPortalContainer());
|
|
156
156
|
if (!focusableElements.length) return;
|
|
157
157
|
if (key === "ArrowUp") this.#handleTriggerArrowUpKeydown(focusableElements, event);
|
|
158
158
|
else this.#handleTriggerArrowDownKeydown(focusableElements, event);
|
|
159
159
|
}
|
|
160
160
|
#getActiveElement() {
|
|
161
|
-
return FocusTrapHandle.getActiveElement(this.
|
|
161
|
+
return FocusTrapHandle.getActiveElement(this.adapter.getPortalContainer() ?? this.adapter.getTriggerNode());
|
|
162
162
|
}
|
|
163
163
|
#handleContainerTabKeyDown(focusableElements, event) {
|
|
164
164
|
const { preventScroll } = this.getProps();
|
|
@@ -197,14 +197,14 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
197
197
|
const controlled = this.getProp("visible");
|
|
198
198
|
if (controlled === void 0 || controlled === visible) return false;
|
|
199
199
|
this.#requestedVisible = visible;
|
|
200
|
-
this.
|
|
200
|
+
this.adapter.notifyVisibleChange(visible);
|
|
201
201
|
return true;
|
|
202
202
|
}
|
|
203
203
|
#reportVisibleChange(visible) {
|
|
204
|
-
if (this.getProp("visible") === void 0) this.
|
|
204
|
+
if (this.getProp("visible") === void 0) this.adapter.notifyVisibleChange(visible);
|
|
205
205
|
}
|
|
206
206
|
#startTracking() {
|
|
207
|
-
const popup = this.
|
|
207
|
+
const popup = this.adapter.getPortalContainer();
|
|
208
208
|
this.#insetTop = popup ? Math.max(parseFloat(getComputedStyle(popup).getPropertyValue("--semi-tooltip-viewport-inset-top")) || 0, 0) : 0;
|
|
209
209
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
210
210
|
for (const { target, borderBoxSize } of entries) if (target === popup) this.#popupSize = {
|
|
@@ -221,8 +221,8 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
221
221
|
this.calcPosition();
|
|
222
222
|
}, { rootMargin: `${-this.#insetTop}px 0px 0px 0px` });
|
|
223
223
|
if (popup) resizeObserver.observe(popup);
|
|
224
|
-
this.
|
|
225
|
-
this.
|
|
224
|
+
this.adapter.observeTrigger(resizeObserver);
|
|
225
|
+
this.adapter.observeTrigger(intersectionObserver);
|
|
226
226
|
if (!Tooltip.#tracking.size) {
|
|
227
227
|
window.addEventListener("scroll", Tooltip.#handleScroll, {
|
|
228
228
|
capture: true,
|
|
@@ -232,8 +232,8 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
232
232
|
}
|
|
233
233
|
Tooltip.#tracking.add(this);
|
|
234
234
|
this.#stopTracking = () => {
|
|
235
|
-
this.
|
|
236
|
-
this.
|
|
235
|
+
this.adapter.unobserveTrigger(resizeObserver);
|
|
236
|
+
this.adapter.unobserveTrigger(intersectionObserver);
|
|
237
237
|
resizeObserver.disconnect();
|
|
238
238
|
intersectionObserver.disconnect();
|
|
239
239
|
Tooltip.#tracking.delete(this);
|
|
@@ -255,10 +255,9 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
255
255
|
this.#moveWatch?.observer.disconnect();
|
|
256
256
|
this.#moveWatch = null;
|
|
257
257
|
}
|
|
258
|
-
/** Reads the layout: the trigger, the popup size and the placement; null while there is nothing to place */
|
|
259
258
|
#measure(viewport) {
|
|
260
|
-
const popup = this.
|
|
261
|
-
const triggerRect = this.
|
|
259
|
+
const popup = this.adapter.getPortalContainer();
|
|
260
|
+
const triggerRect = this.adapter.getTriggerRect();
|
|
262
261
|
if (!this.#stopTracking || !popup || !triggerRect) return null;
|
|
263
262
|
const popupSize = this.#popupSize ?? {
|
|
264
263
|
width: popup.offsetWidth,
|
|
@@ -298,9 +297,8 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
298
297
|
viewport
|
|
299
298
|
};
|
|
300
299
|
}
|
|
301
|
-
/** Writes a measured layout to the popup unless it is already there */
|
|
302
300
|
#apply(layout) {
|
|
303
|
-
const popup = this.
|
|
301
|
+
const popup = this.adapter.getPortalContainer();
|
|
304
302
|
if (!layout || !popup) return;
|
|
305
303
|
this.#watchMove(layout);
|
|
306
304
|
const applied = this.#applied;
|
|
@@ -319,13 +317,14 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
319
317
|
* every frame while open if such a trigger is seen not following.
|
|
320
318
|
*/
|
|
321
319
|
#watchMove({ triggerRect: rect, viewport }) {
|
|
322
|
-
const trigger = this.
|
|
323
|
-
const
|
|
324
|
-
|
|
325
|
-
viewport.width -
|
|
326
|
-
viewport.height -
|
|
327
|
-
|
|
320
|
+
const trigger = this.adapter.getTriggerElement();
|
|
321
|
+
const marginAround = (around) => [
|
|
322
|
+
around.top,
|
|
323
|
+
viewport.width - around.right,
|
|
324
|
+
viewport.height - around.bottom,
|
|
325
|
+
around.left
|
|
328
326
|
].map((inset) => `${-Math.floor(inset)}px`).join(" ");
|
|
327
|
+
const rootMargin = marginAround(rect);
|
|
329
328
|
if (this.#moveWatch?.trigger === trigger && this.#moveWatch.rootMargin === rootMargin) return;
|
|
330
329
|
this.#moveWatch?.observer.disconnect();
|
|
331
330
|
this.#moveWatch = null;
|
|
@@ -337,6 +336,11 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
337
336
|
this.calcPosition();
|
|
338
337
|
return;
|
|
339
338
|
}
|
|
339
|
+
const current = this.adapter.getTriggerRect();
|
|
340
|
+
if (current && marginAround(current) !== rootMargin) {
|
|
341
|
+
this.calcPosition();
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
340
344
|
first = false;
|
|
341
345
|
if (!retried && intersectionRatio > 0 && intersectionRatio !== threshold) {
|
|
342
346
|
observer.disconnect();
|
|
@@ -501,26 +505,26 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
501
505
|
}
|
|
502
506
|
destroy() {
|
|
503
507
|
if (this.#open || this.getState("visible") || this.getState("transitionState") === "leave") {
|
|
504
|
-
this.
|
|
505
|
-
if (!this.getProp("keepDOM")) this.
|
|
508
|
+
this.adapter.closePopup();
|
|
509
|
+
if (!this.getProp("keepDOM")) this.adapter.removePortal();
|
|
506
510
|
}
|
|
507
511
|
this.#mounted = false;
|
|
508
512
|
this.#open = false;
|
|
509
513
|
this.#requestedVisible = void 0;
|
|
510
514
|
this.#endTracking();
|
|
511
|
-
this.
|
|
515
|
+
this.adapter.unregisterClickOutsideHandler();
|
|
512
516
|
this.#clearDelayTimer();
|
|
513
517
|
}
|
|
514
518
|
/** Regenerates the trigger and popup handlers, which depend on `trigger` and `clickToHide` */
|
|
515
|
-
rebindEvents() {
|
|
519
|
+
rebindEvents = () => {
|
|
516
520
|
this.#clearDelayTimer();
|
|
517
521
|
this.#bindEvent();
|
|
518
|
-
}
|
|
519
|
-
removePortal() {
|
|
520
|
-
this.
|
|
521
|
-
}
|
|
522
|
+
};
|
|
523
|
+
removePortal = () => {
|
|
524
|
+
this.adapter.removePortal();
|
|
525
|
+
};
|
|
522
526
|
/** Hosts call this when the `visible` prop changes */
|
|
523
|
-
handleVisiblePropChange() {
|
|
527
|
+
handleVisiblePropChange = () => {
|
|
524
528
|
const visible = this.getProp("visible");
|
|
525
529
|
const answered = visible === this.#requestedVisible;
|
|
526
530
|
this.#requestedVisible = void 0;
|
|
@@ -530,10 +534,10 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
530
534
|
else this.show();
|
|
531
535
|
} else if (delayed) this.delayHide();
|
|
532
536
|
else this.hide();
|
|
533
|
-
}
|
|
534
|
-
updateStateIfCursorOnTrigger() {
|
|
535
|
-
if (this.
|
|
536
|
-
}
|
|
537
|
+
};
|
|
538
|
+
updateStateIfCursorOnTrigger = () => {
|
|
539
|
+
if (this.adapter.isTriggerHovered()) this.getState("triggerEventSet")[TRIGGER_EVENT_NAMES.mouseEnter]?.();
|
|
540
|
+
};
|
|
537
541
|
delayShow() {
|
|
538
542
|
const mouseEnterDelay = this.getProp("mouseEnterDelay");
|
|
539
543
|
this.#clearDelayTimer();
|
|
@@ -549,39 +553,39 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
549
553
|
if (this.#open || this.#requestFromOwner(true)) return;
|
|
550
554
|
this.#open = true;
|
|
551
555
|
this.#clearDelayTimer();
|
|
552
|
-
this.
|
|
556
|
+
this.adapter.insertPortal();
|
|
553
557
|
const hides = trigger === "click" || clickTriggerToHide || trigger === "contextMenu";
|
|
554
558
|
if (hides || trigger === "custom") {
|
|
555
559
|
this.#hidesOnClickOutside = hides;
|
|
556
|
-
this.
|
|
560
|
+
this.adapter.registerClickOutsideHandler(this.#handleClickOutside);
|
|
557
561
|
}
|
|
558
562
|
}
|
|
559
563
|
/** Called once `showPopover()` has been issued for this opening (by the layout effect that reacts to the
|
|
560
564
|
* mount `insertPortal` requested); a hover popup can still back out here if the pointer already left. */
|
|
561
|
-
handleOpened() {
|
|
565
|
+
handleOpened = () => {
|
|
562
566
|
if (!this.#open) return;
|
|
563
567
|
if (this.getProp("trigger") === "hover" && this.getProp("visible") !== true) {
|
|
564
568
|
const activeElement = this.#getActiveElement();
|
|
565
|
-
const focusOpened = !this.getProp("disableFocusListener") && activeElement?.closest?.(`[data-popupid~="${CSS.escape(this.
|
|
566
|
-
const focusInPopup = Boolean(this.
|
|
567
|
-
if (!this.
|
|
569
|
+
const focusOpened = !this.getProp("disableFocusListener") && activeElement?.closest?.(`[data-popupid~="${CSS.escape(this.adapter.getPopupId())}"]`) != null;
|
|
570
|
+
const focusInPopup = Boolean(this.adapter.getPortalContainer()?.contains(activeElement));
|
|
571
|
+
if (!this.adapter.isTriggerHovered() && !focusOpened && !focusInPopup) {
|
|
568
572
|
this.hide();
|
|
569
573
|
return;
|
|
570
574
|
}
|
|
571
575
|
}
|
|
572
|
-
this.
|
|
573
|
-
this.
|
|
576
|
+
this.adapter.setInitialFocus();
|
|
577
|
+
this.adapter.notifyOpen();
|
|
574
578
|
this.#reportVisibleChange(true);
|
|
575
|
-
}
|
|
579
|
+
};
|
|
576
580
|
/** Hosts call this right after `showPopover()`: positions the popup and keeps it beside the trigger until it closes */
|
|
577
|
-
handleShown() {
|
|
581
|
+
handleShown = () => {
|
|
578
582
|
if (!this.#stopTracking) this.#startTracking();
|
|
579
583
|
this.calcPosition();
|
|
580
|
-
}
|
|
584
|
+
};
|
|
581
585
|
/** Positions an open popup beside its trigger at once, without waiting for a frame */
|
|
582
|
-
calcPosition() {
|
|
586
|
+
calcPosition = () => {
|
|
583
587
|
this.#apply(this.#measure(readViewport()));
|
|
584
|
-
}
|
|
588
|
+
};
|
|
585
589
|
delayHide() {
|
|
586
590
|
const mouseLeaveDelay = this.getProp("mouseLeaveDelay");
|
|
587
591
|
this.#clearDelayTimer();
|
|
@@ -600,10 +604,10 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
600
604
|
this.#open = false;
|
|
601
605
|
this.#clearDelayTimer();
|
|
602
606
|
if (!this.#mounted) return;
|
|
603
|
-
this.
|
|
607
|
+
this.adapter.unregisterClickOutsideHandler();
|
|
604
608
|
this.#endTracking();
|
|
605
609
|
if (wasOpen || this.getState("visible")) {
|
|
606
|
-
this.
|
|
610
|
+
this.adapter.closePopup();
|
|
607
611
|
this.#reportVisibleChange(false);
|
|
608
612
|
}
|
|
609
613
|
};
|
|
@@ -615,17 +619,17 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
615
619
|
const { trigger, closeOnEsc } = this.getProps();
|
|
616
620
|
if (!closeOnEsc) return false;
|
|
617
621
|
if (trigger !== "custom") {
|
|
618
|
-
if (this.
|
|
622
|
+
if (this.adapter.getPortalContainer()?.contains(this.#getActiveElement())) this.focusTrigger();
|
|
619
623
|
this.hide();
|
|
620
624
|
}
|
|
621
|
-
this.
|
|
625
|
+
this.adapter.notifyEscKeydown(event);
|
|
622
626
|
return true;
|
|
623
627
|
};
|
|
624
|
-
handleContainerKeydown(event) {
|
|
628
|
+
handleContainerKeydown = (event) => {
|
|
625
629
|
const { guardFocus } = this.getProps();
|
|
626
630
|
switch (event && event.key) {
|
|
627
631
|
case "Tab": if (guardFocus) {
|
|
628
|
-
const container = this.
|
|
632
|
+
const container = this.adapter.getPortalContainer();
|
|
629
633
|
const focusableElements = FocusTrapHandle.getFocusableElements(container);
|
|
630
634
|
if (focusableElements.length) {
|
|
631
635
|
if (event.shiftKey) this.#handleContainerShiftTabKeyDown(focusableElements, event);
|
|
@@ -633,18 +637,18 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
633
637
|
}
|
|
634
638
|
}
|
|
635
639
|
}
|
|
636
|
-
}
|
|
640
|
+
};
|
|
637
641
|
/**
|
|
638
642
|
* Focus the trigger. A 'focus' or 'hover' trigger binds onFocus to show the popup, so focusing it
|
|
639
643
|
* reopens the popup; callers hide the popup right after.
|
|
640
644
|
*/
|
|
641
|
-
focusTrigger() {
|
|
645
|
+
focusTrigger = () => {
|
|
642
646
|
const { trigger, returnFocusOnClose, preventScroll } = this.getProps();
|
|
643
647
|
if (!returnFocusOnClose || trigger === "custom") return;
|
|
644
648
|
const before = this.#getActiveElement();
|
|
645
|
-
this.
|
|
649
|
+
this.adapter.getTriggerNode()?.focus?.({ preventScroll });
|
|
646
650
|
const active = this.#getActiveElement();
|
|
647
651
|
if (active !== before && active?.tabIndex < 0) FocusTrapHandle.getFocusableElements(active)[0]?.focus({ preventScroll });
|
|
648
|
-
}
|
|
652
|
+
};
|
|
649
653
|
};
|
|
650
654
|
export { Tooltip as default };
|
|
@@ -22,13 +22,12 @@ export interface BasicResolvedDataItem extends BasicDataItem {
|
|
|
22
22
|
_parent?: Omit<BasicGroupItem, 'children'>;
|
|
23
23
|
/** The nodes from the root to this one in treeList mode; underscored so it never collides with the caller's `path` */
|
|
24
24
|
_path?: Array<BasicDataItem>;
|
|
25
|
-
/** Whether the node has no children in treeList mode; underscored for the same reason as `_path` */
|
|
26
25
|
_isLeaf?: boolean;
|
|
27
26
|
}
|
|
28
27
|
export type BasicFilter = boolean | ((searchValue: string, item: BasicDataItem) => boolean);
|
|
29
|
-
/** The props the foundation reads with getProp */
|
|
30
28
|
export interface TransferBaseProps {
|
|
31
29
|
dataSource?: Array<object>;
|
|
30
|
+
defaultValue?: Array<number | string>;
|
|
32
31
|
disabled?: boolean;
|
|
33
32
|
filter?: BasicFilter;
|
|
34
33
|
pagination?: {
|
|
@@ -38,14 +37,15 @@ export interface TransferBaseProps {
|
|
|
38
37
|
type?: string;
|
|
39
38
|
value?: Array<number | string>;
|
|
40
39
|
}
|
|
41
|
-
/** The state the foundation reads with getState */
|
|
42
40
|
export interface TransferBaseState {
|
|
43
41
|
inputValue: string;
|
|
44
42
|
leftCurrentPage: number;
|
|
45
43
|
/** The uncontrolled selection, in the shape of `value`; it is resolved against the dataSource when read */
|
|
46
44
|
selectedValues: Array<number | string>;
|
|
47
45
|
}
|
|
48
|
-
|
|
46
|
+
/** E is the host's focusout event, passed on to notifyBlur */
|
|
47
|
+
export interface TransferAdapter<P extends TransferBaseProps = TransferBaseProps, S extends TransferBaseState = TransferBaseState, E = FocusEvent> extends DefaultAdapter<P, S> {
|
|
48
|
+
notifyBlur: (e: E) => void;
|
|
49
49
|
updateSelected: (values: Array<number | string>) => void;
|
|
50
50
|
notifyChange: (values: Array<number | string>, items: Array<BasicDataItem>) => void;
|
|
51
51
|
notifySearch: (searchValue: string) => void;
|
|
@@ -56,7 +56,7 @@ export interface TransferAdapter<P extends TransferBaseProps = TransferBaseProps
|
|
|
56
56
|
updateCurrentPage: (currentPage: number) => void;
|
|
57
57
|
notifyPageChange: (currentPage: number) => void;
|
|
58
58
|
}
|
|
59
|
-
export default class TransferFoundation<P extends TransferBaseProps = TransferBaseProps, S extends TransferBaseState = TransferBaseState> extends BaseFoundation<TransferAdapter<P, S>, P, S> {
|
|
59
|
+
export default class TransferFoundation<P extends TransferBaseProps = TransferBaseProps, S extends TransferBaseState = TransferBaseState, E = FocusEvent> extends BaseFoundation<TransferAdapter<P, S, E>, P, S> {
|
|
60
60
|
#private;
|
|
61
61
|
/** The flat item list of a dataSource: groupList items carry `_parent`, treeList nodes carry `_path` */
|
|
62
62
|
static getData(dataSource: unknown, type: string): Array<BasicResolvedDataItem>;
|
|
@@ -100,13 +100,22 @@ export default class TransferFoundation<P extends TransferBaseProps = TransferBa
|
|
|
100
100
|
};
|
|
101
101
|
/** The item as handed to callbacks: internal fields (`_parent`, `_path`, `_isLeaf`) removed, `fullPath` added */
|
|
102
102
|
static toPublicItem(item: BasicResolvedDataItem, type: string, showPath: boolean): BasicResolvedDataItem;
|
|
103
|
-
/** The treeList path label shown with `showPath`, e.g. "Asia > China > Shanghai" */
|
|
104
103
|
static generatePath({ _path }: BasicResolvedDataItem): string;
|
|
105
|
-
handleInputChange(inputVal: string, notify: boolean)
|
|
106
|
-
handleAll(wantAllChecked: boolean)
|
|
107
|
-
handleClear()
|
|
108
|
-
handleSelectOrRemove(item: BasicResolvedDataItem)
|
|
109
|
-
handleSelect(values: BasicValue)
|
|
110
|
-
|
|
111
|
-
|
|
104
|
+
handleInputChange: (inputVal: string, notify: boolean) => void;
|
|
105
|
+
handleAll: (wantAllChecked: boolean) => void;
|
|
106
|
+
handleClear: () => void;
|
|
107
|
+
handleSelectOrRemove: (item: BasicResolvedDataItem) => void;
|
|
108
|
+
handleSelect: (values: BasicValue) => void;
|
|
109
|
+
/**
|
|
110
|
+
* `value` went back to a non-array (a form reset). The state still holds what was selected before `value` took
|
|
111
|
+
* over, since a controlled selection never writes it, so it returns to the initial selection.
|
|
112
|
+
*/
|
|
113
|
+
handleValueRelease: () => void;
|
|
114
|
+
/**
|
|
115
|
+
* A focusout from the root or anything inside it: reports the blur once the focus has left the whole transfer.
|
|
116
|
+
* A window blur has no relatedTarget and counts as leaving, as in TreeSelect.
|
|
117
|
+
*/
|
|
118
|
+
handleFocusOut: (e: E & Pick<FocusEvent, "currentTarget" | "relatedTarget">) => void;
|
|
119
|
+
handleSortEnd: ({ oldIndex, newIndex }: OnSortEndProps) => void;
|
|
120
|
+
handlePageChange: (currentPage: number) => void;
|
|
112
121
|
}
|
|
@@ -22,8 +22,8 @@ var TransferFoundation = class TransferFoundation extends BaseFoundation {
|
|
|
22
22
|
}
|
|
23
23
|
#updateSelected(selectedItems) {
|
|
24
24
|
const { values, items } = this.#getValuesAndItems(selectedItems);
|
|
25
|
-
if (!Array.isArray(this.getProp("value"))) this.
|
|
26
|
-
this.
|
|
25
|
+
if (!Array.isArray(this.getProp("value"))) this.adapter.updateSelected(values);
|
|
26
|
+
this.adapter.notifyChange(values, items);
|
|
27
27
|
}
|
|
28
28
|
/** The flat item list of a dataSource: groupList items carry `_parent`, treeList nodes carry `_path` */
|
|
29
29
|
static getData(dataSource, type) {
|
|
@@ -108,17 +108,16 @@ var TransferFoundation = class TransferFoundation extends BaseFoundation {
|
|
|
108
108
|
fullPath
|
|
109
109
|
} : publicItem;
|
|
110
110
|
}
|
|
111
|
-
/** The treeList path label shown with `showPath`, e.g. "Asia > China > Shanghai" */
|
|
112
111
|
static generatePath({ _path = [] }) {
|
|
113
112
|
return _path.map((p) => p.label).join(" > ");
|
|
114
113
|
}
|
|
115
|
-
handleInputChange(inputVal, notify) {
|
|
116
|
-
if (this.getProp("type") === strings.TYPE_TREE_TO_LIST) this.
|
|
117
|
-
if (notify) this.
|
|
118
|
-
this.
|
|
114
|
+
handleInputChange = (inputVal, notify) => {
|
|
115
|
+
if (this.getProp("type") === strings.TYPE_TREE_TO_LIST) this.adapter.searchTree(inputVal);
|
|
116
|
+
if (notify) this.adapter.notifySearch(inputVal);
|
|
117
|
+
this.adapter.updateInput(inputVal);
|
|
119
118
|
if (TransferFoundation.getPageNumber(this.getProp("pagination"), this.getState("leftCurrentPage")) !== 1) this.handlePageChange(1);
|
|
120
|
-
}
|
|
121
|
-
handleAll(wantAllChecked) {
|
|
119
|
+
};
|
|
120
|
+
handleAll = (wantAllChecked) => {
|
|
122
121
|
const { disabled, type, filter } = this.getProps();
|
|
123
122
|
if (disabled) return;
|
|
124
123
|
const { inputValue } = this.getStates();
|
|
@@ -133,28 +132,28 @@ var TransferFoundation = class TransferFoundation extends BaseFoundation {
|
|
|
133
132
|
for (const item of operateData) if (wantAllChecked && (!item.disabled || selectedItems.has(item.key))) selectedItems.set(item.key, item);
|
|
134
133
|
else if (!wantAllChecked && !item.disabled) selectedItems.delete(item.key);
|
|
135
134
|
this.#updateSelected(selectedItems);
|
|
136
|
-
}
|
|
137
|
-
handleClear() {
|
|
135
|
+
};
|
|
136
|
+
handleClear = () => {
|
|
138
137
|
if (this.getProp("disabled")) return;
|
|
139
138
|
const data = this.#getData();
|
|
140
139
|
const selectedItems = this.#getSelected(data);
|
|
141
140
|
for (const item of data) if (!item.disabled) selectedItems.delete(item.key);
|
|
142
141
|
this.#updateSelected(selectedItems);
|
|
143
|
-
}
|
|
144
|
-
handleSelectOrRemove(item) {
|
|
142
|
+
};
|
|
143
|
+
handleSelectOrRemove = (item) => {
|
|
145
144
|
if (this.getProp("disabled") || item.disabled) return;
|
|
146
145
|
const selectedItems = this.#getSelected(this.#getData());
|
|
147
146
|
const changedItem = this.#injectFullPath(item);
|
|
148
147
|
if (selectedItems.has(item.key)) {
|
|
149
148
|
selectedItems.delete(item.key);
|
|
150
|
-
this.
|
|
149
|
+
this.adapter.notifyDeselect(changedItem);
|
|
151
150
|
} else {
|
|
152
151
|
selectedItems.set(item.key, item);
|
|
153
|
-
this.
|
|
152
|
+
this.adapter.notifySelect(changedItem);
|
|
154
153
|
}
|
|
155
154
|
this.#updateSelected(selectedItems);
|
|
156
|
-
}
|
|
157
|
-
handleSelect(values) {
|
|
155
|
+
};
|
|
156
|
+
handleSelect = (values) => {
|
|
158
157
|
if (this.getProp("disabled")) return;
|
|
159
158
|
const data = this.#getData();
|
|
160
159
|
const selectedItems = this.#getSelected(data);
|
|
@@ -165,15 +164,30 @@ var TransferFoundation = class TransferFoundation extends BaseFoundation {
|
|
|
165
164
|
if (selectedItems.has(node.key) || !node.disabled) nextSelectedItemsMap.set(node.key, node);
|
|
166
165
|
});
|
|
167
166
|
this.#updateSelected(nextSelectedItemsMap);
|
|
168
|
-
}
|
|
169
|
-
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* `value` went back to a non-array (a form reset). The state still holds what was selected before `value` took
|
|
170
|
+
* over, since a controlled selection never writes it, so it returns to the initial selection.
|
|
171
|
+
*/
|
|
172
|
+
handleValueRelease = () => {
|
|
173
|
+
this.adapter.updateSelected([...this.getProp("defaultValue") ?? []]);
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* A focusout from the root or anything inside it: reports the blur once the focus has left the whole transfer.
|
|
177
|
+
* A window blur has no relatedTarget and counts as leaving, as in TreeSelect.
|
|
178
|
+
*/
|
|
179
|
+
handleFocusOut = (e) => {
|
|
180
|
+
const { currentTarget, relatedTarget } = e;
|
|
181
|
+
if (!(currentTarget instanceof Node && relatedTarget instanceof Node && currentTarget.contains(relatedTarget))) this.adapter.notifyBlur(e);
|
|
182
|
+
};
|
|
183
|
+
handleSortEnd = ({ oldIndex, newIndex }) => {
|
|
170
184
|
if (this.getProp("disabled")) return;
|
|
171
185
|
const selectedArr = arrayMove([...this.#getSelected(this.#getData()).values()], oldIndex, newIndex);
|
|
172
186
|
this.#updateSelected(new Map(selectedArr.map((option) => [option.key, option])));
|
|
173
|
-
}
|
|
174
|
-
handlePageChange(currentPage) {
|
|
175
|
-
this.
|
|
176
|
-
this.
|
|
177
|
-
}
|
|
187
|
+
};
|
|
188
|
+
handlePageChange = (currentPage) => {
|
|
189
|
+
this.adapter.updateCurrentPage(currentPage);
|
|
190
|
+
this.adapter.notifyPageChange(currentPage);
|
|
191
|
+
};
|
|
178
192
|
};
|
|
179
193
|
export { TransferFoundation as default };
|
|
@@ -67,7 +67,6 @@ export interface BasicFlattenNode {
|
|
|
67
67
|
pos?: string;
|
|
68
68
|
value?: string;
|
|
69
69
|
}
|
|
70
|
-
/** `show` while rows expand, `hide` while they collapse */
|
|
71
70
|
export type TreeMotionType = 'show' | 'hide';
|
|
72
71
|
/** The values and the `smart` rule are those of the adapter's virtual list */
|
|
73
72
|
export type ScrollAlign = 'center' | 'start' | 'end' | 'smart' | 'auto';
|
|
@@ -270,27 +269,26 @@ export default class TreeFoundation<E = unknown> extends BaseFoundation<TreeAdap
|
|
|
270
269
|
* Returns null when nothing changed, so a host that writes the result back settles.
|
|
271
270
|
*/
|
|
272
271
|
static deriveState(props: BasicTreeProps, prevState: BasicTreeInnerData): Partial<BasicTreeInnerData> | null;
|
|
273
|
-
/** The state of a new tree: the empty state with what the props imply */
|
|
274
272
|
static getInitialState(props: BasicTreeProps): BasicTreeInnerData;
|
|
275
273
|
destroy(): void;
|
|
276
274
|
/** Writes the state derived from new props back, so handlers read what was rendered */
|
|
277
|
-
syncDerivedState(derived: Partial<BasicTreeInnerData>)
|
|
278
|
-
scrollTo({ key, align }: {
|
|
275
|
+
syncDerivedState: (derived: Partial<BasicTreeInnerData>) => void;
|
|
276
|
+
scrollTo: ({ key, align }: {
|
|
279
277
|
key: string;
|
|
280
278
|
align?: ScrollAlign;
|
|
281
|
-
})
|
|
282
|
-
handleInputChange(sugInput: string)
|
|
283
|
-
handleNodeSelect(e:
|
|
284
|
-
handleNodeRightClick(e: E, treeNode: BasicTreeNodeProps)
|
|
285
|
-
handleNodeDoubleClick(e: E, treeNode: BasicTreeNodeProps)
|
|
286
|
-
handleNodeExpand(_e:
|
|
279
|
+
}) => void;
|
|
280
|
+
handleInputChange: (sugInput: string) => void;
|
|
281
|
+
handleNodeSelect: (e: unknown, treeNode: BasicTreeNodeProps) => void;
|
|
282
|
+
handleNodeRightClick: (e: E, treeNode: BasicTreeNodeProps) => void;
|
|
283
|
+
handleNodeDoubleClick: (e: E, treeNode: BasicTreeNodeProps) => void;
|
|
284
|
+
handleNodeExpand: (_e: unknown, treeNode: BasicTreeNodeProps) => void;
|
|
287
285
|
/** Loads a node's children once; `key` is the node's entity key, which keyMaps may take from another field */
|
|
288
286
|
handleNodeLoad(key: string, data: BasicTreeNodeData): void;
|
|
289
|
-
handleNodeDragStart(e: TreeDragEvent, treeNode: BasicTreeNodeProps)
|
|
290
|
-
handleNodeDragEnter(e: TreeDragEvent, treeNode: BasicTreeNodeProps)
|
|
291
|
-
handleNodeDragOver(e: TreeDragEvent, treeNode: BasicTreeNodeProps)
|
|
292
|
-
handleNodeDragLeave(e: TreeDragEvent, treeNode: BasicTreeNodeProps)
|
|
293
|
-
handleNodeDragEnd(e: TreeDragEvent, treeNode: BasicTreeNodeProps)
|
|
294
|
-
handleNodeDrop(e: TreeDragEvent, treeNode: BasicTreeNodeProps)
|
|
287
|
+
handleNodeDragStart: (e: TreeDragEvent, treeNode: BasicTreeNodeProps) => void;
|
|
288
|
+
handleNodeDragEnter: (e: TreeDragEvent, treeNode: BasicTreeNodeProps) => void;
|
|
289
|
+
handleNodeDragOver: (e: TreeDragEvent, treeNode: BasicTreeNodeProps) => void;
|
|
290
|
+
handleNodeDragLeave: (e: TreeDragEvent, treeNode: BasicTreeNodeProps) => void;
|
|
291
|
+
handleNodeDragEnd: (e: TreeDragEvent, treeNode: BasicTreeNodeProps) => void;
|
|
292
|
+
handleNodeDrop: (e: TreeDragEvent, treeNode: BasicTreeNodeProps) => void;
|
|
295
293
|
}
|
|
296
294
|
export type { KeyMapProps };
|