vue-devui 1.0.0-rc.0 → 1.0.0-rc.3

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 (320) hide show
  1. package/README.md +55 -113
  2. package/alert/index.es.js +28 -30
  3. package/alert/index.umd.js +1 -1
  4. package/auto-complete/index.es.js +143 -103
  5. package/auto-complete/index.umd.js +5 -1
  6. package/auto-complete/style.css +1 -1
  7. package/avatar/index.es.js +77 -81
  8. package/avatar/index.umd.js +1 -1
  9. package/badge/index.es.js +1 -1
  10. package/badge/index.umd.js +1 -1
  11. package/badge/style.css +1 -1
  12. package/button/index.es.js +43 -43
  13. package/button/index.umd.js +1 -1
  14. package/card/index.es.js +3 -6
  15. package/card/index.umd.js +1 -1
  16. package/checkbox/index.es.js +5 -11
  17. package/checkbox/index.umd.js +1 -1
  18. package/comment/index.es.js +2 -5
  19. package/comment/index.umd.js +1 -1
  20. package/countdown/index.es.js +5 -7
  21. package/countdown/index.umd.js +1 -1
  22. package/editable-select/index.es.js +124 -168
  23. package/editable-select/index.umd.js +1 -1
  24. package/fullscreen/index.es.js +13 -16
  25. package/fullscreen/index.umd.js +1 -1
  26. package/grid/index.es.js +30 -36
  27. package/grid/index.umd.js +1 -1
  28. package/icon/index.es.js +39 -57
  29. package/icon/index.umd.js +1 -1
  30. package/image-preview/index.es.js +21 -20
  31. package/image-preview/index.umd.js +1 -1
  32. package/input/index.es.js +2 -5
  33. package/input/index.umd.js +1 -1
  34. package/layout/index.es.js +6 -21
  35. package/layout/index.umd.js +1 -1
  36. package/loading/index.es.js +20 -12
  37. package/loading/index.umd.js +1 -1
  38. package/modal/index.es.js +135 -122
  39. package/modal/index.umd.js +1 -1
  40. package/modal/style.css +1 -1
  41. package/notification/index.es.js +38 -40
  42. package/notification/index.umd.js +1 -1
  43. package/nuxt/components/DropdownPropsKey.js +3 -0
  44. package/nuxt/components/PanelBody.js +3 -0
  45. package/nuxt/components/PanelFooter.js +3 -0
  46. package/nuxt/components/PanelHeader.js +3 -0
  47. package/nuxt/components/Timeline.js +3 -0
  48. package/nuxt/components/TimelineItem.js +3 -0
  49. package/nuxt/components/alertProps.js +3 -0
  50. package/nuxt/components/autoCompleteProps.js +3 -0
  51. package/nuxt/components/avatarProps.js +3 -0
  52. package/nuxt/components/cardProps.js +3 -0
  53. package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
  54. package/nuxt/components/checkboxGroupProps.js +3 -0
  55. package/nuxt/components/checkboxProps.js +3 -0
  56. package/nuxt/components/colProps.js +3 -0
  57. package/nuxt/components/colPropsBaseClass.js +3 -0
  58. package/nuxt/components/colPropsBaseStyle.js +3 -0
  59. package/nuxt/components/commentProps.js +3 -0
  60. package/nuxt/components/countdownProps.js +3 -0
  61. package/nuxt/components/editableSelectProps.js +3 -0
  62. package/nuxt/components/fullscreenProps.js +3 -0
  63. package/nuxt/components/iconProps.js +2 -0
  64. package/nuxt/components/imagePreviewProps.js +3 -0
  65. package/nuxt/components/inputProps.js +3 -0
  66. package/nuxt/components/paginationProps.js +3 -0
  67. package/nuxt/components/panelProps.js +3 -0
  68. package/nuxt/components/progressProps.js +3 -0
  69. package/nuxt/components/rateProps.js +3 -0
  70. package/nuxt/components/readTipProps.js +3 -0
  71. package/nuxt/components/resultProps.js +3 -0
  72. package/nuxt/components/rowProps.js +3 -0
  73. package/nuxt/components/screenSizes.js +3 -0
  74. package/nuxt/components/searchProps.js +3 -0
  75. package/nuxt/components/skeletonProps.js +3 -0
  76. package/nuxt/components/splitterProps.js +3 -0
  77. package/nuxt/components/statisticProps.js +3 -0
  78. package/nuxt/components/switchProps.js +3 -0
  79. package/nuxt/components/tagInputProps.js +3 -0
  80. package/nuxt/components/tagProps.js +3 -0
  81. package/nuxt/components/textareaProps.js +3 -0
  82. package/nuxt/components/timeAxisProps.js +3 -0
  83. package/overlay/index.es.js +49 -42
  84. package/overlay/index.umd.js +1 -1
  85. package/overlay/style.css +1 -1
  86. package/package.json +8 -43
  87. package/pagination/index.es.js +24 -25
  88. package/pagination/index.umd.js +1 -1
  89. package/panel/index.es.js +45 -32
  90. package/panel/index.umd.js +1 -1
  91. package/popover/index.es.js +51 -44
  92. package/popover/index.umd.js +12 -12
  93. package/popover/style.css +1 -1
  94. package/progress/index.es.js +34 -36
  95. package/progress/index.umd.js +3 -3
  96. package/progress/style.css +1 -1
  97. package/radio/index.es.js +11 -11
  98. package/radio/index.umd.js +1 -1
  99. package/radio/style.css +1 -1
  100. package/rate/index.es.js +4 -7
  101. package/rate/index.umd.js +1 -1
  102. package/read-tip/index.es.js +8 -8
  103. package/read-tip/index.umd.js +1 -1
  104. package/result/index.es.js +40 -58
  105. package/result/index.umd.js +1 -1
  106. package/ripple/index.es.js +47 -42
  107. package/ripple/index.umd.js +1 -1
  108. package/search/index.es.js +13 -16
  109. package/search/index.umd.js +8 -8
  110. package/skeleton/index.es.js +20 -23
  111. package/skeleton/index.umd.js +1 -1
  112. package/slider/index.es.js +60 -59
  113. package/slider/index.umd.js +1 -1
  114. package/splitter/index.es.js +223 -171
  115. package/splitter/index.umd.js +13 -13
  116. package/splitter/style.css +1 -1
  117. package/statistic/index.es.js +7 -18
  118. package/statistic/index.umd.js +1 -1
  119. package/status/index.es.js +1 -4
  120. package/status/index.umd.js +1 -1
  121. package/status/style.css +1 -1
  122. package/style.css +1 -1
  123. package/switch/index.es.js +3 -6
  124. package/switch/index.umd.js +1 -1
  125. package/tag/index.es.js +15 -18
  126. package/tag/index.umd.js +1 -1
  127. package/tag/style.css +1 -1
  128. package/tag-input/index.es.js +7 -8
  129. package/tag-input/index.umd.js +1 -1
  130. package/textarea/index.es.js +2 -5
  131. package/textarea/index.umd.js +1 -1
  132. package/{accordion → timeline}/index.d.ts +0 -0
  133. package/{time-axis → timeline}/index.es.js +64 -83
  134. package/timeline/index.umd.js +1 -0
  135. package/{anchor → timeline}/package.json +1 -1
  136. package/timeline/style.css +1 -0
  137. package/upload/index.es.js +98 -97
  138. package/upload/index.umd.js +1 -1
  139. package/vue-devui.es.js +12477 -24991
  140. package/vue-devui.umd.js +24 -20
  141. package/accordion/index.es.js +0 -720
  142. package/accordion/index.umd.js +0 -1
  143. package/accordion/package.json +0 -7
  144. package/accordion/style.css +0 -1
  145. package/anchor/index.d.ts +0 -7
  146. package/anchor/index.es.js +0 -263
  147. package/anchor/index.umd.js +0 -1
  148. package/anchor/style.css +0 -1
  149. package/back-top/index.d.ts +0 -7
  150. package/back-top/index.es.js +0 -128
  151. package/back-top/index.umd.js +0 -1
  152. package/back-top/package.json +0 -7
  153. package/back-top/style.css +0 -1
  154. package/breadcrumb/index.d.ts +0 -7
  155. package/breadcrumb/index.es.js +0 -127
  156. package/breadcrumb/index.umd.js +0 -1
  157. package/breadcrumb/package.json +0 -7
  158. package/breadcrumb/style.css +0 -1
  159. package/carousel/index.d.ts +0 -7
  160. package/carousel/index.es.js +0 -329
  161. package/carousel/index.umd.js +0 -1
  162. package/carousel/package.json +0 -7
  163. package/carousel/style.css +0 -1
  164. package/cascader/index.d.ts +0 -7
  165. package/cascader/index.es.js +0 -5963
  166. package/cascader/index.umd.js +0 -27
  167. package/cascader/package.json +0 -7
  168. package/cascader/style.css +0 -1
  169. package/color-picker/index.d.ts +0 -7
  170. package/color-picker/index.es.js +0 -8187
  171. package/color-picker/index.umd.js +0 -27
  172. package/color-picker/package.json +0 -7
  173. package/color-picker/style.css +0 -1
  174. package/date-picker/index.d.ts +0 -7
  175. package/date-picker/index.es.js +0 -1171
  176. package/date-picker/index.umd.js +0 -1
  177. package/date-picker/package.json +0 -7
  178. package/date-picker/style.css +0 -1
  179. package/dragdrop/index.d.ts +0 -7
  180. package/dragdrop/index.es.js +0 -157
  181. package/dragdrop/index.umd.js +0 -1
  182. package/dragdrop/package.json +0 -7
  183. package/drawer/index.d.ts +0 -7
  184. package/drawer/index.es.js +0 -234
  185. package/drawer/index.umd.js +0 -1
  186. package/drawer/package.json +0 -7
  187. package/drawer/style.css +0 -1
  188. package/dropdown/index.d.ts +0 -7
  189. package/dropdown/index.es.js +0 -638
  190. package/dropdown/index.umd.js +0 -1
  191. package/dropdown/package.json +0 -7
  192. package/dropdown/style.css +0 -1
  193. package/form/index.d.ts +0 -7
  194. package/form/index.es.js +0 -7865
  195. package/form/index.umd.js +0 -27
  196. package/form/package.json +0 -7
  197. package/form/style.css +0 -1
  198. package/gantt/index.d.ts +0 -7
  199. package/gantt/index.es.js +0 -523
  200. package/gantt/index.umd.js +0 -1
  201. package/gantt/package.json +0 -7
  202. package/gantt/style.css +0 -1
  203. package/input-icon/index.d.ts +0 -7
  204. package/input-icon/index.es.js +0 -331
  205. package/input-icon/index.umd.js +0 -1
  206. package/input-icon/package.json +0 -7
  207. package/input-icon/style.css +0 -1
  208. package/input-number/index.d.ts +0 -7
  209. package/input-number/index.es.js +0 -240
  210. package/input-number/index.umd.js +0 -1
  211. package/input-number/package.json +0 -7
  212. package/input-number/style.css +0 -1
  213. package/list/index.d.ts +0 -7
  214. package/list/index.es.js +0 -39
  215. package/list/index.umd.js +0 -1
  216. package/list/package.json +0 -7
  217. package/list/style.css +0 -1
  218. package/nav-sprite/index.d.ts +0 -7
  219. package/nav-sprite/index.es.js +0 -68
  220. package/nav-sprite/index.umd.js +0 -1
  221. package/nav-sprite/package.json +0 -7
  222. package/nuxt/components/Accordion.js +0 -3
  223. package/nuxt/components/Anchor.js +0 -3
  224. package/nuxt/components/BackTop.js +0 -3
  225. package/nuxt/components/Breadcrumb.js +0 -3
  226. package/nuxt/components/Carousel.js +0 -3
  227. package/nuxt/components/CarouselItem.js +0 -3
  228. package/nuxt/components/Cascader.js +0 -3
  229. package/nuxt/components/ColorPicker.js +0 -3
  230. package/nuxt/components/Column.js +0 -3
  231. package/nuxt/components/DatePicker.js +0 -3
  232. package/nuxt/components/Drawer.js +0 -3
  233. package/nuxt/components/DrawerService.js +0 -3
  234. package/nuxt/components/Dropdown.js +0 -3
  235. package/nuxt/components/DropdownMenu.js +0 -3
  236. package/nuxt/components/Form.js +0 -3
  237. package/nuxt/components/FormControl.js +0 -3
  238. package/nuxt/components/FormItem.js +0 -3
  239. package/nuxt/components/FormLabel.js +0 -3
  240. package/nuxt/components/FormOperation.js +0 -3
  241. package/nuxt/components/Gantt.js +0 -3
  242. package/nuxt/components/InputIcon.js +0 -3
  243. package/nuxt/components/InputNumber.js +0 -3
  244. package/nuxt/components/List.js +0 -3
  245. package/nuxt/components/ListItem.js +0 -3
  246. package/nuxt/components/NavSprite.js +0 -2
  247. package/nuxt/components/QuadrantDiagram.js +0 -3
  248. package/nuxt/components/Select.js +0 -3
  249. package/nuxt/components/StepsGuide.js +0 -3
  250. package/nuxt/components/StickSlider.js +0 -3
  251. package/nuxt/components/Sticky.js +0 -2
  252. package/nuxt/components/Table.js +0 -3
  253. package/nuxt/components/Tabs.js +0 -3
  254. package/nuxt/components/TimeAxis.js +0 -3
  255. package/nuxt/components/TimeAxisItem.js +0 -3
  256. package/nuxt/components/TimePicker.js +0 -3
  257. package/nuxt/components/Tooltip.js +0 -3
  258. package/nuxt/components/Transfer.js +0 -3
  259. package/nuxt/components/Tree.js +0 -3
  260. package/nuxt/components/TreeSelect.js +0 -3
  261. package/nuxt/components/dropdownMenuProps.js +0 -3
  262. package/nuxt/components/tooltipProps.js +0 -3
  263. package/quadrant-diagram/index.d.ts +0 -7
  264. package/quadrant-diagram/index.es.js +0 -5728
  265. package/quadrant-diagram/index.umd.js +0 -27
  266. package/quadrant-diagram/package.json +0 -7
  267. package/quadrant-diagram/style.css +0 -1
  268. package/select/index.d.ts +0 -7
  269. package/select/index.es.js +0 -706
  270. package/select/index.umd.js +0 -1
  271. package/select/package.json +0 -7
  272. package/select/style.css +0 -1
  273. package/steps-guide/index.d.ts +0 -7
  274. package/steps-guide/index.es.js +0 -239
  275. package/steps-guide/index.umd.js +0 -1
  276. package/steps-guide/package.json +0 -7
  277. package/steps-guide/style.css +0 -1
  278. package/sticky/index.d.ts +0 -7
  279. package/sticky/index.es.js +0 -197
  280. package/sticky/index.umd.js +0 -1
  281. package/sticky/package.json +0 -7
  282. package/table/index.d.ts +0 -7
  283. package/table/index.es.js +0 -1969
  284. package/table/index.umd.js +0 -1
  285. package/table/package.json +0 -7
  286. package/table/style.css +0 -1
  287. package/tabs/index.d.ts +0 -7
  288. package/tabs/index.es.js +0 -194
  289. package/tabs/index.umd.js +0 -1
  290. package/tabs/package.json +0 -7
  291. package/tabs/style.css +0 -1
  292. package/time-axis/index.d.ts +0 -7
  293. package/time-axis/index.umd.js +0 -1
  294. package/time-axis/package.json +0 -7
  295. package/time-axis/style.css +0 -1
  296. package/time-picker/index.d.ts +0 -7
  297. package/time-picker/index.es.js +0 -1237
  298. package/time-picker/index.umd.js +0 -1
  299. package/time-picker/package.json +0 -7
  300. package/time-picker/style.css +0 -1
  301. package/tooltip/index.d.ts +0 -7
  302. package/tooltip/index.es.js +0 -5828
  303. package/tooltip/index.umd.js +0 -27
  304. package/tooltip/package.json +0 -7
  305. package/tooltip/style.css +0 -1
  306. package/transfer/index.d.ts +0 -7
  307. package/transfer/index.es.js +0 -7608
  308. package/transfer/index.umd.js +0 -27
  309. package/transfer/package.json +0 -7
  310. package/transfer/style.css +0 -1
  311. package/tree/index.d.ts +0 -7
  312. package/tree/index.es.js +0 -6490
  313. package/tree/index.umd.js +0 -27
  314. package/tree/package.json +0 -7
  315. package/tree/style.css +0 -1
  316. package/tree-select/index.d.ts +0 -7
  317. package/tree-select/index.es.js +0 -623
  318. package/tree-select/index.umd.js +0 -1
  319. package/tree-select/package.json +0 -7
  320. 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 };