@fibrae/semi-foundation 0.1.0 → 0.2.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 -1
- package/dist/anchor/foundation.js +21 -21
- package/dist/audio-player/foundation.d.ts +10 -10
- package/dist/audio-player/foundation.js +19 -19
- package/dist/auto-complete/foundation.d.ts +12 -12
- package/dist/auto-complete/foundation.js +51 -51
- package/dist/avatar/foundation.d.ts +5 -5
- package/dist/avatar/foundation.js +16 -16
- package/dist/backtop/foundation.d.ts +2 -2
- package/dist/backtop/foundation.js +7 -7
- package/dist/banner/foundation.d.ts +1 -1
- package/dist/banner/foundation.js +4 -4
- package/dist/base/auto-close-foundation.d.ts +8 -8
- package/dist/base/auto-close-foundation.js +15 -15
- package/dist/base/foundation.d.ts +4 -3
- package/dist/base/foundation.js +12 -11
- 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.js +1 -1
- package/dist/calendar/foundation.js +4 -4
- package/dist/calendar/month-foundation.d.ts +2 -2
- package/dist/calendar/month-foundation.js +6 -6
- package/dist/carousel/foundation.d.ts +17 -17
- package/dist/carousel/foundation.js +51 -51
- package/dist/cascader/foundation.d.ts +34 -26
- package/dist/cascader/foundation.js +143 -121
- package/dist/checkbox/checkbox-foundation.d.ts +2 -2
- package/dist/checkbox/checkbox-foundation.js +15 -15
- package/dist/checkbox/checkbox-group-foundation.d.ts +2 -2
- package/dist/checkbox/checkbox-group-foundation.js +8 -8
- package/dist/code-highlight/index.d.ts +1 -1
- 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-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/config-provider/breakpoint-observer.d.ts +3 -3
- package/dist/config-provider/breakpoint-observer.js +6 -6
- package/dist/cropper/foundation.d.ts +15 -15
- package/dist/cropper/foundation.js +26 -23
- package/dist/date-picker/_utils/picker-type.d.ts +1 -1
- package/dist/date-picker/foundation.d.ts +36 -36
- package/dist/date-picker/foundation.js +125 -129
- package/dist/date-picker/input-foundation.d.ts +9 -9
- package/dist/date-picker/input-foundation.js +28 -28
- package/dist/date-picker/months-grid-foundation.d.ts +17 -17
- package/dist/date-picker/months-grid-foundation.js +64 -65
- 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 -2
- package/dist/drag-move/foundation.js +15 -13
- package/dist/dropdown/foundation.d.ts +8 -5
- package/dist/dropdown/foundation.js +32 -28
- package/dist/dropdown/menu-foundation.d.ts +1 -1
- package/dist/dropdown/menu-foundation.js +11 -11
- package/dist/feedback/foundation.d.ts +9 -9
- package/dist/feedback/foundation.js +33 -33
- package/dist/form/form-api-proxy.d.ts +8 -7
- package/dist/form/form-api-proxy.js +25 -25
- package/dist/form/foundation.d.ts +5 -5
- package/dist/form/foundation.js +60 -61
- package/dist/highlight/foundation.js +1 -1
- package/dist/hot-keys/foundation.d.ts +2 -2
- package/dist/hot-keys/foundation.js +5 -5
- package/dist/image/image-foundation.d.ts +4 -4
- package/dist/image/image-foundation.js +10 -10
- package/dist/image/preview-footer-foundation.d.ts +3 -3
- package/dist/image/preview-footer-foundation.js +10 -10
- package/dist/image/preview-foundation.js +7 -6
- package/dist/image/preview-image-foundation.d.ts +6 -8
- package/dist/image/preview-image-foundation.js +14 -14
- package/dist/image/preview-inner-foundation.d.ts +9 -9
- package/dist/image/preview-inner-foundation.js +38 -38
- package/dist/input/foundation.d.ts +10 -10
- package/dist/input/foundation.js +47 -49
- package/dist/input/text-entry-foundation.d.ts +3 -3
- package/dist/input/text-entry-foundation.js +14 -14
- package/dist/input/textarea-foundation.d.ts +7 -7
- package/dist/input/textarea-foundation.js +36 -36
- package/dist/input-number/foundation.d.ts +16 -14
- package/dist/input-number/foundation.js +54 -53
- package/dist/json-viewer/foundation.d.ts +8 -8
- package/dist/json-viewer/foundation.js +23 -23
- package/dist/lottie/foundation.d.ts +1 -1
- package/dist/lottie/foundation.js +4 -4
- package/dist/markdown-render/foundation.d.ts +1 -1
- package/dist/markdown-render/foundation.js +4 -4
- 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 -1
- package/dist/navigation/foundation.js +14 -14
- 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 -3
- package/dist/navigation/sub-nav-foundation.js +17 -17
- package/dist/notification/notification-list-foundation.d.ts +7 -7
- package/dist/notification/notification-list-foundation.js +12 -12
- package/dist/overflow-list/foundation.d.ts +4 -4
- package/dist/overflow-list/foundation.js +18 -18
- package/dist/pagination/foundation.d.ts +8 -8
- package/dist/pagination/foundation.js +28 -28
- package/dist/pincode/foundation.d.ts +5 -5
- package/dist/pincode/foundation.js +22 -22
- package/dist/popconfirm/popconfirm-foundation.d.ts +7 -7
- package/dist/popconfirm/popconfirm-foundation.js +26 -26
- package/dist/radio/radio-foundation.d.ts +5 -5
- package/dist/radio/radio-foundation.js +15 -15
- package/dist/radio/radio-group-foundation.d.ts +2 -2
- package/dist/radio/radio-group-foundation.js +9 -9
- package/dist/rating/foundation.d.ts +10 -10
- package/dist/rating/foundation.js +35 -35
- package/dist/resizable/group/index.d.ts +6 -6
- package/dist/resizable/group/index.js +40 -40
- package/dist/resizable/single/index.d.ts +2 -2
- package/dist/resizable/single/index.js +9 -9
- package/dist/scroll-list/item-foundation.d.ts +7 -7
- package/dist/scroll-list/item-foundation.js +35 -35
- package/dist/select/foundation.d.ts +42 -56
- package/dist/select/foundation.js +214 -279
- package/dist/select/option-foundation.d.ts +23 -27
- package/dist/select/option-foundation.js +10 -18
- package/dist/side-sheet/side-sheet-foundation.d.ts +6 -6
- package/dist/side-sheet/side-sheet-foundation.js +22 -22
- package/dist/slider/foundation.d.ts +16 -16
- package/dist/slider/foundation.js +46 -46
- package/dist/sortable/accessibility.d.ts +1 -1
- package/dist/sortable/accessibility.js +2 -2
- package/dist/spin/foundation.d.ts +2 -2
- package/dist/spin/foundation.js +6 -6
- package/dist/steps/utils.d.ts +1 -1
- package/dist/switch/foundation.d.ts +2 -2
- package/dist/switch/foundation.js +7 -7
- package/dist/table/foundation.d.ts +14 -14
- package/dist/table/foundation.js +93 -93
- package/dist/table/utils.d.ts +2 -2
- package/dist/tabs/foundation.d.ts +5 -5
- package/dist/tabs/foundation.js +17 -17
- package/dist/tag-input/foundation.d.ts +11 -11
- package/dist/tag-input/foundation.js +52 -52
- package/dist/time-picker/foundation.d.ts +13 -13
- package/dist/time-picker/foundation.js +39 -39
- package/dist/time-picker/input-foundation.d.ts +4 -4
- package/dist/time-picker/input-foundation.js +13 -13
- package/dist/toast/toast-list-foundation.d.ts +7 -7
- package/dist/toast/toast-list-foundation.js +14 -14
- package/dist/tooltip/foundation.d.ts +9 -9
- package/dist/tooltip/foundation.js +67 -61
- package/dist/transfer/foundation.d.ts +22 -9
- package/dist/transfer/foundation.js +38 -23
- package/dist/tree/foundation.d.ts +14 -14
- package/dist/tree/foundation.js +61 -61
- package/dist/tree/shared.d.ts +1 -1
- package/dist/tree-select/foundation.d.ts +26 -20
- package/dist/tree-select/foundation.js +91 -83
- package/dist/typography/ellipsis.d.ts +4 -4
- package/dist/typography/ellipsis.js +8 -8
- package/dist/typography/format-numeral.d.ts +1 -1
- package/dist/typography/format-numeral.js +2 -2
- package/dist/upload/constants.d.ts +1 -1
- package/dist/upload/foundation.d.ts +17 -17
- package/dist/upload/foundation.js +92 -92
- package/dist/upload/utils.d.ts +3 -3
- package/dist/upload/utils.js +6 -6
- package/dist/user-guide/foundation.d.ts +3 -3
- package/dist/user-guide/foundation.js +19 -19
- package/dist/utils/a11y.d.ts +1 -1
- package/dist/utils/announcer.d.ts +2 -2
- package/dist/utils/announcer.js +4 -4
- package/dist/utils/focus-handle.d.ts +1 -1
- package/dist/utils/focus-handle.js +1 -2
- package/dist/utils/focus-scope.d.ts +5 -5
- package/dist/utils/focus-scope.js +10 -10
- 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/video-player/foundation.d.ts +15 -15
- package/dist/video-player/foundation.js +89 -89
- package/dist/video-player/progress-foundation.d.ts +2 -2
- package/dist/video-player/progress-foundation.js +12 -12
- package/package.json +2 -2
package/dist/tree/foundation.js
CHANGED
|
@@ -56,7 +56,7 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
|
|
|
56
56
|
constructor(adapter) {
|
|
57
57
|
super({ ...adapter });
|
|
58
58
|
this.#throttledDragOverUpdate = throttle((dropPosition) => {
|
|
59
|
-
this.
|
|
59
|
+
this.adapter.updateState({ dropPosition });
|
|
60
60
|
}, 16);
|
|
61
61
|
}
|
|
62
62
|
#isMultiple() {
|
|
@@ -83,7 +83,7 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
|
|
|
83
83
|
const data = this.getProp("treeDataSimpleJson");
|
|
84
84
|
const selectedPath = normalizedArr(key).map((i) => i.split(strings.JSON_KEY_SPLIT));
|
|
85
85
|
const value = pick$1(data, selectedPath);
|
|
86
|
-
this.
|
|
86
|
+
this.adapter.notifyChange(value);
|
|
87
87
|
}
|
|
88
88
|
#notifyMultipleChange(key) {
|
|
89
89
|
const { keyEntities } = this.getStates();
|
|
@@ -96,7 +96,7 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
|
|
|
96
96
|
const nodes = keyList.map((key) => keyEntities[key] ? keyEntities[key].data : getDataForKeyNotInKeyEntities(key, props));
|
|
97
97
|
if (this.getProp("onChangeWithObject")) value = nodes;
|
|
98
98
|
else value = getValueOrKey(nodes, keyMaps);
|
|
99
|
-
this.
|
|
99
|
+
this.adapter.notifyChange(value);
|
|
100
100
|
}
|
|
101
101
|
#notifyChange(key) {
|
|
102
102
|
const isMultiple = this.#isMultiple();
|
|
@@ -111,26 +111,26 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
|
|
|
111
111
|
const { data } = get(keyEntities, key);
|
|
112
112
|
value = getValueOrKey(data, keyMaps);
|
|
113
113
|
}
|
|
114
|
-
this.
|
|
114
|
+
this.adapter.notifyChange(value);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
#handleSingleSelect(_e, { selected, eventKey, data }) {
|
|
118
118
|
let selectedKeys = [...this.getState("selectedKeys")];
|
|
119
119
|
const targetSelected = !selected;
|
|
120
|
-
this.
|
|
120
|
+
this.adapter.notifySelect(eventKey, true, data);
|
|
121
121
|
if (!targetSelected) return;
|
|
122
122
|
if (!selectedKeys.includes(eventKey)) {
|
|
123
123
|
selectedKeys = [eventKey];
|
|
124
124
|
this.#notifyChange(eventKey);
|
|
125
|
-
if (!this.
|
|
125
|
+
if (!this.isControlledComponent()) this.adapter.updateState({ selectedKeys });
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
#handleMultipleSelect(_e, treeNode) {
|
|
129
129
|
const result = getMultipleSelectResult(treeNode, this.getProps(), this.getStates());
|
|
130
130
|
if (!result) return;
|
|
131
|
-
this.
|
|
131
|
+
this.adapter.notifySelect(treeNode.eventKey, result.targetStatus, treeNode.data);
|
|
132
132
|
this.#notifyChange(result.keys);
|
|
133
|
-
if (!this.
|
|
133
|
+
if (!this.isControlledComponent()) this.adapter.updateState(result.state);
|
|
134
134
|
}
|
|
135
135
|
#setExpandedStatus({ eventKey, expanded, data }) {
|
|
136
136
|
const { inputValue, treeData, filteredShownKeys, keyEntities } = this.getStates();
|
|
@@ -145,7 +145,7 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
|
|
|
145
145
|
expandedKeys.delete(eventKey);
|
|
146
146
|
motionType = "hide";
|
|
147
147
|
}
|
|
148
|
-
this.
|
|
148
|
+
this.adapter.setCachedFlattenNodes(motionType === "hide" && this.#isAnimated() ? this.getState("flattenNodes") : void 0);
|
|
149
149
|
if (!this.#isExpandControlled()) {
|
|
150
150
|
const flattenNodes = flattenTreeData(treeData, expandedKeys, keyMaps, isSearching && showFilteredOnly && filteredShownKeys);
|
|
151
151
|
let motionKeys = this.#isAnimated() ? getMotionKeys(eventKey, expandedKeys, keyEntities) : [];
|
|
@@ -156,7 +156,7 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
|
|
|
156
156
|
motionKeys: new Set(motionKeys),
|
|
157
157
|
motionType
|
|
158
158
|
};
|
|
159
|
-
this.
|
|
159
|
+
this.adapter.updateState(newState);
|
|
160
160
|
}
|
|
161
161
|
return {
|
|
162
162
|
expandedKeys,
|
|
@@ -178,7 +178,7 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
|
|
|
178
178
|
}
|
|
179
179
|
#clearDragState() {
|
|
180
180
|
this.#clearDragEnterTimers();
|
|
181
|
-
this.
|
|
181
|
+
this.adapter.updateState({
|
|
182
182
|
dragOverNodeKey: "",
|
|
183
183
|
dragging: false
|
|
184
184
|
});
|
|
@@ -350,14 +350,14 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
|
|
|
350
350
|
this.#clearDragEnterTimers();
|
|
351
351
|
}
|
|
352
352
|
/** Writes the state derived from new props back, so handlers read what was rendered */
|
|
353
|
-
syncDerivedState(derived) {
|
|
354
|
-
this.
|
|
355
|
-
}
|
|
356
|
-
scrollTo({ key, align = "center" }) {
|
|
357
|
-
if (key && this.getState("flattenNodes")?.some((node) => node.key === key)) this.
|
|
358
|
-
}
|
|
359
|
-
handleInputChange(sugInput) {
|
|
360
|
-
this.
|
|
353
|
+
syncDerivedState = (derived) => {
|
|
354
|
+
this.adapter.updateState(derived);
|
|
355
|
+
};
|
|
356
|
+
scrollTo = ({ key, align = "center" }) => {
|
|
357
|
+
if (key && this.getState("flattenNodes")?.some((node) => node.key === key)) this.adapter.scrollToNode(key, align);
|
|
358
|
+
};
|
|
359
|
+
handleInputChange = (sugInput) => {
|
|
360
|
+
this.adapter.updateInputValue(sugInput);
|
|
361
361
|
const { selectedKeys, keyEntities, treeData } = this.getStates();
|
|
362
362
|
const expandedKeys = new Set(this.getState("expandedKeys"));
|
|
363
363
|
const { showFilteredOnly, filterTreeNode, treeNodeFilterProp, keyMaps } = this.getProps();
|
|
@@ -380,8 +380,8 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
|
|
|
380
380
|
flattenNodes = flattenTreeData(treeData, new Set(expandedOptsKeys), keyMaps, showFilteredOnly && filteredShownKeys);
|
|
381
381
|
}
|
|
382
382
|
const newFilteredExpandedKeys = new Set(expandedOptsKeys);
|
|
383
|
-
this.
|
|
384
|
-
this.
|
|
383
|
+
this.adapter.notifySearch(sugInput, Array.from(newFilteredExpandedKeys));
|
|
384
|
+
this.adapter.updateState({
|
|
385
385
|
expandedKeys,
|
|
386
386
|
flattenNodes,
|
|
387
387
|
motionKeys: /* @__PURE__ */ new Set([]),
|
|
@@ -389,29 +389,29 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
|
|
|
389
389
|
filteredExpandedKeys: newFilteredExpandedKeys,
|
|
390
390
|
filteredShownKeys
|
|
391
391
|
});
|
|
392
|
-
}
|
|
393
|
-
handleNodeSelect(e, treeNode) {
|
|
392
|
+
};
|
|
393
|
+
handleNodeSelect = (e, treeNode) => {
|
|
394
394
|
if (this.#isDisabled(treeNode)) return;
|
|
395
395
|
if (!this.#isMultiple()) this.#handleSingleSelect(e, treeNode);
|
|
396
396
|
else this.#handleMultipleSelect(e, treeNode);
|
|
397
|
-
}
|
|
398
|
-
handleNodeRightClick(e, treeNode) {
|
|
399
|
-
this.
|
|
400
|
-
}
|
|
401
|
-
handleNodeDoubleClick(e, treeNode) {
|
|
402
|
-
this.
|
|
403
|
-
}
|
|
404
|
-
handleNodeExpand(_e, treeNode) {
|
|
397
|
+
};
|
|
398
|
+
handleNodeRightClick = (e, treeNode) => {
|
|
399
|
+
this.adapter.notifyRightClick(e, treeNode.data);
|
|
400
|
+
};
|
|
401
|
+
handleNodeDoubleClick = (e, treeNode) => {
|
|
402
|
+
this.adapter.notifyDoubleClick(e, treeNode.data);
|
|
403
|
+
};
|
|
404
|
+
handleNodeExpand = (_e, treeNode) => {
|
|
405
405
|
const { loadData } = this.getProps();
|
|
406
406
|
if (!loadData && (!treeNode.children || !treeNode.children.length)) return;
|
|
407
407
|
if (isTreeNodeLeaf(treeNode, loadData)) return;
|
|
408
408
|
const { expandedKeys, data, expanded } = this.#setExpandedStatus(treeNode);
|
|
409
|
-
this.
|
|
409
|
+
this.adapter.notifyExpand(expandedKeys, {
|
|
410
410
|
expanded,
|
|
411
411
|
node: data
|
|
412
412
|
});
|
|
413
413
|
if (expanded && loadData) this.handleNodeLoad(treeNode.eventKey, data);
|
|
414
|
-
}
|
|
414
|
+
};
|
|
415
415
|
/** Loads a node's children once; `key` is the node's entity key, which keyMaps may take from another field */
|
|
416
416
|
handleNodeLoad(key, data) {
|
|
417
417
|
const { loadData } = this.getProps();
|
|
@@ -423,20 +423,20 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
|
|
|
423
423
|
const newLoadedKeys = prevLoadedKeys.add(key);
|
|
424
424
|
const newLoadingKeys = new Set(prevLoadingKeys);
|
|
425
425
|
newLoadingKeys.delete(key);
|
|
426
|
-
this.
|
|
427
|
-
if (!this.#isLoadControlled()) this.
|
|
428
|
-
this.
|
|
426
|
+
this.adapter.notifyLoad(newLoadedKeys, data);
|
|
427
|
+
if (!this.#isLoadControlled()) this.adapter.updateState({ loadedKeys: newLoadedKeys });
|
|
428
|
+
this.adapter.updateState({ loadingKeys: newLoadingKeys });
|
|
429
429
|
}).finally(() => {
|
|
430
430
|
const currentLoadingKeys = this.getState("loadingKeys");
|
|
431
431
|
if (currentLoadingKeys.has(key)) {
|
|
432
432
|
const newLoadingKeys = new Set(currentLoadingKeys);
|
|
433
433
|
newLoadingKeys.delete(key);
|
|
434
|
-
this.
|
|
434
|
+
this.adapter.updateState({ loadingKeys: newLoadingKeys });
|
|
435
435
|
}
|
|
436
436
|
});
|
|
437
|
-
this.
|
|
437
|
+
this.adapter.updateState({ loadingKeys: new Set(loadingKeys).add(key) });
|
|
438
438
|
}
|
|
439
|
-
handleNodeDragStart(e, treeNode) {
|
|
439
|
+
handleNodeDragStart = (e, treeNode) => {
|
|
440
440
|
const { keyEntities } = this.getStates();
|
|
441
441
|
const { hideDraggingNode, renderDraggingNode } = this.getProps();
|
|
442
442
|
const { eventKey, nodeInstance, data } = treeNode;
|
|
@@ -452,13 +452,13 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
|
|
|
452
452
|
setTimeout(() => dragImg.remove());
|
|
453
453
|
}
|
|
454
454
|
this.#dragNode = treeNode;
|
|
455
|
-
this.
|
|
455
|
+
this.adapter.updateState({
|
|
456
456
|
dragging: true,
|
|
457
457
|
dragNodesKeys: new Set(getDragNodesKeys(eventKey, keyEntities))
|
|
458
458
|
});
|
|
459
|
-
this.
|
|
460
|
-
}
|
|
461
|
-
handleNodeDragEnter(e, treeNode) {
|
|
459
|
+
this.adapter.notifyDragStart(this.#dragProps(e, treeNode));
|
|
460
|
+
};
|
|
461
|
+
handleNodeDragEnter = (e, treeNode) => {
|
|
462
462
|
const { dragNodesKeys } = this.getStates();
|
|
463
463
|
const { autoExpandWhenDragEnter } = this.getProps();
|
|
464
464
|
const { eventKey, expanded } = treeNode;
|
|
@@ -466,7 +466,7 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
|
|
|
466
466
|
if (!dragNode || dragNodesKeys.has(eventKey)) return;
|
|
467
467
|
const dropPosition = calcDropRelativePosition(e, treeNode);
|
|
468
468
|
if (dragNode.eventKey === eventKey && dropPosition === 0) {
|
|
469
|
-
this.
|
|
469
|
+
this.adapter.updateState({
|
|
470
470
|
dragOverNodeKey: "",
|
|
471
471
|
dropPosition: null
|
|
472
472
|
});
|
|
@@ -474,26 +474,26 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
|
|
|
474
474
|
}
|
|
475
475
|
const timer = setTimeout(() => {
|
|
476
476
|
this.#dragEnterTimers.delete(timer);
|
|
477
|
-
this.
|
|
477
|
+
this.adapter.updateState({
|
|
478
478
|
dragOverNodeKey: eventKey,
|
|
479
479
|
dropPosition
|
|
480
480
|
});
|
|
481
481
|
if (!autoExpandWhenDragEnter || expanded) {
|
|
482
|
-
this.
|
|
482
|
+
this.adapter.notifyDragEnter(this.#dragProps(e, treeNode));
|
|
483
483
|
return;
|
|
484
484
|
}
|
|
485
485
|
clearTimeout(this.#autoExpandTimer);
|
|
486
486
|
this.#autoExpandTimer = setTimeout(() => {
|
|
487
487
|
const { expandedKeys: newExpandedKeys } = this.#setExpandedStatus(treeNode);
|
|
488
|
-
this.
|
|
488
|
+
this.adapter.notifyDragEnter({
|
|
489
489
|
...this.#dragProps(e, treeNode),
|
|
490
490
|
expandedKeys: [...newExpandedKeys]
|
|
491
491
|
});
|
|
492
492
|
}, 400);
|
|
493
493
|
}, 0);
|
|
494
494
|
this.#dragEnterTimers.add(timer);
|
|
495
|
-
}
|
|
496
|
-
handleNodeDragOver(e, treeNode) {
|
|
495
|
+
};
|
|
496
|
+
handleNodeDragOver = (e, treeNode) => {
|
|
497
497
|
const { dropPosition, dragNodesKeys, dragOverNodeKey } = this.getStates();
|
|
498
498
|
const { eventKey } = treeNode;
|
|
499
499
|
if (dragNodesKeys.has(eventKey)) return;
|
|
@@ -502,21 +502,21 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
|
|
|
502
502
|
if (dropPosition === newPos) return;
|
|
503
503
|
this.#throttledDragOverUpdate(newPos);
|
|
504
504
|
}
|
|
505
|
-
this.
|
|
506
|
-
}
|
|
507
|
-
handleNodeDragLeave(e, treeNode) {
|
|
505
|
+
this.adapter.notifyDragOver(this.#dragProps(e, treeNode));
|
|
506
|
+
};
|
|
507
|
+
handleNodeDragLeave = (e, treeNode) => {
|
|
508
508
|
this.#throttledDragOverUpdate.cancel();
|
|
509
509
|
clearTimeout(this.#autoExpandTimer);
|
|
510
|
-
this.
|
|
511
|
-
this.
|
|
512
|
-
}
|
|
513
|
-
handleNodeDragEnd(e, treeNode) {
|
|
510
|
+
this.adapter.updateState({ dragOverNodeKey: "" });
|
|
511
|
+
this.adapter.notifyDragLeave(this.#dragProps(e, treeNode));
|
|
512
|
+
};
|
|
513
|
+
handleNodeDragEnd = (e, treeNode) => {
|
|
514
514
|
this.#throttledDragOverUpdate.flush();
|
|
515
515
|
this.#clearDragState();
|
|
516
|
-
this.
|
|
516
|
+
this.adapter.notifyDragEnd(this.#dragProps(e, treeNode));
|
|
517
517
|
this.#dragNode = null;
|
|
518
|
-
}
|
|
519
|
-
handleNodeDrop(e, treeNode) {
|
|
518
|
+
};
|
|
519
|
+
handleNodeDrop = (e, treeNode) => {
|
|
520
520
|
this.#throttledDragOverUpdate.flush();
|
|
521
521
|
const { dropPosition, dragNodesKeys } = this.getStates();
|
|
522
522
|
const { eventKey, pos } = treeNode;
|
|
@@ -529,11 +529,11 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
|
|
|
529
529
|
dropPosition: calcDropActualPosition(pos, dropPosition),
|
|
530
530
|
dropToGap: dropPosition !== 0
|
|
531
531
|
};
|
|
532
|
-
this.
|
|
532
|
+
this.adapter.notifyDrop({
|
|
533
533
|
...this.#dragProps(e, treeNode),
|
|
534
534
|
...dropRes
|
|
535
535
|
});
|
|
536
536
|
this.#dragNode = null;
|
|
537
|
-
}
|
|
537
|
+
};
|
|
538
538
|
};
|
|
539
539
|
export { TreeFoundation as default, treeDerivedPropKeys };
|
package/dist/tree/shared.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export declare function sameKeys(a: {
|
|
|
54
54
|
*/
|
|
55
55
|
export declare function getTransitionNodes<T extends {
|
|
56
56
|
key?: string;
|
|
57
|
-
}>(nodes: T[], motionKeys: Set<string>, motionType
|
|
57
|
+
}>(nodes: T[], motionKeys: Set<string>, motionType?: TreeMotionType | null, flattenList?: T[]): (T | T[])[];
|
|
58
58
|
export type TreeKeyAction = {
|
|
59
59
|
type: 'move';
|
|
60
60
|
index: number;
|
|
@@ -127,7 +127,7 @@ export default class TreeSelectFoundation<P extends BasicTreeSelectProps = Basic
|
|
|
127
127
|
/** The state of a new TreeSelect: the empty state with what the props imply */
|
|
128
128
|
static getInitialState(props: BasicTreeSelectProps): BasicTreeSelectInnerData;
|
|
129
129
|
/** The keys the trigger shows: the selection, or in multiple mode the checked keys merged as onChange reports them */
|
|
130
|
-
static getTriggerKeys(props: Pick<BasicTreeSelectProps, 'multiple' | 'checkRelation' | 'autoMergeValue' | 'leafOnly'>,
|
|
130
|
+
static getTriggerKeys(props: Pick<BasicTreeSelectProps, 'multiple' | 'checkRelation' | 'autoMergeValue' | 'leafOnly'>, { checkedKeys, realCheckedKeys, keyEntities, selectedKeys }: Pick<BasicTreeSelectInnerData, 'selectedKeys' | 'checkedKeys' | 'realCheckedKeys' | 'keyEntities'>): string[];
|
|
131
131
|
static hasValue(props: Pick<BasicTreeSelectProps, 'multiple' | 'checkRelation'>, { selectedKeys, checkedKeys, realCheckedKeys }: Pick<BasicTreeSelectInnerData, 'selectedKeys' | 'checkedKeys' | 'realCheckedKeys'>): boolean;
|
|
132
132
|
/** What the trigger shows for the single selection; pure, so render can call it */
|
|
133
133
|
static getRenderTextInSingle(props: Record<string, any>, { selectedKeys, keyEntities }: Pick<BasicTreeSelectInnerData, 'selectedKeys' | 'keyEntities'>): any;
|
|
@@ -138,39 +138,45 @@ export default class TreeSelectFoundation<P extends BasicTreeSelectProps = Basic
|
|
|
138
138
|
static getNodeData(key: string, keyEntities: BasicTreeSelectInnerData['keyEntities'], props: Parameters<typeof getDataForKeyNotInKeyEntities>[1]): BasicTreeNodeData | undefined;
|
|
139
139
|
init(): void;
|
|
140
140
|
/** Writes the state derived from new props back, so handlers read what was rendered */
|
|
141
|
-
syncDerivedState(derived: Partial<BasicTreeSelectInnerData>)
|
|
141
|
+
syncDerivedState: (derived: Partial<BasicTreeSelectInnerData>) => void;
|
|
142
142
|
/** Searches as if `value` were typed, opening the dropdown first */
|
|
143
|
-
search(value: string)
|
|
143
|
+
search: (value: string) => void;
|
|
144
144
|
/** Focus entering the trigger (its search input, tags, clear button) or the dropdown from outside */
|
|
145
|
-
handleTriggerFocus(e: FocusEvent)
|
|
145
|
+
handleTriggerFocus: (e: FocusEvent) => void;
|
|
146
146
|
/**
|
|
147
147
|
* Reports the blur once per focus: on a mousedown outside, a single pick that closes, or the focus leaving the
|
|
148
148
|
* trigger and the dropdown (the component checks where it went)
|
|
149
149
|
*/
|
|
150
150
|
handleTriggerBlur(e: E | MouseEvent | FocusEvent): void;
|
|
151
|
+
/**
|
|
152
|
+
* The focus left the trigger and the dropdown (the component checks where it went): reports the blur, and closes
|
|
153
|
+
* an open dropdown when the focus went to another element (APG combobox). A window blur has no target and keeps
|
|
154
|
+
* the dropdown, as the native select does.
|
|
155
|
+
*/
|
|
156
|
+
handleFocusLeave: (e: FocusEvent) => void;
|
|
151
157
|
/** A mousedown outside the trigger and the dropdown, listened to while the TreeSelect is focused or open */
|
|
152
|
-
handleClickOutside(e: MouseEvent)
|
|
153
|
-
handleKeyDown(e: Pick<KeyboardEvent,
|
|
154
|
-
onClickSingleTriggerSearchItem()
|
|
155
|
-
close()
|
|
156
|
-
handleClick(e: E & Pick<UIEvent,
|
|
158
|
+
handleClickOutside: (e: MouseEvent) => void;
|
|
159
|
+
handleKeyDown: (e: Pick<KeyboardEvent, "key" | "preventDefault">) => void;
|
|
160
|
+
onClickSingleTriggerSearchItem: () => void;
|
|
161
|
+
close: () => void;
|
|
162
|
+
handleClick: (e: E & Pick<UIEvent, "detail" | "target" | "currentTarget">) => void;
|
|
157
163
|
/**
|
|
158
164
|
* Enter toggles the popup like a click; Down and Up open a closed one (APG combobox). Outside a text field (the
|
|
159
165
|
* select-only combobox) Space toggles it like Enter, and Home and End open a closed one: the view moves to the
|
|
160
166
|
* first or the last row, which lives in the view.
|
|
161
167
|
*/
|
|
162
|
-
handleSelectionKeyDown(e: E & Pick<KeyboardEvent,
|
|
163
|
-
handleClear(e
|
|
164
|
-
removeTag(eventKey: BasicTreeNodeData[
|
|
165
|
-
handleNodeSelect(e:
|
|
166
|
-
handleNodeExpand(e:
|
|
167
|
-
handleInputTriggerBlur(e?: {
|
|
168
|
+
handleSelectionKeyDown: (e: E & Pick<KeyboardEvent, "key" | "preventDefault" | "detail" | "target" | "currentTarget">) => void;
|
|
169
|
+
handleClear: (e?: E) => void;
|
|
170
|
+
removeTag: (eventKey: BasicTreeNodeData["key"]) => void;
|
|
171
|
+
handleNodeSelect: (e: E, treeNode: BasicTreeNodeProps) => void;
|
|
172
|
+
handleNodeExpand: (e: E, treeNode: BasicTreeNodeProps) => void;
|
|
173
|
+
handleInputTriggerBlur: (e?: {
|
|
168
174
|
relatedTarget: EventTarget | null;
|
|
169
|
-
})
|
|
170
|
-
handleInputTriggerFocus(e?: {
|
|
175
|
+
}) => void;
|
|
176
|
+
handleInputTriggerFocus: (e?: {
|
|
171
177
|
relatedTarget: EventTarget | null;
|
|
172
|
-
})
|
|
173
|
-
handlePopoverOpen()
|
|
174
|
-
handleAfterClose()
|
|
178
|
+
}) => void;
|
|
179
|
+
handlePopoverOpen: () => void;
|
|
180
|
+
handleAfterClose: () => void;
|
|
175
181
|
}
|
|
176
182
|
export type { Size };
|