vue-devui 1.0.0-rc.5 → 1.0.0-rc.8

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 (153) hide show
  1. package/README.md +22 -8
  2. package/alert/index.es.js +37 -11
  3. package/alert/index.umd.js +1 -1
  4. package/alert/style.css +1 -1
  5. package/auto-complete/index.es.js +72 -26
  6. package/auto-complete/index.umd.js +5 -5
  7. package/auto-complete/style.css +1 -1
  8. package/avatar/index.es.js +32 -6
  9. package/avatar/index.umd.js +1 -1
  10. package/avatar/style.css +1 -1
  11. package/badge/index.es.js +29 -4
  12. package/badge/index.umd.js +1 -1
  13. package/badge/style.css +1 -1
  14. package/button/index.es.js +5548 -76
  15. package/button/index.umd.js +27 -1
  16. package/button/style.css +1 -1
  17. package/card/index.es.js +56 -29
  18. package/card/index.umd.js +1 -1
  19. package/card/style.css +1 -1
  20. package/checkbox/index.es.js +48 -30
  21. package/checkbox/index.umd.js +1 -1
  22. package/checkbox/style.css +1 -1
  23. package/date-picker/index.es.js +91 -145
  24. package/date-picker/index.umd.js +1 -1
  25. package/date-picker/style.css +1 -1
  26. package/drawer/index.es.js +28 -3
  27. package/drawer/index.umd.js +1 -1
  28. package/drawer/style.css +1 -1
  29. package/dropdown/index.es.js +39 -13
  30. package/dropdown/index.umd.js +1 -1
  31. package/dropdown/style.css +1 -1
  32. package/editable-select/index.es.js +14 -14
  33. package/editable-select/index.umd.js +1 -1
  34. package/editable-select/style.css +1 -1
  35. package/form/index.es.js +958 -1200
  36. package/form/index.umd.js +18 -18
  37. package/form/style.css +1 -1
  38. package/fullscreen/index.es.js +29 -5
  39. package/fullscreen/index.umd.js +1 -1
  40. package/fullscreen/style.css +1 -1
  41. package/grid/index.es.js +68 -49
  42. package/grid/index.umd.js +1 -1
  43. package/grid/style.css +1 -1
  44. package/image-preview/index.es.js +34 -11
  45. package/image-preview/index.umd.js +1 -1
  46. package/image-preview/style.css +1 -1
  47. package/input/index.es.js +91 -145
  48. package/input/index.umd.js +1 -1
  49. package/input/style.css +1 -1
  50. package/input-number/index.es.js +27 -5
  51. package/input-number/index.umd.js +1 -1
  52. package/input-number/style.css +1 -1
  53. package/layout/index.es.js +34 -6
  54. package/layout/index.umd.js +1 -1
  55. package/layout/style.css +1 -1
  56. package/loading/index.es.js +34 -10
  57. package/loading/index.umd.js +1 -1
  58. package/loading/style.css +1 -1
  59. package/modal/index.es.js +41 -15
  60. package/modal/index.umd.js +1 -1
  61. package/modal/style.css +1 -1
  62. package/notification/index.es.js +40 -13
  63. package/notification/index.umd.js +1 -1
  64. package/notification/style.css +1 -1
  65. package/nuxt/components/ButtonGroup.js +3 -0
  66. package/nuxt/components/CheckboxGroup.js +3 -0
  67. package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
  68. package/nuxt/components/FORM_TOKEN.js +3 -0
  69. package/nuxt/components/Tree.js +3 -0
  70. package/nuxt/components/buttonGroupInjectionKey.js +3 -0
  71. package/nuxt/components/buttonGroupProps.js +3 -0
  72. package/nuxt/components/formControlProps.js +3 -0
  73. package/nuxt/components/formItemProps.js +3 -0
  74. package/nuxt/components/formProps.js +3 -0
  75. package/nuxt/components/treeProps.js +3 -0
  76. package/overlay/index.es.js +31 -9
  77. package/overlay/index.umd.js +1 -1
  78. package/overlay/style.css +1 -1
  79. package/package.json +1 -1
  80. package/pagination/index.es.js +135 -124
  81. package/pagination/index.umd.js +1 -1
  82. package/pagination/style.css +1 -1
  83. package/popover/index.es.js +53 -24
  84. package/popover/index.umd.js +13 -13
  85. package/popover/style.css +1 -1
  86. package/progress/index.es.js +76 -20
  87. package/progress/index.umd.js +3 -3
  88. package/progress/style.css +1 -1
  89. package/radio/index.es.js +32 -7
  90. package/radio/index.umd.js +1 -1
  91. package/radio/style.css +1 -1
  92. package/rate/index.es.js +34 -10
  93. package/rate/index.umd.js +1 -1
  94. package/rate/style.css +1 -1
  95. package/search/index.es.js +103 -153
  96. package/search/index.umd.js +14 -14
  97. package/search/style.css +1 -1
  98. package/select/index.es.js +74 -51
  99. package/select/index.umd.js +1 -1
  100. package/select/style.css +1 -1
  101. package/skeleton/index.es.js +37 -12
  102. package/skeleton/index.umd.js +1 -1
  103. package/skeleton/style.css +1 -1
  104. package/slider/index.es.js +52 -16
  105. package/slider/index.umd.js +1 -1
  106. package/slider/style.css +1 -1
  107. package/splitter/index.es.js +52 -24
  108. package/splitter/index.umd.js +15 -15
  109. package/splitter/style.css +1 -1
  110. package/status/index.es.js +26 -2
  111. package/status/index.umd.js +1 -1
  112. package/status/style.css +1 -1
  113. package/style.css +1 -1
  114. package/switch/index.es.js +30 -6
  115. package/switch/index.umd.js +1 -1
  116. package/switch/style.css +1 -1
  117. package/table/index.es.js +6267 -536
  118. package/table/index.umd.js +27 -1
  119. package/table/style.css +1 -1
  120. package/tabs/index.es.js +32 -8
  121. package/tabs/index.umd.js +1 -1
  122. package/tabs/style.css +1 -1
  123. package/tag/index.es.js +27 -2
  124. package/tag/index.umd.js +1 -1
  125. package/tag/style.css +1 -1
  126. package/textarea/index.es.js +93 -76
  127. package/textarea/index.umd.js +1 -1
  128. package/textarea/style.css +1 -1
  129. package/tooltip/index.es.js +42 -15
  130. package/tooltip/index.umd.js +12 -12
  131. package/tooltip/style.css +1 -1
  132. package/{comment → tree}/index.d.ts +0 -0
  133. package/tree/index.es.js +1030 -0
  134. package/tree/index.umd.js +1 -0
  135. package/{comment → tree}/package.json +1 -1
  136. package/tree/style.css +1 -0
  137. package/upload/index.es.js +53 -22
  138. package/upload/index.umd.js +1 -1
  139. package/upload/style.css +1 -1
  140. package/vue-devui.es.js +5296 -4916
  141. package/vue-devui.umd.js +22 -22
  142. package/comment/index.es.js +0 -84
  143. package/comment/index.umd.js +0 -1
  144. package/comment/style.css +0 -1
  145. package/nuxt/components/Comment.js +0 -3
  146. package/nuxt/components/ReadTip.js +0 -3
  147. package/nuxt/components/commentProps.js +0 -3
  148. package/nuxt/components/readTipProps.js +0 -3
  149. package/read-tip/index.d.ts +0 -7
  150. package/read-tip/index.es.js +0 -261
  151. package/read-tip/index.umd.js +0 -1
  152. package/read-tip/package.json +0 -7
  153. package/read-tip/style.css +0 -1
