@opentiny/vue-renderless 3.13.2 → 3.14.1

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 (320) 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/bigInt.js +2 -2
  54. package/common/date.js +7 -5
  55. package/common/deps/clickoutside.js +6 -2
  56. package/common/deps/date-util.js +4 -2
  57. package/common/deps/dom.js +19 -4
  58. package/common/deps/popper.js +44 -11
  59. package/common/deps/resize-event.js +1 -0
  60. package/common/deps/touch-emulator.js +4 -1
  61. package/common/deps/tree-model/node.js +2 -2
  62. package/common/deps/tree-model/tree-store.js +2 -13
  63. package/common/deps/useRect.js +25 -0
  64. package/common/deps/vue-popper.js +38 -20
  65. package/common/index.js +2 -2
  66. package/common/runtime.js +1 -1
  67. package/common/string.js +2 -2
  68. package/common/type.js +2 -1
  69. package/common/validate/rules/enum.js +1 -1
  70. package/common/validate/rules/pattern.js +2 -2
  71. package/common/validate/rules/range.js +8 -5
  72. package/common/validate/rules/required.js +1 -1
  73. package/common/validate/rules/type.js +5 -5
  74. package/common/validate/rules/whitespace.js +1 -1
  75. package/common/validate/util.js +15 -16
  76. package/common/validate/validations/integer.js +1 -1
  77. package/common/validate/validations/method.js +1 -1
  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 +15 -6
  85. package/date-table/index.js +35 -53
  86. package/date-table/vue.js +4 -2
  87. package/dialog-box/index.js +46 -14
  88. package/dialog-box/vue.js +30 -7
  89. package/dialog-select/index.js +6 -3
  90. package/dialog-select/vue.js +8 -4
  91. package/drawer/index.js +27 -5
  92. package/drawer/vue.js +14 -7
  93. package/dropdown/index.js +7 -7
  94. package/dropdown/vue.js +6 -2
  95. package/dropdown-item/index.js +9 -1
  96. package/dropdown-item/mf.js +6 -10
  97. package/dropdown-item/vue.js +20 -7
  98. package/dropdown-menu/index.js +20 -7
  99. package/dropdown-menu/vue.js +4 -3
  100. package/exception/index.js +2 -7
  101. package/exception/vue.js +7 -10
  102. package/fall-menu/index.js +5 -1
  103. package/fall-menu/vue.js +13 -2
  104. package/file-upload/index.js +68 -18
  105. package/file-upload/vue.js +38 -8
  106. package/filter-box/index.js +1 -0
  107. package/float-button/index.js +42 -0
  108. package/float-button/vue.js +101 -0
  109. package/floating-button/index.js +62 -16
  110. package/floating-button/vue.js +27 -9
  111. package/flowchart/index.js +134 -25
  112. package/flowchart/node.js +13 -4
  113. package/flowchart/vue.js +16 -4
  114. package/form/vue.js +8 -0
  115. package/form-item/index.js +5 -5
  116. package/form-item/vue.js +3 -1
  117. package/fullscreen/index.js +5 -5
  118. package/fullscreen/vue.js +3 -3
  119. package/grid/plugins/export.js +5 -2
  120. package/grid/utils/column.js +1 -0
  121. package/grid/utils/dom.js +7 -1
  122. package/image/index.js +6 -1
  123. package/image/vue.js +6 -3
  124. package/image-viewer/index.js +62 -51
  125. package/image-viewer/vue.js +17 -5
  126. package/input/index.js +81 -20
  127. package/input/vue.js +44 -18
  128. package/ip-address/index.js +61 -19
  129. package/ip-address/vue.js +22 -4
  130. package/link/vue.js +3 -1
  131. package/loading/index.js +2 -2
  132. package/loading/vue.js +8 -2
  133. package/logout/index.js +1 -1
  134. package/menu/index.js +15 -2
  135. package/menu/vue.js +22 -17
  136. package/mind-map/index.js +47 -0
  137. package/mind-map/vue.js +53 -0
  138. package/modal/index.js +44 -4
  139. package/modal/vue.js +18 -4
  140. package/multi-select/index.js +186 -11
  141. package/multi-select/vue.js +60 -15
  142. package/multi-select-item/index.js +23 -0
  143. package/multi-select-item/vue.js +31 -0
  144. package/numeric/index.js +48 -12
  145. package/numeric/vue.js +44 -19
  146. package/option/index.js +27 -9
  147. package/option/vue.js +37 -21
  148. package/option-group/index.js +3 -3
  149. package/package.json +1 -1
  150. package/pager/index.js +18 -4
  151. package/pager/vue.js +16 -5
  152. package/picker/index.js +290 -77
  153. package/picker/mb.js +42 -0
  154. package/picker/vue.js +76 -20
  155. package/picker-column/index.js +1 -1
  156. package/pop-upload/vue.js +3 -0
  157. package/popconfirm/index.js +3 -6
  158. package/popconfirm/vue.js +1 -1
  159. package/popeditor/index.js +73 -34
  160. package/popeditor/vue.js +15 -11
  161. package/popover/index.js +4 -4
  162. package/popover/vue.js +6 -6
  163. package/popup/index.js +3 -3
  164. package/popup/vue.js +5 -5
  165. package/pull-refresh/index.js +13 -13
  166. package/pull-refresh/vue.js +5 -4
  167. package/radio/index.js +0 -17
  168. package/radio/vue.js +4 -10
  169. package/rate/index.js +1 -1
  170. package/rate/vue.js +0 -2
  171. package/record/index.js +4 -1
  172. package/rich-text/clipboard.js +54 -0
  173. package/rich-text/index.js +192 -0
  174. package/rich-text/module/file-upload.js +107 -0
  175. package/rich-text/module/image-drop.js +63 -0
  176. package/rich-text/module/image-upload.js +89 -0
  177. package/rich-text/options.js +141 -0
  178. package/rich-text/table-module.js +382 -0
  179. package/rich-text/vue.js +102 -0
  180. package/{rich-text-edtior → rich-text-editor}/index.js +2 -2
  181. package/{rich-text-edtior → rich-text-editor}/vue.js +2 -5
  182. package/scrollbar/index.js +11 -11
  183. package/scrollbar/vue-bar.js +3 -3
  184. package/scrollbar/vue.js +5 -5
  185. package/search/index.js +9 -9
  186. package/search/vue.js +8 -6
  187. package/select/index.js +442 -393
  188. package/select/vue.js +278 -164
  189. package/select-dropdown/index.js +61 -3
  190. package/select-dropdown/vue.js +85 -8
  191. package/select-view/index.js +3 -1
  192. package/selected-box/index.js +2 -0
  193. package/selected-box/vue.js +6 -3
  194. package/signature/index.js +241 -0
  195. package/signature/vue.js +88 -0
  196. package/skeleton/index.js +14 -0
  197. package/skeleton/vue.js +15 -0
  198. package/skeleton-item/vue.js +15 -0
  199. package/slider/index.js +70 -17
  200. package/slider/vue.js +16 -7
  201. package/split/index.js +5 -3
  202. package/split/vue.js +4 -6
  203. package/standard-list-item/index.js +15 -1
  204. package/standard-list-item/vue.js +6 -5
  205. package/steps/index.js +25 -2
  206. package/steps/slide-bar.js +8 -1
  207. package/steps/vue.js +15 -3
  208. package/tab-item-mf/vue.js +14 -8
  209. package/tab-nav/index.js +30 -5
  210. package/tab-nav/vue.js +16 -4
  211. package/tabbar/vue.js +9 -3
  212. package/tabbar-item/vue.js +3 -2
  213. package/tabs/index.js +16 -4
  214. package/tabs/vue.js +2 -1
  215. package/tabs-mf/index.js +20 -6
  216. package/tabs-mf/vue-nav.js +26 -11
  217. package/tabs-mf/vue.js +7 -7
  218. package/tabs-mf/wheel.js +1 -0
  219. package/tag/index.js +1 -1
  220. package/tag-group/index.js +2 -1
  221. package/time/index.js +5 -2
  222. package/time/vue.js +1 -1
  223. package/time-line/index.js +3 -3
  224. package/time-line/vue.js +2 -2
  225. package/time-picker-mobile/index.js +24 -5
  226. package/time-picker-mobile/vue.js +17 -7
  227. package/time-range/index.js +2 -0
  228. package/timeline-item/vue.js +1 -1
  229. package/tooltip/index.js +6 -3
  230. package/tooltip/vue.js +4 -4
  231. package/transfer/index.js +20 -22
  232. package/transfer/vue.js +1 -6
  233. package/transfer-panel/vue.js +3 -5
  234. package/tree/index.js +21 -4
  235. package/tree/vue.js +10 -8
  236. package/tree-menu/index.js +29 -3
  237. package/tree-menu/vue.js +28 -15
  238. package/tree-node/index.js +18 -18
  239. package/tree-node/vue.js +6 -5
  240. package/types/action-sheet.type.d.ts +118 -1
  241. package/types/amount.type.d.ts +168 -1
  242. package/types/area.type.d.ts +134 -1
  243. package/types/async-flowchart.type.d.ts +72 -0
  244. package/types/autocomplete.type.d.ts +199 -1
  245. package/types/badge.type.d.ts +3 -1
  246. package/types/breadcrumb-item.type.d.ts +2 -0
  247. package/types/breadcrumb.type.d.ts +2 -0
  248. package/types/button-group.type.d.ts +3 -3
  249. package/types/button.type.d.ts +4 -0
  250. package/types/cascader-menu.type.d.ts +3 -4
  251. package/types/cascader-node.type.d.ts +5 -2
  252. package/types/cascader-panel.type-2bd03be3.d.ts +241 -0
  253. package/types/cascader-panel.type.d.ts +3 -241
  254. package/types/cascader.type.d.ts +329 -1
  255. package/types/checkbox.type.d.ts +6 -0
  256. package/types/collapse.type.d.ts +19 -2
  257. package/types/date-picker.type.d.ts +38 -1
  258. package/types/dialog-box.type.d.ts +13 -3
  259. package/types/drawer.type.d.ts +133 -1
  260. package/types/{dropdown-item.type-8ea6c633.d.ts → dropdown-item.type-8475a549.d.ts} +7 -13
  261. package/types/dropdown-item.type.d.ts +1 -1
  262. package/types/dropdown-menu.type.d.ts +1 -1
  263. package/types/dropdown.type.d.ts +1 -5
  264. package/types/fall-menu.type.d.ts +94 -1
  265. package/types/file-upload.type.d.ts +1 -1
  266. package/types/float-button.type.d.ts +123 -0
  267. package/types/form-item.type.d.ts +1 -1
  268. package/types/{form.type-d0fd42f3.d.ts → form.type-a2dc0099.d.ts} +4 -1
  269. package/types/form.type.d.ts +1 -1
  270. package/types/{index-e0250f63.d.ts → index-b012f687.d.ts} +9 -0
  271. package/types/input.type.d.ts +2 -6
  272. package/types/ip-address.type.d.ts +160 -1
  273. package/types/link.type.d.ts +6 -3
  274. package/types/loading.type.d.ts +7 -0
  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 +12 -0
  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 +4 -0
  282. package/types/popover.type.d.ts +3 -3
  283. package/types/progress.type.d.ts +2 -0
  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 +14 -3
  292. package/types/tab-bar.type.d.ts +1 -1
  293. package/types/tab-nav.type.d.ts +7 -2
  294. package/types/tabs.type.d.ts +9 -1
  295. package/types/tag-group.type.d.ts +64 -1
  296. package/types/{time-line.type-d7daa669.d.ts → time-line.type-b155cb4f.d.ts} +12 -0
  297. package/types/time-line.type.d.ts +1 -1
  298. package/types/timeline-item.type.d.ts +1 -1
  299. package/types/tooltip.type.d.ts +2 -2
  300. package/types/transfer.type.d.ts +185 -1
  301. package/types/tree-menu.type.d.ts +210 -1
  302. package/types/upload-dragger.type.d.ts +1 -1
  303. package/types/{upload-list.type-343e8c11.d.ts → upload-list.type-6d6e3d0e.d.ts} +35 -8
  304. package/types/upload-list.type.d.ts +1 -1
  305. package/types/upload.type.d.ts +1 -1
  306. package/types/user-head.type.d.ts +146 -1
  307. package/types/wizard.type.d.ts +1 -0
  308. package/upload/index.js +64 -34
  309. package/upload/vue.js +9 -5
  310. package/upload-dragger/index.js +22 -20
  311. package/upload-list/index.js +24 -18
  312. package/upload-list/vue.js +9 -4
  313. package/user/index.js +35 -26
  314. package/user/vue.js +1 -1
  315. package/user-head/index.js +3 -3
  316. package/watermark/index.js +11 -0
  317. package/wheel/index.js +3 -0
  318. package/wizard/vue.js +4 -2
  319. package/common/deps/modal-queue.js +0 -6
  320. package/common/deps/requestAnimationFrame.js +0 -25
