vue-devui 1.0.0-beta.7 → 1.0.0-pre.0

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 (303) hide show
  1. package/README.md +81 -66
  2. package/accordion/index.es.js +522 -39
  3. package/accordion/index.umd.js +1 -1
  4. package/accordion/style.css +1 -1
  5. package/alert/index.es.js +7 -8
  6. package/alert/index.umd.js +1 -1
  7. package/alert/style.css +1 -1
  8. package/{toast → auto-complete}/index.d.ts +0 -0
  9. package/auto-complete/index.es.js +976 -0
  10. package/auto-complete/index.umd.js +1 -0
  11. package/auto-complete/package.json +7 -0
  12. package/auto-complete/style.css +1 -0
  13. package/avatar/index.es.js +1 -1
  14. package/avatar/index.umd.js +1 -1
  15. package/back-top/index.es.js +1 -1
  16. package/back-top/index.umd.js +1 -1
  17. package/badge/index.es.js +13 -19
  18. package/badge/index.umd.js +1 -1
  19. package/button/index.es.js +263 -83
  20. package/button/index.umd.js +1 -1
  21. package/button/style.css +1 -1
  22. package/card/index.es.js +1 -1
  23. package/card/index.umd.js +1 -1
  24. package/carousel/index.es.js +7 -6
  25. package/carousel/index.umd.js +1 -1
  26. package/cascader/index.es.js +5393 -773
  27. package/cascader/index.umd.js +27 -1
  28. package/checkbox/index.es.js +1 -1
  29. package/checkbox/index.umd.js +1 -1
  30. package/checkbox/style.css +1 -1
  31. package/color-picker/index.d.ts +7 -0
  32. package/color-picker/index.es.js +8187 -0
  33. package/color-picker/index.umd.js +27 -0
  34. package/color-picker/package.json +7 -0
  35. package/color-picker/style.css +1 -0
  36. package/comment/index.es.js +42 -13
  37. package/comment/index.umd.js +1 -1
  38. package/comment/style.css +1 -1
  39. package/countdown/index.d.ts +7 -0
  40. package/countdown/index.es.js +176 -0
  41. package/countdown/index.umd.js +1 -0
  42. package/countdown/package.json +7 -0
  43. package/countdown/style.css +1 -0
  44. package/date-picker/index.es.js +11 -12
  45. package/date-picker/index.umd.js +1 -1
  46. package/date-picker/style.css +1 -1
  47. package/dragdrop/index.es.js +135 -10
  48. package/dragdrop/index.umd.js +1 -1
  49. package/drawer/index.es.js +173 -203
  50. package/drawer/index.umd.js +1 -1
  51. package/drawer/style.css +1 -1
  52. package/dropdown/index.es.js +412 -302
  53. package/dropdown/index.umd.js +1 -1
  54. package/dropdown/style.css +1 -1
  55. package/editable-select/index.es.js +275 -5610
  56. package/editable-select/index.umd.js +1 -27
  57. package/editable-select/style.css +1 -1
  58. package/form/index.es.js +6129 -461
  59. package/form/index.umd.js +27 -1
  60. package/form/style.css +1 -1
  61. package/fullscreen/index.es.js +111 -119
  62. package/fullscreen/index.umd.js +1 -1
  63. package/fullscreen/style.css +1 -1
  64. package/gantt/index.es.js +6 -18
  65. package/gantt/index.umd.js +1 -1
  66. package/gantt/style.css +1 -1
  67. package/grid/index.es.js +3 -3
  68. package/grid/index.umd.js +1 -1
  69. package/grid/style.css +1 -1
  70. package/icon/index.es.js +3 -2
  71. package/icon/index.umd.js +1 -1
  72. package/image-preview/index.es.js +78 -20
  73. package/image-preview/index.umd.js +1 -1
  74. package/image-preview/style.css +1 -1
  75. package/input/index.es.js +5 -6
  76. package/input/index.umd.js +1 -1
  77. package/input/style.css +1 -1
  78. package/input-icon/index.es.js +6 -6
  79. package/input-icon/index.umd.js +1 -1
  80. package/input-icon/style.css +1 -1
  81. package/input-number/index.es.js +2 -1
  82. package/input-number/index.umd.js +1 -1
  83. package/layout/index.es.js +1 -1
  84. package/layout/index.umd.js +1 -1
  85. package/list/index.d.ts +7 -0
  86. package/list/index.es.js +39 -0
  87. package/list/index.umd.js +1 -0
  88. package/{toast → list}/package.json +1 -1
  89. package/list/style.css +1 -0
  90. package/loading/index.es.js +3 -3
  91. package/loading/index.umd.js +1 -1
  92. package/modal/index.es.js +297 -761
  93. package/modal/index.umd.js +1 -1
  94. package/modal/style.css +1 -1
  95. package/nav-sprite/index.es.js +1 -675
  96. package/nav-sprite/index.umd.js +1 -1
  97. package/notification/index.d.ts +7 -0
  98. package/notification/index.es.js +286 -0
  99. package/notification/index.umd.js +1 -0
  100. package/notification/package.json +7 -0
  101. package/notification/style.css +1 -0
  102. package/nuxt/components/Accordion.js +3 -0
  103. package/nuxt/components/Alert.js +3 -0
  104. package/nuxt/components/Anchor.js +3 -0
  105. package/nuxt/components/Aside.js +3 -0
  106. package/nuxt/components/AutoComplete.js +3 -0
  107. package/nuxt/components/Avatar.js +3 -0
  108. package/nuxt/components/BackTop.js +3 -0
  109. package/nuxt/components/Badge.js +3 -0
  110. package/nuxt/components/Breadcrumb.js +3 -0
  111. package/nuxt/components/Button.js +3 -0
  112. package/nuxt/components/Card.js +3 -0
  113. package/nuxt/components/Carousel.js +3 -0
  114. package/nuxt/components/CarouselItem.js +3 -0
  115. package/nuxt/components/Cascader.js +3 -0
  116. package/nuxt/components/Checkbox.js +3 -0
  117. package/nuxt/components/Col.js +3 -0
  118. package/nuxt/components/ColorPicker.js +3 -0
  119. package/nuxt/components/Column.js +3 -0
  120. package/nuxt/components/Comment.js +3 -0
  121. package/nuxt/components/Content.js +3 -0
  122. package/nuxt/components/Countdown.js +3 -0
  123. package/nuxt/components/DatePicker.js +3 -0
  124. package/nuxt/components/Drawer.js +3 -0
  125. package/nuxt/components/DrawerService.js +3 -0
  126. package/nuxt/components/Dropdown.js +3 -0
  127. package/nuxt/components/DropdownMenu.js +3 -0
  128. package/nuxt/components/EditableSelect.js +3 -0
  129. package/nuxt/components/FixedOverlay.js +3 -0
  130. package/nuxt/components/FlexibleOverlay.js +3 -0
  131. package/nuxt/components/Footer.js +3 -0
  132. package/nuxt/components/Form.js +3 -0
  133. package/nuxt/components/FormControl.js +3 -0
  134. package/nuxt/components/FormItem.js +3 -0
  135. package/nuxt/components/FormLabel.js +3 -0
  136. package/nuxt/components/FormOperation.js +3 -0
  137. package/nuxt/components/Fullscreen.js +3 -0
  138. package/nuxt/components/Gantt.js +3 -0
  139. package/nuxt/components/Header.js +3 -0
  140. package/nuxt/components/IFileOptions.js +3 -0
  141. package/nuxt/components/IUploadOptions.js +3 -0
  142. package/nuxt/components/Icon.js +2 -0
  143. package/nuxt/components/ImagePreviewService.js +3 -0
  144. package/nuxt/components/Input.js +3 -0
  145. package/nuxt/components/InputIcon.js +3 -0
  146. package/nuxt/components/InputNumber.js +3 -0
  147. package/nuxt/components/Layout.js +3 -0
  148. package/nuxt/components/List.js +3 -0
  149. package/nuxt/components/ListItem.js +3 -0
  150. package/nuxt/components/Loading.js +3 -0
  151. package/nuxt/components/LoadingService.js +3 -0
  152. package/nuxt/components/Modal.js +3 -0
  153. package/nuxt/components/NavSprite.js +2 -0
  154. package/nuxt/components/Notification.js +3 -0
  155. package/nuxt/components/NotificationService.js +3 -0
  156. package/nuxt/components/Pagination.js +3 -0
  157. package/nuxt/components/Panel.js +3 -0
  158. package/nuxt/components/Popover.js +3 -0
  159. package/nuxt/components/Progress.js +3 -0
  160. package/nuxt/components/QuadrantDiagram.js +3 -0
  161. package/nuxt/components/Radio.js +3 -0
  162. package/nuxt/components/RadioGroup.js +3 -0
  163. package/nuxt/components/Rate.js +3 -0
  164. package/nuxt/components/ReadTip.js +3 -0
  165. package/nuxt/components/Result.js +3 -0
  166. package/nuxt/components/Row.js +3 -0
  167. package/nuxt/components/Search.js +3 -0
  168. package/nuxt/components/Select.js +3 -0
  169. package/nuxt/components/Skeleton.js +3 -0
  170. package/nuxt/components/SkeletonItem.js +3 -0
  171. package/nuxt/components/Slider.js +3 -0
  172. package/nuxt/components/Splitter.js +3 -0
  173. package/nuxt/components/Statistic.js +3 -0
  174. package/nuxt/components/Status.js +3 -0
  175. package/nuxt/components/StepsGuide.js +3 -0
  176. package/nuxt/components/StickSlider.js +3 -0
  177. package/nuxt/components/Sticky.js +2 -0
  178. package/nuxt/components/Switch.js +3 -0
  179. package/nuxt/components/Table.js +3 -0
  180. package/nuxt/components/Tabs.js +3 -0
  181. package/nuxt/components/Tag.js +3 -0
  182. package/nuxt/components/TagInput.js +3 -0
  183. package/nuxt/components/Textarea.js +3 -0
  184. package/nuxt/components/TimeAxis.js +3 -0
  185. package/nuxt/components/TimeAxisItem.js +3 -0
  186. package/nuxt/components/TimePicker.js +3 -0
  187. package/nuxt/components/Tooltip.js +3 -0
  188. package/nuxt/components/Transfer.js +3 -0
  189. package/nuxt/components/Tree.js +3 -0
  190. package/nuxt/components/TreeSelect.js +3 -0
  191. package/nuxt/components/Upload.js +3 -0
  192. package/nuxt/components/UploadStatus.js +3 -0
  193. package/nuxt/components/badgeProps.js +3 -0
  194. package/nuxt/components/buttonProps.js +3 -0
  195. package/nuxt/components/dropdownMenuProps.js +3 -0
  196. package/nuxt/components/fixedOverlayProps.js +3 -0
  197. package/nuxt/components/flexibleOverlayProps.js +3 -0
  198. package/nuxt/components/notificationProps.js +3 -0
  199. package/nuxt/components/overlayEmits.js +3 -0
  200. package/nuxt/components/overlayProps.js +3 -0
  201. package/nuxt/components/popoverProps.js +3 -0
  202. package/nuxt/components/tooltipProps.js +3 -0
  203. package/nuxt/components/uploadProps.js +3 -0
  204. package/nuxt/index.js +13 -0
  205. package/overlay/index.es.js +146 -200
  206. package/overlay/index.umd.js +1 -1
  207. package/overlay/style.css +1 -1
  208. package/package.json +10 -18
  209. package/pagination/index.es.js +4 -4
  210. package/pagination/index.umd.js +1 -1
  211. package/pagination/style.css +1 -1
  212. package/panel/index.es.js +3 -3
  213. package/panel/index.umd.js +1 -1
  214. package/popover/index.es.js +5948 -190
  215. package/popover/index.umd.js +27 -1
  216. package/popover/style.css +1 -1
  217. package/progress/index.es.js +9 -9
  218. package/progress/index.umd.js +3 -3
  219. package/quadrant-diagram/index.es.js +5405 -166
  220. package/quadrant-diagram/index.umd.js +27 -1
  221. package/radio/index.es.js +6 -6
  222. package/radio/index.umd.js +1 -1
  223. package/radio/style.css +1 -1
  224. package/rate/index.es.js +1 -1
  225. package/rate/index.umd.js +1 -1
  226. package/read-tip/index.es.js +21 -7
  227. package/read-tip/index.umd.js +1 -1
  228. package/read-tip/style.css +1 -1
  229. package/result/index.d.ts +7 -0
  230. package/result/index.es.js +119 -0
  231. package/result/index.umd.js +1 -0
  232. package/result/package.json +7 -0
  233. package/result/style.css +1 -0
  234. package/ripple/index.es.js +6 -3
  235. package/ripple/index.umd.js +1 -1
  236. package/search/index.es.js +5435 -201
  237. package/search/index.umd.js +27 -1
  238. package/search/style.css +1 -1
  239. package/select/index.es.js +3 -2
  240. package/select/index.umd.js +1 -1
  241. package/select/style.css +1 -1
  242. package/skeleton/index.es.js +1 -1
  243. package/skeleton/index.umd.js +1 -1
  244. package/slider/index.es.js +3 -6
  245. package/slider/index.umd.js +1 -1
  246. package/slider/style.css +1 -1
  247. package/splitter/index.es.js +5904 -60
  248. package/splitter/index.umd.js +27 -1
  249. package/splitter/style.css +1 -1
  250. package/statistic/index.d.ts +7 -0
  251. package/statistic/index.es.js +267 -0
  252. package/statistic/index.umd.js +1 -0
  253. package/statistic/package.json +7 -0
  254. package/statistic/style.css +1 -0
  255. package/status/index.es.js +2 -2
  256. package/status/index.umd.js +1 -1
  257. package/status/style.css +1 -1
  258. package/steps-guide/index.es.js +8 -6
  259. package/steps-guide/index.umd.js +1 -1
  260. package/sticky/index.umd.js +1 -1
  261. package/style.css +1 -1
  262. package/switch/index.es.js +1 -1
  263. package/switch/index.umd.js +1 -1
  264. package/table/index.es.js +701 -359
  265. package/table/index.umd.js +1 -1
  266. package/table/style.css +1 -1
  267. package/tabs/index.es.js +3 -4
  268. package/tabs/index.umd.js +1 -1
  269. package/tabs/style.css +1 -1
  270. package/tag/index.es.js +37 -11
  271. package/tag/index.umd.js +1 -1
  272. package/tag/style.css +1 -1
  273. package/tag-input/index.es.js +1 -13
  274. package/tag-input/index.umd.js +1 -1
  275. package/textarea/index.es.js +1 -1
  276. package/textarea/index.umd.js +1 -1
  277. package/textarea/style.css +1 -1
  278. package/{theme → theme/theme.scss} +0 -0
  279. package/time-axis/index.es.js +5 -2
  280. package/time-axis/index.umd.js +1 -1
  281. package/time-picker/index.es.js +269 -84
  282. package/time-picker/index.umd.js +1 -1
  283. package/time-picker/style.css +1 -1
  284. package/tooltip/index.es.js +5798 -141
  285. package/tooltip/index.umd.js +27 -1
  286. package/tooltip/style.css +1 -1
  287. package/transfer/index.es.js +6522 -635
  288. package/transfer/index.umd.js +27 -1
  289. package/transfer/style.css +1 -1
  290. package/tree/index.es.js +5858 -146
  291. package/tree/index.umd.js +27 -1
  292. package/tree/style.css +1 -1
  293. package/tree-select/index.es.js +130 -35
  294. package/tree-select/index.umd.js +1 -1
  295. package/tree-select/style.css +1 -1
  296. package/upload/index.es.js +464 -2681
  297. package/upload/index.umd.js +1 -1
  298. package/upload/style.css +1 -1
  299. package/vue-devui.es.js +15597 -14569
  300. package/vue-devui.umd.js +16 -16
  301. package/toast/index.es.js +0 -2059
  302. package/toast/index.umd.js +0 -1
  303. package/toast/style.css +0 -1
