@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
@@ -1,5 +1,22 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- import { created, handleClick, confirm, reset, wheelChange, clickWheelItem, loadDefault } from "./index";
2
+ import {
3
+ created,
4
+ initValue,
5
+ handleClick,
6
+ confirm,
7
+ reset,
8
+ wheelChange,
9
+ clickWheelItem,
10
+ loadDefault,
11
+ handleSearchBtnClick,
12
+ handleOptionSelect,
13
+ handleClose,
14
+ toggleItemExpand,
15
+ computedCurrentOptions,
16
+ updateValue,
17
+ handleSearchInput,
18
+ updateTitle
19
+ } from "./index";
3
20
  const api = [
4
21
  "state",
5
22
  "created",
@@ -8,58 +25,86 @@ const api = [
8
25
  "reset",
9
26
  "wheelChange",
10
27
  "clickWheelItem",
11
- "loadDefault"
28
+ "loadDefault",
29
+ "handleSearchBtnClick",
30
+ "handleClose",
31
+ "handleSearchInput"
12
32
  ];
13
- const initState = (reactive) => {
33
+ const initState = ({ emitter, reactive, computed, api: api2, props }) => {
14
34
  const state = reactive({
15
35
  dataSource: [],
16
36
  wheelData: [],
37
+ isSearching: false,
17
38
  headerIndex: -1,
18
- showWheel: false,
39
+ showOptions: false,
19
40
  labelLevelsInfo: [],
20
41
  labelsStyle: [],
21
42
  wheelIndex: [],
22
43
  wheelText: "",
23
44
  headerInfo: [],
24
45
  defaultSelectedIndexs: [],
25
- defaultSelectedArray: []
46
+ defaultSelectedArray: [],
47
+ multiSelectEmitter: emitter(),
48
+ searchValue: "",
49
+ optionMap: [],
50
+ currentOptions: computed(() => api2.computedCurrentOptions()),
51
+ showMask: computed(() => props.mask && state.showOptions)
26
52
  });
27
53
  return state;
28
54
  };
29
- const initApi = ({ api: api2, props, state, emit, nextTick, refs }) => {
55
+ const initApi = ({ api: api2, props, state, emit, nextTick, refs, vm }) => {
30
56
  Object.assign(api2, {
31
57
  state,
32
- created: created({ props, state, refs, nextTick }),
58
+ created: created({ api: api2, emit, props, state, refs, nextTick }),
59
+ initValue: initValue({ props, emit }),
33
60
  handleClick: handleClick({ api: api2, props, state }),
34
61
  confirm: confirm({ state, emit }),
35
62
  reset: reset({ api: api2, props, state, emit }),
36
63
  wheelChange: wheelChange(state),
37
64
  clickWheelItem: clickWheelItem({ state, emit }),
38
- loadDefault: loadDefault({ props, state })
65
+ loadDefault: loadDefault({ props, state }),
66
+ handleSearchBtnClick: handleSearchBtnClick({ props, state, nextTick, vm }),
67
+ handleOptionSelect: handleOptionSelect({ api: api2, state, emit }),
68
+ handleClose: handleClose(state),
69
+ toggleItemExpand: toggleItemExpand({ state }),
70
+ computedCurrentOptions: computedCurrentOptions({ state, props }),
71
+ updateValue: updateValue({ state, props, emit }),
72
+ updateTitle: updateTitle({ props, state }),
73
+ handleSearchInput: handleSearchInput({ state, emit })
39
74
  });
40
75
  };
41
- const initWatch = ({ watch, props, state, refs, nextTick }) => {
76
+ const initWatch = ({ api: api2, watch, props, state, refs, nextTick }) => {
42
77
  watch(
43
78
  () => props.dataSource,
44
79
  () => {
45
- api.created({ props, state, refs, nextTick });
80
+ api2.created({ props, state, refs, nextTick });
46
81
  }
47
82
  );
48
83
  watch(
49
84
  () => props.defaultSelectedArray,
50
85
  () => {
51
- api.created({ props, state, refs, nextTick });
86
+ api2.created({ props, state, refs, nextTick });
52
87
  }
53
88
  );
89
+ watch(
90
+ () => props.modelValue,
91
+ () => {
92
+ api2.updateTitle();
93
+ },
94
+ { deep: true }
95
+ );
54
96
  };
55
- const renderless = (props, { onMounted, reactive, watch }, { emit, nextTick, refs }) => {
97
+ const renderless = (props, { onMounted, reactive, watch, provide, computed }, { emit, nextTick, refs, vm, emitter }) => {
56
98
  const api2 = {};
57
- const state = initState(reactive);
58
- initApi({ api: api2, props, state, emit, nextTick, refs });
59
- initWatch({ watch, props, state, refs, nextTick });
99
+ const state = initState({ emitter, reactive, computed, api: api2, props });
100
+ provide("multiSelect", vm);
101
+ initApi({ api: api2, props, state, emit, nextTick, refs, vm });
102
+ initWatch({ api: api2, watch, props, state, refs, nextTick });
60
103
  onMounted(() => {
61
104
  api2.created({ props, state, refs, nextTick });
62
105
  });
106
+ state.multiSelectEmitter.on("multiSelectItemClick", api2.handleOptionSelect);
107
+ state.multiSelectEmitter.on("toggleItemExpand", api2.toggleItemExpand);
63
108
  return api2;
64
109
  };
65
110
  export {
@@ -0,0 +1,23 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ const handleClick = ({ props, multiSelect }) => (event) => {
3
+ if (props.option.disabled) {
4
+ return;
5
+ }
6
+ event.stopPropagation();
7
+ if (props.disabled !== true && multiSelect.disabled !== true) {
8
+ multiSelect.state.multiSelectEmitter.emit("multiSelectItemClick", props.option);
9
+ }
10
+ };
11
+ const toggleExpand = ({ props, multiSelect }) => (event) => {
12
+ if (props.option.disabled) {
13
+ return;
14
+ }
15
+ event.stopPropagation();
16
+ if (props.disabled !== true && multiSelect.disabled !== true) {
17
+ multiSelect.state.multiSelectEmitter.emit("toggleItemExpand", props.option);
18
+ }
19
+ };
20
+ export {
21
+ handleClick,
22
+ toggleExpand
23
+ };
@@ -0,0 +1,31 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ import { handleClick, toggleExpand } from "./index";
3
+ const api = [
4
+ "state",
5
+ "created",
6
+ "handleClick",
7
+ "confirm",
8
+ "reset",
9
+ "wheelChange",
10
+ "clickWheelItem",
11
+ "loadDefault",
12
+ "toggleExpand"
13
+ ];
14
+ const initApi = ({ api: api2, props, state, multiSelect }) => {
15
+ Object.assign(api2, {
16
+ state,
17
+ handleClick: handleClick({ props, multiSelect }),
18
+ toggleExpand: toggleExpand({ props, multiSelect })
19
+ });
20
+ };
21
+ const renderless = (props, { reactive, inject }, { emit, nextTick, refs, vm }) => {
22
+ const api2 = {};
23
+ const multiSelect = inject("multiSelect");
24
+ const state = reactive({});
25
+ initApi({ api: api2, multiSelect, props, state });
26
+ return api2;
27
+ };
28
+ export {
29
+ api,
30
+ renderless
31
+ };
package/numeric/index.js CHANGED
@@ -16,11 +16,11 @@ const initService = (service) => {
16
16
  };
17
17
  };
18
18
  const getDecimal = (props) => (value) => getMiniDecimal(value, props.plugin);
19
- const watchValue = ({ api, state, nextTick }) => (value) => {
19
+ const watchValue = ({ api, props, state, nextTick }) => (value) => {
20
20
  if (value === state.currentValue) {
21
21
  return;
22
22
  }
23
- api.setCurrentValue(value);
23
+ api.setCurrentValue(value, props.changeCompat);
24
24
  nextTick(() => {
25
25
  api.dispatchDisplayedValue();
26
26
  });
@@ -61,7 +61,7 @@ const increase = ({ api, props, state }) => () => {
61
61
  if (state.inputDisabled || state.maxDisabled) {
62
62
  return;
63
63
  }
64
- const value = (props.mouseWheel ? state.displayValue : props.modelValue) || 0;
64
+ const value = (props.mouseWheel ? state.displayValue : Number(state.userInput)) || 0;
65
65
  if (value.toString().includes("e")) {
66
66
  return;
67
67
  }
@@ -79,7 +79,7 @@ const decrease = ({ api, props, state }) => () => {
79
79
  if (state.inputDisabled || state.minDisabled) {
80
80
  return;
81
81
  }
82
- const value = (props.mouseWheel ? state.displayValue : props.modelValue) || 0;
82
+ const value = (props.mouseWheel ? state.displayValue : Number(state.userInput)) || 0;
83
83
  if (value.toString().includes("e")) {
84
84
  return;
85
85
  }
@@ -108,9 +108,9 @@ const handleBlur = ({
108
108
  dispatch(constants.COMPONENT_NAME, constants.EVENT_NAME.blur, [state.displayValue]);
109
109
  }
110
110
  };
111
- const handleFocus = ({ emit, state, props, api, refs }) => (event) => {
111
+ const handleFocus = ({ emit, state, props, api, vm }) => (event) => {
112
112
  if (props.disabled) {
113
- refs.input.blur();
113
+ vm.$refs.input.blur();
114
114
  }
115
115
  state.inputStatus = true;
116
116
  const currentValue = api.getDecimal(state.currentValue);
@@ -126,8 +126,8 @@ const handleFocus = ({ emit, state, props, api, refs }) => (event) => {
126
126
  }
127
127
  emit("focus", event);
128
128
  };
129
- const focus = (refs) => () => {
130
- refs.input.focus();
129
+ const focus = (vm) => () => {
130
+ vm.$refs.input.focus();
131
131
  };
132
132
  const getEmitValue = (args) => {
133
133
  let { newVal, emitValue, allowEmpty, defaultVal, bigNew, oldVal } = args;
@@ -163,7 +163,7 @@ const setCurrentValue = ({
163
163
  emit,
164
164
  props,
165
165
  state
166
- }) => (newVal) => {
166
+ }) => (newVal, emitChangeFlag = true) => {
167
167
  const { max, min, allowEmpty, validateEvent, stringMode, plugin } = props;
168
168
  const { format } = state;
169
169
  const oldVal = state.currentValue;
@@ -183,7 +183,9 @@ const setCurrentValue = ({
183
183
  state.lastInput = emitValue;
184
184
  if (emitValue !== oldVal) {
185
185
  emit("update:modelValue", emitValue);
186
- emit("change", emitValue, oldVal);
186
+ if (emitChangeFlag) {
187
+ emit("change", emitValue, oldVal);
188
+ }
187
189
  state.currentValue = emitValue;
188
190
  state.userInput = emitValue;
189
191
  if (validateEvent && oldVal === "") {
@@ -233,8 +235,21 @@ const handleInputChange = ({ api, state, props }) => (event) => {
233
235
  }
234
236
  api.setCurrentValue(value);
235
237
  };
236
- const select = (refs) => () => refs.input.select();
238
+ const select = (vm) => () => vm.$refs.input.select();
237
239
  const mounted = ({ constants, parent, props, state }) => () => {
240
+ if (props.shape === "filter") {
241
+ state.controls = false;
242
+ }
243
+ if (isNumber(state.currentValue) && state.currentValue < props.min) {
244
+ state.currentValue = props.min;
245
+ state.lastInput = props.min;
246
+ state.userInput = props.min;
247
+ }
248
+ if (isNumber(state.currentValue) && state.currentValue > props.max) {
249
+ state.currentValue = props.max;
250
+ state.lastInput = props.max;
251
+ state.userInput = props.max;
252
+ }
238
253
  const innerInput = parent.$el.querySelector("input");
239
254
  innerInput.setAttribute(constants.KEY, constants.VALUE);
240
255
  innerInput.setAttribute(constants.MAX, props.max);
@@ -255,8 +270,11 @@ const updated = ({ constants, parent, state }) => () => {
255
270
  const innerInput = parent.$el.querySelector("input");
256
271
  innerInput && innerInput.setAttribute(constants.VALUENOW, state.currentValue);
257
272
  };
258
- const displayValue = ({ props, state }) => () => {
273
+ const displayValue = ({ props, state, api }) => () => {
259
274
  const { currentValue, inputStatus, userInput } = state;
275
+ if (props.shape === "filter" && props.filter) {
276
+ api.filterValue();
277
+ }
260
278
  if (inputStatus) {
261
279
  return userInput;
262
280
  }
@@ -321,10 +339,24 @@ const getDisplayOnlyText = ({ parent, state, props }) => () => {
321
339
  }
322
340
  }
323
341
  };
342
+ const filterValue = ({ state }) => () => {
343
+ return (state.radioVal || "") + state.lastInput;
344
+ };
345
+ const handleClear = ({ state, emit }) => () => {
346
+ state.currentValue = "";
347
+ state.userInput = "";
348
+ state.lastInput = "";
349
+ state.radioVal = "";
350
+ emit("clear");
351
+ };
352
+ const handleChange = ({ state, emit }) => () => {
353
+ emit("filter-change", state.radioVal);
354
+ };
324
355
  export {
325
356
  decrease,
326
357
  dispatchDisplayedValue,
327
358
  displayValue,
359
+ filterValue,
328
360
  focus,
329
361
  getDecimal,
330
362
  getDisplayOnlyText,
@@ -333,6 +365,8 @@ export {
333
365
  getPrecision,
334
366
  getUnitPrecision,
335
367
  handleBlur,
368
+ handleChange,
369
+ handleClear,
336
370
  handleFocus,
337
371
  handleInput,
338
372
  handleInputChange,
package/numeric/vue.js CHANGED
@@ -25,7 +25,10 @@ import {
25
25
  initService,
26
26
  dispatchDisplayedValue,
27
27
  getDisplayedValue,
28
- getDisplayOnlyText
28
+ getDisplayOnlyText,
29
+ filterValue,
30
+ handleClear,
31
+ handleChange
29
32
  } from "./index";
30
33
  const api = [
31
34
  "state",
@@ -37,9 +40,19 @@ const api = [
37
40
  "handleInputChange",
38
41
  "mouseEvent",
39
42
  "focus",
40
- "select"
43
+ "select",
44
+ "handleClear",
45
+ "handleChange"
41
46
  ];
42
- const initState = ({ reactive, computed, props, api: api2, $service, parent }) => {
47
+ const initState = ({
48
+ reactive,
49
+ computed,
50
+ props,
51
+ api: api2,
52
+ $service,
53
+ constants,
54
+ parent
55
+ }) => {
43
56
  const state = reactive({
44
57
  currentValue: props.modelValue,
45
58
  userInput: props.modelValue,
@@ -57,8 +70,13 @@ const initState = ({ reactive, computed, props, api: api2, $service, parent }) =
57
70
  maxDisabled: computed(() => !props.circulate && state.currentValue >= props.max || state.formDisabled),
58
71
  controlsAtRight: computed(() => props.controls && props.controlsPosition === "right"),
59
72
  format: computed(() => getUnitPrecision({ service: $service, props })),
73
+ filterMenu: constants.FILTER_OPTION,
74
+ filterValue: computed(() => api2.filterValue()),
75
+ handleClear: computed(() => api2.handleClear()),
76
+ handleChange: computed(() => api2.handleClear()),
60
77
  isDisplayOnly: computed(() => props.displayOnly || (parent.tinyForm || {}).displayOnly),
61
- displayOnlyText: computed(() => api2.getDisplayOnlyText())
78
+ displayOnlyText: computed(() => api2.getDisplayOnlyText()),
79
+ controls: props.controls
62
80
  });
63
81
  return state;
64
82
  };
@@ -67,7 +85,7 @@ const initApi = ({
67
85
  props,
68
86
  state,
69
87
  parent,
70
- refs,
88
+ vm,
71
89
  emit,
72
90
  dispatch,
73
91
  constants,
@@ -75,30 +93,33 @@ const initApi = ({
75
93
  }) => {
76
94
  Object.assign(api2, {
77
95
  state,
78
- focus: focus(refs),
79
- select: select(refs),
96
+ focus: focus(vm),
97
+ select: select(vm),
80
98
  getPrecision: getPrecision(),
81
99
  toPrecision: toPrecision(state),
82
100
  updated: updated({ constants, parent, state }),
83
101
  mounted: mounted({ constants, parent, props, state }),
84
102
  unmounted: unmounted({ parent, state }),
85
103
  getDecimal: getDecimal(props),
86
- handleFocus: handleFocus({ emit, state, props, api: api2, refs }),
104
+ handleFocus: handleFocus({ emit, state, props, api: api2, vm }),
87
105
  decrease: decrease({ api: api2, props, state }),
88
106
  increase: increase({ api: api2, props, state }),
89
107
  handleInput: handleInput({ state, api: api2, emit, props }),
90
108
  getNumPecision: getNumPecision({ api: api2, props }),
91
- displayValue: displayValue({ props, state }),
109
+ displayValue: displayValue({ props, state, api: api2 }),
92
110
  internalDecrease: internalDecrease({ api: api2, state }),
93
111
  internalIncrease: internalIncrease({ api: api2, state }),
94
112
  handleInputChange: handleInputChange({ api: api2, state, props }),
95
113
  mouseEvent: mouseEvent({ api: api2, props, state }),
96
114
  handleBlur: handleBlur({ constants, dispatch, emit, props, state, api: api2 }),
97
- watchValue: watchValue({ api: api2, state, nextTick }),
115
+ watchValue: watchValue({ api: api2, props, state, nextTick }),
98
116
  setCurrentValue: setCurrentValue({ api: api2, constants, dispatch, emit, props, state }),
99
117
  dispatchDisplayedValue: dispatchDisplayedValue({ api: api2, state, dispatch }),
100
118
  getDisplayedValue: getDisplayedValue({ state, props }),
101
- getDisplayOnlyText: getDisplayOnlyText({ parent, props, state })
119
+ getDisplayOnlyText: getDisplayOnlyText({ parent, props, state }),
120
+ filterValue: filterValue({ state }),
121
+ handleClear: handleClear({ state, emit }),
122
+ handleChange: handleChange({ state, emit })
102
123
  });
103
124
  api2.getDecimal(0);
104
125
  };
@@ -108,20 +129,24 @@ const initWatch = ({
108
129
  props,
109
130
  api: api2
110
131
  }) => {
111
- watch(() => [props.max, props.min], ([curMax, curMin]) => {
112
- if (curMax < curMin) {
113
- throw new Error("[Numeric]: The maximum value should not be less than to the minimum value");
114
- }
115
- }, { immediate: true });
132
+ watch(
133
+ () => [props.max, props.min],
134
+ ([curMax, curMin]) => {
135
+ if (curMax < curMin) {
136
+ throw new Error("[Numeric]: The maximum value should not be less than to the minimum value");
137
+ }
138
+ },
139
+ { immediate: true }
140
+ );
116
141
  watch(() => props.modelValue, api2.watchValue, { immediate: true });
117
142
  watch(() => state.isDisplayOnly, api2.dispatchDisplayedValue);
118
143
  };
119
- const renderless = (props, { computed, onMounted, onUpdated, onUnmounted, reactive, watch, inject }, { parent, emit, refs, constants, dispatch, service, nextTick }) => {
144
+ const renderless = (props, { computed, onMounted, onUpdated, onUnmounted, reactive, watch, inject }, { parent, emit, vm, constants, dispatch, service, nextTick }) => {
120
145
  const api2 = {};
121
146
  const $service = initService(service);
122
- const state = initState({ reactive, computed, props, api: api2, $service, parent });
147
+ const state = initState({ reactive, computed, props, api: api2, constants, $service, parent });
123
148
  parent.tinyForm = parent.tinyForm || inject("form", null);
124
- initApi({ api: api2, props, state, parent, refs, emit, dispatch, constants, nextTick });
149
+ initApi({ api: api2, props, state, parent, vm, emit, dispatch, constants, nextTick });
125
150
  initWatch({ state, watch, props, api: api2 });
126
151
  onMounted(() => {
127
152
  api2.dispatchDisplayedValue();
package/option/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
2
  import { getObj } from "../common/object";
3
+ import { omitText } from "../common/string";
3
4
  const escapeRegexpString = (value = "") => String(value).replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
4
5
  const isEqual = ({ select, state }) => (a, b) => {
5
6
  if (!state.isObject) {
@@ -14,15 +15,26 @@ const contains = ({ select, state }) => (arr = [], target = null) => {
14
15
  return arr && arr.includes(target);
15
16
  } else {
16
17
  const valueKey = select.valueKey;
17
- return arr && arr.some((item) => getObj(item, valueKey) === getObj(target, valueKey));
18
+ return arr && arr.some((item) => {
19
+ return getObj(item, valueKey) === getObj(target, valueKey);
20
+ });
18
21
  }
19
22
  };
20
- const handleGroupDisabled = (state) => (val) => {
23
+ const handleGroupDisabled = ({ state, vm }) => (val) => {
21
24
  state.groupDisabled = val;
25
+ vm.groupDisabled = val;
22
26
  };
23
- const hoverItem = ({ select, props, state, vm }) => () => {
24
- if (!props.disabled && !state.groupDisabled) {
25
- select.state.hoverIndex = select.state.options.indexOf(vm);
27
+ const hoverItem = ({ select, props, state }) => (e) => {
28
+ const dom = e.target;
29
+ const text = dom.textContent;
30
+ const style = window.getComputedStyle(dom);
31
+ const font = style.font;
32
+ const rect = dom.getBoundingClientRect();
33
+ const textWidth = rect.width - parseInt(style.paddingLeft || 0) - parseInt(style.paddingRight || 0);
34
+ const res = omitText(text, font, textWidth);
35
+ state.showTitle = res.o;
36
+ if (!props.disabled && !state.groupDisabled && !select.state.disabledOptionHover) {
37
+ select.state.hoverIndex = select.state.optionIndexArr.indexOf(state.index);
26
38
  }
27
39
  };
28
40
  const selectOptionClick = ({ props, state, select, constants, vm }) => () => {
@@ -32,14 +44,19 @@ const selectOptionClick = ({ props, state, select, constants, vm }) => () => {
32
44
  select.state.selectEmitter.emit(constants.EVENT_NAME.handleOptionClick, vm, true);
33
45
  }
34
46
  };
35
- const queryChange = ({ props, state }) => (query) => {
36
- state.visible = new RegExp(escapeRegexpString(query), "i").test(state.currentLabel) || props.created;
47
+ const queryChange = ({ select, props, state }) => (query) => {
48
+ const oldVisible = state.visible;
49
+ const newVisible = new RegExp(escapeRegexpString(query), "i").test(state.currentLabel) || !!props.created;
50
+ if (oldVisible !== newVisible) {
51
+ state.visible = newVisible;
52
+ select.state.filteredOptionsCount += newVisible ? 1 : -1;
53
+ }
37
54
  };
38
55
  const toggleEvent = ({ props, vm, type }) => {
39
56
  const optionEl = vm.$refs.option;
40
- Object.keys(props.events).forEach((ev) => {
57
+ for (let ev in props.events) {
41
58
  optionEl[type + "EventListener"](ev, props.events[ev]);
42
- });
59
+ }
43
60
  };
44
61
  const initValue = ({ select, props, constants, vm }) => () => {
45
62
  if (select.multiple && props.required) {
@@ -48,6 +65,7 @@ const initValue = ({ select, props, constants, vm }) => () => {
48
65
  };
49
66
  export {
50
67
  contains,
68
+ escapeRegexpString,
51
69
  handleGroupDisabled,
52
70
  hoverItem,
53
71
  initValue,
package/option/vue.js CHANGED
@@ -1,4 +1,7 @@
1
- import "../chunk-G2ADBYYC.js";
1
+ import {
2
+ __spreadProps,
3
+ __spreadValues
4
+ } from "../chunk-G2ADBYYC.js";
2
5
  import {
3
6
  isEqual,
4
7
  contains,
@@ -16,30 +19,33 @@ const initState = ({ reactive, computed, props, api: api2, markRaw, select, pare
16
19
  created: computed(() => props.created),
17
20
  index: -1,
18
21
  select: markRaw(select),
19
- hover: false,
22
+ hover: computed(() => !state.select.optimization && state.select.state.hoverValue === state.index),
20
23
  visible: true,
21
24
  hitState: false,
22
25
  groupDisabled: false,
23
- disabled: computed(() => props.disabled),
26
+ disabled: computed(() => props.disabled || state.groupDisabled),
24
27
  isObject: computed(() => Object.prototype.toString.call(props.value).toLowerCase() === "[object object]"),
25
28
  currentLabel: computed(() => props.label || (state.isObject ? "" : props.value)),
29
+ showTitle: false,
26
30
  currentValue: computed(() => props.value || props.label || ""),
27
31
  itemSelected: computed(() => {
28
32
  if (!select.multiple) {
29
- return api2.isEqual(props.value, select.modelValue);
33
+ return api2.isEqual(props.value, select.state.modelValue);
30
34
  } else {
31
- return api2.contains(select.modelValue, props.value);
35
+ return api2.contains(select.state.modelValue, props.value);
32
36
  }
33
37
  }),
34
38
  limitReached: computed(() => {
35
39
  if (select.multiple) {
36
40
  const multipleLimit = select.state.multipleLimit;
37
- return !state.itemSelected && (select.modelValue || []).length >= multipleLimit && multipleLimit > 0;
41
+ return !state.itemSelected && (select.state.modelValue || []).length >= multipleLimit && multipleLimit > 0;
38
42
  } else {
39
43
  return false;
40
44
  }
41
45
  }),
42
- selectCls: computed(() => state.itemSelected ? "checked-sur" : "check")
46
+ selectCls: computed(() => {
47
+ return state.itemSelected ? "checked-sur" : "check";
48
+ })
43
49
  });
44
50
  return state;
45
51
  };
@@ -48,10 +54,10 @@ const initApi = ({ api: api2, props, state, select, constants, vm }) => {
48
54
  state,
49
55
  isEqual: isEqual({ select, state }),
50
56
  contains: contains({ select, state }),
51
- hoverItem: hoverItem({ select, vm, props, state }),
52
- queryChange: queryChange({ props, state }),
57
+ hoverItem: hoverItem({ select, props, state }),
58
+ queryChange: queryChange({ select, props, state }),
53
59
  selectOptionClick: selectOptionClick({ constants, vm, props, state, select }),
54
- handleGroupDisabled: handleGroupDisabled(state),
60
+ handleGroupDisabled: handleGroupDisabled({ state, vm }),
55
61
  initValue: initValue({ select, props, constants, vm })
56
62
  });
57
63
  };
@@ -87,20 +93,33 @@ const initOnMounted = ({ onMounted, props, api: api2, vm, state, constants, sele
87
93
  onMounted(() => {
88
94
  state.el = vm.$el;
89
95
  toggleEvent({ props, vm, type: "add" });
90
- select.state.selectEmitter.on(constants.EVENT_NAME.queryChange, api2.queryChange);
96
+ if (!select.optimization) {
97
+ select.state.selectEmitter.on(constants.EVENT_NAME.queryChange, api2.queryChange);
98
+ }
91
99
  api2.initValue();
92
100
  });
93
101
  };
94
- const initOnBeforeUnmount = ({ onBeforeUnmount, props, select, vm }) => {
102
+ const initOnBeforeUnmount = ({ onBeforeUnmount, props, select, vm, state }) => {
95
103
  onBeforeUnmount(() => {
96
- const index = select.state.cachedOptions.indexOf(vm);
104
+ let selectedOptions = select.multiple ? select.state.selected : [select.state.selected];
105
+ const index = select.state.cachedOptions.findIndex((opt) => opt.state === state);
106
+ const selectedIndex = selectedOptions.findIndex((opt) => opt.state === state);
97
107
  toggleEvent({ props, vm, type: "remove" });
98
- if (index === -1) {
108
+ if (index > -1 && selectedIndex < 0) {
99
109
  select.state.cachedOptions.splice(index, 1);
100
110
  }
101
- select.onOptionDestroy(select.state.options.indexOf(vm));
111
+ select.onOptionDestroy(select.state.options.findIndex((opt) => opt.state === state));
102
112
  });
103
113
  };
114
+ const initSelectState = ({ state, select, markRaw, props }) => {
115
+ let vm = __spreadProps(__spreadValues({}, props), { state });
116
+ select.state.options.push(markRaw(vm));
117
+ select.state.cachedOptions.push(markRaw(vm));
118
+ select.state.optionsIndex++;
119
+ state.index = select.state.optionsIndex;
120
+ select.state.optionsCount++;
121
+ select.state.filteredOptionsCount++;
122
+ };
104
123
  const renderless = (props, { computed, onMounted, onBeforeUnmount, reactive, watch, inject, markRaw }, { vm, parent }) => {
105
124
  const api2 = {};
106
125
  const select = inject("select");
@@ -109,12 +128,9 @@ const renderless = (props, { computed, onMounted, onBeforeUnmount, reactive, wat
109
128
  initApi({ api: api2, props, state, select, constants, vm });
110
129
  initWatch({ watch, props, state, select, constants });
111
130
  initOnMounted({ onMounted, props, api: api2, vm, state, constants, select });
112
- initOnBeforeUnmount({ onBeforeUnmount, props, select, vm });
113
- select.state.options.push(markRaw(vm));
114
- select.state.cachedOptions.push(markRaw(vm));
115
- select.state.optionsCount++;
116
- select.state.filteredOptionsCount++;
117
- vm.$on(constants.EVENT_NAME.handleGroupDisabled, api2.handleGroupDisabled);
131
+ initOnBeforeUnmount({ onBeforeUnmount, props, select, vm, state });
132
+ initSelectState({ state, select, markRaw, props });
133
+ parent.$on(constants.EVENT_NAME.handleGroupDisabled, api2.handleGroupDisabled);
118
134
  return api2;
119
135
  };
120
136
  export {
@@ -2,9 +2,9 @@ import "../chunk-G2ADBYYC.js";
2
2
  const queryChange = ({ select, state, vm }) => () => {
3
3
  state.visible = true;
4
4
  if (Array.isArray(select.state.options)) {
5
- const groupOptions = select.state.options.filter(
6
- (option) => option.state.parent && vm && option.state.parent.label === vm.label
7
- );
5
+ const groupOptions = select.state.options.filter((option) => {
6
+ return option.state.parent.$parent && vm && option.state.parent.$parent.label === vm.label;
7
+ });
8
8
  if (Array.isArray(groupOptions)) {
9
9
  state.visible = groupOptions.some((option) => option.visible === true);
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/vue-renderless",
3
- "version": "3.13.1",
3
+ "version": "3.14.0",
4
4
  "description": "An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.",
5
5
  "homepage": "https://opentiny.design/tiny-vue",
6
6
  "keywords": [