@@ -1,6 +1,64 @@
1
- import "../chunk-G2ADBYYC.js";
1
+ import {
2
+ __spreadProps,
3
+ __spreadValues
4
+ } from "../chunk-G2ADBYYC.js";
2
5
  import { cloneDeep } from "../chart-core/deps/utils";
3
- const created = ({ props, state, refs, nextTick }) => () => {
6
+ const initValue = ({ props, emit }) => () => {
7
+ const { modelValue, dataSource = [], disabled } = props;
8
+ if (disabled) {
9
+ return;
10
+ }
11
+ let value = [];
12
+ dataSource == null ? void 0 : dataSource.forEach((data, index) => {
13
+ const isArrayVal = Array.isArray(modelValue[index]);
14
+ if (data.multiple) {
15
+ value.push(isArrayVal ? modelValue[index] : []);
16
+ } else {
17
+ value.push(isArrayVal ? "" : modelValue[index] || "");
18
+ }
19
+ });
20
+ emit("update:modelValue", value);
21
+ };
22
+ const updateValue = ({ state, props, emit }) => (value) => {
23
+ const activeIndex = state.headerIndex;
24
+ const values = cloneDeep(props.modelValue);
25
+ if (!values) {
26
+ return;
27
+ }
28
+ if (Array.isArray(values[state.headerIndex])) {
29
+ const currentVal = values[activeIndex];
30
+ values[activeIndex] = currentVal.includes(value) ? currentVal.filter((i) => i !== value) : [...currentVal, value];
31
+ } else {
32
+ values[activeIndex] = value;
33
+ }
34
+ emit("update:modelValue", values);
35
+ };
36
+ const getOption = (options, target) => {
37
+ var _a;
38
+ for (const option of options) {
39
+ if (option.value === target) {
40
+ return option;
41
+ }
42
+ if ((_a = option.children) == null ? void 0 : _a.length) {
43
+ const result = getOption(option.children, target);
44
+ if (result) {
45
+ return result;
46
+ }
47
+ }
48
+ }
49
+ return null;
50
+ };
51
+ const updateTitle = ({ props, state }) => () => {
52
+ const { modelValue = [], dataSource = [] } = props;
53
+ const { headerInfo } = state;
54
+ modelValue.forEach((value, index) => {
55
+ var _a;
56
+ if (!dataSource[index].multiple) {
57
+ headerInfo[index].title = ((_a = getOption(dataSource[index].options, value)) == null ? void 0 : _a.label) || headerInfo[index].title;
58
+ }
59
+ });
60
+ };
61
+ const created = ({ api, emit, props, state, refs, nextTick }) => () => {
4
62
  nextTick(() => {
5
63
  state.dataSource = cloneDeep(props.dataSource);
6
64
  state.defaultSelectedArray = cloneDeep(props.defaultSelectedArray);
@@ -9,43 +67,131 @@ const created = ({ props, state, refs, nextTick }) => () => {
9
67
  state.headerInfo = state.dataSource.map((item) => {
10
68
  return { isSelected: false, title: item.title, isUP: false };
11
69
  });
70
+ api.initValue({ props, emit });
71
+ if (props.type === "list") {
72
+ state.dataSource.forEach((item, index) => {
73
+ const { flattenData, dataMap } = getFlatOptions(item.options);
74
+ item.options = flattenData;
75
+ state.optionMap[index] = dataMap;
76
+ });
77
+ }
78
+ });
79
+ };
80
+ const computedCurrentOptions = ({ state, props }) => () => {
81
+ const { options = [], multiple } = state.dataSource[state.headerIndex] || {};
82
+ const selectedValue = props.modelValue[state.headerIndex];
83
+ options.forEach((item) => {
84
+ var _a;
85
+ item.show = state.isSearching ? item.label.includes(state.searchValue) : ((_a = item.show) != null ? _a : parent == null ? void 0 : parent.expanded) || item.level === 0;
86
+ item.active = multiple ? selectedValue.includes(item.value) : item.value === selectedValue;
87
+ });
88
+ return options.filter((i) => i.show);
89
+ };
90
+ const getFlatOptions = (options) => {
91
+ const flattenData = [];
92
+ const dataMap = {};
93
+ const getChild = (data, level = 0, parent2) => {
94
+ data.forEach((item, index) => {
95
+ var _a, _b;
96
+ const id = parent2 ? parent2.id + index : String(index);
97
+ const parentId = (parent2 == null ? void 0 : parent2.id) || "";
98
+ const expanded = (parent2 == null ? void 0 : parent2.expanded) && ((_a = item.children) == null ? void 0 : _a.length) && item.expanded || false;
99
+ const currentData = __spreadProps(__spreadValues({}, item), { id, level, expanded, parentId });
100
+ flattenData.push(currentData);
101
+ if ((_b = item.children) == null ? void 0 : _b.length) {
102
+ getChild(item.children, level + 1, currentData);
103
+ }
104
+ dataMap[currentData.id] = item;
105
+ });
106
+ };
107
+ getChild(options);
108
+ flattenData.forEach((item) => {
109
+ if (item.children) {
110
+ item.hasChild = item.children.length > 0;
111
+ delete item.children;
112
+ }
12
113
  });
114
+ return { flattenData, dataMap };
13
115
  };
14
116
  const handleClick = ({ api, props, state }) => (value) => {
15
117
  var _a, _b, _c;
16
- state.wheelData = (_a = props.dataSource[value]) == null ? void 0 : _a.children;
118
+ if (props.disabled || props.dataSource[value].disabled) {
119
+ return;
120
+ }
121
+ if (props.type === "wheel") {
122
+ state.wheelData = (_a = props.dataSource[value]) == null ? void 0 : _a.options;
123
+ }
17
124
  if (state.headerIndex === -1) {
18
- state.showWheel = true;
125
+ state.showOptions = true;
19
126
  state.headerIndex = value;
20
127
  state.headerInfo[value] = getNewHeaderInfo(state.headerInfo, value, true);
21
128
  state.defaultSelectedIndexs = (_b = state.defaultSelectedArray[value]) != null ? _b : api.loadDefault(value);
22
129
  } else if (state.headerIndex !== value) {
23
- state.showWheel = true;
130
+ state.showOptions = true;
24
131
  state.headerInfo[state.headerIndex] = getNewHeaderInfo(state.headerInfo, state.headerIndex, false);
25
132
  state.headerIndex = value;
26
133
  state.headerInfo[value] = getNewHeaderInfo(state.headerInfo, value, true);
27
134
  state.defaultSelectedIndexs = (_c = state.defaultSelectedArray[value]) != null ? _c : api.loadDefault(value);
28
135
  } else {
29
- state.showWheel = !state.showWheel;
136
+ state.showOptions = !state.showOptions;
30
137
  const { isUP } = state.headerInfo[value];
31
138
  state.headerInfo[value] = getNewHeaderInfo(state.headerInfo, value, !isUP);
32
139
  }
33
140
  };
141
+ const handleOptionSelect = ({ api, state, emit }) => (option) => {
142
+ api.updateValue(option.value);
143
+ emit("item-click", state.optionMap[state.headerIndex][option.id], state.headerIndex);
144
+ if (!state.dataSource[state.headerIndex].multiple) {
145
+ api.handleClose();
146
+ }
147
+ };
148
+ const handleSearchInput = ({ state, emit }) => () => {
149
+ const { searchValue } = state;
150
+ emit("update:searchValue", searchValue);
151
+ };
152
+ const toggleChildExpand = (state, parentId, index) => {
153
+ const { options } = state.dataSource[state.headerIndex];
154
+ for (let i = index + 1; i < options.length; i++) {
155
+ if (options[i].parentId === parentId) {
156
+ options[i].show = !options[i].show;
157
+ } else {
158
+ break;
159
+ }
160
+ }
161
+ };
162
+ const toggleItemExpand = ({ state }) => (option) => {
163
+ const index = state.dataSource[state.headerIndex].options.findIndex((i) => i.id === option.id);
164
+ if (index !== -1) {
165
+ const target = state.dataSource[state.headerIndex].options[index];
166
+ target.expanded = !target.expanded;
167
+ toggleChildExpand(state, target.id, index);
168
+ }
169
+ };
34
170
  const confirm = ({ state, emit }) => () => {
35
171
  const wheelLevelItems = getWheelLevelItems(state.wheelData, state.defaultSelectedIndexs);
36
172
  const { selectedLabels, selectedItems } = getSelected(wheelLevelItems, state.defaultSelectedIndexs);
37
173
  state.headerInfo[state.headerIndex] = { isSelected: true, title: selectedLabels, isUP: false };
38
174
  state.defaultSelectedArray[state.headerIndex] = state.defaultSelectedIndexs;
39
175
  emit("confirm", selectedItems, state.headerIndex, state.defaultSelectedIndexs);
40
- state.showWheel = false;
176
+ state.showOptions = false;
41
177
  };
42
178
  const reset = ({ api, props, state, emit }) => () => {
43
179
  var _a;
44
- state.headerInfo[state.headerIndex] = { isSelected: false, title: "", isUP: false };
180
+ state.headerInfo[state.headerIndex] = {
181
+ isSelected: false,
182
+ title: props.dataSource[state.headerIndex].title || "",
183
+ isUP: false
184
+ };
45
185
  state.defaultSelectedIndexs = (_a = props.defaultSelectedArray[state.headerIndex]) != null ? _a : api.loadDefault(state.headerIndex);
46
186
  state.defaultSelectedArray[state.headerIndex] = state.defaultSelectedIndexs;
47
187
  emit("reset", [], state.headerIndex, state.defaultSelectedIndexs);
48
- state.showWheel = false;
188
+ state.showOptions = false;
189
+ };
190
+ const handleClose = (state) => () => {
191
+ state.showOptions = false;
192
+ if (state.headerIndex !== -1) {
193
+ state.headerInfo[state.headerIndex].isUP = false;
194
+ }
49
195
  };
50
196
  const wheelChange = (state) => (indexs) => {
51
197
  state.defaultSelectedIndexs = indexs;
@@ -60,7 +206,7 @@ const clickWheelItem = ({ state, emit }) => (indexs, text, item) => {
60
206
  }
61
207
  state.defaultSelectedArray[state.headerIndex] = state.defaultSelectedIndexs;
62
208
  emit("confirm", item, state.headerIndex, indexs);
63
- state.showWheel = false;
209
+ state.showOptions = false;
64
210
  };
65
211
  const getWheelLevelItems = (wheelData, newIndexs) => {
66
212
  const level_1 = wheelData;
@@ -160,9 +306,17 @@ const getEl = (node) => {
160
306
  return node.$el || node;
161
307
  };
162
308
  const getLabelsStyle = (state) => {
309
+ const len = state.dataSource.length;
310
+ if (len === 1) {
311
+ return [
312
+ {
313
+ flex: 1,
314
+ justifyContent: "space-between"
315
+ }
316
+ ];
317
+ }
163
318
  const over25Labels = state.labelLevelsInfo.filter((i) => i && !i.isOver25);
164
319
  let widthInfo = over25Labels;
165
- const len = state.dataSource.length;
166
320
  if (len >= 4) {
167
321
  return getStyleConfig(state.labelLevelsInfo, { width: `${(1 / len * 100).toFixed(2)}%` });
168
322
  }
@@ -197,8 +351,20 @@ const getFillArray = (state, widthInfo, maxWidth) => {
197
351
  };
198
352
  });
199
353
  };
354
+ const handleSearchBtnClick = ({ props, state, nextTick, vm }) => () => {
355
+ if (props.disabled) {
356
+ return;
357
+ }
358
+ state.isSearching = !state.isSearching;
359
+ nextTick(() => {
360
+ if (state.isSearching) {
361
+ vm.$refs.searchInput.focus();
362
+ }
363
+ });
364
+ };
200
365
  export {
201
366
  clickWheelItem,
367
+ computedCurrentOptions,
202
368
  confirm,
203
369
  created,
204
370
  getEl,
@@ -208,12 +374,21 @@ export {
208
374
  getMaxFloor,
209
375
  getNewHeaderInfo,
210
376
  getNextLevel,
377
+ getOption,
211
378
  getRect,
212
379
  getSelected,
213
380
  getStyleConfig,
214
381
  getWheelLevelItems,
215
382
  handleClick,
383
+ handleClose,
384
+ handleOptionSelect,
385
+ handleSearchBtnClick,
386
+ handleSearchInput,
387
+ initValue,
216
388
  loadDefault,
217
389
  reset,
390
+ toggleItemExpand,
391
+ updateTitle,
392
+ updateValue,
218
393
  wheelChange
219
394
  };
@@ -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,8 @@ 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 userInput = props.stringMode ? state.userInput : Number(state.userInput);
65
+ const value = (props.mouseWheel ? state.displayValue : userInput) || 0;
65
66
  if (value.toString().includes("e")) {
66
67
  return;
67
68
  }
@@ -79,7 +80,8 @@ const decrease = ({ api, props, state }) => () => {
79
80
  if (state.inputDisabled || state.minDisabled) {
80
81
  return;
81
82
  }
82
- const value = (props.mouseWheel ? state.displayValue : props.modelValue) || 0;
83
+ const userInput = props.stringMode ? state.userInput : Number(state.userInput);
84
+ const value = (props.mouseWheel ? state.displayValue : userInput) || 0;
83
85
  if (value.toString().includes("e")) {
84
86
  return;
85
87
  }
@@ -108,9 +110,9 @@ const handleBlur = ({
108
110
  dispatch(constants.COMPONENT_NAME, constants.EVENT_NAME.blur, [state.displayValue]);
109
111
  }
110
112
  };
111
- const handleFocus = ({ emit, state, props, api, refs }) => (event) => {
113
+ const handleFocus = ({ emit, state, props, api, vm }) => (event) => {
112
114
  if (props.disabled) {
113
- refs.input.blur();
115
+ vm.$refs.input.blur();
114
116
  }
115
117
  state.inputStatus = true;
116
118
  const currentValue = api.getDecimal(state.currentValue);
@@ -126,8 +128,8 @@ const handleFocus = ({ emit, state, props, api, refs }) => (event) => {
126
128
  }
127
129
  emit("focus", event);
128
130
  };
129
- const focus = (refs) => () => {
130
- refs.input.focus();
131
+ const focus = (vm) => () => {
132
+ vm.$refs.input.focus();
131
133
  };
132
134
  const getEmitValue = (args) => {
133
135
  let { newVal, emitValue, allowEmpty, defaultVal, bigNew, oldVal } = args;
@@ -163,7 +165,7 @@ const setCurrentValue = ({
163
165
  emit,
164
166
  props,
165
167
  state
166
- }) => (newVal) => {
168
+ }) => (newVal, emitChangeFlag = true) => {
167
169
  const { max, min, allowEmpty, validateEvent, stringMode, plugin } = props;
168
170
  const { format } = state;
169
171
  const oldVal = state.currentValue;
@@ -183,7 +185,9 @@ const setCurrentValue = ({
183
185
  state.lastInput = emitValue;
184
186
  if (emitValue !== oldVal) {
185
187
  emit("update:modelValue", emitValue);
186
- emit("change", emitValue, oldVal);
188
+ if (emitChangeFlag) {
189
+ emit("change", emitValue, oldVal);
190
+ }
187
191
  state.currentValue = emitValue;
188
192
  state.userInput = emitValue;
189
193
  if (validateEvent && oldVal === "") {
@@ -233,8 +237,21 @@ const handleInputChange = ({ api, state, props }) => (event) => {
233
237
  }
234
238
  api.setCurrentValue(value);
235
239
  };
236
- const select = (refs) => () => refs.input.select();
240
+ const select = (vm) => () => vm.$refs.input.select();
237
241
  const mounted = ({ constants, parent, props, state }) => () => {
242
+ if (props.shape === "filter") {
243
+ state.controls = false;
244
+ }
245
+ if (isNumber(state.currentValue) && state.currentValue < props.min) {
246
+ state.currentValue = props.min;
247
+ state.lastInput = props.min;
248
+ state.userInput = props.min;
249
+ }
250
+ if (isNumber(state.currentValue) && state.currentValue > props.max) {
251
+ state.currentValue = props.max;
252
+ state.lastInput = props.max;
253
+ state.userInput = props.max;
254
+ }
238
255
  const innerInput = parent.$el.querySelector("input");
239
256
  innerInput.setAttribute(constants.KEY, constants.VALUE);
240
257
  innerInput.setAttribute(constants.MAX, props.max);
@@ -255,8 +272,11 @@ const updated = ({ constants, parent, state }) => () => {
255
272
  const innerInput = parent.$el.querySelector("input");
256
273
  innerInput && innerInput.setAttribute(constants.VALUENOW, state.currentValue);
257
274
  };
258
- const displayValue = ({ props, state }) => () => {
275
+ const displayValue = ({ props, state, api }) => () => {
259
276
  const { currentValue, inputStatus, userInput } = state;
277
+ if (props.shape === "filter" && props.filter) {
278
+ api.filterValue();
279
+ }
260
280
  if (inputStatus) {
261
281
  return userInput;
262
282
  }
@@ -321,10 +341,24 @@ const getDisplayOnlyText = ({ parent, state, props }) => () => {
321
341
  }
322
342
  }
323
343
  };
344
+ const filterValue = ({ state }) => () => {
345
+ return (state.radioVal || "") + state.lastInput;
346
+ };
347
+ const handleClear = ({ state, emit }) => () => {
348
+ state.currentValue = "";
349
+ state.userInput = "";
350
+ state.lastInput = "";
351
+ state.radioVal = "";
352
+ emit("clear");
353
+ };
354
+ const handleChange = ({ state, emit }) => () => {
355
+ emit("filter-change", state.radioVal);
356
+ };
324
357
  export {
325
358
  decrease,
326
359
  dispatchDisplayedValue,
327
360
  displayValue,
361
+ filterValue,
328
362
  focus,
329
363
  getDecimal,
330
364
  getDisplayOnlyText,
@@ -333,6 +367,8 @@ export {
333
367
  getPrecision,
334
368
  getUnitPrecision,
335
369
  handleBlur,
370
+ handleChange,
371
+ handleClear,
336
372
  handleFocus,
337
373
  handleInput,
338
374
  handleInputChange,