@opentiny/vue-renderless 3.21.2 → 3.22.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 (323) hide show
  1. package/amount/index.js +4 -4
  2. package/anchor/index.js +1 -1
  3. package/async-flowchart/index.js +1 -1
  4. package/autocomplete/index.js +1 -1
  5. package/autocomplete/vue.js +3 -3
  6. package/base-select/index.js +19 -19
  7. package/base-select/vue.js +2 -2
  8. package/calendar/index.js +2 -2
  9. package/calendar-bar/index.js +2 -2
  10. package/calendar-bar/vue.js +1 -1
  11. package/calendar-view/index.js +66 -22
  12. package/calendar-view/vue.js +2 -3
  13. package/card/index.js +1 -1
  14. package/card-template/index.js +1 -1
  15. package/carousel/index.js +4 -4
  16. package/carousel/vue.js +1 -1
  17. package/cascader/index.js +21 -11
  18. package/cascader/vue.js +6 -5
  19. package/cascader-menu/vue.js +2 -2
  20. package/cascader-mobile/index.js +1 -1
  21. package/cascader-panel/index.js +4 -4
  22. package/cascader-panel/node.js +3 -4
  23. package/cascader-panel/vue.js +1 -1
  24. package/cascader-select/column-index.js +2 -2
  25. package/cascader-view/index.js +1 -1
  26. package/chart-bar/index.js +1 -1
  27. package/chart-candle/index.js +1 -1
  28. package/chart-core/deps/utils.js +6 -6
  29. package/chart-core/index.js +1 -1
  30. package/chart-funnel/index.js +1 -1
  31. package/chart-gauge/index.js +1 -1
  32. package/chart-line/index.js +1 -1
  33. package/chart-map/index.js +1 -1
  34. package/chart-pie/index.js +1 -1
  35. package/chart-radar/index.js +1 -1
  36. package/chart-sankey/index.js +1 -1
  37. package/chart-scatter/index.js +1 -1
  38. package/chart-waterfall/index.js +1 -1
  39. package/chart-wordcloud/index.js +1 -1
  40. package/checkbox/index.js +1 -1
  41. package/collapse-item/vue.js +1 -1
  42. package/column-list-item/index.js +1 -1
  43. package/common/deps/dom.js +20 -196
  44. package/common/deps/infinite-scroll.js +4 -43
  45. package/common/deps/popup-manager.js +1 -200
  46. package/container/index.js +2 -2
  47. package/crop/index.js +3 -3
  48. package/currency/index.js +2 -2
  49. package/date-panel/index.js +75 -25
  50. package/date-panel/vue.js +53 -21
  51. package/date-picker/vue.js +1 -1
  52. package/date-picker-mobile/index.js +1 -1
  53. package/date-range/index.js +71 -37
  54. package/date-range/vue.js +27 -23
  55. package/date-table/index.js +8 -5
  56. package/date-table/vue.js +1 -1
  57. package/dialog-box/index.js +3 -3
  58. package/dialog-box/vue.js +1 -1
  59. package/dialog-select/vue.js +7 -4
  60. package/drawer/index.js +2 -2
  61. package/drop-times/index.js +1 -1
  62. package/dropdown/index.js +11 -3
  63. package/dropdown/vue.js +2 -2
  64. package/dropdown-item/index.js +1 -1
  65. package/dropdown-item/mf.js +1 -1
  66. package/dropdown-menu/index.js +1 -1
  67. package/espace/vue.js +2 -2
  68. package/fall-menu/index.js +3 -3
  69. package/file-upload/index.js +16 -13
  70. package/file-upload/vue.js +2 -2
  71. package/filter/vue.js +1 -1
  72. package/filter-panel/vue.js +1 -2
  73. package/floating-button/index.js +1 -1
  74. package/flowchart/index.js +3 -3
  75. package/flowchart/vue.js +1 -1
  76. package/fluent-editor/index.js +5 -7
  77. package/fluent-editor/options.js +2 -2
  78. package/form/index.js +20 -2
  79. package/form-item/index.js +6 -6
  80. package/fullscreen/index.js +1 -1
  81. package/fullscreen/vue.js +1 -1
  82. package/grid/plugins/export.js +2 -2
  83. package/grid/plugins/exportExcel.js +3 -3
  84. package/grid/plugins/resize.js +2 -2
  85. package/grid/static/base/helperEqualCompare.js +1 -1
  86. package/grid/static/base/isPlainObject.js +1 -1
  87. package/grid/utils/common.js +2 -2
  88. package/grid/utils/dom.js +12 -7
  89. package/grid/utils/event.js +4 -4
  90. package/hrapprover/index.js +1 -1
  91. package/image/index.js +3 -3
  92. package/image-viewer/index.js +4 -6
  93. package/input/index.js +2 -2
  94. package/input/vue.js +1 -1
  95. package/ip-address/index.js +17 -21
  96. package/ip-address/vue.js +1 -1
  97. package/link-menu/index.js +1 -1
  98. package/link-menu/vue.js +1 -1
  99. package/load-list/index.js +1 -1
  100. package/load-list/vue.js +4 -4
  101. package/loading/index.js +2 -2
  102. package/menu/vue.js +1 -1
  103. package/milestone/index.js +6 -45
  104. package/modal/index.js +5 -5
  105. package/month-range/index.js +45 -5
  106. package/month-range/vue.js +19 -15
  107. package/month-table/index.js +5 -5
  108. package/month-table/vue.js +1 -1
  109. package/nav-menu/index.js +7 -7
  110. package/notify/index.js +3 -3
  111. package/numeric/index.js +5 -5
  112. package/option/index.js +1 -1
  113. package/option/vue.js +2 -1
  114. package/package.json +3 -2
  115. package/pager/index.js +28 -16
  116. package/pager/vue.js +27 -16
  117. package/panel/index.js +1 -1
  118. package/picker/index.js +11 -11
  119. package/picker/vue.js +2 -2
  120. package/picker-column/index.js +1 -1
  121. package/pop-upload/vue.js +1 -1
  122. package/popconfirm/vue.js +1 -1
  123. package/popeditor/index.js +6 -6
  124. package/popeditor/vue.js +2 -2
  125. package/popover/index.js +3 -3
  126. package/popover/vue.js +1 -1
  127. package/popup/index.js +3 -3
  128. package/pull-refresh/index.js +1 -1
  129. package/pull-refresh-mobile-first/index.js +1 -1
  130. package/pull-refresh-mobile-first/vue.js +4 -4
  131. package/quarter-panel/index.js +2 -2
  132. package/quarter-panel/vue.js +1 -1
  133. package/radio-group/index.js +1 -1
  134. package/rate/index.js +1 -1
  135. package/rate/vue.js +1 -1
  136. package/recycle-scroller/index.js +2 -2
  137. package/recycle-scroller/vue.js +1 -1
  138. package/rich-text/index.js +1 -1
  139. package/rich-text/table-module.js +2 -2
  140. package/river/river.js +1 -1
  141. package/river/vue.js +1 -1
  142. package/scrollbar/vue-bar.js +1 -1
  143. package/scrollbar/vue.js +1 -1
  144. package/search/index.js +3 -3
  145. package/select/index.js +26 -22
  146. package/select/vue.js +8 -7
  147. package/select-dropdown/vue.js +5 -5
  148. package/selected-box/index.js +1 -1
  149. package/signature/index.js +1 -1
  150. package/signature/vue.js +2 -2
  151. package/skeleton/index.js +1 -1
  152. package/slider/index.js +4 -4
  153. package/slider-button-group/slide-button.js +2 -2
  154. package/split/index.js +2 -2
  155. package/split/vue.js +1 -1
  156. package/statistic/index.js +1 -1
  157. package/steps/index.js +2 -3
  158. package/steps/slide-bar.js +2 -2
  159. package/sticky/vue.js +4 -4
  160. package/tab-bar/index.js +2 -2
  161. package/tab-item-mf/vue.js +1 -1
  162. package/tab-nav/index.js +4 -4
  163. package/tabbar/index.js +1 -1
  164. package/tabbar/vue.js +1 -1
  165. package/tabbar-item/index.js +1 -1
  166. package/tabs-mf/index.js +5 -5
  167. package/tabs-mf/vue-bar.js +1 -1
  168. package/tabs-mf/vue-swipe.js +1 -1
  169. package/tabs-mf/vue.js +2 -2
  170. package/tabs-mf/wheel.js +3 -3
  171. package/tag-group/vue.js +2 -2
  172. package/tall-storage/index.js +1 -1
  173. package/tall-storage/vue.js +1 -1
  174. package/time/index.js +1 -1
  175. package/time/vue.js +1 -1
  176. package/time-line/index.js +1 -1
  177. package/time-line-new/index.js +1 -1
  178. package/time-panel/index.js +2 -2
  179. package/time-panel/vue.js +1 -1
  180. package/time-range/index.js +1 -1
  181. package/time-range/vue.js +1 -1
  182. package/time-spinner/index.js +4 -4
  183. package/time-spinner/vue.js +1 -1
  184. package/timeline-item/index.js +1 -1
  185. package/toggle-menu/index.js +1 -1
  186. package/tooltip/index.js +2 -2
  187. package/tooltip/vue.js +2 -2
  188. package/top-box/index.js +3 -3
  189. package/transfer/index.js +1 -1
  190. package/transfer-panel/index.js +1 -1
  191. package/tree/index.js +9 -9
  192. package/tree/vue.js +2 -2
  193. package/tree-node/index.js +1 -1
  194. package/tree-node/vue.js +1 -1
  195. package/tree-select/index.js +1 -1
  196. package/types/async-flowchart.type.d.ts +2 -14
  197. package/types/breadcrumb-item.type.d.ts +5 -1
  198. package/types/breadcrumb.type.d.ts +5 -1
  199. package/types/button-group.type.d.ts +5 -1
  200. package/types/button.type.d.ts +1 -1
  201. package/types/cascader.type.d.ts +6 -1
  202. package/types/date-table.type.d.ts +1 -120
  203. package/types/dropdown.type.d.ts +1 -1
  204. package/types/label.type.d.ts +1 -53
  205. package/types/loading.type.d.ts +12 -0
  206. package/types/numeric.type.d.ts +3 -22
  207. package/types/pager.type.d.ts +12 -7
  208. package/types/popconfirm.type.d.ts +2 -0
  209. package/types/steps.type.d.ts +1 -0
  210. package/types/tag-group.type.d.ts +2 -14
  211. package/types/tag.type.d.ts +4 -4
  212. package/types/tooltip.type.d.ts +3 -13
  213. package/types/user-head.type.d.ts +0 -4
  214. package/upload/index.js +1 -1
  215. package/upload-list/index.js +1 -1
  216. package/upload-list/vue.js +4 -4
  217. package/user/index.js +7 -7
  218. package/user/vue.js +15 -2
  219. package/user-contact/vue.js +2 -2
  220. package/virtual-scroll-box/index.js +2 -2
  221. package/wizard/index.js +3 -3
  222. package/year-range/index.js +61 -11
  223. package/year-range/vue.js +33 -20
  224. package/year-table/index.js +7 -5
  225. package/avatar/index.js +0 -30
  226. package/avatar/vue.js +0 -22
  227. package/common/array.js +0 -115
  228. package/common/bigInt.js +0 -315
  229. package/common/browser.js +0 -81
  230. package/common/calendar/calendar.js +0 -97
  231. package/common/dataset/index.js +0 -99
  232. package/common/date.js +0 -354
  233. package/common/decimal.js +0 -155
  234. package/common/deps/ResizeObserver.js +0 -456
  235. package/common/deps/after-leave.js +0 -27
  236. package/common/deps/clickoutside.js +0 -75
  237. package/common/deps/date-util.js +0 -255
  238. package/common/deps/date.js +0 -286
  239. package/common/deps/debounce.js +0 -8
  240. package/common/deps/eSpaceCtrl.js +0 -304
  241. package/common/deps/fastdom/async.js +0 -41
  242. package/common/deps/fastdom/index.js +0 -9
  243. package/common/deps/fastdom/sandbox.js +0 -53
  244. package/common/deps/fastdom/singleton.js +0 -88
  245. package/common/deps/fullscreen/apis.js +0 -143
  246. package/common/deps/fullscreen/screenfull.js +0 -165
  247. package/common/deps/memorize.js +0 -124
  248. package/common/deps/observe-visibility.js +0 -106
  249. package/common/deps/popper.js +0 -616
  250. package/common/deps/repeat-click.js +0 -29
  251. package/common/deps/resize-event.js +0 -39
  252. package/common/deps/scroll-into-view.js +0 -29
  253. package/common/deps/scrollbar-width.js +0 -33
  254. package/common/deps/throttle.js +0 -45
  255. package/common/deps/touch-emulator.js +0 -103
  256. package/common/deps/touch.js +0 -37
  257. package/common/deps/tree-model/node.js +0 -475
  258. package/common/deps/tree-model/tree-store.js +0 -312
  259. package/common/deps/tree-model/util.js +0 -24
  260. package/common/deps/upload-ajax.js +0 -81
  261. package/common/deps/useEventListener.js +0 -54
  262. package/common/deps/useInstanceSlots.js +0 -22
  263. package/common/deps/useRect.js +0 -25
  264. package/common/deps/useRelation.js +0 -89
  265. package/common/deps/useTouch.js +0 -68
  266. package/common/deps/useUserAgent.js +0 -16
  267. package/common/deps/useWindowSize.js +0 -23
  268. package/common/deps/vue-emitter.js +0 -34
  269. package/common/deps/vue-popper.js +0 -180
  270. package/common/deps/vue-popup.js +0 -138
  271. package/common/event.js +0 -46
  272. package/common/form/const.js +0 -10
  273. package/common/function.js +0 -28
  274. package/common/global.js +0 -11
  275. package/common/index.js +0 -259
  276. package/common/object.js +0 -227
  277. package/common/prop-util.js +0 -43
  278. package/common/runtime.js +0 -79
  279. package/common/string.js +0 -417
  280. package/common/type.js +0 -66
  281. package/common/validate/index.js +0 -10
  282. package/common/validate/messages.js +0 -65
  283. package/common/validate/rules/enum.js +0 -12
  284. package/common/validate/rules/index.js +0 -18
  285. package/common/validate/rules/pattern.js +0 -20
  286. package/common/validate/rules/range.js +0 -52
  287. package/common/validate/rules/required.js +0 -11
  288. package/common/validate/rules/type.js +0 -100
  289. package/common/validate/rules/whitespace.js +0 -10
  290. package/common/validate/schema.js +0 -290
  291. package/common/validate/util.js +0 -211
  292. package/common/validate/validations/array.js +0 -22
  293. package/common/validate/validations/date.js +0 -31
  294. package/common/validate/validations/enum.js +0 -22
  295. package/common/validate/validations/float.js +0 -22
  296. package/common/validate/validations/index.js +0 -46
  297. package/common/validate/validations/integer.js +0 -22
  298. package/common/validate/validations/method.js +0 -21
  299. package/common/validate/validations/number.js +0 -25
  300. package/common/validate/validations/pattern.js +0 -21
  301. package/common/validate/validations/required.js +0 -11
  302. package/common/validate/validations/string.js +0 -33
  303. package/common/validate/validations/type.js +0 -29
  304. package/index-bar/index.js +0 -66
  305. package/index-bar/vue.js +0 -73
  306. package/index-bar-anchor/vue.js +0 -16
  307. package/label/index.js +0 -56
  308. package/label/vue.js +0 -26
  309. package/list/index.js +0 -13
  310. package/list/vue.js +0 -17
  311. package/mask/index.js +0 -13
  312. package/mask/vue.js +0 -18
  313. package/mini-picker/index.js +0 -165
  314. package/mini-picker/vue.js +0 -122
  315. package/multi-select/index.js +0 -394
  316. package/multi-select/vue.js +0 -113
  317. package/multi-select-item/index.js +0 -23
  318. package/multi-select-item/vue.js +0 -31
  319. package/toast/index.js +0 -7
  320. package/toast/vue.js +0 -19
  321. package/types/toast.type.d.ts +0 -63
  322. package/wheel/index.js +0 -165
  323. package/wheel/vue.js +0 -79
