vue-devui 1.0.0-rc.1 → 1.0.0-rc.2

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 (204) hide show
  1. package/README.md +126 -200
  2. package/auto-complete/index.es.js +55 -77
  3. package/auto-complete/index.umd.js +3 -1
  4. package/auto-complete/style.css +1 -1
  5. package/editable-select/index.es.js +118 -162
  6. package/editable-select/index.umd.js +1 -1
  7. package/nuxt/components/tagProps.js +3 -0
  8. package/package.json +1 -1
  9. package/popover/index.es.js +2 -2
  10. package/popover/index.umd.js +4 -4
  11. package/progress/index.es.js +1 -1
  12. package/progress/index.umd.js +1 -1
  13. package/progress/style.css +1 -1
  14. package/radio/index.es.js +8 -2
  15. package/radio/index.umd.js +1 -1
  16. package/radio/style.css +1 -1
  17. package/ripple/index.es.js +43 -42
  18. package/ripple/index.umd.js +1 -1
  19. package/slider/index.es.js +58 -58
  20. package/slider/index.umd.js +1 -1
  21. package/splitter/index.es.js +168 -125
  22. package/splitter/index.umd.js +11 -11
  23. package/style.css +1 -1
  24. package/tag/index.es.js +13 -17
  25. package/tag/index.umd.js +1 -1
  26. package/tag/style.css +1 -1
  27. package/vue-devui.es.js +765 -605
  28. package/vue-devui.umd.js +18 -16
  29. package/accordion/index.d.ts +0 -7
  30. package/accordion/index.es.js +0 -723
  31. package/accordion/index.umd.js +0 -1
  32. package/accordion/package.json +0 -7
  33. package/accordion/style.css +0 -1
  34. package/anchor/index.d.ts +0 -7
  35. package/anchor/index.es.js +0 -263
  36. package/anchor/index.umd.js +0 -1
  37. package/anchor/package.json +0 -7
  38. package/anchor/style.css +0 -1
  39. package/back-top/index.d.ts +0 -7
  40. package/back-top/index.es.js +0 -130
  41. package/back-top/index.umd.js +0 -1
  42. package/back-top/package.json +0 -7
  43. package/back-top/style.css +0 -1
  44. package/breadcrumb/index.d.ts +0 -7
  45. package/breadcrumb/index.es.js +0 -128
  46. package/breadcrumb/index.umd.js +0 -1
  47. package/breadcrumb/package.json +0 -7
  48. package/breadcrumb/style.css +0 -1
  49. package/carousel/index.d.ts +0 -7
  50. package/carousel/index.es.js +0 -314
  51. package/carousel/index.umd.js +0 -1
  52. package/carousel/package.json +0 -7
  53. package/carousel/style.css +0 -1
  54. package/cascader/index.d.ts +0 -7
  55. package/cascader/index.es.js +0 -5971
  56. package/cascader/index.umd.js +0 -27
  57. package/cascader/package.json +0 -7
  58. package/cascader/style.css +0 -1
  59. package/color-picker/index.d.ts +0 -7
  60. package/color-picker/index.es.js +0 -8196
  61. package/color-picker/index.umd.js +0 -27
  62. package/color-picker/package.json +0 -7
  63. package/color-picker/style.css +0 -1
  64. package/date-picker/index.d.ts +0 -7
  65. package/date-picker/index.es.js +0 -1154
  66. package/date-picker/index.umd.js +0 -1
  67. package/date-picker/package.json +0 -7
  68. package/date-picker/style.css +0 -1
  69. package/dragdrop/index.d.ts +0 -7
  70. package/dragdrop/index.es.js +0 -157
  71. package/dragdrop/index.umd.js +0 -1
  72. package/dragdrop/package.json +0 -7
  73. package/drawer/index.d.ts +0 -7
  74. package/drawer/index.es.js +0 -234
  75. package/drawer/index.umd.js +0 -1
  76. package/drawer/package.json +0 -7
  77. package/drawer/style.css +0 -1
  78. package/dropdown/index.d.ts +0 -7
  79. package/dropdown/index.es.js +0 -693
  80. package/dropdown/index.umd.js +0 -1
  81. package/dropdown/package.json +0 -7
  82. package/dropdown/style.css +0 -1
  83. package/form/index.d.ts +0 -7
  84. package/form/index.es.js +0 -7876
  85. package/form/index.umd.js +0 -27
  86. package/form/package.json +0 -7
  87. package/form/style.css +0 -1
  88. package/gantt/index.d.ts +0 -7
  89. package/gantt/index.es.js +0 -523
  90. package/gantt/index.umd.js +0 -1
  91. package/gantt/package.json +0 -7
  92. package/gantt/style.css +0 -1
  93. package/input-icon/index.d.ts +0 -7
  94. package/input-icon/index.es.js +0 -332
  95. package/input-icon/index.umd.js +0 -1
  96. package/input-icon/package.json +0 -7
  97. package/input-icon/style.css +0 -1
  98. package/input-number/index.d.ts +0 -7
  99. package/input-number/index.es.js +0 -229
  100. package/input-number/index.umd.js +0 -1
  101. package/input-number/package.json +0 -7
  102. package/input-number/style.css +0 -1
  103. package/list/index.d.ts +0 -7
  104. package/list/index.es.js +0 -39
  105. package/list/index.umd.js +0 -1
  106. package/list/package.json +0 -7
  107. package/list/style.css +0 -1
  108. package/nav-sprite/index.d.ts +0 -7
  109. package/nav-sprite/index.es.js +0 -68
  110. package/nav-sprite/index.umd.js +0 -1
  111. package/nav-sprite/package.json +0 -7
  112. package/nuxt/components/Accordion.js +0 -3
  113. package/nuxt/components/Anchor.js +0 -3
  114. package/nuxt/components/BackTop.js +0 -3
  115. package/nuxt/components/Breadcrumb.js +0 -3
  116. package/nuxt/components/Carousel.js +0 -3
  117. package/nuxt/components/CarouselItem.js +0 -3
  118. package/nuxt/components/Cascader.js +0 -3
  119. package/nuxt/components/ColorPicker.js +0 -3
  120. package/nuxt/components/Column.js +0 -3
  121. package/nuxt/components/DatePicker.js +0 -3
  122. package/nuxt/components/Drawer.js +0 -3
  123. package/nuxt/components/DrawerService.js +0 -3
  124. package/nuxt/components/Dropdown.js +0 -3
  125. package/nuxt/components/DropdownMenu.js +0 -3
  126. package/nuxt/components/Form.js +0 -3
  127. package/nuxt/components/FormControl.js +0 -3
  128. package/nuxt/components/FormItem.js +0 -3
  129. package/nuxt/components/FormLabel.js +0 -3
  130. package/nuxt/components/FormOperation.js +0 -3
  131. package/nuxt/components/Gantt.js +0 -3
  132. package/nuxt/components/InputIcon.js +0 -3
  133. package/nuxt/components/InputNumber.js +0 -3
  134. package/nuxt/components/List.js +0 -3
  135. package/nuxt/components/ListItem.js +0 -3
  136. package/nuxt/components/NavSprite.js +0 -2
  137. package/nuxt/components/QuadrantDiagram.js +0 -3
  138. package/nuxt/components/Select.js +0 -3
  139. package/nuxt/components/StepsGuide.js +0 -3
  140. package/nuxt/components/StickSlider.js +0 -3
  141. package/nuxt/components/Sticky.js +0 -2
  142. package/nuxt/components/Table.js +0 -3
  143. package/nuxt/components/Tabs.js +0 -3
  144. package/nuxt/components/TimePicker.js +0 -3
  145. package/nuxt/components/Tooltip.js +0 -3
  146. package/nuxt/components/Transfer.js +0 -3
  147. package/nuxt/components/Tree.js +0 -3
  148. package/nuxt/components/TreeSelect.js +0 -3
  149. package/nuxt/components/dropdownMenuProps.js +0 -3
  150. package/nuxt/components/tooltipProps.js +0 -3
  151. package/quadrant-diagram/index.d.ts +0 -7
  152. package/quadrant-diagram/index.es.js +0 -5728
  153. package/quadrant-diagram/index.umd.js +0 -27
  154. package/quadrant-diagram/package.json +0 -7
  155. package/quadrant-diagram/style.css +0 -1
  156. package/select/index.d.ts +0 -7
  157. package/select/index.es.js +0 -706
  158. package/select/index.umd.js +0 -1
  159. package/select/package.json +0 -7
  160. package/select/style.css +0 -1
  161. package/steps-guide/index.d.ts +0 -7
  162. package/steps-guide/index.es.js +0 -242
  163. package/steps-guide/index.umd.js +0 -1
  164. package/steps-guide/package.json +0 -7
  165. package/steps-guide/style.css +0 -1
  166. package/sticky/index.d.ts +0 -7
  167. package/sticky/index.es.js +0 -197
  168. package/sticky/index.umd.js +0 -1
  169. package/sticky/package.json +0 -7
  170. package/table/index.d.ts +0 -7
  171. package/table/index.es.js +0 -2024
  172. package/table/index.umd.js +0 -1
  173. package/table/package.json +0 -7
  174. package/table/style.css +0 -1
  175. package/tabs/index.d.ts +0 -7
  176. package/tabs/index.es.js +0 -194
  177. package/tabs/index.umd.js +0 -1
  178. package/tabs/package.json +0 -7
  179. package/tabs/style.css +0 -1
  180. package/time-picker/index.d.ts +0 -7
  181. package/time-picker/index.es.js +0 -1238
  182. package/time-picker/index.umd.js +0 -1
  183. package/time-picker/package.json +0 -7
  184. package/time-picker/style.css +0 -1
  185. package/tooltip/index.d.ts +0 -7
  186. package/tooltip/index.es.js +0 -5835
  187. package/tooltip/index.umd.js +0 -27
  188. package/tooltip/package.json +0 -7
  189. package/tooltip/style.css +0 -1
  190. package/transfer/index.d.ts +0 -7
  191. package/transfer/index.es.js +0 -7615
  192. package/transfer/index.umd.js +0 -27
  193. package/transfer/package.json +0 -7
  194. package/transfer/style.css +0 -1
  195. package/tree/index.d.ts +0 -7
  196. package/tree/index.es.js +0 -6495
  197. package/tree/index.umd.js +0 -27
  198. package/tree/package.json +0 -7
  199. package/tree/style.css +0 -1
  200. package/tree-select/index.d.ts +0 -7
  201. package/tree-select/index.es.js +0 -627
  202. package/tree-select/index.umd.js +0 -1
  203. package/tree-select/package.json +0 -7
  204. package/tree-select/style.css +0 -1
