vue-devui 1.0.0-rc.8 → 1.0.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 (228) hide show
  1. package/README.md +188 -149
  2. package/alert/index.es.js +14 -9
  3. package/alert/index.umd.js +1 -1
  4. package/alert/style.css +1 -1
  5. package/auto-complete/index.es.js +8392 -418
  6. package/auto-complete/index.umd.js +29 -5
  7. package/auto-complete/style.css +1 -1
  8. package/avatar/index.es.js +59 -74
  9. package/avatar/index.umd.js +1 -1
  10. package/badge/index.es.js +10 -4
  11. package/badge/index.umd.js +1 -1
  12. package/badge/style.css +1 -1
  13. package/button/index.es.js +191 -53
  14. package/button/index.umd.js +17 -17
  15. package/button/style.css +1 -1
  16. package/card/index.es.js +7 -3
  17. package/card/index.umd.js +1 -1
  18. package/card/style.css +1 -1
  19. package/checkbox/index.es.js +8050 -241
  20. package/checkbox/index.umd.js +27 -1
  21. package/checkbox/style.css +1 -1
  22. package/{date-picker → collapse}/index.d.ts +0 -0
  23. package/collapse/index.es.js +213 -0
  24. package/collapse/index.umd.js +1 -0
  25. package/{date-picker → collapse}/package.json +1 -1
  26. package/collapse/style.css +1 -0
  27. package/countdown/index.es.js +56 -13
  28. package/countdown/index.umd.js +1 -1
  29. package/date-picker-pro/index.d.ts +7 -0
  30. package/date-picker-pro/index.es.js +12022 -0
  31. package/date-picker-pro/index.umd.js +27 -0
  32. package/date-picker-pro/package.json +7 -0
  33. package/date-picker-pro/style.css +1 -0
  34. package/drawer/index.es.js +24 -7
  35. package/drawer/index.umd.js +1 -1
  36. package/drawer/style.css +1 -1
  37. package/dropdown/index.es.js +190 -165
  38. package/dropdown/index.umd.js +1 -1
  39. package/dropdown/style.css +1 -1
  40. package/editable-select/index.es.js +785 -145
  41. package/editable-select/index.umd.js +1 -1
  42. package/editable-select/style.css +1 -1
  43. package/form/index.es.js +399 -300
  44. package/form/index.umd.js +16 -16
  45. package/form/style.css +1 -1
  46. package/fullscreen/index.es.js +2 -2
  47. package/fullscreen/index.umd.js +1 -1
  48. package/grid/index.es.js +8 -6
  49. package/grid/index.umd.js +1 -1
  50. package/icon/index.es.js +185 -23
  51. package/icon/index.umd.js +1 -1
  52. package/icon/style.css +1 -0
  53. package/image-preview/index.es.js +2 -2
  54. package/image-preview/index.umd.js +1 -1
  55. package/image-preview/style.css +1 -1
  56. package/input/index.es.js +8220 -45
  57. package/input/index.umd.js +27 -1
  58. package/input/style.css +1 -1
  59. package/input-number/index.es.js +279 -204
  60. package/input-number/index.umd.js +1 -1
  61. package/input-number/style.css +1 -1
  62. package/layout/index.es.js +3 -3
  63. package/layout/index.umd.js +1 -1
  64. package/loading/index.es.js +53 -53
  65. package/loading/index.umd.js +1 -1
  66. package/loading/style.css +1 -1
  67. package/mention/index.d.ts +7 -0
  68. package/mention/index.es.js +8319 -0
  69. package/mention/index.umd.js +36 -0
  70. package/mention/package.json +7 -0
  71. package/mention/style.css +1 -0
  72. package/menu/index.d.ts +7 -0
  73. package/menu/index.es.js +921 -0
  74. package/menu/index.umd.js +1 -0
  75. package/menu/package.json +7 -0
  76. package/menu/style.css +1 -0
  77. package/message/index.d.ts +7 -0
  78. package/message/index.es.js +539 -0
  79. package/message/index.umd.js +1 -0
  80. package/message/package.json +7 -0
  81. package/message/style.css +1 -0
  82. package/modal/index.es.js +451 -173
  83. package/modal/index.umd.js +1 -1
  84. package/modal/style.css +1 -1
  85. package/notification/index.es.js +212 -70
  86. package/notification/index.umd.js +1 -1
  87. package/notification/style.css +1 -1
  88. package/nuxt/components/CheckboxButton.js +3 -0
  89. package/nuxt/components/Collapse.js +3 -0
  90. package/nuxt/components/CollapseItem.js +3 -0
  91. package/nuxt/components/DRangeDatePickerPro.js +3 -0
  92. package/nuxt/components/DatePickerPro.js +3 -0
  93. package/nuxt/components/Icon.js +1 -0
  94. package/nuxt/components/IconGroup.js +3 -0
  95. package/nuxt/components/LABEL_DATA.js +3 -0
  96. package/nuxt/components/Mention.js +3 -0
  97. package/nuxt/components/Menu.js +3 -0
  98. package/nuxt/components/MenuItem.js +3 -0
  99. package/nuxt/components/Message.js +3 -0
  100. package/nuxt/components/Option.js +3 -0
  101. package/nuxt/components/OptionGroup.js +3 -0
  102. package/nuxt/components/RadioButton.js +3 -0
  103. package/nuxt/components/Step.js +3 -0
  104. package/nuxt/components/Steps.js +3 -0
  105. package/nuxt/components/SubMenu.js +3 -0
  106. package/nuxt/components/TABLE_TOKEN.js +3 -0
  107. package/nuxt/components/TimePicker.js +3 -0
  108. package/nuxt/components/TimeSelect.js +3 -0
  109. package/nuxt/components/animationInjectionKey.js +3 -0
  110. package/nuxt/components/collapseItemProps.js +3 -0
  111. package/nuxt/components/collapseProps.js +3 -0
  112. package/nuxt/components/datePickerProCommonProps.js +3 -0
  113. package/nuxt/components/datePickerProPanelProps.js +3 -0
  114. package/nuxt/components/datePickerProProps.js +3 -0
  115. package/nuxt/components/iconProps.js +1 -0
  116. package/nuxt/components/mentionProps.js +3 -0
  117. package/nuxt/components/messageProps.js +3 -0
  118. package/nuxt/components/paginationInjectionKey.js +3 -0
  119. package/nuxt/components/roundInjectionKey.js +3 -0
  120. package/nuxt/components/skeletonItemProps.js +3 -0
  121. package/nuxt/components/stepProps.js +3 -0
  122. package/nuxt/components/stepsProps.js +3 -0
  123. package/nuxt/components/svgIconProps.js +3 -0
  124. package/nuxt/components/tableProps.js +3 -0
  125. package/nuxt/components/timerPickerPanelProps.js +3 -0
  126. package/nuxt/components/treeNodeProps.js +3 -0
  127. package/overlay/index.es.js +89 -142
  128. package/overlay/index.umd.js +1 -1
  129. package/overlay/style.css +1 -1
  130. package/package.json +8 -4
  131. package/pagination/index.es.js +10180 -129
  132. package/pagination/index.umd.js +27 -1
  133. package/pagination/style.css +1 -1
  134. package/panel/index.es.js +4 -0
  135. package/panel/index.umd.js +1 -1
  136. package/panel/style.css +1 -1
  137. package/popover/index.es.js +262 -229
  138. package/popover/index.umd.js +15 -15
  139. package/popover/style.css +1 -1
  140. package/progress/index.es.js +2 -2
  141. package/progress/index.umd.js +2 -2
  142. package/progress/style.css +1 -1
  143. package/radio/index.es.js +7954 -156
  144. package/radio/index.umd.js +27 -1
  145. package/radio/style.css +1 -1
  146. package/rate/index.es.js +16 -8
  147. package/rate/index.umd.js +1 -1
  148. package/rate/style.css +1 -1
  149. package/result/index.es.js +170 -22
  150. package/result/index.umd.js +1 -1
  151. package/result/style.css +1 -1
  152. package/search/index.es.js +3829 -1042
  153. package/search/index.umd.js +18 -18
  154. package/search/style.css +1 -1
  155. package/select/index.es.js +9202 -495
  156. package/select/index.umd.js +27 -1
  157. package/select/style.css +1 -1
  158. package/skeleton/index.es.js +89 -263
  159. package/skeleton/index.umd.js +1 -1
  160. package/skeleton/style.css +1 -1
  161. package/slider/index.es.js +118 -145
  162. package/slider/index.umd.js +1 -1
  163. package/slider/style.css +1 -1
  164. package/splitter/index.es.js +454 -233
  165. package/splitter/index.umd.js +13 -13
  166. package/splitter/style.css +1 -1
  167. package/statistic/index.es.js +34 -16
  168. package/statistic/index.umd.js +1 -1
  169. package/statistic/style.css +1 -1
  170. package/status/index.es.js +6 -2
  171. package/status/index.umd.js +1 -1
  172. package/status/style.css +1 -1
  173. package/steps/index.d.ts +7 -0
  174. package/steps/index.es.js +387 -0
  175. package/steps/index.umd.js +1 -0
  176. package/steps/package.json +7 -0
  177. package/steps/style.css +1 -0
  178. package/style.css +1 -1
  179. package/switch/index.es.js +7787 -62
  180. package/switch/index.umd.js +27 -1
  181. package/switch/style.css +1 -1
  182. package/table/index.es.js +5225 -1726
  183. package/table/index.umd.js +18 -18
  184. package/table/style.css +1 -1
  185. package/tabs/index.es.js +303 -102
  186. package/tabs/index.umd.js +1 -1
  187. package/tabs/style.css +1 -1
  188. package/tag/index.es.js +11 -8
  189. package/tag/index.umd.js +1 -1
  190. package/tag/style.css +1 -1
  191. package/textarea/index.es.js +7876 -41
  192. package/textarea/index.umd.js +35 -1
  193. package/textarea/style.css +1 -1
  194. package/time-picker/index.d.ts +7 -0
  195. package/time-picker/index.es.js +9549 -0
  196. package/time-picker/index.umd.js +27 -0
  197. package/time-picker/package.json +7 -0
  198. package/time-picker/style.css +1 -0
  199. package/time-select/index.d.ts +7 -0
  200. package/time-select/index.es.js +9607 -0
  201. package/time-select/index.umd.js +27 -0
  202. package/time-select/package.json +7 -0
  203. package/time-select/style.css +1 -0
  204. package/timeline/index.es.js +170 -22
  205. package/timeline/index.umd.js +1 -1
  206. package/timeline/style.css +1 -1
  207. package/tooltip/index.es.js +286 -238
  208. package/tooltip/index.umd.js +14 -14
  209. package/tooltip/style.css +1 -1
  210. package/tree/index.es.js +11342 -793
  211. package/tree/index.umd.js +27 -1
  212. package/tree/style.css +1 -1
  213. package/upload/index.es.js +458 -102
  214. package/upload/index.umd.js +1 -1
  215. package/upload/style.css +1 -1
  216. package/vue-devui.es.js +20475 -11072
  217. package/vue-devui.umd.js +31 -24
  218. package/date-picker/index.es.js +0 -1097
  219. package/date-picker/index.umd.js +0 -1
  220. package/date-picker/style.css +0 -1
  221. package/nuxt/components/DatePicker.js +0 -3
  222. package/nuxt/components/FormControl.js +0 -3
  223. package/nuxt/components/FormLabel.js +0 -3
  224. package/nuxt/components/Loading.js +0 -3
  225. package/nuxt/components/StickSlider.js +0 -3
  226. package/nuxt/components/formControlProps.js +0 -3
  227. package/nuxt/components/overlayEmits.js +0 -3
  228. package/nuxt/components/overlayProps.js +0 -3
