@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,6 +1,40 @@
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
+ var _a;
8
+ const { dataSource = [] } = props;
9
+ let value;
10
+ if (dataSource.length === 1 && !((_a = dataSource[0]) == null ? void 0 : _a.multiple)) {
11
+ value = "";
12
+ } else {
13
+ value = [];
14
+ dataSource == null ? void 0 : dataSource.forEach((data, index) => {
15
+ if (data.multiple && !Array.isArray(props.modelValue[index])) {
16
+ value.push([]);
17
+ }
18
+ if (!data.multiple && Array.isArray(props.modelValue)) {
19
+ value.push("");
20
+ }
21
+ });
22
+ }
23
+ emit("update:modelValue", value);
24
+ };
25
+ const updateValue = ({ state, props, emit }) => (value) => {
26
+ const activeIndex = state.headerIndex;
27
+ const values = cloneDeep(props.modelValue);
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 created = ({ api, emit, props, state, refs, nextTick }) => () => {
37
+ api.initValue({ props, emit });
4
38
  nextTick(() => {
5
39
  state.dataSource = cloneDeep(props.dataSource);
6
40
  state.defaultSelectedArray = cloneDeep(props.defaultSelectedArray);
@@ -9,35 +43,109 @@ const created = ({ props, state, refs, nextTick }) => () => {
9
43
  state.headerInfo = state.dataSource.map((item) => {
10
44
  return { isSelected: false, title: item.title, isUP: false };
11
45
  });
46
+ if (props.type === "list") {
47
+ state.dataSource.forEach((item, index) => {
48
+ const { flattenData, dataMap } = getFlatOptions(item.options);
49
+ item.options = flattenData;
50
+ state.optionMap[index] = dataMap;
51
+ });
52
+ }
53
+ });
54
+ };
55
+ const computedCurrentOptions = ({ state, props }) => () => {
56
+ const { options = [], multiple } = state.dataSource[state.headerIndex] || {};
57
+ const selectedValue = props.modelValue[state.headerIndex];
58
+ options.forEach((item) => {
59
+ var _a;
60
+ item.show = state.isSearching ? item.label.includes(state.searchValue) : ((_a = item.show) != null ? _a : parent == null ? void 0 : parent.expanded) || item.level === 0;
61
+ item.active = multiple ? selectedValue.includes(item.value) : item.value === selectedValue;
62
+ });
63
+ return options.filter((i) => i.show);
64
+ };
65
+ const getFlatOptions = (options) => {
66
+ const flattenData = [];
67
+ const dataMap = {};
68
+ const getChild = (data, level = 0, parent2) => {
69
+ data.forEach((item, index) => {
70
+ var _a, _b;
71
+ const id = parent2 ? parent2.id + index : String(index);
72
+ const parentId = (parent2 == null ? void 0 : parent2.id) || "";
73
+ const expanded = (parent2 == null ? void 0 : parent2.expanded) && ((_a = item.children) == null ? void 0 : _a.length) && item.expanded || false;
74
+ const currentData = __spreadProps(__spreadValues({}, item), { id, level, expanded, parentId });
75
+ flattenData.push(currentData);
76
+ if ((_b = item.children) == null ? void 0 : _b.length) {
77
+ getChild(item.children, level + 1, currentData);
78
+ }
79
+ dataMap[currentData.id] = item;
80
+ });
81
+ };
82
+ getChild(options);
83
+ flattenData.forEach((item) => {
84
+ if (item.children) {
85
+ item.hasChild = item.children.length > 0;
86
+ delete item.children;
87
+ }
12
88
  });
89
+ return { flattenData, dataMap };
13
90
  };
14
91
  const handleClick = ({ api, props, state }) => (value) => {
15
92
  var _a, _b, _c;
16
- state.wheelData = (_a = props.dataSource[value]) == null ? void 0 : _a.children;
93
+ if (props.disabled || props.dataSource[value].disabled) {
94
+ return;
95
+ }
96
+ if (props.type === "wheel") {
97
+ state.wheelData = (_a = props.dataSource[value]) == null ? void 0 : _a.options;
98
+ }
17
99
  if (state.headerIndex === -1) {
18
- state.showWheel = true;
100
+ state.showOptions = true;
19
101
  state.headerIndex = value;
20
102
  state.headerInfo[value] = getNewHeaderInfo(state.headerInfo, value, true);
21
103
  state.defaultSelectedIndexs = (_b = state.defaultSelectedArray[value]) != null ? _b : api.loadDefault(value);
22
104
  } else if (state.headerIndex !== value) {
23
- state.showWheel = true;
105
+ state.showOptions = true;
24
106
  state.headerInfo[state.headerIndex] = getNewHeaderInfo(state.headerInfo, state.headerIndex, false);
25
107
  state.headerIndex = value;
26
108
  state.headerInfo[value] = getNewHeaderInfo(state.headerInfo, value, true);
27
109
  state.defaultSelectedIndexs = (_c = state.defaultSelectedArray[value]) != null ? _c : api.loadDefault(value);
28
110
  } else {
29
- state.showWheel = !state.showWheel;
111
+ state.showOptions = !state.showOptions;
30
112
  const { isUP } = state.headerInfo[value];
31
113
  state.headerInfo[value] = getNewHeaderInfo(state.headerInfo, value, !isUP);
32
114
  }
33
115
  };
116
+ const handleOptionSelect = ({ api, state, emit }) => (option) => {
117
+ api.updateValue(option.value);
118
+ emit("item-click", state.optionMap[state.headerIndex][option.id]);
119
+ };
120
+ const handleSearchInput = ({ state, emit }) => () => {
121
+ const { searchValue } = state;
122
+ emit("update:searchValue", searchValue);
123
+ };
124
+ const toggleChildExpand = (state, parentId, index) => {
125
+ const { options } = state.dataSource[state.headerIndex];
126
+ for (let i = index + 1; i < options.length; i++) {
127
+ if (options[i].parentId === parentId) {
128
+ options[i].show = !options[i].show;
129
+ } else {
130
+ break;
131
+ }
132
+ }
133
+ };
134
+ const toggleItemExpand = ({ state }) => (option) => {
135
+ const index = state.dataSource[state.headerIndex].options.findIndex((i) => i.id === option.id);
136
+ if (index !== -1) {
137
+ const target = state.dataSource[state.headerIndex].options[index];
138
+ target.expanded = !target.expanded;
139
+ toggleChildExpand(state, target.id, index);
140
+ }
141
+ };
34
142
  const confirm = ({ state, emit }) => () => {
35
143
  const wheelLevelItems = getWheelLevelItems(state.wheelData, state.defaultSelectedIndexs);
36
144
  const { selectedLabels, selectedItems } = getSelected(wheelLevelItems, state.defaultSelectedIndexs);
37
145
  state.headerInfo[state.headerIndex] = { isSelected: true, title: selectedLabels, isUP: false };
38
146
  state.defaultSelectedArray[state.headerIndex] = state.defaultSelectedIndexs;
39
147
  emit("confirm", selectedItems, state.headerIndex, state.defaultSelectedIndexs);
40
- state.showWheel = false;
148
+ state.showOptions = false;
41
149
  };
42
150
  const reset = ({ api, props, state, emit }) => () => {
43
151
  var _a;
@@ -45,7 +153,13 @@ const reset = ({ api, props, state, emit }) => () => {
45
153
  state.defaultSelectedIndexs = (_a = props.defaultSelectedArray[state.headerIndex]) != null ? _a : api.loadDefault(state.headerIndex);
46
154
  state.defaultSelectedArray[state.headerIndex] = state.defaultSelectedIndexs;
47
155
  emit("reset", [], state.headerIndex, state.defaultSelectedIndexs);
48
- state.showWheel = false;
156
+ state.showOptions = false;
157
+ };
158
+ const handleClose = (state) => () => {
159
+ state.showOptions = false;
160
+ if (state.headerIndex !== -1) {
161
+ state.headerInfo[state.headerIndex].isUP = false;
162
+ }
49
163
  };
50
164
  const wheelChange = (state) => (indexs) => {
51
165
  state.defaultSelectedIndexs = indexs;
@@ -60,7 +174,7 @@ const clickWheelItem = ({ state, emit }) => (indexs, text, item) => {
60
174
  }
61
175
  state.defaultSelectedArray[state.headerIndex] = state.defaultSelectedIndexs;
62
176
  emit("confirm", item, state.headerIndex, indexs);
63
- state.showWheel = false;
177
+ state.showOptions = false;
64
178
  };
65
179
  const getWheelLevelItems = (wheelData, newIndexs) => {
66
180
  const level_1 = wheelData;
@@ -160,9 +274,16 @@ const getEl = (node) => {
160
274
  return node.$el || node;
161
275
  };
162
276
  const getLabelsStyle = (state) => {
277
+ const len = state.dataSource.length;
278
+ if (len === 1) {
279
+ return [
280
+ {
281
+ justifyContent: "space-between"
282
+ }
283
+ ];
284
+ }
163
285
  const over25Labels = state.labelLevelsInfo.filter((i) => i && !i.isOver25);
164
286
  let widthInfo = over25Labels;
165
- const len = state.dataSource.length;
166
287
  if (len >= 4) {
167
288
  return getStyleConfig(state.labelLevelsInfo, { width: `${(1 / len * 100).toFixed(2)}%` });
168
289
  }
@@ -197,8 +318,20 @@ const getFillArray = (state, widthInfo, maxWidth) => {
197
318
  };
198
319
  });
199
320
  };
321
+ const handleSearchBtnClick = ({ props, state, nextTick, vm }) => () => {
322
+ if (props.disabled) {
323
+ return;
324
+ }
325
+ state.isSearching = !state.isSearching;
326
+ nextTick(() => {
327
+ if (state.isSearching) {
328
+ vm.$refs.searchInput.focus();
329
+ }
330
+ });
331
+ };
200
332
  export {
201
333
  clickWheelItem,
334
+ computedCurrentOptions,
202
335
  confirm,
203
336
  created,
204
337
  getEl,
@@ -213,7 +346,14 @@ export {
213
346
  getStyleConfig,
214
347
  getWheelLevelItems,
215
348
  handleClick,
349
+ handleClose,
350
+ handleOptionSelect,
351
+ handleSearchBtnClick,
352
+ handleSearchInput,
353
+ initValue,
216
354
  loadDefault,
217
355
  reset,
356
+ toggleItemExpand,
357
+ updateValue,
218
358
  wheelChange
219
359
  };
@@ -1,5 +1,21 @@
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
+ } from "./index";
3
19
  const api = [
4
20
  "state",
5
21
  "created",
@@ -8,34 +24,50 @@ const api = [
8
24
  "reset",
9
25
  "wheelChange",
10
26
  "clickWheelItem",
11
- "loadDefault"
27
+ "loadDefault",
28
+ "handleSearchBtnClick",
29
+ "handleClose",
30
+ "handleSearchInput"
12
31
  ];
13
- const initState = (reactive) => {
32
+ const initState = ({ emitter, reactive, computed, api: api2 }) => {
14
33
  const state = reactive({
15
34
  dataSource: [],
16
35
  wheelData: [],
36
+ isSearching: false,
17
37
  headerIndex: -1,
18
- showWheel: false,
38
+ showOptions: false,
19
39
  labelLevelsInfo: [],
20
40
  labelsStyle: [],
21
41
  wheelIndex: [],
22
42
  wheelText: "",
23
43
  headerInfo: [],
24
44
  defaultSelectedIndexs: [],
25
- defaultSelectedArray: []
45
+ defaultSelectedArray: [],
46
+ multiSelectEmitter: emitter(),
47
+ searchValue: "",
48
+ optionMap: [],
49
+ currentOptions: computed(() => api2.computedCurrentOptions())
26
50
  });
27
51
  return state;
28
52
  };
29
- const initApi = ({ api: api2, props, state, emit, nextTick, refs }) => {
53
+ const initApi = ({ api: api2, props, state, emit, nextTick, refs, vm }) => {
30
54
  Object.assign(api2, {
31
55
  state,
32
- created: created({ props, state, refs, nextTick }),
56
+ created: created({ api: api2, emit, props, state, refs, nextTick }),
57
+ initValue: initValue({ props, emit }),
33
58
  handleClick: handleClick({ api: api2, props, state }),
34
59
  confirm: confirm({ state, emit }),
35
60
  reset: reset({ api: api2, props, state, emit }),
36
61
  wheelChange: wheelChange(state),
37
62
  clickWheelItem: clickWheelItem({ state, emit }),
38
- loadDefault: loadDefault({ props, state })
63
+ loadDefault: loadDefault({ props, state }),
64
+ handleSearchBtnClick: handleSearchBtnClick({ props, state, nextTick, vm }),
65
+ handleOptionSelect: handleOptionSelect({ api: api2, state, emit }),
66
+ handleClose: handleClose(state),
67
+ toggleItemExpand: toggleItemExpand({ state }),
68
+ computedCurrentOptions: computedCurrentOptions({ state, props }),
69
+ updateValue: updateValue({ state, props, emit }),
70
+ handleSearchInput: handleSearchInput({ props, state, emit })
39
71
  });
40
72
  };
41
73
  const initWatch = ({ watch, props, state, refs, nextTick }) => {
@@ -52,14 +84,17 @@ const initWatch = ({ watch, props, state, refs, nextTick }) => {
52
84
  }
53
85
  );
54
86
  };
55
- const renderless = (props, { onMounted, reactive, watch }, { emit, nextTick, refs }) => {
87
+ const renderless = (props, { onMounted, reactive, watch, provide, computed }, { emit, nextTick, refs, vm, emitter }) => {
56
88
  const api2 = {};
57
- const state = initState(reactive);
58
- initApi({ api: api2, props, state, emit, nextTick, refs });
89
+ const state = initState({ emitter, reactive, computed, api: api2 });
90
+ provide("multiSelect", vm);
91
+ initApi({ api: api2, props, state, emit, nextTick, refs, vm });
59
92
  initWatch({ watch, props, state, refs, nextTick });
60
93
  onMounted(() => {
61
94
  api2.created({ props, state, refs, nextTick });
62
95
  });
96
+ state.multiSelectEmitter.on("multiSelectItemClick", api2.handleOptionSelect);
97
+ state.multiSelectEmitter.on("toggleItemExpand", api2.toggleItemExpand);
63
98
  return api2;
64
99
  };
65
100
  export {
@@ -0,0 +1,17 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ const handleClick = ({ props, multiSelect }) => (event) => {
3
+ event.stopPropagation();
4
+ if (props.disabled !== true && multiSelect.disabled !== true) {
5
+ multiSelect.state.multiSelectEmitter.emit("multiSelectItemClick", props.option);
6
+ }
7
+ };
8
+ const toggleExpand = ({ props, multiSelect }) => (event) => {
9
+ event.stopPropagation();
10
+ if (props.disabled !== true && multiSelect.disabled !== true) {
11
+ multiSelect.state.multiSelectEmitter.emit("toggleItemExpand", props.option);
12
+ }
13
+ };
14
+ export {
15
+ handleClick,
16
+ toggleExpand
17
+ };
@@ -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, emit, nextTick, refs, vm });
26
+ return api2;
27
+ };
28
+ export {
29
+ api,
30
+ renderless
31
+ };
package/numeric/index.js CHANGED
@@ -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;
@@ -219,12 +219,35 @@ const handleInput = ({ state, api, emit, props }) => (event) => {
219
219
  state.lastInput = value;
220
220
  state.userInput = value;
221
221
  };
222
- const handleInputChange = ({ api }) => (event) => {
223
- const value = event.target.value;
224
- api.setCurrentValue(value === "-" ? 0 : value);
222
+ const handleInputChange = ({ api, state, props }) => (event) => {
223
+ var _a, _b;
224
+ const value = ((_a = event.target) == null ? void 0 : _a.value) === "-" ? 0 : (_b = event.target) == null ? void 0 : _b.value;
225
+ if (props.stepStrictly) {
226
+ const previousValue = Number((props.mouseWheel ? state.displayValue : props.modelValue) || 0);
227
+ if (Math.abs(previousValue - value) % Number(props.step) === 0)
228
+ return api.setCurrentValue(value);
229
+ const step = Number(props.step);
230
+ const difference = value - previousValue;
231
+ const sign = difference >= 0 ? 1 : -1;
232
+ return api.setCurrentValue(sign * Math.round(Math.abs(difference) / step) * step + previousValue);
233
+ }
234
+ api.setCurrentValue(value);
225
235
  };
226
- const select = (refs) => () => refs.input.select();
236
+ const select = (vm) => () => vm.$refs.input.select();
227
237
  const mounted = ({ constants, parent, props, state }) => () => {
238
+ if (props.shape === "filter") {
239
+ state.controls = false;
240
+ }
241
+ if (state.currentValue < props.min) {
242
+ state.currentValue = props.min;
243
+ state.lastInput = props.min;
244
+ state.userInput = props.min;
245
+ }
246
+ if (state.currentValue > props.max) {
247
+ state.currentValue = props.max;
248
+ state.lastInput = props.max;
249
+ state.userInput = props.max;
250
+ }
228
251
  const innerInput = parent.$el.querySelector("input");
229
252
  innerInput.setAttribute(constants.KEY, constants.VALUE);
230
253
  innerInput.setAttribute(constants.MAX, props.max);
@@ -245,8 +268,11 @@ const updated = ({ constants, parent, state }) => () => {
245
268
  const innerInput = parent.$el.querySelector("input");
246
269
  innerInput && innerInput.setAttribute(constants.VALUENOW, state.currentValue);
247
270
  };
248
- const displayValue = ({ props, state }) => () => {
271
+ const displayValue = ({ props, state, api }) => () => {
249
272
  const { currentValue, inputStatus, userInput } = state;
273
+ if (props.shape === "filter" && props.filter) {
274
+ api.filterValue();
275
+ }
250
276
  if (inputStatus) {
251
277
  return userInput;
252
278
  }
@@ -311,10 +337,24 @@ const getDisplayOnlyText = ({ parent, state, props }) => () => {
311
337
  }
312
338
  }
313
339
  };
340
+ const filterValue = ({ state }) => () => {
341
+ return (state.radioVal || "") + state.lastInput;
342
+ };
343
+ const handleClear = ({ state, emit }) => () => {
344
+ state.currentValue = "";
345
+ state.userInput = "";
346
+ state.lastInput = "";
347
+ state.radioVal = "";
348
+ emit("clear");
349
+ };
350
+ const handleChange = ({ state, emit }) => () => {
351
+ emit("filter-change", state.radioVal);
352
+ };
314
353
  export {
315
354
  decrease,
316
355
  dispatchDisplayedValue,
317
356
  displayValue,
357
+ filterValue,
318
358
  focus,
319
359
  getDecimal,
320
360
  getDisplayOnlyText,
@@ -323,6 +363,8 @@ export {
323
363
  getPrecision,
324
364
  getUnitPrecision,
325
365
  handleBlur,
366
+ handleChange,
367
+ handleClear,
326
368
  handleFocus,
327
369
  handleInput,
328
370
  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
- handleInputChange: handleInputChange({ api: api2 }),
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
115
  watchValue: watchValue({ api: api2, 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,15 +129,24 @@ const initWatch = ({
108
129
  props,
109
130
  api: api2
110
131
  }) => {
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
+ );
111
141
  watch(() => props.modelValue, api2.watchValue, { immediate: true });
112
142
  watch(() => state.isDisplayOnly, api2.dispatchDisplayedValue);
113
143
  };
114
- 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 }) => {
115
145
  const api2 = {};
116
146
  const $service = initService(service);
117
- const state = initState({ reactive, computed, props, api: api2, $service, parent });
147
+ const state = initState({ reactive, computed, props, api: api2, constants, $service, parent });
118
148
  parent.tinyForm = parent.tinyForm || inject("form", null);
119
- initApi({ api: api2, props, state, parent, refs, emit, dispatch, constants, nextTick });
149
+ initApi({ api: api2, props, state, parent, vm, emit, dispatch, constants, nextTick });
120
150
  initWatch({ state, watch, props, api: api2 });
121
151
  onMounted(() => {
122
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) {
@@ -17,10 +18,17 @@ const contains = ({ select, state }) => (arr = [], target = null) => {
17
18
  return arr && arr.some((item) => getObj(item, valueKey) === getObj(target, valueKey));
18
19
  }
19
20
  };
20
- const handleGroupDisabled = (state) => (val) => {
21
+ const handleGroupDisabled = ({ state, vm }) => (val) => {
21
22
  state.groupDisabled = val;
23
+ vm.groupDisabled = val;
22
24
  };
23
- const hoverItem = ({ select, props, state, vm }) => () => {
25
+ const hoverItem = ({ select, props, state, vm }) => (e) => {
26
+ const dom = e.target;
27
+ const text = dom.textContent;
28
+ const font = window.getComputedStyle(dom).font;
29
+ const rect = dom.getBoundingClientRect();
30
+ const res = omitText(text, font, rect.width);
31
+ state.showTitle = res.o;
24
32
  if (!props.disabled && !state.groupDisabled) {
25
33
  select.state.hoverIndex = select.state.options.indexOf(vm);
26
34
  }
@@ -32,9 +40,8 @@ const selectOptionClick = ({ props, state, select, constants, vm }) => () => {
32
40
  select.state.selectEmitter.emit(constants.EVENT_NAME.handleOptionClick, vm, true);
33
41
  }
34
42
  };
35
- const queryChange = ({ select, props, state }) => (query) => {
36
- state.visible = new RegExp(escapeRegexpString(query), "i").test(state.currentLabel) || props.created;
37
- select.state.filteredOptionsCount += state.visible ? 1 : -1;
43
+ const queryChange = ({ props, state }) => (query) => {
44
+ state.visible = new RegExp(escapeRegexpString(query), "i").test(state.currentLabel) || !!props.created;
38
45
  };
39
46
  const toggleEvent = ({ props, vm, type }) => {
40
47
  const optionEl = vm.$refs.option;