@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
|
@@ -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,21 +90,20 @@ 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
|
-
/** Loads a node's children once, after it is expanded */
|
|
108
107
|
#handleNodeLoad(key, data) {
|
|
109
108
|
const { loadData } = this.getProps();
|
|
110
109
|
const { loadedKeys, loadingKeys } = this.getStates();
|
|
@@ -113,30 +112,30 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
113
112
|
const newLoadedKeys = new Set(this.getState("loadedKeys")).add(key);
|
|
114
113
|
const newLoadingKeys = new Set(this.getState("loadingKeys"));
|
|
115
114
|
newLoadingKeys.delete(key);
|
|
116
|
-
this.
|
|
117
|
-
if (!this.#isLoadControlled()) this.
|
|
118
|
-
this.
|
|
115
|
+
this.adapter.notifyLoad(newLoadedKeys, data);
|
|
116
|
+
if (!this.#isLoadControlled()) this.adapter.updateState({ loadedKeys: newLoadedKeys });
|
|
117
|
+
this.adapter.updateState({ loadingKeys: newLoadingKeys });
|
|
119
118
|
}).finally(() => {
|
|
120
119
|
const currentLoadingKeys = this.getState("loadingKeys");
|
|
121
120
|
if (currentLoadingKeys.has(key)) {
|
|
122
121
|
const newLoadingKeys = new Set(currentLoadingKeys);
|
|
123
122
|
newLoadingKeys.delete(key);
|
|
124
|
-
this.
|
|
123
|
+
this.adapter.updateState({ loadingKeys: newLoadingKeys });
|
|
125
124
|
}
|
|
126
125
|
});
|
|
127
|
-
this.
|
|
126
|
+
this.adapter.updateState({ loadingKeys: new Set(loadingKeys).add(key) });
|
|
128
127
|
}
|
|
129
128
|
#focusInput() {
|
|
130
|
-
this.
|
|
129
|
+
this.adapter.focusInput();
|
|
131
130
|
}
|
|
132
131
|
#handleTriggerFocus(e) {
|
|
133
|
-
this.
|
|
132
|
+
this.adapter.updateIsFocus(true);
|
|
134
133
|
this.#notifyFocus(e);
|
|
135
134
|
}
|
|
136
135
|
#open() {
|
|
137
136
|
if (this.getProp("filterTreeNode")) this.#clearInput();
|
|
138
|
-
this.
|
|
139
|
-
this.
|
|
137
|
+
this.adapter.openMenu();
|
|
138
|
+
this.adapter.notifyVisibleChange(true);
|
|
140
139
|
}
|
|
141
140
|
#clearInput() {
|
|
142
141
|
const { expandedKeys, selectedKeys, keyEntities, treeData } = this.getStates();
|
|
@@ -145,7 +144,7 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
145
144
|
const expandedOptsKeys = this.#isExpandControlled() ? [] : findAncestorKeys(selectedKeys, keyEntities, false);
|
|
146
145
|
expandedOptsKeys.forEach((item) => newExpandedKeys.add(item));
|
|
147
146
|
const newFlattenNodes = flattenTreeData(treeData, newExpandedKeys, keyMaps);
|
|
148
|
-
this.
|
|
147
|
+
this.adapter.updateState({
|
|
149
148
|
expandedKeys: newExpandedKeys,
|
|
150
149
|
flattenNodes: newFlattenNodes,
|
|
151
150
|
inputValue: "",
|
|
@@ -156,11 +155,11 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
156
155
|
});
|
|
157
156
|
}
|
|
158
157
|
#handleInputChange(searchValue) {
|
|
159
|
-
this.
|
|
158
|
+
this.adapter.updateInputValue(searchValue);
|
|
160
159
|
const { expandedKeys, selectedKeys, keyEntities, treeData } = this.getStates();
|
|
161
160
|
const { showFilteredOnly, filterTreeNode, treeNodeFilterProp, keyMaps, remote } = this.getProps();
|
|
162
161
|
if (remote) {
|
|
163
|
-
this.
|
|
162
|
+
this.adapter.notifySearch(searchValue, [], []);
|
|
164
163
|
return;
|
|
165
164
|
}
|
|
166
165
|
const realFilterProp = getFilterProp(treeNodeFilterProp, keyMaps);
|
|
@@ -188,8 +187,8 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
188
187
|
newFlattenNodes = flattenTreeData(treeData, new Set(expandedOptsKeys), keyMaps, showFilteredOnly && filteredShownKeys);
|
|
189
188
|
}
|
|
190
189
|
const newFilteredExpandedKeys = new Set(expandedOptsKeys);
|
|
191
|
-
this.
|
|
192
|
-
this.
|
|
190
|
+
this.adapter.notifySearch(searchValue, Array.from(newFilteredExpandedKeys), filteredNodes);
|
|
191
|
+
this.adapter.updateState({
|
|
193
192
|
expandedKeys: newExpandedKeys,
|
|
194
193
|
flattenNodes: newFlattenNodes,
|
|
195
194
|
motionKeys: /* @__PURE__ */ new Set([]),
|
|
@@ -201,14 +200,14 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
201
200
|
#handleSingleSelect(e, { selected, eventKey, data, children }) {
|
|
202
201
|
let selectedKeys = [...this.getState("selectedKeys")];
|
|
203
202
|
const { clickToHide } = this.getProps();
|
|
204
|
-
this.
|
|
203
|
+
this.adapter.notifySelect(eventKey, true, data);
|
|
205
204
|
if (!selectedKeys.includes(eventKey) && !selected) {
|
|
206
205
|
selectedKeys = [eventKey];
|
|
207
206
|
this.#notifyChange(eventKey, e);
|
|
208
|
-
if (!this.
|
|
207
|
+
if (!this.isControlledComponent()) this.adapter.updateState({ selectedKeys });
|
|
209
208
|
}
|
|
210
209
|
if (clickToHide && (this.#isSelectToClose() || !children)) {
|
|
211
|
-
if (this.#blurPending) this.
|
|
210
|
+
if (this.#blurPending) this.adapter.focusTrigger();
|
|
212
211
|
this.close();
|
|
213
212
|
this.handleTriggerBlur(e);
|
|
214
213
|
}
|
|
@@ -218,9 +217,9 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
218
217
|
const state = this.getStates();
|
|
219
218
|
const result = getMultipleSelectResult(treeNode, props, state);
|
|
220
219
|
if (result) {
|
|
221
|
-
this.
|
|
220
|
+
this.adapter.notifySelect(treeNode.eventKey, result.targetStatus, treeNode.data);
|
|
222
221
|
this.#notifyChange(result.keys, e);
|
|
223
|
-
if (!this.
|
|
222
|
+
if (!this.isControlledComponent()) this.adapter.updateState(result.state);
|
|
224
223
|
}
|
|
225
224
|
if (props.searchPosition === strings.SEARCH_POSITION_TRIGGER && state.inputValue !== "") this.#handleInputChange("");
|
|
226
225
|
}
|
|
@@ -235,7 +234,7 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
235
234
|
filteredExpandedKeys.delete(eventKey);
|
|
236
235
|
motionType = "hide";
|
|
237
236
|
}
|
|
238
|
-
this.
|
|
237
|
+
this.adapter.setCachedFlattenNodes(motionType === "hide" && this.#isAnimated() ? this.getState("flattenNodes") : void 0);
|
|
239
238
|
if (!this.#isExpandControlled()) {
|
|
240
239
|
const flattenNodes = flattenTreeData(treeData, filteredExpandedKeys, keyMaps, showFilteredOnly && filteredShownKeys);
|
|
241
240
|
let motionKeys = this.#isAnimated() ? getMotionKeys(eventKey, filteredExpandedKeys, keyEntities) : [];
|
|
@@ -246,9 +245,9 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
246
245
|
motionKeys: new Set(motionKeys),
|
|
247
246
|
motionType
|
|
248
247
|
};
|
|
249
|
-
this.
|
|
248
|
+
this.adapter.updateState(newState);
|
|
250
249
|
}
|
|
251
|
-
this.
|
|
250
|
+
this.adapter.notifyExpand(filteredExpandedKeys, {
|
|
252
251
|
expanded: !expanded,
|
|
253
252
|
node: data
|
|
254
253
|
});
|
|
@@ -365,7 +364,6 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
365
364
|
newState.prevProps = { ...props };
|
|
366
365
|
return newState;
|
|
367
366
|
}
|
|
368
|
-
/** The state of a new TreeSelect: the empty state with what the props imply */
|
|
369
367
|
static getInitialState(props) {
|
|
370
368
|
const state = {
|
|
371
369
|
inputTriggerFocus: false,
|
|
@@ -398,8 +396,7 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
398
396
|
};
|
|
399
397
|
}
|
|
400
398
|
/** 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;
|
|
399
|
+
static getTriggerKeys(props, { checkedKeys, realCheckedKeys, keyEntities, selectedKeys }) {
|
|
403
400
|
if (!props.multiple) return selectedKeys;
|
|
404
401
|
if (props.checkRelation === "unRelated") return [...realCheckedKeys];
|
|
405
402
|
if (props.autoMergeValue || props.leafOnly) return normalizeKeyList([...checkedKeys], keyEntities, props.leafOnly, true);
|
|
@@ -435,50 +432,58 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
435
432
|
if (triggerSearchAutoFocus && able) this.#handleTriggerFocus(null);
|
|
436
433
|
}
|
|
437
434
|
/** Writes the state derived from new props back, so handlers read what was rendered */
|
|
438
|
-
syncDerivedState(derived) {
|
|
439
|
-
this.
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
search(value) {
|
|
435
|
+
syncDerivedState = (derived) => {
|
|
436
|
+
this.adapter.updateState(derived);
|
|
437
|
+
};
|
|
438
|
+
search = (value) => {
|
|
443
439
|
if (!this.getState("isOpen")) this.#open();
|
|
444
440
|
this.#handleInputChange(value);
|
|
445
|
-
}
|
|
441
|
+
};
|
|
446
442
|
/** Focus entering the trigger (its search input, tags, clear button) or the dropdown from outside */
|
|
447
|
-
handleTriggerFocus(e) {
|
|
443
|
+
handleTriggerFocus = (e) => {
|
|
448
444
|
this.#notifyFocus(e);
|
|
449
|
-
}
|
|
445
|
+
};
|
|
450
446
|
/**
|
|
451
447
|
* Reports the blur once per focus: on a mousedown outside, a single pick that closes, or the focus leaving the
|
|
452
448
|
* trigger and the dropdown (the component checks where it went)
|
|
453
449
|
*/
|
|
454
450
|
handleTriggerBlur(e) {
|
|
455
451
|
if (!this.#blurPending) return;
|
|
456
|
-
this.
|
|
452
|
+
this.adapter.updateIsFocus(false);
|
|
457
453
|
this.#notifyBlur(e);
|
|
458
454
|
}
|
|
455
|
+
/**
|
|
456
|
+
* The focus left the trigger and the dropdown (the component checks where it went): reports the blur, and closes
|
|
457
|
+
* an open dropdown when the focus went to another element (APG combobox). A window blur has no target and keeps
|
|
458
|
+
* the dropdown, as the native select does.
|
|
459
|
+
*/
|
|
460
|
+
handleFocusLeave = (e) => {
|
|
461
|
+
this.handleTriggerBlur(e);
|
|
462
|
+
if (e.relatedTarget && this.getState("isOpen")) this.close();
|
|
463
|
+
};
|
|
459
464
|
/** A mousedown outside the trigger and the dropdown, listened to while the TreeSelect is focused or open */
|
|
460
|
-
handleClickOutside(e) {
|
|
465
|
+
handleClickOutside = (e) => {
|
|
461
466
|
this.handleTriggerBlur(e);
|
|
462
467
|
if (this.getState("isOpen")) this.close();
|
|
463
|
-
}
|
|
464
|
-
handleKeyDown(e) {
|
|
468
|
+
};
|
|
469
|
+
handleKeyDown = (e) => {
|
|
465
470
|
if (e.key === "Escape") {
|
|
466
471
|
if (this.getState("isOpen")) {
|
|
467
472
|
e.preventDefault();
|
|
468
|
-
this.
|
|
473
|
+
this.adapter.focusTrigger();
|
|
469
474
|
this.close();
|
|
470
475
|
}
|
|
471
476
|
}
|
|
472
|
-
}
|
|
473
|
-
onClickSingleTriggerSearchItem() {
|
|
477
|
+
};
|
|
478
|
+
onClickSingleTriggerSearchItem = () => {
|
|
474
479
|
this.#focusInput();
|
|
475
|
-
}
|
|
476
|
-
close() {
|
|
477
|
-
this.
|
|
478
|
-
this.
|
|
479
|
-
if (this.getProp("motionExpand")) this.
|
|
480
|
-
}
|
|
481
|
-
handleClick(e) {
|
|
480
|
+
};
|
|
481
|
+
close = () => {
|
|
482
|
+
this.adapter.closeMenu();
|
|
483
|
+
this.adapter.notifyVisibleChange(false);
|
|
484
|
+
if (this.getProp("motionExpand")) this.adapter.updateState({ motionKeys: /* @__PURE__ */ new Set([]) });
|
|
485
|
+
};
|
|
486
|
+
handleClick = (e) => {
|
|
482
487
|
const isDisabled = this.#isDisabled();
|
|
483
488
|
const { isOpen, inputValue, isFocus } = this.getStates();
|
|
484
489
|
const { searchPosition, clickTriggerToHide } = this.getProps();
|
|
@@ -491,27 +496,27 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
491
496
|
if (clickTriggerToHide) this.close();
|
|
492
497
|
} else this.#open();
|
|
493
498
|
}
|
|
494
|
-
}
|
|
499
|
+
};
|
|
495
500
|
/**
|
|
496
501
|
* Enter toggles the popup like a click; Down and Up open a closed one (APG combobox). Outside a text field (the
|
|
497
502
|
* select-only combobox) Space toggles it like Enter, and Home and End open a closed one: the view moves to the
|
|
498
503
|
* first or the last row, which lives in the view.
|
|
499
504
|
*/
|
|
500
|
-
handleSelectionKeyDown(e) {
|
|
505
|
+
handleSelectionKeyDown = (e) => {
|
|
501
506
|
const editing = isTextEditor(e.target);
|
|
502
507
|
if (!this.getState("isOpen") && (e.key === "ArrowDown" || e.key === "ArrowUp" || !editing && (e.key === "Home" || e.key === "End")) || isEnterPress(e) || e.key === " " && !editing) {
|
|
503
508
|
e.preventDefault();
|
|
504
509
|
this.handleClick(e);
|
|
505
510
|
}
|
|
506
|
-
}
|
|
507
|
-
handleClear(e) {
|
|
511
|
+
};
|
|
512
|
+
handleClear = (e) => {
|
|
508
513
|
const { searchPosition, filterTreeNode } = this.getProps();
|
|
509
514
|
const { inputValue, selectedKeys } = this.getStates();
|
|
510
|
-
const isControlled = this.
|
|
515
|
+
const isControlled = this.isControlledComponent();
|
|
511
516
|
const value = this.#isMultiple() ? [] : void 0;
|
|
512
517
|
const hasValue = TreeSelectFoundation.hasValue(this.getProps(), this.getStates());
|
|
513
518
|
if (hasValue) this.#notifyChange(value, e);
|
|
514
|
-
if (hasValue && !isControlled) this.
|
|
519
|
+
if (hasValue && !isControlled) this.adapter.updateState({
|
|
515
520
|
selectedKeys: [],
|
|
516
521
|
checkedKeys: /* @__PURE__ */ new Set(),
|
|
517
522
|
halfCheckedKeys: /* @__PURE__ */ new Set(),
|
|
@@ -523,9 +528,9 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
523
528
|
else this.#clearInput();
|
|
524
529
|
}
|
|
525
530
|
}
|
|
526
|
-
this.
|
|
527
|
-
}
|
|
528
|
-
removeTag(eventKey) {
|
|
531
|
+
this.adapter.notifyClear(e);
|
|
532
|
+
};
|
|
533
|
+
removeTag = (eventKey) => {
|
|
529
534
|
const props = this.getProps();
|
|
530
535
|
const { disableStrictly, checkRelation, keyMaps } = props;
|
|
531
536
|
const state = this.getStates();
|
|
@@ -536,23 +541,23 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
536
541
|
const newRealCheckedKeys = new Set(realCheckedKeys);
|
|
537
542
|
newRealCheckedKeys.delete(eventKey);
|
|
538
543
|
this.#notifyChange([...newRealCheckedKeys], null);
|
|
539
|
-
if (!this.
|
|
544
|
+
if (!this.isControlledComponent()) this.adapter.updateState({ realCheckedKeys: newRealCheckedKeys });
|
|
540
545
|
} else if (checkRelation === "related") {
|
|
541
546
|
const { checkedKeys, halfCheckedKeys } = calcRelatedCheckedKeys(eventKey, false, disableStrictly, state);
|
|
542
547
|
this.#notifyChange([...checkedKeys], null);
|
|
543
|
-
if (!this.
|
|
548
|
+
if (!this.isControlledComponent()) this.adapter.updateState({
|
|
544
549
|
checkedKeys,
|
|
545
550
|
halfCheckedKeys
|
|
546
551
|
});
|
|
547
552
|
}
|
|
548
|
-
this.
|
|
549
|
-
}
|
|
550
|
-
handleNodeSelect(e, treeNode) {
|
|
553
|
+
this.adapter.notifySelect(eventKey, false, item);
|
|
554
|
+
};
|
|
555
|
+
handleNodeSelect = (e, treeNode) => {
|
|
551
556
|
if (this.#isDisabled(treeNode)) return;
|
|
552
557
|
if (!this.#isMultiple()) this.#handleSingleSelect(e, treeNode);
|
|
553
558
|
else this.#handleMultipleSelect(e, treeNode);
|
|
554
|
-
}
|
|
555
|
-
handleNodeExpand(e, treeNode) {
|
|
559
|
+
};
|
|
560
|
+
handleNodeExpand = (e, treeNode) => {
|
|
556
561
|
const { loadData, keyMaps } = this.getProps();
|
|
557
562
|
const { inputValue, keyEntities } = this.getStates();
|
|
558
563
|
const isSearching = Boolean(inputValue);
|
|
@@ -571,7 +576,7 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
571
576
|
expandedKeys.delete(eventKey);
|
|
572
577
|
motionType = "hide";
|
|
573
578
|
}
|
|
574
|
-
this.
|
|
579
|
+
this.adapter.setCachedFlattenNodes(motionType === "hide" && this.#isAnimated() ? this.getState("flattenNodes") : void 0);
|
|
575
580
|
if (!isExpandControlled) {
|
|
576
581
|
const flattenNodes = flattenTreeData(treeData, expandedKeys, keyMaps);
|
|
577
582
|
const motionKeys = this.#isAnimated() ? getMotionKeys(eventKey, expandedKeys, keyEntities) : [];
|
|
@@ -581,30 +586,30 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
|
|
|
581
586
|
motionKeys: new Set(motionKeys),
|
|
582
587
|
motionType
|
|
583
588
|
};
|
|
584
|
-
this.
|
|
589
|
+
this.adapter.updateState(newState);
|
|
585
590
|
}
|
|
586
|
-
this.
|
|
591
|
+
this.adapter.notifyExpand(expandedKeys, {
|
|
587
592
|
expanded: !expanded,
|
|
588
593
|
node: data
|
|
589
594
|
});
|
|
590
595
|
if (!expanded) this.#handleNodeLoad(eventKey, data);
|
|
591
|
-
}
|
|
592
|
-
handleInputTriggerBlur(e) {
|
|
593
|
-
if (this.
|
|
594
|
-
this.
|
|
595
|
-
}
|
|
596
|
-
handleInputTriggerFocus(e) {
|
|
597
|
-
if (this.
|
|
596
|
+
};
|
|
597
|
+
handleInputTriggerBlur = (e) => {
|
|
598
|
+
if (this.adapter.isInTrigger(e?.relatedTarget)) return;
|
|
599
|
+
this.adapter.updateState({ inputTriggerFocus: false });
|
|
600
|
+
};
|
|
601
|
+
handleInputTriggerFocus = (e) => {
|
|
602
|
+
if (this.adapter.isInTrigger(e?.relatedTarget)) return;
|
|
598
603
|
this.#clearInput();
|
|
599
|
-
this.
|
|
600
|
-
}
|
|
601
|
-
handlePopoverOpen() {
|
|
604
|
+
this.adapter.updateState({ inputTriggerFocus: true });
|
|
605
|
+
};
|
|
606
|
+
handlePopoverOpen = () => {
|
|
602
607
|
const { filterTreeNode, searchAutoFocus, searchPosition } = this.getProps();
|
|
603
608
|
if (filterTreeNode && searchPosition === strings.SEARCH_POSITION_DROPDOWN && searchAutoFocus) this.#focusInput();
|
|
604
|
-
}
|
|
605
|
-
handleAfterClose() {
|
|
609
|
+
};
|
|
610
|
+
handleAfterClose = () => {
|
|
606
611
|
const { filterTreeNode } = this.getProps();
|
|
607
612
|
if (filterTreeNode) this.#clearInput();
|
|
608
|
-
}
|
|
613
|
+
};
|
|
609
614
|
};
|
|
610
615
|
export { TreeSelectFoundation as default, treeSelectDerivedPropKeys };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** `showTooltip` carries each framework's own tooltip config */
|
|
2
2
|
export interface EllipsisConfig<Tooltip> {
|
|
3
3
|
collapseText?: string;
|
|
4
4
|
collapsible?: boolean;
|
|
@@ -11,7 +11,6 @@ export interface EllipsisConfig<Tooltip> {
|
|
|
11
11
|
}
|
|
12
12
|
/** An unset field, or one explicitly undefined, takes the default; the expand and collapse texts default only when their button is enabled */
|
|
13
13
|
export declare function getEllipsisOpt<Tooltip>(ellipsis: EllipsisConfig<Tooltip> | boolean, expandStr: string, collapseStr: string): Required<Omit<EllipsisConfig<Tooltip>, 'expandText' | 'collapseText'>> & Pick<EllipsisConfig<Tooltip>, 'expandText' | 'collapseText'>;
|
|
14
|
-
/** Whether CSS can truncate the text; every other option needs the measured JS truncation */
|
|
15
14
|
export declare function canUseCSSEllipsis({ expandable, expandText, pos, suffix }: Pick<EllipsisConfig<unknown>, 'expandable' | 'expandText' | 'pos' | 'suffix'>, copyable: unknown): boolean;
|
|
16
15
|
/** Whether `node` is, or holds, a focusable item; the copy button is not the tab stop, so it does not count */
|
|
17
16
|
export declare function isInsideWidgetItem(node: HTMLElement, copy?: Node | null): boolean;
|
|
@@ -20,7 +19,6 @@ export declare function getRenderText(originEle: HTMLElement, rows: number, cont
|
|
|
20
19
|
expand: Node | null;
|
|
21
20
|
copy: Node | null;
|
|
22
21
|
}, suffix: string, ellipsisPos: string, isStrong: boolean): string;
|
|
23
|
-
/** Whether the text overflows: in width for a single row, in height for several rows */
|
|
24
22
|
export declare function isOverflowing(node: HTMLElement, rows: number): boolean;
|
|
25
23
|
/**
|
|
26
24
|
* The pending measurement frame, and the gate for ResizeObserver reports. The observer reports every newly
|
|
@@ -29,8 +27,8 @@ export declare function isOverflowing(node: HTMLElement, rows: number): boolean;
|
|
|
29
27
|
*/
|
|
30
28
|
export declare class EllipsisRuntime {
|
|
31
29
|
#private;
|
|
32
|
-
connect(measure: () => void)
|
|
33
|
-
disconnect()
|
|
34
|
-
schedule()
|
|
35
|
-
handleResize()
|
|
30
|
+
connect: (measure: () => void) => void;
|
|
31
|
+
disconnect: () => void;
|
|
32
|
+
schedule: () => void;
|
|
33
|
+
handleResize: () => void;
|
|
36
34
|
}
|
|
@@ -16,7 +16,6 @@ function getEllipsisOpt(ellipsis, expandStr, collapseStr) {
|
|
|
16
16
|
collapseText: config.collapseText ?? (config.collapsible ? collapseStr : void 0)
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
/** Whether CSS can truncate the text; every other option needs the measured JS truncation */
|
|
20
19
|
function canUseCSSEllipsis({ expandable, expandText, pos, suffix }, copyable) {
|
|
21
20
|
return !expandable && expandText === void 0 && !copyable && pos === "end" && !suffix;
|
|
22
21
|
}
|
|
@@ -115,7 +114,6 @@ function isSingleRowOverflowing(containerNode) {
|
|
|
115
114
|
return acc + range.getBoundingClientRect().width;
|
|
116
115
|
}, 0) > contentAreaWidth;
|
|
117
116
|
}
|
|
118
|
-
/** Whether the text overflows: in width for a single row, in height for several rows */
|
|
119
117
|
function isOverflowing(node, rows) {
|
|
120
118
|
if (!rows || rows < 1) return false;
|
|
121
119
|
return rows <= 1 ? isSingleRowOverflowing(node) : node.scrollHeight > node.offsetHeight;
|
|
@@ -131,26 +129,26 @@ var EllipsisRuntime = class {
|
|
|
131
129
|
#gateTimer;
|
|
132
130
|
#observing = false;
|
|
133
131
|
#measure = () => void 0;
|
|
134
|
-
connect(measure) {
|
|
132
|
+
connect = (measure) => {
|
|
135
133
|
this.#measure = measure;
|
|
136
134
|
this.#gateFrame = requestAnimationFrame(() => {
|
|
137
135
|
this.#gateTimer = setTimeout(() => {
|
|
138
136
|
this.#observing = true;
|
|
139
137
|
});
|
|
140
138
|
});
|
|
141
|
-
}
|
|
142
|
-
disconnect() {
|
|
139
|
+
};
|
|
140
|
+
disconnect = () => {
|
|
143
141
|
cancelAnimationFrame(this.#frame);
|
|
144
142
|
cancelAnimationFrame(this.#gateFrame);
|
|
145
143
|
clearTimeout(this.#gateTimer);
|
|
146
144
|
this.#observing = false;
|
|
147
|
-
}
|
|
148
|
-
schedule() {
|
|
145
|
+
};
|
|
146
|
+
schedule = () => {
|
|
149
147
|
cancelAnimationFrame(this.#frame);
|
|
150
148
|
this.#frame = requestAnimationFrame(() => this.#measure());
|
|
151
|
-
}
|
|
152
|
-
handleResize() {
|
|
149
|
+
};
|
|
150
|
+
handleResize = () => {
|
|
153
151
|
if (this.#observing) this.schedule();
|
|
154
|
-
}
|
|
152
|
+
};
|
|
155
153
|
};
|
|
156
154
|
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: ("picture" | "list" | "none")[];
|
|
15
15
|
DRAG_AREA_DEFAULT: string;
|
|
16
16
|
DRAG_AREA_LEGAL: string;
|
|
17
17
|
TRIGGER_AUTO: "auto";
|
|
@@ -132,17 +132,13 @@ export interface UploadBaseState {
|
|
|
132
132
|
/** The uid of the item a pending replace will overwrite; the list may change while the user picks the file */
|
|
133
133
|
replaceUid: string;
|
|
134
134
|
cropperVisible: boolean;
|
|
135
|
-
/** The image file currently being cropped */
|
|
136
135
|
cropperFile: File | null;
|
|
137
|
-
/** Object URL for the image currently being cropped */
|
|
138
136
|
cropperSrc: string;
|
|
139
|
-
/** Remaining image files queued for cropping (cropped one at a time) */
|
|
140
137
|
pendingImageFiles: File[];
|
|
141
138
|
/** Non-image files that bypass cropping but are uploaded together */
|
|
142
139
|
nonImageFiles: File[];
|
|
143
140
|
/** Image files already cropped, accumulated until the queue drains */
|
|
144
141
|
croppedFiles: File[];
|
|
145
|
-
/** The round was started by a replace, so the result replaces one item */
|
|
146
142
|
isReplaceOperation: boolean;
|
|
147
143
|
}
|
|
148
144
|
export default class UploadFoundation<P extends UploadBaseProps = UploadBaseProps, S extends UploadBaseState = UploadBaseState, E extends UploadDragEvent = UploadDragEvent> extends BaseFoundation<UploadAdapter<P, S, E>, P, S> {
|
|
@@ -158,30 +154,28 @@ export default class UploadFoundation<P extends UploadBaseProps = UploadBaseProp
|
|
|
158
154
|
protected buildFileItem(fileInstance: CustomFile, uploadTrigger: string): BaseFileItem;
|
|
159
155
|
protected checkFileFormat(accept: string, file: File): boolean;
|
|
160
156
|
/** Closes the cropper and drops the queue; the files already cropped are discarded */
|
|
161
|
-
cancelCrop()
|
|
162
|
-
|
|
163
|
-
confirmCrop(): Promise<void>;
|
|
157
|
+
cancelCrop: () => void;
|
|
158
|
+
confirmCrop: () => Promise<void>;
|
|
164
159
|
/** Keep the synchronous snapshot aligned with an externally controlled fileList. */
|
|
165
|
-
syncLatestFileList(fileList: Array<BaseFileItem>)
|
|
160
|
+
syncLatestFileList: (fileList: Array<BaseFileItem>) => void;
|
|
166
161
|
/** A fileList prop that goes back to undefined clears the list (a form reset) and leaves it uncontrolled */
|
|
167
|
-
handleFileListPropChange(fileList?: Array<BaseFileItem>)
|
|
168
|
-
/** The list on screen: the fileList prop when controlled, otherwise the fileList state. */
|
|
162
|
+
handleFileListPropChange: (fileList?: Array<BaseFileItem>) => void;
|
|
169
163
|
getFileList(): BaseFileItem[];
|
|
170
164
|
init(): void;
|
|
171
165
|
/** Adds the files of a paste on the page; the host listens only while addOnPasting is on and not disabled */
|
|
172
|
-
handlePasting(e: ClipboardEvent)
|
|
166
|
+
handlePasting: (e: ClipboardEvent) => void;
|
|
173
167
|
/** Entry for picked, dropped and pasted files: with crop on, images are cropped before they are added */
|
|
174
|
-
addFiles(currentFileList: FileList | Array<File>)
|
|
168
|
+
addFiles: (currentFileList: FileList | Array<File>) => void;
|
|
175
169
|
/** 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)
|
|
170
|
+
handleReplaceChange: (currentFileList: FileList | Array<File>) => void;
|
|
171
|
+
insertFileToList: (files: Array<CustomFile>, index?: number) => void;
|
|
172
|
+
manualUpload: () => void;
|
|
173
|
+
handleRemove: (file: BaseFileItem) => void;
|
|
174
|
+
handleClear: () => void;
|
|
175
|
+
handleDragEnter: (e: UploadDragEvent) => void;
|
|
176
|
+
handleDrop: (e: E) => void;
|
|
177
|
+
handleDragOver: (e: UploadDragEvent) => void;
|
|
178
|
+
handleDragLeave: (e: UploadDragEvent) => void;
|
|
179
|
+
retry: (fileItem: BaseFileItem) => void;
|
|
180
|
+
handlePreviewClick: (fileItem: BaseFileItem) => void;
|
|
187
181
|
}
|