@opentiny/vue-renderless 3.9.2 → 3.10.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 (198) hide show
  1. package/action-sheet/vue.js +25 -2
  2. package/anchor/index.js +3 -3
  3. package/anchor/vue.js +7 -1
  4. package/area/index.js +4 -4
  5. package/button/vue.js +4 -2
  6. package/button-group/index.js +8 -1
  7. package/button-group/vue.js +5 -10
  8. package/calendar/index.js +14 -14
  9. package/calendar-bar/index.js +3 -3
  10. package/carousel-item/index.js +1 -1
  11. package/cascader/vue.js +1 -1
  12. package/cascader-mobile/index.js +299 -0
  13. package/cascader-mobile/vue.js +102 -0
  14. package/cascader-panel/store.js +3 -1
  15. package/chart-boxplot/index.js +0 -1
  16. package/chart-core/deps/constants.js +20 -2
  17. package/chart-core/index.js +9 -1
  18. package/chart-core/modules/extend.js +14 -1
  19. package/chart-gauge/index.js +3 -1
  20. package/chart-graph/index.js +3 -1
  21. package/chart-map/index.js +11 -1
  22. package/chart-scatter/index.js +10 -2
  23. package/chart-waterfall/index.js +4 -1
  24. package/checkbox/index.js +16 -14
  25. package/checkbox/vue.js +14 -10
  26. package/checkbox-button/vue.js +7 -3
  27. package/column-list-item/vue.js +10 -1
  28. package/common/bigInt.js +4 -11
  29. package/common/date.js +2 -2
  30. package/common/deps/ResizeObserver.js +3 -1
  31. package/common/deps/date-util.js +9 -1
  32. package/common/deps/date.js +18 -5
  33. package/common/deps/fastdom/async.js +41 -0
  34. package/common/deps/fastdom/index.js +9 -0
  35. package/common/deps/fastdom/sandbox.js +53 -0
  36. package/common/deps/fastdom/singleton.js +80 -0
  37. package/common/deps/fullscreen/screenfull.js +16 -2
  38. package/common/deps/memorize.js +3 -3
  39. package/common/deps/popup-manager.js +0 -1
  40. package/common/deps/requestAnimationFrame.js +1 -1
  41. package/common/deps/throttle.js +2 -2
  42. package/common/deps/tree-model/node.js +23 -11
  43. package/common/deps/tree-model/tree-store.js +28 -7
  44. package/common/deps/vue-popper.js +14 -2
  45. package/common/deps/vue-popup.js +16 -23
  46. package/common/index.js +7 -35
  47. package/common/runtime.js +1 -1
  48. package/common/validate/rules/type.js +3 -1
  49. package/credit-card-form/vue.js +2 -2
  50. package/date-panel/index.js +35 -31
  51. package/date-panel/vue.js +12 -12
  52. package/date-picker/index.js +9 -5
  53. package/date-picker/vue.js +20 -8
  54. package/date-picker-mobile/index.js +3 -3
  55. package/date-range/index.js +91 -19
  56. package/date-range/vue.js +19 -11
  57. package/date-table/index.js +39 -6
  58. package/date-table/vue.js +2 -2
  59. package/dept/index.js +1 -1
  60. package/detail-page/vue.js +9 -1
  61. package/dialog-box/index.js +11 -2
  62. package/dialog-box/vue.js +30 -6
  63. package/dialog-select/index.js +27 -5
  64. package/dialog-select/vue.js +11 -4
  65. package/drop-roles/index.js +3 -1
  66. package/dropdown/index.js +28 -7
  67. package/dropdown/vue.js +12 -7
  68. package/dropdown-item/index.js +9 -1
  69. package/dropdown-item/mf.js +3 -3
  70. package/dropdown-item/vue.js +12 -10
  71. package/dropdown-menu/index.js +13 -14
  72. package/dropdown-menu/vue.js +8 -7
  73. package/espace/vue.js +9 -1
  74. package/fall-menu/vue.js +12 -1
  75. package/file-upload/index.js +137 -89
  76. package/file-upload/vue.js +24 -14
  77. package/filter/index.js +1 -1
  78. package/filter/vue.js +1 -3
  79. package/floating-button/index.js +73 -0
  80. package/floating-button/vue.js +35 -0
  81. package/form/index.js +13 -4
  82. package/form/vue.js +7 -2
  83. package/form-item/index.js +4 -1
  84. package/form-item/vue.js +6 -3
  85. package/fullscreen/vue.js +24 -3
  86. package/grid/plugins/exportExcel.js +54 -8
  87. package/grid/static/base/helperGetHGSKeys.js +1 -4
  88. package/grid/utils/common.js +15 -11
  89. package/grid/utils/dom.js +5 -1
  90. package/guide/index.js +2 -3
  91. package/hrapprover/index.js +3 -1
  92. package/index-bar/vue.js +8 -1
  93. package/input/index.js +1 -11
  94. package/input/vue.js +6 -12
  95. package/ip-address/index.js +66 -33
  96. package/ip-address/vue.js +8 -1
  97. package/link-menu/vue.js +22 -2
  98. package/locales/index.js +4 -2
  99. package/logon-user/index.js +3 -1
  100. package/logout/index.js +6 -2
  101. package/milestone/vue.js +1 -1
  102. package/mini-picker/index.js +12 -10
  103. package/mini-picker/vue.js +10 -10
  104. package/modal/index.js +5 -3
  105. package/modal/vue.js +4 -2
  106. package/month-range/index.js +18 -18
  107. package/month-range/vue.js +16 -4
  108. package/month-table/index.js +7 -3
  109. package/multi-select/vue.js +1 -9
  110. package/nav-menu/index.js +33 -4
  111. package/nav-menu/vue.js +9 -1
  112. package/notify/vue.js +12 -1
  113. package/numeric/vue.js +6 -2
  114. package/option/index.js +10 -2
  115. package/option/vue.js +20 -9
  116. package/option-group/index.js +3 -1
  117. package/package.json +2 -1
  118. package/picker/index.js +88 -17
  119. package/picker/vue.js +42 -17
  120. package/picker-column/index.js +6 -6
  121. package/picker-column/vue.js +5 -5
  122. package/popconfirm/vue.js +3 -1
  123. package/popeditor/index.js +55 -13
  124. package/popeditor/vue.js +23 -7
  125. package/popover/vue.js +1 -2
  126. package/popup/vue.js +15 -2
  127. package/progress/index.js +9 -7
  128. package/progress/vue.js +12 -4
  129. package/pull-refresh/vue.js +10 -1
  130. package/query-builder/index.js +9 -0
  131. package/query-builder/vue.js +18 -0
  132. package/radio/vue.js +3 -1
  133. package/radio-button/vue.js +1 -1
  134. package/rate/index.js +8 -2
  135. package/rate/vue.js +27 -4
  136. package/recycle-scroller/index.js +0 -1
  137. package/scrollbar/vue-bar.js +18 -2
  138. package/search/index.js +12 -5
  139. package/search/vue.js +7 -5
  140. package/select/index.js +596 -304
  141. package/select/vue.js +167 -101
  142. package/select-dropdown/vue.js +8 -6
  143. package/select-mobile/index.js +26 -13
  144. package/select-mobile/vue.js +14 -5
  145. package/select-view/index.js +5 -21
  146. package/select-view/vue.js +0 -3
  147. package/selected-box/index.js +3 -1
  148. package/slider/index.js +5 -5
  149. package/slider/vue.js +16 -0
  150. package/slider-button/index.js +41 -0
  151. package/slider-button/vue.js +36 -0
  152. package/slider-button-group/slide-button.js +142 -0
  153. package/slider-button-group/vue.js +52 -0
  154. package/steps/slide-bar.js +0 -1
  155. package/switch/index.js +1 -1
  156. package/switch/vue.js +1 -1
  157. package/tab-bar/index.js +8 -6
  158. package/tab-nav/index.js +19 -13
  159. package/tab-nav/vue.js +10 -9
  160. package/tabs/index.js +21 -17
  161. package/tabs/vue.js +1 -4
  162. package/tag/vue.js +2 -1
  163. package/tag-group/index.js +23 -10
  164. package/tag-group/vue.js +5 -4
  165. package/time/index.js +8 -8
  166. package/time/vue.js +9 -9
  167. package/time-line/index.js +24 -2
  168. package/time-line/vue.js +30 -4
  169. package/time-panel/index.js +2 -2
  170. package/time-panel/vue.js +2 -2
  171. package/time-range/index.js +24 -21
  172. package/time-range/vue.js +26 -16
  173. package/time-spinner/index.js +32 -21
  174. package/time-spinner/vue.js +37 -12
  175. package/timeline-item/index.js +77 -0
  176. package/timeline-item/vue.js +44 -0
  177. package/toggle-menu/vue.js +0 -1
  178. package/tooltip/index.js +11 -12
  179. package/tooltip/vue.js +11 -1
  180. package/top-box/vue.js +13 -1
  181. package/tree/index.js +228 -15
  182. package/tree/vue.js +119 -15
  183. package/tree-menu/index.js +35 -0
  184. package/tree-menu/vue.js +27 -5
  185. package/tree-node/index.js +75 -10
  186. package/tree-node/vue.js +45 -23
  187. package/upload/index.js +90 -49
  188. package/upload/vue.js +22 -10
  189. package/upload-dragger/index.js +4 -3
  190. package/upload-list/index.js +67 -16
  191. package/upload-list/vue.js +26 -9
  192. package/user/index.js +7 -4
  193. package/user-link/index.js +2 -1
  194. package/wizard/index.js +4 -1
  195. package/wizard/vue.js +19 -2
  196. package/year-range/index.js +1 -1
  197. package/year-range/vue.js +3 -3
  198. package/year-table/index.js +2 -2
