vue-devui 1.0.0-beta.1 → 1.0.0-beta.13

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 (332) hide show
  1. package/README.md +62 -45
  2. package/accordion/index.d.ts +7 -0
  3. package/accordion/index.es.js +460 -142
  4. package/accordion/index.umd.js +1 -1
  5. package/accordion/style.css +1 -1
  6. package/alert/index.d.ts +7 -0
  7. package/alert/index.es.js +7 -5
  8. package/alert/index.umd.js +1 -1
  9. package/alert/style.css +1 -1
  10. package/anchor/index.d.ts +7 -0
  11. package/avatar/index.d.ts +7 -0
  12. package/avatar/index.es.js +1 -1
  13. package/avatar/index.umd.js +1 -1
  14. package/back-top/index.d.ts +7 -0
  15. package/back-top/index.es.js +128 -0
  16. package/back-top/index.umd.js +1 -0
  17. package/back-top/package.json +7 -0
  18. package/back-top/style.css +1 -0
  19. package/badge/index.d.ts +7 -0
  20. package/badge/index.es.js +1 -1
  21. package/badge/index.umd.js +1 -1
  22. package/breadcrumb/index.d.ts +7 -0
  23. package/button/index.d.ts +7 -0
  24. package/button/index.es.js +218 -12
  25. package/button/index.umd.js +1 -1
  26. package/button/style.css +1 -1
  27. package/card/index.d.ts +7 -0
  28. package/card/index.es.js +1 -1
  29. package/card/index.umd.js +1 -1
  30. package/carousel/index.d.ts +7 -0
  31. package/carousel/index.es.js +5 -4
  32. package/carousel/index.umd.js +1 -1
  33. package/cascader/index.d.ts +7 -0
  34. package/cascader/index.es.js +1239 -83
  35. package/cascader/index.umd.js +1 -1
  36. package/cascader/style.css +1 -1
  37. package/checkbox/index.d.ts +7 -0
  38. package/checkbox/index.es.js +43 -8
  39. package/checkbox/index.umd.js +1 -1
  40. package/color-picker/index.d.ts +7 -0
  41. package/color-picker/index.es.js +2960 -0
  42. package/color-picker/index.umd.js +1 -0
  43. package/color-picker/package.json +7 -0
  44. package/color-picker/style.css +1 -0
  45. package/comment/index.d.ts +7 -0
  46. package/comment/index.es.js +85 -0
  47. package/comment/index.umd.js +1 -0
  48. package/comment/package.json +7 -0
  49. package/comment/style.css +1 -0
  50. package/countdown/index.d.ts +7 -0
  51. package/countdown/index.es.js +176 -0
  52. package/countdown/index.umd.js +1 -0
  53. package/countdown/package.json +7 -0
  54. package/countdown/style.css +1 -0
  55. package/date-picker/index.d.ts +7 -0
  56. package/date-picker/index.es.js +32 -21
  57. package/date-picker/index.umd.js +1 -1
  58. package/date-picker/style.css +1 -1
  59. package/dragdrop/index.d.ts +7 -0
  60. package/dragdrop/index.es.js +157 -0
  61. package/dragdrop/index.umd.js +1 -0
  62. package/dragdrop/package.json +7 -0
  63. package/drawer/index.d.ts +7 -0
  64. package/drawer/index.es.js +194 -42
  65. package/drawer/index.umd.js +1 -1
  66. package/drawer/style.css +1 -1
  67. package/dropdown/index.d.ts +7 -0
  68. package/dropdown/index.es.js +535 -0
  69. package/dropdown/index.umd.js +1 -0
  70. package/dropdown/package.json +7 -0
  71. package/dropdown/style.css +1 -0
  72. package/editable-select/index.d.ts +7 -0
  73. package/editable-select/index.es.js +5782 -469
  74. package/editable-select/index.umd.js +27 -1
  75. package/editable-select/style.css +1 -1
  76. package/form/index.d.ts +7 -0
  77. package/form/index.es.js +2257 -0
  78. package/form/index.umd.js +1 -0
  79. package/form/package.json +7 -0
  80. package/form/style.css +1 -0
  81. package/fullscreen/index.d.ts +7 -0
  82. package/fullscreen/index.es.js +14 -4
  83. package/fullscreen/index.umd.js +1 -1
  84. package/gantt/index.d.ts +7 -0
  85. package/gantt/index.es.js +535 -0
  86. package/gantt/index.umd.js +1 -0
  87. package/gantt/package.json +7 -0
  88. package/gantt/style.css +1 -0
  89. package/grid/index.d.ts +7 -0
  90. package/grid/index.es.js +269 -0
  91. package/grid/index.umd.js +1 -0
  92. package/grid/package.json +7 -0
  93. package/grid/style.css +1 -0
  94. package/icon/index.d.ts +7 -0
  95. package/icon/index.es.js +6 -5
  96. package/icon/index.umd.js +1 -1
  97. package/image-preview/index.d.ts +7 -0
  98. package/image-preview/index.es.js +99 -20
  99. package/image-preview/index.umd.js +1 -1
  100. package/image-preview/style.css +1 -1
  101. package/index.d.ts +7 -0
  102. package/input/index.d.ts +7 -0
  103. package/input/index.es.js +24 -13
  104. package/input/index.umd.js +1 -1
  105. package/input-icon/index.d.ts +7 -0
  106. package/input-icon/index.es.js +332 -0
  107. package/input-icon/index.umd.js +1 -0
  108. package/input-icon/package.json +7 -0
  109. package/input-icon/style.css +1 -0
  110. package/input-number/index.d.ts +7 -0
  111. package/input-number/index.es.js +5 -4
  112. package/input-number/index.umd.js +1 -1
  113. package/layout/index.d.ts +7 -0
  114. package/layout/index.es.js +1 -1
  115. package/layout/index.umd.js +1 -1
  116. package/loading/index.d.ts +7 -0
  117. package/loading/index.es.js +1 -1
  118. package/loading/index.umd.js +1 -1
  119. package/modal/index.d.ts +7 -0
  120. package/modal/index.es.js +328 -109
  121. package/modal/index.umd.js +1 -1
  122. package/modal/style.css +1 -1
  123. package/nav-sprite/index.d.ts +7 -0
  124. package/nuxt/components/Accordion.js +3 -0
  125. package/nuxt/components/Alert.js +3 -0
  126. package/nuxt/components/Anchor.js +3 -0
  127. package/nuxt/components/Aside.js +3 -0
  128. package/nuxt/components/Avatar.js +3 -0
  129. package/nuxt/components/BackTop.js +3 -0
  130. package/nuxt/components/Badge.js +3 -0
  131. package/nuxt/components/Breadcrumb.js +3 -0
  132. package/nuxt/components/Button.js +3 -0
  133. package/nuxt/components/Card.js +3 -0
  134. package/nuxt/components/Carousel.js +3 -0
  135. package/nuxt/components/Cascader.js +3 -0
  136. package/nuxt/components/Checkbox.js +3 -0
  137. package/nuxt/components/Col.js +3 -0
  138. package/nuxt/components/ColorPicker.js +3 -0
  139. package/nuxt/components/Column.js +3 -0
  140. package/nuxt/components/Comment.js +3 -0
  141. package/nuxt/components/Content.js +3 -0
  142. package/nuxt/components/Countdown.js +3 -0
  143. package/nuxt/components/DatePicker.js +3 -0
  144. package/nuxt/components/Drawer.js +3 -0
  145. package/nuxt/components/DrawerService.js +3 -0
  146. package/nuxt/components/Dropdown.js +3 -0
  147. package/nuxt/components/EditableSelect.js +3 -0
  148. package/nuxt/components/FixedOverlay.js +3 -0
  149. package/nuxt/components/FlexibleOverlay.js +3 -0
  150. package/nuxt/components/Footer.js +3 -0
  151. package/nuxt/components/Form.js +3 -0
  152. package/nuxt/components/FormControl.js +3 -0
  153. package/nuxt/components/FormItem.js +3 -0
  154. package/nuxt/components/FormLabel.js +3 -0
  155. package/nuxt/components/FormOperation.js +3 -0
  156. package/nuxt/components/Fullscreen.js +3 -0
  157. package/nuxt/components/Gantt.js +3 -0
  158. package/nuxt/components/Header.js +3 -0
  159. package/nuxt/components/Icon.js +2 -0
  160. package/nuxt/components/ImagePreviewService.js +3 -0
  161. package/nuxt/components/Input.js +3 -0
  162. package/nuxt/components/InputIcon.js +3 -0
  163. package/nuxt/components/InputNumber.js +3 -0
  164. package/nuxt/components/Layout.js +3 -0
  165. package/nuxt/components/Loading.js +3 -0
  166. package/nuxt/components/LoadingService.js +3 -0
  167. package/nuxt/components/Modal.js +3 -0
  168. package/nuxt/components/NavSprite.js +2 -0
  169. package/nuxt/components/Pagination.js +3 -0
  170. package/nuxt/components/Panel.js +3 -0
  171. package/nuxt/components/Popover.js +3 -0
  172. package/nuxt/components/Progress.js +3 -0
  173. package/nuxt/components/QuadrantDiagram.js +3 -0
  174. package/nuxt/components/Radio.js +3 -0
  175. package/nuxt/components/RadioGroup.js +3 -0
  176. package/nuxt/components/Rate.js +3 -0
  177. package/nuxt/components/ReadTip.js +3 -0
  178. package/nuxt/components/Result.js +3 -0
  179. package/nuxt/components/Row.js +3 -0
  180. package/nuxt/components/Search.js +3 -0
  181. package/nuxt/components/Select.js +3 -0
  182. package/nuxt/components/Skeleton.js +3 -0
  183. package/nuxt/components/SkeletonItem.js +3 -0
  184. package/nuxt/components/Slider.js +3 -0
  185. package/nuxt/components/Splitter.js +3 -0
  186. package/nuxt/components/Statistic.js +3 -0
  187. package/nuxt/components/Status.js +3 -0
  188. package/nuxt/components/StepsGuide.js +3 -0
  189. package/nuxt/components/StickSlider.js +3 -0
  190. package/nuxt/components/Sticky.js +2 -0
  191. package/nuxt/components/Switch.js +3 -0
  192. package/nuxt/components/Table.js +3 -0
  193. package/nuxt/components/Tabs.js +3 -0
  194. package/nuxt/components/Tag.js +3 -0
  195. package/nuxt/components/TagInput.js +3 -0
  196. package/nuxt/components/Textarea.js +3 -0
  197. package/nuxt/components/TimeAxis.js +3 -0
  198. package/nuxt/components/TimeAxisItem.js +3 -0
  199. package/nuxt/components/TimePicker.js +3 -0
  200. package/nuxt/components/Toast.js +3 -0
  201. package/nuxt/components/ToastService.js +3 -0
  202. package/nuxt/components/Tooltip.js +3 -0
  203. package/nuxt/components/Transfer.js +3 -0
  204. package/nuxt/components/Tree.js +3 -0
  205. package/nuxt/components/TreeSelect.js +3 -0
  206. package/nuxt/components/Upload.js +3 -0
  207. package/nuxt/components/buttonProps.js +3 -0
  208. package/nuxt/index.js +13 -0
  209. package/overlay/index.d.ts +7 -0
  210. package/overlay/index.es.js +111 -94
  211. package/overlay/index.umd.js +1 -1
  212. package/overlay/style.css +1 -1
  213. package/package.json +5 -47
  214. package/pagination/index.d.ts +7 -0
  215. package/pagination/index.es.js +3 -3
  216. package/pagination/index.umd.js +1 -1
  217. package/panel/index.d.ts +7 -0
  218. package/panel/index.es.js +25 -22
  219. package/panel/index.umd.js +1 -1
  220. package/panel/style.css +1 -1
  221. package/popover/index.d.ts +7 -0
  222. package/popover/index.es.js +18 -6
  223. package/popover/index.umd.js +1 -1
  224. package/progress/index.d.ts +7 -0
  225. package/progress/index.es.js +9 -9
  226. package/progress/index.umd.js +3 -3
  227. package/quadrant-diagram/index.d.ts +7 -0
  228. package/radio/index.d.ts +7 -0
  229. package/radio/index.es.js +6 -6
  230. package/radio/index.umd.js +1 -1
  231. package/rate/index.d.ts +7 -0
  232. package/rate/index.es.js +1 -1
  233. package/rate/index.umd.js +1 -1
  234. package/read-tip/index.d.ts +7 -0
  235. package/read-tip/index.es.js +258 -0
  236. package/read-tip/index.umd.js +1 -0
  237. package/read-tip/package.json +7 -0
  238. package/read-tip/style.css +1 -0
  239. package/result/index.d.ts +7 -0
  240. package/result/index.es.js +119 -0
  241. package/result/index.umd.js +1 -0
  242. package/result/package.json +7 -0
  243. package/result/style.css +1 -0
  244. package/ripple/index.d.ts +7 -0
  245. package/ripple/index.es.js +5 -2
  246. package/ripple/index.umd.js +1 -1
  247. package/search/index.d.ts +7 -0
  248. package/search/index.es.js +35 -21
  249. package/search/index.umd.js +1 -1
  250. package/select/index.d.ts +7 -0
  251. package/select/index.es.js +47 -11
  252. package/select/index.umd.js +1 -1
  253. package/skeleton/index.d.ts +7 -0
  254. package/skeleton/index.es.js +148 -26
  255. package/skeleton/index.umd.js +1 -1
  256. package/skeleton/style.css +1 -1
  257. package/slider/index.d.ts +7 -0
  258. package/slider/index.es.js +32 -182
  259. package/slider/index.umd.js +1 -1
  260. package/slider/style.css +1 -1
  261. package/splitter/index.d.ts +7 -0
  262. package/splitter/index.es.js +295 -100
  263. package/splitter/index.umd.js +1 -1
  264. package/splitter/style.css +1 -1
  265. package/statistic/index.d.ts +7 -0
  266. package/statistic/index.es.js +280 -0
  267. package/statistic/index.umd.js +1 -0
  268. package/statistic/package.json +7 -0
  269. package/statistic/style.css +1 -0
  270. package/status/index.d.ts +7 -0
  271. package/status/index.es.js +2 -2
  272. package/status/index.umd.js +1 -1
  273. package/steps-guide/index.d.ts +7 -0
  274. package/steps-guide/index.es.js +101 -73
  275. package/steps-guide/index.umd.js +1 -1
  276. package/steps-guide/style.css +1 -1
  277. package/sticky/index.d.ts +7 -0
  278. package/style.css +1 -1
  279. package/switch/index.d.ts +7 -0
  280. package/switch/index.es.js +1 -1
  281. package/switch/index.umd.js +1 -1
  282. package/table/index.d.ts +7 -0
  283. package/table/index.es.js +1708 -156
  284. package/table/index.umd.js +1 -1
  285. package/table/style.css +1 -1
  286. package/tabs/index.d.ts +7 -0
  287. package/tabs/index.es.js +6 -3
  288. package/tabs/index.umd.js +1 -1
  289. package/tag/index.d.ts +7 -0
  290. package/tag/index.es.js +131 -0
  291. package/tag/index.umd.js +1 -0
  292. package/tag/package.json +7 -0
  293. package/tag/style.css +1 -0
  294. package/tag-input/index.d.ts +7 -0
  295. package/tag-input/index.es.js +1 -13
  296. package/tag-input/index.umd.js +1 -1
  297. package/textarea/index.d.ts +7 -0
  298. package/textarea/index.es.js +132 -0
  299. package/textarea/index.umd.js +1 -0
  300. package/textarea/package.json +7 -0
  301. package/textarea/style.css +1 -0
  302. package/time-axis/index.d.ts +7 -0
  303. package/time-axis/index.es.js +241 -21
  304. package/time-axis/index.umd.js +1 -1
  305. package/time-axis/style.css +1 -1
  306. package/time-picker/index.d.ts +7 -0
  307. package/time-picker/index.es.js +266 -32
  308. package/time-picker/index.umd.js +1 -1
  309. package/time-picker/style.css +1 -1
  310. package/toast/index.d.ts +7 -0
  311. package/toast/index.es.js +16 -12
  312. package/toast/index.umd.js +1 -1
  313. package/toast/style.css +1 -1
  314. package/tooltip/index.d.ts +7 -0
  315. package/transfer/index.d.ts +7 -0
  316. package/transfer/index.es.js +575 -83
  317. package/transfer/index.umd.js +1 -1
  318. package/transfer/style.css +1 -1
  319. package/tree/index.d.ts +7 -0
  320. package/tree/index.es.js +171 -35
  321. package/tree/index.umd.js +1 -1
  322. package/tree-select/index.d.ts +7 -0
  323. package/tree-select/index.es.js +528 -0
  324. package/tree-select/index.umd.js +1 -0
  325. package/tree-select/package.json +7 -0
  326. package/tree-select/style.css +1 -0
  327. package/upload/index.d.ts +7 -0
  328. package/upload/index.es.js +172 -513
  329. package/upload/index.umd.js +1 -1
  330. package/upload/style.css +1 -1
  331. package/vue-devui.es.js +22079 -8773
  332. package/vue-devui.umd.js +29 -3