@@ -1,4 +1,10 @@
1
- import { defineComponent, toRefs, reactive, watch, createVNode, createTextVNode } from "vue";
1
+ import { defineComponent, toRefs, ref, effect, reactive, watch, createVNode, createTextVNode } from "vue";
2
+ function middleNum(num, min = 0, max = 100) {
3
+ let middle = 0;
4
+ middle = Math.min(num, max);
5
+ middle = Math.max(middle, min);
6
+ return middle;
7
+ }
2
8
  const progressProps = {
3
9
  height: {
4
10
  type: String,
@@ -27,8 +33,39 @@ const progressProps = {
27
33
  showContent: {
28
34
  type: Boolean,
29
35
  default: true
36
+ },
37
+ percentageTextPlacement: {
38
+ type: String,
39
+ default: "inside"
40
+ },
41
+ percentageTextColor: {
42
+ type: String,
43
+ default: ""
30
44
  }
31
45
  };
46
+ function createBem(namespace, element, modifier) {
47
+ let cls = namespace;
48
+ if (element) {
49
+ cls += `__${element}`;
50
+ }
51
+ if (modifier) {
52
+ cls += `--${modifier}`;
53
+ }
54
+ return cls;
55
+ }
56
+ function useNamespace(block) {
57
+ const namespace = `devui-${block}`;
58
+ const b = () => createBem(namespace);
59
+ const e = (element) => element ? createBem(namespace, element) : "";
60
+ const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
61
+ const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
62
+ return {
63
+ b,
64
+ e,
65
+ m,
66
+ em
67
+ };
68
+ }
32
69
  var progress = "";
33
70
  var Progress = defineComponent({
34
71
  name: "DProgress",
@@ -38,11 +75,17 @@ var Progress = defineComponent({
38
75
  height,
39
76
  percentage,
40
77
  percentageText,
78
+ percentageTextPlacement,
79
+ percentageTextColor,
41
80
  barBgColor,
42
81
  isCircle,
43
82
  strokeWidth,
44
83
  showContent
45
84
  } = toRefs(props);
85
+ const normalPercentage = ref(0);
86
+ effect(() => {
87
+ normalPercentage.value = middleNum(percentage.value);
88
+ });
46
89
  const data = reactive({
47
90
  pathString: "",
48
91
  trailPath: null,
@@ -67,25 +110,28 @@ var Progress = defineComponent({
67
110
  };
68
111
  data.strokePath = {
69
112
  stroke: barBgColor || null,
70
- strokeDasharray: `${percentage.value / 100 * len}px ${len}px`,
113
+ strokeDasharray: `${normalPercentage.value / 100 * len}px ${len}px`,
71
114
  strokeDashoffset: `0`,
72
115
  transition: "stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"
73
116
  };
74
117
  };
75
118
  setCircleProgress();
76
- watch([height, percentage, percentageText, barBgColor, isCircle, strokeWidth, showContent], () => {
119
+ watch([height, normalPercentage, percentageText, percentageTextPlacement, percentageTextColor, barBgColor, isCircle, strokeWidth, showContent], () => {
77
120
  setCircleProgress();
78
121
  });
79
122
  return {
80
- data
123
+ data,
124
+ normalPercentage
81
125
  };
82
126
  },
83
127
  render() {
84
128
  var _a;
85
129
  const {
86
130
  height,
87
- percentage,
131
+ normalPercentage,
88
132
  percentageText,
133
+ percentageTextPlacement,
134
+ percentageTextColor,
89
135
  barBgColor,
90
136
  isCircle,
91
137
  strokeWidth,
@@ -93,50 +139,60 @@ var Progress = defineComponent({
93
139
  data,
94
140
  $slots
95
141
  } = this;
142
+ const ns = useNamespace("progress");
143
+ const isOutside = percentageTextPlacement === "outside";
144
+ const isInsideBg = percentageTextPlacement === "insideBg";
145
+ const createPercentageText = () => {
146
+ return createVNode("span", {
147
+ "style": {
148
+ lineHeight: height,
149
+ color: percentageTextColor
150
+ }
151
+ }, [percentageText]);
152
+ };
96
153
  const progressLine = createVNode("div", {
97
- "class": "devui-progress--line",
154
+ "class": ns.e("content")
155
+ }, [createVNode("div", {
156
+ "class": ns.e("line"),
98
157
  "style": {
99
158
  height,
100
159
  borderRadius: height
101
160
  }
102
161
  }, [createVNode("div", {
103
- "class": "devui-progress-bar",
162
+ "class": [ns.e("bar"), percentageTextPlacement],
104
163
  "style": {
105
164
  height,
106
165
  borderRadius: height,
107
- width: `${percentage}%`,
166
+ width: `${normalPercentage}%`,
108
167
  backgroundColor: barBgColor
109
168
  }
110
- }, null), createVNode("span", {
169
+ }, [!isOutside && !isInsideBg ? createPercentageText() : null]), isInsideBg ? createPercentageText() : null]), isOutside && !!percentageText ? createPercentageText() : null]);
170
+ const textElement = createVNode("span", {
171
+ "class": ns.e("circle-text"),
111
172
  "style": {
112
- lineHeight: height
173
+ color: percentageTextColor
113
174
  }
114
- }, [percentageText])]);
115
- const textElement = createVNode("span", {
116
- "class": "devui-progress-circle-text"
117
- }, [percentage, createTextVNode("%")]);
175
+ }, [normalPercentage, createTextVNode("%")]);
118
176
  const progressCircle = createVNode("div", {
119
- "class": "devui-progress-circle"
177
+ "class": ns.e("circle")
120
178
  }, [createVNode("svg", {
121
- "class": "devui-progress-circle",
179
+ "class": ns.e("circle"),
122
180
  "viewBox": "0 0 100 100"
123
181
  }, [createVNode("path", {
124
- "class": "devui-progress-circle-trail",
125
182
  "fill-opacity": "0",
126
183
  "stroke-width": strokeWidth,
127
184
  "style": data.trailPath,
128
185
  "d": data.pathString
129
186
  }, null), createVNode("path", {
130
- "class": "devui-progress-circle-path",
131
187
  "d": data.pathString,
132
188
  "stroke-linecap": "round",
133
189
  "fill-opacity": "0",
134
190
  "stroke": barBgColor,
135
- "stroke-width": percentage ? strokeWidth : 0,
191
+ "stroke-width": normalPercentage ? strokeWidth : 0,
136
192
  "style": data.strokePath
137
193
  }, null)]), showContent && ((_a = $slots.default) == null ? void 0 : _a.call($slots)), showContent && !$slots.default && textElement]);
138
194
  return createVNode("div", {
139
- "class": "devui-progress"
195
+ "class": ns.b()
140
196
  }, [!isCircle ? progressLine : progressCircle]);
141
197
  }
142
198
  });
@@ -1,3 +1,3 @@
1
- (function(t,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(t=typeof globalThis!="undefined"?globalThis:t||self,e(t.index={},t.Vue))})(this,function(t,e){"use strict";const y={height:{type:String,default:"20px"},percentage:{type:Number,default:0},percentageText:{type:String,default:""},barBgColor:{type:String,default:"#5170ff"},isCircle:{type:Boolean,default:!1},strokeWidth:{type:Number,default:6},showContent:{type:Boolean,default:!0}};var C="",f=e.defineComponent({name:"DProgress",props:y,setup(s){const{height:i,percentage:c,percentageText:p,barBgColor:u,isCircle:n,strokeWidth:d,showContent:a}=e.toRefs(s),r=e.reactive({pathString:"",trailPath:null,strokePath:null}),h=()=>{if(!n)return;const o=50-d.value/2,k=-o,l=o*-2;r.pathString=`M 50,50 m 0,${k}
2
- a ${o},${o} 0 1 1 0,${-l}
3
- a ${o},${o} 0 1 1 0,${l}`;const g=Math.PI*2*o;r.trailPath={stroke:"var(--devui-dividing-line, #dfe1e6)",strokeDasharray:`${g}px ${g}px`,strokeDashoffset:"0",transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s"},r.strokePath={stroke:u||null,strokeDasharray:`${c.value/100*g}px ${g}px`,strokeDashoffset:"0",transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"}};return h(),e.watch([i,c,p,u,n,d,a],()=>{h()}),{data:r}},render(){var l;const{height:s,percentage:i,percentageText:c,barBgColor:p,isCircle:u,strokeWidth:n,showContent:d,data:a,$slots:r}=this,h=e.createVNode("div",{class:"devui-progress--line",style:{height:s,borderRadius:s}},[e.createVNode("div",{class:"devui-progress-bar",style:{height:s,borderRadius:s,width:`${i}%`,backgroundColor:p}},null),e.createVNode("span",{style:{lineHeight:s}},[c])]),o=e.createVNode("span",{class:"devui-progress-circle-text"},[i,e.createTextVNode("%")]),k=e.createVNode("div",{class:"devui-progress-circle"},[e.createVNode("svg",{class:"devui-progress-circle",viewBox:"0 0 100 100"},[e.createVNode("path",{class:"devui-progress-circle-trail","fill-opacity":"0","stroke-width":n,style:a.trailPath,d:a.pathString},null),e.createVNode("path",{class:"devui-progress-circle-path",d:a.pathString,"stroke-linecap":"round","fill-opacity":"0",stroke:p,"stroke-width":i?n:0,style:a.strokePath},null)]),d&&((l=r.default)==null?void 0:l.call(r)),d&&!r.default&&o]);return e.createVNode("div",{class:"devui-progress"},[u?k:h])}}),P={title:"Progress \u8FDB\u5EA6\u6761",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(s){s.component(f.name,f)}};t.Progress=f,t.default=P,t.progressProps=y,Object.defineProperty(t,"__esModule",{value:!0}),t[Symbol.toStringTag]="Module"});
1
+ (function(n,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(n=typeof globalThis!="undefined"?globalThis:n||self,e(n.index={},n.Vue))})(this,function(n,e){"use strict";function N(t,s=0,i=100){let r=0;return r=Math.min(t,i),r=Math.max(r,s),r}const C={height:{type:String,default:"20px"},percentage:{type:Number,default:0},percentageText:{type:String,default:""},barBgColor:{type:String,default:"#5170ff"},isCircle:{type:Boolean,default:!1},strokeWidth:{type:Number,default:6},showContent:{type:Boolean,default:!0},percentageTextPlacement:{type:String,default:"inside"},percentageTextColor:{type:String,default:""}};function P(t,s,i){let r=t;return s&&(r+=`__${s}`),i&&(r+=`--${i}`),r}function T(t){const s=`devui-${t}`;return{b:()=>P(s),e:a=>a?P(s,a):"",m:a=>a?P(s,"",a):"",em:(a,d)=>a&&d?P(s,a,d):""}}var S="",x=e.defineComponent({name:"DProgress",props:C,setup(t){const{height:s,percentage:i,percentageText:r,percentageTextPlacement:g,percentageTextColor:h,barBgColor:a,isCircle:d,strokeWidth:f,showContent:u}=e.toRefs(t),l=e.ref(0);e.effect(()=>{l.value=N(i.value)});const o=e.reactive({pathString:"",trailPath:null,strokePath:null}),y=()=>{if(!d)return;const c=50-f.value/2,k=-c,m=c*-2;o.pathString=`M 50,50 m 0,${k}
2
+ a ${c},${c} 0 1 1 0,${-m}
3
+ a ${c},${c} 0 1 1 0,${m}`;const p=Math.PI*2*c;o.trailPath={stroke:"var(--devui-dividing-line, #dfe1e6)",strokeDasharray:`${p}px ${p}px`,strokeDashoffset:"0",transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s"},o.strokePath={stroke:a||null,strokeDasharray:`${l.value/100*p}px ${p}px`,strokeDashoffset:"0",transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"}};return y(),e.watch([s,l,r,g,h,a,d,f,u],()=>{y()}),{data:o,normalPercentage:l}},render(){var b;const{height:t,normalPercentage:s,percentageText:i,percentageTextPlacement:r,percentageTextColor:g,barBgColor:h,isCircle:a,strokeWidth:d,showContent:f,data:u,$slots:l}=this,o=T("progress"),y=r==="outside",c=r==="insideBg",k=()=>e.createVNode("span",{style:{lineHeight:t,color:g}},[i]),m=e.createVNode("div",{class:o.e("content")},[e.createVNode("div",{class:o.e("line"),style:{height:t,borderRadius:t}},[e.createVNode("div",{class:[o.e("bar"),r],style:{height:t,borderRadius:t,width:`${s}%`,backgroundColor:h}},[!y&&!c?k():null]),c?k():null]),y&&!!i?k():null]),p=e.createVNode("span",{class:o.e("circle-text"),style:{color:g}},[s,e.createTextVNode("%")]),V=e.createVNode("div",{class:o.e("circle")},[e.createVNode("svg",{class:o.e("circle"),viewBox:"0 0 100 100"},[e.createVNode("path",{"fill-opacity":"0","stroke-width":d,style:u.trailPath,d:u.pathString},null),e.createVNode("path",{d:u.pathString,"stroke-linecap":"round","fill-opacity":"0",stroke:h,"stroke-width":s?d:0,style:u.strokePath},null)]),f&&((b=l.default)==null?void 0:b.call(l)),f&&!l.default&&p]);return e.createVNode("div",{class:o.b()},[a?V:m])}}),$={title:"Progress \u8FDB\u5EA6\u6761",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(t){t.component(x.name,x)}};n.Progress=x,n.default=$,n.progressProps=C,Object.defineProperty(n,"__esModule",{value:!0}),n[Symbol.toStringTag]="Module"});
@@ -1 +1 @@
1
- .devui-progress--line{position:relative;background:var(--devui-dividing-line, #dfe1e6)}.devui-progress--line .devui-progress-bar{width:0;height:100%;transition:width .6s ease;background-color:#5e7ce0}.devui-progress--line>span{display:block;white-space:nowrap;color:var(--devui-light-text, #ffffff);text-align:center;position:absolute;left:0;top:0;height:100%;width:100%;font-size:12px;line-height:1.5}.devui-progress-circle{position:relative}.devui-progress-circle .devui-progress-circle-text{position:absolute;top:50%;left:50%;width:100%;margin:0;padding:0;color:var(--devui-text, #252b3a);line-height:1;white-space:normal;text-align:center;transform:translate(-50%,-50%)}
1
+ .devui-progress__content{display:flex;flex-wrap:nowrap}.devui-progress__content .devui-progress__line{width:100%;position:relative;background:var(--devui-dividing-line, #dfe1e6)}.devui-progress__content .devui-progress__line .devui-progress__bar{width:0;height:100%;transition:width .6s ease;background-color:#5e7ce0}.devui-progress__content .devui-progress__line .devui-progress__bar>span{display:block;white-space:nowrap;color:var(--devui-light-text, #ffffff);font-size:12px;line-height:1.5;padding:0 10px}.devui-progress__content .devui-progress__line>span{display:block;white-space:nowrap;color:var(--devui-light-text, #ffffff);text-align:center;position:absolute;left:0;top:0;height:100%;width:100%;font-size:12px;line-height:1.5}.devui-progress__content .devui-progress__line .inside{text-align:center}.devui-progress__content .devui-progress__line .insideLeft{text-align:left}.devui-progress__content .devui-progress__line .insideRight{text-align:right}.devui-progress__content>span{min-width:46px;padding:0 5px;text-align:center}.devui-progress__circle{position:relative}.devui-progress__circle .devui-progress__circle-text{position:absolute;top:50%;left:50%;width:100%;margin:0;padding:0;color:var(--devui-text, #252b3a);line-height:1;white-space:normal;text-align:center;transform:translate(-50%,-50%)}
package/radio/index.es.js CHANGED
@@ -54,6 +54,29 @@ const radioGroupProps = __spreadProps(__spreadValues({}, radioCommonProps), {
54
54
  }
55
55
  });
56
56
  const radioGroupInjectionKey = Symbol("DRadioGroup");
57
+ function createBem(namespace, element, modifier) {
58
+ let cls = namespace;
59
+ if (element) {
60
+ cls += `__${element}`;
61
+ }
62
+ if (modifier) {
63
+ cls += `--${modifier}`;
64
+ }
65
+ return cls;
66
+ }
67
+ function useNamespace(block) {
68
+ const namespace = `devui-${block}`;
69
+ const b = () => createBem(namespace);
70
+ const e = (element) => element ? createBem(namespace, element) : "";
71
+ const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
72
+ const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
73
+ return {
74
+ b,
75
+ e,
76
+ m,
77
+ em
78
+ };
79
+ }
57
80
  var radio = "";
58
81
  var Radio = defineComponent({
59
82
  name: "DRadio",
@@ -116,7 +139,8 @@ var Radio = defineComponent({
116
139
  $slots,
117
140
  handleChange
118
141
  } = this;
119
- const labelCls = ["devui-radio", {
142
+ const ns = useNamespace("radio");
143
+ const labelCls = [ns.b(), {
120
144
  active: isChecked,
121
145
  disabled
122
146
  }];
@@ -125,13 +149,13 @@ var Radio = defineComponent({
125
149
  }, [createVNode("input", {
126
150
  "type": "radio",
127
151
  "name": radioName,
128
- "class": "devui-radio-input",
152
+ "class": ns.e("input"),
129
153
  "disabled": disabled,
130
154
  "onChange": handleChange,
131
155
  "value": value,
132
156
  "checked": isChecked
133
157
  }, null), createVNode("span", {
134
- "class": "devui-radio-material"
158
+ "class": ns.e("material")
135
159
  }, [createVNode("svg", {
136
160
  "height": "100%",
137
161
  "width": "100%",
@@ -139,7 +163,7 @@ var Radio = defineComponent({
139
163
  "xmlns": "http://www.w3.org/2000/svg"
140
164
  }, [createVNode("circle", {
141
165
  "class": {
142
- "devui-radio-material-outer": true,
166
+ [ns.e("material-outer")]: true,
143
167
  disabled
144
168
  },
145
169
  "cx": "512",
@@ -148,7 +172,7 @@ var Radio = defineComponent({
148
172
  "stroke-width": "51"
149
173
  }, null), createVNode("circle", {
150
174
  "class": {
151
- "devui-radio-material-inner": true,
175
+ [ns.e("material-inner")]: true,
152
176
  disabled
153
177
  },
154
178
  "cx": "512",
@@ -156,7 +180,7 @@ var Radio = defineComponent({
156
180
  "cy": "512",
157
181
  "r": "320"
158
182
  }, null)])]), createVNode("span", {
159
- "class": "devui-radio-label"
183
+ "class": ns.e("label")
160
184
  }, [(_a = $slots.default) == null ? void 0 : _a.call($slots)])]);
161
185
  }
162
186
  });
@@ -188,6 +212,7 @@ var RadioGroup = defineComponent({
188
212
  values,
189
213
  direction
190
214
  } = this;
215
+ const ns = useNamespace("radio-group");
191
216
  const getContent = () => {
192
217
  const defaultSlot = this.$slots.default;
193
218
  if (defaultSlot) {
@@ -206,7 +231,7 @@ var RadioGroup = defineComponent({
206
231
  }
207
232
  };
208
233
  return createVNode("div", {
209
- "class": ["devui-radio-group", {
234
+ "class": [ns.b(), {
210
235
  "is-row": direction === "row",
211
236
  "is-column": direction === "column"
212
237
  }]
@@ -1 +1 @@
1
- var S=Object.defineProperty,j=Object.defineProperties;var P=Object.getOwnPropertyDescriptors;var C=Object.getOwnPropertySymbols;var k=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable;var v=(t,e,o)=>e in t?S(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,p=(t,e)=>{for(var o in e||(e={}))k.call(e,o)&&v(t,o,e[o]);if(C)for(var o of C(e))x.call(e,o)&&v(t,o,e[o]);return t},b=(t,e)=>j(t,P(e));(function(t,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(t=typeof globalThis!="undefined"?globalThis:t||self,e(t.index={},t.Vue))})(this,function(t,e){"use strict";const o={modelValue:{type:String,default:null},name:{type:String,default:null},beforeChange:{type:Function,default:null},disabled:{type:Boolean,default:!1}},V=b(p({},o),{value:{type:String,required:!0,default:null}}),N=b(p({},o),{values:{type:Array,default:null},direction:{type:String,default:"column"}}),y=Symbol("DRadioGroup");var D="",c=e.defineComponent({name:"DRadio",props:V,emits:["change","update:modelValue"],setup(a,{emit:d}){const n=e.inject(y,null),r=e.computed(()=>a.disabled||(n==null?void 0:n.disabled.value)),l=e.computed(()=>{const i=n?n.modelValue.value:a.modelValue;return a.value===i}),h=e.computed(()=>n?n.name.value:a.name||void 0),g=i=>{const u=a.beforeChange||(n?n.beforeChange:null);let s=Promise.resolve(!0);if(u){const f=u(i);if(typeof f=="undefined")return s;typeof f=="boolean"?s=Promise.resolve(f):s=f}return s};return{isChecked:l,radioName:h,disabled:r,handleChange:async i=>{const u=a.value;if(!await g(u)){i.preventDefault();return}n==null||n.emitChange(u),d("update:modelValue",u),d("change",u)}}},render(){var i;const{disabled:a,radioName:d,value:n,isChecked:r,$slots:l,handleChange:h}=this,g=["devui-radio",{active:r,disabled:a}];return e.createVNode("label",{class:g},[e.createVNode("input",{type:"radio",name:d,class:"devui-radio-input",disabled:a,onChange:h,value:n,checked:r},null),e.createVNode("span",{class:"devui-radio-material"},[e.createVNode("svg",{height:"100%",width:"100%",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},[e.createVNode("circle",{class:{"devui-radio-material-outer":!0,disabled:a},cx:"512",cy:"512",r:"486.5","stroke-width":"51"},null),e.createVNode("circle",{class:{"devui-radio-material-inner":!0,disabled:a},cx:"512","fill-rule":"nonzero",cy:"512",r:"320"},null)])]),e.createVNode("span",{class:"devui-radio-label"},[(i=l.default)==null?void 0:i.call(l)])])}}),_="";function R(a){return typeof a=="function"||Object.prototype.toString.call(a)==="[object Object]"&&!e.isVNode(a)}var m=e.defineComponent({name:"DRadioGroup",props:N,emits:["change","update:modelValue"],setup(a,{emit:d}){const n=r=>{d("update:modelValue",r),d("change",r)};e.provide(y,{modelValue:e.toRef(a,"modelValue"),name:e.toRef(a,"name"),disabled:e.toRef(a,"disabled"),beforeChange:a.beforeChange,emitChange:n})},render(){const{values:a,direction:d}=this,n=()=>{const r=this.$slots.default;return r?r():Array.isArray(a)?a.map(l=>e.createVNode(c,{key:l,value:l},R(l)?l:{default:()=>[l]})):""};return e.createVNode("div",{class:["devui-radio-group",{"is-row":d==="row","is-column":d==="column"}]},[n()])}}),w={title:"Radio \u5355\u9009\u6846",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(a){a.component(c.name,c),a.component(m.name,m)}};t.Radio=c,t.RadioGroup=m,t.default=w,Object.defineProperty(t,"__esModule",{value:!0}),t[Symbol.toStringTag]="Module"});
1
+ var _=Object.defineProperty,P=Object.defineProperties;var k=Object.getOwnPropertyDescriptors;var v=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,D=Object.prototype.propertyIsEnumerable;var N=(a,e,d)=>e in a?_(a,e,{enumerable:!0,configurable:!0,writable:!0,value:d}):a[e]=d,b=(a,e)=>{for(var d in e||(e={}))x.call(e,d)&&N(a,d,e[d]);if(v)for(var d of v(e))D.call(e,d)&&N(a,d,e[d]);return a},y=(a,e)=>P(a,k(e));(function(a,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(a=typeof globalThis!="undefined"?globalThis:a||self,e(a.index={},a.Vue))})(this,function(a,e){"use strict";const d={modelValue:{type:String,default:null},name:{type:String,default:null},beforeChange:{type:Function,default:null},disabled:{type:Boolean,default:!1}},R=y(b({},d),{value:{type:String,required:!0,default:null}}),w=y(b({},d),{values:{type:Array,default:null},direction:{type:String,default:"column"}}),C=Symbol("DRadioGroup");function m(n,o,t){let r=n;return o&&(r+=`__${o}`),t&&(r+=`--${t}`),r}function V(n){const o=`devui-${n}`;return{b:()=>m(o),e:l=>l?m(o,l):"",m:l=>l?m(o,"",l):"",em:(l,i)=>l&&i?m(o,l,i):""}}var G="",h=e.defineComponent({name:"DRadio",props:R,emits:["change","update:modelValue"],setup(n,{emit:o}){const t=e.inject(C,null),r=e.computed(()=>n.disabled||(t==null?void 0:t.disabled.value)),c=e.computed(()=>{const i=t?t.modelValue.value:n.modelValue;return n.value===i}),u=e.computed(()=>t?t.name.value:n.name||void 0),l=i=>{const s=n.beforeChange||(t?t.beforeChange:null);let f=Promise.resolve(!0);if(s){const g=s(i);if(typeof g=="undefined")return f;typeof g=="boolean"?f=Promise.resolve(g):f=g}return f};return{isChecked:c,radioName:u,disabled:r,handleChange:async i=>{const s=n.value;if(!await l(s)){i.preventDefault();return}t==null||t.emitChange(s),o("update:modelValue",s),o("change",s)}}},render(){var s;const{disabled:n,radioName:o,value:t,isChecked:r,$slots:c,handleChange:u}=this,l=V("radio"),i=[l.b(),{active:r,disabled:n}];return e.createVNode("label",{class:i},[e.createVNode("input",{type:"radio",name:o,class:l.e("input"),disabled:n,onChange:u,value:t,checked:r},null),e.createVNode("span",{class:l.e("material")},[e.createVNode("svg",{height:"100%",width:"100%",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},[e.createVNode("circle",{class:{[l.e("material-outer")]:!0,disabled:n},cx:"512",cy:"512",r:"486.5","stroke-width":"51"},null),e.createVNode("circle",{class:{[l.e("material-inner")]:!0,disabled:n},cx:"512","fill-rule":"nonzero",cy:"512",r:"320"},null)])]),e.createVNode("span",{class:l.e("label")},[(s=c.default)==null?void 0:s.call(c)])])}}),A="";function S(n){return typeof n=="function"||Object.prototype.toString.call(n)==="[object Object]"&&!e.isVNode(n)}var p=e.defineComponent({name:"DRadioGroup",props:w,emits:["change","update:modelValue"],setup(n,{emit:o}){const t=r=>{o("update:modelValue",r),o("change",r)};e.provide(C,{modelValue:e.toRef(n,"modelValue"),name:e.toRef(n,"name"),disabled:e.toRef(n,"disabled"),beforeChange:n.beforeChange,emitChange:t})},render(){const{values:n,direction:o}=this,t=V("radio-group"),r=()=>{const c=this.$slots.default;return c?c():Array.isArray(n)?n.map(u=>e.createVNode(h,{key:u,value:u},S(u)?u:{default:()=>[u]})):""};return e.createVNode("div",{class:[t.b(),{"is-row":o==="row","is-column":o==="column"}]},[r()])}}),j={title:"Radio \u5355\u9009\u6846",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(n){n.component(h.name,h),n.component(p.name,p)}};a.Radio=h,a.RadioGroup=p,a.default=j,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});
package/radio/style.css CHANGED
@@ -1 +1 @@
1
- @charset "UTF-8";.devui-radio{display:flex;justify-content:flex-start;align-items:center;font-size:var(--devui-font-size, 12px);line-height:1.5;font-weight:400;cursor:pointer;color:var(--devui-text, #252b3a)}.devui-radio:hover .devui-radio-label{color:var(--devui-primary-hover, #7693f5)}.devui-radio:active .devui-radio-material-outer,.devui-radio:focus .devui-radio-material-outer,.devui-radio:hover .devui-radio-material-outer{stroke:var(--devui-form-control-line-active-hover, #344899)}.devui-radio:active .devui-radio-material-inner,.devui-radio:focus .devui-radio-material-inner,.devui-radio:hover .devui-radio-material-inner{fill:var(--devui-icon-fill-active-hover, #526ecc)}.devui-radio.active .devui-radio-material-outer{opacity:1;stroke:var(--devui-form-control-line-active-hover, #344899);transition:stroke 50ms var(--devui-animation-ease-in-out, cubic-bezier(.5, .05, .5, .95))}.devui-radio.active .devui-radio-material-outer.disabled{stroke:var(--devui-icon-fill-active-disabled, #beccfa);fill:transparent}.devui-radio.active .devui-radio-material-inner{opacity:1;transform:scale(1);transition:transform var(--devui-animation-duration-base, .2s) var(--devui-animation-ease-in-out, cubic-bezier(.5, .05, .5, .95)),opacity var(--devui-animation-duration-base, .2s) var(--devui-animation-ease-in-out, cubic-bezier(.5, .05, .5, .95))}.devui-radio.active .devui-radio-material-inner.disabled{fill:var(--devui-icon-fill-active-disabled, #beccfa)}.devui-radio.disabled{cursor:not-allowed}.devui-radio.disabled .devui-radio-material-outer{stroke:var(--devui-disabled-line, #dfe1e6);fill:var(--devui-disabled-bg, #f5f5f6)}.devui-radio.disabled .devui-radio-material-inner{fill:var(--devui-icon-fill-active-disabled, #beccfa)}.devui-radio.disabled .devui-radio-label{color:var(--devui-disabled-text, #adb0b8)}.devui-radio-material{vertical-align:middle;position:relative;display:inline-block;overflow:hidden;height:16px;width:16px;line-height:16px;user-select:none}.devui-radio-material-outer{opacity:1;transition:stroke 50ms cubic-bezier(.755,.05,.855,.06);stroke:var(--devui-line, #adb0b8);fill:transparent}.devui-radio-material-inner{opacity:0;transform:scale(0);transform-origin:50% 50%;transition:transform .2s cubic-bezier(.755,.05,.855,.06),opacity .2s cubic-bezier(.755,.05,.855,.06);fill:var(--devui-icon-fill-active, #5e7ce0)}.devui-radio-label{color:var(--devui-text, #252b3a);margin-left:8px;font-size:var(--devui-font-size, 12px);transition:color .3s cubic-bezier(.645,.045,.355,1)}.devui-radio-input{opacity:0;z-index:-1;width:0;height:0;display:none;overflow:hidden;pointer-events:none}.devui-radio-group{display:flex;flex-wrap:wrap;justify-content:flex-start;align-items:flex-start}.devui-radio-group.is-row{flex-direction:row}.devui-radio-group.is-column{flex-direction:column}.devui-radio-group .devui-radio{line-height:28px}.devui-radio-group .devui-radio:not(:last-child){padding-right:20px}
1
+ @charset "UTF-8";.devui-radio{display:flex;justify-content:flex-start;align-items:center;font-size:var(--devui-font-size, 12px);line-height:1.5;font-weight:400;cursor:pointer;color:var(--devui-text, #252b3a)}.devui-radio:hover .devui-radio__label{color:var(--devui-primary-hover, #7693f5)}.devui-radio:active .devui-radio__material-outer,.devui-radio:focus .devui-radio__material-outer,.devui-radio:hover .devui-radio__material-outer{stroke:var(--devui-form-control-line-active-hover, #344899)}.devui-radio:active .devui-radio__material-inner,.devui-radio:focus .devui-radio__material-inner,.devui-radio:hover .devui-radio__material-inner{fill:var(--devui-icon-fill-active-hover, #526ecc)}.devui-radio.active .devui-radio__material-outer{opacity:1;stroke:var(--devui-form-control-line-active-hover, #344899);transition:stroke 50ms var(--devui-animation-ease-in-out, cubic-bezier(.5, .05, .5, .95))}.devui-radio.active .devui-radio__material-outer.disabled{stroke:var(--devui-icon-fill-active-disabled, #beccfa);fill:transparent}.devui-radio.active .devui-radio__material-inner{opacity:1;transform:scale(1);transition:transform var(--devui-animation-duration-base, .2s) var(--devui-animation-ease-in-out, cubic-bezier(.5, .05, .5, .95)),opacity var(--devui-animation-duration-base, .2s) var(--devui-animation-ease-in-out, cubic-bezier(.5, .05, .5, .95))}.devui-radio.active .devui-radio__material-inner.disabled{fill:var(--devui-icon-fill-active-disabled, #beccfa)}.devui-radio.disabled{cursor:not-allowed}.devui-radio.disabled .devui-radio__material-outer{stroke:var(--devui-disabled-line, #dfe1e6);fill:var(--devui-disabled-bg, #f5f5f6)}.devui-radio.disabled .devui-radio__material-inner{fill:var(--devui-icon-fill-active-disabled, #beccfa)}.devui-radio.disabled .devui-radio__label{color:var(--devui-disabled-text, #adb0b8)}.devui-radio__material{vertical-align:middle;position:relative;display:inline-block;overflow:hidden;height:16px;width:16px;line-height:16px;user-select:none}.devui-radio__material-outer{opacity:1;transition:stroke 50ms cubic-bezier(.755,.05,.855,.06);stroke:var(--devui-line, #adb0b8);fill:transparent}.devui-radio__material-inner{opacity:0;transform:scale(0);transform-origin:50% 50%;transition:transform .2s cubic-bezier(.755,.05,.855,.06),opacity .2s cubic-bezier(.755,.05,.855,.06);fill:var(--devui-icon-fill-active, #5e7ce0)}.devui-radio__label{color:var(--devui-text, #252b3a);margin-left:8px;font-size:var(--devui-font-size, 12px);transition:color .3s cubic-bezier(.645,.045,.355,1)}.devui-radio__input{opacity:0;z-index:-1;width:0;height:0;display:none;overflow:hidden;pointer-events:none}.devui-radio-group{display:flex;flex-wrap:wrap;justify-content:flex-start;align-items:flex-start}.devui-radio-group.is-row{flex-direction:row}.devui-radio-group.is-column{flex-direction:column}.devui-radio-group .devui-radio{line-height:28px}.devui-radio-group .devui-radio:not(:last-child){padding-right:20px}
package/rate/index.es.js CHANGED
@@ -41,6 +41,29 @@ const rateProps = {
41
41
  default: void 0
42
42
  }
43
43
  };
44
+ function createBem(namespace, element, modifier) {
45
+ let cls = namespace;
46
+ if (element) {
47
+ cls += `__${element}`;
48
+ }
49
+ if (modifier) {
50
+ cls += `--${modifier}`;
51
+ }
52
+ return cls;
53
+ }
54
+ function useNamespace(block) {
55
+ const namespace = `devui-${block}`;
56
+ const b = () => createBem(namespace);
57
+ const e = (element) => element ? createBem(namespace, element) : "";
58
+ const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
59
+ const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
60
+ return {
61
+ b,
62
+ e,
63
+ m,
64
+ em
65
+ };
66
+ }
44
67
  var rate = "";
45
68
  var Rate = defineComponent({
46
69
  name: "DRate",
@@ -127,22 +150,24 @@ var Rate = defineComponent({
127
150
  selectValue,
128
151
  onMouseleave
129
152
  } = this;
153
+ const ns = useNamespace("rate");
130
154
  return createVNode("div", {
131
- "class": "devui-star-container",
132
- "onMouseleave": onMouseleave
155
+ "class": ns.b(),
156
+ "onMouseleave": onMouseleave,
157
+ "style": `--star-color: ${color}`
133
158
  }, [totalLevelArray.map((item, index2) => createVNode("div", {
134
- "class": `devui-star-align devui-pointer ${read ? "devui-only-read" : ""}`,
159
+ "class": [ns.m("align"), ns.m("pointer"), read ? ns.m("only-read") : ""],
135
160
  "key": index2,
136
161
  "onMouseover": (e) => hoverToggle(e, index2),
137
162
  "onClick": (e) => selectValue(e, index2)
138
163
  }, [icon && !character && createVNode("span", {
139
- "class": "devui-star-color"
164
+ "class": ns.e("color")
140
165
  }, [createVNode(resolveComponent("d-icon"), {
141
166
  "name": icon
142
167
  }, null)]), character && !icon && createVNode("span", {
143
- "class": "devui-star-color"
168
+ "class": ns.e("color")
144
169
  }, [character]), !icon && !character && createVNode("span", {
145
- "class": "devui-star-color"
170
+ "class": ns.e("color")
146
171
  }, [createVNode("svg", {
147
172
  "width": "16px",
148
173
  "height": "16px",
@@ -161,7 +186,7 @@ var Rate = defineComponent({
161
186
  }, [createVNode("polygon", {
162
187
  "points": "8 12.7603585 3.67376208 14.3147912 3.81523437 9.71994835 1 6.0857977 5.41367261 4.80046131 8 1 10.5863274 4.80046131 15 6.0857977 12.1847656 9.71994835 12.3262379 14.3147912"
163
188
  }, null)])])])]), icon && !character && createVNode("span", {
164
- "class": `devui-star-color-active devui-active-star devui-star-color-${type}`,
189
+ "class": [ns.e("color-active"), ns.e("active-star"), ns.em("color", type)],
165
190
  "style": {
166
191
  width: item.width
167
192
  }
@@ -169,15 +194,14 @@ var Rate = defineComponent({
169
194
  "name": icon,
170
195
  "color": color
171
196
  }, null)]), character && !icon && createVNode("span", {
172
- "class": `devui-star-color-active devui-active-star devui-star-color-${type}`,
197
+ "class": [ns.e("color-active"), ns.e("active-star"), ns.em("color", type)],
173
198
  "style": {
174
199
  color,
175
200
  width: item.width
176
201
  }
177
202
  }, [character]), !character && !icon && createVNode("span", {
178
- "class": `devui-star-color-active devui-active-star devui-star-color-${type}`,
203
+ "class": [ns.e("color-active"), ns.e("active-star"), !color ? ns.em("color", type) : ns.em("color", "customize")],
179
204
  "style": {
180
- color,
181
205
  width: item.width
182
206
  }
183
207
  }, [createVNode("svg", {
package/rate/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(r,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(r=typeof globalThis!="undefined"?globalThis:r||self,e(r.index={},r.Vue))})(this,function(r,e){"use strict";const g={modelValue:{type:Number,default:0},read:{type:Boolean,default:!1},count:{type:Number,default:5},type:{type:String,default:""},color:{type:String,default:""},icon:{type:String,default:""},character:{type:String,default:""},allowHalf:{type:Boolean,default:!1},onChange:{type:Function,default:void 0},onTouched:{type:Function,default:void 0}};var p="",f=e.defineComponent({name:"DRate",props:g,emits:["change","update:modelValue"],setup(a,i){const n=e.reactive([]),c=e.ref(0),l=(o,t,h)=>{for(let v=o;v<t;v++)n[v].width=h},s=()=>{c.value=a.modelValue;const o=c.value%1,t=Math.floor(c.value);l(0,t,"100%"),o>0?(n[t].width=o*100+"%",l(t+1,a.count,"0")):l(t,a.count,"0")};e.onMounted(()=>{for(let o=0;o<a.count;o++)n.push({width:"0"});s()});const d=o=>{const t=o.target;return a.allowHalf&&o.offsetX*2<=t.clientWidth};return{totalLevelArray:n,chooseValue:c,hoverToggle:(o,t)=>{if(a.read)return;l(0,t+1,"100%");const h=d(o)?"50%":"100%";l(t,t+1,h),l(t+1,a.count,"0")},selectValue:(o,t)=>{a.read||(l(0,t,"100%"),d(o)?(l(t,t+1,"50%"),c.value=t-.5):(l(t,t+1,"100%"),c.value=t),l(t+1,a.count,"0"),a.onChange&&a.onChange(c.value+1),a.onTouched&&a.onTouched(),i.emit("update:modelValue",c.value+1))},onMouseleave:()=>{s()}}},render(){const{totalLevelArray:a,icon:i,character:n,read:c,type:l,color:s,hoverToggle:d,selectValue:w,onMouseleave:V}=this;return e.createVNode("div",{class:"devui-star-container",onMouseleave:V},[a.map((u,o)=>e.createVNode("div",{class:`devui-star-align devui-pointer ${c?"devui-only-read":""}`,key:o,onMouseover:t=>d(t,o),onClick:t=>w(t,o)},[i&&!n&&e.createVNode("span",{class:"devui-star-color"},[e.createVNode(e.resolveComponent("d-icon"),{name:i},null)]),n&&!i&&e.createVNode("span",{class:"devui-star-color"},[n]),!i&&!n&&e.createVNode("span",{class:"devui-star-color"},[e.createVNode("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns-xlink":"http://www.w3.org/1999/xlink"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("g",{fill:"#E3E5E9",id:"Mask"},[e.createVNode("polygon",{points:"8 12.7603585 3.67376208 14.3147912 3.81523437 9.71994835 1 6.0857977 5.41367261 4.80046131 8 1 10.5863274 4.80046131 15 6.0857977 12.1847656 9.71994835 12.3262379 14.3147912"},null)])])])]),i&&!n&&e.createVNode("span",{class:`devui-star-color-active devui-active-star devui-star-color-${l}`,style:{width:u.width}},[e.createVNode(e.resolveComponent("d-icon"),{name:i,color:s},null)]),n&&!i&&e.createVNode("span",{class:`devui-star-color-active devui-active-star devui-star-color-${l}`,style:{color:s,width:u.width}},[n]),!n&&!i&&e.createVNode("span",{class:`devui-star-color-active devui-active-star devui-star-color-${l}`,style:{color:s,width:u.width}},[e.createVNode("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns-xlink":"http://www.w3.org/1999/xlink"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("g",{id:"Mask"},[e.createVNode("polygon",{points:"8 12.7603585 3.67376208 14.3147912 3.81523437 9.71994835 1 6.0857977 5.41367261 4.80046131 8 1 10.5863274 4.80046131 15 6.0857977 12.1847656 9.71994835 12.3262379 14.3147912"},null)])])])])]))])}}),y={title:"Rate \u8BC4\u5206",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(a){a.component(f.name,f)}};r.Rate=f,r.default=y,r.rateProps=g,Object.defineProperty(r,"__esModule",{value:!0}),r[Symbol.toStringTag]="Module"});
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 y={modelValue:{type:Number,default:0},read:{type:Boolean,default:!1},count:{type:Number,default:5},type:{type:String,default:""},color:{type:String,default:""},icon:{type:String,default:""},character:{type:String,default:""},allowHalf:{type:Boolean,default:!1},onChange:{type:Function,default:void 0},onTouched:{type:Function,default:void 0}};function g(o,a,c){let r=o;return a&&(r+=`__${a}`),c&&(r+=`--${c}`),r}function p(o){const a=`devui-${o}`;return{b:()=>g(a),e:i=>i?g(a,i):"",m:i=>i?g(a,"",i):"",em:(i,h)=>i&&h?g(a,i,h):""}}var N="",w=e.defineComponent({name:"DRate",props:y,emits:["change","update:modelValue"],setup(o,a){const c=e.reactive([]),r=e.ref(0),s=(n,t,f)=>{for(let m=n;m<t;m++)c[m].width=f},u=()=>{r.value=o.modelValue;const n=r.value%1,t=Math.floor(r.value);s(0,t,"100%"),n>0?(c[t].width=n*100+"%",s(t+1,o.count,"0")):s(t,o.count,"0")};e.onMounted(()=>{for(let n=0;n<o.count;n++)c.push({width:"0"});u()});const i=n=>{const t=n.target;return o.allowHalf&&n.offsetX*2<=t.clientWidth};return{totalLevelArray:c,chooseValue:r,hoverToggle:(n,t)=>{if(o.read)return;s(0,t+1,"100%");const f=i(n)?"50%":"100%";s(t,t+1,f),s(t+1,o.count,"0")},selectValue:(n,t)=>{o.read||(s(0,t,"100%"),i(n)?(s(t,t+1,"50%"),r.value=t-.5):(s(t,t+1,"100%"),r.value=t),s(t+1,o.count,"0"),o.onChange&&o.onChange(r.value+1),o.onTouched&&o.onTouched(),a.emit("update:modelValue",r.value+1))},onMouseleave:()=>{u()}}},render(){const{totalLevelArray:o,icon:a,character:c,read:r,type:s,color:u,hoverToggle:i,selectValue:h,onMouseleave:V}=this,l=p("rate");return e.createVNode("div",{class:l.b(),onMouseleave:V,style:`--star-color: ${u}`},[o.map((n,t)=>e.createVNode("div",{class:[l.m("align"),l.m("pointer"),r?l.m("only-read"):""],key:t,onMouseover:f=>i(f,t),onClick:f=>h(f,t)},[a&&!c&&e.createVNode("span",{class:l.e("color")},[e.createVNode(e.resolveComponent("d-icon"),{name:a},null)]),c&&!a&&e.createVNode("span",{class:l.e("color")},[c]),!a&&!c&&e.createVNode("span",{class:l.e("color")},[e.createVNode("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns-xlink":"http://www.w3.org/1999/xlink"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("g",{fill:"#E3E5E9",id:"Mask"},[e.createVNode("polygon",{points:"8 12.7603585 3.67376208 14.3147912 3.81523437 9.71994835 1 6.0857977 5.41367261 4.80046131 8 1 10.5863274 4.80046131 15 6.0857977 12.1847656 9.71994835 12.3262379 14.3147912"},null)])])])]),a&&!c&&e.createVNode("span",{class:[l.e("color-active"),l.e("active-star"),l.em("color",s)],style:{width:n.width}},[e.createVNode(e.resolveComponent("d-icon"),{name:a,color:u},null)]),c&&!a&&e.createVNode("span",{class:[l.e("color-active"),l.e("active-star"),l.em("color",s)],style:{color:u,width:n.width}},[c]),!c&&!a&&e.createVNode("span",{class:[l.e("color-active"),l.e("active-star"),u?l.em("color","customize"):l.em("color",s)],style:{width:n.width}},[e.createVNode("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns-xlink":"http://www.w3.org/1999/xlink"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("g",{id:"Mask"},[e.createVNode("polygon",{points:"8 12.7603585 3.67376208 14.3147912 3.81523437 9.71994835 1 6.0857977 5.41367261 4.80046131 8 1 10.5863274 4.80046131 15 6.0857977 12.1847656 9.71994835 12.3262379 14.3147912"},null)])])])])]))])}}),v={title:"Rate \u8BC4\u5206",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(o){o.component(w.name,w)}};d.Rate=w,d.default=v,d.rateProps=y,Object.defineProperty(d,"__esModule",{value:!0}),d[Symbol.toStringTag]="Module"});
package/rate/style.css CHANGED
@@ -1 +1 @@
1
- .devui-star-align{font-size:var(--devui-font-size-icon, 16px);margin-right:5px;position:relative;line-height:1}.devui-pointer{cursor:pointer}.devui-star-container{display:inline-flex}.devui-star-color-active{color:#6a81ed;line-height:1.5}.devui-star-color-active svg g{fill:#6a81ed}.devui-star-color-success{color:#3dcca6}.devui-star-color-success svg g{fill:#3dcca6}.devui-star-color-warning{color:#fac20a}.devui-star-color-warning svg g{fill:#fac20a}.devui-star-color-error{color:#f66f6a}.devui-star-color-error svg g{fill:#f66f6a}.devui-active-star{position:absolute;top:0;left:0;overflow:hidden}.devui-star-color{color:var(--devui-dividing-line, #dfe1e6);line-height:1.5}.devui-star-color .icon{color:var(--devui-dividing-line, #dfe1e6)!important}.devui-star-color svg g{fill:var(--devui-dividing-line, #dfe1e6)}.devui-only-read{cursor:not-allowed}
1
+ .devui-rate--align{font-size:var(--devui-font-size-icon, 16px);margin-right:5px;position:relative;line-height:1}.devui-rate--pointer{cursor:pointer}.devui-rate{display:inline-flex}.devui-rate__color-active{color:#6a81ed;line-height:1.5}.devui-rate__color-active svg g{fill:#6a81ed}.devui-rate__color--success{color:#3dcca6}.devui-rate__color--success svg g{fill:#3dcca6}.devui-rate__color--warning{color:#fac20a}.devui-rate__color--warning svg g{fill:#fac20a}.devui-rate__color--error{color:#f66f6a}.devui-rate__color--error svg g{fill:#f66f6a}.devui-rate__color--customize{color:var(--star-color)}.devui-rate__color--customize svg g{fill:var(--star-color)}.devui-rate__active-star{position:absolute;top:0;left:0;overflow:hidden}.devui-rate__color{color:var(--devui-dividing-line, #dfe1e6);line-height:1.5}.devui-rate__color .icon{color:var(--devui-dividing-line, #dfe1e6)!important}.devui-rate__color svg g{fill:var(--devui-dividing-line, #dfe1e6)}.devui-rate--only-read{cursor:not-allowed}