@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.
Files changed (298) hide show
  1. package/action-sheet/index.js +20 -13
  2. package/action-sheet/vue.js +8 -7
  3. package/alert/index.js +50 -1
  4. package/alert/vue.js +36 -9
  5. package/amount/index.js +100 -25
  6. package/amount/vue.js +102 -26
  7. package/anchor/index.js +1 -0
  8. package/area/index.js +8 -8
  9. package/area/vue.js +5 -5
  10. package/async-flowchart/index.js +16 -3
  11. package/autocomplete/index.js +58 -14
  12. package/autocomplete/vue.js +40 -12
  13. package/badge/index.js +12 -0
  14. package/badge/vue.js +6 -4
  15. package/breadcrumb/vue.js +3 -1
  16. package/breadcrumb-item/vue.js +6 -2
  17. package/button/index.js +5 -1
  18. package/calendar/index.js +2 -86
  19. package/calendar-bar/index.js +20 -6
  20. package/calendar-view/index.js +10 -12
  21. package/calendar-view/vue.js +17 -4
  22. package/cascader/index.js +80 -34
  23. package/cascader/vue.js +49 -19
  24. package/cascader-menu/index.js +7 -7
  25. package/cascader-menu/vue.js +2 -3
  26. package/cascader-mobile/index.js +37 -24
  27. package/cascader-mobile/vue.js +7 -1
  28. package/cascader-node/index.js +13 -1
  29. package/cascader-node/vue.js +15 -4
  30. package/cascader-panel/index.js +1 -1
  31. package/cascader-select/column-index.js +150 -0
  32. package/cascader-select/column.js +120 -0
  33. package/cascader-select/index.js +29 -165
  34. package/cascader-select/usePicker.js +251 -0
  35. package/cascader-select/useTouch.js +65 -0
  36. package/cascader-select/vue.js +35 -47
  37. package/cascader-view/index.js +1 -1
  38. package/cell/vue.js +2 -1
  39. package/chart-bar/index.js +2 -3
  40. package/chart-core/deps/constants.js +43 -43
  41. package/chart-core/index.js +1 -1
  42. package/chart-gauge/index.js +2 -2
  43. package/chart-heatmap/index.js +17 -10
  44. package/chart-line/index.js +8 -9
  45. package/chart-tree/index.js +2 -2
  46. package/chart-waterfall/index.js +4 -6
  47. package/checkbox/index.js +17 -0
  48. package/checkbox/vue.js +16 -7
  49. package/checkbox-group/vue.js +2 -0
  50. package/col/index.js +7 -2
  51. package/col/vue.js +1 -1
  52. package/collapse/index.js +3 -3
  53. package/color-select-panel/vue.js +0 -7
  54. package/column-list-item/index.js +17 -1
  55. package/column-list-item/vue.js +8 -3
  56. package/common/date.js +2 -0
  57. package/common/deps/dom.js +19 -4
  58. package/common/deps/popper.js +48 -5
  59. package/common/deps/touch-emulator.js +4 -1
  60. package/common/deps/tree-model/node.js +1 -1
  61. package/common/deps/tree-model/tree-store.js +2 -13
  62. package/common/deps/useRect.js +25 -0
  63. package/common/deps/vue-popper.js +22 -10
  64. package/common/index.js +1 -1
  65. package/common/runtime.js +1 -1
  66. package/common/type.js +2 -1
  67. package/common/validate/rules/enum.js +1 -1
  68. package/common/validate/rules/pattern.js +2 -2
  69. package/common/validate/rules/range.js +8 -5
  70. package/common/validate/rules/required.js +1 -1
  71. package/common/validate/rules/type.js +5 -5
  72. package/common/validate/rules/whitespace.js +1 -1
  73. package/common/validate/util.js +15 -16
  74. package/common/validate/validations/integer.js +1 -1
  75. package/common/validate/validations/method.js +1 -1
  76. package/container/index.js +17 -1
  77. package/container/vue.js +12 -3
  78. package/currency/index.js +74 -7
  79. package/currency/vue.js +21 -5
  80. package/date-panel/index.js +16 -0
  81. package/date-panel/vue.js +8 -2
  82. package/date-picker-mobile/index.js +12 -0
  83. package/date-picker-mobile/vue.js +7 -1
  84. package/date-range/vue.js +12 -5
  85. package/date-table/index.js +5 -0
  86. package/date-table/vue.js +3 -1
  87. package/dialog-box/index.js +17 -6
  88. package/dialog-select/index.js +6 -3
  89. package/dialog-select/vue.js +8 -4
  90. package/drawer/index.js +26 -5
  91. package/drawer/vue.js +13 -7
  92. package/dropdown/index.js +7 -7
  93. package/dropdown/vue.js +6 -2
  94. package/dropdown-item/index.js +9 -1
  95. package/dropdown-item/mf.js +6 -10
  96. package/dropdown-item/vue.js +21 -8
  97. package/dropdown-menu/index.js +20 -7
  98. package/dropdown-menu/vue.js +4 -3
  99. package/exception/index.js +2 -7
  100. package/exception/vue.js +7 -10
  101. package/fall-menu/index.js +5 -1
  102. package/fall-menu/vue.js +13 -2
  103. package/file-upload/index.js +47 -12
  104. package/file-upload/vue.js +38 -8
  105. package/filter-box/index.js +1 -0
  106. package/floating-button/index.js +62 -16
  107. package/floating-button/vue.js +27 -9
  108. package/flowchart/index.js +134 -25
  109. package/flowchart/node.js +13 -4
  110. package/flowchart/vue.js +16 -4
  111. package/form/vue.js +3 -1
  112. package/form-item/index.js +4 -4
  113. package/form-item/vue.js +3 -1
  114. package/fullscreen/index.js +5 -5
  115. package/fullscreen/vue.js +3 -3
  116. package/grid/utils/common.js +10 -5
  117. package/grid/utils/dom.js +7 -1
  118. package/image/index.js +6 -0
  119. package/image/vue.js +6 -3
  120. package/image-viewer/index.js +62 -51
  121. package/image-viewer/vue.js +17 -5
  122. package/input/index.js +89 -22
  123. package/input/vue.js +52 -21
  124. package/ip-address/index.js +61 -19
  125. package/ip-address/vue.js +22 -4
  126. package/label/index.js +56 -0
  127. package/label/vue.js +26 -0
  128. package/link/vue.js +3 -1
  129. package/loading/vue.js +8 -2
  130. package/logout/index.js +1 -1
  131. package/mask/index.js +13 -0
  132. package/mask/vue.js +18 -0
  133. package/mind-map/index.js +47 -0
  134. package/mind-map/vue.js +53 -0
  135. package/multi-select/index.js +150 -10
  136. package/multi-select/vue.js +46 -11
  137. package/multi-select-item/index.js +17 -0
  138. package/multi-select-item/vue.js +31 -0
  139. package/numeric/index.js +51 -9
  140. package/numeric/vue.js +44 -14
  141. package/option/index.js +12 -5
  142. package/option/vue.js +15 -7
  143. package/option-group/index.js +3 -3
  144. package/package.json +1 -1
  145. package/pager/index.js +372 -0
  146. package/pager/vue.js +125 -2
  147. package/picker/index.js +253 -48
  148. package/picker/mb.js +42 -0
  149. package/picker/vue.js +70 -17
  150. package/picker-column/index.js +1 -1
  151. package/pop-upload/index.js +0 -2
  152. package/pop-upload/vue.js +3 -4
  153. package/popconfirm/index.js +3 -6
  154. package/popconfirm/vue.js +1 -1
  155. package/popeditor/index.js +55 -24
  156. package/popeditor/vue.js +15 -11
  157. package/popover/index.js +4 -4
  158. package/popover/vue.js +6 -6
  159. package/popup/index.js +3 -3
  160. package/popup/vue.js +5 -5
  161. package/pull-refresh/index.js +57 -65
  162. package/pull-refresh/vue.js +23 -7
  163. package/radio/index.js +0 -17
  164. package/radio/vue.js +4 -10
  165. package/rate/index.js +1 -1
  166. package/rate/vue.js +0 -2
  167. package/record/index.js +4 -1
  168. package/{rich-text-edtior → rich-text-editor}/index.js +2 -2
  169. package/{rich-text-edtior → rich-text-editor}/vue.js +2 -5
  170. package/scrollbar/index.js +11 -11
  171. package/scrollbar/vue-bar.js +3 -3
  172. package/scrollbar/vue.js +5 -5
  173. package/search/index.js +1 -1
  174. package/search/vue.js +3 -1
  175. package/select/index.js +185 -113
  176. package/select/vue.js +105 -20
  177. package/select-dropdown/index.js +62 -4
  178. package/select-dropdown/vue.js +85 -8
  179. package/select-view/index.js +3 -1
  180. package/signature/index.js +241 -0
  181. package/signature/vue.js +88 -0
  182. package/skeleton/index.js +14 -0
  183. package/skeleton/vue.js +15 -0
  184. package/skeleton-item/vue.js +15 -0
  185. package/slider/index.js +27 -7
  186. package/slider/vue.js +26 -7
  187. package/split/index.js +1 -1
  188. package/split/vue.js +4 -6
  189. package/standard-list-item/index.js +15 -1
  190. package/standard-list-item/vue.js +6 -5
  191. package/steps/index.js +25 -2
  192. package/steps/slide-bar.js +8 -1
  193. package/steps/vue.js +15 -3
  194. package/tab-item-mf/vue.js +14 -8
  195. package/tab-nav/index.js +9 -4
  196. package/tab-nav/vue.js +6 -2
  197. package/tabbar/vue.js +9 -3
  198. package/tabbar-item/vue.js +3 -2
  199. package/tabs/index.js +1 -1
  200. package/tabs/vue.js +1 -0
  201. package/tabs-mf/index.js +20 -6
  202. package/tabs-mf/vue-nav.js +26 -11
  203. package/tabs-mf/vue.js +7 -7
  204. package/tag/index.js +1 -1
  205. package/tag/vue.js +5 -1
  206. package/tag-group/index.js +2 -1
  207. package/tall-storage/index.js +4 -5
  208. package/time/index.js +4 -1
  209. package/time/vue.js +1 -1
  210. package/time-line/vue.js +1 -1
  211. package/time-picker-mobile/index.js +24 -5
  212. package/time-picker-mobile/vue.js +17 -7
  213. package/time-range/index.js +2 -0
  214. package/time-spinner/index.js +0 -3
  215. package/time-spinner/vue.js +2 -3
  216. package/timeline-item/vue.js +1 -1
  217. package/tooltip/index.js +1 -2
  218. package/tooltip/vue.js +3 -3
  219. package/transfer/index.js +20 -22
  220. package/transfer/vue.js +1 -6
  221. package/transfer-panel/vue.js +3 -5
  222. package/tree/index.js +21 -4
  223. package/tree/vue.js +10 -8
  224. package/tree-menu/index.js +27 -3
  225. package/tree-menu/vue.js +27 -14
  226. package/tree-node/index.js +12 -10
  227. package/tree-node/vue.js +6 -5
  228. package/types/action-menu.type.d.ts +5 -0
  229. package/types/action-sheet.type.d.ts +118 -1
  230. package/types/alert.type.d.ts +16 -1
  231. package/types/amount.type.d.ts +168 -1
  232. package/types/area.type.d.ts +134 -1
  233. package/types/async-flowchart.type.d.ts +72 -0
  234. package/types/autocomplete.type.d.ts +199 -1
  235. package/types/badge.type.d.ts +3 -1
  236. package/types/breadcrumb-item.type.d.ts +2 -0
  237. package/types/breadcrumb.type.d.ts +2 -0
  238. package/types/button.type.d.ts +5 -0
  239. package/types/cascader-menu.type.d.ts +3 -4
  240. package/types/cascader-node.type.d.ts +5 -2
  241. package/types/cascader-panel.type-2bd03be3.d.ts +241 -0
  242. package/types/cascader-panel.type.d.ts +3 -241
  243. package/types/cascader.type.d.ts +327 -1
  244. package/types/checkbox.type.d.ts +9 -0
  245. package/types/collapse.type.d.ts +19 -2
  246. package/types/date-picker.type.d.ts +33 -0
  247. package/types/dialog-box.type.d.ts +5 -1
  248. package/types/drawer.type.d.ts +132 -1
  249. package/types/{dropdown-item.type-bf83e929.d.ts → dropdown-item.type-8475a549.d.ts} +8 -14
  250. package/types/dropdown-item.type.d.ts +1 -1
  251. package/types/dropdown-menu.type.d.ts +1 -1
  252. package/types/dropdown.type.d.ts +2 -5
  253. package/types/fall-menu.type.d.ts +94 -1
  254. package/types/file-upload.type.d.ts +1 -1
  255. package/types/form-item.type.d.ts +1 -1
  256. package/types/{form.type-d0fd42f3.d.ts → form.type-d88482e4.d.ts} +3 -0
  257. package/types/form.type.d.ts +1 -1
  258. package/types/input.type.d.ts +23 -9
  259. package/types/ip-address.type.d.ts +160 -1
  260. package/types/label.type.d.ts +81 -0
  261. package/types/link.type.d.ts +6 -3
  262. package/types/mind-map.type.d.ts +20 -0
  263. package/types/modal.type.d.ts +4 -2
  264. package/types/numeric.type.d.ts +36 -9
  265. package/types/pager.type.d.ts +171 -1
  266. package/types/picker.type.d.ts +14 -0
  267. package/types/popconfirm.type.d.ts +85 -1
  268. package/types/popeditor.type.d.ts +4 -0
  269. package/types/popover.type.d.ts +3 -3
  270. package/types/radio.type.d.ts +0 -4
  271. package/types/rate.type.d.ts +236 -1
  272. package/types/search.type.d.ts +88 -1
  273. package/types/shared.type.d.ts +1 -1
  274. package/types/skeleton-item.type.d.ts +38 -0
  275. package/types/skeleton.type.d.ts +45 -0
  276. package/types/slider.type.d.ts +8 -1
  277. package/types/steps.type.d.ts +14 -3
  278. package/types/tab-item.type.d.ts +0 -1
  279. package/types/tab-nav.type.d.ts +6 -1
  280. package/types/tabs.type.d.ts +5 -0
  281. package/types/tag-group.type.d.ts +64 -1
  282. package/types/tag.type.d.ts +12 -0
  283. package/types/tooltip.type.d.ts +1 -1
  284. package/types/transfer.type.d.ts +183 -1
  285. package/types/tree-menu.type.d.ts +210 -1
  286. package/types/upload-dragger.type.d.ts +1 -1
  287. package/types/{upload-list.type-343e8c11.d.ts → upload-list.type-1078fba2.d.ts} +27 -6
  288. package/types/upload-list.type.d.ts +1 -1
  289. package/types/upload.type.d.ts +1 -1
  290. package/types/wizard.type.d.ts +1 -0
  291. package/upload/index.js +59 -29
  292. package/upload/vue.js +6 -4
  293. package/upload-list/index.js +14 -14
  294. package/upload-list/vue.js +5 -2
  295. package/user/index.js +5 -4
  296. package/user-head/index.js +1 -1
  297. package/wheel/index.js +3 -0
  298. 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, constants, designConfig }) => {
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(name = "dropdownIcon")),
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 = ({ api: api2, props, state, emit, constants, parent, nextTick, dispatch, vm, designConfig }) => {
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, emit, state, props }),
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
- toggleMenu: toggleMenu({ vm, state, props }),
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(() => props.modelValue, api2.watchValue);
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({ api: api2, props, state, emit, maskState, constants, parent, nextTick, dispatch, t, vm, designConfig });
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);
@@ -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 ? selectVm.$refs.reference.$el : selectVm.$refs.select;
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
- mounted
67
+ cancelSearch,
68
+ closeModal,
69
+ deleteSelected,
70
+ handleClear,
71
+ handleQueryChange,
72
+ mounted,
73
+ selectDropdownConfirm,
74
+ selectedBoxConfirm,
75
+ toggleSelectedBox
18
76
  };
@@ -1,7 +1,30 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- import { mounted } from "./index";
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
- const api = ["state", "doDestroy"];
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;
@@ -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
- } else if (typeof list.then === "function") {
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;