@@ -1,8 +1,290 @@
1
- import { defineComponent, createVNode, mergeProps, resolveComponent, createTextVNode, reactive } from "vue";
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, createTextVNode, provide, onMounted, watch } from "vue";
21
+ const accordionProps = {
22
+ data: {
23
+ type: Array,
24
+ default: null
25
+ },
26
+ titleKey: { type: String, default: "title" },
27
+ loadingKey: { type: String, default: "loading" },
28
+ childrenKey: { type: String, default: "children" },
29
+ disabledKey: { type: String, default: "disabled" },
30
+ activeKey: { type: String, default: "active" },
31
+ openKey: { type: String, default: "open" },
32
+ menuItemTemplate: { type: Boolean, default: true },
33
+ itemTemplate: { type: Boolean, default: true },
34
+ menuToggle: {
35
+ type: Function,
36
+ default: null
37
+ },
38
+ itemClick: {
39
+ type: Function,
40
+ default: null
41
+ },
42
+ activeItemChange: {
43
+ type: Function,
44
+ default: null
45
+ },
46
+ restrictOneOpen: { type: Boolean, default: false },
47
+ autoOpenActiveMenu: { type: Boolean, default: false },
48
+ showNoContent: { type: Boolean, default: true },
49
+ noContentTemplate: { type: Boolean, default: true },
50
+ loadingTemplate: { type: Boolean, default: true },
51
+ innerListTemplate: { type: Boolean, default: true },
52
+ linkType: {
53
+ type: String,
54
+ default: ""
55
+ },
56
+ linkTypeKey: { type: String, default: "linkType" },
57
+ linkKey: { type: String, default: "link" },
58
+ linkTargetKey: { type: String, default: "target" },
59
+ linkDefaultTarget: { type: String, default: "_self" },
60
+ accordionType: {
61
+ type: String,
62
+ default: "normal"
63
+ }
64
+ };
65
+ const OpenIcon = () => {
66
+ return createVNode("svg", {
67
+ "width": "1em",
68
+ "height": "1em",
69
+ "viewBox": "0 0 16 16",
70
+ "version": "1.1",
71
+ "xmlns": "http://www.w3.org/2000/svg",
72
+ "xmlns:xlink": "http://www.w3.org/1999/xlink"
73
+ }, [createVNode("g", {
74
+ "stroke": "none",
75
+ "stroke-width": "1",
76
+ "fill": "none",
77
+ "fill-rule": "evenodd"
78
+ }, [createVNode("path", {
79
+ "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",
80
+ "fill-rule": "nonzero"
81
+ }, null)])]);
82
+ };
83
+ const getRootSlots = () => {
84
+ const rootComponentName = "DAccordion";
85
+ const getRootComponent = (component) => {
86
+ if (component && component.type.name === rootComponentName) {
87
+ return component;
88
+ }
89
+ if (component && component.parent) {
90
+ const parent = component.parent;
91
+ return getRootComponent(parent);
92
+ }
93
+ };
94
+ const rootComponent = getRootComponent(getCurrentInstance());
95
+ return rootComponent == null ? void 0 : rootComponent.slots;
96
+ };
97
+ var DAccordionMenu = defineComponent({
98
+ name: "DAccordionMenu",
99
+ components: {
100
+ OpenIcon
101
+ },
102
+ props: __spreadValues({
103
+ item: Object,
104
+ deepth: {
105
+ type: Number,
106
+ default: 0
107
+ },
108
+ parent: {
109
+ type: Object,
110
+ default: null
111
+ }
112
+ }, accordionProps),
113
+ setup(props) {
114
+ const {
115
+ item,
116
+ deepth,
117
+ parent,
118
+ openKey,
119
+ activeKey,
120
+ autoOpenActiveMenu,
121
+ disabledKey,
122
+ childrenKey,
123
+ titleKey,
124
+ menuItemTemplate
125
+ } = toRefs(props);
126
+ const rootSlots = getRootSlots();
127
+ const accordionCtx = inject("accordionContext");
128
+ let parentValue = parent.value;
129
+ let deepValue = deepth.value;
130
+ const toggle = (itemEvent) => {
131
+ accordionCtx.menuToggleFn(itemEvent);
132
+ };
133
+ const hasActiveChildren = (item2) => {
134
+ if (item2[activeKey.value] === true)
135
+ return true;
136
+ if (item2[childrenKey.value]) {
137
+ return hasChildActive(item2[childrenKey.value]);
138
+ }
139
+ };
140
+ const hasChildActive = (arr) => {
141
+ let flag = false;
142
+ if (!arr.length)
143
+ return false;
144
+ for (let i = 0; i < arr.length; i++) {
145
+ if (arr[i][activeKey.value] === true) {
146
+ flag = true;
147
+ break;
148
+ }
149
+ if (arr[i][childrenKey.value]) {
150
+ flag = hasChildActive(arr[i][childrenKey.value]);
151
+ if (flag)
152
+ break;
153
+ }
154
+ }
155
+ return flag;
156
+ };
157
+ const keyOpen = computed(() => {
158
+ return item.value && item.value[openKey.value];
159
+ });
160
+ const disabled = computed(() => {
161
+ return item.value && item.value[disabledKey.value];
162
+ });
163
+ const title = computed(() => {
164
+ return item.value && item.value[titleKey.value];
165
+ });
166
+ const children = computed(() => {
167
+ return item.value && item.value[childrenKey.value];
168
+ });
169
+ const childActived = computed(() => {
170
+ return hasActiveChildren(item.value);
171
+ });
172
+ const open = computed(() => {
173
+ return keyOpen.value === void 0 && autoOpenActiveMenu.value ? childActived.value : keyOpen.value;
174
+ });
175
+ return () => {
176
+ var _a;
177
+ return createVNode(Fragment, null, [createVNode("div", {
178
+ "class": ["devui-accordion-item-title", "devui-over-flow-ellipsis", open.value && "open", childActived.value && "active", disabled.value && "disabled"],
179
+ "title": title.value,
180
+ "style": {
181
+ textIndent: deepValue * 20 + "px"
182
+ },
183
+ "onClick": (e) => !disabled.value && toggle({
184
+ item: item.value,
185
+ open: !open.value,
186
+ parent: parentValue,
187
+ event: e
188
+ })
189
+ }, [createVNode("div", {
190
+ "class": ["devui-accordion-splitter", deepValue === 0 && "devui-parent-list"],
191
+ "style": {
192
+ left: deepValue * 20 + 10 + "px"
193
+ }
194
+ }, 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, {
195
+ parent: parentValue,
196
+ deepth: deepValue,
197
+ item: item.value
198
+ })), createVNode("span", {
199
+ "class": "devui-accordion-open-icon"
200
+ }, [createVNode(OpenIcon, null, null)])]), createVNode("div", {
201
+ "class": [!open.value && "devui-accordion-menu-hidden", "devui-accordion-submenu", "devui-accordion-show-animate"]
202
+ }, [createVNode(AccordionList, mergeProps(props, {
203
+ "deepth": deepValue + 1,
204
+ "data": children.value || [],
205
+ "parent": item.value
206
+ }), null)])]);
207
+ };
208
+ }
209
+ });
210
+ var DAccordionItem = defineComponent({
211
+ name: "DAccordionItem",
212
+ props: __spreadValues({
213
+ item: Object,
214
+ deepth: {
215
+ type: Number,
216
+ default: 0
217
+ },
218
+ parent: {
219
+ type: Object,
220
+ default: null
221
+ }
222
+ }, accordionProps),
223
+ setup(props) {
224
+ const {
225
+ item,
226
+ deepth,
227
+ parent,
228
+ titleKey,
229
+ activeKey,
230
+ disabledKey,
231
+ itemTemplate
232
+ } = toRefs(props);
233
+ const rootSlots = getRootSlots();
234
+ const accordionCtx = inject("accordionContext");
235
+ let parentValue = parent.value;
236
+ let deepValue = deepth.value;
237
+ const disabled = computed(() => {
238
+ return item.value && item.value[disabledKey.value];
239
+ });
240
+ const title = computed(() => {
241
+ return item.value && item.value[titleKey.value];
242
+ });
243
+ const active = computed(() => {
244
+ return item.value && item.value[activeKey.value];
245
+ });
246
+ const childActived = computed(() => {
247
+ return active.value;
248
+ });
249
+ const itemClick = (itemEvent) => {
250
+ if (item.value && !disabled.value) {
251
+ accordionCtx.itemClickFn(itemEvent);
252
+ }
253
+ };
254
+ return () => {
255
+ var _a;
256
+ return createVNode(Fragment, null, [createVNode("div", {
257
+ "class": ["devui-accordion-item-title", "devui-over-flow-ellipsis", childActived.value && "active", disabled.value && "disabled"],
258
+ "title": title.value,
259
+ "style": {
260
+ textIndent: deepValue * 20 + "px"
261
+ },
262
+ "onClick": (e) => itemClick({
263
+ item: item.value,
264
+ parent: parentValue,
265
+ event: e
266
+ })
267
+ }, [createVNode("div", {
268
+ "class": ["devui-accordion-splitter", deepValue === 0 && "devui-parent-list"],
269
+ "style": {
270
+ left: deepValue * 20 + 10 + "px"
271
+ }
272
+ }, 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, {
273
+ parent: parentValue,
274
+ deepth: deepValue,
275
+ item: item.value
276
+ }))])]);
277
+ };
278
+ }
279
+ });
2
280
  var AccordionList = defineComponent({
3
281
  name: "DAccordionList",
4
282
  inheritAttrs: false,
5
- props: {
283
+ components: {
284
+ DAccordionMenu,
285
+ DAccordionItem
286
+ },
287
+ props: __spreadValues({
6
288
  data: {
7
289
  type: Array,
8
290
  default: null
@@ -16,163 +298,199 @@ var AccordionList = defineComponent({
16
298
  default: null
17
299
  },
18
300
  innerListTemplate: Boolean
19
- },
20
- setup(props, ctx) {
301
+ }, accordionProps),
302
+ setup(props, {
303
+ attrs
304
+ }) {
305
+ const {
306
+ childrenKey,
307
+ deepth,
308
+ parent,
309
+ data,
310
+ linkType,
311
+ showNoContent,
312
+ loadingKey,
313
+ titleKey,
314
+ loadingTemplate,
315
+ noContentTemplate,
316
+ innerListTemplate
317
+ } = toRefs(props);
318
+ let parentValue = parent.value;
319
+ let deepValue = deepth.value;
320
+ const rootSlots = getRootSlots();
321
+ const accordionCtx = inject("accordionContext");
322
+ const loading = computed(() => {
323
+ return parentValue && parentValue[loadingKey.value];
324
+ });
325
+ const noContent = computed(() => {
326
+ let dataValue = data.value;
327
+ return dataValue === void 0 || dataValue === null || dataValue.length === 0;
328
+ });
21
329
  return () => {
22
- return (!props.innerListTemplate || props.deepth === 0) && createVNode("ul", mergeProps({
23
- "class": "devui-accordion-list"
24
- }, ctx.attrs), [props.data.map((item) => {
330
+ var _a, _b, _c;
331
+ return createVNode(Fragment, null, [(!rootSlots.innerListTemplate || deepth.value === 0 || innerListTemplate.value === false) && createVNode("ul", mergeProps({
332
+ "class": ["devui-accordion-list"]
333
+ }, attrs), [data.value.map((item) => {
25
334
  return createVNode("li", {
26
335
  "class": "devui-accordion-item",
27
- "key": item.title
336
+ "key": item[titleKey.value]
337
+ }, [item[childrenKey.value] !== void 0 && createVNode("div", {
338
+ "class": "devui-accordion-menu-item"
339
+ }, [createVNode(resolveComponent("d-accordion-menu"), mergeProps(props, {
340
+ "item": item,
341
+ "deepth": deepValue,
342
+ "parent": parentValue
343
+ }), null)]), item[childrenKey.value] === void 0 && createVNode(Fragment, null, [(!linkType.value || linkType.value === "") && createVNode(resolveComponent("d-accordion-item"), mergeProps(props, {
344
+ "item": item,
345
+ "deepth": deepValue,
346
+ "parent": parentValue
347
+ }), null)])]);
348
+ })]), rootSlots.innerListTemplate && innerListTemplate.value !== false && deepValue !== 0 && ((_a = rootSlots.innerListTemplate) == null ? void 0 : _a.call(rootSlots, {
349
+ item: parentValue,
350
+ deepth: deepValue,
351
+ itemClickFn: accordionCtx.itemClickFn,
352
+ menuToggleFn: accordionCtx.menuToggleFn
353
+ })), (!rootSlots.innerListTemplate || innerListTemplate.value === false) && (loading.value || noContent.value && showNoContent.value) && createVNode("ul", mergeProps({
354
+ "class": ["devui-accordion-list"]
355
+ }, attrs), [
356
+ loading.value && (!rootSlots.loadingTemplate || loadingTemplate.value === false) && createVNode("li", {
357
+ "class": "devui-accordion-item"
28
358
  }, [createVNode("div", {
29
- "class": "devui-accordion-menu-item open",
30
- "title": item.title
359
+ "class": ["devui-accordion-item-title", "devui-over-flow-ellipsis"],
360
+ "style": {
361
+ textIndent: deepValue * 20 + "px"
362
+ }
363
+ }, [createTextVNode("\u52A0\u8F7D\u4E2D...")])]),
364
+ loading.value && rootSlots.loadingTemplate && loadingTemplate.value !== false && ((_b = rootSlots.loadingTemplate) == null ? void 0 : _b.call(rootSlots, {
365
+ item: parentValue,
366
+ deepth: deepValue
367
+ })),
368
+ showNoContent.value && !loading.value && noContent.value && (!rootSlots.noContentTemplate || noContentTemplate.value === false) && createVNode("li", {
369
+ "class": "devui-accordion-item"
31
370
  }, [createVNode("div", {
32
- "title": item.title,
33
- "class": `devui-accordion-item-title devui-over-flow-ellipsis open`
34
- }, [item.title]), createVNode("div", {
35
- "class": "devui-accordion-submenu devui-accordion-show-animate",
36
- "style": "opacity: 1; overflow: hidden;"
37
- }, [createVNode("ul", {
38
- "class": "devui-accordion-list"
39
- }, [item.children.map((component) => {
40
- return createVNode("li", {
41
- "class": "devui-accordion-item",
42
- "key": component.title
43
- }, [createVNode("div", {
44
- "class": "devui-accordion-item-title devui-over-flow-ellipsis",
45
- "style": "text-indent: 20px;",
46
- "title": component.title
47
- }, [createVNode(resolveComponent("router-link"), {
48
- "to": component.link
49
- }, {
50
- default: () => [createVNode("div", {
51
- "class": "devui-accordion-splitter",
52
- "style": "left: 30px;"
53
- }, null), component.title, component.done && createVNode("span", {
54
- "class": "tag-done"
55
- }, [createTextVNode("\u5DF2\u5B8C\u6210")])]
56
- })])]);
57
- })])])])]);
58
- })]);
371
+ "class": ["devui-accordion-item-title", "devui-over-flow-ellipsis disabled"],
372
+ "style": {
373
+ textIndent: deepValue * 20 + "px"
374
+ }
375
+ }, [createTextVNode("\u6CA1\u6709\u6570\u636E")])]),
376
+ showNoContent.value && !loading.value && noContent.value && rootSlots.noContentTemplate && noContentTemplate.value !== false && ((_c = rootSlots.noContentTemplate) == null ? void 0 : _c.call(rootSlots, {
377
+ item: parentValue,
378
+ deepth: deepValue
379
+ }))
380
+ ])]);
59
381
  };
