@opentiny/vue-renderless 3.12.1 → 3.13.0-alpha.1
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/action-sheet/index.js +20 -13
- package/action-sheet/vue.js +8 -7
- package/alert/index.js +50 -1
- package/alert/vue.js +36 -9
- package/amount/index.js +100 -25
- package/amount/vue.js +102 -26
- package/anchor/index.js +1 -0
- package/area/index.js +8 -8
- package/area/vue.js +5 -5
- package/async-flowchart/index.js +16 -3
- package/autocomplete/index.js +58 -14
- package/autocomplete/vue.js +40 -12
- package/badge/index.js +12 -0
- package/badge/vue.js +6 -4
- package/breadcrumb/vue.js +3 -1
- package/breadcrumb-item/vue.js +6 -2
- package/button/index.js +5 -1
- package/calendar/index.js +2 -86
- package/calendar-bar/index.js +20 -6
- package/calendar-view/index.js +10 -12
- package/calendar-view/vue.js +17 -4
- package/cascader/index.js +80 -34
- package/cascader/vue.js +49 -19
- package/cascader-menu/index.js +7 -7
- package/cascader-menu/vue.js +2 -3
- package/cascader-mobile/index.js +37 -24
- package/cascader-mobile/vue.js +7 -1
- package/cascader-node/index.js +13 -1
- package/cascader-node/vue.js +15 -4
- package/cascader-panel/index.js +1 -1
- package/cascader-select/column-index.js +150 -0
- package/cascader-select/column.js +120 -0
- package/cascader-select/index.js +29 -165
- package/cascader-select/usePicker.js +251 -0
- package/cascader-select/useTouch.js +65 -0
- package/cascader-select/vue.js +35 -47
- package/cascader-view/index.js +1 -1
- package/cell/vue.js +2 -1
- package/chart-bar/index.js +2 -3
- package/chart-core/deps/constants.js +43 -43
- package/chart-core/index.js +1 -1
- package/chart-gauge/index.js +2 -2
- package/chart-heatmap/index.js +17 -10
- package/chart-line/index.js +8 -9
- package/chart-tree/index.js +2 -2
- package/chart-waterfall/index.js +4 -6
- package/checkbox/index.js +17 -0
- package/checkbox/vue.js +16 -7
- package/checkbox-group/vue.js +2 -0
- package/col/vue.js +3 -2
- package/collapse/index.js +3 -3
- package/color-select-panel/vue.js +0 -7
- package/column-list-item/index.js +17 -1
- package/column-list-item/vue.js +8 -3
- package/common/date.js +2 -0
- package/common/deps/dom.js +19 -4
- package/common/deps/popper.js +48 -5
- package/common/deps/touch-emulator.js +4 -1
- package/common/deps/tree-model/node.js +1 -1
- package/common/deps/tree-model/tree-store.js +2 -13
- package/common/deps/useRect.js +25 -0
- package/common/deps/vue-popper.js +22 -10
- package/common/index.js +1 -1
- package/common/runtime.js +1 -1
- package/common/type.js +2 -1
- package/common/validate/rules/enum.js +1 -1
- package/common/validate/rules/pattern.js +2 -2
- package/common/validate/rules/range.js +8 -5
- package/common/validate/rules/required.js +1 -1
- package/common/validate/rules/type.js +5 -5
- package/common/validate/rules/whitespace.js +1 -1
- package/common/validate/util.js +15 -16
- package/common/validate/validations/integer.js +1 -1
- package/common/validate/validations/method.js +1 -1
- package/container/index.js +17 -1
- package/container/vue.js +12 -3
- package/currency/index.js +74 -7
- package/currency/vue.js +21 -5
- package/date-panel/index.js +16 -0
- package/date-panel/vue.js +8 -2
- package/date-picker-mobile/index.js +12 -0
- package/date-picker-mobile/vue.js +7 -1
- package/date-range/vue.js +12 -5
- package/date-table/index.js +5 -0
- package/date-table/vue.js +3 -1
- package/dialog-box/index.js +17 -6
- package/dialog-select/index.js +6 -3
- package/dialog-select/vue.js +8 -4
- package/drawer/index.js +26 -5
- package/drawer/vue.js +13 -7
- package/dropdown/index.js +7 -7
- package/dropdown/vue.js +6 -2
- package/dropdown-item/index.js +9 -1
- package/dropdown-item/mf.js +6 -10
- package/dropdown-item/vue.js +21 -8
- package/dropdown-menu/index.js +20 -7
- package/dropdown-menu/vue.js +4 -3
- package/exception/index.js +2 -7
- package/exception/vue.js +7 -10
- package/fall-menu/index.js +5 -1
- package/fall-menu/vue.js +13 -2
- package/file-upload/index.js +47 -12
- package/file-upload/vue.js +38 -8
- package/filter-box/index.js +1 -0
- package/floating-button/index.js +62 -16
- package/floating-button/vue.js +27 -9
- package/flowchart/index.js +134 -25
- package/flowchart/node.js +13 -4
- package/flowchart/vue.js +16 -4
- package/form/vue.js +3 -1
- package/form-item/index.js +4 -4
- package/form-item/vue.js +3 -1
- package/fullscreen/index.js +5 -5
- package/fullscreen/vue.js +3 -3
- package/grid/utils/common.js +10 -5
- package/grid/utils/dom.js +7 -1
- package/image/index.js +6 -0
- package/image/vue.js +6 -3
- package/image-viewer/index.js +62 -51
- package/image-viewer/vue.js +17 -5
- package/input/index.js +89 -22
- package/input/vue.js +52 -21
- package/ip-address/index.js +61 -19
- package/ip-address/vue.js +22 -4
- package/label/index.js +56 -0
- package/label/vue.js +26 -0
- package/link/vue.js +3 -1
- package/loading/vue.js +8 -2
- package/logout/index.js +1 -1
- package/mask/index.js +13 -0
- package/mask/vue.js +18 -0
- package/mind-map/index.js +47 -0
- package/mind-map/vue.js +53 -0
- package/multi-select/index.js +150 -10
- package/multi-select/vue.js +46 -11
- package/multi-select-item/index.js +17 -0
- package/multi-select-item/vue.js +31 -0
- package/numeric/index.js +51 -9
- package/numeric/vue.js +44 -14
- package/option/index.js +12 -5
- package/option/vue.js +15 -7
- package/option-group/index.js +3 -3
- package/package.json +1 -1
- package/pager/index.js +372 -0
- package/pager/vue.js +125 -2
- package/picker/index.js +253 -48
- package/picker/mb.js +42 -0
- package/picker/vue.js +70 -17
- package/picker-column/index.js +1 -1
- package/pop-upload/index.js +0 -2
- package/pop-upload/vue.js +3 -4
- package/popconfirm/index.js +3 -6
- package/popconfirm/vue.js +1 -1
- package/popeditor/index.js +55 -24
- package/popeditor/vue.js +15 -11
- package/popover/index.js +4 -4
- package/popover/vue.js +6 -6
- package/popup/index.js +3 -3
- package/popup/vue.js +5 -5
- package/pull-refresh/index.js +57 -65
- package/pull-refresh/vue.js +23 -7
- package/radio/index.js +0 -17
- package/radio/vue.js +4 -10
- package/rate/index.js +1 -1
- package/rate/vue.js +0 -2
- package/record/index.js +4 -1
- package/{rich-text-edtior → rich-text-editor}/index.js +2 -2
- package/{rich-text-edtior → rich-text-editor}/vue.js +2 -5
- package/scrollbar/index.js +11 -11
- package/scrollbar/vue-bar.js +3 -3
- package/scrollbar/vue.js +5 -5
- package/search/index.js +1 -1
- package/search/vue.js +3 -1
- package/select/index.js +176 -110
- package/select/vue.js +105 -20
- package/select-dropdown/index.js +62 -4
- package/select-dropdown/vue.js +85 -8
- package/select-view/index.js +3 -1
- package/signature/index.js +241 -0
- package/signature/vue.js +88 -0
- package/skeleton/index.js +14 -0
- package/skeleton/vue.js +15 -0
- package/skeleton-item/vue.js +15 -0
- package/slider/index.js +27 -7
- package/slider/vue.js +26 -7
- package/split/index.js +1 -1
- package/split/vue.js +4 -6
- package/standard-list-item/index.js +15 -1
- package/standard-list-item/vue.js +6 -5
- package/steps/index.js +25 -2
- package/steps/slide-bar.js +8 -1
- package/steps/vue.js +15 -3
- package/tab-item-mf/vue.js +14 -8
- package/tab-nav/index.js +9 -4
- package/tab-nav/vue.js +6 -2
- package/tabbar/vue.js +9 -3
- package/tabbar-item/vue.js +3 -2
- package/tabs/index.js +1 -1
- package/tabs/vue.js +1 -0
- package/tabs-mf/index.js +20 -6
- package/tabs-mf/vue-nav.js +26 -11
- package/tabs-mf/vue.js +7 -7
- package/tag/index.js +1 -1
- package/tag/vue.js +5 -1
- package/tag-group/index.js +2 -1
- package/tall-storage/index.js +4 -5
- package/time/index.js +4 -1
- package/time/vue.js +1 -1
- package/time-line/vue.js +1 -1
- package/time-picker-mobile/index.js +24 -5
- package/time-picker-mobile/vue.js +17 -7
- package/time-range/index.js +2 -0
- package/time-spinner/index.js +0 -3
- package/time-spinner/vue.js +2 -3
- package/timeline-item/vue.js +1 -1
- package/tooltip/index.js +1 -2
- package/tooltip/vue.js +3 -3
- package/transfer/index.js +20 -22
- package/transfer/vue.js +1 -6
- package/transfer-panel/vue.js +3 -5
- package/tree/index.js +21 -4
- package/tree/vue.js +10 -8
- package/tree-menu/index.js +27 -3
- package/tree-menu/vue.js +27 -14
- package/tree-node/index.js +12 -10
- package/tree-node/vue.js +6 -5
- package/types/action-menu.type.d.ts +5 -0
- package/types/action-sheet.type.d.ts +118 -1
- package/types/alert.type.d.ts +16 -1
- package/types/amount.type.d.ts +168 -1
- package/types/area.type.d.ts +134 -1
- package/types/async-flowchart.type.d.ts +72 -0
- package/types/autocomplete.type.d.ts +199 -1
- package/types/badge.type.d.ts +3 -1
- package/types/breadcrumb-item.type.d.ts +2 -0
- package/types/breadcrumb.type.d.ts +2 -0
- package/types/button.type.d.ts +5 -0
- package/types/cascader-menu.type.d.ts +3 -4
- package/types/cascader-node.type.d.ts +5 -2
- package/types/cascader-panel.type-2bd03be3.d.ts +241 -0
- package/types/cascader-panel.type.d.ts +3 -241
- package/types/cascader.type.d.ts +327 -1
- package/types/checkbox.type.d.ts +9 -0
- package/types/collapse.type.d.ts +19 -2
- package/types/date-picker.type.d.ts +34 -1
- package/types/dialog-box.type.d.ts +5 -1
- package/types/drawer.type.d.ts +132 -1
- package/types/{dropdown-item.type-bf83e929.d.ts → dropdown-item.type-8475a549.d.ts} +8 -14
- package/types/dropdown-item.type.d.ts +1 -1
- package/types/dropdown-menu.type.d.ts +1 -1
- package/types/dropdown.type.d.ts +2 -5
- package/types/fall-menu.type.d.ts +94 -1
- package/types/file-upload.type.d.ts +1 -1
- package/types/form-item.type.d.ts +1 -1
- package/types/{form.type-d0fd42f3.d.ts → form.type-d88482e4.d.ts} +3 -0
- package/types/form.type.d.ts +1 -1
- package/types/input.type.d.ts +23 -9
- package/types/ip-address.type.d.ts +160 -1
- package/types/label.type.d.ts +81 -0
- package/types/link.type.d.ts +6 -3
- package/types/mind-map.type.d.ts +20 -0
- package/types/modal.type.d.ts +4 -2
- package/types/numeric.type.d.ts +36 -9
- package/types/pager.type.d.ts +171 -1
- package/types/picker.type.d.ts +14 -0
- package/types/popconfirm.type.d.ts +85 -1
- package/types/popeditor.type.d.ts +4 -0
- package/types/popover.type.d.ts +3 -3
- package/types/radio.type.d.ts +0 -4
- package/types/rate.type.d.ts +236 -1
- package/types/search.type.d.ts +88 -1
- package/types/shared.type.d.ts +1 -1
- package/types/skeleton-item.type.d.ts +38 -0
- package/types/skeleton.type.d.ts +45 -0
- package/types/slider.type.d.ts +8 -1
- package/types/steps.type.d.ts +14 -3
- package/types/tab-item.type.d.ts +0 -1
- package/types/tab-nav.type.d.ts +6 -1
- package/types/tabs.type.d.ts +5 -0
- package/types/tag-group.type.d.ts +64 -1
- package/types/tag.type.d.ts +12 -0
- package/types/tooltip.type.d.ts +1 -1
- package/types/transfer.type.d.ts +183 -1
- package/types/tree-menu.type.d.ts +210 -1
- package/types/upload-dragger.type.d.ts +1 -1
- package/types/{upload-list.type-343e8c11.d.ts → upload-list.type-1078fba2.d.ts} +27 -6
- package/types/upload-list.type.d.ts +1 -1
- package/types/upload.type.d.ts +1 -1
- package/types/wizard.type.d.ts +1 -0
- package/upload/index.js +59 -29
- package/upload/vue.js +6 -4
- package/upload-list/index.js +14 -14
- package/upload-list/vue.js +5 -2
- package/user/index.js +5 -4
- package/user-head/index.js +1 -1
- package/wheel/index.js +3 -0
- package/wizard/vue.js +4 -2
package/select/index.js
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
} from "../chunk-G2ADBYYC.js";
|
|
5
5
|
import { find } from "../common/array";
|
|
6
6
|
import { getObj, isEqual } from "../common/object";
|
|
7
|
-
import { hasClass } from "../common/deps/dom";
|
|
8
7
|
import { isKorean } from "../common/string";
|
|
9
8
|
import scrollIntoView from "../common/deps/scroll-into-view";
|
|
10
9
|
import PopupManager from "../common/deps/popup-manager";
|
|
@@ -17,6 +16,7 @@ import { extend } from "../common/object";
|
|
|
17
16
|
import { BROWSER_NAME } from "../common";
|
|
18
17
|
import browserInfo from "../common/browser";
|
|
19
18
|
import { fastdom } from "../common/deps/fastdom";
|
|
19
|
+
import { deepClone } from "../picker-column";
|
|
20
20
|
const handleComposition = ({ api, nextTick, state }) => (event) => {
|
|
21
21
|
const text = event.target.value;
|
|
22
22
|
if (event.type === "compositionend") {
|
|
@@ -69,7 +69,7 @@ const gridOnQueryChange = ({ props, vm, constants, state }) => (value) => {
|
|
|
69
69
|
state.remoteData = data.filter((row) => !~selectedIds.indexOf(row[valueField])).concat(state.selected);
|
|
70
70
|
} else {
|
|
71
71
|
vm.$refs.selectGrid.clearRadioRow();
|
|
72
|
-
vm.$refs.selectGrid.setRadioRow(find(data, (item) => props.modelValue
|
|
72
|
+
vm.$refs.selectGrid.setRadioRow(find(data, (item) => props.modelValue === item[props.valueField]));
|
|
73
73
|
state.remoteData = data;
|
|
74
74
|
}
|
|
75
75
|
vm.$refs.selectGrid.$refs.tinyTable.lastScrollTop = 0;
|
|
@@ -86,7 +86,6 @@ const defaultOnQueryChange = ({ props, state, constants, api }) => (value) => {
|
|
|
86
86
|
props.filterMethod(value);
|
|
87
87
|
state.selectEmitter.emit(constants.COMPONENT_NAME.OptionGroup, constants.EVENT_NAME.queryChange);
|
|
88
88
|
} else {
|
|
89
|
-
state.filteredOptionsCount = state.optionsCount;
|
|
90
89
|
state.selectEmitter.emit(constants.EVENT_NAME.queryChange, value);
|
|
91
90
|
}
|
|
92
91
|
if (props.defaultFirstOption && (props.filterable || props.remote) && state.filteredOptionsCount) {
|
|
@@ -111,6 +110,7 @@ const handleQueryChange = ({ api, constants, nextTick, props, vm, state }) => (v
|
|
|
111
110
|
vm.$refs.selectTree && vm.$refs.selectTree.filter(value);
|
|
112
111
|
}
|
|
113
112
|
}
|
|
113
|
+
state.query = value;
|
|
114
114
|
state.previousQuery = value;
|
|
115
115
|
window.requestAnimationFrame(() => {
|
|
116
116
|
if (state.visible) {
|
|
@@ -132,20 +132,28 @@ const handleQueryChange = ({ api, constants, nextTick, props, vm, state }) => (v
|
|
|
132
132
|
if (props.renderType === constants.TYPE.Tree) {
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
135
|
+
state.triggerSearch = true;
|
|
135
136
|
api.defaultOnQueryChange(value);
|
|
136
137
|
};
|
|
138
|
+
const resetFilter = ({ state, api }) => () => {
|
|
139
|
+
state.query = "";
|
|
140
|
+
state.previousQuery = void 0;
|
|
141
|
+
api.handleQueryChange(state.query);
|
|
142
|
+
};
|
|
137
143
|
const scrollToOption = ({ vm, constants }) => (option) => {
|
|
138
|
-
const target = Array.isArray(option) && option[0] ? option[0].el : option.el;
|
|
144
|
+
const target = Array.isArray(option) && option[0] && option[0].state ? option[0].state.el : option.state ? option.state.el : "";
|
|
139
145
|
if (vm.$refs.popper && target) {
|
|
140
146
|
const menu = vm.$refs.popper.$el.querySelector(constants.CLASS.SelectDropdownWrap);
|
|
141
|
-
scrollIntoView(menu, target);
|
|
147
|
+
setTimeout(() => scrollIntoView(menu, target));
|
|
142
148
|
}
|
|
143
149
|
vm.$refs.scrollbar && vm.$refs.scrollbar.handleScroll();
|
|
144
150
|
};
|
|
145
151
|
const handleMenuEnter = ({ api, nextTick, state }) => () => {
|
|
146
152
|
nextTick(() => api.scrollToOption(state.selected));
|
|
147
153
|
};
|
|
148
|
-
const emitChange = ({ emit, props, state, constants }) => (value) => {
|
|
154
|
+
const emitChange = ({ emit, props, state, constants }) => (value, changed) => {
|
|
155
|
+
if (state.device === "mb" && props.multiple && !changed)
|
|
156
|
+
return;
|
|
149
157
|
const seekItem = (val, arr, items, flag) => {
|
|
150
158
|
if (constants.TYPE.Tree === flag) {
|
|
151
159
|
const recurNode = (node) => {
|
|
@@ -162,7 +170,7 @@ const emitChange = ({ emit, props, state, constants }) => (value) => {
|
|
|
162
170
|
}
|
|
163
171
|
}
|
|
164
172
|
};
|
|
165
|
-
if (!isEqual(props.modelValue,
|
|
173
|
+
if (!isEqual(props.modelValue, state.compareValue)) {
|
|
166
174
|
if (props.renderType === constants.TYPE.Grid && props.multiple) {
|
|
167
175
|
value = value || [];
|
|
168
176
|
const gridData = state.gridData || [];
|
|
@@ -184,6 +192,11 @@ const emitChange = ({ emit, props, state, constants }) => (value) => {
|
|
|
184
192
|
}
|
|
185
193
|
}
|
|
186
194
|
};
|
|
195
|
+
const directEmitChange = ({ emit, props, state }) => (value, key) => {
|
|
196
|
+
if (state.device === "mb" && props.multiple)
|
|
197
|
+
return;
|
|
198
|
+
emit("change", value, key);
|
|
199
|
+
};
|
|
187
200
|
const clearNoMatchValue = ({ props, emit }) => (newModelValue) => {
|
|
188
201
|
if (!props.clearNoMatchValue) {
|
|
189
202
|
return;
|
|
@@ -241,11 +254,11 @@ const getOptionOfSetSelected = ({ api, props }) => {
|
|
|
241
254
|
}
|
|
242
255
|
return option;
|
|
243
256
|
};
|
|
244
|
-
const getResultOfSetSelected = ({ props, isGrid, isTree, api }) => {
|
|
257
|
+
const getResultOfSetSelected = ({ state, props, isGrid, isTree, api }) => {
|
|
245
258
|
let result = [];
|
|
246
259
|
const newModelValue = [];
|
|
247
|
-
if (Array.isArray(
|
|
248
|
-
|
|
260
|
+
if (Array.isArray(state.modelValue)) {
|
|
261
|
+
state.modelValue.forEach((value) => {
|
|
249
262
|
if (isGrid || isTree) {
|
|
250
263
|
const option = api.getPluginOption(value, isTree);
|
|
251
264
|
result = result.concat(option);
|
|
@@ -275,7 +288,7 @@ const setGridOrTreeSelected = ({ props, state, vm, isTree, api }) => {
|
|
|
275
288
|
}
|
|
276
289
|
const isRemote = state.filterOrSearch && props.remote && (typeof props.remoteMethod === "function" || typeof props.initQuery === "function");
|
|
277
290
|
const nestdata = isRemote ? state.remoteData : isTree ? api.getTreeData(state.treeData) : state.gridData;
|
|
278
|
-
const data = find(nestdata, (item) => props.modelValue
|
|
291
|
+
const data = find(nestdata, (item) => props.modelValue === item[props.valueField]);
|
|
279
292
|
if (isEmptyObject(data)) {
|
|
280
293
|
api.clearNoMatchValue("");
|
|
281
294
|
return;
|
|
@@ -305,7 +318,7 @@ const setSelected = ({ api, constants, nextTick, props, vm, state }) => () => {
|
|
|
305
318
|
}
|
|
306
319
|
return;
|
|
307
320
|
}
|
|
308
|
-
const result = getResultOfSetSelected({ props, isGrid, isTree, api });
|
|
321
|
+
const result = getResultOfSetSelected({ state, props, isGrid, isTree, api });
|
|
309
322
|
state.selectCls = result.length ? result.length === state.options.length ? "checked-sur" : "halfselect" : "check";
|
|
310
323
|
state.selected = result;
|
|
311
324
|
vm.$refs.selectTree && vm.$refs.selectTree.setCheckedNodes && vm.$refs.selectTree.setCheckedNodes(state.selected);
|
|
@@ -316,7 +329,7 @@ const getPluginOption = ({ api, props, state }) => (value, isTree) => {
|
|
|
316
329
|
const isRemote = state.filterOrSearch && props.remote && (typeof props.remoteMethod === "function" || typeof props.initQuery === "function");
|
|
317
330
|
const { textField, valueField } = props;
|
|
318
331
|
const sourceData = isRemote ? state.remoteData : isTree ? api.getTreeData(state.treeData) : state.gridData;
|
|
319
|
-
const selNode = find(sourceData, (item) => item[valueField]
|
|
332
|
+
const selNode = find(sourceData, (item) => item[valueField] === value);
|
|
320
333
|
const items = [];
|
|
321
334
|
if (selNode) {
|
|
322
335
|
selNode.currentLabel = selNode[textField];
|
|
@@ -324,12 +337,21 @@ const getPluginOption = ({ api, props, state }) => (value, isTree) => {
|
|
|
324
337
|
}
|
|
325
338
|
return items;
|
|
326
339
|
};
|
|
327
|
-
const toggleCheckAll = ({ api,
|
|
340
|
+
const toggleCheckAll = ({ api, state }) => () => {
|
|
328
341
|
const getEnabledValues = (options) => {
|
|
329
342
|
let values = [];
|
|
330
343
|
for (let i = 0; i < options.length; i++) {
|
|
331
|
-
|
|
332
|
-
|
|
344
|
+
const isEnabled = !options[i].state.disabled && !options[i].state.groupDisabled;
|
|
345
|
+
const isRequired = options[i].required;
|
|
346
|
+
const isDisabledAndChecked = !isEnabled && options[i].state.selectCls === "checked-sur";
|
|
347
|
+
if (state.isSelectAll) {
|
|
348
|
+
if (isRequired || isDisabledAndChecked) {
|
|
349
|
+
values.push(options[i].value);
|
|
350
|
+
}
|
|
351
|
+
} else {
|
|
352
|
+
if (isEnabled || isRequired || isDisabledAndChecked) {
|
|
353
|
+
values.push(options[i].value);
|
|
354
|
+
}
|
|
333
355
|
}
|
|
334
356
|
}
|
|
335
357
|
return values;
|
|
@@ -341,29 +363,14 @@ const toggleCheckAll = ({ api, emit, state, props }) => () => {
|
|
|
341
363
|
const unchecked = state.options.filter((item) => !item.disabled && item.state.selectCls === "check");
|
|
342
364
|
unchecked.length ? value = getEnabledValues(state.options) : value = [];
|
|
343
365
|
} else if (state.selectCls === "checked-sur") {
|
|
344
|
-
value =
|
|
345
|
-
}
|
|
346
|
-
const requiredValue = [];
|
|
347
|
-
if (props.multiple) {
|
|
348
|
-
state.options.forEach((opt) => {
|
|
349
|
-
if (opt.required)
|
|
350
|
-
requiredValue.push(opt.value);
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
if (Array.isArray(value)) {
|
|
354
|
-
value = requiredValue.concat(value.filter((val) => !requiredValue.find((requireVal) => requireVal === val)));
|
|
366
|
+
value = getEnabledValues(state.options);
|
|
355
367
|
}
|
|
356
368
|
api.setSoftFocus();
|
|
357
369
|
state.isSilentBlur = true;
|
|
358
370
|
api.updateModelValue(value);
|
|
359
|
-
|
|
371
|
+
api.directEmitChange(value);
|
|
360
372
|
};
|
|
361
|
-
const
|
|
362
|
-
state.query = "";
|
|
363
|
-
state.previousQuery = void 0;
|
|
364
|
-
api.handleQueryChange(state.query);
|
|
365
|
-
};
|
|
366
|
-
const handleFocus = ({ emit, props, state, api }) => (event) => {
|
|
373
|
+
const handleFocus = ({ emit, props, state }) => (event) => {
|
|
367
374
|
if (!state.softFocus) {
|
|
368
375
|
if (props.automaticDropdown || props.filterable) {
|
|
369
376
|
state.visible = true;
|
|
@@ -371,12 +378,11 @@ const handleFocus = ({ emit, props, state, api }) => (event) => {
|
|
|
371
378
|
}
|
|
372
379
|
emit("focus", event);
|
|
373
380
|
} else {
|
|
381
|
+
if (state.searchSingleCopy && state.selectedLabel) {
|
|
382
|
+
emit("focus", event);
|
|
383
|
+
}
|
|
374
384
|
state.softFocus = false;
|
|
375
385
|
}
|
|
376
|
-
if (props.remote && state.filterOrSearch && state.firstAutoSearch) {
|
|
377
|
-
state.firstAutoSearch = false;
|
|
378
|
-
api.resetFilter();
|
|
379
|
-
}
|
|
380
386
|
};
|
|
381
387
|
const focus = ({ vm, state }) => () => {
|
|
382
388
|
var _a;
|
|
@@ -390,16 +396,17 @@ const blur = ({ vm, state }) => () => {
|
|
|
390
396
|
(_a = vm.$refs.reference) == null ? void 0 : _a.blur();
|
|
391
397
|
};
|
|
392
398
|
const handleBlur = ({ constants, dispatch, emit, state }) => (event) => {
|
|
399
|
+
var _a;
|
|
393
400
|
clearTimeout(state.timer);
|
|
394
401
|
state.timer = setTimeout(() => {
|
|
395
|
-
var _a;
|
|
396
402
|
if (state.isSilentBlur) {
|
|
397
403
|
state.isSilentBlur = false;
|
|
398
404
|
} else {
|
|
399
405
|
emit("blur", event);
|
|
400
406
|
}
|
|
401
|
-
dispatch(constants.COMPONENT_NAME.FormItem, constants.EVENT_NAME.formBlur, (_a = event == null ? void 0 : event.target) == null ? void 0 : _a.value);
|
|
402
407
|
}, 200);
|
|
408
|
+
dispatch(constants.COMPONENT_NAME.FormItem, constants.EVENT_NAME.formBlur, (_a = event == null ? void 0 : event.target) == null ? void 0 : _a.value);
|
|
409
|
+
state.triggerSearch = false;
|
|
403
410
|
state.softFocus = false;
|
|
404
411
|
};
|
|
405
412
|
const handleClearClick = (api) => (event) => {
|
|
@@ -419,6 +426,9 @@ const toggleLastOptionHitState = ({ state }) => (hit) => {
|
|
|
419
426
|
if (!option) {
|
|
420
427
|
return;
|
|
421
428
|
}
|
|
429
|
+
if (option.required) {
|
|
430
|
+
return true;
|
|
431
|
+
}
|
|
422
432
|
const hitTarget = option.state || option;
|
|
423
433
|
if (hit === true || hit === false) {
|
|
424
434
|
hitTarget.hitState = hit;
|
|
@@ -429,8 +439,9 @@ const toggleLastOptionHitState = ({ state }) => (hit) => {
|
|
|
429
439
|
};
|
|
430
440
|
const deletePrevTag = ({ api, constants, props, state, vm }) => (event) => {
|
|
431
441
|
if (event.target.value.length <= 0 && !api.toggleLastOptionHitState()) {
|
|
432
|
-
const value =
|
|
442
|
+
const value = state.modelValue.slice();
|
|
433
443
|
value.pop();
|
|
444
|
+
state.compareValue = deepClone(value);
|
|
434
445
|
api.updateModelValue(value);
|
|
435
446
|
api.emitChange(value);
|
|
436
447
|
if (props.renderType === constants.TYPE.Grid) {
|
|
@@ -461,9 +472,7 @@ const resetInputHeight = ({ constants, nextTick, props, vm, state, api, designCo
|
|
|
461
472
|
if (!vm.$refs.reference) {
|
|
462
473
|
return;
|
|
463
474
|
}
|
|
464
|
-
|
|
465
|
-
const inputContainer = [].filter.call(inputChildNodes, (item) => hasClass(item, "tiny-input-display-only"))[0];
|
|
466
|
-
const input = inputContainer && inputContainer.querySelector("input");
|
|
475
|
+
let input = vm.$refs.reference.type === "text" && vm.$refs.reference.$el.querySelector("input");
|
|
467
476
|
const tags = vm.$refs.tags;
|
|
468
477
|
if (!input) {
|
|
469
478
|
return;
|
|
@@ -471,18 +480,19 @@ const resetInputHeight = ({ constants, nextTick, props, vm, state, api, designCo
|
|
|
471
480
|
if (!state.isDisplayOnly && props.hoverExpand && !props.disabled) {
|
|
472
481
|
api.calcCollapseTags();
|
|
473
482
|
}
|
|
474
|
-
const sizeInMap =
|
|
483
|
+
const sizeInMap = state.initialInputHeight;
|
|
475
484
|
const noSelected = state.selected.length === 0;
|
|
485
|
+
const spacingHeight = designConfig ? (_a = designConfig.state) == null ? void 0 : _a.spacingHeight : constants.SPACING_HEIGHT;
|
|
476
486
|
if (!state.isDisplayOnly) {
|
|
477
487
|
if (!noSelected && tags) {
|
|
478
488
|
fastdom.measure(() => {
|
|
479
489
|
const tagsClientHeight = tags.clientHeight;
|
|
480
490
|
fastdom.mutate(() => {
|
|
481
|
-
input.style.height = Math.max(tagsClientHeight +
|
|
491
|
+
input.style.height = Math.max(tagsClientHeight + spacingHeight, sizeInMap) + "px";
|
|
482
492
|
});
|
|
483
493
|
});
|
|
484
494
|
} else {
|
|
485
|
-
input.style.height =
|
|
495
|
+
input.style.height = sizeInMap + "px";
|
|
486
496
|
}
|
|
487
497
|
} else {
|
|
488
498
|
input.style.height = "auto";
|
|
@@ -512,13 +522,14 @@ const handleOptionSelect = ({ api, nextTick, props, vm, state }) => (option, byC
|
|
|
512
522
|
var _a, _b;
|
|
513
523
|
state.memorize && state.memorize.updateByKey(option[state.memorize._dataKey] || option.value);
|
|
514
524
|
if (props.multiple) {
|
|
515
|
-
const value = (
|
|
525
|
+
const value = (state.modelValue || []).slice();
|
|
516
526
|
const optionIndex = api.getValueIndex(value, option.value);
|
|
517
527
|
if (optionIndex > -1) {
|
|
518
528
|
value.splice(optionIndex, 1);
|
|
519
529
|
} else if (state.multipleLimit <= 0 || value.length < state.multipleLimit) {
|
|
520
530
|
value.push(option.value);
|
|
521
531
|
}
|
|
532
|
+
state.compareValue = deepClone(value);
|
|
522
533
|
api.updateModelValue(value);
|
|
523
534
|
api.emitChange(value);
|
|
524
535
|
if (option.created) {
|
|
@@ -536,6 +547,7 @@ const handleOptionSelect = ({ api, nextTick, props, vm, state }) => (option, byC
|
|
|
536
547
|
state.visible = false;
|
|
537
548
|
}
|
|
538
549
|
} else {
|
|
550
|
+
state.compareValue = deepClone(option.value);
|
|
539
551
|
api.updateModelValue(option.value);
|
|
540
552
|
api.emitChange(option.value);
|
|
541
553
|
if (option.created) {
|
|
@@ -579,11 +591,17 @@ const getValueIndex = (props) => (arr = [], value = null) => {
|
|
|
579
591
|
return index;
|
|
580
592
|
}
|
|
581
593
|
};
|
|
582
|
-
const toggleMenu = ({ vm, state, props }) => (e) => {
|
|
594
|
+
const toggleMenu = ({ vm, state, props, api }) => (e) => {
|
|
595
|
+
if (props.keepFocus && state.visible && props.filterable) {
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
583
598
|
const event = e || window.event;
|
|
584
599
|
const enterCode = 13;
|
|
585
600
|
const nodeName = event.target && event.target.nodeName;
|
|
586
601
|
const toggleVisible = props.ignoreEnter ? event.keyCode !== enterCode && nodeName === "INPUT" : true;
|
|
602
|
+
if (!props.displayOnly) {
|
|
603
|
+
event.stopPropagation();
|
|
604
|
+
}
|
|
587
605
|
if (!state.selectDisabled) {
|
|
588
606
|
toggleVisible && !state.softFocus && (state.visible = !state.visible);
|
|
589
607
|
state.softFocus = false;
|
|
@@ -591,6 +609,7 @@ const toggleMenu = ({ vm, state, props }) => (e) => {
|
|
|
591
609
|
if (!(props.filterable && props.shape)) {
|
|
592
610
|
const dom = vm.$refs.input || vm.$refs.reference;
|
|
593
611
|
dom == null ? void 0 : dom.focus();
|
|
612
|
+
api.setOptionHighlight();
|
|
594
613
|
}
|
|
595
614
|
}
|
|
596
615
|
}
|
|
@@ -605,11 +624,11 @@ const selectOption = ({ api, state, props }) => (e) => {
|
|
|
605
624
|
}
|
|
606
625
|
};
|
|
607
626
|
const deleteSelected = ({ api, constants, emit, props, vm, state }) => (event) => {
|
|
608
|
-
event.stopPropagation();
|
|
627
|
+
event == null ? void 0 : event.stopPropagation();
|
|
609
628
|
let selectedValue = [];
|
|
610
629
|
if (props.multiple) {
|
|
611
630
|
const requireOptions = state.options.filter((opt) => opt.required && opt.value);
|
|
612
|
-
selectedValue =
|
|
631
|
+
selectedValue = state.modelValue.slice().filter((v) => requireOptions.find((opt) => opt.value === v));
|
|
613
632
|
}
|
|
614
633
|
const value = props.multiple ? selectedValue : "";
|
|
615
634
|
const refs = vm.$refs;
|
|
@@ -623,8 +642,9 @@ const deleteSelected = ({ api, constants, emit, props, vm, state }) => (event) =
|
|
|
623
642
|
refs.selectGrid.clearRadioRow();
|
|
624
643
|
}
|
|
625
644
|
state.showTip = false;
|
|
626
|
-
|
|
627
|
-
api.
|
|
645
|
+
state.compareValue = deepClone(value);
|
|
646
|
+
api.updateModelValue(value, true);
|
|
647
|
+
api.emitChange(value, true);
|
|
628
648
|
state.visible = false;
|
|
629
649
|
emit("clear");
|
|
630
650
|
};
|
|
@@ -648,7 +668,7 @@ const deleteTag = ({ api, constants, emit, props, state, nextTick, vm }) => (eve
|
|
|
648
668
|
state.selected.slice().map((node2) => !treeIds.includes(node2[props.valueField]) && treeValue.push(node2[props.valueField]));
|
|
649
669
|
}
|
|
650
670
|
if (index > -1 && !state.selectDisabled) {
|
|
651
|
-
const value =
|
|
671
|
+
const value = state.modelValue.slice();
|
|
652
672
|
value.splice(index, 1);
|
|
653
673
|
if (props.renderType === constants.TYPE.Tree) {
|
|
654
674
|
props.treeOp.checkStrictly && treeValue.push(...value);
|
|
@@ -658,6 +678,7 @@ const deleteTag = ({ api, constants, emit, props, state, nextTick, vm }) => (eve
|
|
|
658
678
|
refs.selectGrid.clearSelection();
|
|
659
679
|
refs.selectGrid.setSelection(rows, true);
|
|
660
680
|
}
|
|
681
|
+
state.compareValue = deepClone(value);
|
|
661
682
|
api.updateModelValue(isTree ? treeValue : value);
|
|
662
683
|
api.emitChange(value);
|
|
663
684
|
emit(constants.EVENT_NAME.removeTag, tag[props.valueField]);
|
|
@@ -698,6 +719,15 @@ const handleResize = ({ api, props, state }) => () => {
|
|
|
698
719
|
api.resetInputHeight();
|
|
699
720
|
}
|
|
700
721
|
};
|
|
722
|
+
const setOptionHighlight = (state) => () => {
|
|
723
|
+
for (let i = 0; i < state.options.length; ++i) {
|
|
724
|
+
const option = state.options[i];
|
|
725
|
+
if (!option.disabled && !option.groupDisabled && option.state.visible && option.state.itemSelected) {
|
|
726
|
+
state.hoverIndex = i;
|
|
727
|
+
break;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
};
|
|
701
731
|
const checkDefaultFirstOption = (state) => () => {
|
|
702
732
|
state.hoverIndex = -1;
|
|
703
733
|
let hasCreated = false;
|
|
@@ -734,7 +764,11 @@ const getValueKey = (props) => (item) => {
|
|
|
734
764
|
}
|
|
735
765
|
return getObj(item.value, props.valueKey);
|
|
736
766
|
};
|
|
737
|
-
const navigateOptions = ({ api, nextTick, state }) => (direction) => {
|
|
767
|
+
const navigateOptions = ({ api, nextTick, state, props }) => (direction) => {
|
|
768
|
+
const { optimization } = props;
|
|
769
|
+
if (optimization) {
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
738
772
|
const len = state.options.length;
|
|
739
773
|
if (!state.visible) {
|
|
740
774
|
state.visible = true;
|
|
@@ -756,38 +790,37 @@ const navigateOptions = ({ api, nextTick, state }) => (direction) => {
|
|
|
756
790
|
}
|
|
757
791
|
}
|
|
758
792
|
const option = state.options[state.hoverIndex];
|
|
759
|
-
if (option.disabled === true || option.groupDisabled === true || !option.visible) {
|
|
793
|
+
if (option.disabled === true || option.groupDisabled === true || !option.visible || option.state.limitReached) {
|
|
760
794
|
api.navigateOptions(direction);
|
|
761
795
|
}
|
|
762
796
|
nextTick(() => api.scrollToOption(state.hoverOption));
|
|
763
797
|
}
|
|
764
798
|
};
|
|
765
|
-
const emptyText = ({ I18N, props, state, t }) => () => {
|
|
799
|
+
const emptyText = ({ I18N, props, state, t, isMobileFirstMode }) => () => {
|
|
766
800
|
if (props.loading) {
|
|
767
801
|
return props.loadingText || t(I18N.loading);
|
|
768
802
|
} else {
|
|
769
803
|
if (props.remote && state.query === "" && props.renderType) {
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
return
|
|
804
|
+
return remoteEmptyText(props, state);
|
|
805
|
+
}
|
|
806
|
+
if (props.remote && state.query === "" && state.options.length === 0 && !state.triggerSearch) {
|
|
807
|
+
return props.shape === "filter" || isMobileFirstMode ? "" : false;
|
|
774
808
|
}
|
|
775
809
|
if (state.filterOrSearch && state.query && state.options.length >= 0 && state.filteredOptionsCount === 0) {
|
|
776
810
|
return props.noMatchText || t(I18N.noMatch);
|
|
777
811
|
}
|
|
778
|
-
if (!state.options.some((option) => option.visible)) {
|
|
812
|
+
if (!state.options.some((option) => option.visible && option.state.visible)) {
|
|
779
813
|
return props.noDataText || t(I18N.noData);
|
|
780
814
|
}
|
|
781
|
-
if (props.remote && state.query === "" && state.options.length === 0) {
|
|
782
|
-
if (props.shape === "filter") {
|
|
783
|
-
return "";
|
|
784
|
-
} else {
|
|
785
|
-
return false;
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
815
|
}
|
|
789
816
|
return null;
|
|
790
817
|
};
|
|
818
|
+
const remoteEmptyText = function(props, state) {
|
|
819
|
+
if (props.multiple) {
|
|
820
|
+
return state.selected.length > 0 || state.remoteData.length >= 0;
|
|
821
|
+
}
|
|
822
|
+
return state.selected[props.valueField] || state.remoteData.length >= 0;
|
|
823
|
+
};
|
|
791
824
|
const watchValue = ({ api, constants, dispatch, props, vm, state }) => (value, oldValue) => {
|
|
792
825
|
if (props.multiple) {
|
|
793
826
|
api.resetInputHeight();
|
|
@@ -816,7 +849,7 @@ const calcOverFlow = ({ vm, props, state }) => (height) => {
|
|
|
816
849
|
if (props.multiple && props.showOverflowTooltip) {
|
|
817
850
|
state.overflow = false;
|
|
818
851
|
const tagDom = vm.$refs.tags;
|
|
819
|
-
const tags = tagDom.querySelectorAll("
|
|
852
|
+
const tags = tagDom.querySelectorAll('[data-tag="tiny-tag"]');
|
|
820
853
|
if (tags.length) {
|
|
821
854
|
tagDom.scrollTo && tagDom.scrollTo({ top: 0 });
|
|
822
855
|
let { x, width } = tags[0].getBoundingClientRect();
|
|
@@ -825,7 +858,7 @@ const calcOverFlow = ({ vm, props, state }) => (height) => {
|
|
|
825
858
|
} else {
|
|
826
859
|
for (let i = 1; i < tags.length; i++) {
|
|
827
860
|
let tx = tags[i].getBoundingClientRect().x;
|
|
828
|
-
if (tx
|
|
861
|
+
if (tx === x) {
|
|
829
862
|
state.overflow = i - 1;
|
|
830
863
|
break;
|
|
831
864
|
}
|
|
@@ -878,7 +911,7 @@ const toVisible = ({ constants, state, props, vm, api, nextTick }) => () => {
|
|
|
878
911
|
state.inputLength = 20;
|
|
879
912
|
state.previousQuery !== state.query && api.initQuery().then(() => api.setSelected());
|
|
880
913
|
if (props.renderType !== constants.TYPE.Tree) {
|
|
881
|
-
state.previousQuery =
|
|
914
|
+
state.previousQuery = null;
|
|
882
915
|
}
|
|
883
916
|
api.resetHoverIndex();
|
|
884
917
|
nextTick(() => {
|
|
@@ -893,21 +926,24 @@ const toVisible = ({ constants, state, props, vm, api, nextTick }) => () => {
|
|
|
893
926
|
};
|
|
894
927
|
const toHide = ({ constants, state, props, vm, api, nextTick }) => () => {
|
|
895
928
|
var _a, _b;
|
|
929
|
+
const { remote, remoteConfig, shape, renderType, multiple, valueField } = props;
|
|
896
930
|
state.selectEmitter.emit(constants.COMPONENT_NAME.SelectDropdown);
|
|
897
931
|
nextTick(() => {
|
|
898
932
|
state.selectEmitter.emit(constants.EVENT_NAME.updatePopper);
|
|
899
933
|
});
|
|
900
934
|
if (state.filterOrSearch) {
|
|
901
|
-
state.query =
|
|
902
|
-
|
|
903
|
-
|
|
935
|
+
state.query = remote || shape ? "" : renderType !== constants.TYPE.Tree ? state.selectedLabel : "";
|
|
936
|
+
const isChange = remote && remoteConfig.autoSearch && (state.firstAutoSearch || remoteConfig.clearData);
|
|
937
|
+
state.firstAutoSearch = false;
|
|
938
|
+
api.handleQueryChange(state.query, isChange);
|
|
939
|
+
if (multiple) {
|
|
904
940
|
props.filterable ? (_a = vm.$refs.input) == null ? void 0 : _a.focus() : (_b = vm.$refs.reference) == null ? void 0 : _b.focus();
|
|
905
941
|
} else {
|
|
906
|
-
if (!
|
|
942
|
+
if (!remote) {
|
|
907
943
|
state.selectEmitter.emit(constants.EVENT_NAME.queryChange);
|
|
908
944
|
state.selectEmitter.emit(constants.COMPONENT_NAME.OptionGroup);
|
|
909
945
|
}
|
|
910
|
-
if (state.selectedLabel && !
|
|
946
|
+
if (state.selectedLabel && !shape) {
|
|
911
947
|
state.currentPlaceholder = state.selectedLabel;
|
|
912
948
|
state.selectedLabel = "";
|
|
913
949
|
}
|
|
@@ -915,25 +951,25 @@ const toHide = ({ constants, state, props, vm, api, nextTick }) => () => {
|
|
|
915
951
|
}
|
|
916
952
|
if (vm.$refs.selectGrid) {
|
|
917
953
|
let { fullData } = vm.$refs.selectGrid.getTableData();
|
|
918
|
-
if (
|
|
919
|
-
const selectedIds = state.selected.map((sel) => sel[
|
|
954
|
+
if (multiple) {
|
|
955
|
+
const selectedIds = state.selected.map((sel) => sel[valueField]);
|
|
920
956
|
vm.$refs.selectGrid.clearSelection();
|
|
921
957
|
vm.$refs.selectGrid.setSelection(
|
|
922
|
-
fullData.filter((row) => ~selectedIds.indexOf(row[
|
|
958
|
+
fullData.filter((row) => ~selectedIds.indexOf(row[valueField])),
|
|
923
959
|
true
|
|
924
960
|
);
|
|
925
961
|
} else {
|
|
926
962
|
vm.$refs.selectGrid.clearRadioRow();
|
|
927
|
-
vm.$refs.selectGrid.setRadioRow(find(fullData, (item) => props.modelValue
|
|
963
|
+
vm.$refs.selectGrid.setRadioRow(find(fullData, (item) => props.modelValue === item[props.valueField]));
|
|
928
964
|
}
|
|
929
965
|
if (state.filterOrSearch && typeof props.filterMethod === "function") {
|
|
930
966
|
vm.$refs.selectGrid.handleTableData(true);
|
|
931
|
-
} else if (state.filterOrSearch &&
|
|
967
|
+
} else if (state.filterOrSearch && remote && (typeof props.remoteMethod === "function" || typeof props.initQuery === "function")) {
|
|
932
968
|
vm.$refs.selectGrid.handleTableData();
|
|
933
969
|
}
|
|
934
970
|
}
|
|
935
971
|
};
|
|
936
|
-
const watchVisible = ({ api, constants, emit, state, vm, props }) => (value) => {
|
|
972
|
+
const watchVisible = ({ api, constants, emit, state, vm, props, isMobileFirstMode }) => (value) => {
|
|
937
973
|
var _a;
|
|
938
974
|
if ((state.filterOrSearch || props.remote) && !value) {
|
|
939
975
|
(_a = vm.$refs.reference) == null ? void 0 : _a.blur();
|
|
@@ -941,6 +977,9 @@ const watchVisible = ({ api, constants, emit, state, vm, props }) => (value) =>
|
|
|
941
977
|
if (api.onCopying()) {
|
|
942
978
|
return;
|
|
943
979
|
}
|
|
980
|
+
if (value && props.multiple && state.device === "mb") {
|
|
981
|
+
state.selectedCopy = state.selected.slice();
|
|
982
|
+
}
|
|
944
983
|
setTimeout(() => {
|
|
945
984
|
if (!value && !state.selectedLabel) {
|
|
946
985
|
state.cachedOptions.forEach((item) => {
|
|
@@ -950,10 +989,19 @@ const watchVisible = ({ api, constants, emit, state, vm, props }) => (value) =>
|
|
|
950
989
|
}, 200);
|
|
951
990
|
value ? api.toHide() : api.toVisible();
|
|
952
991
|
emit(constants.EVENT_NAME.visibleChange, value);
|
|
992
|
+
setTimeout(() => {
|
|
993
|
+
state.selectEmitter.emit(constants.EVENT_NAME.updatePopper);
|
|
994
|
+
if (value && vm.$refs.scrollbar) {
|
|
995
|
+
vm.$refs.scrollbar.handleScroll();
|
|
996
|
+
}
|
|
997
|
+
}, props.updateDelay);
|
|
953
998
|
if (!value && props.shape === "filter") {
|
|
954
999
|
state.softFocus = false;
|
|
955
1000
|
}
|
|
956
1001
|
if (value && state.optimizeStore.flag) {
|
|
1002
|
+
if (isMobileFirstMode) {
|
|
1003
|
+
optmzApis.queryWrap(vm.$refs).addEventListener("scroll", api.getScrollListener);
|
|
1004
|
+
}
|
|
957
1005
|
optmzApis.createMacro(() => {
|
|
958
1006
|
optmzApis.setScrollTop({ refs: vm.$refs, state });
|
|
959
1007
|
api.getScrollListener();
|
|
@@ -990,7 +1038,7 @@ const handleCopyClick = ({ parent, props, state }) => () => {
|
|
|
990
1038
|
document.execCommand("copy");
|
|
991
1039
|
parent.$el.removeChild(input);
|
|
992
1040
|
};
|
|
993
|
-
const selectChange = ({
|
|
1041
|
+
const selectChange = ({ props, state, api }) => ({ $table, selection, checked, row }) => {
|
|
994
1042
|
const { textField, valueField } = props;
|
|
995
1043
|
const remoteItem = (row2) => {
|
|
996
1044
|
const removeItem = find(state.selected, (item) => item[valueField] === row2[valueField]);
|
|
@@ -1000,12 +1048,12 @@ const selectChange = ({ emit, props, state, api }) => ({ $table, selection, chec
|
|
|
1000
1048
|
checked ? state.selected.push(__spreadProps(__spreadValues({}, row), { value: row[valueField], currentLabel: row[textField] })) : remoteItem(row);
|
|
1001
1049
|
} else {
|
|
1002
1050
|
checked ? state.selected = state.selected.concat(
|
|
1003
|
-
selection.filter((row2) => !~
|
|
1051
|
+
selection.filter((row2) => !~state.modelValue.indexOf(row2[valueField]))
|
|
1004
1052
|
) : $table.tableFullData.forEach((row2) => remoteItem(row2));
|
|
1005
1053
|
}
|
|
1006
1054
|
const keys = state.selected.map((item) => item[valueField]);
|
|
1007
1055
|
api.updateModelValue(keys);
|
|
1008
|
-
|
|
1056
|
+
api.directEmitChange(keys, state.selected);
|
|
1009
1057
|
};
|
|
1010
1058
|
const getcheckedData = ({ props, state }) => () => {
|
|
1011
1059
|
const checkedKey = [];
|
|
@@ -1018,14 +1066,14 @@ const getcheckedData = ({ props, state }) => () => {
|
|
|
1018
1066
|
return checkedKey;
|
|
1019
1067
|
}
|
|
1020
1068
|
};
|
|
1021
|
-
const radioChange = ({
|
|
1069
|
+
const radioChange = ({ props, state, api }) => ({ row }) => {
|
|
1022
1070
|
row.value = row[props.valueField];
|
|
1023
1071
|
row.currentLabel = row[props.textField];
|
|
1024
1072
|
state.selected = row;
|
|
1025
1073
|
state.visible = false;
|
|
1026
1074
|
state.currentKey = row[props.valueField];
|
|
1027
1075
|
api.updateModelValue(row.value);
|
|
1028
|
-
|
|
1076
|
+
api.directEmitChange(row);
|
|
1029
1077
|
};
|
|
1030
1078
|
const getTreeData = (props) => (data) => {
|
|
1031
1079
|
const nodes = [];
|
|
@@ -1041,14 +1089,14 @@ const getTreeData = (props) => (data) => {
|
|
|
1041
1089
|
getChild(data, null);
|
|
1042
1090
|
return nodes;
|
|
1043
1091
|
};
|
|
1044
|
-
const treeNodeClick = ({
|
|
1092
|
+
const treeNodeClick = ({ props, state, api, vm }) => (data) => {
|
|
1045
1093
|
if (!props.multiple) {
|
|
1046
1094
|
data.currentLabel = data[props.textField];
|
|
1047
1095
|
data.value = data[props.valueField];
|
|
1048
1096
|
state.selected = data;
|
|
1049
1097
|
state.visible = false;
|
|
1050
1098
|
api.updateModelValue(data.value);
|
|
1051
|
-
|
|
1099
|
+
api.directEmitChange(data);
|
|
1052
1100
|
} else {
|
|
1053
1101
|
if (props.treeOp.checkOnClickNode) {
|
|
1054
1102
|
const checkedNodes = vm.$refs.selectTree.getCheckedNodes();
|
|
@@ -1057,7 +1105,7 @@ const treeNodeClick = ({ emit, props, state, api, vm }) => (data) => {
|
|
|
1057
1105
|
}
|
|
1058
1106
|
}
|
|
1059
1107
|
};
|
|
1060
|
-
const nodeCheckClick = ({
|
|
1108
|
+
const nodeCheckClick = ({ props, state, api }) => (data, { checkedKeys, checkedNodes }) => {
|
|
1061
1109
|
const selected = state.selected.map((item) => api.getValueKey(item));
|
|
1062
1110
|
if (isEqual(selected, checkedKeys)) {
|
|
1063
1111
|
return;
|
|
@@ -1065,9 +1113,10 @@ const nodeCheckClick = ({ emit, props, state, api }) => (data, { checkedKeys, ch
|
|
|
1065
1113
|
state.selected = checkedNodes.filter((node) => {
|
|
1066
1114
|
node.currentLabel = node[props.textField];
|
|
1067
1115
|
node.value = node[props.valueField];
|
|
1116
|
+
return checkedNodes;
|
|
1068
1117
|
});
|
|
1069
1118
|
api.updateModelValue(checkedKeys);
|
|
1070
|
-
|
|
1119
|
+
api.directEmitChange(checkedKeys, checkedNodes);
|
|
1071
1120
|
};
|
|
1072
1121
|
const nodeCollapse = ({ state, constants }) => () => {
|
|
1073
1122
|
setTimeout(() => {
|
|
@@ -1144,7 +1193,7 @@ const buildRadioConfig = ({ props, state }) => () => {
|
|
|
1144
1193
|
const radioConfig = props.radioConfig;
|
|
1145
1194
|
return __spreadValues(__spreadValues({}, radioConfig), { checkRowKey, highlight });
|
|
1146
1195
|
};
|
|
1147
|
-
const onMouseenterNative = ({ state }) => (
|
|
1196
|
+
const onMouseenterNative = ({ state }) => () => {
|
|
1148
1197
|
state.inputHovering = true;
|
|
1149
1198
|
if (state.searchSingleCopy && state.selectedLabel) {
|
|
1150
1199
|
state.softFocus = true;
|
|
@@ -1183,17 +1232,17 @@ const calcCollapseTags = ({ state, vm }) => () => {
|
|
|
1183
1232
|
return state.isHidden = true;
|
|
1184
1233
|
}
|
|
1185
1234
|
const tags = vm.$refs.tags;
|
|
1186
|
-
|
|
1235
|
+
const collapseTag = tags && tags.querySelector('[data-tag="tags-collapse"]');
|
|
1236
|
+
if (!tags || !collapseTag) {
|
|
1187
1237
|
return;
|
|
1188
1238
|
}
|
|
1189
1239
|
const { width: tagsContentWidth, paddingLeft, paddingRight } = window.getComputedStyle(tags);
|
|
1190
1240
|
const tagsWidth = parseFloat(tagsContentWidth) - parseFloat(paddingLeft) - parseFloat(paddingRight);
|
|
1191
|
-
const collapseTag = tags.querySelector(".tiny-select__tags-collapse");
|
|
1192
1241
|
const { width: collapseTagContentWidth, marginRight } = collapseTag && window.getComputedStyle(collapseTag);
|
|
1193
1242
|
const collapseTagWidth = collapseTag && parseFloat(collapseTagContentWidth) + parseFloat(marginRight);
|
|
1194
|
-
const tagList = Array.from(tags.querySelectorAll("
|
|
1243
|
+
const tagList = Array.from(tags.querySelectorAll('[data-tag="tiny-tag"]'));
|
|
1195
1244
|
let { total, dom, idx } = { total: collapseTagWidth, dom: null, idx: 0 };
|
|
1196
|
-
tagList.
|
|
1245
|
+
tagList.forEach((tag, index) => {
|
|
1197
1246
|
if (tag !== collapseTag) {
|
|
1198
1247
|
const { width: tagContentWidth, marginRight: marginRight2 } = tag && window.getComputedStyle(tag);
|
|
1199
1248
|
total += parseFloat(tagContentWidth) + parseFloat(marginRight2);
|
|
@@ -1244,8 +1293,8 @@ const initQuery = ({ props, state, constants, vm }) => ({ init } = {}) => {
|
|
|
1244
1293
|
}
|
|
1245
1294
|
return Promise.resolve(selected);
|
|
1246
1295
|
};
|
|
1247
|
-
const mounted = ({ api, parent, state, props, vm,
|
|
1248
|
-
var _a;
|
|
1296
|
+
const mounted = ({ api, parent, state, props, vm, designConfig }) => () => {
|
|
1297
|
+
var _a, _b;
|
|
1249
1298
|
state.defaultCheckedKeys = state.gridCheckedData;
|
|
1250
1299
|
const parentEl = parent.$el;
|
|
1251
1300
|
const inputEl = parentEl.querySelector("input.tiny-input__inner") || parentEl.querySelector("input.tiny-mobile-input__inner");
|
|
@@ -1254,11 +1303,12 @@ const mounted = ({ api, parent, state, props, vm, constants }) => () => {
|
|
|
1254
1303
|
(_a = document.activeElement) == null ? void 0 : _a.blur();
|
|
1255
1304
|
}
|
|
1256
1305
|
state.completed = true;
|
|
1257
|
-
const
|
|
1306
|
+
const defaultSizeMap = { default: 28, mini: 24, small: 32, medium: 40 };
|
|
1307
|
+
const sizeMap = ((_b = designConfig == null ? void 0 : designConfig.state) == null ? void 0 : _b.sizeMap) || defaultSizeMap;
|
|
1258
1308
|
if (props.multiple && Array.isArray(props.modelValue) && props.modelValue.length > 0) {
|
|
1259
1309
|
state.currentPlaceholder = "";
|
|
1260
1310
|
}
|
|
1261
|
-
state.initialInputHeight =
|
|
1311
|
+
state.initialInputHeight = sizeMap[state.selectSize || "default"];
|
|
1262
1312
|
addResizeListener(parentEl, api.handleResize);
|
|
1263
1313
|
if (vm.$refs.tags) {
|
|
1264
1314
|
addResizeListener(vm.$refs.tags, api.resetInputHeight);
|
|
@@ -1337,7 +1387,7 @@ const optmzApis = {
|
|
|
1337
1387
|
return sliced;
|
|
1338
1388
|
},
|
|
1339
1389
|
queryWrap: (refs) => refs.scrollbar.$el.querySelector(".tiny-scrollbar__wrap.virtual"),
|
|
1340
|
-
queryItems: (refs) => refs.scrollbar.$el.querySelectorAll("
|
|
1390
|
+
queryItems: (refs) => refs.scrollbar.$el.querySelectorAll('[data-tag="tiny-option"].virtual'),
|
|
1341
1391
|
createMacro: (cb) => setTimeout(cb),
|
|
1342
1392
|
setScrollTop: ({ refs, state }) => {
|
|
1343
1393
|
const { optimizeOpts, optimizeStore } = state;
|
|
@@ -1438,9 +1488,13 @@ const computeMultipleLimit = ({ props, state }) => () => {
|
|
|
1438
1488
|
const { optimizeOpts, optimizeStore } = state;
|
|
1439
1489
|
return optmzApis.natural(multiple && optimizeStore.flag ? multipleLimit || optimizeOpts.limit : multipleLimit);
|
|
1440
1490
|
};
|
|
1441
|
-
const updateModelValue = ({ emit, state }) => (value) => {
|
|
1491
|
+
const updateModelValue = ({ props, emit, state }) => (value, needUpdate) => {
|
|
1442
1492
|
state.isClickChoose = true;
|
|
1443
|
-
|
|
1493
|
+
if (state.device === "mb" && props.multiple && !needUpdate) {
|
|
1494
|
+
state.modelValue = value;
|
|
1495
|
+
} else {
|
|
1496
|
+
emit("update:modelValue", value);
|
|
1497
|
+
}
|
|
1444
1498
|
};
|
|
1445
1499
|
const getLabelSlotValue = ({ props, state }) => (item) => {
|
|
1446
1500
|
const datas = state.optimizeStore.flag ? state.optimizeStore.datas : state.datas;
|
|
@@ -1459,11 +1513,14 @@ const computedTagsStyle = ({ props, parent, state }) => () => {
|
|
|
1459
1513
|
width: "100%"
|
|
1460
1514
|
};
|
|
1461
1515
|
};
|
|
1462
|
-
const computedReadonly = ({ props, state }) => () => props.readonly || !props.filterable || props.multiple || browserInfo.name !== BROWSER_NAME.IE && browserInfo.name !== BROWSER_NAME.Edge && !state.visible;
|
|
1463
|
-
const computedShowClose = ({ props, state }) => () => props.clearable && !state.selectDisabled && state.inputHovering && // 新增 || (props.multiple && state.visible)
|
|
1516
|
+
const computedReadonly = ({ props, state }) => () => state.device === "mb" || props.readonly || !props.filterable || props.multiple || browserInfo.name !== BROWSER_NAME.IE && browserInfo.name !== BROWSER_NAME.Edge && !state.visible;
|
|
1517
|
+
const computedShowClose = ({ props, state }) => () => props.clearable && !state.selectDisabled && (state.inputHovering || props.multiple && state.visible) && // 新增 || (props.multiple && state.visible)
|
|
1464
1518
|
(props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : !isNull(props.modelValue) && props.modelValue !== "");
|
|
1465
1519
|
const computedCollapseTagSize = (state) => () => state.selectSize;
|
|
1466
|
-
const computedShowNewOption = ({ props, state }) => () =>
|
|
1520
|
+
const computedShowNewOption = ({ props, state }) => () => {
|
|
1521
|
+
const query = state.device === "mb" ? state.queryValue : state.query;
|
|
1522
|
+
return props.filterable && props.allowCreate && query !== "" && !state.options.filter((option) => !option.created).some((option) => option.state.currentLabel === state.query);
|
|
1523
|
+
};
|
|
1467
1524
|
const computedShowCopy = ({ props, state }) => () => props.multiple && props.copyable && state.inputHovering && state.selected.length;
|
|
1468
1525
|
const computedOptionsAllDisabled = (state) => () => state.options.filter((option) => option.visible).every((option) => option.disabled);
|
|
1469
1526
|
const computedDisabledTooltipContent = (state) => () => state.selected.map((item) => item.state ? item.state.currentLabel : item.currentLabel).join("\uFF1B");
|
|
@@ -1508,15 +1565,22 @@ const watchInitValue = ({ props, emit }) => (value) => {
|
|
|
1508
1565
|
const watchShowClose = ({ nextTick, state, parent }) => () => {
|
|
1509
1566
|
nextTick(() => {
|
|
1510
1567
|
const parentEl = parent.$el;
|
|
1511
|
-
const inputEl = parentEl.querySelector("
|
|
1568
|
+
const inputEl = parentEl.querySelector('input[data-tag="tiny-input-inner"]');
|
|
1512
1569
|
if (inputEl) {
|
|
1513
1570
|
const { paddingRight } = getComputedStyle(inputEl);
|
|
1514
1571
|
state.inputPaddingRight = parseFloat(paddingRight);
|
|
1515
1572
|
}
|
|
1516
1573
|
});
|
|
1517
1574
|
};
|
|
1518
|
-
const computedGetIcon = ({ constants, designConfig, props }) => (
|
|
1519
|
-
|
|
1575
|
+
const computedGetIcon = ({ constants, designConfig, props }) => (iconKey = "dropdownIcon") => {
|
|
1576
|
+
const defaultDropdownIcon = {
|
|
1577
|
+
icon: (designConfig == null ? void 0 : designConfig.icons[iconKey]) || (constants == null ? void 0 : constants.ICON_MAP[iconKey]),
|
|
1578
|
+
isDefault: true
|
|
1579
|
+
};
|
|
1580
|
+
if (props.dropdownIcon) {
|
|
1581
|
+
return { icon: props.dropdownIcon };
|
|
1582
|
+
}
|
|
1583
|
+
return defaultDropdownIcon;
|
|
1520
1584
|
};
|
|
1521
1585
|
const computedGetTagType = ({ designConfig, props }) => () => {
|
|
1522
1586
|
var _a;
|
|
@@ -1557,6 +1621,7 @@ export {
|
|
|
1557
1621
|
deletePrevTag,
|
|
1558
1622
|
deleteSelected,
|
|
1559
1623
|
deleteTag,
|
|
1624
|
+
directEmitChange,
|
|
1560
1625
|
doDestroy,
|
|
1561
1626
|
emitChange,
|
|
1562
1627
|
emptyText,
|
|
@@ -1606,6 +1671,7 @@ export {
|
|
|
1606
1671
|
scrollToOption,
|
|
1607
1672
|
selectChange,
|
|
1608
1673
|
selectOption,
|
|
1674
|
+
setOptionHighlight,
|
|
1609
1675
|
setSelected,
|
|
1610
1676
|
setSoftFocus,
|
|
1611
1677
|
showTip,
|