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

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 (328) hide show
  1. package/README.md +149 -200
  2. package/alert/index.es.js +46 -15
  3. package/alert/index.umd.js +1 -1
  4. package/alert/style.css +1 -1
  5. package/auto-complete/index.es.js +8166 -287
  6. package/auto-complete/index.umd.js +29 -1
  7. package/auto-complete/style.css +1 -1
  8. package/avatar/index.es.js +153 -146
  9. package/avatar/index.umd.js +1 -1
  10. package/avatar/style.css +1 -1
  11. package/badge/index.es.js +29 -4
  12. package/badge/index.umd.js +1 -1
  13. package/badge/style.css +1 -1
  14. package/button/index.es.js +5726 -111
  15. package/button/index.umd.js +27 -1
  16. package/button/style.css +1 -1
  17. package/card/index.es.js +59 -35
  18. package/card/index.umd.js +1 -1
  19. package/card/style.css +1 -1
  20. package/checkbox/index.es.js +8060 -255
  21. package/checkbox/index.umd.js +27 -1
  22. package/checkbox/style.css +1 -1
  23. package/{accordion → collapse}/index.d.ts +0 -0
  24. package/collapse/index.es.js +379 -0
  25. package/collapse/index.umd.js +1 -0
  26. package/{anchor → collapse}/package.json +1 -1
  27. package/collapse/style.css +1 -0
  28. package/countdown/index.es.js +3 -6
  29. package/countdown/index.umd.js +1 -1
  30. package/date-picker/index.es.js +8130 -242
  31. package/date-picker/index.umd.js +27 -1
  32. package/date-picker/style.css +1 -1
  33. package/drawer/index.es.js +31 -4
  34. package/drawer/index.umd.js +1 -1
  35. package/drawer/style.css +1 -1
  36. package/dropdown/index.es.js +209 -148
  37. package/dropdown/index.umd.js +1 -1
  38. package/dropdown/style.css +1 -1
  39. package/editable-select/index.es.js +521 -153
  40. package/editable-select/index.umd.js +1 -1
  41. package/editable-select/style.css +1 -1
  42. package/form/index.es.js +1040 -1187
  43. package/form/index.umd.js +16 -16
  44. package/form/style.css +1 -1
  45. package/fullscreen/index.es.js +29 -5
  46. package/fullscreen/index.umd.js +1 -1
  47. package/fullscreen/style.css +1 -1
  48. package/grid/index.es.js +101 -86
  49. package/grid/index.umd.js +1 -1
  50. package/grid/style.css +1 -1
  51. package/icon/index.es.js +182 -23
  52. package/icon/index.umd.js +1 -1
  53. package/icon/style.css +1 -0
  54. package/image-preview/index.es.js +53 -30
  55. package/image-preview/index.umd.js +1 -1
  56. package/image-preview/style.css +1 -1
  57. package/input/index.es.js +8066 -144
  58. package/input/index.umd.js +27 -1
  59. package/input/style.css +1 -1
  60. package/input-number/index.es.js +274 -177
  61. package/input-number/index.umd.js +1 -1
  62. package/input-number/style.css +1 -1
  63. package/layout/index.es.js +40 -25
  64. package/layout/index.umd.js +1 -1
  65. package/layout/style.css +1 -1
  66. package/loading/index.es.js +74 -35
  67. package/loading/index.umd.js +1 -1
  68. package/loading/style.css +1 -1
  69. package/modal/index.es.js +374 -171
  70. package/modal/index.umd.js +1 -1
  71. package/modal/style.css +1 -1
  72. package/notification/index.es.js +292 -40
  73. package/notification/index.umd.js +1 -1
  74. package/notification/style.css +1 -1
  75. package/nuxt/components/ButtonGroup.js +3 -0
  76. package/nuxt/components/CheckboxButton.js +3 -0
  77. package/nuxt/components/CheckboxGroup.js +3 -0
  78. package/nuxt/components/Collapse.js +3 -0
  79. package/nuxt/components/CollapseItem.js +3 -0
  80. package/nuxt/components/DropdownPropsKey.js +3 -0
  81. package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
  82. package/nuxt/components/FORM_TOKEN.js +3 -0
  83. package/nuxt/components/Icon.js +1 -0
  84. package/nuxt/components/IconGroup.js +3 -0
  85. package/nuxt/components/LABEL_DATA.js +3 -0
  86. package/nuxt/components/LoadingOptions.js +3 -0
  87. package/nuxt/components/Option.js +3 -0
  88. package/nuxt/components/RadioButton.js +3 -0
  89. package/nuxt/components/Tab.js +3 -0
  90. package/nuxt/components/autoCompleteProps.js +3 -0
  91. package/nuxt/components/avatarProps.js +3 -0
  92. package/nuxt/components/buttonGroupInjectionKey.js +3 -0
  93. package/nuxt/components/buttonGroupProps.js +3 -0
  94. package/nuxt/components/cardProps.js +3 -0
  95. package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
  96. package/nuxt/components/checkboxGroupProps.js +3 -0
  97. package/nuxt/components/checkboxProps.js +3 -0
  98. package/nuxt/components/colProps.js +3 -0
  99. package/nuxt/components/colPropsBaseClass.js +3 -0
  100. package/nuxt/components/colPropsBaseStyle.js +3 -0
  101. package/nuxt/components/collapseItemProps.js +3 -0
  102. package/nuxt/components/collapseProps.js +3 -0
  103. package/nuxt/components/countdownProps.js +3 -0
  104. package/nuxt/components/editableSelectProps.js +3 -0
  105. package/nuxt/components/formItemProps.js +3 -0
  106. package/nuxt/components/formProps.js +3 -0
  107. package/nuxt/components/iconProps.js +1 -0
  108. package/nuxt/components/imagePreviewProps.js +3 -0
  109. package/nuxt/components/inputProps.js +3 -0
  110. package/nuxt/components/loadingProps.js +3 -0
  111. package/nuxt/components/modalProps.js +3 -0
  112. package/nuxt/components/progressProps.js +3 -0
  113. package/nuxt/components/rateProps.js +3 -0
  114. package/nuxt/components/resultProps.js +3 -0
  115. package/nuxt/components/rowProps.js +3 -0
  116. package/nuxt/components/screenSizes.js +3 -0
  117. package/nuxt/components/skeletonProps.js +3 -0
  118. package/nuxt/components/sliderProps.js +3 -0
  119. package/nuxt/components/splitterProps.js +3 -0
  120. package/nuxt/components/statisticProps.js +3 -0
  121. package/nuxt/components/svgIconProps.js +3 -0
  122. package/nuxt/components/switchProps.js +3 -0
  123. package/nuxt/components/tabsProps.js +3 -0
  124. package/nuxt/components/tagProps.js +3 -0
  125. package/nuxt/components/textareaProps.js +3 -0
  126. package/nuxt/components/timeAxisProps.js +3 -0
  127. package/nuxt/components/treeProps.js +3 -0
  128. package/overlay/index.es.js +104 -133
  129. package/overlay/index.umd.js +1 -1
  130. package/overlay/style.css +1 -1
  131. package/package.json +3 -2
  132. package/pagination/index.es.js +148 -136
  133. package/pagination/index.umd.js +1 -1
  134. package/pagination/style.css +1 -1
  135. package/panel/style.css +1 -1
  136. package/popover/index.es.js +294 -230
  137. package/popover/index.umd.js +15 -15
  138. package/popover/style.css +1 -1
  139. package/progress/index.es.js +110 -56
  140. package/progress/index.umd.js +3 -3
  141. package/progress/style.css +1 -1
  142. package/radio/index.es.js +7959 -146
  143. package/radio/index.umd.js +27 -1
  144. package/radio/style.css +1 -1
  145. package/rate/index.es.js +77 -55
  146. package/rate/index.umd.js +1 -1
  147. package/rate/style.css +1 -1
  148. package/result/index.es.js +169 -27
  149. package/result/index.umd.js +1 -1
  150. package/result/style.css +1 -1
  151. package/ripple/index.es.js +43 -42
  152. package/ripple/index.umd.js +1 -1
  153. package/search/index.es.js +3620 -1095
  154. package/search/index.umd.js +18 -18
  155. package/search/style.css +1 -1
  156. package/select/index.es.js +9131 -584
  157. package/select/index.umd.js +27 -1
  158. package/select/style.css +1 -1
  159. package/skeleton/index.es.js +46 -24
  160. package/skeleton/index.umd.js +1 -1
  161. package/skeleton/style.css +1 -1
  162. package/slider/index.es.js +108 -75
  163. package/slider/index.umd.js +1 -1
  164. package/slider/style.css +1 -1
  165. package/splitter/index.es.js +443 -335
  166. package/splitter/index.umd.js +15 -15
  167. package/splitter/style.css +1 -1
  168. package/statistic/index.es.js +7 -18
  169. package/statistic/index.umd.js +1 -1
  170. package/status/index.es.js +26 -2
  171. package/status/index.umd.js +1 -1
  172. package/status/style.css +1 -1
  173. package/style.css +1 -1
  174. package/switch/index.es.js +7794 -64
  175. package/switch/index.umd.js +27 -1
  176. package/switch/style.css +1 -1
  177. package/table/index.es.js +10038 -1180
  178. package/table/index.umd.js +27 -1
  179. package/table/style.css +1 -1
  180. package/tabs/index.es.js +342 -141
  181. package/tabs/index.umd.js +1 -1
  182. package/tabs/style.css +1 -1
  183. package/tag/index.es.js +47 -23
  184. package/tag/index.umd.js +1 -1
  185. package/tag/style.css +1 -1
  186. package/textarea/index.es.js +7913 -83
  187. package/textarea/index.umd.js +35 -1
  188. package/textarea/style.css +1 -1
  189. package/timeline/index.es.js +176 -37
  190. package/timeline/index.umd.js +1 -1
  191. package/timeline/style.css +1 -1
  192. package/tooltip/index.es.js +285 -220
  193. package/tooltip/index.umd.js +15 -15
  194. package/tooltip/style.css +1 -1
  195. package/tree/index.es.js +4190 -1857
  196. package/tree/index.umd.js +18 -18
  197. package/tree/style.css +1 -1
  198. package/upload/index.es.js +365 -106
  199. package/upload/index.umd.js +1 -1
  200. package/upload/style.css +1 -1
  201. package/vue-devui.es.js +20102 -25264
  202. package/vue-devui.umd.js +25 -15
  203. package/accordion/index.es.js +0 -723
  204. package/accordion/index.umd.js +0 -1
  205. package/accordion/package.json +0 -7
  206. package/accordion/style.css +0 -1
  207. package/anchor/index.d.ts +0 -7
  208. package/anchor/index.es.js +0 -263
  209. package/anchor/index.umd.js +0 -1
  210. package/anchor/style.css +0 -1
  211. package/back-top/index.d.ts +0 -7
  212. package/back-top/index.es.js +0 -130
  213. package/back-top/index.umd.js +0 -1
  214. package/back-top/package.json +0 -7
  215. package/back-top/style.css +0 -1
  216. package/breadcrumb/index.d.ts +0 -7
  217. package/breadcrumb/index.es.js +0 -128
  218. package/breadcrumb/index.umd.js +0 -1
  219. package/breadcrumb/package.json +0 -7
  220. package/breadcrumb/style.css +0 -1
  221. package/carousel/index.d.ts +0 -7
  222. package/carousel/index.es.js +0 -314
  223. package/carousel/index.umd.js +0 -1
  224. package/carousel/package.json +0 -7
  225. package/carousel/style.css +0 -1
  226. package/cascader/index.d.ts +0 -7
  227. package/cascader/index.es.js +0 -5971
  228. package/cascader/index.umd.js +0 -27
  229. package/cascader/package.json +0 -7
  230. package/cascader/style.css +0 -1
  231. package/color-picker/index.d.ts +0 -7
  232. package/color-picker/index.es.js +0 -8196
  233. package/color-picker/index.umd.js +0 -27
  234. package/color-picker/package.json +0 -7
  235. package/color-picker/style.css +0 -1
  236. package/comment/index.d.ts +0 -7
  237. package/comment/index.es.js +0 -86
  238. package/comment/index.umd.js +0 -1
  239. package/comment/package.json +0 -7
  240. package/comment/style.css +0 -1
  241. package/dragdrop/index.d.ts +0 -7
  242. package/dragdrop/index.es.js +0 -157
  243. package/dragdrop/index.umd.js +0 -1
  244. package/dragdrop/package.json +0 -7
  245. package/gantt/index.d.ts +0 -7
  246. package/gantt/index.es.js +0 -523
  247. package/gantt/index.umd.js +0 -1
  248. package/gantt/package.json +0 -7
  249. package/gantt/style.css +0 -1
  250. package/input-icon/index.d.ts +0 -7
  251. package/input-icon/index.es.js +0 -332
  252. package/input-icon/index.umd.js +0 -1
  253. package/input-icon/package.json +0 -7
  254. package/input-icon/style.css +0 -1
  255. package/list/index.d.ts +0 -7
  256. package/list/index.es.js +0 -39
  257. package/list/index.umd.js +0 -1
  258. package/list/package.json +0 -7
  259. package/list/style.css +0 -1
  260. package/nav-sprite/index.d.ts +0 -7
  261. package/nav-sprite/index.es.js +0 -68
  262. package/nav-sprite/index.umd.js +0 -1
  263. package/nav-sprite/package.json +0 -7
  264. package/nuxt/components/Accordion.js +0 -3
  265. package/nuxt/components/Anchor.js +0 -3
  266. package/nuxt/components/BackTop.js +0 -3
  267. package/nuxt/components/Breadcrumb.js +0 -3
  268. package/nuxt/components/Carousel.js +0 -3
  269. package/nuxt/components/CarouselItem.js +0 -3
  270. package/nuxt/components/Cascader.js +0 -3
  271. package/nuxt/components/ColorPicker.js +0 -3
  272. package/nuxt/components/Comment.js +0 -3
  273. package/nuxt/components/FormControl.js +0 -3
  274. package/nuxt/components/FormLabel.js +0 -3
  275. package/nuxt/components/Gantt.js +0 -3
  276. package/nuxt/components/InputIcon.js +0 -3
  277. package/nuxt/components/List.js +0 -3
  278. package/nuxt/components/ListItem.js +0 -3
  279. package/nuxt/components/NavSprite.js +0 -2
  280. package/nuxt/components/QuadrantDiagram.js +0 -3
  281. package/nuxt/components/ReadTip.js +0 -3
  282. package/nuxt/components/StepsGuide.js +0 -3
  283. package/nuxt/components/Sticky.js +0 -2
  284. package/nuxt/components/TagInput.js +0 -3
  285. package/nuxt/components/TimePicker.js +0 -3
  286. package/nuxt/components/Transfer.js +0 -3
  287. package/nuxt/components/TreeSelect.js +0 -3
  288. package/nuxt/components/overlayEmits.js +0 -3
  289. package/nuxt/components/overlayProps.js +0 -3
  290. package/quadrant-diagram/index.d.ts +0 -7
  291. package/quadrant-diagram/index.es.js +0 -5728
  292. package/quadrant-diagram/index.umd.js +0 -27
  293. package/quadrant-diagram/package.json +0 -7
  294. package/quadrant-diagram/style.css +0 -1
  295. package/read-tip/index.d.ts +0 -7
  296. package/read-tip/index.es.js +0 -261
  297. package/read-tip/index.umd.js +0 -1
  298. package/read-tip/package.json +0 -7
  299. package/read-tip/style.css +0 -1
  300. package/steps-guide/index.d.ts +0 -7
  301. package/steps-guide/index.es.js +0 -242
  302. package/steps-guide/index.umd.js +0 -1
  303. package/steps-guide/package.json +0 -7
  304. package/steps-guide/style.css +0 -1
  305. package/sticky/index.d.ts +0 -7
  306. package/sticky/index.es.js +0 -197
  307. package/sticky/index.umd.js +0 -1
  308. package/sticky/package.json +0 -7
  309. package/tag-input/index.d.ts +0 -7
  310. package/tag-input/index.es.js +0 -331
  311. package/tag-input/index.umd.js +0 -1
  312. package/tag-input/package.json +0 -7
  313. package/tag-input/style.css +0 -1
  314. package/time-picker/index.d.ts +0 -7
  315. package/time-picker/index.es.js +0 -1238
  316. package/time-picker/index.umd.js +0 -1
  317. package/time-picker/package.json +0 -7
  318. package/time-picker/style.css +0 -1
  319. package/transfer/index.d.ts +0 -7
  320. package/transfer/index.es.js +0 -7615
  321. package/transfer/index.umd.js +0 -27
  322. package/transfer/package.json +0 -7
  323. package/transfer/style.css +0 -1
  324. package/tree-select/index.d.ts +0 -7
  325. package/tree-select/index.es.js +0 -627
  326. package/tree-select/index.umd.js +0 -1
  327. package/tree-select/package.json +0 -7
  328. 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 };