60
382
  }
61
383
  });
62
384
  var accordion = "";
63
385
  var Accordion = defineComponent({
64
386
  name: "DAccordion",
65
- props: {
66
- data: {
67
- type: Array,
68
- default: null
69
- },
70
- titleKey: {
71
- type: String,
72
- default: "title"
73
- },
74
- loadingKey: {
75
- type: String,
76
- default: "loading"
77
- },
78
- childrenKey: {
79
- type: String,
80
- default: "children"
81
- },
82
- disabledKey: {
83
- type: String,
84
- default: "disabled"
85
- },
86
- activeKey: {
87
- type: String,
88
- default: "active"
89
- },
90
- openKey: {
91
- type: String,
92
- default: "open"
93
- },
94
- menuItemTemplate: {
95
- type: String,
96
- default: ""
97
- },
98
- itemTemplate: {
99
- type: String,
100
- default: ""
101
- },
102
- menuToggle: {
103
- type: Function,
104
- default: null
105
- },
106
- itemClick: {
107
- type: Function,
108
- default: null
109
- },
110
- activeItemChange: {
111
- type: Function,
112
- default: null
113
- },
114
- restrictOneOpen: {
115
- type: Boolean,
116
- default: false
117
- },
118
- autoOpenActiveMenu: {
119
- type: Boolean,
120
- default: false
121
- },
122
- showNoContent: {
123
- type: Boolean,
124
- default: true
125
- },
126
- noContentTemplate: {
127
- type: String,
128
- default: ""
129
- },
130
- loadingTemplate: {
131
- type: String,
132
- default: ""
133
- },
134
- innerListTemplate: {
135
- type: String,
136
- default: ""
137
- },
138
- linkType: {
139
- type: String,
140
- default: ""
141
- },
142
- linkTypeKey: {
143
- type: String,
144
- default: "linkType"
145
- },
146
- linkKey: {
147
- type: String,
148
- default: "link"
149
- },
150
- linkTargetKey: {
151
- type: String,
152
- default: "target"
153
- },
154
- linkDefaultTarget: {
155
- type: String,
156
- default: "_self"
157
- },
158
- accordionType: {
159
- type: String,
160
- default: "normal"
161
- }
162
- },
163
- setup(props) {
387
+ props: accordionProps,
388
+ setup(props, {
389
+ emit
390
+ }) {
164
391
  const {
165
392
  data,
166
- accordionType
167
- } = reactive(props);
393
+ childrenKey,
394
+ activeKey,
395
+ openKey,
396
+ accordionType,
397
+ autoOpenActiveMenu,
398
+ restrictOneOpen
399
+ } = toRefs(props);
400
+ let clickActiveItem = void 0;
401
+ const flatten = (arr, childrenKey2 = "children", includeParent = false, includeLeaf = true) => {
402
+ return arr.reduce((acc, cur) => {
403
+ const children = cur[childrenKey2];
404
+ if (children === void 0) {
405
+ if (includeLeaf) {
406
+ acc.push(cur);
407
+ }
408
+ } else {
409
+ if (includeParent) {
410
+ acc.push(cur);
411
+ }
412
+ if (Array.isArray(children)) {
413
+ acc.push(...flatten(children, childrenKey2, includeParent));
414
+ }
415
+ }
416
+ return acc;
417
+ }, []);
418
+ };
419
+ const initActiveItem = () => {
420
+ const activeItem = flatten(data.value, childrenKey.value).filter((item) => item[activeKey.value]).pop();
421
+ if (activeItem) {
422
+ if (!clickActiveItem) {
423
+ activeItemFn(activeItem);
424
+ }
425
+ } else {
426
+ clickActiveItem = void 0;
427
+ }
428
+ };
429
+ const activeItemFn = (item) => {
430
+ if (clickActiveItem && clickActiveItem[activeKey.value]) {
431
+ clickActiveItem[activeKey.value] = false;
432
+ }
433
+ item[activeKey.value] = true;
434
+ clickActiveItem = item;
435
+ emit("activeItemChange", clickActiveItem);
436
+ };
437
+ const openMenuFn = (item, open) => {
438
+ if (open && restrictOneOpen.value) {
439
+ data.value.forEach((itemtemp) => {
440
+ itemtemp[openKey.value] = false;
441
+ });
442
+ }
443
+ item[openKey.value] = open;
444
+ };
445
+ const itemClickFn = (itemEvent) => {
446
+ const prevActiveItem = clickActiveItem;
447
+ activeItemFn(itemEvent.item);
448
+ emit("itemClick", __spreadProps(__spreadValues({}, itemEvent), {
449
+ prevActiveItem
450
+ }));
451
+ };
452
+ const linkItemClickFn = (itemEvent) => {
453
+ const prevActiveItem = clickActiveItem;
454
+ clickActiveItem = itemEvent.item;
455
+ emit("linkItemClick", __spreadProps(__spreadValues({}, itemEvent), {
456
+ prevActiveItem
457
+ }));
458
+ };
459
+ const menuToggleFn = (menuEvent) => {
460
+ openMenuFn(menuEvent.item, menuEvent.open);
461
+ emit("menuToggle", menuEvent);
462
+ };
463
+ const cleanOpenData = () => {
464
+ flatten(data.value, childrenKey.value, true, false).forEach((item) => item[openKey.value] = void 0);
465
+ };
466
+ provide("accordionContext", {
467
+ itemClickFn,
468
+ linkItemClickFn,
469
+ menuToggleFn
470
+ });
471
+ onMounted(() => {
472
+ if (data.value) {
473
+ initActiveItem();
474
+ }
475
+ });
476
+ watch(() => autoOpenActiveMenu.value, (current, preV) => {
477
+ if (current && preV === false) {
478
+ cleanOpenData();
479
+ }
480
+ });
481
+ watch(data.value, (current, preV) => {
482
+ initActiveItem();
483
+ }, {
484
+ deep: true
485
+ });
168
486
  return () => {
169
487
  return createVNode("div", {
170
- "class": `devui-accordion-menu devui-scrollbar ${accordionType === "normal" ? "devui-accordion-menu-normal" : ""}`
171
- }, [createVNode(AccordionList, mergeProps({
172
- "data": data,
488
+ "class": ["devui-accordion-menu", "devui-scrollbar", "devui-accordion-show-animate", accordionType.value === "normal" && "devui-accordion-menu-normal"]
489
+ }, [createVNode(AccordionList, mergeProps(props, {
490
+ "data": data.value,
173
491
  "deepth": 0,
174
492
  "parent": null
175
- }, props), null)]);
493
+ }), null)]);
176
494
  };
177
495
  }