@@ -1,4 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
2
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
4
6
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -14,7 +16,9 @@ var __spreadValues = (a, b) => {
14
16
  }
15
17
  return a;
16
18
  };
17
- import { defineComponent, toRefs, computed, createVNode, Fragment, mergeProps, resolveComponent, onMounted, watch } from "vue";
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";
18
22
  const accordionProps = {
19
23
  data: {
20
24
  type: Array,
@@ -26,8 +30,8 @@ const accordionProps = {
26
30
  disabledKey: { type: String, default: "disabled" },
27
31
  activeKey: { type: String, default: "active" },
28
32
  openKey: { type: String, default: "open" },
29
- menuItemTemplate: { type: String, default: "" },
30
- itemTemplate: { type: String, default: "" },
33
+ menuItemTemplate: { type: Boolean, default: true },
34
+ itemTemplate: { type: Boolean, default: true },
31
35
  menuToggle: {
32
36
  type: Function,
33
37
  default: null
@@ -43,9 +47,9 @@ const accordionProps = {
43
47
  restrictOneOpen: { type: Boolean, default: false },
44
48
  autoOpenActiveMenu: { type: Boolean, default: false },
45
49
  showNoContent: { type: Boolean, default: true },
46
- noContentTemplate: { type: String, default: "" },
47
- loadingTemplate: { type: String, default: "" },
48
- innerListTemplate: { type: String, default: "" },
50
+ noContentTemplate: { type: Boolean, default: true },
51
+ loadingTemplate: { type: Boolean, default: true },
52
+ innerListTemplate: { type: Boolean, default: true },
49
53
  linkType: {
50
54
  type: String,
51
55
  default: ""
@@ -59,8 +63,43 @@ const accordionProps = {
59
63
  default: "normal"
60
64
  }
61
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
+ };
62
98
  var DAccordionMenu = defineComponent({
63
99
  name: "DAccordionMenu",
100
+ components: {
101
+ OpenIcon
102
+ },
64
103
  props: __spreadValues({
65
104
  item: Object,
66
105
  deepth: {
@@ -75,36 +114,367 @@ var DAccordionMenu = defineComponent({
75
114
  setup(props) {
76
115
  const {
77
116
  item,
78
- deepth
117
+ deepth,
118
+ parent,
119
+ openKey,
120
+ activeKey,
121
+ autoOpenActiveMenu,
122
+ disabledKey,
123
+ childrenKey,
124
+ titleKey,
125
+ menuItemTemplate
79
126
  } = toRefs(props);
80
- computed(() => {
81
- return keyOpen === void 0 && props.autoOpenActiveMenu ? childActived : keyOpen;
82
- });
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
+ };
83
158
  const keyOpen = computed(() => {
84
- return item == null ? void 0 : item.value[props.openKey];
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];
85
169
  });
86
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;
87
175
  });
88
176
  return () => {
177
+ var _a;
89
178
  return createVNode(Fragment, null, [createVNode("div", {
90
- "class": ["devui-accordion-item-title", "devui-over-flow-ellipsis", item.value.children ? "open active" : ""],
91
- "title": item.value.title
92
- }, [item.value.title]), createVNode(AccordionList, {
93
- "class": "devui-accordion-submenu devui-accordion-show-animate",
94
- "style": "opacity: 1; overflow: hidden;",
95
- "deepth": deepth.value + 1,
96
- "data": item.value.children || [],
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 || [],
97
206
  "parent": item.value
98
- }, null)]);
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()])])]);
99
466
  };
100
467
  }
101
468
  });
