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