178
496
  });
@@ -1 +1 @@
1
- (function(i,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.index={},i.Vue))})(this,function(i,e){"use strict";var o=e.defineComponent({name:"DAccordionList",inheritAttrs:!1,props:{data:{type:Array,default:null},deepth:{type:Number,default:0},parent:{type:Object,default:null},innerListTemplate:Boolean},setup(t,d){return()=>(!t.innerListTemplate||t.deepth===0)&&e.createVNode("ul",e.mergeProps({class:"devui-accordion-list"},d.attrs),[t.data.map(n=>e.createVNode("li",{class:"devui-accordion-item",key:n.title},[e.createVNode("div",{class:"devui-accordion-menu-item open",title:n.title},[e.createVNode("div",{title:n.title,class:"devui-accordion-item-title devui-over-flow-ellipsis open"},[n.title]),e.createVNode("div",{class:"devui-accordion-submenu devui-accordion-show-animate",style:"opacity: 1; overflow: hidden;"},[e.createVNode("ul",{class:"devui-accordion-list"},[n.children.map(a=>e.createVNode("li",{class:"devui-accordion-item",key:a.title},[e.createVNode("div",{class:"devui-accordion-item-title devui-over-flow-ellipsis",style:"text-indent: 20px;",title:a.title},[e.createVNode(e.resolveComponent("router-link"),{to:a.link},{default:()=>[e.createVNode("div",{class:"devui-accordion-splitter",style:"left: 30px;"},null),a.title,a.done&&e.createVNode("span",{class:"tag-done"},[e.createTextVNode("\u5DF2\u5B8C\u6210")])]})])]))])])])]))])}}),c="",l=e.defineComponent({name:"DAccordion",props:{data:{type:Array,default:null},titleKey:{type:String,default:"title"},loadingKey:{type:String,default:"loading"},childrenKey:{type:String,default:"children"},disabledKey:{type:String,default:"disabled"},activeKey:{type:String,default:"active"},openKey:{type:String,default:"open"},menuItemTemplate:{type:String,default:""},itemTemplate:{type:String,default:""},menuToggle:{type:Function,default:null},itemClick:{type:Function,default:null},activeItemChange:{type:Function,default:null},restrictOneOpen:{type:Boolean,default:!1},autoOpenActiveMenu:{type:Boolean,default:!1},showNoContent:{type:Boolean,default:!0},noContentTemplate:{type:String,default:""},loadingTemplate:{type:String,default:""},innerListTemplate:{type:String,default:""},linkType:{type:String,default:""},linkTypeKey:{type:String,default:"linkType"},linkKey:{type:String,default:"link"},linkTargetKey:{type:String,default:"target"},linkDefaultTarget:{type:String,default:"_self"},accordionType:{type:String,default:"normal"}},setup(t){const{data:d,accordionType:n}=e.reactive(t);return()=>e.createVNode("div",{class:`devui-accordion-menu devui-scrollbar ${n==="normal"?"devui-accordion-menu-normal":""}`},[e.createVNode(o,e.mergeProps({data:d,deepth:0,parent:null},t),null)])}});l.install=function(t){t.component(l.name,l)};var r={title:"Accordion \u624B\u98CE\u7434",category:"\u5BFC\u822A",status:"10%",install(t){t.use(l)}};i.Accordion=l,i.default=r,Object.defineProperty(i,"__esModule",{value:!0}),i[Symbol.toStringTag]="Module"});
1
+ var q=Object.defineProperty,z=Object.defineProperties;var E=Object.getOwnPropertyDescriptors;var M=Object.getOwnPropertySymbols;var Z=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable;var S=(i,e,m)=>e in i?q(i,e,{enumerable:!0,configurable:!0,writable:!0,value:m}):i[e]=m,K=(i,e)=>{for(var m in e||(e={}))Z.call(e,m)&&S(i,m,e[m]);if(M)for(var m of M(e))G.call(e,m)&&S(i,m,e[m]);return i},L=(i,e)=>z(i,E(e));(function(i,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.index={},i.Vue))})(this,function(i,e){"use strict";const m={data:{type:Array,default:null},titleKey:{type:String,default:"title"},loadingKey:{type:String,default:"loading"},childrenKey:{type:String,default:"children"},disabledKey:{type:String,default:"disabled"},activeKey:{type:String,default:"active"},openKey:{type:String,default:"open"},menuItemTemplate:{type:Boolean,default:!0},itemTemplate:{type:Boolean,default:!0},menuToggle:{type:Function,default:null},itemClick:{type:Function,default:null},activeItemChange:{type:Function,default:null},restrictOneOpen:{type:Boolean,default:!1},autoOpenActiveMenu:{type:Boolean,default:!1},showNoContent:{type:Boolean,default:!0},noContentTemplate:{type:Boolean,default:!0},loadingTemplate:{type:Boolean,default:!0},innerListTemplate:{type:Boolean,default:!0},linkType:{type:String,default:""},linkTypeKey:{type:String,default:"linkType"},linkKey:{type:String,default:"link"},linkTargetKey:{type:String,default:"target"},linkDefaultTarget:{type:String,default:"_self"},accordionType:{type:String,default:"normal"}},D=()=>e.createVNode("svg",{width:"1em",height:"1em",viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("path",{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","fill-rule":"nonzero"},null)])]),B=()=>{const d="DAccordion",t=c=>{if(c&&c.type.name===d)return c;if(c&&c.parent){const h=c.parent;return t(h)}},u=t(e.getCurrentInstance());return u==null?void 0:u.slots};var P=e.defineComponent({name:"DAccordionMenu",components:{OpenIcon:D},props:K({item:Object,deepth:{type:Number,default:0},parent:{type:Object,default:null}},m),setup(d){const{item:t,deepth:u,parent:c,openKey:h,activeKey:T,autoOpenActiveMenu:k,disabledKey:N,childrenKey:v,titleKey:s,menuItemTemplate:C}=e.toRefs(d),p=B(),V=e.inject("accordionContext");let f=c.value,o=u.value;const a=r=>{V.menuToggleFn(r)},x=r=>{if(r[T.value]===!0)return!0;if(r[v.value])return y(r[v.value])},y=r=>{let F=!1;if(!r.length)return!1;for(let O=0;O<r.length;O++){if(r[O][T.value]===!0){F=!0;break}if(r[O][v.value]&&(F=y(r[O][v.value]),F))break}return F},n=e.computed(()=>t.value&&t.value[h.value]),l=e.computed(()=>t.value&&t.value[N.value]),A=e.computed(()=>t.value&&t.value[s.value]),b=e.computed(()=>t.value&&t.value[v.value]),g=e.computed(()=>x(t.value)),I=e.computed(()=>n.value===void 0&&k.value?g.value:n.value);return()=>{var r;return e.createVNode(e.Fragment,null,[e.createVNode("div",{class:["devui-accordion-item-title","devui-over-flow-ellipsis",I.value&&"open",g.value&&"active",l.value&&"disabled"],title:A.value,style:{textIndent:o*20+"px"},onClick:F=>!l.value&&a({item:t.value,open:!I.value,parent:f,event:F})},[e.createVNode("div",{class:["devui-accordion-splitter",o===0&&"devui-parent-list"],style:{left:o*20+10+"px"}},null),(!p.menuItemTemplate||C.value===!1)&&e.createVNode(e.Fragment,null,[A.value]),p.menuItemTemplate&&C.value!==!1&&((r=p.menuItemTemplate)==null?void 0:r.call(p,{parent:f,deepth:o,item:t.value})),e.createVNode("span",{class:"devui-accordion-open-icon"},[e.createVNode(D,null,null)])]),e.createVNode("div",{class:[!I.value&&"devui-accordion-menu-hidden","devui-accordion-submenu","devui-accordion-show-animate"]},[e.createVNode(j,e.mergeProps(d,{deepth:o+1,data:b.value||[],parent:t.value}),null)])])}}}),R=e.defineComponent({name:"DAccordionItem",props:K({item:Object,deepth:{type:Number,default:0},parent:{type:Object,default:null}},m),setup(d){const{item:t,deepth:u,parent:c,titleKey:h,activeKey:T,disabledKey:k,itemTemplate:N}=e.toRefs(d),v=B(),s=e.inject("accordionContext");let C=c.value,p=u.value;const V=e.computed(()=>t.value&&t.value[k.value]),f=e.computed(()=>t.value&&t.value[h.value]),o=e.computed(()=>t.value&&t.value[T.value]),a=e.computed(()=>o.value),x=y=>{t.value&&!V.value&&s.itemClickFn(y)};return()=>{var y;return e.createVNode(e.Fragment,null,[e.createVNode("div",{class:["devui-accordion-item-title","devui-over-flow-ellipsis",a.value&&"active",V.value&&"disabled"],title:f.value,style:{textIndent:p*20+"px"},onClick:n=>x({item:t.value,parent:C,event:n})},[e.createVNode("div",{class:["devui-accordion-splitter",p===0&&"devui-parent-list"],style:{left:p*20+10+"px"}},null),(!v.itemTemplate||N.value===!1)&&e.createVNode(e.Fragment,null,[f.value]),v.itemTemplate&&N.value!==!1&&((y=v.itemTemplate)==null?void 0:y.call(v,{parent:C,deepth:p,item:t.value}))])])}}}),j=e.defineComponent({name:"DAccordionList",inheritAttrs:!1,components:{DAccordionMenu:P,DAccordionItem:R},props:K({data:{type:Array,default:null},deepth:{type:Number,default:0},parent:{type:Object,default:null},innerListTemplate:Boolean},m),setup(d,{attrs:t}){const{childrenKey:u,deepth:c,parent:h,data:T,linkType:k,showNoContent:N,loadingKey:v,titleKey:s,loadingTemplate:C,noContentTemplate:p,innerListTemplate:V}=e.toRefs(d);let f=h.value,o=c.value;const a=B(),x=e.inject("accordionContext"),y=e.computed(()=>f&&f[v.value]),n=e.computed(()=>{let l=T.value;return l==null||l.length===0});return()=>{var l,A,b;return e.createVNode(e.Fragment,null,[(!a.innerListTemplate||c.value===0||V.value===!1)&&e.createVNode("ul",e.mergeProps({class:["devui-accordion-list"]},t),[T.value.map(g=>e.createVNode("li",{class:"devui-accordion-item",key:g[s.value]},[g[u.value]!==void 0&&e.createVNode("div",{class:"devui-accordion-menu-item"},[e.createVNode(e.resolveComponent("d-accordion-menu"),e.mergeProps(d,{item:g,deepth:o,parent:f}),null)]),g[u.value]===void 0&&e.createVNode(e.Fragment,null,[(!k.value||k.value==="")&&e.createVNode(e.resolveComponent("d-accordion-item"),e.mergeProps(d,{item:g,deepth:o,parent:f}),null)])]))]),a.innerListTemplate&&V.value!==!1&&o!==0&&((l=a.innerListTemplate)==null?void 0:l.call(a,{item:f,deepth:o,itemClickFn:x.itemClickFn,menuToggleFn:x.menuToggleFn})),(!a.innerListTemplate||V.value===!1)&&(y.value||n.value&&N.value)&&e.createVNode("ul",e.mergeProps({class:["devui-accordion-list"]},t),[y.value&&(!a.loadingTemplate||C.value===!1)&&e.createVNode("li",{class:"devui-accordion-item"},[e.createVNode("div",{class:["devui-accordion-item-title","devui-over-flow-ellipsis"],style:{textIndent:o*20+"px"}},[e.createTextVNode("\u52A0\u8F7D\u4E2D...")])]),y.value&&a.loadingTemplate&&C.value!==!1&&((A=a.loadingTemplate)==null?void 0:A.call(a,{item:f,deepth:o})),N.value&&!y.value&&n.value&&(!a.noContentTemplate||p.value===!1)&&e.createVNode("li",{class:"devui-accordion-item"},[e.createVNode("div",{class:["devui-accordion-item-title","devui-over-flow-ellipsis disabled"],style:{textIndent:o*20+"px"}},[e.createTextVNode("\u6CA1\u6709\u6570\u636E")])]),N.value&&!y.value&&n.value&&a.noContentTemplate&&p.value!==!1&&((b=a.noContentTemplate)==null?void 0:b.call(a,{item:f,deepth:o}))])])}}}),H="",w=e.defineComponent({name:"DAccordion",props:m,setup(d,{emit:t}){const{data:u,childrenKey:c,activeKey:h,openKey:T,accordionType:k,autoOpenActiveMenu:N,restrictOneOpen:v}=e.toRefs(d);let s;const C=(n,l="children",A=!1,b=!0)=>n.reduce((g,I)=>{const r=I[l];return r===void 0?b&&g.push(I):(A&&g.push(I),Array.isArray(r)&&g.push(...C(r,l,A))),g},[]),p=()=>{const n=C(u.value,c.value).filter(l=>l[h.value]).pop();n?s||V(n):s=void 0},V=n=>{s&&s[h.value]&&(s[h.value]=!1),n[h.value]=!0,s=n,t("activeItemChange",s)},f=(n,l)=>{l&&v.value&&u.value.forEach(A=>{A[T.value]=!1}),n[T.value]=l},o=n=>{const l=s;V(n.item),t("itemClick",L(K({},n),{prevActiveItem:l}))},a=n=>{const l=s;s=n.item,t("linkItemClick",L(K({},n),{prevActiveItem:l}))},x=n=>{f(n.item,n.open),t("menuToggle",n)},y=()=>{C(u.value,c.value,!0,!1).forEach(n=>n[T.value]=void 0)};return e.provide("accordionContext",{itemClickFn:o,linkItemClickFn:a,menuToggleFn:x}),e.onMounted(()=>{u.value&&p()}),e.watch(()=>N.value,(n,l)=>{n&&l===!1&&y()}),e.watch(u.value,(n,l)=>{p()},{deep:!0}),()=>e.createVNode("div",{class:["devui-accordion-menu","devui-scrollbar","devui-accordion-show-animate",k.value==="normal"&&"devui-accordion-menu-normal"]},[e.createVNode(j,e.mergeProps(d,{data:u.value,deepth:0,parent:null}),null)])}});w.install=function(d){d.component(w.name,w)};var _={title:"Accordion \u624B\u98CE\u7434",category:"\u5BFC\u822A",status:"10%",install(d){d.use(w)}};i.Accordion=w,i.default=_,Object.defineProperty(i,"__esModule",{value:!0}),i[Symbol.toStringTag]="Module"});