vue-devui 1.0.0-rc.7 → 1.0.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 (231) hide show
  1. package/README.md +163 -146
  2. package/alert/index.es.js +46 -15
  3. package/alert/index.umd.js +1 -1
  4. package/alert/style.css +1 -1
  5. package/auto-complete/index.es.js +8230 -231
  6. package/auto-complete/index.umd.js +29 -5
  7. package/auto-complete/style.css +1 -1
  8. package/avatar/index.es.js +81 -70
  9. package/avatar/index.umd.js +1 -1
  10. package/avatar/style.css +1 -1
  11. package/badge/index.es.js +34 -4
  12. package/badge/index.umd.js +1 -1
  13. package/badge/style.css +1 -1
  14. package/button/index.es.js +5706 -98
  15. package/button/index.umd.js +27 -1
  16. package/button/style.css +1 -1
  17. package/card/index.es.js +38 -13
  18. package/card/index.umd.js +1 -1
  19. package/card/style.css +1 -1
  20. package/checkbox/index.es.js +8066 -245
  21. package/checkbox/index.umd.js +27 -1
  22. package/checkbox/style.css +1 -1
  23. package/{date-picker → collapse}/index.d.ts +0 -0
  24. package/collapse/index.es.js +213 -0
  25. package/collapse/index.umd.js +1 -0
  26. package/{date-picker → collapse}/package.json +1 -1
  27. package/collapse/style.css +1 -0
  28. package/countdown/index.es.js +56 -13
  29. package/countdown/index.umd.js +1 -1
  30. package/date-picker-pro/index.d.ts +7 -0
  31. package/date-picker-pro/index.es.js +12020 -0
  32. package/date-picker-pro/index.umd.js +27 -0
  33. package/date-picker-pro/package.json +7 -0
  34. package/date-picker-pro/style.css +1 -0
  35. package/drawer/index.es.js +29 -4
  36. package/drawer/index.umd.js +1 -1
  37. package/drawer/style.css +1 -1
  38. package/dropdown/index.es.js +178 -142
  39. package/dropdown/index.umd.js +1 -1
  40. package/dropdown/style.css +1 -1
  41. package/editable-select/index.es.js +742 -107
  42. package/editable-select/index.umd.js +1 -1
  43. package/editable-select/style.css +1 -1
  44. package/form/index.es.js +544 -316
  45. package/form/index.umd.js +17 -17
  46. package/form/style.css +1 -1
  47. package/fullscreen/index.es.js +28 -4
  48. package/fullscreen/index.umd.js +1 -1
  49. package/fullscreen/style.css +1 -1
  50. package/grid/index.es.js +71 -50
  51. package/grid/index.umd.js +1 -1
  52. package/grid/style.css +1 -1
  53. package/icon/index.es.js +184 -23
  54. package/icon/index.umd.js +1 -1
  55. package/icon/style.css +1 -0
  56. package/image-preview/index.es.js +34 -11
  57. package/image-preview/index.umd.js +1 -1
  58. package/image-preview/style.css +1 -1
  59. package/input/index.es.js +8250 -131
  60. package/input/index.umd.js +27 -1
  61. package/input/style.css +1 -1
  62. package/input-number/index.es.js +275 -203
  63. package/input-number/index.umd.js +1 -1
  64. package/input-number/style.css +1 -1
  65. package/layout/index.es.js +34 -6
  66. package/layout/index.umd.js +1 -1
  67. package/layout/style.css +1 -1
  68. package/loading/index.es.js +34 -10
  69. package/loading/index.umd.js +1 -1
  70. package/loading/style.css +1 -1
  71. package/mention/index.d.ts +7 -0
  72. package/mention/index.es.js +8310 -0
  73. package/mention/index.umd.js +36 -0
  74. package/mention/package.json +7 -0
  75. package/mention/style.css +1 -0
  76. package/menu/index.d.ts +7 -0
  77. package/menu/index.es.js +934 -0
  78. package/menu/index.umd.js +1 -0
  79. package/menu/package.json +7 -0
  80. package/menu/style.css +1 -0
  81. package/message/index.d.ts +7 -0
  82. package/message/index.es.js +538 -0
  83. package/message/index.umd.js +1 -0
  84. package/message/package.json +7 -0
  85. package/message/style.css +1 -0
  86. package/modal/index.es.js +359 -170
  87. package/modal/index.umd.js +1 -1
  88. package/modal/style.css +1 -1
  89. package/notification/index.es.js +236 -65
  90. package/notification/index.umd.js +1 -1
  91. package/notification/style.css +1 -1
  92. package/nuxt/components/ButtonGroup.js +3 -0
  93. package/nuxt/components/CheckboxButton.js +3 -0
  94. package/nuxt/components/Collapse.js +3 -0
  95. package/nuxt/components/CollapseItem.js +3 -0
  96. package/nuxt/components/DRangeDatePickerPro.js +3 -0
  97. package/nuxt/components/DatePickerPro.js +3 -0
  98. package/nuxt/components/Icon.js +1 -0
  99. package/nuxt/components/IconGroup.js +3 -0
  100. package/nuxt/components/LABEL_DATA.js +3 -0
  101. package/nuxt/components/Mention.js +3 -0
  102. package/nuxt/components/Menu.js +3 -0
  103. package/nuxt/components/MenuItem.js +3 -0
  104. package/nuxt/components/Message.js +3 -0
  105. package/nuxt/components/Option.js +3 -0
  106. package/nuxt/components/OptionGroup.js +3 -0
  107. package/nuxt/components/RadioButton.js +3 -0
  108. package/nuxt/components/Step.js +3 -0
  109. package/nuxt/components/Steps.js +3 -0
  110. package/nuxt/components/SubMenu.js +3 -0
  111. package/nuxt/components/TABLE_TOKEN.js +3 -0
  112. package/nuxt/components/TimePicker.js +3 -0
  113. package/nuxt/components/TimeSelect.js +3 -0
  114. package/nuxt/components/animationInjectionKey.js +3 -0
  115. package/nuxt/components/buttonGroupInjectionKey.js +3 -0
  116. package/nuxt/components/buttonGroupProps.js +3 -0
  117. package/nuxt/components/collapseItemProps.js +3 -0
  118. package/nuxt/components/collapseProps.js +3 -0
  119. package/nuxt/components/datePickerProCommonProps.js +3 -0
  120. package/nuxt/components/datePickerProPanelProps.js +3 -0
  121. package/nuxt/components/datePickerProProps.js +3 -0
  122. package/nuxt/components/iconProps.js +1 -0
  123. package/nuxt/components/mentionProps.js +3 -0
  124. package/nuxt/components/messageProps.js +3 -0
  125. package/nuxt/components/roundInjectionKey.js +3 -0
  126. package/nuxt/components/skeletonItemProps.js +3 -0
  127. package/nuxt/components/stepProps.js +3 -0
  128. package/nuxt/components/stepsProps.js +3 -0
  129. package/nuxt/components/svgIconProps.js +3 -0
  130. package/nuxt/components/tableProps.js +3 -0
  131. package/nuxt/components/timerPickerPanelProps.js +3 -0
  132. package/nuxt/components/treeNodeProps.js +3 -0
  133. package/overlay/index.es.js +84 -125
  134. package/overlay/index.umd.js +1 -1
  135. package/overlay/style.css +1 -1
  136. package/package.json +7 -3
  137. package/pagination/index.es.js +234 -39
  138. package/pagination/index.umd.js +1 -1
  139. package/pagination/style.css +1 -1
  140. package/panel/style.css +1 -1
  141. package/popover/index.es.js +274 -220
  142. package/popover/index.umd.js +13 -13
  143. package/popover/style.css +1 -1
  144. package/progress/index.es.js +31 -9
  145. package/progress/index.umd.js +3 -3
  146. package/progress/style.css +1 -1
  147. package/radio/index.es.js +7969 -152
  148. package/radio/index.umd.js +27 -1
  149. package/radio/style.css +1 -1
  150. package/rate/index.es.js +46 -14
  151. package/rate/index.umd.js +1 -1
  152. package/rate/style.css +1 -1
  153. package/result/index.es.js +169 -22
  154. package/result/index.umd.js +1 -1
  155. package/result/style.css +1 -1
  156. package/search/index.es.js +3823 -1090
  157. package/search/index.umd.js +18 -18
  158. package/search/style.css +1 -1
  159. package/select/index.es.js +9186 -478
  160. package/select/index.umd.js +27 -1
  161. package/select/style.css +1 -1
  162. package/skeleton/index.es.js +110 -259
  163. package/skeleton/index.umd.js +1 -1
  164. package/skeleton/style.css +1 -1
  165. package/slider/index.es.js +143 -146
  166. package/slider/index.umd.js +1 -1
  167. package/slider/style.css +1 -1
  168. package/splitter/index.es.js +433 -207
  169. package/splitter/index.umd.js +17 -17
  170. package/splitter/style.css +1 -1
  171. package/statistic/index.es.js +34 -16
  172. package/statistic/index.umd.js +1 -1
  173. package/statistic/style.css +1 -1
  174. package/status/index.es.js +26 -2
  175. package/status/index.umd.js +1 -1
  176. package/status/style.css +1 -1
  177. package/steps/index.d.ts +7 -0
  178. package/steps/index.es.js +386 -0
  179. package/steps/index.umd.js +1 -0
  180. package/steps/package.json +7 -0
  181. package/steps/style.css +1 -0
  182. package/style.css +1 -1
  183. package/switch/index.es.js +7802 -59
  184. package/switch/index.umd.js +27 -1
  185. package/switch/style.css +1 -1
  186. package/table/index.es.js +9769 -919
  187. package/table/index.umd.js +27 -1
  188. package/table/style.css +1 -1
  189. package/tabs/index.es.js +309 -96
  190. package/tabs/index.umd.js +1 -1
  191. package/tabs/style.css +1 -1
  192. package/tag/index.es.js +35 -7
  193. package/tag/index.umd.js +1 -1
  194. package/tag/style.css +1 -1
  195. package/textarea/index.es.js +7922 -78
  196. package/textarea/index.umd.js +35 -1
  197. package/textarea/style.css +1 -1
  198. package/time-picker/index.d.ts +7 -0
  199. package/time-picker/index.es.js +9549 -0
  200. package/time-picker/index.umd.js +27 -0
  201. package/time-picker/package.json +7 -0
  202. package/time-picker/style.css +1 -0
  203. package/time-select/index.d.ts +7 -0
  204. package/time-select/index.es.js +9585 -0
  205. package/time-select/index.umd.js +27 -0
  206. package/time-select/package.json +7 -0
  207. package/time-select/style.css +1 -0
  208. package/timeline/index.es.js +169 -22
  209. package/timeline/index.umd.js +1 -1
  210. package/timeline/style.css +1 -1
  211. package/tooltip/index.es.js +265 -212
  212. package/tooltip/index.umd.js +15 -15
  213. package/tooltip/style.css +1 -1
  214. package/tree/index.es.js +11343 -795
  215. package/tree/index.umd.js +27 -1
  216. package/tree/style.css +1 -1
  217. package/upload/index.es.js +494 -106
  218. package/upload/index.umd.js +1 -1
  219. package/upload/style.css +1 -1
  220. package/vue-devui.es.js +22849 -13614
  221. package/vue-devui.umd.js +30 -23
  222. package/date-picker/index.es.js +0 -1145
  223. package/date-picker/index.umd.js +0 -1
  224. package/date-picker/style.css +0 -1
  225. package/nuxt/components/DatePicker.js +0 -3
  226. package/nuxt/components/FormControl.js +0 -3
  227. package/nuxt/components/FormLabel.js +0 -3
  228. package/nuxt/components/StickSlider.js +0 -3
  229. package/nuxt/components/formControlProps.js +0 -3
  230. package/nuxt/components/overlayEmits.js +0 -3
  231. package/nuxt/components/overlayProps.js +0 -3
