@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
@@ -1,15 +1,9 @@
1
1
  import {
2
2
  __spreadValues
3
3
  } from "../chunk-G2ADBYYC.js";
4
- import { cloneDeep } from "@opentiny/vue-renderless/chart-core/deps/utils";
5
- import { getDirection } from "@opentiny/vue-renderless/common/deps/touch";
6
- import {
7
- getDays,
8
- lastMonth,
9
- nextMonth,
10
- getCalendar,
11
- transformArray
12
- } from "@opentiny/vue-renderless/common/calendar/calendar";
4
+ import { cloneDeep } from "../chart-core/deps/utils";
5
+ import { getDirection } from "../common/deps/touch";
6
+ import { getDays, lastMonth, nextMonth, getCalendar, transformArray } from "../common/calendar/calendar";
13
7
  const getTime = (date) => new Date(date).getTime();
14
8
  const newSchedule = ({ emit }) => (date) => emit("new-schedule", date);
15
9
  const isShowNewSchedule = ({ props }) => (date) => props.showNewSchedule instanceof Function ? props.showNewSchedule(date) : false;
@@ -66,7 +60,7 @@ const isSelectedDate = ({ state }) => (day) => {
66
60
  const getDayBgColor = ({ props }) => (day) => {
67
61
  const date = day.year + "-" + day.month + "-" + day.value;
68
62
  const isFunction = props.setDayBgColor instanceof Function;
69
- const bgColor = isFunction ? props.setDayBgColor(date) : "";
63
+ const bgColor = isFunction ? props.setDayBgColor(date) : "white";
70
64
  return bgColor;
71
65
  };
72
66
  const parseDate = (time) => {
@@ -201,7 +195,9 @@ const selectDay = ({ state, emit }) => (day, i) => {
201
195
  } else {
202
196
  state.selectedDates.push(date);
203
197
  }
198
+ emit("update:modelValue", state.selectedDates);
204
199
  emit("selected-date-change", state.selectedDates);
200
+ emit("date-click", date);
205
201
  } else {
206
202
  if (day.isNext) {
207
203
  const { year, month } = nextMonth(state.activeYear, state.activeMonth);
@@ -215,6 +211,8 @@ const selectDay = ({ state, emit }) => (day, i) => {
215
211
  }
216
212
  state.selectedDate = day.value.toString().length > 2 ? day.value : `${state.activeYear}-${state.activeMonth}-${day.value}`;
217
213
  state.showSelectedDateEvents = true;
214
+ emit("update:modelValue", state.selectedDate);
215
+ emit("date-click", state.selectedDate);
218
216
  }
219
217
  };
220
218
  const getEventByMonth = ({ state }) => (year, month) => {
@@ -230,7 +228,7 @@ const getEventByMonth = ({ state }) => (year, month) => {
230
228
  day: state.weekDays[new Date(date).getDay()],
231
229
  events: []
232
230
  };
233
- state.events.filter((item) => {
231
+ state.events.forEach((item) => {
234
232
  if (eventInThisTime(item, startTime, endTime)) {
235
233
  obj.events.push(item);
236
234
  state.monthEventsLength += 1;
@@ -276,7 +274,7 @@ const getEventByDate = ({ state }) => (date, events) => {
276
274
  const endTime = getTime(date + " " + state.dayEndTime);
277
275
  state.curWeekEvents[date] = [];
278
276
  events ? events = [] : state.curWeekEvents[date] = [];
279
- state.events.filter((item) => {
277
+ state.events.forEach((item) => {
280
278
  if (eventInThisTime(item, startTime, endTime)) {
281
279
  events ? events.push(item) : state.curWeekEvents[date].push(item);
282
280
  }
@@ -40,7 +40,7 @@ import {
40
40
  touchmove,
41
41
  touchend
42
42
  } from "./index";
43
- import throttle from "@opentiny/vue-renderless/common/deps/throttle";
43
+ import throttle from "../common/deps/throttle";
44
44
  const api = [
45
45
  "state",
46
46
  "renderProxy",
@@ -135,6 +135,19 @@ const initState = ({ reactive, props, computed, api: api2, images, modesIcon })
135
135
  return state;
136
136
  };
137
137
  const initWatch = ({ watch, props, state, emit, api: api2, nextTick }) => {
138
+ watch(
139
+ () => props.modelValue,
140
+ (value) => {
141
+ if (value) {
142
+ if (props.multiSelect && Array.isArray(value)) {
143
+ state.selectedDates = value;
144
+ } else {
145
+ state.selectedDate = value;
146
+ }
147
+ }
148
+ },
149
+ { immediate: true, deep: true }
150
+ );
138
151
  watch(
139
152
  () => props.mode,
140
153
  () => {
@@ -151,9 +164,6 @@ const initWatch = ({ watch, props, state, emit, api: api2, nextTick }) => {
151
164
  watch(
152
165
  () => state.selectedDate,
153
166
  () => {
154
- if (state.mode === "month") {
155
- api2.getEventByDate(state.selectedDate, state.selectedDateEvents);
156
- }
157
167
  emit("selected-date-change", state.selectedDate);
158
168
  },
159
169
  { deep: true }
@@ -184,6 +194,9 @@ const initWatch = ({ watch, props, state, emit, api: api2, nextTick }) => {
184
194
  });
185
195
  }
186
196
  );
197
+ addWatch({ watch, props, state, emit, api: api2 });
198
+ };
199
+ const addWatch = ({ watch, props, state, emit, api: api2 }) => {
187
200
  watch(
188
201
  () => props.month,
189
202
  (val, oldVal) => {
package/cascader/index.js CHANGED
@@ -50,12 +50,25 @@ 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
63
  api.computePresentContent();
56
64
  if (!multiple && !checkStrictly && state.dropDownVisible) {
57
65
  api.toggleDropDownVisible(false);
58
66
  }
67
+ nextTick(() => {
68
+ dispatch(constants.COMPONENT_NAME.FormItem, constants.EVENT_NAME.FormBlur, [
69
+ state.multiple ? state.presentText : state.inputValue
70
+ ]);
71
+ });
59
72
  emit("update:modelValue", value);
60
73
  emit("change", value);
61
74
  setTimeout(api.updateStyle);
@@ -85,10 +98,16 @@ const isEmpty = (val) => {
85
98
  }
86
99
  return false;
87
100
  };
88
- const selfMounted = ({ api, parent, props, refs, state }) => () => {
89
- const { input } = refs;
101
+ const selfMounted = ({
102
+ api,
103
+ parent,
104
+ props,
105
+ vm,
106
+ state
107
+ }) => () => {
108
+ const { input } = vm.$refs;
90
109
  const inputSizeMap = { medium: 36, small: 32, mini: 28 };
91
- input && (input.$parent.popperElm = refs.popper);
110
+ input && (input.$parent.popperElm = vm.$refs.popper);
92
111
  if (input && input.$el) {
93
112
  state.inputInitialHeight = input.$el.offsetHeight || inputSizeMap[state.realSize] || 30;
94
113
  }
@@ -111,11 +130,16 @@ const selfMounted = ({ api, parent, props, refs, state }) => () => {
111
130
  });
112
131
  addResizeListener(parent.$el, api.updateStyle);
113
132
  };
114
- const toggleDropDownVisible = ({ emit, nextTick, refs, state, updatePopper }) => (visible) => {
133
+ const toggleDropDownVisible = ({
134
+ emit,
135
+ vm,
136
+ state,
137
+ updatePopper
138
+ }) => (visible) => {
115
139
  if (state.isDisabled) {
116
140
  return;
117
141
  }
118
- const { input } = refs;
142
+ const { input } = vm.$refs;
119
143
  visible = !isNull(visible) ? visible : !state.dropDownVisible;
120
144
  if (visible !== state.dropDownVisible) {
121
145
  state.dropDownVisible = visible;
@@ -152,21 +176,18 @@ const handleKeyDown = ({ api }) => (event) => {
152
176
  const handleFocus = (emit) => (e) => {
153
177
  emit("focus", e);
154
178
  };
155
- const handleBlur = ({ constants, dispatch, emit, state, api, props }) => (e) => {
179
+ const handleBlur = ({ emit, api, props }) => (e) => {
156
180
  if (props.filterable) {
157
181
  api.computePresentContent();
158
182
  }
159
- dispatch(constants.COMPONENT_NAME.FormItem, constants.EVENT_NAME.FormBlur, [
160
- state.multiple ? state.presentText : state.inputValue
161
- ]);
162
183
  emit("blur", e);
163
184
  };
164
- const handleInput = ({ api, state, refs }) => (val, event) => {
185
+ const handleInput = ({ api, state, vm }) => (val, event) => {
165
186
  event = event || window.event;
166
187
  if (!event) {
167
188
  return;
168
189
  }
169
- const reference = refs.reference;
190
+ const reference = vm.$refs.reference;
170
191
  const key = "init-flag";
171
192
  const value = "true";
172
193
  const isIE = browser.name === "ie";
@@ -185,7 +206,7 @@ const handleInput = ({ api, state, refs }) => (val, event) => {
185
206
  state.filtering = false;
186
207
  }
187
208
  };
188
- const handleClear = (state) => () => {
209
+ const handleClear = (state) => (_event) => {
189
210
  state.presentText = "";
190
211
  state.panel.clearCheckedNodes();
191
212
  };
@@ -194,13 +215,13 @@ const handleExpandChange = ({ constants, dispatch, emit, nextTick, state, update
194
215
  dispatch(constants.COMPONENT_NAME.FormItem, constants.EVENT_NAME.FormBlur, [
195
216
  state.multiple ? state.presentText : state.inputValue
196
217
  ]);
197
- updatePopper(state.panel.$parent);
218
+ updatePopper(state.panel.$parent.$el);
198
219
  });
199
220
  emit("expand-change", value);
200
221
  emit("active-item-change", value);
201
222
  };
202
- const focusFirstNode = ({ refs, state }) => () => {
203
- const { popper, suggestionPanel } = refs;
223
+ const focusFirstNode = ({ vm, state }) => () => {
224
+ const { popper, suggestionPanel } = vm.$refs;
204
225
  let firstNode = null;
205
226
  if (state.filtering && suggestionPanel) {
206
227
  firstNode = suggestionPanel.$el.querySelector(CASCADER.SugItem);
@@ -246,13 +267,19 @@ const computePresentTags = ({ api, props, state }) => () => {
246
267
  }
247
268
  state.checkedNodes = checkedNodes;
248
269
  state.presentTags = tags;
270
+ state.inputValue = null;
271
+ state.presentText = null;
249
272
  if (props.hoverExpand) {
250
273
  api.calcCollapseTags();
251
274
  }
252
275
  };
253
- const calcCollapseTags = ({ state, refs, nextTick }) => () => {
276
+ const calcCollapseTags = ({
277
+ state,
278
+ vm,
279
+ nextTick
280
+ }) => () => {
254
281
  nextTick(() => {
255
- const content = refs["tags-content"];
282
+ const content = vm.$refs["tags-content"];
256
283
  if (state.inputHover || state.dropDownVisible) {
257
284
  return state.isHidden = true;
258
285
  }
@@ -268,7 +295,7 @@ const calcCollapseTags = ({ state, refs, nextTick }) => () => {
268
295
  const collapseTagWidth = tagsLength && parseFloat(collapseTagContentWidth) + parseFloat(marginRight) + parseFloat(marginLeft);
269
296
  const tags = Array.from(content.querySelectorAll(".tiny-tag"));
270
297
  let { total, dom, idx } = { total: collapseTagWidth, dom: null, idx: 0 };
271
- tags.some((tag, index) => {
298
+ tags.forEach((tag, index) => {
272
299
  if (tag !== tagsLength) {
273
300
  const { width: tagContentWidth, marginRight: marginRight2, marginLeft: marginLeft2 } = tag && window.getComputedStyle(tag);
274
301
  total += parseFloat(tagContentWidth) + parseFloat(marginRight2) + parseFloat(marginLeft2);
@@ -292,17 +319,17 @@ const calcCollapseTags = ({ state, refs, nextTick }) => () => {
292
319
  }
293
320
  });
294
321
  };
295
- const watchInputHover = ({ refs }) => (newVal) => {
322
+ const watchInputHover = ({ vm }) => (newVal) => {
296
323
  const [inputHover, dropDownVisible] = newVal;
297
324
  if (!inputHover && !dropDownVisible) {
298
- const content = refs["tags-content"];
325
+ const content = vm.$refs["tags-content"];
299
326
  content && content.scrollTo({ top: 0, left: 0 });
300
327
  }
301
328
  };
302
- const handleMouseenter = ({ refs, state }) => ($event) => {
329
+ const handleMouseenter = ({ vm, state }) => ($event) => {
303
330
  const dom = $event.target;
304
331
  const textNode = dom && dom.querySelector("span");
305
- const { tooltip } = refs;
332
+ const { tooltip } = vm.$refs;
306
333
  if (textNode && tooltip && textNode.scrollWidth > textNode.offsetWidth) {
307
334
  const text = textNode.textContent;
308
335
  tooltip.state.referenceElm = dom;
@@ -314,7 +341,12 @@ const handleMouseenter = ({ refs, state }) => ($event) => {
314
341
  }
315
342
  };
316
343
  const handleMouseleave = ({ state }) => () => state.tooltipVisible = false;
317
- const getSuggestions = ({ nextTick, props, state, updatePopper }) => () => {
344
+ const getSuggestions = ({
345
+ nextTick,
346
+ props,
347
+ state,
348
+ updatePopper
349
+ }) => () => {
318
350
  let filterMethod = null;
319
351
  if (!(props.filterMethod && typeof props.filterMethod === "function")) {
320
352
  filterMethod = (node, keyword) => ~node.text.indexOf(keyword);
@@ -325,8 +357,9 @@ const getSuggestions = ({ nextTick, props, state, updatePopper }) => () => {
325
357
  if (node.isDisabled) {
326
358
  return false;
327
359
  }
360
+ ;
328
361
  node.text = node.getText(props.showAllLevels, props.separator) || "";
329
- return filterMethod(node, state.inputValue);
362
+ return filterMethod == null ? void 0 : filterMethod(node, state.inputValue);
330
363
  });
331
364
  if (state.multiple) {
332
365
  state.presentTags.forEach((tag) => {
@@ -390,16 +423,17 @@ const deleteTag = ({ emit, state }) => (index) => {
390
423
  state.checkedValue = state.checkedValue.filter((n, i) => i !== index);
391
424
  emit("remove-tag", val);
392
425
  };
393
- const updateStyle = ({ parent, refs, state, updatePopper, nextTick, props }) => () => {
426
+ const updateStyle = ({ parent, vm, state, updatePopper, nextTick, props }) => () => {
394
427
  const $el = parent.$el;
395
- const { suggestionPanel } = refs;
428
+ const { suggestionPanel } = vm.$refs;
396
429
  const inputInner = $el.querySelector(CASCADER.InputClass);
397
430
  if (!inputInner) {
398
431
  return;
399
432
  }
400
433
  const tags = $el.querySelector(CASCADER.TagClass);
401
434
  let suggestionPanelEl = null;
402
- if (suggestionPanel && (suggestionPanelEl = suggestionPanel.$el)) {
435
+ if (suggestionPanel) {
436
+ suggestionPanelEl = suggestionPanel.$el;
403
437
  const suggestionList = suggestionPanelEl.querySelector(CASCADER.ListClass);
404
438
  suggestionList.style.minWidth = inputInner.offsetWidth + "px";
405
439
  }
@@ -415,21 +449,28 @@ const updateStyle = ({ parent, refs, state, updatePopper, nextTick, props }) =>
415
449
  updatePopper();
416
450
  } else {
417
451
  nextTick(() => {
418
- if (state.displayOnly) {
452
+ if (state.multiple && state.isDisplayOnly) {
419
453
  inputInner.style.height = "auto";
420
454
  }
421
455
  });
422
456
  }
423
457
  };
424
458
  const getCheckedNodes = (state) => (leafOnly) => state.panel.getCheckedNodes(leafOnly, state.checkedValue);
425
- const setInputHeightToTag = ({ nextTick, parent, state }) => () => {
459
+ const setInputHeightToTag = ({
460
+ nextTick,
461
+ parent,
462
+ state
463
+ }) => () => {
426
464
  nextTick(() => {
465
+ var _a;
427
466
  const parentEl = parent.$el;
428
- const height = parentEl.querySelector(CASCADER.TagClass).offsetHeight + 6 + "px";
467
+ const height = ((_a = parentEl == null ? void 0 : parentEl.querySelector(CASCADER.TagClass)) == null ? void 0 : _a.offsetHeight) + 6 + "px";
429
468
  if (!state.isDisplayOnly) {
430
- parentEl.querySelector(CASCADER.InputClass).style.height = height;
469
+ const inputDom = parentEl == null ? void 0 : parentEl.querySelector(CASCADER.InputClass);
470
+ inputDom && (inputDom.style.height = height);
431
471
  } else {
432
- parentEl.querySelector(CASCADER.InputClass).style.height = "auto";
472
+ const inputDom = parentEl == null ? void 0 : parentEl.querySelector(CASCADER.InputClass);
473
+ inputDom && (inputDom.style.height = "auto");
433
474
  }
434
475
  });
435
476
  };
@@ -449,7 +490,12 @@ const handleBeforeUpdate = ({ props, api, state }) => () => {
449
490
  api.computePresentContent();
450
491
  }
451
492
  };
452
- const showPlaceholder = ({ props, state, t, constants }) => () => {
493
+ const showPlaceholder = ({
494
+ props,
495
+ state,
496
+ t,
497
+ constants
498
+ }) => () => {
453
499
  let placeholder = null;
454
500
  placeholder = state.multiple && state.presentTags.length || state.present ? "" : props.placeholder || t(constants.placeholder);
455
501
  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,7 +105,19 @@ 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),
@@ -103,10 +125,10 @@ const initApi = ({ api: api2, state, constants, dispatch, emit, refs, props, upd
103
125
  getCheckedNodes: getCheckedNodes(state),
104
126
  deleteTag: deleteTag({ emit, state }),
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,7 @@ 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, { computed, onMounted, onBeforeUnmount, onDeactivated, onUpdated, onBeforeUpdate, reactive, toRefs, watch, inject }, { t, emit, nextTick, constants, parent, slots, dispatch, vm }) => {
169
198
  parent.tinyForm = parent.tinyForm || inject("form", null);
170
199
  const { updatePopper } = userPopper({
171
200
  reactive,
@@ -174,26 +203,27 @@ const renderless = (props, { computed, onMounted, onBeforeUnmount, onDeactivated
174
203
  props: __spreadProps(__spreadValues({}, props), {
175
204
  placement: DATEPICKER.PlacementMap.left,
176
205
  popperOptions: { boundariesPadding: 0, gpuAcceleration: false },
177
- visibleArrow: true,
206
+ visibleArrow: false,
178
207
  offset: 0,
179
208
  boundariesPadding: 5,
180
209
  arrowOffset: 35
181
210
  }),
182
211
  toRefs,
183
- refs,
212
+ vm,
184
213
  slots,
185
214
  nextTick,
186
215
  onBeforeUnmount,
187
216
  onDeactivated
188
217
  });
189
218
  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 });
219
+ const state = initState({ reactive, props, computed, parent, api: api2, t, constants, vm, inject });
220
+ initApi({ api: api2, state, constants, dispatch, emit, vm, props, updatePopper, nextTick, parent, t });
192
221
  initWatch({ watch, state, api: api2, props, nextTick, updatePopper });
193
222
  onBeforeUpdate(api2.handleBeforeUpdate);
194
223
  onUpdated(api2.updateStyle);
195
224
  onMounted(api2.selfMounted);
196
225
  parent.$on("handle-clear", (event) => {
226
+ ;
197
227
  api2.handleClear(event);
198
228
  });
199
229
  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
  };