package/select/vue.js CHANGED
@@ -74,13 +74,34 @@ import {
74
74
  getScrollListener,
75
75
  computeCollapseTags,
76
76
  computeMultipleLimit,
77
+ handleDropdownClick,
78
+ handleEnterTag,
79
+ calcCollapseTags,
80
+ initValue,
81
+ watchInputHover,
82
+ initQuery,
83
+ updateModelValue,
84
+ getLabelSlotValue,
85
+ computedTagsStyle,
86
+ computedReadonly,
87
+ computedShowClose,
88
+ computedCollapseTagSize,
89
+ computedShowNewOption,
90
+ computedShowCopy,
91
+ computedOptionsAllDisabled,
92
+ computedDisabledTooltipContent,
93
+ computedSelectDisabled,
94
+ computedIsExpandAll,
95
+ watchInitValue,
96
+ watchShowClose,
97
+ loadTreeData,
77
98
  resetFilter,
78
- computedGetIcon
99
+ computedGetIcon,
100
+ computedGetTagType,
101
+ computedShowDropdownIcon
79
102
  } from "./index";
80
- import { BROWSER_NAME } from "../common";
81
- import browserInfo from "../common/browser";
82
103
  import debounce from "../common/deps/debounce";
83
- import { isNumber, isNull } from "../common/type";
104
+ import { isNumber } from "../common/type";
84
105
  const api = [
85
106
  "state",
86
107
  "nodeCollapse",
@@ -133,9 +154,14 @@ const api = [
133
154
  "onMouseenterNative",
134
155
  "onMouseleaveNative",
135
156
  "onCopying",
136
- "resetFilter"
157
+ "handleDropdownClick",
158
+ "handleEnterTag",
159
+ "getLabelSlotValue",
160
+ "loadTreeData",
161
+ "resetFilter",
162
+ "computedGetIcon"
137
163
  ];
138
- const initStateAdd = ({ computed, props, api: api2, parent, emitter }) => ({
164
+ const initStateAdd = ({ computed, props, api: api2, parent }) => ({
139
165
  selectedTags: [],
140
166
  tips: "",
141
167
  showTip: false,
@@ -146,21 +172,23 @@ const initStateAdd = ({ computed, props, api: api2, parent, emitter }) => ({
146
172
  overflow: null,
147
173
  completed: false,
148
174
  inputWidth: 0,
175
+ inputPaddingRight: 0,
149
176
  hoverIndex: -1,
150
177
  hoverOption: -1,
151
178
  inputLength: 20,
152
179
  optionsCount: 0,
153
180
  selectFiexd: {},
181
+ createdLabel: null,
154
182
  isSilentBlur: false,
155
183
  cachedOptions: [],
156
184
  selectedLabel: "",
157
185
  previousQuery: null,
158
186
  inputHovering: false,
159
- createdLabel: null,
160
187
  createdSelected: false,
161
188
  isOnComposition: false,
162
189
  cachedPlaceHolder: props.placeholder,
163
- initialInputHeight: 0,
190
+ inputHeight: 0,
191
+ initialInputHeight: 28,
164
192
  currentPlaceholder: props.placeholder,
165
193
  filteredOptionsCount: 0,
166
194
  gridData: [],
@@ -169,104 +197,110 @@ const initStateAdd = ({ computed, props, api: api2, parent, emitter }) => ({
169
197
  currentKey: props.modelValue,
170
198
  updateId: "",
171
199
  popperElm: null,
172
- selectEmitter: emitter(),
173
200
  debounce: computed(() => isNumber(props.queryDebounce) ? props.queryDebounce : props.remote ? 300 : 0),
174
201
  emptyText: computed(() => api2.emptyText()),
175
202
  formItemSize: computed(() => (parent.formItem || {}).formItemSize),
176
- selectDisabled: computed(() => props.disabled || (parent.form || {}).disabled),
203
+ selectDisabled: computed(() => api2.computedSelectDisabled()),
204
+ isDisplayOnly: computed(() => props.displayOnly || (parent.form || {}).displayOnly),
177
205
  gridCheckedData: computed(() => api2.getcheckedData()),
178
- isExpandAll: computed(
179
- () => props.treeOp && props.treeOp.defaultExpandAll !== void 0 ? props.treeOp.defaultExpandAll : true
180
- ),
206
+ isExpandAll: computed(() => api2.computedIsExpandAll()),
181
207
  searchSingleCopy: computed(() => props.allowCopy && !props.multiple && props.filterable),
208
+ tooltipContent: {},
209
+ isHidden: false,
210
+ defaultCheckedKeys: [],
182
211
  filterOrSearch: computed(() => props.filterable || props.searchable)
183
212
  });
184
- const initState = ({ reactive, computed, props, api: api2, emitter, parent, constants }) => {
185
- const stateAdd = initStateAdd({ computed, props, api: api2, parent, emitter });
213
+ const initState = ({ reactive, computed, props, api: api2, emitter, parent, constants, designConfig }) => {
214
+ const stateAdd = initStateAdd({ computed, props, api: api2, parent });
186
215
  const state = reactive(__spreadProps(__spreadValues({}, stateAdd), {
216
+ selectEmitter: emitter(),
187
217
  datas: [],
188
218
  query: "",
189
219
  options: [],
190
220
  visible: false,
191
- showCopy: computed(() => props.multiple && props.copyable && state.inputHovering && state.selected.length),
221
+ showCopy: computed(() => api2.computedShowCopy()),
192
222
  showWarper: true,
193
- // 显示下拉外层控制
194
223
  selected: props.multiple ? [] : {},
195
224
  softFocus: false,
196
225
  hover: false,
197
- firstAutoSeach: props.remoteConfig.autoSeach,
198
- tagsStyle: computed(() => ({ "max-width": state.inputWidth - 32 + "px", width: "100%" })),
199
- readonly: computed(
200
- () => props.readonly || !props.filterable || props.searchable || props.multiple || browserInfo.name !== BROWSER_NAME.IE && browserInfo.name !== BROWSER_NAME.Edge && !state.visible
201
- ),
226
+ firstAutoSearch: props.remoteConfig.autoSearch,
227
+ tagsStyle: computed(() => api2.computedTagsStyle()),
228
+ readonly: computed(() => api2.computedReadonly()),
202
229
  iconClass: computed(() => state.visible ? "" : constants.CLASS.IsReverse),
203
- showClose: computed(
204
- () => props.clearable && !state.selectDisabled && state.inputHovering && (props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : !isNull(props.modelValue) && props.modelValue !== "")
205
- ),
206
- optionsAllDisabled: computed(
207
- () => state.options.filter((option) => option.visible).every((option) => option.disabled)
208
- ),
209
- collapseTagSize: computed(() => state.selectSize),
210
- showNewOption: computed(
211
- () => props.filterable && props.allowCreate && state.query !== "" && !state.options.filter((option) => !option.created).some((option) => option.state.currentLabel === state.query)
212
- ),
230
+ showClose: computed(() => api2.computedShowClose()),
231
+ optionsAllDisabled: computed(() => api2.computedOptionsAllDisabled()),
232
+ collapseTagSize: computed(() => api2.computedCollapseTagSize()),
233
+ showNewOption: computed(() => api2.computedShowNewOption()),
213
234
  selectSize: computed(() => props.size || state.formItemSize),
214
235
  optimizeOpts: computed(() => api2.computeOptimizeOpts()),
215
236
  optimizeStore: { flag: false, valueIndex: 0, startIndex: 0, viewStyle: "", datas: [] },
216
237
  collapseTags: computed(() => api2.computeCollapseTags()),
217
238
  multipleLimit: computed(() => api2.computeMultipleLimit()),
239
+ disabledTooltipContent: computed(() => api2.computedDisabledTooltipContent()),
240
+ collapseTagsLength: 0,
241
+ initValue: [],
242
+ key: 0,
218
243
  isSelectAll: computed(() => state.selectCls === "checked-sur"),
219
244
  isHalfSelect: computed(() => state.selectCls === "halfselect"),
220
- getIcon: computed(() => api2.computedGetIcon())
245
+ getIcon: computed(() => api2.computedGetIcon(name = "dropdownIcon")),
246
+ getTagType: computed(() => api2.computedGetTagType()),
247
+ isShowDropdownIcon: computed(() => api2.computedShowDropdownIcon())
221
248
  }));
222
249
  return state;
223
250
  };
224
- const addApi = ({ api: api2, props, state, refs, emit, constants, parent, nextTick, dispatch, vm, designConfig }) => {
251
+ const addApi = ({ api: api2, props, state, emit, constants, parent, nextTick, dispatch, vm, designConfig }) => {
225
252
  Object.assign(api2, {
226
- resetInputHeight: resetInputHeight({ api: api2, constants, nextTick, props, refs, state }),
227
- calcOverFlow: calcOverFlow({ refs, props, state }),
253
+ resetInputHeight: resetInputHeight({ api: api2, constants, nextTick, props, vm, state, designConfig }),
254
+ calcOverFlow: calcOverFlow({ vm, props, state }),
228
255
  handleFocus: handleFocus({ api: api2, emit, props, state }),
229
- deleteTag: deleteTag({ api: api2, constants, emit, props, vm, state }),
230
- watchValue: watchValue({ api: api2, constants, dispatch, props, refs, state }),
256
+ deleteTag: deleteTag({ api: api2, constants, emit, props, vm, nextTick, state }),
257
+ watchValue: watchValue({ api: api2, constants, dispatch, props, vm, state }),
231
258
  toHide: toHide({ constants, state, props, vm, api: api2 }),
232
259
  toVisible: toVisible({ constants, state, props, vm, api: api2, nextTick }),
233
- setSelected: setSelected({ api: api2, constants, nextTick, props, refs, state }),
260
+ setSelected: setSelected({ api: api2, constants, nextTick, props, vm, state }),
234
261
  selectOption: selectOption({ api: api2, state, props }),
235
- handleResize: handleResize({ api: api2, props }),
262
+ handleResize: handleResize({ api: api2, props, state }),
236
263
  watchOptions: watchOptions({ api: api2, constants, nextTick, parent, props, state }),
237
- watchVisible: watchVisible({ api: api2, constants, emit, state, refs }),
238
- deletePrevTag: deletePrevTag({ api: api2, constants, emit, props, state, vm }),
264
+ watchVisible: watchVisible({ api: api2, constants, emit, state, vm, props }),
265
+ deletePrevTag: deletePrevTag({ api: api2, constants, props, state, vm }),
239
266
  onInputChange: onInputChange({ api: api2, props, state, constants, nextTick }),
240
267
  deleteSelected: deleteSelected({ api: api2, constants, emit, props, vm, state }),
241
268
  handleMenuEnter: handleMenuEnter({ api: api2, nextTick, state }),
242
- resetInputState: resetInputState({ api: api2, refs, state }),
269
+ resetInputState: resetInputState({ api: api2, vm, state }),
243
270
  navigateOptions: navigateOptions({ api: api2, nextTick, state }),
244
271
  handleClearClick: handleClearClick(api2),
245
272
  handleComposition: handleComposition({ api: api2, nextTick, state }),
246
273
  handleQueryChange: handleQueryChange({ api: api2, constants, nextTick, props, vm, state }),
247
- handleOptionSelect: handleOptionSelect({ api: api2, emit, nextTick, props, refs, state }),
274
+ handleOptionSelect: handleOptionSelect({ api: api2, nextTick, props, vm, state }),
248
275
  getPluginOption: getPluginOption({ api: api2, props, state }),
249
- toggleCheckAll: toggleCheckAll({ api: api2, emit, state }),
276
+ toggleCheckAll: toggleCheckAll({ api: api2, emit, state, props }),
250
277
  debouncedQueryChange: debounce(state.debounce, (event) => {
251
- api2.handleQueryChange(event.target.value);
278
+ api2.handleQueryChange(props.shape ? event : event.target.value);
252
279
  }),
253
280
  debouncedOnInputChange: debounce(state.debounce, () => {
254
281
  api2.onInputChange();
255
282
  }),
256
283
  debouncRquest: debouncRquest({ api: api2, state, props }),
257
284
  defaultOnQueryChange: defaultOnQueryChange({ props, state, constants, api: api2 }),
258
- mounted: mounted({ api: api2, parent, state, props, refs }),
259
- unMount: unMount({ api: api2, parent, refs, state }),
260
- watchOptimizeOpts: watchOptimizeOpts({ api: api2, props, refs, state }),
285
+ mounted: mounted({ api: api2, parent, state, props, vm }),
286
+ unMount: unMount({ api: api2, parent, vm, state }),
287
+ watchOptimizeOpts: watchOptimizeOpts({ api: api2, props, vm, state }),
288
+ handleDropdownClick: handleDropdownClick({ emit }),
289
+ handleEnterTag: handleEnterTag({ state }),
290
+ calcCollapseTags: calcCollapseTags({ state, vm }),
291
+ initValue: initValue({ state }),
292
+ getLabelSlotValue: getLabelSlotValue({ props, state }),
293
+ loadTreeData: loadTreeData({ state, vm, props, api: api2 }),
261
294
  resetFilter: resetFilter({ state, api: api2 }),
262
- computedGetIcon: computedGetIcon({ constants, designConfig })
295
+ computedGetIcon: computedGetIcon({ constants, designConfig, props }),
296
+ computedGetTagType: computedGetTagType({ designConfig, props }),
297
+ computedShowDropdownIcon: computedShowDropdownIcon({ props, state })
263
298
  });
264
299
  };
265
300
  const initApi = ({
266
301
  api: api2,
267
302
  props,
268
303
  state,
269
- refs,
270
304
  emit,
271
305
  maskState,
272
306
  constants,
@@ -280,30 +314,30 @@ const initApi = ({
280
314
  Object.assign(api2, {
281
315
  state,
282
316
  maskState,
283
- doDestroy: doDestroy(refs),
317
+ doDestroy: doDestroy(vm),
284
318
  getTreeData: getTreeData(props),
285
- blur: blur({ refs, state }),
286
- focus: focus({ refs, state }),
319
+ blur: blur({ vm, state }),
320
+ focus: focus({ vm, state }),
287
321
  getValueKey: getValueKey(props),
288
322
  handleClose: handleClose(state),
289
323
  getValueIndex: getValueIndex(props),
290
324
  getChildValue: getChildValue(),
291
325
  getOption: getOption({ props, state }),
292
326
  emitChange: emitChange({ emit, props, state, constants }),
293
- toggleMenu: toggleMenu({ refs, state, props }),
294
- showTip: showTip({ props, state, refs }),
327
+ toggleMenu: toggleMenu({ vm, state, props }),
328
+ showTip: showTip({ props, state, vm }),
295
329
  onOptionDestroy: onOptionDestroy(state),
296
- setSoftFocus: setSoftFocus({ refs, state }),
330
+ setSoftFocus: setSoftFocus({ vm, state }),
297
331
  getcheckedData: getcheckedData({ props, state }),
298
- resetInputWidth: resetInputWidth({ refs, state }),
332
+ resetInputWidth: resetInputWidth({ vm, state }),
299
333
  resetHoverIndex: resetHoverIndex({ props, state }),
300
- scrollToOption: scrollToOption({ refs, constants }),
301
- selectChange: selectChange({ emit, props, refs, state }),
302
- radioChange: radioChange({ emit, props, state }),
334
+ scrollToOption: scrollToOption({ vm, constants }),
335
+ selectChange: selectChange({ emit, props, vm, state, api: api2 }),
336
+ radioChange: radioChange({ emit, props, state, api: api2 }),
303
337
  handleCopyClick: handleCopyClick({ parent, props, state }),
304
- treeNodeClick: treeNodeClick({ emit, props, state }),
305
- managePlaceholder: managePlaceholder({ refs, state }),
306
- nodeCheckClick: nodeCheckClick({ emit, props, state }),
338
+ treeNodeClick: treeNodeClick({ emit, props, state, api: api2, vm }),
339
+ managePlaceholder: managePlaceholder({ vm, state }),
340
+ nodeCheckClick: nodeCheckClick({ emit, props, state, api: api2 }),
307
341
  checkDefaultFirstOption: checkDefaultFirstOption(state),
308
342
  nodeExpand: nodeExpand({ state, constants, nextTick }),
309
343
  nodeCollapse: nodeCollapse({ state, constants, nextTick }),
@@ -315,39 +349,70 @@ const initApi = ({
315
349
  buildRadioConfig: buildRadioConfig({ props, state }),
316
350
  onMouseenterNative: onMouseenterNative({ state }),
317
351
  onMouseleaveNative: onMouseleaveNative({ state }),
318
- onCopying: onCopying({ state, refs }),
319
- gridOnQueryChange: gridOnQueryChange({ props, refs, constants, state }),
352
+ onCopying: onCopying({ state, vm }),
353
+ gridOnQueryChange: gridOnQueryChange({ props, vm, constants, state }),
320
354
  watchHoverIndex: watchHoverIndex({ state }),
321
355
  computeOptimizeOpts: computeOptimizeOpts({ props, state }),
322
- getScrollListener: getScrollListener({ props, refs, state }),
356
+ getScrollListener: getScrollListener({ props, vm, state }),
323
357
  computeCollapseTags: computeCollapseTags(props),
324
- computeMultipleLimit: computeMultipleLimit({ props, state })
358
+ computeMultipleLimit: computeMultipleLimit({ props, state }),
359
+ watchInputHover: watchInputHover({ vm }),
360
+ initQuery: initQuery({ props, state, constants, vm }),
361
+ updateModelValue: updateModelValue({ emit, state }),
362
+ computedTagsStyle: computedTagsStyle({ props, parent, state }),
363
+ computedReadonly: computedReadonly({ props, state }),
364
+ computedShowClose: computedShowClose({ props, state }),
365
+ computedCollapseTagSize: computedCollapseTagSize(state),
366
+ computedShowNewOption: computedShowNewOption({ props, state }),
367
+ computedShowCopy: computedShowCopy({ props, state }),
368
+ computedOptionsAllDisabled: computedOptionsAllDisabled(state),
369
+ computedDisabledTooltipContent: computedDisabledTooltipContent(state),
370
+ computedSelectDisabled: computedSelectDisabled({ props, parent }),
371
+ computedIsExpandAll: computedIsExpandAll(props),
372
+ watchInitValue: watchInitValue({ props, emit }),
373
+ watchShowClose: watchShowClose({ nextTick, state, parent })
325
374
  });
326
- addApi({ api: api2, props, state, refs, emit, constants, parent, nextTick, dispatch, vm, designConfig });
375
+ addApi({ api: api2, props, state, emit, constants, parent, nextTick, dispatch, vm, designConfig });
327
376
  };
328
- const addWatch = ({ watch, props, api: api2, state }) => {
377
+ const addWatch = ({ watch, props, api: api2, state, nextTick }) => {
329
378
  watch(() => [...state.options], api2.watchOptions);
330
- watch(() => state.gridData, api2.setSelected, { immediate: true });
331
- watch(() => state.treeData, api2.setSelected, { immediate: true });
379
+ if (props.renderType === "grid") {
380
+ watch(() => state.gridData, api2.setSelected, { immediate: true });
381
+ }
382
+ if (props.renderType === "tree") {
383
+ watch(() => state.treeData, api2.setSelected, { immediate: true });
384
+ }
332
385
  watch(() => state.hoverIndex, api2.watchHoverIndex);
333
- props.options && watch(() => props.options, api2.watchPropsOption, { immediate: true, deep: true });
386
+ if (props.options) {
387
+ watch(() => props.options, api2.watchPropsOption, { immediate: true, deep: true });
388
+ }
334
389
  watch(() => state.optimizeOpts, api2.watchOptimizeOpts);
335
- };
336
- const initWatch = ({ watch, props, api: api2, state, nextTick, refs }) => {
337
- props.treeOp.data && watch(
338
- () => props.treeOp.data,
339
- (data) => {
340
- state.treeData = data;
341
- },
342
- { immediate: true, deep: true }
343
- );
344
- props.gridOp.data && watch(
345
- () => props.gridOp.data,
346
- (data) => {
347
- state.gridData = data;
348
- },
349
- { immediate: true, deep: true }
390
+ watch([() => state.inputHovering, () => state.visible], api2.watchInputHover);
391
+ watch(() => state.showClose, api2.watchShowClose, { immediate: true });
392
+ watch(
393
+ () => state.selectHover,
394
+ () => props.hoverExpand && !props.disabled && !state.isDisplayOnly && nextTick(api2.resetInputHeight)
350
395
  );
396
+ };
397
+ const initWatch = ({ watch, props, api: api2, state, nextTick }) => {
398
+ if (props.renderType === "tree" && props.treeOp.data) {
399
+ watch(
400
+ () => props.treeOp.data,
401
+ (data) => {
402
+ data && (state.treeData = data);
403
+ },
404
+ { immediate: true, deep: true }
405
+ );
406
+ }
407
+ if (props.renderType === "grid" && props.gridOp.data) {
408
+ watch(
409
+ () => props.gridOp.data,
410
+ (data) => {
411
+ data && (state.gridData = data);
412
+ },
413
+ { immediate: true, deep: true }
414
+ );
415
+ }
351
416
  watch(
352
417
  () => state.selectDisabled,
353
418
  () => nextTick(api2.resetInputHeight)
@@ -360,27 +425,27 @@ const initWatch = ({ watch, props, api: api2, state, nextTick, refs }) => {
360
425
  );
361
426
  watch(() => props.modelValue, api2.watchValue);
362
427
  watch(
363
- () => state.visible,
364
- (value) => {
365
- var _a;
366
- if ((state.filterOrSearch || props.remote) && !value) {
367
- (_a = refs.reference) == null ? void 0 : _a.blur();
368
- }
369
- api2.watchVisible(value);
370
- }
428
+ () => props.extraQueryParams,
429
+ () => api2.handleQueryChange(state.previousQuery, true),
430
+ { deep: true }
371
431
  );
372
- addWatch({ watch, props, api: api2, state });
432
+ watch(() => state.visible, api2.watchVisible);
433
+ watch(() => state.initValue, api2.watchInitValue, { deep: true });
434
+ addWatch({ watch, props, api: api2, state, nextTick });
373
435
  };
374
- const renderless = (props, { computed, onBeforeUnmount, onMounted, reactive, watch, provide }, { vm, refs, parent, emit, constants, nextTick, dispatch, t, emitter, designConfig }) => {
436
+ const renderless = (props, { computed, onBeforeUnmount, onMounted, reactive, watch, provide }, { vm, parent, emit, constants, nextTick, dispatch, t, emitter, designConfig }) => {
375
437
  const api2 = {};
376
- const state = initState({ reactive, computed, props, api: api2, emitter, parent, constants });
438
+ const state = initState({ reactive, computed, props, api: api2, emitter, parent, constants, designConfig });
377
439
  provide("selectEmitter", state.selectEmitter);
378
440
  provide("selectVm", vm);
379
441
  const maskState = reactive({ width: "", height: "", top: "" });
380
- initApi({ api: api2, props, state, refs, emit, maskState, constants, parent, nextTick, dispatch, t, vm, designConfig });
381
- initWatch({ watch, props, api: api2, state, nextTick, refs });
442
+ initApi({ api: api2, props, state, emit, maskState, constants, parent, nextTick, dispatch, t, vm, designConfig });
443
+ initWatch({ watch, props, api: api2, state, nextTick });
382
444
  onMounted(api2.mounted);
383
445
  onBeforeUnmount(api2.unMount);
446
+ parent.$on("handle-clear", (event) => {
447
+ api2.handleClearClick(event);
448
+ });
384
449
  if (props.multiple && !Array.isArray(props.modelValue)) {
385
450
  emit("update:modelValue", []);
386
451
  }
@@ -389,6 +454,7 @@ const renderless = (props, { computed, onBeforeUnmount, onMounted, reactive, wat
389
454
  }
390
455
  state.selectEmitter.on(constants.EVENT_NAME.handleOptionClick, api2.handleOptionSelect);
391
456
  state.selectEmitter.on(constants.EVENT_NAME.setSelected, api2.setSelected);
457
+ state.selectEmitter.on(constants.EVENT_NAME.initValue, api2.initValue);
392
458
  return api2;
393
459
  };
394
460
  export {
@@ -23,16 +23,18 @@ const initApi = ({ api: api2, popper, state, selectEmitter, constants, selectVm,
23
23
  mounted: mounted({ selectEmitter, constants, state, selectVm, updatePopper, destroyPopper, parent })
24
24
  });
25
25
  };
26
- const initWatch = ({ watch, selectVm, state }) => {
26
+ const initWatch = ({ watch, selectVm, state, nextTick }) => {
27
27
  watch(
28
28
  () => selectVm.state.inputWidth,
29
- () => {
30
- state.minWidth = (selectVm && selectVm.$el && selectVm.$el.getBoundingClientRect().width) + "px";
29
+ (val) => {
30
+ nextTick(() => {
31
+ state.minWidth = (selectVm && selectVm.$el && selectVm.$el.getBoundingClientRect().width || val) + "px";
32
+ });
31
33
  },
32
34
  { immediate: true }
33
35
  );
34
36
  };
35
- const renderless = (props, { computed, onBeforeUnmount, onDeactivated, onMounted, reactive, toRefs, watch, inject }, { refs, slots, parent, emit, nextTick }) => {
37
+ const renderless = (props, { computed, onBeforeUnmount, onDeactivated, onMounted, reactive, toRefs, watch, inject }, { vm, slots, parent, emit, nextTick }) => {
36
38
  const api2 = {};
37
39
  const constants = parent.select._constants;
38
40
  const selectEmitter = inject("selectEmitter");
@@ -44,14 +46,14 @@ const renderless = (props, { computed, onBeforeUnmount, onDeactivated, onMounted
44
46
  onDeactivated,
45
47
  props,
46
48
  reactive,
47
- refs,
49
+ vm,
48
50
  slots,
49
51
  toRefs,
50
52
  watch
51
53
  });
52
54
  const state = initState({ reactive, computed, popper, selectVm });
53
55
  initApi({ api: api2, popper, state, selectEmitter, constants, selectVm, parent });
54
- initWatch({ watch, selectVm, state });
56
+ initWatch({ watch, selectVm, state, nextTick });
55
57
  onBeforeUnmount(() => {
56
58
  popper.destroyPopper("remove");
57
59
  state.popperElm = null;
@@ -14,17 +14,7 @@ const watchVisible = ({ emit, state, props, api }) => (bool) => {
14
14
  }, 0);
15
15
  emit("update:visible", bool);
16
16
  };
17
- const watchModelValue = ({ props, state, emit }) => (value) => {
18
- const { multiple, menus, valueField, textField, textSplit } = props;
19
- if (multiple) {
20
- const ids = menus.map((option) => option[valueField]);
21
- state.checkList = (value || []).map((id) => {
22
- return ids.indexOf(id) > -1 ? menus[ids.indexOf(id)] : { [valueField]: id, [textField]: id };
23
- });
24
- }
25
- const text = multiple ? state.checkList.map((item) => item[textField]) : menus.filter((item) => item[valueField] === value).map((item) => item[textField]);
26
- emit("update:text", text.join(textSplit));
27
- };
17
+ const watchModelValue = ({ api }) => () => api.setSelected();
28
18
  const includeOptionIndex = (props) => (list, option) => {
29
19
  const { valueField } = props;
30
20
  let index = -1;
@@ -43,6 +33,7 @@ const selectOption = ({ emit, state, props, api }) => (option) => {
43
33
  } else {
44
34
  emit("update:visible", false);
45
35
  emit("update:modelValue", option[valueField]);
36
+ emit("confirm", option[valueField]);
46
37
  }
47
38
  emit("click", option);
48
39
  };
@@ -62,9 +53,9 @@ const searchMethod = ({ state, props }) => () => {
62
53
  if (searchConfig && searchConfig.searchMethod) {
63
54
  list = searchConfig.searchMethod({ input, options }) || [];
64
55
  } else {
65
- list = options.filter((item) => item[textField].indexOf(input) > -1);
56
+ list = options.filter((item) => item[textField].includes(input));
66
57
  }
67
- if (list.then === "function") {
58
+ if (typeof list.then === "function") {
68
59
  list.then((data) => state.search.filterOptions = data);
69
60
  } else {
70
61
  state.search.filterOptions = list;
@@ -97,15 +88,37 @@ const searchSelectHandler = ({ state, emit, api, props }) => (option) => {
97
88
  }
98
89
  emit("search-click", option);
99
90
  };
91
+ const isSelected = ({ state, api, props }) => (option) => {
92
+ const { valueField, multiple, modelValue } = props;
93
+ return multiple ? api.includeOptionIndex(state.checkList, option) > -1 : option[valueField] === modelValue;
94
+ };
95
+ const watchPropsOption = ({ api }) => () => api.setSelected();
96
+ const setSelected = ({ props, state, emit }) => () => {
97
+ const { multiple, menus, valueField, textField, textSplit, modelValue } = props;
98
+ if (!menus.length)
99
+ return;
100
+ if (multiple) {
101
+ const ids = menus.map((option) => option[valueField]);
102
+ state.checkList = (modelValue || []).map((id) => {
103
+ return ids.includes(id) ? menus[ids.indexOf(id)] : { [valueField]: id, [textField]: id };
104
+ });
105
+ }
106
+ const text = multiple ? state.checkList.map((item) => item[textField]) : menus.filter((item) => item[valueField] === modelValue).map((item) => item[textField]);
107
+ state.selectedLabel = text.join(textSplit);
108
+ emit("update:text", state.selectedLabel);
109
+ };
100
110
  export {
101
111
  allCheckHandler,
102
112
  confirm,
103
113
  hide,
104
114
  includeOptionIndex,
115
+ isSelected,
105
116
  searchBoxToggle,
106
117
  searchMethod,
107
118
  searchSelectHandler,
108
119
  selectOption,
120
+ setSelected,
109
121
  watchModelValue,
122
+ watchPropsOption,
110
123
  watchVisible
111
124
  };
@@ -9,7 +9,10 @@ import {
9
9
  searchBoxToggle,
10
10
  watchModelValue,
11
11
  includeOptionIndex,
12
- allCheckHandler
12
+ isSelected,
13
+ allCheckHandler,
14
+ watchPropsOption,
15
+ setSelected
13
16
  } from "./index";
14
17
  const api = [
15
18
  "state",
@@ -20,6 +23,7 @@ const api = [
20
23
  "searchSelectHandler",
21
24
  "searchBoxToggle",
22
25
  "includeOptionIndex",
26
+ "isSelected",
23
27
  "allCheckHandler"
24
28
  ];
25
29
  const renderless = (props, { computed, reactive, watch }, { emit }) => {
@@ -33,7 +37,8 @@ const renderless = (props, { computed, reactive, watch }, { emit }) => {
33
37
  options: [],
34
38
  filterOptions: []
35
39
  },
36
- checkIds: computed(() => state.checkList.map((option) => option[props.valueField]))
40
+ checkIds: computed(() => state.checkList.map((option) => option[props.valueField])),
41
+ selectedLabel: ""
37
42
  });
38
43
  Object.assign(api2, {
39
44
  state,
@@ -41,15 +46,19 @@ const renderless = (props, { computed, reactive, watch }, { emit }) => {
41
46
  selectOption: selectOption({ state, emit, props, api: api2 }),
42
47
  hide: hide({ state, emit }),
43
48
  watchVisible: watchVisible({ emit, state, props, api: api2 }),
44
- watchModelValue: watchModelValue({ props, state, emit }),
49
+ watchModelValue: watchModelValue({ api: api2 }),
45
50
  searchMethod: searchMethod({ state, props, api: api2 }),
46
51
  searchSelectHandler: searchSelectHandler({ state, emit, api: api2, props }),
47
52
  searchBoxToggle: searchBoxToggle({ state, props, api: api2 }),
48
53
  allCheckHandler: allCheckHandler({ state, props }),
49
- includeOptionIndex: includeOptionIndex(props)
54
+ includeOptionIndex: includeOptionIndex(props),
55
+ isSelected: isSelected({ state, api: api2, props }),
56
+ watchPropsOption: watchPropsOption({ api: api2 }),
57
+ setSelected: setSelected({ props, state, emit })
50
58
  });
51
59
  watch(() => props.visible, api2.watchVisible);
52
- watch(() => props.modelValue, api2.watchModelValue, { immediate: true });
60
+ watch(() => props.modelValue, api2.watchModelValue);
61
+ watch(() => props.menus, api2.watchPropsOption, { immediate: true, deep: true });
53
62
  return api2;
54
63
  };
55
64
  export {
@@ -23,7 +23,7 @@ const watchModelValue = ({ props, state, emit }) => (value) => {
23
23
  if (multiple) {
24
24
  const ids = menus.map((option) => option[valueField]);
25
25
  state.checkList = (value || []).map((id) => {
26
- return ids.indexOf(id) > -1 ? menus[ids.indexOf(id)] : { [valueField]: id, [textField]: id };
26
+ return ids.includes(id) ? menus[ids.indexOf(id)] : { [valueField]: id, [textField]: id };
27
27
  });
28
28
  }
29
29
  const textStr = multiple ? state.checkList.map((data) => data[textField]) : menus.filter((data) => data[valueField] === value).map((data) => data[textField]);
@@ -39,17 +39,6 @@ const includeOptionIndex = (props) => (list, option) => {
39
39
  });
40
40
  return OptionIndex;
41
41
  };
42
- const selectOption = ({ emit, state, props, api }) => (data) => {
43
- const { valueField, multiple } = props;
44
- if (multiple) {
45
- const index = api.includeOptionIndex(state.checkList, data);
46
- index > -1 ? state.checkList.splice(index, 1) : state.checkList.push(data);
47
- } else {
48
- emit("update:visible", false);
49
- emit("update:modelValue", data[valueField]);
50
- }
51
- emit("click", data);
52
- };
53
42
  const confirm = ({ state, props, api, emit }) => () => {
54
43
  const { search, checkIds } = state;
55
44
  if (!search.show) {
@@ -68,9 +57,7 @@ const searchMethod = ({ state, props }) => () => {
68
57
  if (searchConfig && searchConfig.searchMethod) {
69
58
  list = searchConfig.searchMethod({ input, options }) || [];
70
59
  } else {
71
- list = options.filter(
72
- (item) => item[textField].indexOf(input) > -1 && topOptionIds.indexOf(item[valueField]) === -1
73
- );
60
+ list = options.filter((item) => item[textField].includes(input) && !topOptionIds.includes(item[valueField]));
74
61
  }
75
62
  if (typeof list.then === "function") {
76
63
  list.then((data) => state.search.filterOptions = data);
@@ -97,7 +84,7 @@ const searchSelectHandler = ({ state, emit, api, props }) => (option) => {
97
84
  const { valueField, multiple, requiredSelectedList } = props;
98
85
  if (multiple) {
99
86
  const index = api.includeOptionIndex(state.checkList, option);
100
- if (index > -1 && requiredSelectedList.indexOf(option[valueField]) !== -1) {
87
+ if (index > -1 && requiredSelectedList.includes(option[valueField])) {
101
88
  emit("search-click", option, false);
102
89
  return;
103
90
  }
@@ -105,6 +92,7 @@ const searchSelectHandler = ({ state, emit, api, props }) => (option) => {
105
92
  } else {
106
93
  api.searchBoxToggle(false);
107
94
  emit("update:modelValue", option[valueField]);
95
+ emit("confirm", option[valueField], option);
108
96
  }
109
97
  emit("search-click", option, true);
110
98
  };
@@ -121,9 +109,7 @@ const toggleCheckList = ({ state }) => (value) => {
121
109
  };
122
110
  const clean = ({ state, props }) => () => {
123
111
  const { valueField, requiredSelectedList } = props;
124
- state.selected.options = state.selected.options.filter(
125
- (item) => requiredSelectedList.indexOf(item[valueField]) !== -1
126
- );
112
+ state.selected.options = state.selected.options.filter((item) => requiredSelectedList.includes(item[valueField]));
127
113
  };
128
114
  const selectedOptionHandler = ({ state, api }) => (option) => {
129
115
  const index = api.includeOptionIndex(state.selected.options, option);
@@ -139,7 +125,6 @@ const load = ({ state, props, api }) => () => {
139
125
  }
140
126
  const list = infiniteScroll.load({ input: search.input, options: search.options });
141
127
  if (!list) {
142
- return;
143
128
  } else if (typeof list.then === "function") {
144
129
  state.search.loading = true;
145
130
  list.then((data) => {
@@ -162,7 +147,6 @@ export {
162
147
  searchBoxToggle,
163
148
  searchMethod,
164
149
  searchSelectHandler,
165
- selectOption,
166
150
  selectedOptionHandler,
167
151
  toggleCheckList,
168
152
  watchModelValue,