@@ -1,12 +1,18 @@
1
- import { defineComponent, createVNode, Fragment, withDirectives, vShow, mergeProps } from "vue";
1
+ import { toRefs, inject, computed, createVNode, defineComponent, provide } from "vue";
2
+ const skeletonItemProps = {
3
+ variant: {
4
+ type: String,
5
+ default: "square"
6
+ },
7
+ size: {
8
+ type: String,
9
+ default: "md"
10
+ }
11
+ };
2
12
  const skeletonProps = {
3
- row: {
13
+ rows: {
4
14
  type: Number,
5
- default: 0
6
- },
7
- animate: {
8
- type: Boolean,
9
- default: true
15
+ default: 3
10
16
  },
11
17
  round: {
12
18
  type: Boolean,
@@ -16,269 +22,114 @@ const skeletonProps = {
16
22
  type: Boolean,
17
23
  default: true
18
24
  },
19
- avatar: {
20
- type: Boolean,
21
- default: false
22
- },
23
- title: {
24
- type: Boolean,
25
- default: true
26
- },
27
- paragraph: {
25
+ showAnimation: {
28
26
  type: Boolean,
29
27
  default: true
30
- },
31
- avatarSize: {
32
- type: [String, Number],
33
- default: "40px"
34
- },
35
- avatarShape: {
36
- type: String,
37
- default: "round"
38
- },
39
- titleWidth: {
40
- type: [String, Number],
41
- default: "40%"
42
- },
43
- rowWidth: {
44
- type: [Number, String, Array],
45
- default: ["100%"]
46
28
  }
47
29
  };
48
- var skeleton = "";
49
- var Skeleton = defineComponent({
50
- name: "DSkeleton",
51
- props: skeletonProps,
52
- setup(props, ctx) {
53
- const {
54
- slots
55
- } = ctx;
56
- function renderAnimate(isAnimated) {
57
- return isAnimated ? "devui-skeleton__animated" : "";
58
- }
59
- function renderBorderRadius(isRound) {
60
- return isRound ? "border-radius: 1em;" : "";
61
- }
62
- function renderParagraph(isShown, rowNum, rowWidth, round) {
63
- const arr = [];
64
- function pushIntoArray(type) {
65
- for (let index2 = 0; index2 < rowNum; index2++) {
66
- arr.push({
67
- width: type
68
- });
69
- }
70
- }
71
- (function handleRowWidth() {
72
- if (rowWidth instanceof Array) {
73
- for (let index2 = 0; index2 < rowNum; index2++) {
74
- if (rowWidth[index2]) {
75
- switch (typeof rowWidth[index2]) {
76
- case "string":
77
- arr.push({
78
- width: rowWidth[index2]
79
- });
80
- break;
81
- case "number":
82
- arr.push({
83
- width: `${rowWidth[index2]}px`
84
- });
85
- }
86
- } else {
87
- arr.push({
88
- width: 1
89
- });
90
- }
91
- }
92
- } else {
93
- switch (typeof rowWidth) {
94
- case "string":
95
- pushIntoArray(rowWidth);
96
- break;
97
- case "number":
98
- pushIntoArray(`${rowWidth}px`);
99
- break;
100
- }
101
- }
102
- })();
103
- return withDirectives(createVNode("div", {
104
- "class": "devui-skeleton__paragraph"
105
- }, [arr.map((item) => {
106
- return createVNode("div", {
107
- "class": "devui-skeleton__item",
108
- "style": round ? "border-radius: 1em;" : `width: ${item.width}`
109
- }, null);
110
- })]), [[vShow, isShown]]);
111
- }
112
- function renderAvatarStyle(avatarSize, avatarShape) {
113
- function renderAvatarShape() {
114
- return avatarShape === "square" ? "" : "border-radius:50%;";
115
- }
116
- function renderAvatarSize() {
117
- switch (typeof avatarSize) {
118
- case "string":
119
- return `width:${avatarSize};height:${avatarSize};`;
120
- case "number":
121
- return `width:${avatarSize}px;height:${avatarSize}px;`;
122
- }
123
- }
124
- return renderAvatarSize() + renderAvatarShape();
125
- }
126
- function renderTitle(isVisible, titleWidth, isRound) {
127
- function renderTitleWidth() {
128
- switch (typeof titleWidth) {
129
- case "string":
130
- return `width: ${titleWidth};`;
131
- case "number":
132
- return `width: ${titleWidth}px;`;
133
- }
134
- }
135
- function renderTitleVisibility() {
136
- return isVisible ? null : "visibility: hidden;";
137
- }
138
- return renderTitleWidth() + renderBorderRadius(isRound) + renderTitleVisibility();
139
- }
140
- function renderDefaultSkeleton() {
141
- return createVNode(Fragment, null, [withDirectives(createVNode("div", {
142
- "class": "devui-skeleton__avatar"
143
- }, [createVNode("div", {
144
- "class": "avatar",
145
- "style": renderAvatarStyle(props.avatarSize, props.avatarShape)
146
- }, null)]), [[vShow, props.avatar]]), createVNode("div", {
147
- "class": "devui-skeleton__group"
148
- }, [createVNode("div", {
149
- "class": "devui-skeleton__title",
150
- "style": renderTitle(props.title, props.titleWidth, props.round)
151
- }, null), renderParagraph(props.paragraph, props.row, props.rowWidth, props.round)])]);
152
- }
153
- return () => {
154
- var _a;
155
- if (props.loading) {
156
- return createVNode("div", {
157
- "class": `devui-skeleton ${renderAnimate(props.animate)}`
158
- }, [renderDefaultSkeleton()]);
159
- }
160
- return createVNode(Fragment, null, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
161
- };
30
+ const roundInjectionKey = Symbol("round");
31
+ const animationInjectionKey = Symbol("showAnimation");
32
+ function createBem(namespace, element, modifier) {
33
+ let cls = namespace;
34
+ if (element) {
35
+ cls += `__${element}`;
162
36
  }
163
- });
164
- const itemProps = {
165
- row: {
166
- type: Number,
167
- default: 0
168
- },
169
- animate: {
170
- type: Boolean,
171
- default: true
172
- },
173
- round: {
174
- type: Boolean,
175
- default: false
176
- },
177
- loading: {
178
- type: Boolean,
179
- default: true
180
- },
181
- avatarShape: {
182
- type: String,
183
- default: "round"
184
- },
185
- titleWidth: {
186
- type: [String, Number],
187
- default: "40%"
188
- },
189
- rowWidth: {
190
- type: [Number, String, Array],
191
- default: ["100%"]
192
- },
193
- shape: {
194
- type: String
37
+ if (modifier) {
38
+ cls += `--${modifier}`;
195
39
  }
196
- };
40
+ return cls;
41
+ }
42
+ function useNamespace(block, needDot = false) {
43
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
44
+ const b = () => createBem(namespace);
45
+ const e = (element) => element ? createBem(namespace, element) : "";
46
+ const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
47
+ const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
48
+ return {
49
+ b,
50
+ e,
51
+ m,
52
+ em
53
+ };
54
+ }
55
+ function useSkeletonItem(props) {
56
+ const ns = useNamespace("skeleton-item");
57
+ const { variant, size } = toRefs(props);
58
+ const round = inject(roundInjectionKey, void 0);
59
+ const showAnimation = inject(animationInjectionKey, void 0);
60
+ const classes = computed(() => ({
61
+ [ns.b()]: true,
62
+ [ns.m(variant.value)]: true,
63
+ [ns.m(size.value)]: variant.value !== "square",
64
+ [ns.m("round")]: variant.value !== "circle" && Boolean(round == null ? void 0 : round.value),
65
+ [ns.m("animation")]: Boolean(showAnimation == null ? void 0 : showAnimation.value)
66
+ }));
67
+ return { classes };
68
+ }
69
+ function ImageIcon() {
70
+ return createVNode("svg", {
71
+ "width": "24px",
72
+ "height": "24px",
73
+ "viewBox": "0 0 24 24",
74
+ "version": "1.1",
75
+ "xmlns": "http://www.w3.org/2000/svg"
76
+ }, [createVNode("g", {
77
+ "stroke": "none",
78
+ "stroke-width": "1",
79
+ "fill": "none",
80
+ "fill-rule": "evenodd"
81
+ }, [createVNode("g", null, [createVNode("rect", {
82
+ "fill": "#d8d8d8",
83
+ "opacity": "0",
84
+ "x": "0",
85
+ "y": "0",
86
+ "width": "24",
87
+ "height": "24"
88
+ }, null), createVNode("path", {
89
+ "d": "M17.9783341,3.022 C19.5705758,3.022 20.8816065,4.27616494 20.9732206,5.84628917 L20.9783341,6.022 L20.9783341,15.4777069 L20.9783775,15.4946187 C20.9778434,15.509964 20.9768409,15.525296 20.9753698,15.5405914 L20.9783341,15.4777069 C20.9783341,15.8919205 20.6425477,16.2277069 20.2283341,16.2277069 C19.9841207,16.2277069 19.7671693,16.1109847 19.630224,15.9302845 L16.3835041,12.6846982 C15.9279377,12.2291319 15.2084078,12.1987608 14.7176463,12.593585 L14.6161642,12.6846982 L9.05907272,18.2417898 C8.76083183,18.5400306 8.28304152,18.5577535 7.96352506,18.2824274 C7.67269311,18.0318186 7.64008582,17.5928941 7.89069464,17.3020621 L7.9253008,17.2647549 L7.9253008,17.2647549 L13.5555041,11.6240381 C14.5846517,10.5948904 16.2263561,10.5520093 17.3065502,11.4953946 L17.4441642,11.6240381 L19.4783341,13.658 L19.4783341,6.022 C19.4783341,5.24761276 18.8784495,4.6021759 18.1219124,4.52892169 L17.9783341,4.522 L6.02133414,4.522 C5.24694691,4.522 4.60151004,5.12188468 4.52825583,5.87842174 L4.52133414,6.022 L4.52133414,17.978 C4.52133414,18.7529555 5.12086774,19.397891 5.87769393,19.4710842 L6.02133414,19.478 L17.9783341,19.478 C18.7530944,19.478 19.3982021,18.8786501 19.4714163,18.1216726 L19.4783341,17.978 C19.4783341,17.5637864 19.8141206,17.208 20.2283341,17.228 C20.6425477,17.228 20.9783341,17.5637864 20.9783341,17.978 C20.9783341,19.5709231 19.724442,20.881321 18.1540742,20.9728891 L17.9783341,20.978 L6.02133414,20.978 C4.42880954,20.978 3.11804157,19.7244922 3.02644657,18.1537812 L3.02133414,17.978 L3.02133414,6.022 C3.02133414,4.42975835 4.27549908,3.11872764 5.84562331,3.02711351 L6.02133414,3.022 L17.9783341,3.022 Z M8.99983414,7.7505 C9.6900477,7.7505 10.2498341,8.31028644 10.2498341,9.0005 C10.2498341,9.69071356 9.6900477,10.2505 8.99983414,10.3505 C8.30962058,10.2505 7.74983414,9.69071356 7.74983414,9.0005 C7.74983414,8.31028644 8.30962058,7.7505 8.99983414,7.7505 Z",
90
+ "fill": "#bfbfbf"
91
+ }, null)])])]);
92
+ }
197
93
  var skeletonItem = "";
198
94
  var SkeletonItem = defineComponent({
199
95
  name: "DSkeletonItem",
200
- props: itemProps,
96
+ props: skeletonItemProps,
97
+ setup(props) {
98
+ const {
99
+ variant
100
+ } = toRefs(props);
101
+ const {
102
+ classes
103
+ } = useSkeletonItem(props);
104
+ return () => createVNode("div", {
105
+ "class": classes.value
106
+ }, [variant.value === "image" && createVNode(ImageIcon, null, null)]);
107
+ }
108
+ });
109
+ var skeleton = "";
110
+ var Skeleton = defineComponent({
111
+ name: "DSkeleton",
112
+ props: skeletonProps,
201
113
  setup(props, ctx) {
114
+ const ns = useNamespace("skeleton");
202
115
  const {
203
- slots
204
- } = ctx;
205
- function renderAnimate(isAnimated) {
206
- return isAnimated ? "devui-skeleton__animated" : "";
207
- }
208
- function renderShapeParagraph(rowNum, rowWidth, round) {
209
- const arr = [];
210
- function pushIntoArray(type) {
211
- for (let index2 = 0; index2 < rowNum; index2++) {
212
- arr.push({
213
- width: type
214
- });
215
- }
216
- }
217
- (function handleRowWidth() {
218
- if (rowWidth instanceof Array) {
219
- for (let index2 = 0; index2 < rowNum; index2++) {
220
- if (rowWidth[index2]) {
221
- switch (typeof rowWidth[index2]) {
222
- case "string":
223
- arr.push({
224
- width: rowWidth[index2]
225
- });
226
- break;
227
- case "number":
228
- arr.push({
229
- width: `${rowWidth[index2]}px`
230
- });
231
- }
232
- } else {
233
- arr.push({
234
- width: 1
235
- });
236
- }
237
- }
238
- } else {
239
- switch (typeof rowWidth) {
240
- case "string":
241
- pushIntoArray(rowWidth);
242
- break;
243
- case "number":
244
- pushIntoArray(`${rowWidth}px`);
245
- break;
246
- }
247
- }
248
- })();
249
- return createVNode("div", mergeProps({
250
- "class": `devui-skeleton__shape__paragraph ${renderAnimate(props.animate)}`
251
- }, ctx.attrs), [arr.map((item) => {
252
- return createVNode("div", {
253
- "class": "devui-skeleton__shape__paragraph__item",
254
- "style": round ? "border-radius: 1em;" : `width: ${item.width}`
255
- }, null);
256
- })]);
257
- }
258
- function renderAvatarStyle(avatarShape) {
259
- function renderAvatarShape() {
260
- return avatarShape === "square" ? "" : "border-radius:50%;";
261
- }
262
- return renderAvatarShape();
263
- }
116
+ loading,
117
+ rows,
118
+ showAnimation,
119
+ round
120
+ } = toRefs(props);
121
+ const paragraphs = computed(() => new Array(rows.value).fill(""));
122
+ provide(animationInjectionKey, showAnimation);
123
+ provide(roundInjectionKey, round);
264
124
  return () => {
265
- var _a;
266
- if (props.loading && props.shape) {
267
- switch (props.shape) {
268
- case "avatar":
269
- return createVNode(Fragment, null, [createVNode("div", mergeProps({
270
- "class": `devui-skeleton__shape__avatar ${renderAnimate(props.animate)}`,
271
- "style": renderAvatarStyle(props.avatarShape)
272
- }, ctx.attrs), null)]);
273
- case "paragraph":
274
- return createVNode(Fragment, null, [renderShapeParagraph(props.row, props.rowWidth, props.round)]);
275
- default:
276
- return createVNode(Fragment, null, [createVNode("div", mergeProps({
277
- "class": `devui-skeleton__shape__${props.shape} ${renderAnimate(props.animate)}`
278
- }, ctx.attrs), null)]);
279
- }
280
- }
281
- return createVNode(Fragment, null, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
125
+ var _a, _b;
126
+ return loading.value ? ctx.slots.placeholder ? ctx.slots.placeholder() : createVNode("div", {
127
+ "class": ns.b()
128
+ }, [createVNode(SkeletonItem, {
129
+ "class": ns.e("title")
130
+ }, null), paragraphs.value.map(() => createVNode(SkeletonItem, {
131
+ "class": ns.e("paragraph")
132
+ }, null))]) : (_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a);
282
133
  };
283
134
  }
284
135
  });
@@ -291,4 +142,4 @@ var index = {
291
142
  app.component(SkeletonItem.name, SkeletonItem);
292
143
  }
293
144
  };
294
- export { Skeleton, SkeletonItem, index as default, skeletonProps };
145
+ export { Skeleton, SkeletonItem, animationInjectionKey, index as default, roundInjectionKey, skeletonItemProps, skeletonProps };
@@ -1 +1 @@
1
- (function(d,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(d=typeof globalThis!="undefined"?globalThis:d||self,e(d.index={},d.Vue))})(this,function(d,e){"use strict";const b={row:{type:Number,default:0},animate:{type:Boolean,default:!0},round:{type:Boolean,default:!1},loading:{type:Boolean,default:!0},avatar:{type:Boolean,default:!1},title:{type:Boolean,default:!0},paragraph:{type:Boolean,default:!0},avatarSize:{type:[String,Number],default:"40px"},avatarShape:{type:String,default:"round"},titleWidth:{type:[String,Number],default:"40%"},rowWidth:{type:[Number,String,Array],default:["100%"]}};var V="",p=e.defineComponent({name:"DSkeleton",props:b,setup(t,f){const{slots:s}=f;function h(a){return a?"devui-skeleton__animated":""}function g(a){return a?"border-radius: 1em;":""}function _(a,u,n,r){const c=[];function S(m){for(let o=0;o<u;o++)c.push({width:m})}return function(){if(n instanceof Array)for(let o=0;o<u;o++)if(n[o])switch(typeof n[o]){case"string":c.push({width:n[o]});break;case"number":c.push({width:`${n[o]}px`})}else c.push({width:1});else switch(typeof n){case"string":S(n);break;case"number":S(`${n}px`);break}}(),e.withDirectives(e.createVNode("div",{class:"devui-skeleton__paragraph"},[c.map(m=>e.createVNode("div",{class:"devui-skeleton__item",style:r?"border-radius: 1em;":`width: ${m.width}`},null))]),[[e.vShow,a]])}function l(a,u){function n(){return u==="square"?"":"border-radius:50%;"}function r(){switch(typeof a){case"string":return`width:${a};height:${a};`;case"number":return`width:${a}px;height:${a}px;`}}return r()+n()}function i(a,u,n){function r(){switch(typeof u){case"string":return`width: ${u};`;case"number":return`width: ${u}px;`}}function c(){return a?null:"visibility: hidden;"}return r()+g(n)+c()}function k(){return e.createVNode(e.Fragment,null,[e.withDirectives(e.createVNode("div",{class:"devui-skeleton__avatar"},[e.createVNode("div",{class:"avatar",style:l(t.avatarSize,t.avatarShape)},null)]),[[e.vShow,t.avatar]]),e.createVNode("div",{class:"devui-skeleton__group"},[e.createVNode("div",{class:"devui-skeleton__title",style:i(t.title,t.titleWidth,t.round)},null),_(t.paragraph,t.row,t.rowWidth,t.round)])])}return()=>{var a;return t.loading?e.createVNode("div",{class:`devui-skeleton ${h(t.animate)}`},[k()]):e.createVNode(e.Fragment,null,[(a=s.default)==null?void 0:a.call(s)])}}});const N={row:{type:Number,default:0},animate:{type:Boolean,default:!0},round:{type:Boolean,default:!1},loading:{type:Boolean,default:!0},avatarShape:{type:String,default:"round"},titleWidth:{type:[String,Number],default:"40%"},rowWidth:{type:[Number,String,Array],default:["100%"]},shape:{type:String}};var v="",y=e.defineComponent({name:"DSkeletonItem",props:N,setup(t,f){const{slots:s}=f;function h(l){return l?"devui-skeleton__animated":""}function g(l,i,k){const a=[];function u(n){for(let r=0;r<l;r++)a.push({width:n})}return function(){if(i instanceof Array)for(let r=0;r<l;r++)if(i[r])switch(typeof i[r]){case"string":a.push({width:i[r]});break;case"number":a.push({width:`${i[r]}px`})}else a.push({width:1});else switch(typeof i){case"string":u(i);break;case"number":u(`${i}px`);break}}(),e.createVNode("div",e.mergeProps({class:`devui-skeleton__shape__paragraph ${h(t.animate)}`},f.attrs),[a.map(n=>e.createVNode("div",{class:"devui-skeleton__shape__paragraph__item",style:k?"border-radius: 1em;":`width: ${n.width}`},null))])}function _(l){function i(){return l==="square"?"":"border-radius:50%;"}return i()}return()=>{var l;if(t.loading&&t.shape)switch(t.shape){case"avatar":return e.createVNode(e.Fragment,null,[e.createVNode("div",e.mergeProps({class:`devui-skeleton__shape__avatar ${h(t.animate)}`,style:_(t.avatarShape)},f.attrs),null)]);case"paragraph":return e.createVNode(e.Fragment,null,[g(t.row,t.rowWidth,t.round)]);default:return e.createVNode(e.Fragment,null,[e.createVNode("div",e.mergeProps({class:`devui-skeleton__shape__${t.shape} ${h(t.animate)}`},f.attrs),null)])}return e.createVNode(e.Fragment,null,[(l=s.default)==null?void 0:l.call(s)])}}}),w={title:"Skeleton \u9AA8\u67B6\u5C4F",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(t){t.component(p.name,p),t.component(y.name,y)}};d.Skeleton=p,d.SkeletonItem=y,d.default=w,d.skeletonProps=b,Object.defineProperty(d,"__esModule",{value:!0}),d[Symbol.toStringTag]="Module"});
1
+ (function(o,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(o=typeof globalThis!="undefined"?globalThis:o||self,e(o.index={},o.Vue))})(this,function(o,e){"use strict";const C={variant:{type:String,default:"square"},size:{type:String,default:"md"}},y={rows:{type:Number,default:3},round:{type:Boolean,default:!1},loading:{type:Boolean,default:!0},showAnimation:{type:Boolean,default:!0}},m=Symbol("round"),f=Symbol("showAnimation");function u(l,n,t){let s=l;return n&&(s+=`__${n}`),t&&(s+=`--${t}`),s}function h(l,n=!1){const t=n?`.devui-${l}`:`devui-${l}`;return{b:()=>u(t),e:a=>a?u(t,a):"",m:a=>a?u(t,"",a):"",em:(a,d)=>a&&d?u(t,a,d):""}}function k(l){const n=h("skeleton-item"),{variant:t,size:s}=e.toRefs(l),i=e.inject(m,void 0),r=e.inject(f,void 0);return{classes:e.computed(()=>({[n.b()]:!0,[n.m(t.value)]:!0,[n.m(s.value)]:t.value!=="square",[n.m("round")]:t.value!=="circle"&&Boolean(i==null?void 0:i.value),[n.m("animation")]:Boolean(r==null?void 0:r.value)}))}}function v(){return e.createVNode("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("g",null,[e.createVNode("rect",{fill:"#d8d8d8",opacity:"0",x:"0",y:"0",width:"24",height:"24"},null),e.createVNode("path",{d:"M17.9783341,3.022 C19.5705758,3.022 20.8816065,4.27616494 20.9732206,5.84628917 L20.9783341,6.022 L20.9783341,15.4777069 L20.9783775,15.4946187 C20.9778434,15.509964 20.9768409,15.525296 20.9753698,15.5405914 L20.9783341,15.4777069 C20.9783341,15.8919205 20.6425477,16.2277069 20.2283341,16.2277069 C19.9841207,16.2277069 19.7671693,16.1109847 19.630224,15.9302845 L16.3835041,12.6846982 C15.9279377,12.2291319 15.2084078,12.1987608 14.7176463,12.593585 L14.6161642,12.6846982 L9.05907272,18.2417898 C8.76083183,18.5400306 8.28304152,18.5577535 7.96352506,18.2824274 C7.67269311,18.0318186 7.64008582,17.5928941 7.89069464,17.3020621 L7.9253008,17.2647549 L7.9253008,17.2647549 L13.5555041,11.6240381 C14.5846517,10.5948904 16.2263561,10.5520093 17.3065502,11.4953946 L17.4441642,11.6240381 L19.4783341,13.658 L19.4783341,6.022 C19.4783341,5.24761276 18.8784495,4.6021759 18.1219124,4.52892169 L17.9783341,4.522 L6.02133414,4.522 C5.24694691,4.522 4.60151004,5.12188468 4.52825583,5.87842174 L4.52133414,6.022 L4.52133414,17.978 C4.52133414,18.7529555 5.12086774,19.397891 5.87769393,19.4710842 L6.02133414,19.478 L17.9783341,19.478 C18.7530944,19.478 19.3982021,18.8786501 19.4714163,18.1216726 L19.4783341,17.978 C19.4783341,17.5637864 19.8141206,17.208 20.2283341,17.228 C20.6425477,17.228 20.9783341,17.5637864 20.9783341,17.978 C20.9783341,19.5709231 19.724442,20.881321 18.1540742,20.9728891 L17.9783341,20.978 L6.02133414,20.978 C4.42880954,20.978 3.11804157,19.7244922 3.02644657,18.1537812 L3.02133414,17.978 L3.02133414,6.022 C3.02133414,4.42975835 4.27549908,3.11872764 5.84562331,3.02711351 L6.02133414,3.022 L17.9783341,3.022 Z M8.99983414,7.7505 C9.6900477,7.7505 10.2498341,8.31028644 10.2498341,9.0005 C10.2498341,9.69071356 9.6900477,10.2505 8.99983414,10.3505 C8.30962058,10.2505 7.74983414,9.69071356 7.74983414,9.0005 C7.74983414,8.31028644 8.30962058,7.7505 8.99983414,7.7505 Z",fill:"#bfbfbf"},null)])])])}var w="",c=e.defineComponent({name:"DSkeletonItem",props:C,setup(l){const{variant:n}=e.toRefs(l),{classes:t}=k(l);return()=>e.createVNode("div",{class:t.value},[n.value==="image"&&e.createVNode(v,null,null)])}}),I="",p=e.defineComponent({name:"DSkeleton",props:y,setup(l,n){const t=h("skeleton"),{loading:s,rows:i,showAnimation:r,round:L}=e.toRefs(l),a=e.computed(()=>new Array(i.value).fill(""));return e.provide(f,r),e.provide(m,L),()=>{var d,g;return s.value?n.slots.placeholder?n.slots.placeholder():e.createVNode("div",{class:t.b()},[e.createVNode(c,{class:t.e("title")},null),a.value.map(()=>e.createVNode(c,{class:t.e("paragraph")},null))]):(g=(d=n.slots).default)==null?void 0:g.call(d)}}}),S={title:"Skeleton \u9AA8\u67B6\u5C4F",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(l){l.component(p.name,p),l.component(c.name,c)}};o.Skeleton=p,o.SkeletonItem=c,o.animationInjectionKey=f,o.default=S,o.roundInjectionKey=m,o.skeletonItemProps=C,o.skeletonProps=y,Object.defineProperty(o,"__esModule",{value:!0}),o[Symbol.toStringTag]="Module"});
@@ -1 +1 @@
1
- .devui-skeleton{display:flex;justify-content:space-between}.devui-skeleton__avatar{display:flex;flex:1;justify-content:center;padding-right:16px}.devui-skeleton__avatar .avatar{width:40px;height:40px;background-color:#f2f2f2}.devui-skeleton__group{flex:11}.devui-skeleton__item,.devui-skeleton__title{width:100%;height:16px;background-color:#f2f2f2}.devui-skeleton__title{margin-top:24px}.devui-skeleton__paragraph{margin-top:12px}.devui-skeleton__item:last-child{width:60%}.devui-skeleton__avatar>.avatar,.devui-skeleton__group>div>.devui-skeleton__item{margin-top:12px}.devui-skeleton__animated>.devui-skeleton__group>.devui-skeleton__title,.devui-skeleton__animated>.devui-skeleton__group>div>.devui-skeleton__item,.devui-skeleton__animated>.devui-skeleton__avatar>.avatar{background:linear-gradient(100deg,rgba(255,255,255,0) 40%,rgba(255,255,255,.5) 50%,rgba(255,255,255,0) 60%) #f2f2f2;background-size:200% 100%;background-position-x:180%;animation:2s skeletonLoading ease-in-out infinite}.devui-skeleton__shape__avatar,.devui-skeleton__shape__image,.devui-skeleton__shape__title,.devui-skeleton__shape__button{background-color:#f2f2f2}.devui-skeleton__shape__avatar{width:40px;height:40px;background-color:#f2f2f2}.devui-skeleton__shape__image{width:200px;height:150px;border-radius:4px}.devui-skeleton__shape__title{width:40%;height:24px}.devui-skeleton__shape__paragraph__item{background-color:#f2f2f2;width:100%;height:16px;margin-bottom:10px}.devui-skeleton__shape__paragraph__item:last-child{width:60%}.devui-skeleton__shape__button{width:115px;height:32px}@keyframes skeletonLoading{to{background-position-x:-20%}}.devui-skeleton__animated .devui-skeleton__shape__avatar,.devui-skeleton__animated.devui-skeleton__shape__avatar,.devui-skeleton__animated.devui-skeleton__shape__image,.devui-skeleton__animated.devui-skeleton__shape__title,.devui-skeleton__animated.devui-skeleton__shape__paragraph>.devui-skeleton__shape__paragraph__item,.devui-skeleton__animated.devui-skeleton__shape__button{background:linear-gradient(100deg,rgba(255,255,255,0) 40%,rgba(255,255,255,.5) 50%,rgba(255,255,255,0) 60%) #f2f2f2;background-size:200% 100%;background-position-x:180%;animation:2s skeletonLoading ease-in-out infinite}
1
+ .devui-skeleton-item{background-color:var(--devui-list-item-hover-bg, #f2f2f3)}.devui-skeleton-item--round{border-radius:var(--devui-border-radius, 4px)}.devui-skeleton-item--square{width:100%;height:16px}.devui-skeleton-item--circle{border-radius:50%}.devui-skeleton-item--circle.devui-skeleton-item--sm{width:20px;height:20px}.devui-skeleton-item--circle.devui-skeleton-item--md{width:40px;height:40px}.devui-skeleton-item--circle.devui-skeleton-item--lg{width:60px;height:60px}.devui-skeleton-item--image{display:flex;justify-content:center;align-items:center}.devui-skeleton-item--image svg{width:40%;height:40%}.devui-skeleton-item--image.devui-skeleton-item--sm{width:50px;height:50px}.devui-skeleton-item--image.devui-skeleton-item--md{width:100px;height:100px}.devui-skeleton-item--image.devui-skeleton-item--lg{width:200px;height:200px}.devui-skeleton-item--animation.devui-skeleton-item{background:linear-gradient(100deg,rgba(255,255,255,0) 40%,rgba(255,255,255,.5) 50%,rgba(255,255,255,0) 60%) var(--devui-list-item-hover-bg, #f2f2f3);background-size:200% 100%;background-position-x:180%;animation:2s skeletonLoading ease-in-out infinite}@keyframes skeletonLoading{to{background-position-x:-20%}}.devui-skeleton{width:100%}.devui-skeleton__paragraph{margin-bottom:12px}.devui-skeleton__paragraph:last-child{width:60%;margin-bottom:0}.devui-skeleton-item.devui-skeleton__title{width:40%;margin-bottom:16px}