@@ -1,723 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { createVNode, getCurrentInstance, defineComponent, toRefs, inject, computed, Fragment, mergeProps, resolveComponent, isVNode, createTextVNode, provide, onMounted, watch } from "vue";
21
- import { useRoute } from "vue-router";
22
- const accordionProps = {
23
- data: {
24
- type: Array,
25
- default: null
26
- },
27
- titleKey: { type: String, default: "title" },
28
- loadingKey: { type: String, default: "loading" },
29
- childrenKey: { type: String, default: "children" },
30
- disabledKey: { type: String, default: "disabled" },
31
- activeKey: { type: String, default: "active" },
32
- openKey: { type: String, default: "open" },
33
- menuItemTemplate: { type: Boolean, default: true },
34
- itemTemplate: { type: Boolean, default: true },
35
- menuToggle: {
36
- type: Function,
37
- default: null
38
- },
39
- itemClick: {
40
- type: Function,
41
- default: null
42
- },
43
- activeItemChange: {
44
- type: Function,
45
- default: null
46
- },
47
- restrictOneOpen: { type: Boolean, default: false },
48
- autoOpenActiveMenu: { type: Boolean, default: false },
49
- showNoContent: { type: Boolean, default: true },
50
- noContentTemplate: { type: Boolean, default: true },
51
- loadingTemplate: { type: Boolean, default: true },
52
- innerListTemplate: { type: Boolean, default: true },
53
- linkType: {
54
- type: String,
55
- default: ""
56
- },
57
- linkTypeKey: { type: String, default: "linkType" },
58
- linkKey: { type: String, default: "link" },
59
- linkTargetKey: { type: String, default: "target" },
60
- linkDefaultTarget: { type: String, default: "_self" },
61
- accordionType: {
62
- type: String,
63
- default: "normal"
64
- }
65
- };
66
- const OpenIcon = () => {
67
- return createVNode("svg", {
68
- "width": "1em",
69
- "height": "1em",
70
- "viewBox": "0 0 16 16",
71
- "version": "1.1",
72
- "xmlns": "http://www.w3.org/2000/svg",
73
- "xmlns:xlink": "http://www.w3.org/1999/xlink"
74
- }, [createVNode("g", {
75
- "stroke": "none",
76
- "stroke-width": "1",
77
- "fill": "none",
78
- "fill-rule": "evenodd"
79
- }, [createVNode("path", {
80
- "d": "M12.1464466,6.85355339 L8.35355339,10.6464466 C8.15829124,10.8417088 7.84170876,10.8417088 7.64644661,10.6464466 L3.85355339,6.85355339 C3.65829124,6.65829124 3.65829124,6.34170876 3.85355339,6.14644661 C3.94732158,6.05267842 4.07449854,6 4.20710678,6 L11.7928932,6 C12.0690356,6 12.2928932,6.22385763 12.2928932,6.5 C12.2928932,6.63260824 12.2402148,6.7597852 12.1464466,6.85355339 Z",
81
- "fill-rule": "nonzero"
82
- }, null)])]);
83
- };
84
- const getRootSlots = () => {
85
- const rootComponentName = "DAccordion";
86
- const getRootComponent = (component) => {
87
- if (component && component.type.name === rootComponentName) {
88
- return component;
89
- }
90
- if (component && component.parent) {
91
- const parent = component.parent;
92
- return getRootComponent(parent);
93
- }
94
- };
95
- const rootComponent = getRootComponent(getCurrentInstance());
96
- return rootComponent == null ? void 0 : rootComponent.slots;
97
- };
98
- var DAccordionMenu = defineComponent({
99
- name: "DAccordionMenu",
100
- components: {
101
- OpenIcon
102
- },
103
- props: __spreadValues({
104
- item: Object,
105
- deepth: {
106
- type: Number,
107
- default: 0
108
- },
109
- parent: {
110
- type: Object,
111
- default: null
112
- }
113
- }, accordionProps),
114
- setup(props) {
115
- const {
116
- item,
117
- deepth,
118
- parent,
119
- openKey,
120
- activeKey,
121
- autoOpenActiveMenu,
122
- disabledKey,
123
- childrenKey,
124
- titleKey,
125
- menuItemTemplate
126
- } = toRefs(props);
127
- const rootSlots = getRootSlots();
128
- const accordionCtx = inject("accordionContext");
129
- const parentValue = parent.value;
130
- const deepValue = deepth.value;
131
- const toggle = (itemEvent) => {
132
- accordionCtx.menuToggleFn(itemEvent);
133
- };
134
- const hasActiveChildren = (item2) => {
135
- if (item2[activeKey.value] === true) {
136
- return true;
137
- }
138
- if (item2[childrenKey.value]) {
139
- return hasChildActive(item2[childrenKey.value]);
140
- }
141
- };
142
- const hasChildActive = (arr) => {
143
- let flag = false;
144
- if (!arr.length) {
145
- return false;
146
- }
147
- for (let i = 0; i < arr.length; i++) {
148
- if (arr[i][activeKey.value] === true) {
149
- flag = true;
150
- break;
151
- }
152
- if (arr[i][childrenKey.value]) {
153
- flag = hasChildActive(arr[i][childrenKey.value]);
154
- if (flag) {
155
- break;
156
- }
157
- }
158
- }
159
- return flag;
160
- };
161
- const keyOpen = computed(() => {
162
- return item.value && item.value[openKey.value];
163
- });
164
- const disabled = computed(() => {
165
- return item.value && item.value[disabledKey.value];
166
- });
167
- const title = computed(() => {
168
- return item.value && item.value[titleKey.value];
169
- });
170
- const children = computed(() => {
171
- return item.value && item.value[childrenKey.value];
172
- });
173
- const childActived = computed(() => {
174
- return hasActiveChildren(item.value);
175
- });
176
- const open = computed(() => {
177
- return keyOpen.value === void 0 && autoOpenActiveMenu.value ? childActived.value : keyOpen.value;
178
- });
179
- return () => {
180
- var _a;
181
- return createVNode(Fragment, null, [createVNode("div", {
182
- "class": ["devui-accordion-item-title", "devui-over-flow-ellipsis", open.value && "open", childActived.value && "active", disabled.value && "disabled"],
183
- "title": title.value,
184
- "style": {
185
- textIndent: deepValue * 20 + "px"
186
- },
187
- "onClick": (e) => !disabled.value && toggle({
188
- item: item.value,
189
- open: !open.value,
190
- parent: parentValue,
191
- event: e
192
- })
193
- }, [createVNode("div", {
194
- "class": ["devui-accordion-splitter", deepValue === 0 && "devui-parent-list"],
195
- "style": {
196
- left: deepValue * 20 + 10 + "px"
197
- }
198
- }, null), (!rootSlots.menuItemTemplate || menuItemTemplate.value === false) && createVNode(Fragment, null, [title.value]), rootSlots.menuItemTemplate && menuItemTemplate.value !== false && ((_a = rootSlots.menuItemTemplate) == null ? void 0 : _a.call(rootSlots, {
199
- parent: parentValue,
200
- deepth: deepValue,
201
- item: item.value
202
- })), createVNode("span", {
203
- "class": "devui-accordion-open-icon"
204
- }, [createVNode(OpenIcon, null, null)])]), createVNode("div", {
205
- "class": [!open.value && "devui-accordion-menu-hidden", "devui-accordion-submenu", "devui-accordion-show-animate"]
206
- }, [createVNode(AccordionList, mergeProps(props, {
207
- "deepth": deepValue + 1,
208
- "data": children.value || [],
209
- "parent": item.value
210
- }), null)])]);
211
- };
212
- }
213
- });
214
- var DAccordionItem = defineComponent({
215
- name: "DAccordionItem",
216
- props: __spreadValues({
217
- item: Object,
218
- deepth: {
219
- type: Number,
220
- default: 0
221
- },
222
- parent: {
223
- type: Object,
224
- default: null
225
- }
226
- }, accordionProps),
227
- setup(props) {
228
- const {
229
- item,
230
- deepth,
231
- parent,
232
- titleKey,
233
- activeKey,
234
- disabledKey,
235
- itemTemplate
236
- } = toRefs(props);
237
- const rootSlots = getRootSlots();
238
- const accordionCtx = inject("accordionContext");
239
- const parentValue = parent.value;
240
- const deepValue = deepth.value;
241
- const disabled = computed(() => {
242
- return item.value && item.value[disabledKey.value];
243
- });
244
- const title = computed(() => {
245
- return item.value && item.value[titleKey.value];
246
- });
247
- const active = computed(() => {
248
- return item.value && item.value[activeKey.value];
249
- });
250
- const childActived = computed(() => {
251
- return active.value;
252
- });
253
- const itemClick = (itemEvent) => {
254
- if (item.value && !disabled.value) {
255
- accordionCtx.itemClickFn(itemEvent);
256
- }
257
- };
258
- return () => {
259
- var _a;
260
- return createVNode(Fragment, null, [createVNode("div", {
261
- "class": ["devui-accordion-item-title", "devui-over-flow-ellipsis", childActived.value && "active", disabled.value && "disabled"],
262
- "title": title.value,
263
- "style": {
264
- textIndent: deepValue * 20 + "px"
265
- },
266
- "onClick": (e) => itemClick({
267
- item: item.value,
268
- parent: parentValue,
269
- event: e
270
- })
271
- }, [createVNode("div", {
272
- "class": ["devui-accordion-splitter", deepValue === 0 && "devui-parent-list"],
273
- "style": {
274
- left: deepValue * 20 + 10 + "px"
275
- }
276
- }, null), (!rootSlots.itemTemplate || itemTemplate.value === false) && createVNode(Fragment, null, [title.value]), rootSlots.itemTemplate && itemTemplate.value !== false && ((_a = rootSlots.itemTemplate) == null ? void 0 : _a.call(rootSlots, {
277
- parent: parentValue,
278
- deepth: deepValue,
279
- item: item.value
280
- }))])]);
281
- };
282
- }
283
- });
284
- var DAccordionItemHreflink = defineComponent({
285
- name: "DAccordionItemHreflink",
286
- component: {
287
- DAccordionItem
288
- },
289
- props: __spreadValues({
290
- item: Object,
291
- deepth: {
292
- type: Number,
293
- default: 0
294
- },
295
- parent: {
296
- type: Object,
297
- default: null
298
- }
299
- }, accordionProps),
300
- setup(props) {
301
- const {
302
- item,
303
- deepth,
304
- parent,
305
- titleKey,
306
- linkKey,
307
- linkTargetKey,
308
- linkDefaultTarget,
309
- disabledKey,
310
- itemTemplate
311
- } = toRefs(props);
312
- const rootSlots = getRootSlots();
313
- const accordionCtx = inject("accordionContext");
314
- const title = computed(() => {
315
- return item.value && item.value[titleKey.value];
316
- });
317
- const link = computed(() => {
318
- return item.value && item.value[linkKey.value];
319
- });
320
- const target = computed(() => {
321
- return item.value && (item.value[linkTargetKey.value] || linkDefaultTarget.value);
322
- });
323
- const disabled = computed(() => {
324
- return item.value && item.value[disabledKey.value];
325
- });
326
- const parentValue = parent.value;
327
- const deepValue = deepth.value;
328
- const linkItemClickFn = (itemEvent) => {
329
- if (item.value && !disabled.value) {
330
- accordionCtx.itemClickFn(itemEvent);
331
- }
332
- };
333
- const renderContent = () => {
334
- var _a;
335
- return createVNode(Fragment, null, [createVNode("div", {
336
- "class": ["devui-accordion-splitter", deepValue === 0 && "devui-parent-list"],
337
- "style": {
338
- left: deepValue * 20 + 10 + "px"
339
- }
340
- }, null), (!rootSlots.itemTemplate || itemTemplate.value === false) && createVNode(Fragment, null, [title.value]), rootSlots.itemTemplate && itemTemplate.value !== false && ((_a = rootSlots.itemTemplate) == null ? void 0 : _a.call(rootSlots, {
341
- parent: parentValue,
342
- deepth: deepValue,
343
- item: item.value
344
- }))]);
345
- };
346
- return () => {
347
- return createVNode(Fragment, null, [createVNode("div", {
348
- "class": ["devui-accordion-item-title", disabled.value && "disabled"],
349
- "style": {
350
- textIndent: deepValue * 20 + "px"
351
- }
352
- }, [!disabled.value && createVNode("a", {
353
- "href": link.value,
354
- "target": target.value,
355
- "class": "devui-over-flow-ellipsis",
356
- "title": title.value,
357
- "onClick": (e) => linkItemClickFn({
358
- item: item.value,
359
- parent: parentValue,
360
- event: e
361
- })
362
- }, [renderContent()]), disabled.value && createVNode("a", {
363
- "class": "devui-over-flow-ellipsis",
364
- "title": title.value
365
- }, [renderContent()])])]);
366
- };
367
- }
368
- });
369
- function _isSlot(s) {
370
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
371
- }
372
- var DAccordionItemRouterlink = defineComponent({
373
- name: "DAccordionItemRouterlink",
374
- component: {
375
- DAccordionItem
376
- },
377
- props: __spreadValues({
378
- item: Object,
379
- deepth: {
380
- type: Number,
381
- default: 0
382
- },
383
- parent: {
384
- type: Object,
385
- default: null
386
- }
387
- }, accordionProps),
388
- setup(props) {
389
- const {
390
- item,
391
- deepth,
392
- parent,
393
- titleKey,
394
- linkKey,
395
- linkDefaultTarget,
396
- disabledKey,
397
- itemTemplate
398
- } = toRefs(props);
399
- const route = useRoute();
400
- const rootSlots = getRootSlots();
401
- const accordionCtx = inject("accordionContext");
402
- console.log(useRoute());
403
- const title = computed(() => {
404
- return item.value && item.value[titleKey.value];
405
- });
406
- const link = computed(() => {
407
- return item.value && item.value[linkKey.value];
408
- });
409
- const isUsedVueRouter = computed(() => route !== void 0);
410
- const routerLinkActive = computed(() => {
411
- return route === link.value;
412
- });
413
- const disabled = computed(() => {
414
- return item.value && item.value[disabledKey.value];
415
- });
416
- const parentValue = parent.value;
417
- const deepValue = deepth.value;
418
- const linkItemClickFn = (itemEvent) => {
419
- if (item.value && !disabled.value) {
420
- accordionCtx.itemClickFn(itemEvent);
421
- }
422
- };
423
- const renderContent = () => {
424
- var _a;
425
- return createVNode(Fragment, null, [createVNode("div", {
426
- "class": ["devui-accordion-splitter", deepValue === 0 && "devui-parent-list"],
427
- "style": {
428
- left: deepValue * 20 + 10 + "px"
429
- }
430
- }, null), (!rootSlots.itemTemplate || itemTemplate.value === false) && createVNode(Fragment, null, [title.value]), rootSlots.itemTemplate && itemTemplate.value !== false && ((_a = rootSlots.itemTemplate) == null ? void 0 : _a.call(rootSlots, {
431
- parent: parentValue,
432
- deepth: deepValue,
433
- item: item.value
434
- }))]);
435
- };
436
- return () => {
437
- let _slot;
438
- return createVNode(Fragment, null, [createVNode("div", {
439
- "class": ["devui-accordion-item-title", disabled.value && "disabled"],
440
- "style": {
441
- textIndent: deepValue * 20 + "px"
442
- }
443
- }, [!disabled.value && createVNode(Fragment, null, [isUsedVueRouter.value && createVNode(resolveComponent("router-link"), {
444
- "to": link.value,
445
- "class": ["devui-over-flow-ellipsis", routerLinkActive.value && ".devui-router-active"],
446
- "custom": true,
447
- "title": title.value,
448
- "onClick": (e) => linkItemClickFn({
449
- item: item.value,
450
- parent: parentValue,
451
- event: e
452
- })
453
- }, _isSlot(_slot = renderContent()) ? _slot : {
454
- default: () => [_slot]
455
- }), !isUsedVueRouter.value && createVNode("a", {
456
- "href": link.value,
457
- "target": linkDefaultTarget.value,
458
- "class": "devui-over-flow-ellipsis",
459
- "title": title.value,
460
- "onClick": (e) => linkItemClickFn({
461
- item: item.value,
462
- parent: parentValue,
463
- event: e
464
- })
465
- }, [renderContent()])]), disabled.value && createVNode("a", {
466
- "class": "devui-over-flow-ellipsis",
467
- "title": title.value
468
- }, [renderContent()])])]);
469
- };
470
- }
471
- });
472
- var AccordionList = defineComponent({
473
- name: "DAccordionList",
474
- components: {
475
- DAccordionMenu,
476
- DAccordionItem,
477
- DAccordionItemHreflink,
478
- DAccordionItemRouterlink
479
- },
480
- inheritAttrs: false,
481
- props: __spreadValues({
482
- data: {
483
- type: Array,
484
- default: null
485
- },
486
- deepth: {
487
- type: Number,
488
- default: 0
489
- },
490
- parent: {
491
- type: Object,
492
- default: null
493
- },
494
- innerListTemplate: Boolean
495
- }, accordionProps),
496
- setup(props, {
497
- attrs
498
- }) {
499
- const {
500
- childrenKey,
501
- deepth,
502
- parent,
503
- data,
504
- linkType,
505
- showNoContent,
506
- loadingKey,
507
- titleKey,
508
- linkTypeKey,
509
- loadingTemplate,
510
- noContentTemplate,
511
- innerListTemplate
512
- } = toRefs(props);
513
- const parentValue = parent.value;
514
- const deepValue = deepth.value;
515
- const rootSlots = getRootSlots();
516
- const accordionCtx = inject("accordionContext");
517
- const loading = computed(() => {
518
- return parentValue && parentValue[loadingKey.value];
519
- });
520
- const noContent = computed(() => {
521
- const dataValue = data.value;
522
- return dataValue === void 0 || dataValue === null || dataValue.length === 0;
523
- });
524
- return () => {
525
- var _a, _b, _c;
526
- return createVNode(Fragment, null, [(!rootSlots.innerListTemplate || deepth.value === 0 || innerListTemplate.value === false) && createVNode("ul", mergeProps({
527
- "class": ["devui-accordion-list"]
528
- }, attrs), [data.value.map((item) => {
529
- return createVNode("li", {
530
- "class": "devui-accordion-item",
531
- "key": item[titleKey.value]
532
- }, [item[childrenKey.value] !== void 0 && createVNode("div", {
533
- "class": "devui-accordion-menu-item"
534
- }, [createVNode(resolveComponent("d-accordion-menu"), mergeProps(props, {
535
- "item": item,
536
- "deepth": deepValue,
537
- "parent": parentValue
538
- }), null)]), item[childrenKey.value] === void 0 && createVNode(Fragment, null, [(!linkType.value || linkType.value === "") && createVNode(resolveComponent("d-accordion-item"), mergeProps(props, {
539
- "item": item,
540
- "deepth": deepValue,
541
- "parent": parentValue
542
- }), null), linkType.value === "routerLink" && createVNode(resolveComponent("d-accordion-item-routerlink"), mergeProps(props, {
543
- "item": item,
544
- "deepth": deepValue,
545
- "parent": parentValue
546
- }), null), linkType.value === "hrefLink" && createVNode(resolveComponent("d-accordion-item-hreflink"), mergeProps(props, {
547
- "item": item,
548
- "deepth": deepValue,
549
- "parent": parentValue
550
- }), null), linkType.value === "dependOnLinkTypeKey" && createVNode(Fragment, null, [item[linkTypeKey.value] === "routerLink" && createVNode(resolveComponent("d-accordion-item-routerlink"), mergeProps(props, {
551
- "item": item,
552
- "deepth": deepValue,
553
- "parent": parentValue
554
- }), null), item[linkTypeKey.value] === "hrefLink" && createVNode(resolveComponent("d-accordion-item-hreflink"), mergeProps(props, {
555
- "item": item,
556
- "deepth": deepValue,
557
- "parent": parentValue
558
- }), null), item[linkTypeKey.value] !== "routerLink" && item[linkTypeKey.value] !== "hrefLink" && createVNode(resolveComponent("d-accordion-item"), mergeProps(props, {
559
- "item": item,
560
- "deepth": deepValue,
561
- "parent": parentValue
562
- }), null)])])]);
563
- })]), rootSlots.innerListTemplate && innerListTemplate.value !== false && deepValue !== 0 && ((_a = rootSlots.innerListTemplate) == null ? void 0 : _a.call(rootSlots, {
564
- item: parentValue,
565
- deepth: deepValue,
566
- itemClickFn: accordionCtx.itemClickFn,
567
- menuToggleFn: accordionCtx.menuToggleFn
568
- })), (!rootSlots.innerListTemplate || innerListTemplate.value === false) && (loading.value || noContent.value && showNoContent.value) && createVNode("ul", mergeProps({
569
- "class": ["devui-accordion-list"]
570
- }, attrs), [
571
- loading.value && (!rootSlots.loadingTemplate || loadingTemplate.value === false) && createVNode("li", {
572
- "class": "devui-accordion-item"
573
- }, [createVNode("div", {
574
- "class": ["devui-accordion-item-title", "devui-over-flow-ellipsis"],
575
- "style": {
576
- textIndent: deepValue * 20 + "px"
577
- }
578
- }, [createTextVNode("\u52A0\u8F7D\u4E2D...")])]),
579
- loading.value && rootSlots.loadingTemplate && loadingTemplate.value !== false && ((_b = rootSlots.loadingTemplate) == null ? void 0 : _b.call(rootSlots, {
580
- item: parentValue,
581
- deepth: deepValue
582
- })),
583
- showNoContent.value && !loading.value && noContent.value && (!rootSlots.noContentTemplate || noContentTemplate.value === false) && createVNode("li", {
584
- "class": "devui-accordion-item"
585
- }, [createVNode("div", {
586
- "class": ["devui-accordion-item-title", "devui-over-flow-ellipsis disabled"],
587
- "style": {
588
- textIndent: deepValue * 20 + "px"
589
- }
590
- }, [createTextVNode("\u6CA1\u6709\u6570\u636E")])]),
591
- showNoContent.value && !loading.value && noContent.value && rootSlots.noContentTemplate && noContentTemplate.value !== false && ((_c = rootSlots.noContentTemplate) == null ? void 0 : _c.call(rootSlots, {
592
- item: parentValue,
593
- deepth: deepValue
594
- }))
595
- ])]);
596
- };
597
- }
598
- });
599
- var accordion = "";
600
- var Accordion = defineComponent({
601
- name: "DAccordion",
602
- props: accordionProps,
603
- setup(props, {
604
- emit
605
- }) {
606
- const {
607
- data,
608
- childrenKey,
609
- activeKey,
610
- openKey,
611
- accordionType,
612
- autoOpenActiveMenu,
613
- restrictOneOpen
614
- } = toRefs(props);
615
- let clickActiveItem = void 0;
616
- const flatten = (arr, childrenKey2 = "children", includeParent = false, includeLeaf = true) => {
617
- return arr.reduce((acc, cur) => {
618
- const children = cur[childrenKey2];
619
- if (children === void 0) {
620
- if (includeLeaf) {
621
- acc.push(cur);
622
- }
623
- } else {
624
- if (includeParent) {
625
- acc.push(cur);
626
- }
627
- if (Array.isArray(children)) {
628
- acc.push(...flatten(children, childrenKey2, includeParent));
629
- }
630
- }
631
- return acc;
632
- }, []);
633
- };
634
- const initActiveItem = () => {
635
- const activeItem = flatten(data.value, childrenKey.value).filter((item) => item[activeKey.value]).pop();
636
- if (activeItem) {
637
- if (!clickActiveItem) {
638
- activeItemFn(activeItem);
639
- }
640
- } else {
641
- clickActiveItem = void 0;
642
- }
643
- };
644
- const activeItemFn = (item) => {
645
- if (clickActiveItem && clickActiveItem[activeKey.value]) {
646
- clickActiveItem[activeKey.value] = false;
647
- }
648
- item[activeKey.value] = true;
649
- clickActiveItem = item;
650
- emit("activeItemChange", clickActiveItem);
651
- };
652
- const openMenuFn = (item, open) => {
653
- if (open && restrictOneOpen.value) {
654
- data.value.forEach((itemtemp) => {
655
- itemtemp[openKey.value] = false;
656
- });
657
- }
658
- item[openKey.value] = open;
659
- };
660
- const itemClickFn = (itemEvent) => {
661
- const prevActiveItem = clickActiveItem;
662
- activeItemFn(itemEvent.item);
663
- emit("itemClick", __spreadProps(__spreadValues({}, itemEvent), {
664
- prevActiveItem
665
- }));
666
- };
667
- const linkItemClickFn = (itemEvent) => {
668
- const prevActiveItem = clickActiveItem;
669
- clickActiveItem = itemEvent.item;
670
- emit("linkItemClick", __spreadProps(__spreadValues({}, itemEvent), {
671
- prevActiveItem
672
- }));
673
- };
674
- const menuToggleFn = (menuEvent) => {
675
- openMenuFn(menuEvent.item, menuEvent.open);
676
- emit("menuToggle", menuEvent);
677
- };
678
- const cleanOpenData = () => {
679
- flatten(data.value, childrenKey.value, true, false).forEach((item) => item[openKey.value] = void 0);
680
- };
681
- provide("accordionContext", {
682
- itemClickFn,
683
- linkItemClickFn,
684
- menuToggleFn
685
- });
686
- onMounted(() => {
687
- if (data.value) {
688
- initActiveItem();
689
- }
690
- });
691
- watch(() => autoOpenActiveMenu.value, (current, preV) => {
692
- if (current && preV === false) {
693
- cleanOpenData();
694
- }
695
- });
696
- watch(data.value, (current, preV) => {
697
- initActiveItem();
698
- }, {
699
- deep: true
700
- });
701
- return () => {
702
- return createVNode("div", {
703
- "class": ["devui-accordion-menu", "devui-scrollbar", "devui-accordion-show-animate", accordionType.value === "normal" && "devui-accordion-menu-normal"]
704
- }, [createVNode(AccordionList, mergeProps(props, {
705
- "data": data.value,
706
- "deepth": 0,
707
- "parent": null
708
- }), null)]);
709
- };
710
- }
711
- });
712
- Accordion.install = function(app) {
713
- app.component(Accordion.name, Accordion);
714
- };
715
- var index = {
716
- title: "Accordion \u624B\u98CE\u7434",
717
- category: "\u5BFC\u822A",
718
- status: "10%",
719
- install(app) {
720
- app.use(Accordion);
721
- }
722
- };
723
- export { Accordion, index as default };