@opentiny/vue-renderless 3.12.0 → 3.13.0-alpha.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/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/index.js +7 -2
- 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 +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 +185 -113
- 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 +33 -0
- 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/vue.js
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
scrollToOption,
|
|
23
23
|
handleMenuEnter,
|
|
24
24
|
emitChange,
|
|
25
|
+
directEmitChange,
|
|
25
26
|
getOption,
|
|
26
27
|
setSelected,
|
|
27
28
|
handleFocus,
|
|
@@ -49,6 +50,7 @@ import {
|
|
|
49
50
|
resetInputWidth,
|
|
50
51
|
handleResize,
|
|
51
52
|
checkDefaultFirstOption,
|
|
53
|
+
setOptionHighlight,
|
|
52
54
|
getValueKey,
|
|
53
55
|
emptyText,
|
|
54
56
|
watchValue,
|
|
@@ -95,11 +97,11 @@ import {
|
|
|
95
97
|
watchInitValue,
|
|
96
98
|
watchShowClose,
|
|
97
99
|
loadTreeData,
|
|
98
|
-
resetFilter,
|
|
99
100
|
computedGetIcon,
|
|
100
101
|
computedGetTagType,
|
|
101
102
|
computedShowDropdownIcon,
|
|
102
|
-
clearNoMatchValue
|
|
103
|
+
clearNoMatchValue,
|
|
104
|
+
resetFilter
|
|
103
105
|
} from "./index";
|
|
104
106
|
import debounce from "../common/deps/debounce";
|
|
105
107
|
import { isNumber } from "../common/type";
|
|
@@ -129,6 +131,7 @@ const api = [
|
|
|
129
131
|
"resetInputHeight",
|
|
130
132
|
"managePlaceholder",
|
|
131
133
|
"checkDefaultFirstOption",
|
|
134
|
+
"setOptionHighlight",
|
|
132
135
|
"toggleLastOptionHitState",
|
|
133
136
|
"deleteTag",
|
|
134
137
|
"setSelected",
|
|
@@ -159,6 +162,7 @@ const api = [
|
|
|
159
162
|
"handleEnterTag",
|
|
160
163
|
"getLabelSlotValue",
|
|
161
164
|
"loadTreeData",
|
|
165
|
+
"updateModelValue",
|
|
162
166
|
"resetFilter",
|
|
163
167
|
"computedGetIcon"
|
|
164
168
|
];
|
|
@@ -200,7 +204,7 @@ const initStateAdd = ({ computed, props, api: api2, parent }) => ({
|
|
|
200
204
|
popperElm: null,
|
|
201
205
|
debounce: computed(() => isNumber(props.queryDebounce) ? props.queryDebounce : props.remote ? 300 : 0),
|
|
202
206
|
emptyText: computed(() => api2.emptyText()),
|
|
203
|
-
formItemSize: computed(() => (parent.formItem || {}).formItemSize),
|
|
207
|
+
formItemSize: computed(() => (parent.formItem || { state: {} }).state.formItemSize),
|
|
204
208
|
selectDisabled: computed(() => api2.computedSelectDisabled()),
|
|
205
209
|
isDisplayOnly: computed(() => props.displayOnly || (parent.form || {}).displayOnly),
|
|
206
210
|
gridCheckedData: computed(() => api2.getcheckedData()),
|
|
@@ -211,7 +215,7 @@ const initStateAdd = ({ computed, props, api: api2, parent }) => ({
|
|
|
211
215
|
defaultCheckedKeys: [],
|
|
212
216
|
filterOrSearch: computed(() => props.filterable || props.searchable)
|
|
213
217
|
});
|
|
214
|
-
const initState = ({ reactive, computed, props, api: api2, emitter, parent,
|
|
218
|
+
const initState = ({ reactive, computed, props, api: api2, emitter, parent, useBreakpoint }) => {
|
|
215
219
|
const stateAdd = initStateAdd({ computed, props, api: api2, parent });
|
|
216
220
|
const state = reactive(__spreadProps(__spreadValues({}, stateAdd), {
|
|
217
221
|
selectEmitter: emitter(),
|
|
@@ -225,10 +229,10 @@ const initState = ({ reactive, computed, props, api: api2, emitter, parent, cons
|
|
|
225
229
|
selected: props.multiple ? [] : {},
|
|
226
230
|
softFocus: false,
|
|
227
231
|
hover: false,
|
|
232
|
+
triggerSearch: false,
|
|
228
233
|
firstAutoSearch: props.remoteConfig.autoSearch,
|
|
229
234
|
tagsStyle: computed(() => api2.computedTagsStyle()),
|
|
230
235
|
readonly: computed(() => api2.computedReadonly()),
|
|
231
|
-
iconClass: computed(() => state.visible ? "" : constants.CLASS.IsReverse),
|
|
232
236
|
showClose: computed(() => api2.computedShowClose()),
|
|
233
237
|
optionsAllDisabled: computed(() => api2.computedOptionsAllDisabled()),
|
|
234
238
|
collapseTagSize: computed(() => api2.computedCollapseTagSize()),
|
|
@@ -239,18 +243,44 @@ const initState = ({ reactive, computed, props, api: api2, emitter, parent, cons
|
|
|
239
243
|
collapseTags: computed(() => api2.computeCollapseTags()),
|
|
240
244
|
multipleLimit: computed(() => api2.computeMultipleLimit()),
|
|
241
245
|
disabledTooltipContent: computed(() => api2.computedDisabledTooltipContent()),
|
|
246
|
+
isExpand: computed(() => (state.selectHover || state.visible) && props.hoverExpand && !props.disabled),
|
|
242
247
|
collapseTagsLength: 0,
|
|
243
248
|
initValue: [],
|
|
244
249
|
key: 0,
|
|
250
|
+
device: "",
|
|
251
|
+
timer: null,
|
|
252
|
+
modelValue: [],
|
|
253
|
+
queryValue: "",
|
|
254
|
+
selectedCopy: [],
|
|
255
|
+
compareValue: null,
|
|
256
|
+
selectedVal: computed(
|
|
257
|
+
() => state.device === "mb" && props.multiple && state.visible ? state.selectedCopy : state.selected
|
|
258
|
+
),
|
|
259
|
+
displayOnlyContent: computed(
|
|
260
|
+
() => props.multiple && Array.isArray(state.selected) ? state.selected.map((item) => item.state ? item.state.currentLabel : item.currentLabel).join("; ") : ""
|
|
261
|
+
),
|
|
262
|
+
breakpoint: useBreakpoint ? useBreakpoint().current : "",
|
|
245
263
|
isSelectAll: computed(() => state.selectCls === "checked-sur"),
|
|
246
264
|
isHalfSelect: computed(() => state.selectCls === "halfselect"),
|
|
247
|
-
getIcon: computed(() => api2.computedGetIcon(
|
|
265
|
+
getIcon: computed(() => api2.computedGetIcon()),
|
|
248
266
|
getTagType: computed(() => api2.computedGetTagType()),
|
|
249
267
|
isShowDropdownIcon: computed(() => api2.computedShowDropdownIcon())
|
|
250
268
|
}));
|
|
251
269
|
return state;
|
|
252
270
|
};
|
|
253
|
-
const addApi = ({
|
|
271
|
+
const addApi = ({
|
|
272
|
+
api: api2,
|
|
273
|
+
props,
|
|
274
|
+
state,
|
|
275
|
+
emit,
|
|
276
|
+
constants,
|
|
277
|
+
parent,
|
|
278
|
+
nextTick,
|
|
279
|
+
dispatch,
|
|
280
|
+
vm,
|
|
281
|
+
designConfig,
|
|
282
|
+
isMobileFirstMode
|
|
283
|
+
}) => {
|
|
254
284
|
Object.assign(api2, {
|
|
255
285
|
resetInputHeight: resetInputHeight({ api: api2, constants, nextTick, props, vm, state, designConfig }),
|
|
256
286
|
calcOverFlow: calcOverFlow({ vm, props, state }),
|
|
@@ -263,19 +293,19 @@ const addApi = ({ api: api2, props, state, emit, constants, parent, nextTick, di
|
|
|
263
293
|
selectOption: selectOption({ api: api2, state, props }),
|
|
264
294
|
handleResize: handleResize({ api: api2, props, state }),
|
|
265
295
|
watchOptions: watchOptions({ api: api2, constants, nextTick, parent, props, state }),
|
|
266
|
-
watchVisible: watchVisible({ api: api2, constants, emit, state, vm, props }),
|
|
296
|
+
watchVisible: watchVisible({ api: api2, constants, emit, state, vm, props, isMobileFirstMode }),
|
|
267
297
|
deletePrevTag: deletePrevTag({ api: api2, constants, props, state, vm }),
|
|
268
298
|
onInputChange: onInputChange({ api: api2, props, state, constants, nextTick }),
|
|
269
299
|
deleteSelected: deleteSelected({ api: api2, constants, emit, props, vm, state }),
|
|
270
300
|
handleMenuEnter: handleMenuEnter({ api: api2, nextTick, state }),
|
|
271
301
|
resetInputState: resetInputState({ api: api2, vm, state }),
|
|
272
|
-
navigateOptions: navigateOptions({ api: api2, nextTick, state }),
|
|
302
|
+
navigateOptions: navigateOptions({ api: api2, nextTick, state, props }),
|
|
273
303
|
handleClearClick: handleClearClick(api2),
|
|
274
304
|
handleComposition: handleComposition({ api: api2, nextTick, state }),
|
|
275
305
|
handleQueryChange: handleQueryChange({ api: api2, constants, nextTick, props, vm, state }),
|
|
276
306
|
handleOptionSelect: handleOptionSelect({ api: api2, nextTick, props, vm, state }),
|
|
277
307
|
getPluginOption: getPluginOption({ api: api2, props, state }),
|
|
278
|
-
toggleCheckAll: toggleCheckAll({ api: api2,
|
|
308
|
+
toggleCheckAll: toggleCheckAll({ api: api2, state }),
|
|
279
309
|
debouncedQueryChange: debounce(state.debounce, (event) => {
|
|
280
310
|
api2.handleQueryChange(props.shape ? event : event.target.value);
|
|
281
311
|
}),
|
|
@@ -284,7 +314,7 @@ const addApi = ({ api: api2, props, state, emit, constants, parent, nextTick, di
|
|
|
284
314
|
}),
|
|
285
315
|
debouncRquest: debouncRquest({ api: api2, state, props }),
|
|
286
316
|
defaultOnQueryChange: defaultOnQueryChange({ props, state, constants, api: api2 }),
|
|
287
|
-
mounted: mounted({ api: api2, parent, state, props, vm, constants }),
|
|
317
|
+
mounted: mounted({ api: api2, parent, state, props, vm, constants, designConfig }),
|
|
288
318
|
unMount: unMount({ api: api2, parent, vm, state }),
|
|
289
319
|
watchOptimizeOpts: watchOptimizeOpts({ api: api2, props, vm, state }),
|
|
290
320
|
handleDropdownClick: handleDropdownClick({ emit }),
|
|
@@ -312,7 +342,8 @@ const initApi = ({
|
|
|
312
342
|
dispatch,
|
|
313
343
|
t,
|
|
314
344
|
vm,
|
|
315
|
-
designConfig
|
|
345
|
+
designConfig,
|
|
346
|
+
isMobileFirstMode
|
|
316
347
|
}) => {
|
|
317
348
|
Object.assign(api2, {
|
|
318
349
|
state,
|
|
@@ -327,7 +358,8 @@ const initApi = ({
|
|
|
327
358
|
getChildValue: getChildValue(),
|
|
328
359
|
getOption: getOption({ props, state }),
|
|
329
360
|
emitChange: emitChange({ emit, props, state, constants }),
|
|
330
|
-
|
|
361
|
+
directEmitChange: directEmitChange({ emit, props, state, constants }),
|
|
362
|
+
toggleMenu: toggleMenu({ vm, state, props, api: api2, isMobileFirstMode }),
|
|
331
363
|
showTip: showTip({ props, state, vm }),
|
|
332
364
|
onOptionDestroy: onOptionDestroy(state),
|
|
333
365
|
setSoftFocus: setSoftFocus({ vm, state }),
|
|
@@ -342,11 +374,12 @@ const initApi = ({
|
|
|
342
374
|
managePlaceholder: managePlaceholder({ vm, state }),
|
|
343
375
|
nodeCheckClick: nodeCheckClick({ emit, props, state, api: api2 }),
|
|
344
376
|
checkDefaultFirstOption: checkDefaultFirstOption(state),
|
|
377
|
+
setOptionHighlight: setOptionHighlight(state),
|
|
345
378
|
nodeExpand: nodeExpand({ state, constants, nextTick }),
|
|
346
379
|
nodeCollapse: nodeCollapse({ state, constants, nextTick }),
|
|
347
380
|
handleBlur: handleBlur({ constants, dispatch, emit, state }),
|
|
348
381
|
toggleLastOptionHitState: toggleLastOptionHitState({ state }),
|
|
349
|
-
emptyText: emptyText({ I18N: constants.I18N, props, state, t }),
|
|
382
|
+
emptyText: emptyText({ I18N: constants.I18N, props, state, t, isMobileFirstMode }),
|
|
350
383
|
watchPropsOption: watchPropsOption({ constants, parent, props, state }),
|
|
351
384
|
buildSelectConfig: buildSelectConfig({ props, state }),
|
|
352
385
|
buildRadioConfig: buildRadioConfig({ props, state }),
|
|
@@ -361,7 +394,7 @@ const initApi = ({
|
|
|
361
394
|
computeMultipleLimit: computeMultipleLimit({ props, state }),
|
|
362
395
|
watchInputHover: watchInputHover({ vm }),
|
|
363
396
|
initQuery: initQuery({ props, state, constants, vm }),
|
|
364
|
-
updateModelValue: updateModelValue({ emit, state }),
|
|
397
|
+
updateModelValue: updateModelValue({ props, emit, state }),
|
|
365
398
|
computedTagsStyle: computedTagsStyle({ props, parent, state }),
|
|
366
399
|
computedReadonly: computedReadonly({ props, state }),
|
|
367
400
|
computedShowClose: computedShowClose({ props, state }),
|
|
@@ -375,7 +408,7 @@ const initApi = ({
|
|
|
375
408
|
watchInitValue: watchInitValue({ props, emit }),
|
|
376
409
|
watchShowClose: watchShowClose({ nextTick, state, parent })
|
|
377
410
|
});
|
|
378
|
-
addApi({ api: api2, props, state, emit, constants, parent, nextTick, dispatch, vm, designConfig });
|
|
411
|
+
addApi({ api: api2, props, state, emit, constants, parent, nextTick, dispatch, vm, designConfig, isMobileFirstMode });
|
|
379
412
|
};
|
|
380
413
|
const addWatch = ({ watch, props, api: api2, state, nextTick }) => {
|
|
381
414
|
watch(() => [...state.options], api2.watchOptions);
|
|
@@ -426,23 +459,75 @@ const initWatch = ({ watch, props, api: api2, state, nextTick }) => {
|
|
|
426
459
|
state.cachedPlaceHolder = state.currentPlaceholder = value;
|
|
427
460
|
}
|
|
428
461
|
);
|
|
429
|
-
watch(
|
|
462
|
+
watch(
|
|
463
|
+
() => props.modelValue,
|
|
464
|
+
() => {
|
|
465
|
+
if (props.multiple && Array.isArray(props.modelValue)) {
|
|
466
|
+
state.modelValue = [...props.modelValue];
|
|
467
|
+
} else {
|
|
468
|
+
state.modelValue = props.modelValue;
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
{ immediate: true, deep: true }
|
|
472
|
+
);
|
|
473
|
+
watch(() => state.modelValue, api2.watchValue);
|
|
474
|
+
watch(
|
|
475
|
+
() => state.selectedLabel,
|
|
476
|
+
() => {
|
|
477
|
+
if (props.trim) {
|
|
478
|
+
state.selectedLabel = state.selectedLabel.trim();
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
);
|
|
430
482
|
watch(
|
|
431
483
|
() => props.extraQueryParams,
|
|
432
484
|
() => api2.handleQueryChange(state.previousQuery, true),
|
|
433
485
|
{ deep: true }
|
|
434
486
|
);
|
|
487
|
+
watch(
|
|
488
|
+
() => state.breakpoint,
|
|
489
|
+
(val) => {
|
|
490
|
+
if (val === "default") {
|
|
491
|
+
state.device = "mb";
|
|
492
|
+
} else {
|
|
493
|
+
state.device = "pc";
|
|
494
|
+
}
|
|
495
|
+
},
|
|
496
|
+
{ immediate: true, deep: true }
|
|
497
|
+
);
|
|
498
|
+
watch(
|
|
499
|
+
() => state.device,
|
|
500
|
+
(newVal, oldVal) => {
|
|
501
|
+
if (oldVal !== "" && state.visible) {
|
|
502
|
+
api2.updateModelValue(state.modelValue, true);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
);
|
|
435
506
|
watch(() => state.visible, api2.watchVisible);
|
|
436
507
|
watch(() => state.initValue, api2.watchInitValue, { deep: true });
|
|
437
508
|
addWatch({ watch, props, api: api2, state, nextTick });
|
|
438
509
|
};
|
|
439
|
-
const renderless = (props, { computed, onBeforeUnmount, onMounted, reactive, watch, provide }, { vm, parent, emit, constants, nextTick, dispatch, t, emitter, designConfig }) => {
|
|
510
|
+
const renderless = (props, { computed, onBeforeUnmount, onMounted, reactive, watch, provide }, { vm, parent, emit, constants, nextTick, dispatch, t, emitter, isMobileFirstMode, useBreakpoint, designConfig }) => {
|
|
440
511
|
const api2 = {};
|
|
441
|
-
const state = initState({ reactive, computed, props, api: api2, emitter, parent, constants, designConfig });
|
|
512
|
+
const state = initState({ reactive, computed, props, api: api2, emitter, parent, constants, designConfig, useBreakpoint });
|
|
442
513
|
provide("selectEmitter", state.selectEmitter);
|
|
443
514
|
provide("selectVm", vm);
|
|
444
515
|
const maskState = reactive({ width: "", height: "", top: "" });
|
|
445
|
-
initApi({
|
|
516
|
+
initApi({
|
|
517
|
+
api: api2,
|
|
518
|
+
props,
|
|
519
|
+
state,
|
|
520
|
+
emit,
|
|
521
|
+
maskState,
|
|
522
|
+
constants,
|
|
523
|
+
parent,
|
|
524
|
+
nextTick,
|
|
525
|
+
dispatch,
|
|
526
|
+
t,
|
|
527
|
+
vm,
|
|
528
|
+
designConfig,
|
|
529
|
+
isMobileFirstMode
|
|
530
|
+
});
|
|
446
531
|
initWatch({ watch, props, api: api2, state, nextTick });
|
|
447
532
|
onMounted(api2.mounted);
|
|
448
533
|
onBeforeUnmount(api2.unMount);
|
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
|
-
state.referenceElm = selectVm.$refs.reference
|
|
6
|
+
state.referenceElm = selectVm.$refs.reference && selectVm.$refs.reference.$el;
|
|
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
|
};
|
package/select-dropdown/vue.js
CHANGED
|
@@ -1,7 +1,30 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
mounted,
|
|
4
|
+
closeModal,
|
|
5
|
+
handleQueryChange,
|
|
6
|
+
toggleSelectedBox,
|
|
7
|
+
deleteSelected,
|
|
8
|
+
selectedBoxConfirm,
|
|
9
|
+
selectDropdownConfirm,
|
|
10
|
+
cancelSearch,
|
|
11
|
+
handleClear
|
|
12
|
+
} from "./index";
|
|
3
13
|
import userPopper from "../common/deps/vue-popper";
|
|
4
|
-
|
|
14
|
+
import PopupManager from "../common/deps/popup-manager";
|
|
15
|
+
import debounce from "../common/deps/debounce";
|
|
16
|
+
const api = [
|
|
17
|
+
"state",
|
|
18
|
+
"doDestroy",
|
|
19
|
+
"closeModal",
|
|
20
|
+
"debouncedQueryChange",
|
|
21
|
+
"toggleSelectedBox",
|
|
22
|
+
"deleteSelected",
|
|
23
|
+
"selectedBoxConfirm",
|
|
24
|
+
"selectDropdownConfirm",
|
|
25
|
+
"cancelSearch",
|
|
26
|
+
"handleClear"
|
|
27
|
+
];
|
|
5
28
|
const initState = ({ reactive, computed, popper, selectVm }) => {
|
|
6
29
|
const { showPopper, currentPlacement, popperElm, referenceElm } = popper;
|
|
7
30
|
const state = reactive({
|
|
@@ -10,16 +33,43 @@ const initState = ({ reactive, computed, popper, selectVm }) => {
|
|
|
10
33
|
popperElm,
|
|
11
34
|
referenceElm,
|
|
12
35
|
minWidth: "",
|
|
36
|
+
query: "",
|
|
37
|
+
showSelectedBox: false,
|
|
38
|
+
debounce: 300,
|
|
39
|
+
selectedArr: [],
|
|
40
|
+
deletedArr: [],
|
|
41
|
+
originValue: [],
|
|
42
|
+
showClose: computed(() => selectVm.clearable && !selectVm.multiple && selectVm.modelValue !== ""),
|
|
43
|
+
filterable: computed(() => selectVm.filterable),
|
|
13
44
|
multiple: computed(() => selectVm.multiple),
|
|
14
|
-
popperClass: computed(() => selectVm.popperClass)
|
|
45
|
+
popperClass: computed(() => selectVm.popperClass),
|
|
46
|
+
selected: computed(
|
|
47
|
+
() => selectVm.renderType === "tree" && !selectVm.treeOp.checkStrictly ? selectVm.state.selected.filter((item) => !item.children) : selectVm.state.selected
|
|
48
|
+
),
|
|
49
|
+
device: computed(() => selectVm.state.device),
|
|
50
|
+
visible: false,
|
|
51
|
+
windowScrollTop: 0,
|
|
52
|
+
zIndex: 2e3,
|
|
53
|
+
valueField: computed(() => selectVm.renderType === "tree" ? "id" : "value")
|
|
15
54
|
});
|
|
16
55
|
return state;
|
|
17
56
|
};
|
|
18
|
-
const initApi = ({ api: api2, popper, state, selectEmitter, constants, selectVm, parent }) => {
|
|
57
|
+
const initApi = ({ api: api2, popper, state, selectEmitter, constants, selectVm, parent, nextTick, props }) => {
|
|
19
58
|
const { destroyPopper, doDestroy, updatePopper } = popper;
|
|
20
59
|
Object.assign(api2, {
|
|
21
60
|
state,
|
|
22
61
|
doDestroy,
|
|
62
|
+
handleQueryChange: handleQueryChange({ state, selectVm }),
|
|
63
|
+
debouncedQueryChange: debounce(state.debounce, (value) => {
|
|
64
|
+
api2.handleQueryChange(value);
|
|
65
|
+
}),
|
|
66
|
+
toggleSelectedBox: toggleSelectedBox({ state }),
|
|
67
|
+
deleteSelected: deleteSelected({ state }),
|
|
68
|
+
selectedBoxConfirm: selectedBoxConfirm({ state, selectVm, nextTick }),
|
|
69
|
+
selectDropdownConfirm: selectDropdownConfirm({ state, selectVm }),
|
|
70
|
+
closeModal: closeModal({ state, selectVm, props }),
|
|
71
|
+
cancelSearch: cancelSearch({ api: api2, state, selectVm }),
|
|
72
|
+
handleClear: handleClear({ state, selectVm }),
|
|
23
73
|
mounted: mounted({ selectEmitter, constants, state, selectVm, updatePopper, destroyPopper, parent })
|
|
24
74
|
});
|
|
25
75
|
};
|
|
@@ -33,8 +83,35 @@ const initWatch = ({ watch, selectVm, state, nextTick }) => {
|
|
|
33
83
|
},
|
|
34
84
|
{ immediate: true }
|
|
35
85
|
);
|
|
86
|
+
watch(
|
|
87
|
+
() => state.query,
|
|
88
|
+
(val) => {
|
|
89
|
+
selectVm.state.queryValue = val;
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
watch(
|
|
93
|
+
() => selectVm.state.visible,
|
|
94
|
+
(val) => {
|
|
95
|
+
state.query = "";
|
|
96
|
+
setTimeout(() => {
|
|
97
|
+
state.visible = val;
|
|
98
|
+
state.zIndex = PopupManager.nextZIndex();
|
|
99
|
+
}, 0);
|
|
100
|
+
if (val && selectVm.multiple) {
|
|
101
|
+
state.originValue = selectVm.modelValue.slice(0);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
watch(
|
|
106
|
+
() => selectVm.shape,
|
|
107
|
+
() => {
|
|
108
|
+
nextTick(() => {
|
|
109
|
+
state.referenceElm = selectVm.$refs.reference && selectVm.$refs.reference.$el;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
);
|
|
36
113
|
};
|
|
37
|
-
const renderless = (props, { computed, onBeforeUnmount, onDeactivated, onMounted, reactive, toRefs, watch, inject }, { vm, slots, parent, emit, nextTick }) => {
|
|
114
|
+
const renderless = (props, { computed, onBeforeUnmount, onDeactivated, onMounted, reactive, toRefs, watch, inject }, { vm, slots, parent, emit, nextTick, isMobileFirstMode }) => {
|
|
38
115
|
const api2 = {};
|
|
39
116
|
const constants = parent.select._constants;
|
|
40
117
|
const selectEmitter = inject("selectEmitter");
|
|
@@ -51,9 +128,9 @@ const renderless = (props, { computed, onBeforeUnmount, onDeactivated, onMounted
|
|
|
51
128
|
toRefs,
|
|
52
129
|
watch
|
|
53
130
|
});
|
|
54
|
-
const state = initState({ reactive, computed, popper, selectVm });
|
|
55
|
-
initApi({ api: api2, popper, state, selectEmitter, constants, selectVm, parent });
|
|
56
|
-
initWatch({ watch, selectVm, state, nextTick });
|
|
131
|
+
const state = initState({ reactive, computed, popper, props, selectVm });
|
|
132
|
+
initApi({ api: api2, popper, state, selectEmitter, constants, selectVm, parent, nextTick, props, isMobileFirstMode });
|
|
133
|
+
initWatch({ watch, selectVm, state, nextTick, api: api2 });
|
|
57
134
|
onBeforeUnmount(() => {
|
|
58
135
|
popper.destroyPopper("remove");
|
|
59
136
|
state.popperElm = null;
|
package/select-view/index.js
CHANGED
|
@@ -125,7 +125,9 @@ const load = ({ state, props, api }) => () => {
|
|
|
125
125
|
}
|
|
126
126
|
const list = infiniteScroll.load({ input: search.input, options: search.options });
|
|
127
127
|
if (!list) {
|
|
128
|
-
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (typeof list.then === "function") {
|
|
129
131
|
state.search.loading = true;
|
|
130
132
|
list.then((data) => {
|
|
131
133
|
state.search.loading = false;
|