vue-devui 1.0.0-beta.9 → 1.0.0-rc.1

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