@opentiny/vue-renderless 3.13.1 → 3.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (321) hide show
  1. package/action-sheet/index.js +20 -13
  2. package/action-sheet/vue.js +8 -7
  3. package/amount/index.js +100 -25
  4. package/amount/vue.js +102 -26
  5. package/anchor/index.js +1 -0
  6. package/area/index.js +8 -8
  7. package/area/vue.js +5 -5
  8. package/async-flowchart/index.js +16 -3
  9. package/autocomplete/index.js +58 -14
  10. package/autocomplete/vue.js +40 -12
  11. package/badge/index.js +12 -0
  12. package/badge/vue.js +6 -4
  13. package/breadcrumb/vue.js +3 -1
  14. package/breadcrumb-item/vue.js +6 -2
  15. package/button/index.js +5 -1
  16. package/calendar/index.js +2 -86
  17. package/calendar-bar/index.js +18 -4
  18. package/calendar-view/index.js +5 -1
  19. package/calendar-view/vue.js +16 -3
  20. package/card-group/vue.js +4 -2
  21. package/cascader/index.js +86 -34
  22. package/cascader/vue.js +61 -20
  23. package/cascader-menu/index.js +7 -7
  24. package/cascader-menu/vue.js +2 -3
  25. package/cascader-mobile/index.js +36 -23
  26. package/cascader-mobile/vue.js +6 -0
  27. package/cascader-node/index.js +13 -1
  28. package/cascader-node/vue.js +15 -4
  29. package/cascader-panel/index.js +1 -1
  30. package/cascader-select/column-index.js +150 -0
  31. package/cascader-select/column.js +120 -0
  32. package/cascader-select/index.js +29 -165
  33. package/cascader-select/usePicker.js +251 -0
  34. package/cascader-select/useTouch.js +65 -0
  35. package/cascader-select/vue.js +35 -47
  36. package/cell/vue.js +2 -1
  37. package/chart-bar/index.js +2 -3
  38. package/chart-core/deps/constants.js +43 -43
  39. package/chart-core/index.js +1 -1
  40. package/chart-gauge/index.js +2 -2
  41. package/chart-heatmap/index.js +17 -10
  42. package/chart-line/index.js +8 -9
  43. package/chart-tree/index.js +2 -2
  44. package/chart-waterfall/index.js +4 -6
  45. package/checkbox/index.js +18 -1
  46. package/checkbox/vue.js +15 -7
  47. package/checkbox-group/vue.js +1 -0
  48. package/col/vue.js +1 -1
  49. package/collapse/index.js +3 -3
  50. package/color-select-panel/vue.js +0 -7
  51. package/column-list-item/index.js +17 -1
  52. package/column-list-item/vue.js +8 -3
  53. package/common/date.js +7 -5
  54. package/common/deps/clickoutside.js +6 -2
  55. package/common/deps/dom.js +19 -4
  56. package/common/deps/popper.js +44 -11
  57. package/common/deps/resize-event.js +1 -0
  58. package/common/deps/touch-emulator.js +4 -1
  59. package/common/deps/tree-model/node.js +2 -2
  60. package/common/deps/tree-model/tree-store.js +2 -13
  61. package/common/deps/useRect.js +25 -0
  62. package/common/deps/vue-popper.js +38 -20
  63. package/common/index.js +2 -2
  64. package/common/runtime.js +1 -1
  65. package/common/string.js +2 -2
  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/currency/index.js +74 -7
  77. package/currency/vue.js +21 -5
  78. package/date-panel/index.js +16 -0
  79. package/date-panel/vue.js +8 -2
  80. package/date-picker-mobile/index.js +12 -0
  81. package/date-picker-mobile/vue.js +7 -1
  82. package/date-range/vue.js +14 -6
  83. package/date-table/index.js +5 -0
  84. package/date-table/vue.js +3 -1
  85. package/dialog-box/index.js +46 -14
  86. package/dialog-box/vue.js +30 -7
  87. package/dialog-select/index.js +6 -3
  88. package/dialog-select/vue.js +8 -4
  89. package/drawer/index.js +27 -5
  90. package/drawer/vue.js +14 -7
  91. package/dropdown/index.js +7 -7
  92. package/dropdown/vue.js +6 -2
  93. package/dropdown-item/index.js +9 -1
  94. package/dropdown-item/mf.js +6 -10
  95. package/dropdown-item/vue.js +20 -7
  96. package/dropdown-menu/index.js +20 -7
  97. package/dropdown-menu/vue.js +4 -3
  98. package/exception/index.js +2 -7
  99. package/exception/vue.js +7 -10
  100. package/fall-menu/index.js +5 -1
  101. package/fall-menu/vue.js +13 -2
  102. package/file-upload/index.js +68 -18
  103. package/file-upload/vue.js +38 -8
  104. package/filter-box/index.js +1 -0
  105. package/float-button/index.js +42 -0
  106. package/float-button/vue.js +101 -0
  107. package/floating-button/index.js +62 -16
  108. package/floating-button/vue.js +27 -9
  109. package/flowchart/index.js +134 -25
  110. package/flowchart/node.js +13 -4
  111. package/flowchart/vue.js +16 -4
  112. package/form/vue.js +8 -0
  113. package/form-item/index.js +5 -5
  114. package/form-item/vue.js +3 -1
  115. package/fullscreen/index.js +5 -5
  116. package/fullscreen/vue.js +3 -3
  117. package/grid/plugins/export.js +5 -2
  118. package/grid/utils/column.js +1 -0
  119. package/grid/utils/dom.js +7 -1
  120. package/image/index.js +6 -1
  121. package/image/vue.js +6 -3
  122. package/image-viewer/index.js +62 -51
  123. package/image-viewer/vue.js +17 -5
  124. package/input/index.js +81 -20
  125. package/input/vue.js +44 -18
  126. package/ip-address/index.js +61 -19
  127. package/ip-address/vue.js +22 -4
  128. package/link/vue.js +3 -1
  129. package/loading/index.js +2 -2
  130. package/loading/vue.js +8 -2
  131. package/logout/index.js +1 -1
  132. package/menu/index.js +15 -2
  133. package/menu/vue.js +22 -17
  134. package/mind-map/index.js +47 -0
  135. package/mind-map/vue.js +53 -0
  136. package/modal/index.js +44 -4
  137. package/modal/vue.js +18 -4
  138. package/multi-select/index.js +186 -11
  139. package/multi-select/vue.js +60 -15
  140. package/multi-select-item/index.js +23 -0
  141. package/multi-select-item/vue.js +31 -0
  142. package/numeric/index.js +46 -12
  143. package/numeric/vue.js +44 -19
  144. package/option/index.js +27 -9
  145. package/option/vue.js +37 -21
  146. package/option-group/index.js +3 -3
  147. package/package.json +1 -1
  148. package/pager/index.js +18 -4
  149. package/pager/vue.js +16 -5
  150. package/picker/index.js +258 -49
  151. package/picker/mb.js +42 -0
  152. package/picker/vue.js +70 -17
  153. package/picker-column/index.js +1 -1
  154. package/pop-upload/vue.js +3 -0
  155. package/popconfirm/index.js +3 -6
  156. package/popconfirm/vue.js +1 -1
  157. package/popeditor/index.js +71 -32
  158. package/popeditor/vue.js +15 -11
  159. package/popover/index.js +4 -4
  160. package/popover/vue.js +6 -6
  161. package/popup/index.js +3 -3
  162. package/popup/vue.js +5 -5
  163. package/pull-refresh/index.js +13 -13
  164. package/pull-refresh/vue.js +5 -4
  165. package/radio/index.js +0 -17
  166. package/radio/vue.js +4 -10
  167. package/rate/index.js +1 -1
  168. package/rate/vue.js +0 -2
  169. package/record/index.js +4 -1
  170. package/rich-text/clipboard.js +54 -0
  171. package/rich-text/index.js +192 -0
  172. package/rich-text/module/file-upload.js +107 -0
  173. package/rich-text/module/image-drop.js +63 -0
  174. package/rich-text/module/image-upload.js +89 -0
  175. package/rich-text/options.js +141 -0
  176. package/rich-text/table-module.js +382 -0
  177. package/rich-text/vue.js +102 -0
  178. package/{rich-text-edtior → rich-text-editor}/index.js +2 -2
  179. package/{rich-text-edtior → rich-text-editor}/vue.js +2 -5
  180. package/scrollbar/index.js +11 -11
  181. package/scrollbar/vue-bar.js +3 -3
  182. package/scrollbar/vue.js +5 -5
  183. package/search/index.js +9 -9
  184. package/search/vue.js +8 -6
  185. package/select/index.js +457 -389
  186. package/select/vue.js +257 -161
  187. package/select-dropdown/index.js +61 -3
  188. package/select-dropdown/vue.js +85 -8
  189. package/select-view/index.js +3 -1
  190. package/selected-box/index.js +2 -0
  191. package/selected-box/vue.js +6 -3
  192. package/signature/index.js +241 -0
  193. package/signature/vue.js +88 -0
  194. package/skeleton/index.js +14 -0
  195. package/skeleton/vue.js +15 -0
  196. package/skeleton-item/vue.js +15 -0
  197. package/slider/index.js +70 -17
  198. package/slider/vue.js +16 -7
  199. package/split/index.js +5 -3
  200. package/split/vue.js +4 -6
  201. package/standard-list-item/index.js +15 -1
  202. package/standard-list-item/vue.js +6 -5
  203. package/steps/index.js +25 -2
  204. package/steps/slide-bar.js +8 -1
  205. package/steps/vue.js +15 -3
  206. package/tab-item-mf/vue.js +14 -8
  207. package/tab-nav/index.js +30 -5
  208. package/tab-nav/vue.js +16 -4
  209. package/tabbar/vue.js +9 -3
  210. package/tabbar-item/vue.js +3 -2
  211. package/tabs/index.js +16 -4
  212. package/tabs/vue.js +2 -1
  213. package/tabs-mf/index.js +20 -6
  214. package/tabs-mf/vue-nav.js +26 -11
  215. package/tabs-mf/vue.js +7 -7
  216. package/tabs-mf/wheel.js +1 -0
  217. package/tag/index.js +1 -1
  218. package/tag-group/index.js +2 -1
  219. package/time/index.js +5 -2
  220. package/time/vue.js +1 -1
  221. package/time-line/index.js +3 -3
  222. package/time-line/vue.js +2 -2
  223. package/time-picker-mobile/index.js +24 -5
  224. package/time-picker-mobile/vue.js +17 -7
  225. package/time-range/index.js +2 -0
  226. package/timeline-item/vue.js +1 -1
  227. package/tooltip/index.js +6 -3
  228. package/tooltip/vue.js +4 -4
  229. package/transfer/index.js +20 -22
  230. package/transfer/vue.js +1 -6
  231. package/transfer-panel/vue.js +3 -5
  232. package/tree/index.js +21 -4
  233. package/tree/vue.js +10 -8
  234. package/tree-menu/index.js +31 -5
  235. package/tree-menu/vue.js +28 -15
  236. package/tree-node/index.js +18 -18
  237. package/tree-node/vue.js +6 -5
  238. package/types/action-sheet.type.d.ts +118 -1
  239. package/types/alert.type.d.ts +1 -1
  240. package/types/amount.type.d.ts +168 -1
  241. package/types/area.type.d.ts +134 -1
  242. package/types/async-flowchart.type.d.ts +72 -0
  243. package/types/autocomplete.type.d.ts +199 -1
  244. package/types/badge.type.d.ts +3 -1
  245. package/types/breadcrumb-item.type.d.ts +2 -0
  246. package/types/breadcrumb.type.d.ts +2 -0
  247. package/types/button-group.type.d.ts +3 -3
  248. package/types/button.type.d.ts +4 -0
  249. package/types/cascader-menu.type.d.ts +3 -4
  250. package/types/cascader-node.type.d.ts +5 -2
  251. package/types/cascader-panel.type-2bd03be3.d.ts +241 -0
  252. package/types/cascader-panel.type.d.ts +3 -241
  253. package/types/cascader.type.d.ts +329 -1
  254. package/types/checkbox.type.d.ts +9 -3
  255. package/types/collapse.type.d.ts +20 -3
  256. package/types/date-picker.type.d.ts +37 -0
  257. package/types/dialog-box.type.d.ts +13 -3
  258. package/types/drawer.type.d.ts +133 -1
  259. package/types/{dropdown-item.type-8ea6c633.d.ts → dropdown-item.type-8475a549.d.ts} +7 -13
  260. package/types/dropdown-item.type.d.ts +1 -1
  261. package/types/dropdown-menu.type.d.ts +1 -1
  262. package/types/dropdown.type.d.ts +1 -5
  263. package/types/fall-menu.type.d.ts +94 -1
  264. package/types/file-upload.type.d.ts +1 -1
  265. package/types/float-button.type.d.ts +123 -0
  266. package/types/form-item.type.d.ts +1 -1
  267. package/types/{form.type-d0fd42f3.d.ts → form.type-222799ae.d.ts} +5 -2
  268. package/types/form.type.d.ts +1 -1
  269. package/types/{index-e0250f63.d.ts → index-b012f687.d.ts} +9 -0
  270. package/types/input.type.d.ts +1 -5
  271. package/types/ip-address.type.d.ts +160 -1
  272. package/types/link.type.d.ts +6 -3
  273. package/types/loading.type.d.ts +7 -0
  274. package/types/milestone.type.d.ts +1 -1
  275. package/types/mind-map.type.d.ts +20 -0
  276. package/types/modal.type.d.ts +29 -2
  277. package/types/numeric.type.d.ts +41 -10
  278. package/types/pager.type.d.ts +13 -1
  279. package/types/picker.type.d.ts +18 -0
  280. package/types/popconfirm.type.d.ts +86 -1
  281. package/types/popeditor.type.d.ts +5 -1
  282. package/types/popover.type.d.ts +3 -3
  283. package/types/progress.type.d.ts +3 -1
  284. package/types/radio.type.d.ts +0 -4
  285. package/types/rate.type.d.ts +236 -1
  286. package/types/search.type.d.ts +88 -1
  287. package/types/shared.type.d.ts +1 -1
  288. package/types/skeleton-item.type.d.ts +38 -0
  289. package/types/skeleton.type.d.ts +45 -0
  290. package/types/slider.type.d.ts +49 -10
  291. package/types/steps.type.d.ts +15 -4
  292. package/types/switch.type.d.ts +3 -3
  293. package/types/tab-bar.type.d.ts +1 -1
  294. package/types/tab-nav.type.d.ts +7 -2
  295. package/types/tabs.type.d.ts +9 -1
  296. package/types/tag-group.type.d.ts +64 -1
  297. package/types/{time-line.type-d7daa669.d.ts → time-line.type-b155cb4f.d.ts} +12 -0
  298. package/types/time-line.type.d.ts +1 -1
  299. package/types/timeline-item.type.d.ts +1 -1
  300. package/types/tooltip.type.d.ts +2 -2
  301. package/types/transfer.type.d.ts +185 -1
  302. package/types/tree-menu.type.d.ts +210 -1
  303. package/types/upload-dragger.type.d.ts +2 -2
  304. package/types/{upload-list.type-343e8c11.d.ts → upload-list.type-a29aea50.d.ts} +31 -8
  305. package/types/upload-list.type.d.ts +1 -1
  306. package/types/upload.type.d.ts +1 -1
  307. package/types/user-head.type.d.ts +146 -1
  308. package/types/wizard.type.d.ts +1 -0
  309. package/upload/index.js +64 -34
  310. package/upload/vue.js +9 -5
  311. package/upload-dragger/index.js +22 -20
  312. package/upload-list/index.js +24 -18
  313. package/upload-list/vue.js +9 -4
  314. package/user/index.js +34 -25
  315. package/user/vue.js +1 -1
  316. package/user-head/index.js +3 -3
  317. package/watermark/index.js +11 -0
  318. package/wheel/index.js +3 -0
  319. package/wizard/vue.js +4 -2
  320. package/common/deps/modal-queue.js +0 -6
  321. package/common/deps/requestAnimationFrame.js +0 -25
