@opentiny/vue-renderless 3.13.1 → 3.14.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/action-sheet/index.js +20 -13
- package/action-sheet/vue.js +8 -7
- 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 +18 -4
- package/calendar-view/index.js +5 -1
- package/calendar-view/vue.js +16 -3
- package/card-group/vue.js +4 -2
- package/cascader/index.js +86 -34
- package/cascader/vue.js +61 -20
- package/cascader-menu/index.js +7 -7
- package/cascader-menu/vue.js +2 -3
- package/cascader-mobile/index.js +36 -23
- package/cascader-mobile/vue.js +6 -0
- 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/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 +18 -1
- package/checkbox/vue.js +15 -7
- package/checkbox-group/vue.js +1 -0
- package/col/vue.js +1 -1
- 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 +7 -5
- package/common/deps/clickoutside.js +6 -2
- package/common/deps/dom.js +19 -4
- package/common/deps/popper.js +44 -11
- package/common/deps/resize-event.js +1 -0
- package/common/deps/touch-emulator.js +4 -1
- package/common/deps/tree-model/node.js +2 -2
- package/common/deps/tree-model/tree-store.js +2 -13
- package/common/deps/useRect.js +25 -0
- package/common/deps/vue-popper.js +38 -20
- package/common/index.js +2 -2
- package/common/runtime.js +1 -1
- package/common/string.js +2 -2
- 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/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 +14 -6
- package/date-table/index.js +5 -0
- package/date-table/vue.js +3 -1
- package/dialog-box/index.js +46 -14
- package/dialog-box/vue.js +30 -7
- package/dialog-select/index.js +6 -3
- package/dialog-select/vue.js +8 -4
- package/drawer/index.js +27 -5
- package/drawer/vue.js +14 -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 +20 -7
- 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 +68 -18
- package/file-upload/vue.js +38 -8
- package/filter-box/index.js +1 -0
- package/float-button/index.js +42 -0
- package/float-button/vue.js +101 -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 +8 -0
- package/form-item/index.js +5 -5
- package/form-item/vue.js +3 -1
- package/fullscreen/index.js +5 -5
- package/fullscreen/vue.js +3 -3
- package/grid/plugins/export.js +5 -2
- package/grid/utils/column.js +1 -0
- package/grid/utils/dom.js +7 -1
- package/image/index.js +6 -1
- package/image/vue.js +6 -3
- package/image-viewer/index.js +62 -51
- package/image-viewer/vue.js +17 -5
- package/input/index.js +81 -20
- package/input/vue.js +44 -18
- package/ip-address/index.js +61 -19
- package/ip-address/vue.js +22 -4
- package/link/vue.js +3 -1
- package/loading/index.js +2 -2
- package/loading/vue.js +8 -2
- package/logout/index.js +1 -1
- package/menu/index.js +15 -2
- package/menu/vue.js +22 -17
- package/mind-map/index.js +47 -0
- package/mind-map/vue.js +53 -0
- package/modal/index.js +44 -4
- package/modal/vue.js +18 -4
- package/multi-select/index.js +186 -11
- package/multi-select/vue.js +60 -15
- package/multi-select-item/index.js +23 -0
- package/multi-select-item/vue.js +31 -0
- package/numeric/index.js +46 -12
- package/numeric/vue.js +44 -19
- package/option/index.js +27 -9
- package/option/vue.js +37 -21
- package/option-group/index.js +3 -3
- package/package.json +1 -1
- package/pager/index.js +18 -4
- package/pager/vue.js +16 -5
- package/picker/index.js +258 -49
- package/picker/mb.js +42 -0
- package/picker/vue.js +70 -17
- package/picker-column/index.js +1 -1
- package/pop-upload/vue.js +3 -0
- package/popconfirm/index.js +3 -6
- package/popconfirm/vue.js +1 -1
- package/popeditor/index.js +71 -32
- 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 +13 -13
- package/pull-refresh/vue.js +5 -4
- 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/clipboard.js +54 -0
- package/rich-text/index.js +192 -0
- package/rich-text/module/file-upload.js +107 -0
- package/rich-text/module/image-drop.js +63 -0
- package/rich-text/module/image-upload.js +89 -0
- package/rich-text/options.js +141 -0
- package/rich-text/table-module.js +382 -0
- package/rich-text/vue.js +102 -0
- 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 +9 -9
- package/search/vue.js +8 -6
- package/select/index.js +457 -389
- package/select/vue.js +257 -161
- package/select-dropdown/index.js +61 -3
- package/select-dropdown/vue.js +85 -8
- package/select-view/index.js +3 -1
- package/selected-box/index.js +2 -0
- package/selected-box/vue.js +6 -3
- 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 +70 -17
- package/slider/vue.js +16 -7
- package/split/index.js +5 -3
- 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 +30 -5
- package/tab-nav/vue.js +16 -4
- package/tabbar/vue.js +9 -3
- package/tabbar-item/vue.js +3 -2
- package/tabs/index.js +16 -4
- package/tabs/vue.js +2 -1
- package/tabs-mf/index.js +20 -6
- package/tabs-mf/vue-nav.js +26 -11
- package/tabs-mf/vue.js +7 -7
- package/tabs-mf/wheel.js +1 -0
- package/tag/index.js +1 -1
- package/tag-group/index.js +2 -1
- package/time/index.js +5 -2
- package/time/vue.js +1 -1
- package/time-line/index.js +3 -3
- package/time-line/vue.js +2 -2
- package/time-picker-mobile/index.js +24 -5
- package/time-picker-mobile/vue.js +17 -7
- package/time-range/index.js +2 -0
- package/timeline-item/vue.js +1 -1
- package/tooltip/index.js +6 -3
- package/tooltip/vue.js +4 -4
- 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 +31 -5
- package/tree-menu/vue.js +28 -15
- package/tree-node/index.js +18 -18
- package/tree-node/vue.js +6 -5
- package/types/action-sheet.type.d.ts +118 -1
- package/types/alert.type.d.ts +1 -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-group.type.d.ts +3 -3
- package/types/button.type.d.ts +4 -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 +329 -1
- package/types/checkbox.type.d.ts +9 -3
- package/types/collapse.type.d.ts +20 -3
- package/types/date-picker.type.d.ts +37 -0
- package/types/dialog-box.type.d.ts +13 -3
- package/types/drawer.type.d.ts +133 -1
- package/types/{dropdown-item.type-8ea6c633.d.ts → dropdown-item.type-8475a549.d.ts} +7 -13
- package/types/dropdown-item.type.d.ts +1 -1
- package/types/dropdown-menu.type.d.ts +1 -1
- package/types/dropdown.type.d.ts +1 -5
- package/types/fall-menu.type.d.ts +94 -1
- package/types/file-upload.type.d.ts +1 -1
- package/types/float-button.type.d.ts +123 -0
- package/types/form-item.type.d.ts +1 -1
- package/types/{form.type-d0fd42f3.d.ts → form.type-222799ae.d.ts} +5 -2
- package/types/form.type.d.ts +1 -1
- package/types/{index-e0250f63.d.ts → index-b012f687.d.ts} +9 -0
- package/types/input.type.d.ts +1 -5
- package/types/ip-address.type.d.ts +160 -1
- package/types/link.type.d.ts +6 -3
- package/types/loading.type.d.ts +7 -0
- package/types/milestone.type.d.ts +1 -1
- package/types/mind-map.type.d.ts +20 -0
- package/types/modal.type.d.ts +29 -2
- package/types/numeric.type.d.ts +41 -10
- package/types/pager.type.d.ts +13 -1
- package/types/picker.type.d.ts +18 -0
- package/types/popconfirm.type.d.ts +86 -1
- package/types/popeditor.type.d.ts +5 -1
- package/types/popover.type.d.ts +3 -3
- package/types/progress.type.d.ts +3 -1
- 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 +49 -10
- package/types/steps.type.d.ts +15 -4
- package/types/switch.type.d.ts +3 -3
- package/types/tab-bar.type.d.ts +1 -1
- package/types/tab-nav.type.d.ts +7 -2
- package/types/tabs.type.d.ts +9 -1
- package/types/tag-group.type.d.ts +64 -1
- package/types/{time-line.type-d7daa669.d.ts → time-line.type-b155cb4f.d.ts} +12 -0
- package/types/time-line.type.d.ts +1 -1
- package/types/timeline-item.type.d.ts +1 -1
- package/types/tooltip.type.d.ts +2 -2
- package/types/transfer.type.d.ts +185 -1
- package/types/tree-menu.type.d.ts +210 -1
- package/types/upload-dragger.type.d.ts +2 -2
- package/types/{upload-list.type-343e8c11.d.ts → upload-list.type-a29aea50.d.ts} +31 -8
- package/types/upload-list.type.d.ts +1 -1
- package/types/upload.type.d.ts +1 -1
- package/types/user-head.type.d.ts +146 -1
- package/types/wizard.type.d.ts +1 -0
- package/upload/index.js +64 -34
- package/upload/vue.js +9 -5
- package/upload-dragger/index.js +22 -20
- package/upload-list/index.js +24 -18
- package/upload-list/vue.js +9 -4
- package/user/index.js +34 -25
- package/user/vue.js +1 -1
- package/user-head/index.js +3 -3
- package/watermark/index.js +11 -0
- package/wheel/index.js +3 -0
- package/wizard/vue.js +4 -2
- package/common/deps/modal-queue.js +0 -6
- package/common/deps/requestAnimationFrame.js +0 -25
package/select/vue.js
CHANGED
|
@@ -22,7 +22,9 @@ import {
|
|
|
22
22
|
scrollToOption,
|
|
23
23
|
handleMenuEnter,
|
|
24
24
|
emitChange,
|
|
25
|
+
directEmitChange,
|
|
25
26
|
getOption,
|
|
27
|
+
getSelectedOption,
|
|
26
28
|
setSelected,
|
|
27
29
|
handleFocus,
|
|
28
30
|
focus,
|
|
@@ -37,6 +39,7 @@ import {
|
|
|
37
39
|
resetInputState,
|
|
38
40
|
resetInputHeight,
|
|
39
41
|
resetHoverIndex,
|
|
42
|
+
resetDatas,
|
|
40
43
|
handleOptionSelect,
|
|
41
44
|
setSoftFocus,
|
|
42
45
|
getValueIndex,
|
|
@@ -49,8 +52,11 @@ import {
|
|
|
49
52
|
resetInputWidth,
|
|
50
53
|
handleResize,
|
|
51
54
|
checkDefaultFirstOption,
|
|
55
|
+
setOptionHighlight,
|
|
52
56
|
getValueKey,
|
|
53
57
|
emptyText,
|
|
58
|
+
emptyFlag,
|
|
59
|
+
recycleScrollerHeight,
|
|
54
60
|
watchValue,
|
|
55
61
|
watchVisible,
|
|
56
62
|
watchOptions,
|
|
@@ -64,6 +70,7 @@ import {
|
|
|
64
70
|
onCopying,
|
|
65
71
|
gridOnQueryChange,
|
|
66
72
|
defaultOnQueryChange,
|
|
73
|
+
queryChange,
|
|
67
74
|
toVisible,
|
|
68
75
|
toHide,
|
|
69
76
|
mounted,
|
|
@@ -71,7 +78,6 @@ import {
|
|
|
71
78
|
watchHoverIndex,
|
|
72
79
|
computeOptimizeOpts,
|
|
73
80
|
watchOptimizeOpts,
|
|
74
|
-
getScrollListener,
|
|
75
81
|
computeCollapseTags,
|
|
76
82
|
computeMultipleLimit,
|
|
77
83
|
handleDropdownClick,
|
|
@@ -95,13 +101,12 @@ import {
|
|
|
95
101
|
watchInitValue,
|
|
96
102
|
watchShowClose,
|
|
97
103
|
loadTreeData,
|
|
98
|
-
|
|
104
|
+
getOptionIndexArr,
|
|
105
|
+
queryVisibleOptions,
|
|
99
106
|
computedGetIcon,
|
|
100
107
|
computedGetTagType,
|
|
101
|
-
|
|
102
|
-
clearNoMatchValue
|
|
103
|
-
debouncedQueryChange,
|
|
104
|
-
handleDebouncedQueryChange
|
|
108
|
+
clearSearchText,
|
|
109
|
+
clearNoMatchValue
|
|
105
110
|
} from "./index";
|
|
106
111
|
import debounce from "../common/deps/debounce";
|
|
107
112
|
import { isNumber } from "../common/type";
|
|
@@ -131,6 +136,7 @@ const api = [
|
|
|
131
136
|
"resetInputHeight",
|
|
132
137
|
"managePlaceholder",
|
|
133
138
|
"checkDefaultFirstOption",
|
|
139
|
+
"setOptionHighlight",
|
|
134
140
|
"toggleLastOptionHitState",
|
|
135
141
|
"deleteTag",
|
|
136
142
|
"setSelected",
|
|
@@ -161,64 +167,17 @@ const api = [
|
|
|
161
167
|
"handleEnterTag",
|
|
162
168
|
"getLabelSlotValue",
|
|
163
169
|
"loadTreeData",
|
|
164
|
-
"
|
|
165
|
-
"
|
|
170
|
+
"updateModelValue",
|
|
171
|
+
"clearSearchText"
|
|
166
172
|
];
|
|
167
|
-
const
|
|
168
|
-
selectedTags: [],
|
|
169
|
-
tips: "",
|
|
170
|
-
showTip: false,
|
|
171
|
-
tipHover: false,
|
|
172
|
-
selectHover: false,
|
|
173
|
-
tipTimer: null,
|
|
174
|
-
selectCls: "checked-sur",
|
|
175
|
-
overflow: null,
|
|
176
|
-
completed: false,
|
|
177
|
-
inputWidth: 0,
|
|
178
|
-
inputPaddingRight: 0,
|
|
179
|
-
hoverIndex: -1,
|
|
180
|
-
hoverOption: -1,
|
|
181
|
-
inputLength: 20,
|
|
182
|
-
optionsCount: 0,
|
|
183
|
-
selectFiexd: {},
|
|
184
|
-
createdLabel: null,
|
|
185
|
-
isSilentBlur: false,
|
|
186
|
-
cachedOptions: [],
|
|
187
|
-
selectedLabel: "",
|
|
188
|
-
previousQuery: null,
|
|
189
|
-
inputHovering: false,
|
|
190
|
-
createdSelected: false,
|
|
191
|
-
isOnComposition: false,
|
|
192
|
-
cachedPlaceHolder: props.placeholder,
|
|
193
|
-
inputHeight: 0,
|
|
194
|
-
initialInputHeight: 28,
|
|
195
|
-
currentPlaceholder: props.placeholder,
|
|
196
|
-
filteredOptionsCount: 0,
|
|
197
|
-
gridData: [],
|
|
198
|
-
treeData: [],
|
|
199
|
-
remoteData: [],
|
|
200
|
-
currentKey: props.modelValue,
|
|
201
|
-
updateId: "",
|
|
202
|
-
popperElm: null,
|
|
203
|
-
debounce: computed(() => isNumber(props.queryDebounce) ? props.queryDebounce : props.remote ? 300 : 0),
|
|
204
|
-
emptyText: computed(() => api2.emptyText()),
|
|
205
|
-
formItemSize: computed(() => (parent.formItem || {}).formItemSize),
|
|
206
|
-
selectDisabled: computed(() => api2.computedSelectDisabled()),
|
|
207
|
-
isDisplayOnly: computed(() => props.displayOnly || (parent.form || {}).displayOnly),
|
|
208
|
-
gridCheckedData: computed(() => api2.getcheckedData()),
|
|
209
|
-
isExpandAll: computed(() => api2.computedIsExpandAll()),
|
|
210
|
-
searchSingleCopy: computed(() => props.allowCopy && !props.multiple && props.filterable),
|
|
211
|
-
tooltipContent: {},
|
|
212
|
-
isHidden: false,
|
|
213
|
-
defaultCheckedKeys: [],
|
|
214
|
-
filterOrSearch: computed(() => props.filterable || props.searchable)
|
|
215
|
-
});
|
|
216
|
-
const initState = ({ reactive, computed, props, api: api2, emitter, parent, constants, designConfig }) => {
|
|
173
|
+
const initState = ({ reactive, computed, props, api: api2, emitter, parent, constants, useBreakpoint, vm }) => {
|
|
217
174
|
const stateAdd = initStateAdd({ computed, props, api: api2, parent });
|
|
218
175
|
const state = reactive(__spreadProps(__spreadValues({}, stateAdd), {
|
|
219
176
|
selectEmitter: emitter(),
|
|
220
177
|
datas: [],
|
|
178
|
+
initDatas: [],
|
|
221
179
|
query: "",
|
|
180
|
+
magicKey: 0,
|
|
222
181
|
options: [],
|
|
223
182
|
visible: false,
|
|
224
183
|
showCopy: computed(() => api2.computedShowCopy()),
|
|
@@ -227,6 +186,7 @@ const initState = ({ reactive, computed, props, api: api2, emitter, parent, cons
|
|
|
227
186
|
selected: props.multiple ? [] : {},
|
|
228
187
|
softFocus: false,
|
|
229
188
|
hover: false,
|
|
189
|
+
triggerSearch: false,
|
|
230
190
|
firstAutoSearch: props.remoteConfig.autoSearch,
|
|
231
191
|
tagsStyle: computed(() => api2.computedTagsStyle()),
|
|
232
192
|
readonly: computed(() => api2.computedReadonly()),
|
|
@@ -237,69 +197,90 @@ const initState = ({ reactive, computed, props, api: api2, emitter, parent, cons
|
|
|
237
197
|
showNewOption: computed(() => api2.computedShowNewOption()),
|
|
238
198
|
selectSize: computed(() => props.size || state.formItemSize),
|
|
239
199
|
optimizeOpts: computed(() => api2.computeOptimizeOpts()),
|
|
240
|
-
optimizeStore: {
|
|
200
|
+
optimizeStore: { valueIndex: 0, recycleScrollerHeight: computed(() => api2.recycleScrollerHeight()) },
|
|
241
201
|
collapseTags: computed(() => api2.computeCollapseTags()),
|
|
242
202
|
multipleLimit: computed(() => api2.computeMultipleLimit()),
|
|
243
203
|
disabledTooltipContent: computed(() => api2.computedDisabledTooltipContent()),
|
|
204
|
+
isExpand: computed(() => (state.selectHover || state.visible) && props.hoverExpand && !props.disabled),
|
|
244
205
|
collapseTagsLength: 0,
|
|
245
206
|
initValue: [],
|
|
246
207
|
key: 0,
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
208
|
+
device: "",
|
|
209
|
+
timer: null,
|
|
210
|
+
modelValue: [],
|
|
211
|
+
queryValue: "",
|
|
212
|
+
selectedCopy: [],
|
|
213
|
+
compareValue: null,
|
|
214
|
+
selectedVal: computed(
|
|
215
|
+
() => state.device === "mb" && props.multiple && state.visible ? state.selectedCopy : state.selected
|
|
216
|
+
),
|
|
217
|
+
displayOnlyContent: computed(
|
|
218
|
+
() => props.multiple && Array.isArray(state.selected) ? state.selected.map((item) => item.state ? item.state.currentLabel : item.currentLabel).join("; ") : ""
|
|
219
|
+
),
|
|
220
|
+
breakpoint: useBreakpoint ? useBreakpoint().current : "",
|
|
221
|
+
isSaaSTheme: vm.theme === "saas",
|
|
222
|
+
disabledOptionHover: false,
|
|
223
|
+
hasClearSelection: false,
|
|
224
|
+
// tiny 新增
|
|
225
|
+
getIcon: computed(() => api2.computedGetIcon()),
|
|
250
226
|
getTagType: computed(() => api2.computedGetTagType()),
|
|
251
|
-
|
|
227
|
+
isSelectAll: computed(() => state.selectCls === "checked-sur")
|
|
252
228
|
}));
|
|
253
229
|
return state;
|
|
254
230
|
};
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
231
|
+
const initStateAdd = ({ computed, props, api: api2, parent }) => {
|
|
232
|
+
return {
|
|
233
|
+
selectedTags: [],
|
|
234
|
+
tips: "",
|
|
235
|
+
showTip: false,
|
|
236
|
+
tipHover: false,
|
|
237
|
+
selectHover: false,
|
|
238
|
+
tipTimer: null,
|
|
239
|
+
selectCls: "checked-sur",
|
|
240
|
+
filteredSelectCls: "checked-sur",
|
|
241
|
+
overflow: null,
|
|
242
|
+
completed: false,
|
|
243
|
+
inputWidth: 0,
|
|
244
|
+
inputPaddingRight: 0,
|
|
245
|
+
hoverIndex: -1,
|
|
246
|
+
hoverValue: -1,
|
|
247
|
+
optionsIndex: -1,
|
|
248
|
+
inputLength: 20,
|
|
249
|
+
optionsCount: 0,
|
|
250
|
+
selectFiexd: {},
|
|
251
|
+
createdLabel: null,
|
|
252
|
+
isSilentBlur: false,
|
|
253
|
+
cachedOptions: [],
|
|
254
|
+
selectedLabel: "",
|
|
255
|
+
previousQuery: null,
|
|
256
|
+
inputHovering: false,
|
|
257
|
+
createdSelected: false,
|
|
258
|
+
isOnComposition: false,
|
|
259
|
+
cachedPlaceHolder: props.placeholder,
|
|
260
|
+
inputHeight: 0,
|
|
261
|
+
initialInputHeight: 0,
|
|
262
|
+
currentPlaceholder: props.placeholder,
|
|
263
|
+
filteredOptionsCount: 0,
|
|
264
|
+
gridData: [],
|
|
265
|
+
treeData: [],
|
|
266
|
+
remoteData: [],
|
|
267
|
+
currentKey: props.modelValue,
|
|
268
|
+
updateId: "",
|
|
269
|
+
popperElm: null,
|
|
270
|
+
debounce: computed(() => isNumber(props.queryDebounce) ? props.queryDebounce : props.remote ? 300 : 0),
|
|
271
|
+
emptyText: computed(() => api2.emptyText()),
|
|
272
|
+
emptyFlag: computed(() => api2.emptyFlag()),
|
|
273
|
+
formItemSize: computed(() => (parent.formItem || { state: {} }).state.formItemSize),
|
|
274
|
+
selectDisabled: computed(() => api2.computedSelectDisabled()),
|
|
275
|
+
isDisplayOnly: computed(() => props.displayOnly || (parent.form || {}).displayOnly),
|
|
276
|
+
gridCheckedData: computed(() => api2.getcheckedData()),
|
|
277
|
+
isExpandAll: computed(() => api2.computedIsExpandAll()),
|
|
278
|
+
searchSingleCopy: computed(() => props.allowCopy && !props.multiple && props.filterable),
|
|
279
|
+
tooltipContent: {},
|
|
280
|
+
isHidden: false,
|
|
281
|
+
defaultCheckedKeys: [],
|
|
282
|
+
optionIndexArr: []
|
|
283
|
+
};
|
|
303
284
|
};
|
|
304
285
|
const initApi = ({
|
|
305
286
|
api: api2,
|
|
@@ -313,6 +294,7 @@ const initApi = ({
|
|
|
313
294
|
dispatch,
|
|
314
295
|
t,
|
|
315
296
|
vm,
|
|
297
|
+
isMobileFirstMode,
|
|
316
298
|
designConfig
|
|
317
299
|
}) => {
|
|
318
300
|
Object.assign(api2, {
|
|
@@ -326,28 +308,36 @@ const initApi = ({
|
|
|
326
308
|
handleClose: handleClose(state),
|
|
327
309
|
getValueIndex: getValueIndex(props),
|
|
328
310
|
getChildValue: getChildValue(),
|
|
329
|
-
getOption: getOption({ props, state }),
|
|
311
|
+
getOption: getOption({ props, state, api: api2 }),
|
|
312
|
+
getSelectedOption: getSelectedOption({ props, state }),
|
|
330
313
|
emitChange: emitChange({ emit, props, state, constants }),
|
|
331
|
-
|
|
314
|
+
directEmitChange: directEmitChange({ emit, props, state, constants }),
|
|
315
|
+
toggleMenu: toggleMenu({ vm, state, props, api: api2, isMobileFirstMode }),
|
|
332
316
|
showTip: showTip({ props, state, vm }),
|
|
333
317
|
onOptionDestroy: onOptionDestroy(state),
|
|
334
318
|
setSoftFocus: setSoftFocus({ vm, state }),
|
|
335
319
|
getcheckedData: getcheckedData({ props, state }),
|
|
336
320
|
resetInputWidth: resetInputWidth({ vm, state }),
|
|
337
321
|
resetHoverIndex: resetHoverIndex({ props, state }),
|
|
322
|
+
resetDatas: resetDatas({ props, state }),
|
|
338
323
|
scrollToOption: scrollToOption({ vm, constants }),
|
|
339
324
|
selectChange: selectChange({ emit, props, vm, state, api: api2 }),
|
|
340
|
-
radioChange: radioChange({ emit, props, state, api: api2 }),
|
|
325
|
+
radioChange: radioChange({ emit, props, state, api: api2, vm }),
|
|
341
326
|
handleCopyClick: handleCopyClick({ parent, props, state }),
|
|
342
327
|
treeNodeClick: treeNodeClick({ emit, props, state, api: api2, vm }),
|
|
343
328
|
managePlaceholder: managePlaceholder({ vm, state }),
|
|
344
329
|
nodeCheckClick: nodeCheckClick({ emit, props, state, api: api2 }),
|
|
345
330
|
checkDefaultFirstOption: checkDefaultFirstOption(state),
|
|
331
|
+
setOptionHighlight: setOptionHighlight(state),
|
|
346
332
|
nodeExpand: nodeExpand({ state, constants, nextTick }),
|
|
347
333
|
nodeCollapse: nodeCollapse({ state, constants, nextTick }),
|
|
348
334
|
handleBlur: handleBlur({ constants, dispatch, emit, state }),
|
|
349
335
|
toggleLastOptionHitState: toggleLastOptionHitState({ state }),
|
|
350
|
-
emptyText: emptyText({ I18N: constants.I18N, props, state, t }),
|
|
336
|
+
emptyText: emptyText({ I18N: constants.I18N, props, state, t, isMobileFirstMode }),
|
|
337
|
+
emptyFlag: emptyFlag({ props, state }),
|
|
338
|
+
getOptionIndexArr: getOptionIndexArr({ props, state, api: api2 }),
|
|
339
|
+
queryVisibleOptions: queryVisibleOptions({ props, vm, isMobileFirstMode }),
|
|
340
|
+
recycleScrollerHeight: recycleScrollerHeight({ state, props, recycle: constants.RECYCLE }),
|
|
351
341
|
watchPropsOption: watchPropsOption({ constants, parent, props, state }),
|
|
352
342
|
buildSelectConfig: buildSelectConfig({ props, state }),
|
|
353
343
|
buildRadioConfig: buildRadioConfig({ props, state }),
|
|
@@ -356,13 +346,12 @@ const initApi = ({
|
|
|
356
346
|
onCopying: onCopying({ state, vm }),
|
|
357
347
|
gridOnQueryChange: gridOnQueryChange({ props, vm, constants, state }),
|
|
358
348
|
watchHoverIndex: watchHoverIndex({ state }),
|
|
359
|
-
computeOptimizeOpts: computeOptimizeOpts({ props,
|
|
360
|
-
getScrollListener: getScrollListener({ props, vm, state }),
|
|
349
|
+
computeOptimizeOpts: computeOptimizeOpts({ props, designConfig }),
|
|
361
350
|
computeCollapseTags: computeCollapseTags(props),
|
|
362
351
|
computeMultipleLimit: computeMultipleLimit({ props, state }),
|
|
363
352
|
watchInputHover: watchInputHover({ vm }),
|
|
364
353
|
initQuery: initQuery({ props, state, constants, vm }),
|
|
365
|
-
updateModelValue: updateModelValue({ emit, state }),
|
|
354
|
+
updateModelValue: updateModelValue({ props, emit, state }),
|
|
366
355
|
computedTagsStyle: computedTagsStyle({ props, parent, state }),
|
|
367
356
|
computedReadonly: computedReadonly({ props, state }),
|
|
368
357
|
computedShowClose: computedShowClose({ props, state }),
|
|
@@ -374,49 +363,84 @@ const initApi = ({
|
|
|
374
363
|
computedSelectDisabled: computedSelectDisabled({ props, parent }),
|
|
375
364
|
computedIsExpandAll: computedIsExpandAll(props),
|
|
376
365
|
watchInitValue: watchInitValue({ props, emit }),
|
|
377
|
-
watchShowClose: watchShowClose({ nextTick, state, parent })
|
|
366
|
+
watchShowClose: watchShowClose({ nextTick, state, parent }),
|
|
367
|
+
// tiny 新增
|
|
368
|
+
computedGetIcon: computedGetIcon({ designConfig, props }),
|
|
369
|
+
computedGetTagType: computedGetTagType({ designConfig, props }),
|
|
370
|
+
clearSearchText: clearSearchText({ state, api: api2 }),
|
|
371
|
+
clearNoMatchValue: clearNoMatchValue({ props, emit })
|
|
378
372
|
});
|
|
379
|
-
addApi({ api: api2, props, state, emit, constants, parent, nextTick, dispatch, vm, designConfig });
|
|
373
|
+
addApi({ api: api2, props, state, emit, constants, parent, nextTick, dispatch, vm, isMobileFirstMode, designConfig });
|
|
380
374
|
};
|
|
381
|
-
const
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
(
|
|
398
|
-
(
|
|
399
|
-
|
|
375
|
+
const addApi = ({
|
|
376
|
+
api: api2,
|
|
377
|
+
props,
|
|
378
|
+
state,
|
|
379
|
+
emit,
|
|
380
|
+
constants,
|
|
381
|
+
parent,
|
|
382
|
+
nextTick,
|
|
383
|
+
dispatch,
|
|
384
|
+
vm,
|
|
385
|
+
isMobileFirstMode,
|
|
386
|
+
designConfig
|
|
387
|
+
}) => {
|
|
388
|
+
Object.assign(api2, {
|
|
389
|
+
resetInputHeight: resetInputHeight({ api: api2, constants, nextTick, props, vm, state, designConfig }),
|
|
390
|
+
calcOverFlow: calcOverFlow({ vm, props, state }),
|
|
391
|
+
handleFocus: handleFocus({ api: api2, emit, props, state }),
|
|
392
|
+
deleteTag: deleteTag({ api: api2, constants, emit, props, vm, nextTick, state }),
|
|
393
|
+
watchValue: watchValue({ api: api2, constants, dispatch, props, vm, state }),
|
|
394
|
+
toHide: toHide({ constants, state, props, vm, api: api2 }),
|
|
395
|
+
toVisible: toVisible({ constants, state, props, vm, api: api2, nextTick }),
|
|
396
|
+
setSelected: setSelected({ api: api2, constants, nextTick, props, vm, state }),
|
|
397
|
+
selectOption: selectOption({ api: api2, state, props }),
|
|
398
|
+
handleResize: handleResize({ api: api2, props, state }),
|
|
399
|
+
watchOptions: watchOptions({ api: api2, constants, nextTick, parent, props, state, vm }),
|
|
400
|
+
watchVisible: watchVisible({ api: api2, constants, emit, state, vm, props, isMobileFirstMode }),
|
|
401
|
+
deletePrevTag: deletePrevTag({ api: api2, constants, props, state, vm }),
|
|
402
|
+
onInputChange: onInputChange({ api: api2, props, state, constants, nextTick }),
|
|
403
|
+
deleteSelected: deleteSelected({ api: api2, constants, emit, props, vm, state }),
|
|
404
|
+
handleMenuEnter: handleMenuEnter({ api: api2, nextTick, state, props }),
|
|
405
|
+
resetInputState: resetInputState({ api: api2, vm, state }),
|
|
406
|
+
navigateOptions: navigateOptions({ api: api2, state, props, nextTick }),
|
|
407
|
+
handleClearClick: handleClearClick(api2),
|
|
408
|
+
handleComposition: handleComposition({ api: api2, nextTick, state }),
|
|
409
|
+
handleQueryChange: handleQueryChange({ api: api2, constants, nextTick, props, vm, state }),
|
|
410
|
+
handleOptionSelect: handleOptionSelect({ api: api2, nextTick, props, vm, state }),
|
|
411
|
+
getPluginOption: getPluginOption({ api: api2, props, state }),
|
|
412
|
+
toggleCheckAll: toggleCheckAll({ api: api2, emit, state, props }),
|
|
413
|
+
debouncedQueryChange: debounce(state.debounce, (event) => {
|
|
414
|
+
api2.handleQueryChange(props.shape ? event : event.target.value, false, true);
|
|
415
|
+
}),
|
|
416
|
+
debouncedOnInputChange: debounce(state.debounce, () => {
|
|
417
|
+
api2.onInputChange();
|
|
418
|
+
}),
|
|
419
|
+
debouncRquest: debouncRquest({ api: api2, state, props }),
|
|
420
|
+
defaultOnQueryChange: defaultOnQueryChange({ props, state, constants, api: api2, nextTick, vm }),
|
|
421
|
+
queryChange: queryChange({ props, state, constants, api: api2, nextTick, vm }),
|
|
422
|
+
mounted: mounted({ api: api2, parent, state, props, vm, designConfig }),
|
|
423
|
+
unMount: unMount({ api: api2, parent, vm, state }),
|
|
424
|
+
watchOptimizeOpts: watchOptimizeOpts({ props, state }),
|
|
425
|
+
handleDropdownClick: handleDropdownClick({ emit }),
|
|
426
|
+
handleEnterTag: handleEnterTag({ state }),
|
|
427
|
+
calcCollapseTags: calcCollapseTags({ state, vm }),
|
|
428
|
+
initValue: initValue({ state }),
|
|
429
|
+
getLabelSlotValue: getLabelSlotValue({ props, state }),
|
|
430
|
+
loadTreeData: loadTreeData({ state, vm, props, api: api2 })
|
|
431
|
+
});
|
|
400
432
|
};
|
|
401
433
|
const initWatch = ({ watch, props, api: api2, state, nextTick }) => {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
)
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
watch(
|
|
413
|
-
() => props.gridOp.data,
|
|
414
|
-
(data) => {
|
|
415
|
-
data && (state.gridData = data);
|
|
416
|
-
},
|
|
417
|
-
{ immediate: true, deep: true }
|
|
418
|
-
);
|
|
419
|
-
}
|
|
434
|
+
watch(
|
|
435
|
+
() => props.treeOp.data,
|
|
436
|
+
(data) => data && (state.treeData = data),
|
|
437
|
+
{ immediate: true, deep: true }
|
|
438
|
+
);
|
|
439
|
+
watch(
|
|
440
|
+
() => props.gridOp.data,
|
|
441
|
+
(data) => data && (state.gridData = data),
|
|
442
|
+
{ immediate: true, deep: true }
|
|
443
|
+
);
|
|
420
444
|
watch(
|
|
421
445
|
() => state.selectDisabled,
|
|
422
446
|
() => nextTick(api2.resetInputHeight)
|
|
@@ -427,23 +451,94 @@ const initWatch = ({ watch, props, api: api2, state, nextTick }) => {
|
|
|
427
451
|
state.cachedPlaceHolder = state.currentPlaceholder = value;
|
|
428
452
|
}
|
|
429
453
|
);
|
|
430
|
-
watch(
|
|
454
|
+
watch(
|
|
455
|
+
() => props.modelValue,
|
|
456
|
+
() => {
|
|
457
|
+
if (props.multiple && Array.isArray(props.modelValue)) {
|
|
458
|
+
state.modelValue = [...props.modelValue];
|
|
459
|
+
} else {
|
|
460
|
+
state.modelValue = props.modelValue;
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
{ immediate: true, deep: true }
|
|
464
|
+
);
|
|
465
|
+
watch(() => state.modelValue, api2.watchValue);
|
|
466
|
+
watch(
|
|
467
|
+
() => state.selectedLabel,
|
|
468
|
+
() => {
|
|
469
|
+
if (props.trim) {
|
|
470
|
+
state.selectedLabel = state.selectedLabel.trim();
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
);
|
|
431
474
|
watch(
|
|
432
475
|
() => props.extraQueryParams,
|
|
433
476
|
() => api2.handleQueryChange(state.previousQuery, true),
|
|
434
477
|
{ deep: true }
|
|
435
478
|
);
|
|
479
|
+
watch(
|
|
480
|
+
() => state.breakpoint,
|
|
481
|
+
(val) => {
|
|
482
|
+
if (val === "default") {
|
|
483
|
+
state.device = "mb";
|
|
484
|
+
} else {
|
|
485
|
+
state.device = "pc";
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
{ immediate: true, deep: true }
|
|
489
|
+
);
|
|
490
|
+
watch(
|
|
491
|
+
() => state.device,
|
|
492
|
+
(newVal, oldVal) => {
|
|
493
|
+
if (oldVal !== "" && state.visible) {
|
|
494
|
+
api2.updateModelValue(state.modelValue, true);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
);
|
|
436
498
|
watch(() => state.visible, api2.watchVisible);
|
|
437
499
|
watch(() => state.initValue, api2.watchInitValue, { deep: true });
|
|
438
500
|
addWatch({ watch, props, api: api2, state, nextTick });
|
|
439
501
|
};
|
|
440
|
-
const
|
|
502
|
+
const addWatch = ({ watch, props, api: api2, state, nextTick }) => {
|
|
503
|
+
watch(() => [...state.options], api2.watchOptions);
|
|
504
|
+
if (props.renderType === "grid" && !props.optimization) {
|
|
505
|
+
watch(() => state.gridData, api2.setSelected, { immediate: true });
|
|
506
|
+
}
|
|
507
|
+
if (props.renderType === "tree" && !props.optimization) {
|
|
508
|
+
watch(() => state.treeData, api2.setSelected, { immediate: true });
|
|
509
|
+
}
|
|
510
|
+
watch(() => state.hoverIndex, api2.watchHoverIndex);
|
|
511
|
+
props.options && watch(() => props.options, api2.watchPropsOption, { immediate: true, deep: true });
|
|
512
|
+
props.optimization && watch(() => state.optimizeOpts, api2.watchOptimizeOpts, { immediate: true });
|
|
513
|
+
watch([() => state.inputHovering, () => state.visible], api2.watchInputHover);
|
|
514
|
+
watch(() => state.showClose, api2.watchShowClose, { immediate: true });
|
|
515
|
+
watch(
|
|
516
|
+
() => state.selectHover,
|
|
517
|
+
() => props.hoverExpand && !props.disabled && !state.isDisplayOnly && nextTick(api2.resetInputHeight)
|
|
518
|
+
);
|
|
519
|
+
};
|
|
520
|
+
const renderless = (props, { computed, onBeforeUnmount, onMounted, reactive, watch, provide, inject }, { vm, parent, emit, constants, nextTick, dispatch, t, emitter, isMobileFirstMode, useBreakpoint, designConfig }) => {
|
|
441
521
|
const api2 = {};
|
|
442
|
-
const state = initState({ reactive, computed, props, api: api2, emitter, parent, constants,
|
|
522
|
+
const state = initState({ reactive, computed, props, api: api2, emitter, parent, constants, useBreakpoint, vm });
|
|
523
|
+
const dialog = inject("dialog", null);
|
|
443
524
|
provide("selectEmitter", state.selectEmitter);
|
|
444
525
|
provide("selectVm", vm);
|
|
445
526
|
const maskState = reactive({ width: "", height: "", top: "" });
|
|
446
|
-
initApi({
|
|
527
|
+
initApi({
|
|
528
|
+
api: api2,
|
|
529
|
+
props,
|
|
530
|
+
state,
|
|
531
|
+
emit,
|
|
532
|
+
maskState,
|
|
533
|
+
constants,
|
|
534
|
+
parent,
|
|
535
|
+
nextTick,
|
|
536
|
+
dispatch,
|
|
537
|
+
t,
|
|
538
|
+
vm,
|
|
539
|
+
isMobileFirstMode,
|
|
540
|
+
designConfig
|
|
541
|
+
});
|
|
447
542
|
initWatch({ watch, props, api: api2, state, nextTick });
|
|
448
543
|
onMounted(api2.mounted);
|
|
449
544
|
onBeforeUnmount(api2.unMount);
|
|
@@ -456,6 +551,7 @@ const renderless = (props, { computed, onBeforeUnmount, onMounted, reactive, wat
|
|
|
456
551
|
if (!props.multiple && Array.isArray(props.modelValue)) {
|
|
457
552
|
emit("update:modelValue", "");
|
|
458
553
|
}
|
|
554
|
+
dialog && dialog.state.emitter.on("handleSelectClose", api2.handleClose);
|
|
459
555
|
state.selectEmitter.on(constants.EVENT_NAME.handleOptionClick, api2.handleOptionSelect);
|
|
460
556
|
state.selectEmitter.on(constants.EVENT_NAME.setSelected, api2.setSelected);
|
|
461
557
|
state.selectEmitter.on(constants.EVENT_NAME.initValue, api2.initValue);
|
package/select-dropdown/index.js
CHANGED
|
@@ -1,18 +1,76 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
2
|
const mounted = ({ selectEmitter, constants, state, selectVm, updatePopper, destroyPopper, parent }) => () => {
|
|
3
|
-
selectEmitter.on(constants.EVENT_NAME.updatePopper, () => {
|
|
3
|
+
selectEmitter.on(constants.EVENT_NAME.updatePopper, (keepZIndex) => {
|
|
4
4
|
let hideDrop = false;
|
|
5
5
|
if (!state.referenceElm || state.referenceElm.nodeType !== 1) {
|
|
6
6
|
state.referenceElm = selectVm.$refs.reference ? selectVm.$refs.reference.$el : selectVm.$refs.select;
|
|
7
7
|
selectVm.popperElm = selectVm.state.popperElm = state.popperElm = parent.$el;
|
|
8
8
|
}
|
|
9
9
|
if (parent.select.state.visible && !hideDrop) {
|
|
10
|
-
updatePopper();
|
|
10
|
+
updatePopper(keepZIndex);
|
|
11
11
|
hideDrop = true;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
selectEmitter.on(constants.EVENT_NAME.destroyPopper, destroyPopper);
|
|
15
15
|
};
|
|
16
|
+
const closeModal = ({ selectVm, state, props }) => ($event, isMask) => {
|
|
17
|
+
if (!props.closeByMask && isMask)
|
|
18
|
+
return;
|
|
19
|
+
selectVm.multiple && selectVm.updateModelValue(state.originValue);
|
|
20
|
+
selectVm.state.visible = false;
|
|
21
|
+
selectVm.state.softFocus = false;
|
|
22
|
+
};
|
|
23
|
+
const handleQueryChange = ({ selectVm }) => (value) => {
|
|
24
|
+
selectVm.handleQueryChange(value);
|
|
25
|
+
};
|
|
26
|
+
const toggleSelectedBox = ({ state }) => (show) => {
|
|
27
|
+
if (show) {
|
|
28
|
+
state.selectedArr = state.selected.slice(0);
|
|
29
|
+
state.deletedArr = [];
|
|
30
|
+
}
|
|
31
|
+
state.showSelectedBox = show;
|
|
32
|
+
};
|
|
33
|
+
const deleteSelected = ({ state }) => (option, clear) => {
|
|
34
|
+
if (clear) {
|
|
35
|
+
state.deletedArr = state.selectedArr.slice(0);
|
|
36
|
+
state.selectedArr = [];
|
|
37
|
+
} else {
|
|
38
|
+
state.selectedArr = state.selectedArr.filter((item) => item[state.valueField] !== option[state.valueField]);
|
|
39
|
+
state.deletedArr.push(option);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const selectedBoxConfirm = ({ state, selectVm }) => () => {
|
|
43
|
+
if (state.deletedArr.length) {
|
|
44
|
+
if (state.deletedArr.length === state.selected.length) {
|
|
45
|
+
selectVm.updateModelValue([]);
|
|
46
|
+
} else {
|
|
47
|
+
selectVm.updateModelValue(state.selectedArr.map((item) => item[state.valueField]));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
state.showSelectedBox = false;
|
|
51
|
+
};
|
|
52
|
+
const selectDropdownConfirm = ({ selectVm }) => () => {
|
|
53
|
+
selectVm.multiple && selectVm.updateModelValue(selectVm.state.modelValue, true);
|
|
54
|
+
selectVm.state.visible = false;
|
|
55
|
+
selectVm.state.softFocus = false;
|
|
56
|
+
selectVm.$emit("confirm", selectVm.state.modelValue);
|
|
57
|
+
selectVm.emitChange(selectVm.state.modelValue, true);
|
|
58
|
+
};
|
|
59
|
+
const cancelSearch = ({ api, state }) => () => {
|
|
60
|
+
state.query = "";
|
|
61
|
+
api.debouncedQueryChange("");
|
|
62
|
+
};
|
|
63
|
+
const handleClear = ({ selectVm }) => () => {
|
|
64
|
+
selectVm.deleteSelected();
|
|
65
|
+
};
|
|
16
66
|
export {
|
|
17
|
-
|
|
67
|
+
cancelSearch,
|
|
68
|
+
closeModal,
|
|
69
|
+
deleteSelected,
|
|
70
|
+
handleClear,
|
|
71
|
+
handleQueryChange,
|
|
72
|
+
mounted,
|
|
73
|
+
selectDropdownConfirm,
|
|
74
|
+
selectedBoxConfirm,
|
|
75
|
+
toggleSelectedBox
|
|
18
76
|
};
|