@@ -1,4 +1,4 @@
1
- import { createVNode, defineComponent, toRefs, ref, watch } from "vue";
1
+ import { createVNode, defineComponent, toRefs, ref, computed, watch } from "vue";
2
2
  const IconBody = (props) => {
3
3
  const {
4
4
  width,
@@ -147,8 +147,8 @@ function createBem(namespace, element, modifier) {
147
147
  }
148
148
  return cls;
149
149
  }
150
- function useNamespace(block) {
151
- const namespace = `devui-${block}`;
150
+ function useNamespace(block, needDot = false) {
151
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
152
152
  const b = () => createBem(namespace);
153
153
  const e = (element) => element ? createBem(namespace, element) : "";
154
154
  const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
@@ -170,14 +170,20 @@ var Avatar = defineComponent({
170
170
  width,
171
171
  height,
172
172
  customText,
173
- gender
173
+ gender,
174
+ imgSrc,
175
+ isRound
174
176
  } = toRefs(props);
175
177
  const isNobody = ref(true);
176
178
  const isErrorImg = ref(false);
177
179
  const fontSize = ref(12);
178
- const code = ref();
180
+ const code = ref(1);
179
181
  const nameDisplay = ref();
180
182
  const ns = useNamespace("avatar");
183
+ const styleNS = ns.e("style");
184
+ const bgNS = computed(() => {
185
+ return ns.m(`${"background-" + code.value}`);
186
+ });
181
187
  const getBackgroundColor = (char) => {
182
188
  if (gender.value) {
183
189
  if (gender.value.toLowerCase() === "male") {
@@ -185,7 +191,7 @@ var Avatar = defineComponent({
185
191
  } else if (gender.value.toLowerCase() === "female") {
186
192
  code.value = 0;
187
193
  } else {
188
- throw new Error('gender must be "Male" or "Female"');
194
+ console.warn('gender must be "Male" or "Female"');
189
195
  }
190
196
  return;
191
197
  }
@@ -241,75 +247,54 @@ var Avatar = defineComponent({
241
247
  watch([name, width, height, customText, gender], () => {
242
248
  calcValues(customText.value ? customText.value : name.value);
243
249
  });
244
- return {
245
- showErrorAvatar,
246
- isErrorImg,
247
- code,
248
- fontSize,
249
- nameDisplay,
250
- isNobody,
251
- ns
250
+ return () => {
251
+ var _a, _b;
252
+ const imgElement = createVNode("img", {
253
+ "src": imgSrc.value,
254
+ "alt": "",
255
+ "onError": showErrorAvatar,
256
+ "style": {
257
+ height: `${height.value}px`,
258
+ width: `${width.value}px`,
259
+ borderRadius: isRound.value ? "100%" : "0"
260
+ }
261
+ }, null);
262
+ const hasImgSrc = imgSrc.value && !isErrorImg.value ? imgElement : null;
263
+ const nameElement = createVNode("span", {
264
+ "class": [styleNS, bgNS.value],
265
+ "style": {
266
+ height: `${height.value}px`,
267
+ width: `${width.value}px`,
268
+ lineHeight: `${height.value}px`,
269
+ fontSize: `${fontSize.value}px`,
270
+ borderRadius: isRound.value ? "100%" : "0"
271
+ }
272
+ }, [nameDisplay.value]);
273
+ const hasNameDisplay = !imgSrc.value && !isNobody.value && ((_a = nameDisplay.value) == null ? void 0 : _a.length) !== 0 ? nameElement : null;
274
+ const noNameElement = createVNode("span", {
275
+ "class": styleNS,
276
+ "style": {
277
+ borderRadius: isRound.value ? "100%" : "0"
278
+ }
279
+ }, [createVNode(AvatarBodyIcon, {
280
+ "width": width.value,
281
+ "height": height.value
282
+ }, null)]);
283
+ const hasNoDisplayName = !imgSrc.value && !isNobody.value && ((_b = nameDisplay.value) == null ? void 0 : _b.length) === 0 ? noNameElement : null;
284
+ const noBodyElement = createVNode("span", {
285
+ "class": styleNS,
286
+ "style": {
287
+ borderRadius: isRound.value ? "100%" : "0"
288
+ }
289
+ }, [createVNode(AvatarNoBodyIcon, {
290
+ "width": width.value,
291
+ "height": height.value
292
+ }, null)]);
293
+ const noBody = !imgSrc.value && isNobody.value || isErrorImg.value ? noBodyElement : null;
294
+ return createVNode("span", {
295
+ "class": ns.b()
296
+ }, [hasImgSrc, hasNameDisplay, hasNoDisplayName, noBody]);
252
297
  };
253
- },
254
- render() {
255
- const {
256
- imgSrc,
257
- showErrorAvatar,
258
- height,
259
- width,
260
- isRound,
261
- isErrorImg,
262
- code,
263
- fontSize,
264
- nameDisplay,
265
- isNobody,
266
- ns
267
- } = this;
268
- const imgElement = createVNode("img", {
269
- "src": imgSrc,
270
- "alt": "",
271
- "onError": showErrorAvatar,
272
- "style": {
273
- height: `${height}px`,
274
- width: `${width}px`,
275
- borderRadius: isRound ? "100%" : "0"
276
- }
277
- }, null);
278
- const hasImgSrc = imgSrc && !isErrorImg ? imgElement : null;
279
- const nameElement = createVNode("span", {
280
- "class": [ns.e("style"), ns.m(`background-${code}`)],
281
- "style": {
282
- height: `${height}px`,
283
- width: `${width}px`,
284
- lineHeight: `${height}px`,
285
- fontSize: `${fontSize}px`,
286
- borderRadius: isRound ? "100%" : "0"
287
- }
288
- }, [nameDisplay]);
289
- const hasNameDisplay = !imgSrc && !isNobody && (nameDisplay == null ? void 0 : nameDisplay.length) !== 0 ? nameElement : null;
290
- const noNameElement = createVNode("span", {
291
- "class": ns.e("style"),
292
- "style": {
293
- borderRadius: isRound ? "100%" : "0"
294
- }
295
- }, [createVNode(AvatarBodyIcon, {
296
- "width": width,
297
- "height": height
298
- }, null)]);
299
- const hasNoDisplayName = !imgSrc && !isNobody && (nameDisplay == null ? void 0 : nameDisplay.length) === 0 ? noNameElement : null;
300
- const noBodyElement = createVNode("span", {
301
- "class": ns.e("style"),
302
- "style": {
303
- borderRadius: isRound ? "100%" : "0"
304
- }
305
- }, [createVNode(AvatarNoBodyIcon, {
306
- "width": width,
307
- "height": height
308
- }, null)]);
309
- const noBody = !imgSrc && isNobody || isErrorImg ? noBodyElement : null;
310
- return createVNode("span", {
311
- "class": ns.b()
312
- }, [hasImgSrc, hasNameDisplay, hasNoDisplayName, noBody]);
313
298
  }
314
299
  });
315
300
  var index = {
@@ -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=t=>{const{width:r,height:s}=t;return e.createVNode("svg",{style:{width:`${r}px`,height:`${s}px`,verticalAlign:"middle"},viewBox:"0 0 30 30",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},[e.createVNode("g",{id:"\u672A\u547D\u540D",stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("circle",{id:"Oval",fill:"#CACFD8",cx:"15",cy:"15",r:"15"},null),e.createVNode("path",{d:"M14.9997866,16 C12.5145053,16 10.4997866,13.9852814 10.4997866, 11.5 C10.4997866,9.01471863 12.5145053,7 14.9997866,7 C17.485068, 7 19.4997866,9.01471863 19.4997866,11.5 C19.4997866,13.9852814 17.485068, 16 14.9997866,16 Z M23,23 L7,22.998553 C7,19.0122153 10.8892296, 16.5 14.9997866,16.5 C19.1103437,16.5 23,20 23,23 Z",id:"\u5F62\u72B6\u7ED3\u5408",fill:"#FFFFFF"},null)])])};var Z=e.defineComponent({name:"AvatarBodyIcon",props:{width:{type:Number,default:16},height:{type:Number,default:16}},render(){const{width:t,height:r}=this;return e.createVNode(b,{width:t,height:r},null)}});const x=t=>{const{width:r,height:s}=t;return e.createVNode("svg",{style:{width:`${r}px`,height:`${s}px`,verticalAlign:"middle"},viewBox:"0 0 30 30",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("path",{d:"M22.31,19.2474562 L22.31,21.9974562 L20.81,21.9974562 L20.81, 19.2474562 L18.06,19.2474562 L18.06,17.7474562 L20.81,17.7474562 L20.81, 14.9974562 L22.31,14.9974562 L22.31,17.7474562 L25.06,17.7474562 L25.06, 19.2474562 L22.31,19.2474562 Z M14.9297866,14.9974562 C12.4445053, 14.9974562 10.4297866,12.9827376 10.4297866,10.4974562 C10.4297866, 8.01217483 12.4445053,5.9974562 14.9297866,5.9974562 C17.415068, 5.9974562 19.4297866,8.01217483 19.4297866,10.4974562 C19.4297866, 12.9827376 17.415068,14.9974562 14.9297866,14.9974562 Z M19.6797866, 20.2474562 L19.6797866,21.9971623 L6.93,21.9960092 C6.93,18.0096715 10.8192296, 15.4974562 14.9297866,15.4974562 C16.4608397,15.4974562 17.9612467,15.983021 19.2414296, 16.7474562 L17.06,16.7474562 L17.06,20.2474562 L19.6797866,20.2474562 Z",id:"\u5F62\u72B6\u7ED3\u5408",fill:"#959EB2"},null),e.createVNode("path",{d:"M0,15 L1,15 C1,15.6118966 1.03919561,16.2186526 1.11683409, 16.8178549 L0.125124012,16.9463505 C0.0425740367,16.309242 0, 15.6595925 0,15 Z M0.503241262,18.867175 L1.46961749,18.6100428 C1.62594651, 19.1975718 1.8203704,19.7729973 2.05141295,20.3332823 L1.12693074, 20.7145074 C0.880599065,20.1171459 0.67172715,19.500393 0.503241262, 18.867175 Z M1.99122134,22.4730778 L2.85786221,21.9741453 C3.16078316, 22.5003161 3.49772502,23.0063252 3.86631639,23.4889602 L3.0715754, 24.0959089 C2.6777461,23.5802273 2.31659753,23.0382531 1.99122134, 22.4730778 Z M4.38894559,25.6021078 L5.09634867,24.8952974 C5.52582519, 25.3251341 5.98272136,25.7268214 6.46397085,26.0975793 L5.85367498, 26.8897529 C5.33779918,26.4923186 4.84851395,26.0620615 4.38894559, 25.6021078 Z M7.4424647,27.9597887 L7.94703323,27.096417 C8.47111119, 27.4026968 9.0146817,27.6746032 9.57453904,27.9101878 L9.18668461, 28.8319084 C8.58423501,28.5784013 8.00181692,28.2866833 7.4424647, 27.9597887 Z M11.0671021,29.4791103 L11.3286494,28.5139196 C11.9126912, 28.6721832 12.5080563,28.7925378 13.1119738,28.8738935 L12.9784667, 29.8649413 C12.3271613,29.7772019 11.6891102,29.647662 11.0671021, 29.4791103 Z M15,30 C14.9951965,30 14.9903936,29.9999977 14.9855912, 30 L14.9865313,28.9999937 C14.9929361,28.9999987 14.9929361, 28.9999987 14.999296,29 C15.6071552,29 16.2093364,28.9614092 16.8041774, 28.8849313 L16.9316965,29.8767674 C16.2992813,29.9580762 15.6545362, 30 15,30 Z M18.8545762,29.5001051 L18.5982903,28.5335041 C19.1860387, 28.3776677 19.7617059,28.1837179 20.3222555,27.9531286 L20.7026875, 28.8779375 C20.1050484,29.123784 19.4880358,29.3321488 18.8545762, 29.5001051 Z M22.4608087,28.0158343 L21.9626951,27.1487226 C22.4893928, 26.8461604 22.9959399,26.5095265 23.479119,26.1411926 L24.0853678, 26.9364676 C23.5691101,27.3300178 23.0265585,27.6908386 22.4608087, 28.0158343 Z M25.5921583,25.6209863 L24.8860071,24.9129252 C25.3161421, 24.4839504 25.7181674,24.0275419 26.0893023,23.5467621 L26.8808873, 24.1578212 C26.4830546,24.6731862 26.0524368,25.1619493 25.5921583, 25.6209863 Z M27.9526445,22.5697466 L27.0897495,22.0643633 C27.3964738, 21.5406601 27.6688549,20.9974409 27.904942,20.4379104 L28.8262855, 20.8266601 C28.5722411,21.4287497 28.2800163,22.0107897 27.9526445, 22.5697466 Z M29.4756977,18.9454696 L28.5107363,18.6830777 C28.6695136, 18.099165 28.7903877,17.5039035 28.8722662,16.9000659 L29.8631978, 17.0344333 C29.7748946,17.6856516 29.6447979,18.3235936 29.4756977, 18.9454696 Z M30,15 C30,15.0093541 29.9999914,15.0187063 29.9999743, 15.0280564 L28.999976,15.0262257 C28.9999956,15.0134169 28.9999956, 15.0134169 29,15.0006466 C29,14.3970304 28.9619395,13.7989704 28.8865088, 13.208136 L29.8784576,13.0814959 C29.9586571,13.7096843 30,14.3500145 30, 15 Z M29.5038108,11.1594275 L28.5369608,11.4147728 C28.3816616, 10.8267413 28.1882232,10.2507676 27.9581175,9.68988857 L28.8832852, 9.31033004 C29.1286141,9.90831524 29.3364318,10.5256569 29.5038108, 11.1594275 Z M28.0228788,7.55146763 L27.1552968,8.0487618 C26.853241, 7.52179373 26.5170958,7.0149453 26.1492295,6.53143425 L26.9450761, 5.92593594 C27.3381231,6.44254364 27.6984223,6.98541919 28.0228788, 7.55146763 Z M25.6309089,4.41780044 L24.9221905,5.12329189 C24.4935639, 4.69270467 24.0374698,4.2902078 23.5569705,3.9185855 L24.1687554, 3.12756133 C24.6838129,3.52591118 25.1722392,3.95703271 25.6309089, 4.41780044 Z M22.5819506,2.05451093 L22.0757531,2.91692851 C21.5523008, 2.60968727 21.0092999,2.33677531 20.4499564,2.10014728 L20.8395722, 1.17916981 C21.4414531,1.43379309 22.0232574,1.72658499 22.5819506, 2.05451093 Z M18.9594329,0.528106464 L18.696103,1.4928123 C18.1122842, 1.33345081 17.517086,1.21199245 16.9132846,1.12953261 L17.0485964, 0.138729543 C17.6997753,0.227659622 18.3376514,0.358382523 18.9594329, 0.528106464 Z M15,-1.11022302e-16 C15.0139048,-1.11022302e-16 15.0278052, 1.892004e-05 15.0417011,5.673578e-05 L15.0389797,1.00005303 C15.0197685, 1.00000934 15.0197685,1.00000934 15.0005868,1.00000001 C14.4012162, 1 13.8072783,1.03753392 13.2204527,1.11192427 L13.0946918,0.119863691 C13.7186509, 0.0407660189 14.3545651,-1.11022302e-16 15,-1.11022302e-16 Z M11.1720354, 0.492865376 L11.4265338,1.45993857 C10.8386468,1.61464899 10.2627801, 1.80746996 9.70196444,2.03693489 L9.32327455,1.11141127 C9.92118954, 0.86676666 10.5384173,0.659610554 11.1720354,0.492865376 Z M7.56375123, 1.97008801 L8.06022548,2.83813946 C7.53298826,3.13968806 7.02583975, 3.47534367 6.54199783,3.84274131 L5.93725081,3.04632368 C6.4542073, 2.65378102 6.99740556,2.29400434 7.56375123,1.97008801 Z M4.42776842, 4.35917772 L5.13259949,5.06855291 C4.70156141,5.49682984 4.29859416, 5.95260763 3.92648544,6.43282469 L3.13602297,5.82031423 C3.53488885, 5.30556625 3.96651291,4.81747851 4.42776842,4.35917772 Z M2.0616775, 7.40585279 L2.92361696,7.91286401 C2.61586086,8.43606175 2.34241977, 8.97884042 2.10525197,9.53799293 L1.18464153,9.14751063 C1.43984243, 8.54584288 1.73319965,7.96427837 2.0616775,7.40585279 Z M0.531541456, 11.0280046 L1.49601653,11.2921785 C1.33614878,11.8758413 1.21417484, 12.4709081 1.13119244,13.074601 L0.140507978,12.9384235 C0.230001486, 12.2873626 0.361276825,11.6496255 0.531541456,11.0280046 Z",id:"\u8499\u7248",fill:"#CACFD8","fill-rule":"nonzero"},null)])])};var A=e.defineComponent({name:"AvatarNobodyIcon",props:{width:{type:Number,default:16},height:{type:Number,default:16}},render(){const{width:t,height:r}=this;return e.createVNode(x,{width:t,height:r},null)}});const M={name:{type:String,default:null},gender:{type:String,default:null},width:{type:Number,default:36},height:{type:Number,default:36},isRound:{type:Boolean,default:!0},imgSrc:{type:String,default:""},customText:{type:String,default:null}};function p(t,r,s){let i=t;return r&&(i+=`__${r}`),s&&(i+=`--${s}`),i}function $(t){const r=`devui-${t}`;return{b:()=>p(r),e:n=>n?p(r,n):"",m:n=>n?p(r,"",n):"",em:(n,L)=>n&&L?p(r,n,L):""}}var S="",m=e.defineComponent({name:"DAvatar",props:M,setup(t){const{name:r,width:s,height:i,customText:a,gender:C}=e.toRefs(t),n=e.ref(!0),L=e.ref(!1),c=e.ref(12),h=e.ref(),l=e.ref(),y=$("avatar"),g=o=>{if(C.value){if(C.value.toLowerCase()==="male")h.value=1;else if(C.value.toLowerCase()==="female")h.value=0;else throw new Error('gender must be "Male" or "Female"');return}const u=o.charCodeAt(0);h.value=u%2},w=(o,u)=>{if(a.value){l.value=a.value,g(a.value.substr(0,1));return}if(o.length<2)l.value=o;else if(/^[\u4e00-\u9fa5]/.test(o))l.value=o.substr(o.length-2,2);else if(/^[A-Za-z]/.test(o))if(/[_ -]/.test(o)){const f=o.split(/_|-|\s+/)[0],E=o.split(/_|-|\s+/)[1];l.value=f.substr(0,1).toUpperCase()+E.substr(0,1).toUpperCase()}else l.value=o.substr(0,2).toUpperCase();else l.value=o.substr(0,2);u<30&&(l.value=o.substr(0,1).toUpperCase()),g(o.substr(0,1))},N=()=>{L.value=!0},v=o=>{const u=o,f=Math.min(s.value,i.value);u?(n.value=!1,w(u,f)):u===""?(n.value=!1,l.value=""):n.value=!0,c.value=f/4+3};return v(a.value?a.value:r.value),e.watch([r,s,i,a,C],()=>{v(a.value?a.value:r.value)}),{showErrorAvatar:N,isErrorImg:L,code:h,fontSize:c,nameDisplay:l,isNobody:n,ns:y}},render(){const{imgSrc:t,showErrorAvatar:r,height:s,width:i,isRound:a,isErrorImg:C,code:n,fontSize:L,nameDisplay:c,isNobody:h,ns:l}=this,y=e.createVNode("img",{src:t,alt:"",onError:r,style:{height:`${s}px`,width:`${i}px`,borderRadius:a?"100%":"0"}},null),g=t&&!C?y:null,w=e.createVNode("span",{class:[l.e("style"),l.m(`background-${n}`)],style:{height:`${s}px`,width:`${i}px`,lineHeight:`${s}px`,fontSize:`${L}px`,borderRadius:a?"100%":"0"}},[c]),N=!t&&!h&&(c==null?void 0:c.length)!==0?w:null,v=e.createVNode("span",{class:l.e("style"),style:{borderRadius:a?"100%":"0"}},[e.createVNode(Z,{width:i,height:s},null)]),o=!t&&!h&&(c==null?void 0:c.length)===0?v:null,u=e.createVNode("span",{class:l.e("style"),style:{borderRadius:a?"100%":"0"}},[e.createVNode(A,{width:i,height:s},null)]),f=!t&&h||C?u:null;return e.createVNode("span",{class:l.b()},[g,N,o,f])}}),B={title:"Avatar \u5934\u50CF",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(t){t.component(m.name,m)}};d.Avatar=m,d.avatarProps=M,d.default=B,Object.defineProperty(d,"__esModule",{value:!0}),d[Symbol.toStringTag]="Module"});
1
+ (function(u,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(u=typeof globalThis!="undefined"?globalThis:u||self,e(u.index={},u.Vue))})(this,function(u,e){"use strict";const $=a=>{const{width:s,height:l}=a;return e.createVNode("svg",{style:{width:`${s}px`,height:`${l}px`,verticalAlign:"middle"},viewBox:"0 0 30 30",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},[e.createVNode("g",{id:"\u672A\u547D\u540D",stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("circle",{id:"Oval",fill:"#CACFD8",cx:"15",cy:"15",r:"15"},null),e.createVNode("path",{d:"M14.9997866,16 C12.5145053,16 10.4997866,13.9852814 10.4997866, 11.5 C10.4997866,9.01471863 12.5145053,7 14.9997866,7 C17.485068, 7 19.4997866,9.01471863 19.4997866,11.5 C19.4997866,13.9852814 17.485068, 16 14.9997866,16 Z M23,23 L7,22.998553 C7,19.0122153 10.8892296, 16.5 14.9997866,16.5 C19.1103437,16.5 23,20 23,23 Z",id:"\u5F62\u72B6\u7ED3\u5408",fill:"#FFFFFF"},null)])])};var S=e.defineComponent({name:"AvatarBodyIcon",props:{width:{type:Number,default:16},height:{type:Number,default:16}},render(){const{width:a,height:s}=this;return e.createVNode($,{width:a,height:s},null)}});const B=a=>{const{width:s,height:l}=a;return e.createVNode("svg",{style:{width:`${s}px`,height:`${l}px`,verticalAlign:"middle"},viewBox:"0 0 30 30",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("path",{d:"M22.31,19.2474562 L22.31,21.9974562 L20.81,21.9974562 L20.81, 19.2474562 L18.06,19.2474562 L18.06,17.7474562 L20.81,17.7474562 L20.81, 14.9974562 L22.31,14.9974562 L22.31,17.7474562 L25.06,17.7474562 L25.06, 19.2474562 L22.31,19.2474562 Z M14.9297866,14.9974562 C12.4445053, 14.9974562 10.4297866,12.9827376 10.4297866,10.4974562 C10.4297866, 8.01217483 12.4445053,5.9974562 14.9297866,5.9974562 C17.415068, 5.9974562 19.4297866,8.01217483 19.4297866,10.4974562 C19.4297866, 12.9827376 17.415068,14.9974562 14.9297866,14.9974562 Z M19.6797866, 20.2474562 L19.6797866,21.9971623 L6.93,21.9960092 C6.93,18.0096715 10.8192296, 15.4974562 14.9297866,15.4974562 C16.4608397,15.4974562 17.9612467,15.983021 19.2414296, 16.7474562 L17.06,16.7474562 L17.06,20.2474562 L19.6797866,20.2474562 Z",id:"\u5F62\u72B6\u7ED3\u5408",fill:"#959EB2"},null),e.createVNode("path",{d:"M0,15 L1,15 C1,15.6118966 1.03919561,16.2186526 1.11683409, 16.8178549 L0.125124012,16.9463505 C0.0425740367,16.309242 0, 15.6595925 0,15 Z M0.503241262,18.867175 L1.46961749,18.6100428 C1.62594651, 19.1975718 1.8203704,19.7729973 2.05141295,20.3332823 L1.12693074, 20.7145074 C0.880599065,20.1171459 0.67172715,19.500393 0.503241262, 18.867175 Z M1.99122134,22.4730778 L2.85786221,21.9741453 C3.16078316, 22.5003161 3.49772502,23.0063252 3.86631639,23.4889602 L3.0715754, 24.0959089 C2.6777461,23.5802273 2.31659753,23.0382531 1.99122134, 22.4730778 Z M4.38894559,25.6021078 L5.09634867,24.8952974 C5.52582519, 25.3251341 5.98272136,25.7268214 6.46397085,26.0975793 L5.85367498, 26.8897529 C5.33779918,26.4923186 4.84851395,26.0620615 4.38894559, 25.6021078 Z M7.4424647,27.9597887 L7.94703323,27.096417 C8.47111119, 27.4026968 9.0146817,27.6746032 9.57453904,27.9101878 L9.18668461, 28.8319084 C8.58423501,28.5784013 8.00181692,28.2866833 7.4424647, 27.9597887 Z M11.0671021,29.4791103 L11.3286494,28.5139196 C11.9126912, 28.6721832 12.5080563,28.7925378 13.1119738,28.8738935 L12.9784667, 29.8649413 C12.3271613,29.7772019 11.6891102,29.647662 11.0671021, 29.4791103 Z M15,30 C14.9951965,30 14.9903936,29.9999977 14.9855912, 30 L14.9865313,28.9999937 C14.9929361,28.9999987 14.9929361, 28.9999987 14.999296,29 C15.6071552,29 16.2093364,28.9614092 16.8041774, 28.8849313 L16.9316965,29.8767674 C16.2992813,29.9580762 15.6545362, 30 15,30 Z M18.8545762,29.5001051 L18.5982903,28.5335041 C19.1860387, 28.3776677 19.7617059,28.1837179 20.3222555,27.9531286 L20.7026875, 28.8779375 C20.1050484,29.123784 19.4880358,29.3321488 18.8545762, 29.5001051 Z M22.4608087,28.0158343 L21.9626951,27.1487226 C22.4893928, 26.8461604 22.9959399,26.5095265 23.479119,26.1411926 L24.0853678, 26.9364676 C23.5691101,27.3300178 23.0265585,27.6908386 22.4608087, 28.0158343 Z M25.5921583,25.6209863 L24.8860071,24.9129252 C25.3161421, 24.4839504 25.7181674,24.0275419 26.0893023,23.5467621 L26.8808873, 24.1578212 C26.4830546,24.6731862 26.0524368,25.1619493 25.5921583, 25.6209863 Z M27.9526445,22.5697466 L27.0897495,22.0643633 C27.3964738, 21.5406601 27.6688549,20.9974409 27.904942,20.4379104 L28.8262855, 20.8266601 C28.5722411,21.4287497 28.2800163,22.0107897 27.9526445, 22.5697466 Z M29.4756977,18.9454696 L28.5107363,18.6830777 C28.6695136, 18.099165 28.7903877,17.5039035 28.8722662,16.9000659 L29.8631978, 17.0344333 C29.7748946,17.6856516 29.6447979,18.3235936 29.4756977, 18.9454696 Z M30,15 C30,15.0093541 29.9999914,15.0187063 29.9999743, 15.0280564 L28.999976,15.0262257 C28.9999956,15.0134169 28.9999956, 15.0134169 29,15.0006466 C29,14.3970304 28.9619395,13.7989704 28.8865088, 13.208136 L29.8784576,13.0814959 C29.9586571,13.7096843 30,14.3500145 30, 15 Z M29.5038108,11.1594275 L28.5369608,11.4147728 C28.3816616, 10.8267413 28.1882232,10.2507676 27.9581175,9.68988857 L28.8832852, 9.31033004 C29.1286141,9.90831524 29.3364318,10.5256569 29.5038108, 11.1594275 Z M28.0228788,7.55146763 L27.1552968,8.0487618 C26.853241, 7.52179373 26.5170958,7.0149453 26.1492295,6.53143425 L26.9450761, 5.92593594 C27.3381231,6.44254364 27.6984223,6.98541919 28.0228788, 7.55146763 Z M25.6309089,4.41780044 L24.9221905,5.12329189 C24.4935639, 4.69270467 24.0374698,4.2902078 23.5569705,3.9185855 L24.1687554, 3.12756133 C24.6838129,3.52591118 25.1722392,3.95703271 25.6309089, 4.41780044 Z M22.5819506,2.05451093 L22.0757531,2.91692851 C21.5523008, 2.60968727 21.0092999,2.33677531 20.4499564,2.10014728 L20.8395722, 1.17916981 C21.4414531,1.43379309 22.0232574,1.72658499 22.5819506, 2.05451093 Z M18.9594329,0.528106464 L18.696103,1.4928123 C18.1122842, 1.33345081 17.517086,1.21199245 16.9132846,1.12953261 L17.0485964, 0.138729543 C17.6997753,0.227659622 18.3376514,0.358382523 18.9594329, 0.528106464 Z M15,-1.11022302e-16 C15.0139048,-1.11022302e-16 15.0278052, 1.892004e-05 15.0417011,5.673578e-05 L15.0389797,1.00005303 C15.0197685, 1.00000934 15.0197685,1.00000934 15.0005868,1.00000001 C14.4012162, 1 13.8072783,1.03753392 13.2204527,1.11192427 L13.0946918,0.119863691 C13.7186509, 0.0407660189 14.3545651,-1.11022302e-16 15,-1.11022302e-16 Z M11.1720354, 0.492865376 L11.4265338,1.45993857 C10.8386468,1.61464899 10.2627801, 1.80746996 9.70196444,2.03693489 L9.32327455,1.11141127 C9.92118954, 0.86676666 10.5384173,0.659610554 11.1720354,0.492865376 Z M7.56375123, 1.97008801 L8.06022548,2.83813946 C7.53298826,3.13968806 7.02583975, 3.47534367 6.54199783,3.84274131 L5.93725081,3.04632368 C6.4542073, 2.65378102 6.99740556,2.29400434 7.56375123,1.97008801 Z M4.42776842, 4.35917772 L5.13259949,5.06855291 C4.70156141,5.49682984 4.29859416, 5.95260763 3.92648544,6.43282469 L3.13602297,5.82031423 C3.53488885, 5.30556625 3.96651291,4.81747851 4.42776842,4.35917772 Z M2.0616775, 7.40585279 L2.92361696,7.91286401 C2.61586086,8.43606175 2.34241977, 8.97884042 2.10525197,9.53799293 L1.18464153,9.14751063 C1.43984243, 8.54584288 1.73319965,7.96427837 2.0616775,7.40585279 Z M0.531541456, 11.0280046 L1.49601653,11.2921785 C1.33614878,11.8758413 1.21417484, 12.4709081 1.13119244,13.074601 L0.140507978,12.9384235 C0.230001486, 12.2873626 0.361276825,11.6496255 0.531541456,11.0280046 Z",id:"\u8499\u7248",fill:"#CACFD8","fill-rule":"nonzero"},null)])])};var F=e.defineComponent({name:"AvatarNobodyIcon",props:{width:{type:Number,default:16},height:{type:Number,default:16}},render(){const{width:a,height:s}=this;return e.createVNode(B,{width:a,height:s},null)}});const w={name:{type:String,default:null},gender:{type:String,default:null},width:{type:Number,default:36},height:{type:Number,default:36},isRound:{type:Boolean,default:!0},imgSrc:{type:String,default:""},customText:{type:String,default:null}};function L(a,s,l){let n=a;return s&&(n+=`__${s}`),l&&(n+=`--${l}`),n}function E(a,s=!1){const l=s?`.devui-${a}`:`devui-${a}`;return{b:()=>L(l),e:o=>o?L(l,o):"",m:o=>o?L(l,"",o):"",em:(o,d)=>o&&d?L(l,o,d):""}}var U="",p=e.defineComponent({name:"DAvatar",props:w,setup(a){const{name:s,width:l,height:n,customText:i,gender:v,imgSrc:C,isRound:o}=e.toRefs(a),d=e.ref(!0),g=e.ref(!1),M=e.ref(12),f=e.ref(1),r=e.ref(),m=E("avatar"),y=m.e("style"),I=e.computed(()=>m.m(`${"background-"+f.value}`)),Z=t=>{if(v.value){v.value.toLowerCase()==="male"?f.value=1:v.value.toLowerCase()==="female"?f.value=0:console.warn('gender must be "Male" or "Female"');return}const c=t.charCodeAt(0);f.value=c%2},D=(t,c)=>{if(i.value){r.value=i.value,Z(i.value.substr(0,1));return}if(t.length<2)r.value=t;else if(/^[\u4e00-\u9fa5]/.test(t))r.value=t.substr(t.length-2,2);else if(/^[A-Za-z]/.test(t))if(/[_ -]/.test(t)){const h=t.split(/_|-|\s+/)[0],N=t.split(/_|-|\s+/)[1];r.value=h.substr(0,1).toUpperCase()+N.substr(0,1).toUpperCase()}else r.value=t.substr(0,2).toUpperCase();else r.value=t.substr(0,2);c<30&&(r.value=t.substr(0,1).toUpperCase()),Z(t.substr(0,1))},R=()=>{g.value=!0},b=t=>{const c=t,h=Math.min(l.value,n.value);c?(d.value=!1,D(c,h)):c===""?(d.value=!1,r.value=""):d.value=!0,M.value=h/4+3};return b(i.value?i.value:s.value),e.watch([s,l,n,i,v],()=>{b(i.value?i.value:s.value)}),()=>{var x,A;const t=e.createVNode("img",{src:C.value,alt:"",onError:R,style:{height:`${n.value}px`,width:`${l.value}px`,borderRadius:o.value?"100%":"0"}},null),c=C.value&&!g.value?t:null,h=e.createVNode("span",{class:[y,I.value],style:{height:`${n.value}px`,width:`${l.value}px`,lineHeight:`${n.value}px`,fontSize:`${M.value}px`,borderRadius:o.value?"100%":"0"}},[r.value]),N=!C.value&&!d.value&&((x=r.value)==null?void 0:x.length)!==0?h:null,V=e.createVNode("span",{class:y,style:{borderRadius:o.value?"100%":"0"}},[e.createVNode(S,{width:l.value,height:n.value},null)]),k=!C.value&&!d.value&&((A=r.value)==null?void 0:A.length)===0?V:null,T=e.createVNode("span",{class:y,style:{borderRadius:o.value?"100%":"0"}},[e.createVNode(F,{width:l.value,height:n.value},null)]),z=!C.value&&d.value||g.value?T:null;return e.createVNode("span",{class:m.b()},[c,N,k,z])}}}),_={title:"Avatar \u5934\u50CF",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(a){a.component(p.name,p)}};u.Avatar=p,u.avatarProps=w,u.default=_,Object.defineProperty(u,"__esModule",{value:!0}),u[Symbol.toStringTag]="Module"});
package/badge/index.es.js CHANGED
@@ -31,6 +31,10 @@ const badgeProps = {
31
31
  },
32
32
  textColor: {
33
33
  type: String
34
+ },
35
+ hidden: {
36
+ type: Boolean,
37
+ default: false
34
38
  }
35
39
  };
36
40
  function createBem(namespace, element, modifier) {
@@ -43,8 +47,8 @@ function createBem(namespace, element, modifier) {
43
47
  }
44
48
  return cls;
45
49
  }
46
- function useNamespace(block) {
47
- const namespace = `devui-${block}`;
50
+ function useNamespace(block, needDot = false) {
51
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
48
52
  const b = () => createBem(namespace);
49
53
  const e = (element) => element ? createBem(namespace, element) : "";
50
54
  const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
@@ -64,7 +68,7 @@ var Badge = defineComponent({
64
68
  const ns = useNamespace("badge");
65
69
  const className = computed(() => {
66
70
  const base = ns.e("content");
67
- return [base, props.showDot ? ns.m("dot") : ns.m("count"), props.status && ns.m(props.status), ctx.slots.default && props.position && ns.m(props.position), ctx.slots.default && ns.m("fixed")].join(" ");
71
+ return [base, props.showDot ? ns.m("dot") : ns.m("count"), props.status && ns.m(props.status), ctx.slots.default && props.position && ns.m(props.position), ctx.slots.default && ns.m("fixed"), props.hidden ? ns.m("hidden") : ns.m("show")].join(" ");
68
72
  });
69
73
  const style = computed(() => {
70
74
  const styleMap = {
@@ -72,7 +76,9 @@ var Badge = defineComponent({
72
76
  textColor: "color"
73
77
  };
74
78
  const ret = Object.keys(styleMap).reduce((result, key) => {
75
- props[key] && (result[styleMap[key]] = props[key]);
79
+ if (props[key]) {
80
+ result[styleMap[key]] = props[key];
81
+ }
76
82
  return result;
77
83
  }, {});
78
84
  if (ctx.slots.default && props.offset) {
@@ -1 +1 @@
1
- (function(u,a){typeof exports=="object"&&typeof module!="undefined"?a(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],a):(u=typeof globalThis!="undefined"?globalThis:u||self,a(u.index={},u.Vue))})(this,function(u,a){"use strict";const b=["danger","warning","waiting","success","info","common"],y=["top-left","top-right","bottom-left","bottom-right"],r={count:{type:[Number,String]},maxCount:{type:Number,default:99},showDot:{type:Boolean,default:!1},status:{type:String,validator:t=>b.includes(t),default:"info"},position:{type:String,default:"top-right",validator:t=>y.includes(t)},offset:{type:Array},bgColor:{type:String},textColor:{type:String}};function d(t,n,o){let i=t;return n&&(i+=`__${n}`),o&&(i+=`--${o}`),i}function x(t){const n=`devui-${t}`;return{b:()=>d(n),e:e=>e?d(n,e):"",m:e=>e?d(n,"",e):"",em:(e,s)=>e&&s?d(n,e,s):""}}var N="",f=a.defineComponent({name:"DBadge",props:r,setup(t,n){const o=x("badge"),i=a.computed(()=>[o.e("content"),t.showDot?o.m("dot"):o.m("count"),t.status&&o.m(t.status),n.slots.default&&t.position&&o.m(t.position),n.slots.default&&o.m("fixed")].join(" ")),m=a.computed(()=>{const e={bgColor:"background",textColor:"color"},s=Object.keys(e).reduce((l,c)=>(t[c]&&(l[e[c]]=t[c]),l),{});if(n.slots.default&&t.offset){const[l,c]=t.offset,[h,v]=t.position.split("-");s[h]=c+"px",s[v]=l+"px"}return s}),g=a.computed(()=>{if(!t.showDot)return typeof t.count=="number"&&typeof t.maxCount=="number"&&t.count>t.maxCount?`${t.maxCount}+`:t.count});return()=>{var e,s;return a.createVNode("div",{class:o.b()},[(s=(e=n.slots).default)==null?void 0:s.call(e),a.createVNode("div",{class:i.value,style:m.value},[g.value])])}}}),C={title:"Badge \u5FBD\u6807",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(t){t.component(f.name,f)}};u.Badge=f,u.badgeProps=r,u.default=C,Object.defineProperty(u,"__esModule",{value:!0}),u[Symbol.toStringTag]="Module"});
1
+ (function(o,u){typeof exports=="object"&&typeof module!="undefined"?u(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],u):(o=typeof globalThis!="undefined"?globalThis:o||self,u(o.index={},o.Vue))})(this,function(o,u){"use strict";const y=["danger","warning","waiting","success","info","common"],b=["top-left","top-right","bottom-left","bottom-right"],r={count:{type:[Number,String]},maxCount:{type:Number,default:99},showDot:{type:Boolean,default:!1},status:{type:String,validator:t=>y.includes(t),default:"info"},position:{type:String,default:"top-right",validator:t=>b.includes(t)},offset:{type:Array},bgColor:{type:String},textColor:{type:String},hidden:{type:Boolean,default:!1}};function f(t,a,e){let d=t;return a&&(d+=`__${a}`),e&&(d+=`--${e}`),d}function h(t,a=!1){const e=a?`.devui-${t}`:`devui-${t}`;return{b:()=>f(e),e:n=>n?f(e,n):"",m:n=>n?f(e,"",n):"",em:(n,i)=>n&&i?f(e,n,i):""}}var B="",l=u.defineComponent({name:"DBadge",props:r,setup(t,a){const e=h("badge"),d=u.computed(()=>[e.e("content"),t.showDot?e.m("dot"):e.m("count"),t.status&&e.m(t.status),a.slots.default&&t.position&&e.m(t.position),a.slots.default&&e.m("fixed"),t.hidden?e.m("hidden"):e.m("show")].join(" ")),m=u.computed(()=>{const s={bgColor:"background",textColor:"color"},n=Object.keys(s).reduce((i,c)=>(t[c]&&(i[s[c]]=t[c]),i),{});if(a.slots.default&&t.offset){const[i,c]=t.offset,[x,C]=t.position.split("-");n[x]=c+"px",n[C]=i+"px"}return n}),g=u.computed(()=>{if(!t.showDot)return typeof t.count=="number"&&typeof t.maxCount=="number"&&t.count>t.maxCount?`${t.maxCount}+`:t.count});return()=>{var s,n;return u.createVNode("div",{class:e.b()},[(n=(s=a.slots).default)==null?void 0:n.call(s),u.createVNode("div",{class:d.value,style:m.value},[g.value])])}}}),v={title:"Badge \u5FBD\u6807",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(t){t.component(l.name,l)}};o.Badge=l,o.badgeProps=r,o.default=v,Object.defineProperty(o,"__esModule",{value:!0}),o[Symbol.toStringTag]="Module"});
package/badge/style.css CHANGED
@@ -1 +1 @@
1
- .devui-badge{position:relative;display:inline-block}.devui-badge__content{font-size:var(--devui-font-size, 12px);color:var(--devui-light-text, #ffffff)}.devui-badge--count{padding:0 4px;min-width:16px;height:16px;line-height:16px;border-radius:8px;background:var(--devui-brand, #5e7ce0);text-align:center}.devui-badge--danger{background:var(--devui-danger, #f66f6a)}.devui-badge--warning{background:var(--devui-warning, #fac20a)}.devui-badge--waiting{background:var(--devui-waiting, #9faad7)}.devui-badge--success{background:var(--devui-success, #50d4ab)}.devui-badge--info{background:var(--devui-info, #5e7ce0)}.devui-badge--common{background:var(--devui-unavailable, #f5f5f6);color:var(--devui-aide-text, #8a8e99)}.devui-badge--top-left{left:0;top:0;transform:translate(-50%,-50%)}.devui-badge--top-right{right:0;top:0;transform:translate(50%,-50%)}.devui-badge--bottom-left{left:0;bottom:0;transform:translate(-50%,50%)}.devui-badge--bottom-right{right:0;bottom:0;transform:translate(50%,50%)}.devui-badge--fixed{position:absolute}.devui-badge--dot{width:6px;height:6px;border-radius:50%}
1
+ .devui-badge{position:relative;display:inline-block}.devui-badge__content{font-size:var(--devui-font-size-sm, 12px);color:var(--devui-light-text, #ffffff)}.devui-badge--count{padding:0 4px;min-width:16px;height:16px;line-height:16px;border-radius:var(--devui-border-radius-full, 100px);background:var(--devui-brand, #5e7ce0);text-align:center}.devui-badge--danger{background:var(--devui-danger, #f66f6a)}.devui-badge--warning{background:var(--devui-warning, #fac20a)}.devui-badge--waiting{background:var(--devui-waiting, #9faad7)}.devui-badge--success{background:var(--devui-success, #50d4ab)}.devui-badge--info{background:var(--devui-brand, #5e7ce0)}.devui-badge--common{background:var(--devui-unavailable, #f5f5f5);color:var(--devui-aide-text, #71757f)}.devui-badge--top-left{left:0;top:0;transform:translate(-50%,-50%)}.devui-badge--top-right{right:0;top:0;transform:translate(50%,-50%)}.devui-badge--bottom-left{left:0;bottom:0;transform:translate(-50%,50%)}.devui-badge--bottom-right{right:0;bottom:0;transform:translate(50%,50%)}.devui-badge--fixed{position:absolute}.devui-badge--dot{width:6px;height:6px;border-radius:50%}.devui-badge--show{visibility:visible;opacity:1;transition:all var(--devui-animation-duration-fast, .1s) var(--devui-animation-ease-out, cubic-bezier(.16, .75, .5, 1))}.devui-badge--hidden{visibility:hidden;opacity:0;transition:all var(--devui-animation-duration-fast, .1s) var(--devui-animation-ease-in, cubic-bezier(.5, 0, .84, .25))}
@@ -18,7 +18,8 @@ var __publicField = (obj, key, value) => {
18
18
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
19
19
  return value;
20
20
  };
21
- import { defineComponent, toRefs, createVNode, ref, h, render, computed, inject, withDirectives, resolveDirective, provide, toRef } from "vue";
21
+ import { defineComponent, toRefs, computed, createVNode, resolveDynamicComponent, mergeProps, ref, h, render, inject, withDirectives, resolveDirective, provide, toRef } from "vue";
22
+ const DEFAULT_PREFIX = "icon";
22
23
  const iconProps = {
23
24
  name: {
24
25
  type: String,
@@ -26,43 +27,203 @@ const iconProps = {
26
27
  required: true
27
28
  },
28
29
  size: {
29
- type: String,
30
+ type: [Number, String],
30
31
  default: "inherit"
31
32
  },
32
33
  color: {
33
34
  type: String,
34
35
  default: "inherit"
35
36
  },
37
+ component: {
38
+ type: Object,
39
+ default: null
40
+ },
36
41
  classPrefix: {
37
42
  type: String,
38
- default: "icon"
43
+ default: DEFAULT_PREFIX
44
+ },
45
+ operable: {
46
+ type: Boolean,
47
+ default: false
48
+ },
49
+ disabled: {
50
+ type: Boolean,
51
+ default: false
52
+ },
53
+ rotate: {
54
+ type: [Number, String]
39
55
  }
40
56
  };
41
- var Icon = defineComponent({
42
- name: "DIcon",
43
- props: iconProps,
57
+ const svgIconProps = {
58
+ name: {
59
+ type: String,
60
+ default: "",
61
+ required: true
62
+ },
63
+ color: {
64
+ type: String,
65
+ default: "inherit"
66
+ },
67
+ size: {
68
+ type: [Number, String],
69
+ default: "inherit"
70
+ }
71
+ };
72
+ function createBem(namespace, element, modifier) {
73
+ let cls = namespace;
74
+ if (element) {
75
+ cls += `__${element}`;
76
+ }
77
+ if (modifier) {
78
+ cls += `--${modifier}`;
79
+ }
80
+ return cls;
81
+ }
82
+ function useNamespace(block, needDot = false) {
83
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
84
+ const b = () => createBem(namespace);
85
+ const e = (element) => element ? createBem(namespace, element) : "";
86
+ const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
87
+ const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
88
+ return {
89
+ b,
90
+ e,
91
+ m,
92
+ em
93
+ };
94
+ }
95
+ var icon = "";
96
+ var svgIcon = defineComponent({
97
+ name: "DSvgIcon",
98
+ props: svgIconProps,
44
99
  setup(props) {
45
100
  const {
46
101
  name,
47
- size,
48
102
  color,
49
- classPrefix
103
+ size
50
104
  } = toRefs(props);
105
+ const ns = useNamespace("svg-icon");
106
+ const iconName = computed(() => `#icon-${name.value}`);
107
+ const iconSize = computed(() => {
108
+ return typeof size.value === "number" ? `${size.value}px` : size.value;
109
+ });
110
+ const styles = {
111
+ width: iconSize.value,
112
+ height: iconSize.value
113
+ };
51
114
  return () => {
52
- return /^((https?):)?\/\//.test(name.value) ? createVNode("img", {
53
- "src": name.value,
54
- "alt": name.value.split("/")[name.value.split("/").length - 1],
55
- "style": {
56
- width: size.value,
57
- verticalAlign: "text-bottom"
58
- }
59
- }, null) : createVNode("i", {
60
- "class": `${classPrefix.value} ${classPrefix.value}-${name.value}`,
61
- "style": {
62
- fontSize: size.value,
63
- color: color.value
64
- }
65
- }, null);
115
+ return createVNode("svg", {
116
+ "class": ns.b(),
117
+ "style": styles
118
+ }, [createVNode("use", {
119
+ "xlink:href": iconName.value,
120
+ "fill": color.value
121
+ }, null)]);
122
+ };
123
+ }
124
+ });
125
+ function isUrl(value) {
126
+ return /^((http|https):)?\/\//.test(value);
127
+ }
128
+ function useIconDom(props, ctx) {
129
+ const {
130
+ component,
131
+ name,
132
+ size,
133
+ color,
134
+ classPrefix,
135
+ rotate
136
+ } = toRefs(props);
137
+ const ns = useNamespace("icon");
138
+ const iconSize = computed(() => {
139
+ return typeof size.value === "number" ? `${size.value}px` : size.value;
140
+ });
141
+ const IconComponent = component.value ? resolveDynamicComponent(component.value) : resolveDynamicComponent(svgIcon);
142
+ const imgIconDom = () => {
143
+ return createVNode("img", mergeProps({
144
+ "src": name.value,
145
+ "alt": name.value.split("/")[name.value.split("/").length - 1],
146
+ "class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
147
+ "style": {
148
+ width: iconSize.value || "",
149
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`,
150
+ verticalAlign: "middle"
151
+ }
152
+ }, ctx.attrs), null);
153
+ };
154
+ const svgIconDom = () => {
155
+ return createVNode(IconComponent, mergeProps({
156
+ "name": name.value,
157
+ "color": color.value,
158
+ "size": iconSize.value,
159
+ "class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
160
+ "style": {
161
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
162
+ }
163
+ }, ctx.attrs), null);
164
+ };
165
+ const fontIconDom = () => {
166
+ const fontIconClass = /^icon-/.test(name.value) ? name.value : `${classPrefix.value}-${name.value}`;
167
+ return createVNode("i", mergeProps({
168
+ "class": [classPrefix.value, fontIconClass, (rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
169
+ "style": {
170
+ fontSize: iconSize.value,
171
+ color: color.value,
172
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
173
+ }
174
+ }, ctx.attrs), null);
175
+ };
176
+ const iconDom = () => {
177
+ return component.value ? svgIconDom() : isUrl(name.value) ? imgIconDom() : fontIconDom();
178
+ };
179
+ return {
180
+ iconDom
181
+ };
182
+ }
183
+ var Icon = defineComponent({
184
+ name: "DIcon",
185
+ props: iconProps,
186
+ emits: ["click"],
187
+ setup(props, ctx) {
188
+ const {
189
+ disabled,
190
+ operable
191
+ } = toRefs(props);
192
+ const {
193
+ iconDom
194
+ } = useIconDom(props, ctx);
195
+ const ns = useNamespace("icon");
196
+ const wrapClassed = computed(() => ({
197
+ [ns.e("container")]: true,
198
+ [ns.m("disabled")]: disabled.value,
199
+ [ns.m("operable")]: operable.value,
200
+ [ns.m("no-slots")]: !Object.keys(ctx.slots).length
201
+ }));
202
+ const onClick = (e) => {
203
+ if (disabled.value) {
204
+ return;
205
+ }
206
+ ctx.emit("click", e);
207
+ };
208
+ return () => {
209
+ var _a, _b, _c, _d;
210
+ return createVNode("div", {
211
+ "class": wrapClassed.value,
212
+ "onClick": onClick
213
+ }, [(_b = (_a = ctx.slots).prefix) == null ? void 0 : _b.call(_a), iconDom(), (_d = (_c = ctx.slots).suffix) == null ? void 0 : _d.call(_c)]);
214
+ };
215
+ }
216
+ });
217
+ var iconGroup = "";
218
+ defineComponent({
219
+ name: "DIconGroup",
220
+ setup(_, ctx) {
221
+ const ns = useNamespace("icon-group");
222
+ return () => {
223
+ var _a, _b;
224
+ return createVNode("div", {
225
+ "class": ns.b()
226
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
66
227
  };
67
228
  }
68
229
  });
@@ -96,32 +257,9 @@ class LoadingOptions {
96
257
  __publicField(this, "zIndex");
97
258
  }
98
259
  }
99
- function createBem(namespace, element, modifier) {
100
- let cls = namespace;
101
- if (element) {
102
- cls += `__${element}`;
103
- }
104
- if (modifier) {
105
- cls += `--${modifier}`;
106
- }
107
- return cls;
108
- }
109
- function useNamespace(block) {
110
- const namespace = `devui-${block}`;
111
- const b = () => createBem(namespace);
112
- const e = (element) => element ? createBem(namespace, element) : "";
113
- const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
114
- const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
115
- return {
116
- b,
117
- e,
118
- m,
119
- em
120
- };
121
- }
122
260
  var loading = "";
123
261
  var Loading = defineComponent({
124
- name: "DLoading",
262
+ name: "Loading",
125
263
  inheritAttrs: false,
126
264
  props: loadingProps,
127
265
  setup(props) {
@@ -274,12 +412,12 @@ const handleProps = (el, vprops) => {
274
412
  const props = __spreadValues(__spreadValues({}, new LoadingOptions()), vprops);
275
413
  const loadingTemplateRef = props.loadingTemplateRef;
276
414
  const loadingInstance = createComponent(loadingConstructor, __spreadValues({}, props), loadingTemplateRef ? () => loadingTemplateRef : null);
277
- el.style.position = props.positionType;
415
+ el.style.position = props.positionType || "relative";
278
416
  el.options = props;
279
417
  el.instance = loadingInstance;
280
418
  el.mask = (_a = loadingInstance == null ? void 0 : loadingInstance.proxy) == null ? void 0 : _a.$el;
281
419
  };
282
- const loadingDirective = {
420
+ const LoadingDirective = {
283
421
  mounted: function(el, binding, vnode) {
284
422
  handleProps(el, vnode.props);
285
423
  removeAttribute(el);
@@ -5781,13 +5919,13 @@ var button = "";
5781
5919
  var Button = defineComponent({
5782
5920
  name: "DButton",
5783
5921
  directives: {
5784
- dLoading: loadingDirective
5922
+ Loading: LoadingDirective
5785
5923
  },
5786
5924
  props: buttonProps,
5787
5925
  emits: ["click"],
5788
5926
  setup(props, ctx) {
5789
5927
  const {
5790
- icon,
5928
+ icon: icon2,
5791
5929
  disabled,
5792
5930
  loading: loading2
5793
5931
  } = toRefs(props);
@@ -5807,14 +5945,14 @@ var Button = defineComponent({
5807
5945
  "class": classes.value,
5808
5946
  "disabled": disabled.value,
5809
5947
  "onClick": onClick
5810
- }, [icon.value && createVNode(Icon, {
5811
- "name": icon.value,
5948
+ }, [icon2.value && createVNode(Icon, {
5949
+ "name": icon2.value,
5812
5950
  "size": "var(--devui-font-size, 12px)",
5813
5951
  "color": "",
5814
5952
  "class": iconClass.value
5815
5953
  }, null), createVNode("span", {
5816
5954
  "class": "button-content"
5817
- }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])]), [[resolveDirective("dLoading"), loading2.value]]);
5955
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])]), [[resolveDirective("loading"), loading2.value]]);
5818
5956
  };
5819
5957
  }
5820
5958
  });