package/cascader/index.js CHANGED
@@ -50,12 +50,27 @@ const watchValue = ({ api, state }) => (value) => {
50
50
  setTimeout(api.computePresentContent);
51
51
  }
52
52
  };
53
- const watchCheckedValue = ({ api, emit, state }) => (value) => {
53
+ const watchCheckedValue = ({
54
+ nextTick,
55
+ constants,
56
+ dispatch,
57
+ api,
58
+ emit,
59
+ state
60
+ }) => (value) => {
61
+ state.presentText = state.presentTags.length ? "" : null;
54
62
  const { checkStrictly, multiple } = state.config;
55
- api.computePresentContent();
63
+ nextTick(() => {
64
+ api.computePresentContent();
65
+ });
56
66
  if (!multiple && !checkStrictly && state.dropDownVisible) {
57
67
  api.toggleDropDownVisible(false);
58
68
  }
69
+ nextTick(() => {
70
+ dispatch(constants.COMPONENT_NAME.FormItem, constants.EVENT_NAME.FormChange, [
71
+ state.multiple ? state.presentText : state.inputValue
72
+ ]);
73
+ });
59
74
  emit("update:modelValue", value);
60
75
  emit("change", value);
61
76
  setTimeout(api.updateStyle);
@@ -85,10 +100,16 @@ const isEmpty = (val) => {
85
100
  }
86
101
  return false;
87
102
  };
88
- const selfMounted = ({ api, parent, props, refs, state }) => () => {
89
- const { input } = refs;
103
+ const selfMounted = ({
104
+ api,
105
+ parent,
106
+ props,
107
+ vm,
108
+ state
109
+ }) => () => {
110
+ const { input } = vm.$refs;
90
111
  const inputSizeMap = { medium: 36, small: 32, mini: 28 };
91
- input && (input.$parent.popperElm = refs.popper);
112
+ input && (input.$parent.popperElm = vm.$refs.popper);
92
113
  if (input && input.$el) {
93
114
  state.inputInitialHeight = input.$el.offsetHeight || inputSizeMap[state.realSize] || 30;
94
115
  }
@@ -111,11 +132,16 @@ const selfMounted = ({ api, parent, props, refs, state }) => () => {
111
132
  });
112
133
  addResizeListener(parent.$el, api.updateStyle);
113
134
  };
114
- const toggleDropDownVisible = ({ emit, nextTick, refs, state, updatePopper }) => (visible) => {
135
+ const toggleDropDownVisible = ({
136
+ emit,
137
+ vm,
138
+ state,
139
+ updatePopper
140
+ }) => (visible) => {
115
141
  if (state.isDisabled) {
116
142
  return;
117
143
  }
118
- const { input } = refs;
144
+ const { input } = vm.$refs;
119
145
  visible = !isNull(visible) ? visible : !state.dropDownVisible;
120
146
  if (visible !== state.dropDownVisible) {
121
147
  state.dropDownVisible = visible;
@@ -152,21 +178,18 @@ const handleKeyDown = ({ api }) => (event) => {
152
178
  const handleFocus = (emit) => (e) => {
153
179
  emit("focus", e);
154
180
  };
155
- const handleBlur = ({ constants, dispatch, emit, state, api, props }) => (e) => {
181
+ const handleBlur = ({ emit, api, props }) => (e) => {
156
182
  if (props.filterable) {
157
183
  api.computePresentContent();
158
184
  }
159
- dispatch(constants.COMPONENT_NAME.FormItem, constants.EVENT_NAME.FormBlur, [
160
- state.multiple ? state.presentText : state.inputValue
161
- ]);
162
185
  emit("blur", e);
163
186
  };
164
- const handleInput = ({ api, state, refs }) => (val, event) => {
187
+ const handleInput = ({ api, state, vm }) => (val, event) => {
165
188
  event = event || window.event;
166
189
  if (!event) {
167
190
  return;
168
191
  }
169
- const reference = refs.reference;
192
+ const reference = vm.$refs.reference;
170
193
  const key = "init-flag";
171
194
  const value = "true";
172
195
  const isIE = browser.name === "ie";
@@ -185,7 +208,7 @@ const handleInput = ({ api, state, refs }) => (val, event) => {
185
208
  state.filtering = false;
186
209
  }
187
210
  };
188
- const handleClear = (state) => () => {
211
+ const handleClear = (state) => (_event) => {
189
212
  state.presentText = "";
190
213
  state.panel.clearCheckedNodes();
191
214
  };
@@ -194,13 +217,13 @@ const handleExpandChange = ({ constants, dispatch, emit, nextTick, state, update
194
217
  dispatch(constants.COMPONENT_NAME.FormItem, constants.EVENT_NAME.FormBlur, [
195
218
  state.multiple ? state.presentText : state.inputValue
196
219
  ]);
197
- updatePopper(state.panel.$parent);
220
+ updatePopper(state.panel.$parent.$el);
198
221
  });
199
222
  emit("expand-change", value);
200
223
  emit("active-item-change", value);
201
224
  };
202
- const focusFirstNode = ({ refs, state }) => () => {
203
- const { popper, suggestionPanel } = refs;
225
+ const focusFirstNode = ({ vm, state }) => () => {
226
+ const { popper, suggestionPanel } = vm.$refs;
204
227
  let firstNode = null;
205
228
  if (state.filtering && suggestionPanel) {
206
229
  firstNode = suggestionPanel.$el.querySelector(CASCADER.SugItem);
@@ -246,13 +269,19 @@ const computePresentTags = ({ api, props, state }) => () => {
246
269
  }
247
270
  state.checkedNodes = checkedNodes;
248
271
  state.presentTags = tags;
272
+ state.inputValue = null;
273
+ state.presentText = null;
249
274
  if (props.hoverExpand) {
250
275
  api.calcCollapseTags();
251
276
  }
252
277
  };
253
- const calcCollapseTags = ({ state, refs, nextTick }) => () => {
278
+ const calcCollapseTags = ({
279
+ state,
280
+ vm,
281
+ nextTick
282
+ }) => () => {
254
283
  nextTick(() => {
255
- const content = refs["tags-content"];
284
+ const content = vm.$refs["tags-content"];
256
285
  if (state.inputHover || state.dropDownVisible) {
257
286
  return state.isHidden = true;
258
287
  }
@@ -292,17 +321,17 @@ const calcCollapseTags = ({ state, refs, nextTick }) => () => {
292
321
  }
293
322
  });
294
323
  };
295
- const watchInputHover = ({ refs }) => (newVal) => {
324
+ const watchInputHover = ({ vm }) => (newVal) => {
296
325
  const [inputHover, dropDownVisible] = newVal;
297
326
  if (!inputHover && !dropDownVisible) {
298
- const content = refs["tags-content"];
327
+ const content = vm.$refs["tags-content"];
299
328
  content && content.scrollTo({ top: 0, left: 0 });
300
329
  }
301
330
  };
302
- const handleMouseenter = ({ refs, state }) => ($event) => {
331
+ const handleMouseenter = ({ vm, state }) => ($event) => {
303
332
  const dom = $event.target;
304
333
  const textNode = dom && dom.querySelector("span");
305
- const { tooltip } = refs;
334
+ const { tooltip } = vm.$refs;
306
335
  if (textNode && tooltip && textNode.scrollWidth > textNode.offsetWidth) {
307
336
  const text = textNode.textContent;
308
337
  tooltip.state.referenceElm = dom;
@@ -314,7 +343,12 @@ const handleMouseenter = ({ refs, state }) => ($event) => {
314
343
  }
315
344
  };
316
345
  const handleMouseleave = ({ state }) => () => state.tooltipVisible = false;
317
- const getSuggestions = ({ nextTick, props, state, updatePopper }) => () => {
346
+ const getSuggestions = ({
347
+ nextTick,
348
+ props,
349
+ state,
350
+ updatePopper
351
+ }) => () => {
318
352
  let filterMethod = null;
319
353
  if (!(props.filterMethod && typeof props.filterMethod === "function")) {
320
354
  filterMethod = (node, keyword) => ~node.text.indexOf(keyword);
@@ -325,8 +359,9 @@ const getSuggestions = ({ nextTick, props, state, updatePopper }) => () => {
325
359
  if (node.isDisabled) {
326
360
  return false;
327
361
  }
362
+ ;
328
363
  node.text = node.getText(props.showAllLevels, props.separator) || "";
329
- return filterMethod(node, state.inputValue);
364
+ return filterMethod == null ? void 0 : filterMethod(node, state.inputValue);
330
365
  });
331
366
  if (state.multiple) {
332
367
  state.presentTags.forEach((tag) => {
@@ -385,14 +420,19 @@ const handleSuggestionClick = ({ api, state }) => (index) => {
385
420
  api.toggleDropDownVisible(false);
386
421
  }
387
422
  };
388
- const deleteTag = ({ emit, state }) => (index) => {
423
+ const deleteTag = ({
424
+ emit,
425
+ state,
426
+ api
427
+ }) => (index) => {
389
428
  const val = state.checkedValue[index];
390
429
  state.checkedValue = state.checkedValue.filter((n, i) => i !== index);
430
+ api.handleMouseleave();
391
431
  emit("remove-tag", val);
392
432
  };
393
- const updateStyle = ({ parent, refs, state, updatePopper, nextTick, props }) => () => {
433
+ const updateStyle = ({ parent, vm, state, updatePopper, nextTick, props }) => () => {
394
434
  const $el = parent.$el;
395
- const { suggestionPanel } = refs;
435
+ const { suggestionPanel } = vm.$refs;
396
436
  const inputInner = $el.querySelector(CASCADER.InputClass);
397
437
  if (!inputInner) {
398
438
  return;
@@ -416,21 +456,28 @@ const updateStyle = ({ parent, refs, state, updatePopper, nextTick, props }) =>
416
456
  updatePopper();
417
457
  } else {
418
458
  nextTick(() => {
419
- if (state.displayOnly) {
459
+ if (state.multiple && state.isDisplayOnly) {
420
460
  inputInner.style.height = "auto";
421
461
  }
422
462
  });
423
463
  }
424
464
  };
425
465
  const getCheckedNodes = (state) => (leafOnly) => state.panel.getCheckedNodes(leafOnly, state.checkedValue);
426
- const setInputHeightToTag = ({ nextTick, parent, state }) => () => {
466
+ const setInputHeightToTag = ({
467
+ nextTick,
468
+ parent,
469
+ state
470
+ }) => () => {
427
471
  nextTick(() => {
472
+ var _a;
428
473
  const parentEl = parent.$el;
429
- const height = parentEl.querySelector(CASCADER.TagClass).offsetHeight + 6 + "px";
474
+ const height = ((_a = parentEl == null ? void 0 : parentEl.querySelector(CASCADER.TagClass)) == null ? void 0 : _a.offsetHeight) + 6 + "px";
430
475
  if (!state.isDisplayOnly) {
431
- parentEl.querySelector(CASCADER.InputClass).style.height = height;
476
+ const inputDom = parentEl == null ? void 0 : parentEl.querySelector(CASCADER.InputClass);
477
+ inputDom && (inputDom.style.height = height);
432
478
  } else {
433
- parentEl.querySelector(CASCADER.InputClass).style.height = "auto";
479
+ const inputDom = parentEl == null ? void 0 : parentEl.querySelector(CASCADER.InputClass);
480
+ inputDom && (inputDom.style.height = "auto");
434
481
  }
435
482
  });
436
483
  };
@@ -450,7 +497,12 @@ const handleBeforeUpdate = ({ props, api, state }) => () => {
450
497
  api.computePresentContent();
451
498
  }
452
499
  };
453
- const showPlaceholder = ({ props, state, t, constants }) => () => {
500
+ const showPlaceholder = ({
501
+ props,
502
+ state,
503
+ t,
504
+ constants
505
+ }) => () => {
454
506
  let placeholder = null;
455
507
  placeholder = state.multiple && state.presentTags.length || state.present ? "" : props.placeholder || t(constants.placeholder);
456
508
  return placeholder;
package/cascader/vue.js CHANGED
@@ -58,7 +58,17 @@ const api = [
58
58
  "handleMouseenter",
59
59
  "handleMouseleave"
60
60
  ];
61
- const initState = ({ reactive, props, computed, parent, api: api2, t, constants, refs, inject }) => {
61
+ const initState = ({
62
+ reactive,
63
+ props,
64
+ computed,
65
+ parent,
66
+ api: api2,
67
+ t,
68
+ constants,
69
+ vm,
70
+ inject
71
+ }) => {
62
72
  const state = reactive({
63
73
  showAutoWidth: inject("showAutoWidth", null),
64
74
  /** popper 元素是否显示。 它是通过v-show 绑定到页面上,造成隐藏时,popperJs并没有destory,有一定的性能影响 */
@@ -85,7 +95,7 @@ const initState = ({ reactive, props, computed, parent, api: api2, t, constants,
85
95
  leafOnly: computed(() => !state.config.checkStrictly),
86
96
  readonly: computed(() => !props.filterable || state.multiple),
87
97
  clearBtnVisible: computed(() => api2.computClearVisible()),
88
- panel: computed(() => refs.panel),
98
+ panel: computed(() => vm.$refs.panel),
89
99
  placeholder: computed(() => props.placeholder || t(constants.placeholder)),
90
100
  inputValues: computed(() => state.multiple ? state.presentText : state.inputValue),
91
101
  collapseTagsLength: 0,
@@ -95,18 +105,30 @@ const initState = ({ reactive, props, computed, parent, api: api2, t, constants,
95
105
  });
96
106
  return state;
97
107
  };
98
- const initApi = ({ api: api2, state, constants, dispatch, emit, refs, props, updatePopper, nextTick, parent, t }) => {
108
+ const initApi = ({
109
+ api: api2,
110
+ state,
111
+ constants,
112
+ dispatch,
113
+ emit,
114
+ vm,
115
+ props,
116
+ updatePopper,
117
+ nextTick,
118
+ parent,
119
+ t
120
+ }) => {
99
121
  Object.assign(api2, {
100
122
  state,
101
123
  handleFocus: handleFocus(emit),
102
124
  handleClear: handleClear(state),
103
125
  getCheckedNodes: getCheckedNodes(state),
104
- deleteTag: deleteTag({ emit, state }),
126
+ deleteTag: deleteTag({ emit, state, api: api2 }),
105
127
  handleDropdownLeave: handleDropdownLeave(state),
106
- focusFirstNode: focusFirstNode({ refs, state }),
128
+ focusFirstNode: focusFirstNode({ vm, state }),
107
129
  computClearVisible: computClearVisible({ props, state }),
108
130
  showPlaceholder: showPlaceholder({ props, state, t, constants }),
109
- updateStyle: updateStyle({ parent, refs, state, updatePopper, nextTick, props }),
131
+ updateStyle: updateStyle({ parent, vm, state, updatePopper, nextTick, props }),
110
132
  getSuggestions: getSuggestions({ nextTick, props, state, updatePopper }),
111
133
  handleExpandChange: handleExpandChange({ constants, emit, dispatch, nextTick, state, updatePopper }),
112
134
  getConfig: getConfig({ parent, props }),
@@ -115,23 +137,30 @@ const initApi = ({ api: api2, state, constants, dispatch, emit, refs, props, upd
115
137
  handleDelete: handleDelete({ api: api2, state }),
116
138
  computePresentText: computePresentText({ props, state }),
117
139
  handleSuggestionKeyDown: handleSuggestionKeyDown({ api: api2 }),
118
- handleInput: handleInput({ api: api2, state, refs }),
140
+ handleInput: handleInput({ api: api2, state, vm }),
119
141
  handleKeyDown: handleKeyDown({ api: api2 }),
120
142
  watchValue: watchValue({ api: api2, state }),
121
143
  computePresentTags: computePresentTags({ api: api2, props, state }),
122
144
  computePresentContent: computePresentContent({ api: api2, state }),
123
- watchCheckedValue: watchCheckedValue({ api: api2, emit, state }),
124
- toggleDropDownVisible: toggleDropDownVisible({ emit, nextTick, refs, state, updatePopper }),
125
- selfMounted: selfMounted({ api: api2, parent, props, refs, state }),
145
+ watchCheckedValue: watchCheckedValue({ constants, dispatch, api: api2, nextTick, emit, state }),
146
+ toggleDropDownVisible: toggleDropDownVisible({ emit, vm, state, updatePopper }),
147
+ selfMounted: selfMounted({ api: api2, parent, props, vm, state }),
126
148
  handleBeforeUpdate: handleBeforeUpdate({ props, api: api2, state }),
127
- handleBlur: handleBlur({ constants, dispatch, emit, state, api: api2, props }),
128
- calcCollapseTags: calcCollapseTags({ refs, state, nextTick }),
129
- watchInputHover: watchInputHover({ refs }),
130
- handleMouseenter: handleMouseenter({ refs, state }),
149
+ handleBlur: handleBlur({ emit, api: api2, props }),
150
+ calcCollapseTags: calcCollapseTags({ vm, state, nextTick }),
151
+ watchInputHover: watchInputHover({ vm }),
152
+ handleMouseenter: handleMouseenter({ vm, state }),
131
153
  handleMouseleave: handleMouseleave({ state })
132
154
  });
133
155
  };
134
- const initWatch = ({ watch, state, api: api2, props, nextTick, updatePopper }) => {
156
+ const initWatch = ({
157
+ watch,
158
+ state,
159
+ api: api2,
160
+ props,
161
+ nextTick,
162
+ updatePopper
163
+ }) => {
135
164
  watch(() => state.disabled, api2.computePresentContent);
136
165
  watch(() => props.modelValue, api2.watchValue);
137
166
  watch(() => state.checkedValue, api2.watchCheckedValue);
@@ -165,7 +194,18 @@ const initWatch = ({ watch, state, api: api2, props, nextTick, updatePopper }) =
165
194
  );
166
195
  watch([() => state.inputHover, () => state.dropDownVisible], api2.watchInputHover);
167
196
  };
168
- const renderless = (props, { computed, onMounted, onBeforeUnmount, onDeactivated, onUpdated, onBeforeUpdate, reactive, toRefs, watch, inject }, { t, refs, emit, nextTick, constants, parent, slots, dispatch }) => {
197
+ const renderless = (props, {
198
+ computed,
199
+ onMounted,
200
+ onBeforeUnmount,
201
+ onDeactivated,
202
+ onUpdated,
203
+ onBeforeUpdate,
204
+ reactive,
205
+ toRefs,
206
+ watch,
207
+ inject
208
+ }, { t, emit, nextTick, constants, parent, slots, dispatch, vm }) => {
169
209
  parent.tinyForm = parent.tinyForm || inject("form", null);
170
210
  const { updatePopper } = userPopper({
171
211
  reactive,
@@ -174,26 +214,27 @@ const renderless = (props, { computed, onMounted, onBeforeUnmount, onDeactivated
174
214
  props: __spreadProps(__spreadValues({}, props), {
175
215
  placement: DATEPICKER.PlacementMap.left,
176
216
  popperOptions: { boundariesPadding: 0, gpuAcceleration: false },
177
- visibleArrow: true,
217
+ visibleArrow: false,
178
218
  offset: 0,
179
219
  boundariesPadding: 5,
180
220
  arrowOffset: 35
181
221
  }),
182
222
  toRefs,
183
- refs,
223
+ vm,
184
224
  slots,
185
225
  nextTick,
186
226
  onBeforeUnmount,
187
227
  onDeactivated
188
228
  });
189
229
  const api2 = {};
190
- const state = initState({ reactive, props, computed, parent, api: api2, t, constants, refs, inject });
191
- initApi({ api: api2, state, constants, dispatch, emit, refs, props, updatePopper, nextTick, parent, t });
230
+ const state = initState({ reactive, props, computed, parent, api: api2, t, constants, vm, inject });
231
+ initApi({ api: api2, state, constants, dispatch, emit, vm, props, updatePopper, nextTick, parent, t });
192
232
  initWatch({ watch, state, api: api2, props, nextTick, updatePopper });
193
233
  onBeforeUpdate(api2.handleBeforeUpdate);
194
234
  onUpdated(api2.updateStyle);
195
235
  onMounted(api2.selfMounted);
196
236
  parent.$on("handle-clear", (event) => {
237
+ ;
197
238
  api2.handleClear(event);
198
239
  });
199
240
  onBeforeUnmount(() => removeResizeListener(parent.$el, api2.updateStyle));
@@ -3,11 +3,11 @@ const handleExpand = (state) => (e) => state.activeNode = e.target;
3
3
  const handleMouseMove = ({
4
4
  api,
5
5
  parent,
6
- refs,
6
+ vm,
7
7
  state,
8
8
  svg
9
9
  }) => (e) => {
10
- const { hoverZone } = refs;
10
+ const hoverZone = vm.$refs.hoverZone;
11
11
  if (!state.activeNode || !hoverZone) {
12
12
  return;
13
13
  }
@@ -15,9 +15,9 @@ const handleMouseMove = ({
15
15
  if (state.hoverTimer) {
16
16
  clearTimeout(state.hoverTimer);
17
17
  }
18
- const { left } = refs.cascaderMenu.$parent.$el.getBoundingClientRect();
18
+ const { left } = vm.$refs.cascaderMenu.$parent.$el.getBoundingClientRect();
19
19
  const startX = e.clientX - left;
20
- const { offsetWidth, offsetHeight } = refs.cascaderMenu.$parent.$el;
20
+ const { offsetWidth, offsetHeight } = vm.$refs.cascaderMenu.$parent.$el;
21
21
  const top = state.activeNode.offsetTop;
22
22
  const bottom = top + state.activeNode.offsetHeight;
23
23
  hoverZone.innerHTML = `
@@ -25,11 +25,11 @@ const handleMouseMove = ({
25
25
  ${svg}${startX} ${bottom} L${offsetWidth} ${offsetHeight} V${bottom} Z" />
26
26
  `;
27
27
  } else if (!state.hoverTimer) {
28
- state.hoverTimer = setTimeout(api.clearHoverZone, parent.state.config.hoverThreshold);
28
+ state.hoverTimer = setTimeout(api.clearHoverZone, parent.$parent.state.config.hoverThreshold);
29
29
  }
30
30
  };
31
- const clearHoverZone = (refs) => () => {
32
- const { hoverZone } = refs;
31
+ const clearHoverZone = ({ vm }) => () => {
32
+ const { hoverZone } = vm.$refs.hoverZone;
33
33
  if (!hoverZone) {
34
34
  return;
35
35
  }
@@ -4,7 +4,6 @@ import { CASCADER } from "../common";
4
4
  import { random } from "../common/string";
5
5
  const api = ["state", "handleMouseMove", "handleExpand"];
6
6
  const renderless = (props, { computed, reactive }, { vm, parent }) => {
7
- const refs = vm.$refs;
8
7
  const api2 = {};
9
8
  const state = reactive({
10
9
  activeNode: null,
@@ -15,9 +14,9 @@ const renderless = (props, { computed, reactive }, { vm, parent }) => {
15
14
  });
16
15
  Object.assign(api2, {
17
16
  state,
18
- clearHoverZone: clearHoverZone(refs),
17
+ clearHoverZone: clearHoverZone({ vm }),
19
18
  handleExpand: handleExpand(state),
20
- handleMouseMove: handleMouseMove({ api: api2, parent, refs, state, svg: CASCADER.SvgStr })
19
+ handleMouseMove: handleMouseMove({ api: api2, parent, vm, state, svg: CASCADER.SvgStr })
21
20
  });
22
21
  return api2;
23
22
  };
@@ -6,16 +6,13 @@ const close = ({ state, emit }) => () => {
6
6
  emit("close", false);
7
7
  };
8
8
  const syncCheckStatus = ({ state, props, api }) => (value) => {
9
- const { valueField, textField, modelValue: propsModelValue, visible } = props;
9
+ const { valueField, textField, modelValue: propsModelValue } = props;
10
10
  const { lazy, isLeaf: leafField } = api.getNodeConfig();
11
11
  let currentData;
12
12
  let navList = [];
13
13
  let modelValue = value || propsModelValue || [];
14
14
  let len = modelValue.length;
15
15
  let isLeaf;
16
- if (!visible) {
17
- return;
18
- }
19
16
  for (let i = 0; i < len; i++) {
20
17
  const id = modelValue[i];
21
18
  currentData = state.store.getNode(id);
@@ -42,7 +39,6 @@ const watchVisible = ({ emit, state, props, api }) => (visible) => {
42
39
  const { modelValue } = props;
43
40
  if (visible) {
44
41
  api.watchModelValue(modelValue);
45
- api.initTreeStore();
46
42
  }
47
43
  setTimeout(() => {
48
44
  state.toggle = visible;
@@ -115,19 +111,35 @@ const loopSearchOption = ({
115
111
  textField,
116
112
  prefixValue,
117
113
  prefixText,
118
- textSplit = "/"
114
+ textSplit = "/",
115
+ filterMethod,
116
+ level,
117
+ checkStrictly
119
118
  }) => {
120
119
  const list = [];
121
120
  options.forEach((item) => {
121
+ if (item.disabled) {
122
+ return;
123
+ }
122
124
  const text = item[textField];
123
125
  const textNavStr = prefixText ? prefixText + textSplit + text : text;
124
126
  const value = [...prefixValue, item[valueField]];
125
127
  const children = item[childrenField];
126
- if (text.includes(input)) {
127
- list.push({
128
- [valueField]: value,
129
- [textField]: textNavStr
130
- });
128
+ if (checkStrictly === true || !children || children.length === 0) {
129
+ if (typeof filterMethod === "function") {
130
+ const matched = filterMethod({ data: item, label: item.label, value: item.value, level }, input);
131
+ if (matched) {
132
+ list.push({
133
+ [valueField]: value,
134
+ [textField]: textNavStr
135
+ });
136
+ }
137
+ } else if (text.includes(input)) {
138
+ list.push({
139
+ [valueField]: value,
140
+ [textField]: textNavStr
141
+ });
142
+ }
131
143
  }
132
144
  if (children && children.length) {
133
145
  const arr = loopSearchOption({
@@ -138,7 +150,10 @@ const loopSearchOption = ({
138
150
  textField,
139
151
  prefixValue: value,
140
152
  prefixText: textNavStr,
141
- textSplit
153
+ textSplit,
154
+ filterMethod,
155
+ level: level + 1,
156
+ checkStrictly
142
157
  });
143
158
  list.push(...arr);
144
159
  }
@@ -160,7 +175,10 @@ const searchMethod = ({ state, props, api }) => () => {
160
175
  valueField,
161
176
  textField,
162
177
  prefixValue: [],
163
- prefixText: ""
178
+ prefixText: "",
179
+ filterMethod: searchConfig.filterMethod,
180
+ level: 0,
181
+ checkStrictly: props.nodeConfig.checkStrictly
164
182
  });
165
183
  }
166
184
  if (typeof list.then === "function") {
@@ -169,12 +187,12 @@ const searchMethod = ({ state, props, api }) => () => {
169
187
  state.search.filterOptions = list;
170
188
  }
171
189
  };
172
- const searchBoxToggle = ({ state, props, api }) => (bool) => {
190
+ const searchBoxToggle = ({ state, props, api }) => (isShow) => {
173
191
  const { searchConfig = {} } = props;
174
192
  const { lazy } = api.getNodeConfig();
175
- state.search.show = bool;
193
+ state.search.show = isShow;
176
194
  state.search.input = "";
177
- if (bool) {
195
+ if (isShow) {
178
196
  state.search.options = !lazy && searchConfig.options && searchConfig.options.length ? searchConfig.options : state.store.getAllData();
179
197
  api.searchMethod();
180
198
  }
@@ -198,8 +216,7 @@ const created = ({ api }) => () => {
198
216
  api.initTreeStore();
199
217
  };
200
218
  const loadData = ({ props, state }) => (data) => {
201
- const { visible } = props;
202
- if (!visible) {
219
+ if (!props.visible) {
203
220
  return;
204
221
  }
205
222
  state.store.setData(data);
@@ -230,7 +247,7 @@ const getNodeConfig = ({ constants, props }) => () => {
230
247
  return Object.assign({ nodeKey: valueField }, constants.defaultNodeConfig, nodeConfig);
231
248
  };
232
249
  const initTreeStore = ({ props, state, api }) => () => {
233
- const { data, textField, visible } = props;
250
+ const { data, textField } = props;
234
251
  const {
235
252
  nodeKey,
236
253
  lazy,
@@ -247,10 +264,6 @@ const initTreeStore = ({ props, state, api }) => () => {
247
264
  defaultExpandAll,
248
265
  filterNodeMethod
249
266
  } = api.getNodeConfig();
250
- if (!visible || state.store) {
251
- api.syncCheckStatus();
252
- return;
253
- }
254
267
  state.store = new TreeStore({
255
268
  key: nodeKey,
256
269
  data,
@@ -67,6 +67,11 @@ const renderless = (props, { computed, reactive, watch }, { emit, constants }) =
67
67
  computedNavList: computed(() => api2.computedNavListHandler()),
68
68
  showButton: computed(() => {
69
69
  const len = state.navList.length;
70
+ if (!props.nodeConfig.checkStrictly) {
71
+ if (state.level < len - 1) {
72
+ return false;
73
+ }
74
+ }
70
75
  return len && (props.nodeConfig.checkStrictly || state.navList[len - 1].isLeaf);
71
76
  })
72
77
  });
@@ -92,6 +97,7 @@ const renderless = (props, { computed, reactive, watch }, { emit, constants }) =
92
97
  isSelected: isSelected({ state, api: api2, props })
93
98
  });
94
99
  api2.created();
100
+ api2.syncCheckStatus();
95
101
  watch(() => props.visible, api2.watchVisible);
96
102
  watch(() => props.modelValue, api2.watchModelValue, { immediate: true, deep: true });
97
103
  watch(() => props.data, api2.loadData, { deep: true });
@@ -15,9 +15,11 @@ const handleExpand = ({ api, parent, props, state }) => () => {
15
15
  if (!state.isLeaf) {
16
16
  api.handleExpand();
17
17
  }
18
- if (multiple) {
18
+ if (multiple && state.isLeaf) {
19
19
  const checked = state.isLeaf ? props.node.checked : false;
20
20
  api.handleMultiCheckChange(Boolean(checked));
21
+ } else {
22
+ parent.handleExpand(props.node);
21
23
  }
22
24
  });
23
25
  } else {
@@ -37,10 +39,20 @@ const isInPath = (props) => (pathNodes) => {
37
39
  const selectedPathNode = pathNodes[props.node.level - 1] || {};
38
40
  return selectedPathNode.uid === props.node.uid;
39
41
  };
42
+ const handleNodeClick = ({ state, api }) => () => {
43
+ if (!state.isDisabled) {
44
+ if (state.isLeaf) {
45
+ api.handleCheckChange();
46
+ } else {
47
+ api.handleExpand();
48
+ }
49
+ }
50
+ };
40
51
  export {
41
52
  comptCheckPath,
42
53
  handleCheckChange,
43
54
  handleExpand,
44
55
  handleMultiCheckChange,
56
+ handleNodeClick,
45
57
  isInPath
46
58
  };