102
469
  var AccordionList = defineComponent({
103
470
  name: "DAccordionList",
104
- inheritAttrs: false,
105
471
  components: {
106
- DAccordionMenu
472
+ DAccordionMenu,
473
+ DAccordionItem,
474
+ DAccordionItemHreflink,
475
+ DAccordionItemRouterlink
107
476
  },
477
+ inheritAttrs: false,
108
478
  props: __spreadValues({
109
479
  data: {
110
480
  type: Array,
@@ -121,27 +491,105 @@ var AccordionList = defineComponent({
121
491
  innerListTemplate: Boolean
122
492
  }, accordionProps),
123
493
  setup(props, {
124
- attrs,
125
- slots
494
+ attrs
126
495
  }) {
127
496
  const {
128
497
  childrenKey,
129
- innerListTemplate,
130
- deepth
498
+ deepth,
499
+ parent,
500
+ data,
501
+ linkType,
502
+ showNoContent,
503
+ loadingKey,
504
+ titleKey,
505
+ linkTypeKey,
506
+ loadingTemplate,
507
+ noContentTemplate,
508
+ innerListTemplate
131
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
+ });
132
521
  return () => {
133
- return createVNode(Fragment, null, [!innerListTemplate.value && createVNode("ul", mergeProps({
134
- "class": "devui-accordion-list"
135
- }, attrs), [props.data.map((item) => {
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) => {
136
526
  return createVNode("li", {
137
527
  "class": "devui-accordion-item",
138
- "key": item.title
139
- }, [childrenKey !== void 0 && createVNode(resolveComponent("d-accordion-menu"), mergeProps({
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, {
140
544
  "item": item,
141
- "deepth": props.deepth,
142
- "parent": props.parent
143
- }, accordionProps), null)]);
144
- })]), innerListTemplate.value && deepth.value !== 0 && createVNode("div", null, [slots.default ? slots.innerListTemplate() : ""])]);
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
+ ])]);
145
593
  };
146
594
  }
147
595
  });
