@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
|
@@ -77,10 +77,10 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
77
77
|
else if (checkRelation === "unRelated") keyList = key;
|
|
78
78
|
const props = this.getProps();
|
|
79
79
|
const nodes = keyList.map((key) => TreeSelectFoundation.getNodeData(key, keyEntities, props));
|
|
80
|
-
if (this.getProp("onChangeWithObject")) this.
|
|
80
|
+
if (this.getProp("onChangeWithObject")) this.adapter.notifyChangeWithObject(nodes, e);
|
|
81
81
|
else {
|
|
82
82
|
const value = getValueOrKey(nodes, keyMaps);
|
|
83
|
-
this.
|
|
83
|
+
this.adapter.notifyChange(value, nodes, e);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
#notifyChange(key, e) {
|
|
@@ -90,19 +90,19 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
90
90
|
else {
|
|
91
91
|
const nodes = key === void 0 ? key : keyEntities[key].data;
|
|
92
92
|
const value = key === void 0 ? key : getValueOrKey(nodes, keyMaps);
|
|
93
|
-
if (this.getProp("onChangeWithObject")) this.
|
|
94
|
-
else this.
|
|
93
|
+
if (this.getProp("onChangeWithObject")) this.adapter.notifyChangeWithObject(nodes, e);
|
|
94
|
+
else this.adapter.notifyChange(value, nodes, e);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
#notifyFocus(e) {
|
|
98
98
|
if (!this.#blurPending && !this.#isDisabled()) {
|
|
99
99
|
this.#blurPending = true;
|
|
100
|
-
this.
|
|
100
|
+
this.adapter.notifyFocus(e);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
#notifyBlur(e) {
|
|
104
104
|
this.#blurPending = false;
|
|
105
|
-
this.
|
|
105
|
+
this.adapter.notifyBlur(e);
|
|
106
106
|
}
|
|
107
107
|
/** Loads a node's children once, after it is expanded */
|
|
108
108
|
#handleNodeLoad(key, data) {
|
|
@@ -113,30 +113,30 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
113
113
|
const newLoadedKeys = new Set(this.getState("loadedKeys")).add(key);
|
|
114
114
|
const newLoadingKeys = new Set(this.getState("loadingKeys"));
|
|
115
115
|
newLoadingKeys.delete(key);
|
|
116
|
-
this.
|
|
117
|
-
if (!this.#isLoadControlled()) this.
|
|
118
|
-
this.
|
|
116
|
+
this.adapter.notifyLoad(newLoadedKeys, data);
|
|
117
|
+
if (!this.#isLoadControlled()) this.adapter.updateState({ loadedKeys: newLoadedKeys });
|
|
118
|
+
this.adapter.updateState({ loadingKeys: newLoadingKeys });
|
|
119
119
|
}).finally(() => {
|
|
120
120
|
const currentLoadingKeys = this.getState("loadingKeys");
|
|
121
121
|
if (currentLoadingKeys.has(key)) {
|
|
122
122
|
const newLoadingKeys = new Set(currentLoadingKeys);
|
|
123
123
|
newLoadingKeys.delete(key);
|
|
124
|
-
this.
|
|
124
|
+
this.adapter.updateState({ loadingKeys: newLoadingKeys });
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
|
-
this.
|
|
127
|
+
this.adapter.updateState({ loadingKeys: new Set(loadingKeys).add(key) });
|
|
128
128
|
}
|
|
129
129
|
#focusInput() {
|
|
130
|
-
this.
|
|
130
|
+
this.adapter.focusInput();
|
|
131
131
|
}
|
|
132
132
|
#handleTriggerFocus(e) {
|
|
133
|
-
this.
|
|
133
|
+
this.adapter.updateIsFocus(true);
|
|
134
134
|
this.#notifyFocus(e);
|
|
135
135
|
}
|
|
136
136
|
#open() {
|
|
137
137
|
if (this.getProp("filterTreeNode")) this.#clearInput();
|
|
138
|
-
this.
|
|
139
|
-
this.
|
|
138
|
+
this.adapter.openMenu();
|
|
139
|
+
this.adapter.notifyVisibleChange(true);
|
|
140
140
|
}
|
|
141
141
|
#clearInput() {
|
|
142
142
|
const { expandedKeys, selectedKeys, keyEntities, treeData } = this.getStates();
|
|
@@ -145,7 +145,7 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
145
145
|
const expandedOptsKeys = this.#isExpandControlled() ? [] : findAncestorKeys(selectedKeys, keyEntities, false);
|
|
146
146
|
expandedOptsKeys.forEach((item) => newExpandedKeys.add(item));
|
|
147
147
|
const newFlattenNodes = flattenTreeData(treeData, newExpandedKeys, keyMaps);
|
|
148
|
-
this.
|
|
148
|
+
this.adapter.updateState({
|
|
149
149
|
expandedKeys: newExpandedKeys,
|
|
150
150
|
flattenNodes: newFlattenNodes,
|
|
151
151
|
inputValue: "",
|
|
@@ -156,11 +156,11 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
#handleInputChange(searchValue) {
|
|
159
|
-
this.
|
|
159
|
+
this.adapter.updateInputValue(searchValue);
|
|
160
160
|
const { expandedKeys, selectedKeys, keyEntities, treeData } = this.getStates();
|
|
161
161
|
const { showFilteredOnly, filterTreeNode, treeNodeFilterProp, keyMaps, remote } = this.getProps();
|
|
162
162
|
if (remote) {
|
|
163
|
-
this.
|
|
163
|
+
this.adapter.notifySearch(searchValue, [], []);
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
166
166
|
const realFilterProp = getFilterProp(treeNodeFilterProp, keyMaps);
|
|
@@ -188,8 +188,8 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
188
188
|
newFlattenNodes = flattenTreeData(treeData, new Set(expandedOptsKeys), keyMaps, showFilteredOnly && filteredShownKeys);
|
|
189
189
|
}
|
|
190
190
|
const newFilteredExpandedKeys = new Set(expandedOptsKeys);
|
|
191
|
-
this.
|
|
192
|
-
this.
|
|
191
|
+
this.adapter.notifySearch(searchValue, Array.from(newFilteredExpandedKeys), filteredNodes);
|
|
192
|
+
this.adapter.updateState({
|
|
193
193
|
expandedKeys: newExpandedKeys,
|
|
194
194
|
flattenNodes: newFlattenNodes,
|
|
195
195
|
motionKeys: /* @__PURE__ */ new Set([]),
|
|
@@ -201,14 +201,14 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
201
201
|
#handleSingleSelect(e, { selected, eventKey, data, children }) {
|
|
202
202
|
let selectedKeys = [...this.getState("selectedKeys")];
|
|
203
203
|
const { clickToHide } = this.getProps();
|
|
204
|
-
this.
|
|
204
|
+
this.adapter.notifySelect(eventKey, true, data);
|
|
205
205
|
if (!selectedKeys.includes(eventKey) && !selected) {
|
|
206
206
|
selectedKeys = [eventKey];
|
|
207
207
|
this.#notifyChange(eventKey, e);
|
|
208
|
-
if (!this.
|
|
208
|
+
if (!this.isControlledComponent()) this.adapter.updateState({ selectedKeys });
|
|
209
209
|
}
|
|
210
210
|
if (clickToHide && (this.#isSelectToClose() || !children)) {
|
|
211
|
-
if (this.#blurPending) this.
|
|
211
|
+
if (this.#blurPending) this.adapter.focusTrigger();
|
|
212
212
|
this.close();
|
|
213
213
|
this.handleTriggerBlur(e);
|
|
214
214
|
}
|
|
@@ -218,9 +218,9 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
218
218
|
const state = this.getStates();
|
|
219
219
|
const result = getMultipleSelectResult(treeNode, props, state);
|
|
220
220
|
if (result) {
|
|
221
|
-
this.
|
|
221
|
+
this.adapter.notifySelect(treeNode.eventKey, result.targetStatus, treeNode.data);
|
|
222
222
|
this.#notifyChange(result.keys, e);
|
|
223
|
-
if (!this.
|
|
223
|
+
if (!this.isControlledComponent()) this.adapter.updateState(result.state);
|
|
224
224
|
}
|
|
225
225
|
if (props.searchPosition === strings.SEARCH_POSITION_TRIGGER && state.inputValue !== "") this.#handleInputChange("");
|
|
226
226
|
}
|
|
@@ -235,7 +235,7 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
235
235
|
filteredExpandedKeys.delete(eventKey);
|
|
236
236
|
motionType = "hide";
|
|
237
237
|
}
|
|
238
|
-
this.
|
|
238
|
+
this.adapter.setCachedFlattenNodes(motionType === "hide" && this.#isAnimated() ? this.getState("flattenNodes") : void 0);
|
|
239
239
|
if (!this.#isExpandControlled()) {
|
|
240
240
|
const flattenNodes = flattenTreeData(treeData, filteredExpandedKeys, keyMaps, showFilteredOnly && filteredShownKeys);
|
|
241
241
|
let motionKeys = this.#isAnimated() ? getMotionKeys(eventKey, filteredExpandedKeys, keyEntities) : [];
|
|
@@ -246,9 +246,9 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
246
246
|
motionKeys: new Set(motionKeys),
|
|
247
247
|
motionType
|
|
248
248
|
};
|
|
249
|
-
this.
|
|
249
|
+
this.adapter.updateState(newState);
|
|
250
250
|
}
|
|
251
|
-
this.
|
|
251
|
+
this.adapter.notifyExpand(filteredExpandedKeys, {
|
|
252
252
|
expanded: !expanded,
|
|
253
253
|
node: data
|
|
254
254
|
});
|
|
@@ -398,8 +398,7 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
398
398
|
};
|
|
399
399
|
}
|
|
400
400
|
/** The keys the trigger shows: the selection, or in multiple mode the checked keys merged as onChange reports them */
|
|
401
|
-
static getTriggerKeys(props,
|
|
402
|
-
const { checkedKeys, realCheckedKeys, keyEntities, selectedKeys } = state;
|
|
401
|
+
static getTriggerKeys(props, { checkedKeys, realCheckedKeys, keyEntities, selectedKeys }) {
|
|
403
402
|
if (!props.multiple) return selectedKeys;
|
|
404
403
|
if (props.checkRelation === "unRelated") return [...realCheckedKeys];
|
|
405
404
|
if (props.autoMergeValue || props.leafOnly) return normalizeKeyList([...checkedKeys], keyEntities, props.leafOnly, true);
|
|
@@ -435,50 +434,59 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
435
434
|
if (triggerSearchAutoFocus && able) this.#handleTriggerFocus(null);
|
|
436
435
|
}
|
|
437
436
|
/** Writes the state derived from new props back, so handlers read what was rendered */
|
|
438
|
-
syncDerivedState(derived) {
|
|
439
|
-
this.
|
|
440
|
-
}
|
|
437
|
+
syncDerivedState = (derived) => {
|
|
438
|
+
this.adapter.updateState(derived);
|
|
439
|
+
};
|
|
441
440
|
/** Searches as if `value` were typed, opening the dropdown first */
|
|
442
|
-
search(value) {
|
|
441
|
+
search = (value) => {
|
|
443
442
|
if (!this.getState("isOpen")) this.#open();
|
|
444
443
|
this.#handleInputChange(value);
|
|
445
|
-
}
|
|
444
|
+
};
|
|
446
445
|
/** Focus entering the trigger (its search input, tags, clear button) or the dropdown from outside */
|
|
447
|
-
handleTriggerFocus(e) {
|
|
446
|
+
handleTriggerFocus = (e) => {
|
|
448
447
|
this.#notifyFocus(e);
|
|
449
|
-
}
|
|
448
|
+
};
|
|
450
449
|
/**
|
|
451
450
|
* Reports the blur once per focus: on a mousedown outside, a single pick that closes, or the focus leaving the
|
|
452
451
|
* trigger and the dropdown (the component checks where it went)
|
|
453
452
|
*/
|
|
454
453
|
handleTriggerBlur(e) {
|
|
455
454
|
if (!this.#blurPending) return;
|
|
456
|
-
this.
|
|
455
|
+
this.adapter.updateIsFocus(false);
|
|
457
456
|
this.#notifyBlur(e);
|
|
458
457
|
}
|
|
458
|
+
/**
|
|
459
|
+
* The focus left the trigger and the dropdown (the component checks where it went): reports the blur, and closes
|
|
460
|
+
* an open dropdown when the focus went to another element (APG combobox). A window blur has no target and keeps
|
|
461
|
+
* the dropdown, as the native select does.
|
|
462
|
+
*/
|
|
463
|
+
handleFocusLeave = (e) => {
|
|
464
|
+
this.handleTriggerBlur(e);
|
|
465
|
+
if (e.relatedTarget && this.getState("isOpen")) this.close();
|
|
466
|
+
};
|
|
459
467
|
/** A mousedown outside the trigger and the dropdown, listened to while the TreeSelect is focused or open */
|
|
460
|
-
handleClickOutside(e) {
|
|
468
|
+
handleClickOutside = (e) => {
|
|
461
469
|
this.handleTriggerBlur(e);
|
|
462
470
|
if (this.getState("isOpen")) this.close();
|
|
463
|
-
}
|
|
464
|
-
handleKeyDown(e) {
|
|
471
|
+
};
|
|
472
|
+
handleKeyDown = (e) => {
|
|
465
473
|
if (e.key === "Escape") {
|
|
466
474
|
if (this.getState("isOpen")) {
|
|
467
475
|
e.preventDefault();
|
|
468
|
-
this.
|
|
476
|
+
this.adapter.focusTrigger();
|
|
469
477
|
this.close();
|
|
470
478
|
}
|
|
471
479
|
}
|
|
472
|
-
}
|
|
473
|
-
onClickSingleTriggerSearchItem() {
|
|
480
|
+
};
|
|
481
|
+
onClickSingleTriggerSearchItem = () => {
|
|
474
482
|
this.#focusInput();
|
|
475
|
-
}
|
|
476
|
-
close() {
|
|
477
|
-
this.
|
|
478
|
-
this.
|
|
479
|
-
if (this.getProp("motionExpand")) this.
|
|
480
|
-
}
|
|
481
|
-
handleClick(e) {
|
|
483
|
+
};
|
|
484
|
+
close = () => {
|
|
485
|
+
this.adapter.closeMenu();
|
|
486
|
+
this.adapter.notifyVisibleChange(false);
|
|
487
|
+
if (this.getProp("motionExpand")) this.adapter.updateState({ motionKeys: /* @__PURE__ */ new Set([]) });
|
|
488
|
+
};
|
|
489
|
+
handleClick = (e) => {
|
|
482
490
|
const isDisabled = this.#isDisabled();
|
|
483
491
|
const { isOpen, inputValue, isFocus } = this.getStates();
|
|
484
492
|
const { searchPosition, clickTriggerToHide } = this.getProps();
|
|
@@ -491,27 +499,27 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
491
499
|
if (clickTriggerToHide) this.close();
|
|
492
500
|
} else this.#open();
|
|
493
501
|
}
|
|
494
|
-
}
|
|
502
|
+
};
|
|
495
503
|
/**
|
|
496
504
|
* Enter toggles the popup like a click; Down and Up open a closed one (APG combobox). Outside a text field (the
|
|
497
505
|
* select-only combobox) Space toggles it like Enter, and Home and End open a closed one: the view moves to the
|
|
498
506
|
* first or the last row, which lives in the view.
|
|
499
507
|
*/
|
|
500
|
-
handleSelectionKeyDown(e) {
|
|
508
|
+
handleSelectionKeyDown = (e) => {
|
|
501
509
|
const editing = isTextEditor(e.target);
|
|
502
510
|
if (!this.getState("isOpen") && (e.key === "ArrowDown" || e.key === "ArrowUp" || !editing && (e.key === "Home" || e.key === "End")) || isEnterPress(e) || e.key === " " && !editing) {
|
|
503
511
|
e.preventDefault();
|
|
504
512
|
this.handleClick(e);
|
|
505
513
|
}
|
|
506
|
-
}
|
|
507
|
-
handleClear(e) {
|
|
514
|
+
};
|
|
515
|
+
handleClear = (e) => {
|
|
508
516
|
const { searchPosition, filterTreeNode } = this.getProps();
|
|
509
517
|
const { inputValue, selectedKeys } = this.getStates();
|
|
510
|
-
const isControlled = this.
|
|
518
|
+
const isControlled = this.isControlledComponent();
|
|
511
519
|
const value = this.#isMultiple() ? [] : void 0;
|
|
512
520
|
const hasValue = TreeSelectFoundation.hasValue(this.getProps(), this.getStates());
|
|
513
521
|
if (hasValue) this.#notifyChange(value, e);
|
|
514
|
-
if (hasValue && !isControlled) this.
|
|
522
|
+
if (hasValue && !isControlled) this.adapter.updateState({
|
|
515
523
|
selectedKeys: [],
|
|
516
524
|
checkedKeys: /* @__PURE__ */ new Set(),
|
|
517
525
|
halfCheckedKeys: /* @__PURE__ */ new Set(),
|
|
@@ -523,9 +531,9 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
523
531
|
else this.#clearInput();
|
|
524
532
|
}
|
|
525
533
|
}
|
|
526
|
-
this.
|
|
527
|
-
}
|
|
528
|
-
removeTag(eventKey) {
|
|
534
|
+
this.adapter.notifyClear(e);
|
|
535
|
+
};
|
|
536
|
+
removeTag = (eventKey) => {
|
|
529
537
|
const props = this.getProps();
|
|
530
538
|
const { disableStrictly, checkRelation, keyMaps } = props;
|
|
531
539
|
const state = this.getStates();
|
|
@@ -536,23 +544,23 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
536
544
|
const newRealCheckedKeys = new Set(realCheckedKeys);
|
|
537
545
|
newRealCheckedKeys.delete(eventKey);
|
|
538
546
|
this.#notifyChange([...newRealCheckedKeys], null);
|
|
539
|
-
if (!this.
|
|
547
|
+
if (!this.isControlledComponent()) this.adapter.updateState({ realCheckedKeys: newRealCheckedKeys });
|
|
540
548
|
} else if (checkRelation === "related") {
|
|
541
549
|
const { checkedKeys, halfCheckedKeys } = calcRelatedCheckedKeys(eventKey, false, disableStrictly, state);
|
|
542
550
|
this.#notifyChange([...checkedKeys], null);
|
|
543
|
-
if (!this.
|
|
551
|
+
if (!this.isControlledComponent()) this.adapter.updateState({
|
|
544
552
|
checkedKeys,
|
|
545
553
|
halfCheckedKeys
|
|
546
554
|
});
|
|
547
555
|
}
|
|
548
|
-
this.
|
|
549
|
-
}
|
|
550
|
-
handleNodeSelect(e, treeNode) {
|
|
556
|
+
this.adapter.notifySelect(eventKey, false, item);
|
|
557
|
+
};
|
|
558
|
+
handleNodeSelect = (e, treeNode) => {
|
|
551
559
|
if (this.#isDisabled(treeNode)) return;
|
|
552
560
|
if (!this.#isMultiple()) this.#handleSingleSelect(e, treeNode);
|
|
553
561
|
else this.#handleMultipleSelect(e, treeNode);
|
|
554
|
-
}
|
|
555
|
-
handleNodeExpand(e, treeNode) {
|
|
562
|
+
};
|
|
563
|
+
handleNodeExpand = (e, treeNode) => {
|
|
556
564
|
const { loadData, keyMaps } = this.getProps();
|
|
557
565
|
const { inputValue, keyEntities } = this.getStates();
|
|
558
566
|
const isSearching = Boolean(inputValue);
|
|
@@ -571,7 +579,7 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
571
579
|
expandedKeys.delete(eventKey);
|
|
572
580
|
motionType = "hide";
|
|
573
581
|
}
|
|
574
|
-
this.
|
|
582
|
+
this.adapter.setCachedFlattenNodes(motionType === "hide" && this.#isAnimated() ? this.getState("flattenNodes") : void 0);
|
|
575
583
|
if (!isExpandControlled) {
|
|
576
584
|
const flattenNodes = flattenTreeData(treeData, expandedKeys, keyMaps);
|
|
577
585
|
const motionKeys = this.#isAnimated() ? getMotionKeys(eventKey, expandedKeys, keyEntities) : [];
|
|
@@ -581,30 +589,30 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
581
589
|
motionKeys: new Set(motionKeys),
|
|
582
590
|
motionType
|
|
583
591
|
};
|
|
584
|
-
this.
|
|
592
|
+
this.adapter.updateState(newState);
|
|
585
593
|
}
|
|
586
|
-
this.
|
|
594
|
+
this.adapter.notifyExpand(expandedKeys, {
|
|
587
595
|
expanded: !expanded,
|
|
588
596
|
node: data
|
|
589
597
|
});
|
|
590
598
|
if (!expanded) this.#handleNodeLoad(eventKey, data);
|
|
591
|
-
}
|
|
592
|
-
handleInputTriggerBlur(e) {
|
|
593
|
-
if (this.
|
|
594
|
-
this.
|
|
595
|
-
}
|
|
596
|
-
handleInputTriggerFocus(e) {
|
|
597
|
-
if (this.
|
|
599
|
+
};
|
|
600
|
+
handleInputTriggerBlur = (e) => {
|
|
601
|
+
if (this.adapter.isInTrigger(e?.relatedTarget)) return;
|
|
602
|
+
this.adapter.updateState({ inputTriggerFocus: false });
|
|
603
|
+
};
|
|
604
|
+
handleInputTriggerFocus = (e) => {
|
|
605
|
+
if (this.adapter.isInTrigger(e?.relatedTarget)) return;
|
|
598
606
|
this.#clearInput();
|
|
599
|
-
this.
|
|
600
|
-
}
|
|
601
|
-
handlePopoverOpen() {
|
|
607
|
+
this.adapter.updateState({ inputTriggerFocus: true });
|
|
608
|
+
};
|
|
609
|
+
handlePopoverOpen = () => {
|
|
602
610
|
const { filterTreeNode, searchAutoFocus, searchPosition } = this.getProps();
|
|
603
611
|
if (filterTreeNode && searchPosition === strings.SEARCH_POSITION_DROPDOWN && searchAutoFocus) this.#focusInput();
|
|
604
|
-
}
|
|
605
|
-
handleAfterClose() {
|
|
612
|
+
};
|
|
613
|
+
handleAfterClose = () => {
|
|
606
614
|
const { filterTreeNode } = this.getProps();
|
|
607
615
|
if (filterTreeNode) this.#clearInput();
|
|
608
|
-
}
|
|
616
|
+
};
|
|
609
617
|
};
|
|
610
618
|
export { TreeSelectFoundation as default, treeSelectDerivedPropKeys };
|
|
@@ -29,8 +29,8 @@ export declare function isOverflowing(node: HTMLElement, rows: number): boolean;
|
|
|
29
29
|
*/
|
|
30
30
|
export declare class EllipsisRuntime {
|
|
31
31
|
#private;
|
|
32
|
-
connect(measure: () => void)
|
|
33
|
-
disconnect()
|
|
34
|
-
schedule()
|
|
35
|
-
handleResize()
|
|
32
|
+
connect: (measure: () => void) => void;
|
|
33
|
+
disconnect: () => void;
|
|
34
|
+
schedule: () => void;
|
|
35
|
+
handleResize: () => void;
|
|
36
36
|
}
|
|
@@ -131,26 +131,26 @@ var EllipsisRuntime = class {
|
|
|
131
131
|
#gateTimer;
|
|
132
132
|
#observing = false;
|
|
133
133
|
#measure = () => void 0;
|
|
134
|
-
connect(measure) {
|
|
134
|
+
connect = (measure) => {
|
|
135
135
|
this.#measure = measure;
|
|
136
136
|
this.#gateFrame = requestAnimationFrame(() => {
|
|
137
137
|
this.#gateTimer = setTimeout(() => {
|
|
138
138
|
this.#observing = true;
|
|
139
139
|
});
|
|
140
140
|
});
|
|
141
|
-
}
|
|
142
|
-
disconnect() {
|
|
141
|
+
};
|
|
142
|
+
disconnect = () => {
|
|
143
143
|
cancelAnimationFrame(this.#frame);
|
|
144
144
|
cancelAnimationFrame(this.#gateFrame);
|
|
145
145
|
clearTimeout(this.#gateTimer);
|
|
146
146
|
this.#observing = false;
|
|
147
|
-
}
|
|
148
|
-
schedule() {
|
|
147
|
+
};
|
|
148
|
+
schedule = () => {
|
|
149
149
|
cancelAnimationFrame(this.#frame);
|
|
150
150
|
this.#frame = requestAnimationFrame(() => this.#measure());
|
|
151
|
-
}
|
|
152
|
-
handleResize() {
|
|
151
|
+
};
|
|
152
|
+
handleResize = () => {
|
|
153
153
|
if (this.#observing) this.schedule();
|
|
154
|
-
}
|
|
154
|
+
};
|
|
155
155
|
};
|
|
156
156
|
export { EllipsisRuntime, canUseCSSEllipsis, getEllipsisOpt, getRenderText, isInsideWidgetItem, isOverflowing };
|
|
@@ -78,12 +78,12 @@ var FormatNumeral = class {
|
|
|
78
78
|
if (cTLength < this.#precision) return `${cArr[0]}.${cArr[1]}${"0".repeat(this.#precision - cTLength)}`;
|
|
79
79
|
return cTruncated.toString();
|
|
80
80
|
}
|
|
81
|
-
format() {
|
|
81
|
+
format = () => {
|
|
82
82
|
if (this.#parser !== void 0) return this.#parser(this.#content);
|
|
83
83
|
if (this.#rule === "text") return extractNumbers(this.#content).map((item) => checkIsNumeral(item) ? this.#truncatePrecision(item) : item).join("");
|
|
84
84
|
if (this.#rule === "numbers") return extractNumbers(this.#content).filter((item) => checkIsNumeral(item)).map((item) => this.#truncatePrecision(item)).join(",");
|
|
85
85
|
return extractNumbers(this.#content).map((item) => checkIsNumeral(item) ? this.#ruleMethods[this.#rule](Number(item)) : item).join("");
|
|
86
|
-
}
|
|
86
|
+
};
|
|
87
87
|
};
|
|
88
88
|
function shiftDecimal(value, places) {
|
|
89
89
|
if (!Number.isFinite(value)) return value;
|
|
@@ -11,7 +11,7 @@ export declare const strings: {
|
|
|
11
11
|
FILE_STATUS_WAIT_UPLOAD: string;
|
|
12
12
|
FILE_LIST_PIC: "picture";
|
|
13
13
|
FILE_LIST_DEFAULT: "list";
|
|
14
|
-
LIST_TYPE: ("
|
|
14
|
+
LIST_TYPE: ("list" | "picture" | "none")[];
|
|
15
15
|
DRAG_AREA_DEFAULT: string;
|
|
16
16
|
DRAG_AREA_LEGAL: string;
|
|
17
17
|
TRIGGER_AUTO: "auto";
|
|
@@ -158,30 +158,30 @@ export default class UploadFoundation<P extends UploadBaseProps = UploadBaseProp
|
|
|
158
158
|
protected buildFileItem(fileInstance: CustomFile, uploadTrigger: string): BaseFileItem;
|
|
159
159
|
protected checkFileFormat(accept: string, file: File): boolean;
|
|
160
160
|
/** Closes the cropper and drops the queue; the files already cropped are discarded */
|
|
161
|
-
cancelCrop()
|
|
161
|
+
cancelCrop: () => void;
|
|
162
162
|
/** Crops the current image, then moves to the next queued one or adds every result once the queue drains */
|
|
163
|
-
confirmCrop()
|
|
163
|
+
confirmCrop: () => Promise<void>;
|
|
164
164
|
/** Keep the synchronous snapshot aligned with an externally controlled fileList. */
|
|
165
|
-
syncLatestFileList(fileList: Array<BaseFileItem>)
|
|
165
|
+
syncLatestFileList: (fileList: Array<BaseFileItem>) => void;
|
|
166
166
|
/** A fileList prop that goes back to undefined clears the list (a form reset) and leaves it uncontrolled */
|
|
167
|
-
handleFileListPropChange(fileList?: Array<BaseFileItem>)
|
|
167
|
+
handleFileListPropChange: (fileList?: Array<BaseFileItem>) => void;
|
|
168
168
|
/** The list on screen: the fileList prop when controlled, otherwise the fileList state. */
|
|
169
169
|
getFileList(): BaseFileItem[];
|
|
170
170
|
init(): void;
|
|
171
171
|
/** Adds the files of a paste on the page; the host listens only while addOnPasting is on and not disabled */
|
|
172
|
-
handlePasting(e: ClipboardEvent)
|
|
172
|
+
handlePasting: (e: ClipboardEvent) => void;
|
|
173
173
|
/** Entry for picked, dropped and pasted files: with crop on, images are cropped before they are added */
|
|
174
|
-
addFiles(currentFileList: FileList | Array<File>)
|
|
174
|
+
addFiles: (currentFileList: FileList | Array<File>) => void;
|
|
175
175
|
/** Entry for the file picked to replace the item `replaceUid` names; with crop on, an image is cropped first */
|
|
176
|
-
handleReplaceChange(currentFileList: FileList | Array<File>)
|
|
177
|
-
insertFileToList(files: Array<CustomFile>, index?: number)
|
|
178
|
-
manualUpload()
|
|
179
|
-
handleRemove(file: BaseFileItem)
|
|
180
|
-
handleClear()
|
|
181
|
-
handleDragEnter(e: UploadDragEvent)
|
|
182
|
-
handleDrop(e: E)
|
|
183
|
-
handleDragOver(e: UploadDragEvent)
|
|
184
|
-
handleDragLeave(e: UploadDragEvent)
|
|
185
|
-
retry(fileItem: BaseFileItem)
|
|
186
|
-
handlePreviewClick(fileItem: BaseFileItem)
|
|
176
|
+
handleReplaceChange: (currentFileList: FileList | Array<File>) => void;
|
|
177
|
+
insertFileToList: (files: Array<CustomFile>, index?: number) => void;
|
|
178
|
+
manualUpload: () => void;
|
|
179
|
+
handleRemove: (file: BaseFileItem) => void;
|
|
180
|
+
handleClear: () => void;
|
|
181
|
+
handleDragEnter: (e: UploadDragEvent) => void;
|
|
182
|
+
handleDrop: (e: E) => void;
|
|
183
|
+
handleDragOver: (e: UploadDragEvent) => void;
|
|
184
|
+
handleDragLeave: (e: UploadDragEvent) => void;
|
|
185
|
+
retry: (fileItem: BaseFileItem) => void;
|
|
186
|
+
handlePreviewClick: (fileItem: BaseFileItem) => void;
|
|
187
187
|
}
|