@@ -1,165 +0,0 @@
1
- import "../chunk-G2ADBYYC.js";
2
- const visibleHandle = (emit) => () => emit("update:visible", false);
3
- const watchVisible = (emit) => ({ state, value }) => {
4
- setTimeout(() => {
5
- value ? state.toggle = true : state.toggle = false;
6
- }, 0);
7
- emit("update:visible", value);
8
- };
9
- const getDataType = (state) => () => {
10
- const { columns } = state;
11
- const firstColumn = columns[0] || {};
12
- if (firstColumn.children) {
13
- return "cascade";
14
- }
15
- if (firstColumn.values) {
16
- return "object";
17
- }
18
- return "text";
19
- };
20
- const format = ({ state, api }) => () => {
21
- const { columns, dataType } = state;
22
- if (dataType === "text") {
23
- state.formattedColumns = [{ values: columns }];
24
- } else if (dataType === "cascade") {
25
- api.formatCascade();
26
- } else {
27
- state.formattedColumns = columns;
28
- }
29
- };
30
- const formatCascade = ({ state, props }) => () => {
31
- const formatted = [];
32
- let cursor = { children: state.columns };
33
- while (cursor && cursor.children) {
34
- const defaultIndex = cursor.defaultIndex || Number(state.defaultIndex);
35
- formatted.push({
36
- values: cursor.children.map((item) => item[props.valueKey]),
37
- defaultIndex
38
- });
39
- cursor = cursor.children[defaultIndex];
40
- }
41
- state.formattedColumns = formatted;
42
- };
43
- const change = (api) => (index) => {
44
- api.onChange(index);
45
- };
46
- const setColumnValue = (api) => (index, value) => {
47
- const column = api.getColumn(index);
48
- column && column.setValue(value);
49
- };
50
- const setValues = (api) => (values) => {
51
- values.forEach((value, index) => {
52
- api.setColumnValue(index, value);
53
- });
54
- };
55
- const getColumnValue = (api) => (index) => {
56
- const column = api.getColumn(index);
57
- return column && column.getValue();
58
- };
59
- const confirm = ({ api, childrenPickerRefs }) => () => {
60
- const children = childrenPickerRefs.childrenPicker;
61
- children && children.forEach((child) => child.onTransitionEnd());
62
- api.emitEvent("confirm");
63
- api.visibleHandle();
64
- };
65
- const cancel = ({ api, emit }) => () => {
66
- emit("cancel");
67
- api.visibleHandle();
68
- };
69
- const emitEvent = ({ api, state, emit }) => (event) => {
70
- if (state.dataType === "text") {
71
- emit(event, api.getColumnValue(0), api.getColumnIndex(0));
72
- } else {
73
- emit(event, api.getValues(), api.getIndexes());
74
- }
75
- };
76
- const getColumn = (childrenPickerRefs) => (index) => {
77
- const children = childrenPickerRefs.childrenPicker;
78
- return children[index];
79
- };
80
- const getColumnIndex = (api) => (columnIndex) => (api.getColumn(columnIndex) || {}).state.currentIndex;
81
- const getValues = (childrenPickerRefs) => () => childrenPickerRefs.childrenPicker && childrenPickerRefs.childrenPicker.map((child) => child.getValue());
82
- const getIndexes = (childrenPickerRefs) => () => childrenPickerRefs.childrenPicker && childrenPickerRefs.childrenPicker.map((child) => child.state.currentIndex);
83
- const setIndexes = (api) => (indexes) => {
84
- indexes.forEach((optionIndex, columnIndex) => {
85
- api.setColumnIndex(columnIndex, optionIndex);
86
- });
87
- };
88
- const setColumnIndex = (api) => (columnIndex, optionIndex) => {
89
- const column = api.getColumn(columnIndex);
90
- column && column.setIndex(optionIndex);
91
- };
92
- const getColumnValues = (childrenPickerRefs) => (index) => (childrenPickerRefs.childrenPicker[index] || {}).state.columnsItem.values;
93
- const setColumnValues = (childrenPickerRefs) => (index, options) => {
94
- const children = childrenPickerRefs.childrenPicker;
95
- const column = children[index];
96
- if (column) {
97
- column.setOptions(options);
98
- }
99
- };
100
- const onCascadeChange = ({ api, state, props }) => (columnIndex) => {
101
- const { columns } = state;
102
- let cursor = { children: columns };
103
- const indexes = api.getIndexes();
104
- for (let i = 0; i <= columnIndex; i++) {
105
- cursor = cursor.children[indexes[i]];
106
- }
107
- while (columnIndex < state.formattedColumns.length) {
108
- if (cursor.children && cursor.children.length !== 0) {
109
- columnIndex++;
110
- api.setColumnValues(
111
- columnIndex,
112
- cursor.children.map((item) => item[props.valueKey])
113
- );
114
- cursor = cursor.children[cursor.defaultIndex || 0];
115
- } else {
116
- columnIndex++;
117
- api.setColumnValues(columnIndex, []);
118
- }
119
- }
120
- };
121
- const onChange = ({ api, state, emit }) => (columnIndex) => {
122
- if (state.dataType === "cascade") {
123
- api.onCascadeChange(columnIndex);
124
- }
125
- if (api.dataType === "text") {
126
- emit("change", api.getColumnValue(0), api.getColumnIndex(0));
127
- } else {
128
- emit("change", api.getValues(), columnIndex);
129
- }
130
- };
131
- const getChildrenComponent = ({ state, vm, constants }) => {
132
- const childrenName = constants.CHILDREN_PICKER;
133
- const children = [];
134
- for (let index = 0; index < state.formattedColumns.length; index++) {
135
- children.push(
136
- Array.isArray(vm.$refs[childrenName + index]) ? vm.$refs[childrenName + index][0] : vm.$refs[childrenName + index]
137
- );
138
- }
139
- return children;
140
- };
141
- export {
142
- cancel,
143
- change,
144
- confirm,
145
- emitEvent,
146
- format,
147
- formatCascade,
148
- getChildrenComponent,
149
- getColumn,
150
- getColumnIndex,
151
- getColumnValue,
152
- getColumnValues,
153
- getDataType,
154
- getIndexes,
155
- getValues,
156
- onCascadeChange,
157
- onChange,
158
- setColumnIndex,
159
- setColumnValue,
160
- setColumnValues,
161
- setIndexes,
162
- setValues,
163
- visibleHandle,
164
- watchVisible
165
- };
@@ -1,122 +0,0 @@
1
- import "../chunk-G2ADBYYC.js";
2
- import {
3
- visibleHandle,
4
- watchVisible,
5
- formatCascade,
6
- format,
7
- getDataType,
8
- change,
9
- setColumnValue,
10
- setValues,
11
- getColumnValue,
12
- confirm,
13
- cancel,
14
- getColumnIndex,
15
- getValues,
16
- getIndexes,
17
- setIndexes,
18
- setColumnIndex,
19
- getColumnValues,
20
- setColumnValues,
21
- onChange,
22
- onCascadeChange,
23
- emitEvent,
24
- getColumn,
25
- getChildrenComponent
26
- } from "./index";
27
- const api = [
28
- "state",
29
- "visibleHandle",
30
- "watchVisible",
31
- "change",
32
- "setValues",
33
- "getColumnValue",
34
- "confirm",
35
- "cancel",
36
- "getColumnIndex",
37
- "getValues",
38
- "getIndexes",
39
- "setIndexes",
40
- "setColumnIndex",
41
- "getColumnValues",
42
- "setColumnValues",
43
- "onChange",
44
- "onCascadeChange",
45
- "emitEvent",
46
- "getColumn",
47
- "setColumnValue"
48
- ];
49
- const initState = ({ reactive, computed, props, api: api2 }) => {
50
- const state = reactive({
51
- columns: props.columns,
52
- toggle: false,
53
- itemHeight: Number(props.itemHeight),
54
- defaultIndex: props.defaultIndex,
55
- visibleItemCount: props.visibleItemCount,
56
- clumnsWrapHeight: null,
57
- formattedColumns: [],
58
- dataType: computed(() => api2.getDataType())
59
- });
60
- return state;
61
- };
62
- const initApi = ({ api: api2, props, state, emit, childrenPickerRefs }) => {
63
- Object.assign(api2, {
64
- state,
65
- getColumn: getColumn(childrenPickerRefs),
66
- getValues: getValues(childrenPickerRefs),
67
- getIndexes: getIndexes(childrenPickerRefs),
68
- getDataType: getDataType(state),
69
- visibleHandle: visibleHandle(emit),
70
- formatCascade: formatCascade({ state, props }),
71
- getColumnValues: getColumnValues(childrenPickerRefs),
72
- setColumnValues: setColumnValues(childrenPickerRefs),
73
- emitEvent: emitEvent({ api: api2, state, emit }),
74
- change: change(api2),
75
- onChange: onChange({ api: api2, state, emit }),
76
- cancel: cancel({ api: api2, emit }),
77
- confirm: confirm({ api: api2, childrenPickerRefs }),
78
- format: format({ state, api: api2 }),
79
- setValues: setValues(api2),
80
- setIndexes: setIndexes(api2),
81
- watchVisible: watchVisible(emit),
82
- setColumnIndex: setColumnIndex(api2),
83
- getColumnValue: getColumnValue(api2),
84
- getColumnIndex: getColumnIndex(api2),
85
- setColumnValue: setColumnValue(api2),
86
- onCascadeChange: onCascadeChange({ api: api2, state, props })
87
- });
88
- };
89
- const initWatch = ({ watch, props, state, api: api2 }) => {
90
- watch(
91
- () => props.visible,
92
- (value) => {
93
- api2.watchVisible({ state, value });
94
- }
95
- );
96
- watch(
97
- () => props.columns,
98
- (value) => {
99
- state.columns = value;
100
- api2.format();
101
- }
102
- );
103
- };
104
- const renderless = (props, { computed, onMounted, reactive, watch }, { emit, nextTick, vm, constants }) => {
105
- const api2 = {};
106
- const childrenPickerRefs = { childrenPicker: null };
107
- const state = initState({ reactive, computed, props, api: api2 });
108
- initApi({ api: api2, props, state, emit, childrenPickerRefs });
109
- initWatch({ watch, props, state, api: api2 });
110
- onMounted(() => {
111
- nextTick(() => {
112
- childrenPickerRefs.childrenPicker = getChildrenComponent({ state, vm, constants });
113
- });
114
- api2.format();
115
- state.clumnsWrapHeight = state.itemHeight * state.visibleItemCount;
116
- });
117
- return api2;
118
- };
119
- export {
120
- api,
121
- renderless
122
- };
@@ -1,394 +0,0 @@
1
- import {
2
- __spreadProps,
3
- __spreadValues
4
- } from "../chunk-G2ADBYYC.js";
5
- import { cloneDeep } from "../chart-core/deps/utils";
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 }) => () => {
62
- nextTick(() => {
63
- state.dataSource = cloneDeep(props.dataSource);
64
- state.defaultSelectedArray = cloneDeep(props.defaultSelectedArray);
65
- state.labelLevelsInfo = getLabelLevelsInfo(refs);
66
- state.labelsStyle = getLabelsStyle(state);
67
- state.headerInfo = state.dataSource.map((item) => {
68
- return { isSelected: false, title: item.title, isUP: false };
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
- }
113
- });
114
- return { flattenData, dataMap };
115
- };
116
- const handleClick = ({ api, props, state }) => (value) => {
117
- var _a, _b, _c;
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
- }
124
- if (state.headerIndex === -1) {
125
- state.showOptions = true;
126
- state.headerIndex = value;
127
- state.headerInfo[value] = getNewHeaderInfo(state.headerInfo, value, true);
128
- state.defaultSelectedIndexs = (_b = state.defaultSelectedArray[value]) != null ? _b : api.loadDefault(value);
129
- } else if (state.headerIndex !== value) {
130
- state.showOptions = true;
131
- state.headerInfo[state.headerIndex] = getNewHeaderInfo(state.headerInfo, state.headerIndex, false);
132
- state.headerIndex = value;
133
- state.headerInfo[value] = getNewHeaderInfo(state.headerInfo, value, true);
134
- state.defaultSelectedIndexs = (_c = state.defaultSelectedArray[value]) != null ? _c : api.loadDefault(value);
135
- } else {
136
- state.showOptions = !state.showOptions;
137
- const { isUP } = state.headerInfo[value];
138
- state.headerInfo[value] = getNewHeaderInfo(state.headerInfo, value, !isUP);
139
- }
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
- };
170
- const confirm = ({ state, emit }) => () => {
171
- const wheelLevelItems = getWheelLevelItems(state.wheelData, state.defaultSelectedIndexs);
172
- const { selectedLabels, selectedItems } = getSelected(wheelLevelItems, state.defaultSelectedIndexs);
173
- state.headerInfo[state.headerIndex] = { isSelected: true, title: selectedLabels, isUP: false };
174
- state.defaultSelectedArray[state.headerIndex] = state.defaultSelectedIndexs;
175
- emit("confirm", selectedItems, state.headerIndex, state.defaultSelectedIndexs);
176
- state.showOptions = false;
177
- };
178
- const reset = ({ api, props, state, emit }) => () => {
179
- var _a;
180
- state.headerInfo[state.headerIndex] = {
181
- isSelected: false,
182
- title: props.dataSource[state.headerIndex].title || "",
183
- isUP: false
184
- };
185
- state.defaultSelectedIndexs = (_a = props.defaultSelectedArray[state.headerIndex]) != null ? _a : api.loadDefault(state.headerIndex);
186
- state.defaultSelectedArray[state.headerIndex] = state.defaultSelectedIndexs;
187
- emit("reset", [], state.headerIndex, state.defaultSelectedIndexs);
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
- }
195
- };
196
- const wheelChange = (state) => (indexs) => {
197
- state.defaultSelectedIndexs = indexs;
198
- };
199
- const clickWheelItem = ({ state, emit }) => (indexs, text, item) => {
200
- if (indexs.length === 0) {
201
- state.defaultSelectedIndexs = [-1];
202
- state.headerInfo[state.headerIndex] = { isSelected: false, title: "", isUP: false };
203
- } else {
204
- state.defaultSelectedIndexs = indexs;
205
- state.headerInfo[state.headerIndex] = { isSelected: true, title: text, isUP: false };
206
- }
207
- state.defaultSelectedArray[state.headerIndex] = state.defaultSelectedIndexs;
208
- emit("confirm", item, state.headerIndex, indexs);
209
- state.showOptions = false;
210
- };
211
- const getWheelLevelItems = (wheelData, newIndexs) => {
212
- const level_1 = wheelData;
213
- const level_n = getNextLevel([], wheelData, newIndexs, 0);
214
- let wheelLevelItems = [];
215
- if (level_n.length === 0) {
216
- wheelLevelItems = [level_1];
217
- } else {
218
- wheelLevelItems = [level_1, ...level_n];
219
- }
220
- return wheelLevelItems;
221
- };
222
- const getNextLevel = (levelItems, children, nextIndexs, start) => {
223
- var _a, _b;
224
- let levelItem = (_b = (_a = children[nextIndexs[start]]) == null ? void 0 : _a.children) != null ? _b : [];
225
- if (start !== nextIndexs.length - 1) {
226
- levelItems.push(levelItem);
227
- return getNextLevel(levelItems, levelItem, nextIndexs, ++start);
228
- } else {
229
- return levelItems;
230
- }
231
- };
232
- const getSelected = (wheelLevelItems, selectedIndexs) => {
233
- const selectedItems = [];
234
- wheelLevelItems.forEach((levelItem, i) => {
235
- const index = selectedIndexs[i];
236
- if (levelItem[index]) {
237
- selectedItems.push(levelItem[index]);
238
- }
239
- });
240
- const selectedLabels = selectedItems.map((item) => item == null ? void 0 : item.label).join(" ");
241
- return { selectedLabels, selectedItems };
242
- };
243
- const loadDefault = ({ props, state }) => (value) => {
244
- var _a, _b;
245
- const current = (_a = props.defaultSelectedArray[value]) != null ? _a : [];
246
- let defaultSelectedIndexs = [];
247
- if ((_b = state.dataSource[state.headerIndex]) == null ? void 0 : _b.hasFooter) {
248
- const defaultL = current.length;
249
- const dataSL = getMaxFloor(state.wheelData);
250
- if (defaultL <= dataSL) {
251
- defaultSelectedIndexs = current.concat(new Array(dataSL - defaultL).fill(0));
252
- } else {
253
- defaultSelectedIndexs = current.slice(0, dataSL);
254
- }
255
- } else {
256
- defaultSelectedIndexs = current.length > 0 ? current : [-1];
257
- }
258
- return defaultSelectedIndexs;
259
- };
260
- const getMaxFloor = (treeData) => {
261
- let maxFloor = 0;
262
- const loop = (data, level) => {
263
- data.forEach((item) => {
264
- var _a;
265
- item.level = level;
266
- if (level > maxFloor) {
267
- maxFloor = level;
268
- }
269
- if (((_a = item == null ? void 0 : item.children) == null ? void 0 : _a.length) > 0) {
270
- loop(item.children, level + 1);
271
- }
272
- });
273
- };
274
- loop(treeData, 1);
275
- return maxFloor;
276
- };
277
- const getNewHeaderInfo = (headerInfo, index, isUP) => {
278
- var _a, _b;
279
- return { isSelected: (_a = headerInfo[index]) == null ? void 0 : _a.isSelected, title: (_b = headerInfo[index]) == null ? void 0 : _b.title, isUP };
280
- };
281
- const getLabelLevelsInfo = (refs) => {
282
- const { headerBox, label } = refs;
283
- if (!headerBox || !label)
284
- return [];
285
- const totalWidth = getRect(getEl(headerBox)).width;
286
- const labelWidth = label.map((node) => getRect(getEl(node))).map((rect) => rect.width);
287
- return labelWidth.map((labelWidth2, idx) => {
288
- const isOver25 = totalWidth * 0.25 < labelWidth2;
289
- return {
290
- idx,
291
- labelWidth: labelWidth2,
292
- totalWidth,
293
- isOver25
294
- };
295
- });
296
- };
297
- const getRect = (el) => {
298
- return {
299
- top: el.offsetTop,
300
- left: el.offsetLeft,
301
- width: el.offsetWidth,
302
- height: el.offsetHeight
303
- };
304
- };
305
- const getEl = (node) => {
306
- return node.$el || node;
307
- };
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
- }
318
- const over25Labels = state.labelLevelsInfo.filter((i) => i && !i.isOver25);
319
- let widthInfo = over25Labels;
320
- if (len >= 4) {
321
- return getStyleConfig(state.labelLevelsInfo, { width: `${(1 / len * 100).toFixed(2)}%` });
322
- }
323
- if (!widthInfo.length || widthInfo.length === state.labelLevelsInfo.length) {
324
- return getStyleConfig(state.labelLevelsInfo, { maxWidth: `${(1 / len * 100).toFixed(2)}%` });
325
- }
326
- let fillArr;
327
- if (widthInfo.length === 1) {
328
- fillArr = getFillArray(state, widthInfo, "37.5%");
329
- } else if (widthInfo.length === 2) {
330
- fillArr = getFillArray(state, widthInfo, "50%");
331
- }
332
- widthInfo = widthInfo.concat(fillArr);
333
- return widthInfo.reduce((styles, item) => {
334
- styles[item.idx] = item.maxWidth ? { maxWidth: item.maxWidth } : { maxWidth: "25%" };
335
- return styles;
336
- }, {});
337
- };
338
- const getStyleConfig = (data, style) => {
339
- return data.reduce((styleConfig, _, idx) => {
340
- styleConfig[idx] = style;
341
- return styleConfig;
342
- }, {});
343
- };
344
- const getFillArray = (state, widthInfo, maxWidth) => {
345
- const labelIndexArr = state.labelLevelsInfo.map((_, idx) => idx);
346
- const mapWidthInfoArr = widthInfo.map((i) => i.idx);
347
- return labelIndexArr.filter((i) => !mapWidthInfoArr.includes(i)).map((i) => {
348
- return {
349
- idx: i,
350
- maxWidth
351
- };
352
- });
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
- };
365
- export {
366
- clickWheelItem,
367
- computedCurrentOptions,
368
- confirm,
369
- created,
370
- getEl,
371
- getFillArray,
372
- getLabelLevelsInfo,
373
- getLabelsStyle,
374
- getMaxFloor,
375
- getNewHeaderInfo,
376
- getNextLevel,
377
- getOption,
378
- getRect,
379
- getSelected,
380
- getStyleConfig,
381
- getWheelLevelItems,
382
- handleClick,
383
- handleClose,
384
- handleOptionSelect,
385
- handleSearchBtnClick,
386
- handleSearchInput,
387
- initValue,
388
- loadDefault,
389
- reset,
390
- toggleItemExpand,
391
- updateTitle,
392
- updateValue,
393
- wheelChange
394
- };