@@ -198,28 +646,63 @@ var Accordion = defineComponent({
198
646
  clickActiveItem = item;
199
647
  emit("activeItemChange", clickActiveItem);
200
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
+ };
201
675
  const cleanOpenData = () => {
202
676
  flatten(data.value, childrenKey.value, true, false).forEach((item) => item[openKey.value] = void 0);
203
677
  };
678
+ provide("accordionContext", {
679
+ itemClickFn,
680
+ linkItemClickFn,
681
+ menuToggleFn
682
+ });
204
683
  onMounted(() => {
205
684
  if (data.value) {
206
685
  initActiveItem();
207
686
  }
208
687
  });
209
688
  watch(() => autoOpenActiveMenu.value, (current, preV) => {
210
- console.log("cur, new", current, preV);
211
689
  if (current && preV === false) {
212
690
  cleanOpenData();
213
691
  }
214
692
  });
693
+ watch(data.value, (current, preV) => {
694
+ initActiveItem();
695
+ }, {
696
+ deep: true
697
+ });
215
698
  return () => {
216
699
  return createVNode("div", {
217
- "class": `devui-accordion-menu devui-scrollbar ${accordionType.value === "normal" ? "devui-accordion-menu-normal" : ""}`
218
- }, [createVNode(AccordionList, mergeProps({
219
- "data": data,
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,
220
703
  "deepth": 0,
221
704
  "parent": null
222
- }, props), null)]);
705
+ }), null)]);
223
706
  };
224
707
  }
225
708
  });