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

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 (123) hide show
  1. package/alert/index.es.js +2 -2
  2. package/alert/index.umd.js +1 -1
  3. package/auto-complete/index.es.js +282 -84
  4. package/auto-complete/index.umd.js +3 -5
  5. package/auto-complete/style.css +1 -1
  6. package/avatar/index.es.js +59 -74
  7. package/avatar/index.umd.js +1 -1
  8. package/badge/index.es.js +2 -2
  9. package/badge/index.umd.js +1 -1
  10. package/button/index.es.js +111 -38
  11. package/button/index.umd.js +15 -15
  12. package/button/style.css +1 -1
  13. package/card/index.es.js +2 -2
  14. package/card/index.umd.js +1 -1
  15. package/checkbox/index.es.js +340 -228
  16. package/checkbox/index.umd.js +1 -1
  17. package/checkbox/style.css +1 -1
  18. package/date-picker/index.es.js +264 -63
  19. package/date-picker/index.umd.js +1 -1
  20. package/date-picker/style.css +1 -1
  21. package/drawer/index.es.js +2 -2
  22. package/drawer/index.umd.js +1 -1
  23. package/dropdown/index.es.js +104 -48
  24. package/dropdown/index.umd.js +1 -1
  25. package/dropdown/style.css +1 -1
  26. package/editable-select/index.es.js +423 -8
  27. package/editable-select/index.umd.js +1 -1
  28. package/editable-select/style.css +1 -1
  29. package/form/index.es.js +304 -184
  30. package/form/index.umd.js +15 -15
  31. package/form/style.css +1 -1
  32. package/fullscreen/index.es.js +2 -2
  33. package/fullscreen/index.umd.js +1 -1
  34. package/grid/index.es.js +8 -6
  35. package/grid/index.umd.js +1 -1
  36. package/icon/index.es.js +109 -13
  37. package/icon/index.umd.js +1 -1
  38. package/icon/style.css +1 -0
  39. package/image-preview/index.es.js +2 -2
  40. package/image-preview/index.umd.js +1 -1
  41. package/input/index.es.js +278 -30
  42. package/input/index.umd.js +1 -1
  43. package/input/style.css +1 -1
  44. package/input-number/index.es.js +272 -199
  45. package/input-number/index.umd.js +1 -1
  46. package/input-number/style.css +1 -1
  47. package/layout/index.es.js +2 -2
  48. package/layout/index.umd.js +1 -1
  49. package/loading/index.es.js +2 -2
  50. package/loading/index.umd.js +1 -1
  51. package/modal/index.es.js +105 -32
  52. package/modal/index.umd.js +1 -1
  53. package/modal/style.css +1 -1
  54. package/notification/index.es.js +105 -32
  55. package/notification/index.umd.js +1 -1
  56. package/notification/style.css +1 -1
  57. package/nuxt/components/CheckboxButton.js +3 -0
  58. package/nuxt/components/Icon.js +1 -0
  59. package/nuxt/components/LABEL_DATA.js +3 -0
  60. package/nuxt/components/Option.js +3 -0
  61. package/nuxt/components/iconProps.js +1 -0
  62. package/nuxt/components/svgIconProps.js +3 -0
  63. package/overlay/index.es.js +2 -2
  64. package/overlay/index.umd.js +1 -1
  65. package/package.json +2 -1
  66. package/pagination/index.es.js +2 -2
  67. package/pagination/index.umd.js +1 -1
  68. package/popover/index.es.js +153 -67
  69. package/popover/index.umd.js +15 -15
  70. package/popover/style.css +1 -1
  71. package/progress/index.es.js +2 -2
  72. package/progress/index.umd.js +2 -2
  73. package/radio/index.es.js +139 -143
  74. package/radio/index.umd.js +1 -1
  75. package/rate/index.es.js +16 -8
  76. package/rate/index.umd.js +1 -1
  77. package/result/index.es.js +108 -12
  78. package/result/index.umd.js +1 -1
  79. package/result/style.css +1 -1
  80. package/search/index.es.js +316 -60
  81. package/search/index.umd.js +16 -16
  82. package/search/style.css +1 -1
  83. package/select/index.es.js +7334 -574
  84. package/select/index.umd.js +27 -1
  85. package/select/style.css +1 -1
  86. package/skeleton/index.es.js +2 -2
  87. package/skeleton/index.umd.js +1 -1
  88. package/slider/index.es.js +2 -2
  89. package/slider/index.umd.js +1 -1
  90. package/splitter/index.es.js +178 -89
  91. package/splitter/index.umd.js +17 -17
  92. package/splitter/style.css +1 -1
  93. package/status/index.es.js +2 -2
  94. package/status/index.umd.js +1 -1
  95. package/style.css +1 -1
  96. package/switch/index.es.js +2 -2
  97. package/switch/index.umd.js +1 -1
  98. package/table/index.es.js +1301 -524
  99. package/table/index.umd.js +18 -18
  100. package/table/style.css +1 -1
  101. package/tabs/index.es.js +114 -72
  102. package/tabs/index.umd.js +1 -1
  103. package/tabs/style.css +1 -1
  104. package/tag/index.es.js +6 -7
  105. package/tag/index.umd.js +1 -1
  106. package/textarea/index.es.js +5545 -11
  107. package/textarea/index.umd.js +35 -1
  108. package/timeline/index.es.js +108 -12
  109. package/timeline/index.umd.js +1 -1
  110. package/timeline/style.css +1 -1
  111. package/tooltip/index.es.js +168 -79
  112. package/tooltip/index.umd.js +15 -15
  113. package/tooltip/style.css +1 -1
  114. package/tree/index.es.js +338 -227
  115. package/tree/index.umd.js +1 -1
  116. package/tree/style.css +1 -1
  117. package/upload/index.es.js +105 -32
  118. package/upload/index.umd.js +1 -1
  119. package/upload/style.css +1 -1
  120. package/vue-devui.es.js +3269 -1742
  121. package/vue-devui.umd.js +29 -23
  122. package/nuxt/components/FormControl.js +0 -3
  123. package/nuxt/components/FormLabel.js +0 -3
package/radio/index.es.js CHANGED
@@ -17,10 +17,10 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { defineComponent, inject, computed, createVNode, provide, toRef, isVNode } from "vue";
20
+ import { inject, computed, provide, toRef, defineComponent, createVNode, isVNode } from "vue";
21
21
  const radioCommonProps = {
22
22
  modelValue: {
23
- type: String,
23
+ type: [Number, String, Boolean],
24
24
  default: null
25
25
  },
26
26
  name: {
@@ -38,7 +38,7 @@ const radioCommonProps = {
38
38
  };
39
39
  const radioProps = __spreadProps(__spreadValues({}, radioCommonProps), {
40
40
  value: {
41
- type: String,
41
+ type: [Number, String, Boolean],
42
42
  required: true,
43
43
  default: null
44
44
  }
@@ -64,8 +64,8 @@ function createBem(namespace, element, modifier) {
64
64
  }
65
65
  return cls;
66
66
  }
67
- function useNamespace(block) {
68
- const namespace = `devui-${block}`;
67
+ function useNamespace(block, needDot = false) {
68
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
69
69
  const b = () => createBem(namespace);
70
70
  const e = (element) => element ? createBem(namespace, element) : "";
71
71
  const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
@@ -77,111 +77,123 @@ function useNamespace(block) {
77
77
  em
78
78
  };
79
79
  }
80
+ function useRadio(props, ctx) {
81
+ const radioGroupConf = inject(radioGroupInjectionKey, null);
82
+ const isDisabled = computed(() => {
83
+ return props.disabled || (radioGroupConf == null ? void 0 : radioGroupConf.disabled.value);
84
+ });
85
+ const isChecked = computed(() => {
86
+ const _value = radioGroupConf ? radioGroupConf.modelValue.value : props.modelValue;
87
+ return props.value === _value;
88
+ });
89
+ const radioName = computed(() => {
90
+ return radioGroupConf ? radioGroupConf.name.value : props.name || void 0;
91
+ });
92
+ const judgeCanChange = (_value) => {
93
+ const beforeChange = props.beforeChange || (radioGroupConf ? radioGroupConf.beforeChange : null);
94
+ let flag = Promise.resolve(true);
95
+ if (beforeChange) {
96
+ const canChange = beforeChange(_value);
97
+ if (typeof canChange === "undefined") {
98
+ return flag;
99
+ }
100
+ if (typeof canChange === "boolean") {
101
+ flag = Promise.resolve(canChange);
102
+ } else {
103
+ flag = canChange;
104
+ }
105
+ }
106
+ return flag;
107
+ };
108
+ const handleChange = async (event) => {
109
+ const _value = props.value;
110
+ const canChange = await judgeCanChange(_value);
111
+ if (!canChange) {
112
+ event.preventDefault();
113
+ return;
114
+ }
115
+ radioGroupConf == null ? void 0 : radioGroupConf.emitChange(_value);
116
+ ctx.emit("update:modelValue", _value);
117
+ ctx.emit("change", _value);
118
+ };
119
+ return {
120
+ isChecked,
121
+ radioName,
122
+ isDisabled,
123
+ handleChange
124
+ };
125
+ }
126
+ function useRadioGroup(props, ctx) {
127
+ const emitChange = (radioValue) => {
128
+ ctx.emit("update:modelValue", radioValue);
129
+ ctx.emit("change", radioValue);
130
+ };
131
+ provide(radioGroupInjectionKey, {
132
+ modelValue: toRef(props, "modelValue"),
133
+ name: toRef(props, "name"),
134
+ disabled: toRef(props, "disabled"),
135
+ beforeChange: props.beforeChange,
136
+ emitChange
137
+ });
138
+ }
80
139
  var radio = "";
81
140
  var Radio = defineComponent({
82
141
  name: "DRadio",
83
142
  props: radioProps,
84
143
  emits: ["change", "update:modelValue"],
85
- setup(props, {
86
- emit
87
- }) {
88
- const radioGroupConf = inject(radioGroupInjectionKey, null);
89
- const isDisabled = computed(() => {
90
- return props.disabled || (radioGroupConf == null ? void 0 : radioGroupConf.disabled.value);
91
- });
92
- const isChecked = computed(() => {
93
- const _value = radioGroupConf ? radioGroupConf.modelValue.value : props.modelValue;
94
- return props.value === _value;
95
- });
96
- const radioName = computed(() => {
97
- return radioGroupConf ? radioGroupConf.name.value : props.name || void 0;
98
- });
99
- const judgeCanChange = (_value) => {
100
- const beforeChange = props.beforeChange || (radioGroupConf ? radioGroupConf.beforeChange : null);
101
- let flag = Promise.resolve(true);
102
- if (beforeChange) {
103
- const canChange = beforeChange(_value);
104
- if (typeof canChange === "undefined") {
105
- return flag;
106
- }
107
- if (typeof canChange === "boolean") {
108
- flag = Promise.resolve(canChange);
109
- } else {
110
- flag = canChange;
111
- }
112
- }
113
- return flag;
114
- };
115
- return {
116
- isChecked,
117
- radioName,
118
- disabled: isDisabled,
119
- handleChange: async (event) => {
120
- const _value = props.value;
121
- const canChange = await judgeCanChange(_value);
122
- if (!canChange) {
123
- event.preventDefault();
124
- return;
125
- }
126
- radioGroupConf == null ? void 0 : radioGroupConf.emitChange(_value);
127
- emit("update:modelValue", _value);
128
- emit("change", _value);
129
- }
130
- };
131
- },
132
- render() {
133
- var _a;
144
+ setup(props, ctx) {
145
+ const ns = useNamespace("radio");
134
146
  const {
135
- disabled,
136
- radioName,
137
- value,
138
147
  isChecked,
139
- $slots,
148
+ radioName,
149
+ isDisabled,
140
150
  handleChange
141
- } = this;
142
- const ns = useNamespace("radio");
143
- const labelCls = [ns.b(), {
144
- active: isChecked,
145
- disabled
146
- }];
147
- return createVNode("label", {
148
- "class": labelCls
149
- }, [createVNode("input", {
150
- "type": "radio",
151
- "name": radioName,
152
- "class": ns.e("input"),
153
- "disabled": disabled,
154
- "onChange": handleChange,
155
- "value": value,
156
- "checked": isChecked
157
- }, null), createVNode("span", {
158
- "class": ns.e("material")
159
- }, [createVNode("svg", {
160
- "height": "100%",
161
- "width": "100%",
162
- "viewBox": "0 0 1024 1024",
163
- "xmlns": "http://www.w3.org/2000/svg"
164
- }, [createVNode("circle", {
165
- "class": {
166
- [ns.e("material-outer")]: true,
167
- disabled
168
- },
169
- "cx": "512",
170
- "cy": "512",
171
- "r": "486.5",
172
- "stroke-width": "51"
173
- }, null), createVNode("circle", {
174
- "class": {
175
- [ns.e("material-inner")]: true,
176
- disabled
177
- },
178
- "cx": "512",
179
- "fill-rule": "nonzero",
180
- "cy": "512",
181
- "r": "320"
182
- }, null)])]), createVNode("span", {
183
- "class": ns.e("label")
184
- }, [(_a = $slots.default) == null ? void 0 : _a.call($slots)])]);
151
+ } = useRadio(props, ctx);
152
+ return () => {
153
+ var _a, _b;
154
+ const labelCls = [ns.b(), {
155
+ active: isChecked.value,
156
+ disabled: isDisabled.value
157
+ }];
158
+ return createVNode("label", {
159
+ "class": labelCls
160
+ }, [createVNode("input", {
161
+ "type": "radio",
162
+ "name": radioName.value,
163
+ "class": ns.e("input"),
164
+ "disabled": isDisabled.value,
165
+ "onChange": handleChange,
166
+ "value": props.value,
167
+ "checked": isChecked.value
168
+ }, null), createVNode("span", {
169
+ "class": ns.e("material")
170
+ }, [createVNode("svg", {
171
+ "height": "100%",
172
+ "width": "100%",
173
+ "viewBox": "0 0 1024 1024",
174
+ "xmlns": "http://www.w3.org/2000/svg"
175
+ }, [createVNode("circle", {
176
+ "class": {
177
+ [ns.e("material-outer")]: true,
178
+ disabled: isDisabled.value
179
+ },
180
+ "cx": "512",
181
+ "cy": "512",
182
+ "r": "486.5",
183
+ "stroke-width": "51"
184
+ }, null), createVNode("circle", {
185
+ "class": {
186
+ [ns.e("material-inner")]: true,
187
+ disabled: isDisabled.value
188
+ },
189
+ "cx": "512",
190
+ "fill-rule": "nonzero",
191
+ "cy": "512",
192
+ "r": "320"
193
+ }, null)])]), createVNode("span", {
194
+ "class": ns.e("label")
195
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])]);
196
+ };
185
197
  }
186
198
  });
187
199
  var radioGroup = "";
@@ -192,50 +204,34 @@ var RadioGroup = defineComponent({
192
204
  name: "DRadioGroup",
193
205
  props: radioGroupProps,
194
206
  emits: ["change", "update:modelValue"],
195
- setup(props, {
196
- emit
197
- }) {
198
- const emitChange = (radioValue) => {
199
- emit("update:modelValue", radioValue);
200
- emit("change", radioValue);
201
- };
202
- provide(radioGroupInjectionKey, {
203
- modelValue: toRef(props, "modelValue"),
204
- name: toRef(props, "name"),
205
- disabled: toRef(props, "disabled"),
206
- beforeChange: props.beforeChange,
207
- emitChange
208
- });
209
- },
210
- render() {
211
- const {
212
- values,
213
- direction
214
- } = this;
207
+ setup(props, ctx) {
215
208
  const ns = useNamespace("radio-group");
216
- const getContent = () => {
217
- const defaultSlot = this.$slots.default;
218
- if (defaultSlot) {
219
- return defaultSlot();
220
- } else if (Array.isArray(values)) {
221
- return values.map((item) => {
222
- return createVNode(Radio, {
223
- "key": item,
224
- "value": item
225
- }, _isSlot(item) ? item : {
226
- default: () => [item]
209
+ useRadioGroup(props, ctx);
210
+ return () => {
211
+ const getContent = () => {
212
+ const defaultSlot = ctx.slots.default;
213
+ if (defaultSlot) {
214
+ return defaultSlot();
215
+ } else if (Array.isArray(props.values)) {
216
+ return props.values.map((item) => {
217
+ return createVNode(Radio, {
218
+ "key": item,
219
+ "value": item
220
+ }, _isSlot(item) ? item : {
221
+ default: () => [item]
222
+ });
227
223
  });
228
- });
229
- } else {
230
- return "";
231
- }
224
+ } else {
225
+ return "";
226
+ }
227
+ };
228
+ return createVNode("div", {
229
+ "class": [ns.b(), {
230
+ "is-row": props.direction === "row",
231
+ "is-column": props.direction === "column"
232
+ }]
233
+ }, [getContent()]);
232
234
  };
233
- return createVNode("div", {
234
- "class": [ns.b(), {
235
- "is-row": direction === "row",
236
- "is-column": direction === "column"
237
- }]
238
- }, [getContent()]);
239
235
  }
240
236
  });
241
237
  var index = {
@@ -1 +1 @@
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"});
1
+ var B=Object.defineProperty,G=Object.defineProperties;var k=Object.getOwnPropertyDescriptors;var N=Object.getOwnPropertySymbols;var $=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable;var R=(t,e,u)=>e in t?B(t,e,{enumerable:!0,configurable:!0,writable:!0,value:u}):t[e]=u,p=(t,e)=>{for(var u in e||(e={}))$.call(e,u)&&R(t,u,e[u]);if(N)for(var u of N(e))A.call(e,u)&&R(t,u,e[u]);return t},v=(t,e)=>G(t,k(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 u={modelValue:{type:[Number,String,Boolean],default:null},name:{type:String,default:null},beforeChange:{type:Function,default:null},disabled:{type:Boolean,default:!1}},w=v(p({},u),{value:{type:[Number,String,Boolean],required:!0,default:null}}),S=v(p({},u),{values:{type:Array,default:null},direction:{type:String,default:"column"}}),C=Symbol("DRadioGroup");function m(a,o,n){let l=a;return o&&(l+=`__${o}`),n&&(l+=`--${n}`),l}function V(a,o=!1){const n=o?`.devui-${a}`:`devui-${a}`;return{b:()=>m(n),e:i=>i?m(n,i):"",m:i=>i?m(n,"",i):"",em:(i,r)=>i&&r?m(n,i,r):""}}function j(a,o){const n=e.inject(C,null),l=e.computed(()=>a.disabled||(n==null?void 0:n.disabled.value)),c=e.computed(()=>{const r=n?n.modelValue.value:a.modelValue;return a.value===r}),d=e.computed(()=>n?n.name.value:a.name||void 0),h=r=>{const s=a.beforeChange||(n?n.beforeChange:null);let f=Promise.resolve(!0);if(s){const b=s(r);if(typeof b=="undefined")return f;typeof b=="boolean"?f=Promise.resolve(b):f=b}return f};return{isChecked:c,radioName:d,isDisabled:l,handleChange:async r=>{const s=a.value;if(!await h(s)){r.preventDefault();return}n==null||n.emitChange(s),o.emit("update:modelValue",s),o.emit("change",s)}}}function _(a,o){const n=l=>{o.emit("update:modelValue",l),o.emit("change",l)};e.provide(C,{modelValue:e.toRef(a,"modelValue"),name:e.toRef(a,"name"),disabled:e.toRef(a,"disabled"),beforeChange:a.beforeChange,emitChange:n})}var O="",g=e.defineComponent({name:"DRadio",props:w,emits:["change","update:modelValue"],setup(a,o){const n=V("radio"),{isChecked:l,radioName:c,isDisabled:d,handleChange:h}=j(a,o);return()=>{var r,s;const i=[n.b(),{active:l.value,disabled:d.value}];return e.createVNode("label",{class:i},[e.createVNode("input",{type:"radio",name:c.value,class:n.e("input"),disabled:d.value,onChange:h,value:a.value,checked:l.value},null),e.createVNode("span",{class:n.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:{[n.e("material-outer")]:!0,disabled:d.value},cx:"512",cy:"512",r:"486.5","stroke-width":"51"},null),e.createVNode("circle",{class:{[n.e("material-inner")]:!0,disabled:d.value},cx:"512","fill-rule":"nonzero",cy:"512",r:"320"},null)])]),e.createVNode("span",{class:n.e("label")},[(s=(r=o.slots).default)==null?void 0:s.call(r)])])}}}),T="";function D(a){return typeof a=="function"||Object.prototype.toString.call(a)==="[object Object]"&&!e.isVNode(a)}var y=e.defineComponent({name:"DRadioGroup",props:S,emits:["change","update:modelValue"],setup(a,o){const n=V("radio-group");return _(a,o),()=>{const l=()=>{const c=o.slots.default;return c?c():Array.isArray(a.values)?a.values.map(d=>e.createVNode(g,{key:d,value:d},D(d)?d:{default:()=>[d]})):""};return e.createVNode("div",{class:[n.b(),{"is-row":a.direction==="row","is-column":a.direction==="column"}]},[l()])}}}),P={title:"Radio \u5355\u9009\u6846",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(a){a.component(g.name,g),a.component(y.name,y)}};t.Radio=g,t.RadioGroup=y,t.default=P,Object.defineProperty(t,"__esModule",{value:!0}),t[Symbol.toStringTag]="Module"});
package/rate/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent, reactive, ref, onMounted, createVNode, resolveComponent } from "vue";
1
+ import { defineComponent, ref, watch, onMounted, createVNode, resolveComponent } from "vue";
2
2
  const rateProps = {
3
3
  modelValue: {
4
4
  type: Number,
@@ -51,8 +51,8 @@ function createBem(namespace, element, modifier) {
51
51
  }
52
52
  return cls;
53
53
  }
54
- function useNamespace(block) {
55
- const namespace = `devui-${block}`;
54
+ function useNamespace(block, needDot = false) {
55
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
56
56
  const b = () => createBem(namespace);
57
57
  const e = (element) => element ? createBem(namespace, element) : "";
58
58
  const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
@@ -70,11 +70,11 @@ var Rate = defineComponent({
70
70
  props: rateProps,
71
71
  emits: ["change", "update:modelValue"],
72
72
  setup(props, ctx) {
73
- const totalLevelArray = reactive([]);
73
+ const totalLevelArray = ref([]);
74
74
  const chooseValue = ref(0);
75
75
  const setChange = (start, end, width) => {
76
76
  for (let i = start; i < end; i++) {
77
- totalLevelArray[i]["width"] = width;
77
+ totalLevelArray.value[i]["width"] = width;
78
78
  }
79
79
  };
80
80
  const initRating = () => {
@@ -83,18 +83,26 @@ var Rate = defineComponent({
83
83
  const intCurrentLevel = Math.floor(chooseValue.value);
84
84
  setChange(0, intCurrentLevel, "100%");
85
85
  if (halfStar > 0) {
86
- totalLevelArray[intCurrentLevel]["width"] = halfStar * 100 + "%";
86
+ totalLevelArray.value[intCurrentLevel]["width"] = halfStar * 100 + "%";
87
87
  setChange(intCurrentLevel + 1, props.count, "0");
88
88
  } else {
89
89
  setChange(intCurrentLevel, props.count, "0");
90
90
  }
91
91
  };
92
- onMounted(() => {
92
+ const initLevelArray = () => {
93
+ totalLevelArray.value = [];
93
94
  for (let i = 0; i < props.count; i++) {
94
- totalLevelArray.push({
95
+ totalLevelArray.value.push({
95
96
  width: "0"
96
97
  });
97
98
  }
99
+ };
100
+ watch([() => props.modelValue, () => props.count], () => {
101
+ initLevelArray();
102
+ initRating();
103
+ });
104
+ onMounted(() => {
105
+ initLevelArray();
98
106
  initRating();
99
107
  });
100
108
  const isSemiSelected = (e) => {
package/rate/index.umd.js CHANGED
@@ -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 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"});
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 V={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,c,a){let r=o;return c&&(r+=`__${c}`),a&&(r+=`--${a}`),r}function p(o,c=!1){const a=c?`.devui-${o}`:`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 k="",m=e.defineComponent({name:"DRate",props:V,emits:["change","update:modelValue"],setup(o,c){const a=e.ref([]),r=e.ref(0),s=(n,t,v)=>{for(let y=n;y<t;y++)a.value[y].width=v},u=()=>{r.value=o.modelValue;const n=r.value%1,t=Math.floor(r.value);s(0,t,"100%"),n>0?(a.value[t].width=n*100+"%",s(t+1,o.count,"0")):s(t,o.count,"0")},f=()=>{a.value=[];for(let n=0;n<o.count;n++)a.value.push({width:"0"})};e.watch([()=>o.modelValue,()=>o.count],()=>{f(),u()}),e.onMounted(()=>{f(),u()});const i=n=>{const t=n.target;return o.allowHalf&&n.offsetX*2<=t.clientWidth};return{totalLevelArray:a,chooseValue:r,hoverToggle:(n,t)=>{if(o.read)return;s(0,t+1,"100%");const v=i(n)?"50%":"100%";s(t,t+1,v),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(),c.emit("update:modelValue",r.value+1))},onMouseleave:()=>{u()}}},render(){const{totalLevelArray:o,icon:c,character:a,read:r,type:s,color:u,hoverToggle:f,selectValue:i,onMouseleave:h}=this,l=p("rate");return e.createVNode("div",{class:l.b(),onMouseleave:h,style:`--star-color: ${u}`},[o.map((w,n)=>e.createVNode("div",{class:[l.m("align"),l.m("pointer"),r?l.m("only-read"):""],key:n,onMouseover:t=>f(t,n),onClick:t=>i(t,n)},[c&&!a&&e.createVNode("span",{class:l.e("color")},[e.createVNode(e.resolveComponent("d-icon"),{name:c},null)]),a&&!c&&e.createVNode("span",{class:l.e("color")},[a]),!c&&!a&&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)])])])]),c&&!a&&e.createVNode("span",{class:[l.e("color-active"),l.e("active-star"),l.em("color",s)],style:{width:w.width}},[e.createVNode(e.resolveComponent("d-icon"),{name:c,color:u},null)]),a&&!c&&e.createVNode("span",{class:[l.e("color-active"),l.e("active-star"),l.em("color",s)],style:{color:u,width:w.width}},[a]),!a&&!c&&e.createVNode("span",{class:[l.e("color-active"),l.e("active-star"),u?l.em("color","customize"):l.em("color",s)],style:{width:w.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)])])])])]))])}}),N={title:"Rate \u8BC4\u5206",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(o){o.component(m.name,m)}};d.Rate=m,d.default=N,d.rateProps=V,Object.defineProperty(d,"__esModule",{value:!0}),d[Symbol.toStringTag]="Module"});
@@ -1,4 +1,4 @@
1
- import { defineComponent, toRefs, createVNode } from "vue";
1
+ import { defineComponent, toRefs, computed, createVNode, resolveDynamicComponent, mergeProps } from "vue";
2
2
  const resultProps = {
3
3
  icon: {
4
4
  type: String,
@@ -13,6 +13,10 @@ const resultProps = {
13
13
  default: ""
14
14
  }
15
15
  };
16
+ function isUrl(value) {
17
+ return /^((http|https):)?\/\//.test(value);
18
+ }
19
+ const DEFAULT_PREFIX = "icon";
16
20
  const iconProps = {
17
21
  name: {
18
22
  type: String,
@@ -20,43 +24,135 @@ const iconProps = {
20
24
  required: true
21
25
  },
22
26
  size: {
23
- type: String,
27
+ type: [Number, String],
24
28
  default: "inherit"
25
29
  },
26
30
  color: {
27
31
  type: String,
28
32
  default: "inherit"
29
33
  },
34
+ component: {
35
+ type: Object,
36
+ default: null
37
+ },
30
38
  classPrefix: {
31
39
  type: String,
32
- default: "icon"
40
+ default: DEFAULT_PREFIX
33
41
  }
34
42
  };
43
+ const svgIconProps = {
44
+ name: {
45
+ type: String,
46
+ default: "",
47
+ required: true
48
+ },
49
+ color: {
50
+ type: String,
51
+ default: "inherit"
52
+ },
53
+ size: {
54
+ type: [Number, String],
55
+ default: "inherit"
56
+ }
57
+ };
58
+ function createBem(namespace, element, modifier) {
59
+ let cls = namespace;
60
+ if (element) {
61
+ cls += `__${element}`;
62
+ }
63
+ if (modifier) {
64
+ cls += `--${modifier}`;
65
+ }
66
+ return cls;
67
+ }
68
+ function useNamespace(block, needDot = false) {
69
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
70
+ const b = () => createBem(namespace);
71
+ const e = (element) => element ? createBem(namespace, element) : "";
72
+ const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
73
+ const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
74
+ return {
75
+ b,
76
+ e,
77
+ m,
78
+ em
79
+ };
80
+ }
81
+ var icon = "";
82
+ var svgIcon = defineComponent({
83
+ name: "DSvgIcon",
84
+ props: svgIconProps,
85
+ setup(props) {
86
+ const {
87
+ name,
88
+ color,
89
+ size
90
+ } = toRefs(props);
91
+ const ns = useNamespace("svg-icon");
92
+ const iconName = computed(() => `#icon-${name.value}`);
93
+ const iconSize = computed(() => {
94
+ return typeof size.value === "number" ? `${size.value}px` : size.value;
95
+ });
96
+ const styles = {
97
+ width: iconSize.value,
98
+ height: iconSize.value
99
+ };
100
+ return () => {
101
+ return createVNode("svg", {
102
+ "class": ns.b(),
103
+ "style": styles
104
+ }, [createVNode("use", {
105
+ "xlink:href": iconName.value,
106
+ "fill": color.value
107
+ }, null)]);
108
+ };
109
+ }
110
+ });
35
111
  var Icon = defineComponent({
36
112
  name: "DIcon",
37
113
  props: iconProps,
38
- setup(props) {
114
+ setup(props, {
115
+ attrs
116
+ }) {
39
117
  const {
118
+ component,
40
119
  name,
41
120
  size,
42
121
  color,
43
122
  classPrefix
44
123
  } = toRefs(props);
45
- return () => {
46
- return /^((https?):)?\/\//.test(name.value) ? createVNode("img", {
124
+ const IconComponent = component.value ? resolveDynamicComponent(component.value) : resolveDynamicComponent(svgIcon);
125
+ const iconSize = computed(() => {
126
+ return typeof size.value === "number" ? `${size.value}px` : size.value;
127
+ });
128
+ const svgIconDom = () => {
129
+ return createVNode(IconComponent, mergeProps({
130
+ "name": name.value,
131
+ "color": color.value,
132
+ "size": iconSize.value
133
+ }, attrs), null);
134
+ };
135
+ const imgIconDom = () => {
136
+ return createVNode("img", mergeProps({
47
137
  "src": name.value,
48
138
  "alt": name.value.split("/")[name.value.split("/").length - 1],
49
139
  "style": {
50
- width: size.value,
51
- verticalAlign: "text-bottom"
140
+ width: iconSize.value || ""
52
141
  }
53
- }, null) : createVNode("i", {
54
- "class": `${classPrefix.value} ${classPrefix.value}-${name.value}`,
142
+ }, attrs), null);
143
+ };
144
+ const fontIconDom = () => {
145
+ const fontIconClass = /^icon-/.test(name.value) ? name.value : `${classPrefix.value}-${name.value}`;
146
+ return createVNode("i", mergeProps({
147
+ "class": [classPrefix.value, fontIconClass],
55
148
  "style": {
56
- fontSize: size.value,
149
+ fontSize: iconSize.value,
57
150
  color: color.value
58
151
  }
59
- }, null);
152
+ }, attrs), null);
153
+ };
154
+ return () => {
155
+ return component.value ? svgIconDom() : isUrl(name.value) ? imgIconDom() : fontIconDom();
60
156
  };
61
157
  }
62
158
  });
@@ -1 +1 @@
1
- (function(s,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(s=typeof globalThis!="undefined"?globalThis:s||self,e(s.index={},s.Vue))})(this,function(s,e){"use strict";const u={icon:{type:String,default:"info"},title:{type:String,default:""},desc:{type:String,default:""}},c={name:{type:String,default:"",required:!0},size:{type:String,default:"inherit"},color:{type:String,default:"inherit"},classPrefix:{type:String,default:"icon"}};var f=e.defineComponent({name:"DIcon",props:c,setup(i){const{name:t,size:n,color:l,classPrefix:o}=e.toRefs(i);return()=>/^((https?):)?\/\//.test(t.value)?e.createVNode("img",{src:t.value,alt:t.value.split("/")[t.value.split("/").length-1],style:{width:n.value,verticalAlign:"text-bottom"}},null):e.createVNode("i",{class:`${o.value} ${o.value}-${t.value}`,style:{fontSize:n.value,color:l.value}},null)}}),v="",r=e.defineComponent({name:"DResult",props:u,setup(i,t){let n;return function(l){l.success="right-o",l.danger="error-o",l.warning="warning-o",l.info="info-o"}(n||(n={})),()=>{var l,o,a,d;return e.createVNode("div",{class:"devui-result"},[t.slots.icon?e.createVNode("div",null,[(l=t.slots)==null?void 0:l.icon()]):e.createVNode(f,{name:n[i.icon]||"",class:`devui-result__icon-${i.icon}`,size:"64px"},null),e.createVNode("div",{class:"devui-result__title"},[t.slots.title?(o=t.slots)==null?void 0:o.title():i.title]),e.createVNode("div",{class:"devui-result__desc"},[t.slots.desc?(a=t.slots)==null?void 0:a.desc():i.desc]),e.createVNode("div",{class:"devui-result__extra"},[t.slots.extra?(d=t.slots)==null?void 0:d.extra():""])])}}}),p={title:"Result \u7ED3\u679C",category:"\u53CD\u9988",status:"100%",install(i){i.component(r.name,r)}};s.Result=r,s.default=p,s.resultProps=u,Object.defineProperty(s,"__esModule",{value:!0}),s[Symbol.toStringTag]="Module"});
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 f={icon:{type:String,default:"info"},title:{type:String,default:""},desc:{type:String,default:""}};function m(o){return/^((http|https):)?\/\//.test(o)}const v={name:{type:String,default:"",required:!0},size:{type:[Number,String],default:"inherit"},color:{type:String,default:"inherit"},component:{type:Object,default:null},classPrefix:{type:String,default:"icon"}},g={name:{type:String,default:"",required:!0},color:{type:String,default:"inherit"},size:{type:[Number,String],default:"inherit"}};function d(o,n,s){let t=o;return n&&(t+=`__${n}`),s&&(t+=`--${s}`),t}function y(o,n=!1){const s=n?`.devui-${o}`:`devui-${o}`;return{b:()=>d(s),e:l=>l?d(s,l):"",m:l=>l?d(s,"",l):"",em:(l,c)=>l&&c?d(s,l,c):""}}var $="",h=e.defineComponent({name:"DSvgIcon",props:g,setup(o){const{name:n,color:s,size:t}=e.toRefs(o),i=y("svg-icon"),a=e.computed(()=>`#icon-${n.value}`),u=e.computed(()=>typeof t.value=="number"?`${t.value}px`:t.value),l={width:u.value,height:u.value};return()=>e.createVNode("svg",{class:i.b(),style:l},[e.createVNode("use",{"xlink:href":a.value,fill:s.value},null)])}}),S=e.defineComponent({name:"DIcon",props:v,setup(o,{attrs:n}){const{component:s,name:t,size:i,color:a,classPrefix:u}=e.toRefs(o),l=s.value?e.resolveDynamicComponent(s.value):e.resolveDynamicComponent(h),c=e.computed(()=>typeof i.value=="number"?`${i.value}px`:i.value),_=()=>e.createVNode(l,e.mergeProps({name:t.value,color:a.value,size:c.value},n),null),D=()=>e.createVNode("img",e.mergeProps({src:t.value,alt:t.value.split("/")[t.value.split("/").length-1],style:{width:c.value||""}},n),null),P=()=>{const V=/^icon-/.test(t.value)?t.value:`${u.value}-${t.value}`;return e.createVNode("i",e.mergeProps({class:[u.value,V],style:{fontSize:c.value,color:a.value}},n),null)};return()=>s.value?_():m(t.value)?D():P()}}),b="",p=e.defineComponent({name:"DResult",props:f,setup(o,n){let s;return function(t){t.success="right-o",t.danger="error-o",t.warning="warning-o",t.info="info-o"}(s||(s={})),()=>{var t,i,a,u;return e.createVNode("div",{class:"devui-result"},[n.slots.icon?e.createVNode("div",null,[(t=n.slots)==null?void 0:t.icon()]):e.createVNode(S,{name:s[o.icon]||"",class:`devui-result__icon-${o.icon}`,size:"64px"},null),e.createVNode("div",{class:"devui-result__title"},[n.slots.title?(i=n.slots)==null?void 0:i.title():o.title]),e.createVNode("div",{class:"devui-result__desc"},[n.slots.desc?(a=n.slots)==null?void 0:a.desc():o.desc]),e.createVNode("div",{class:"devui-result__extra"},[n.slots.extra?(u=n.slots)==null?void 0:u.extra():""])])}}}),N={title:"Result \u7ED3\u679C",category:"\u53CD\u9988",status:"100%",install(o){o.component(p.name,p)}};r.Result=p,r.default=N,r.resultProps=f,Object.defineProperty(r,"__esModule",{value:!0}),r[Symbol.toStringTag]="Module"});
package/result/style.css CHANGED
@@ -1 +1 @@
1
- .devui-result{display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center;box-sizing:border-box;padding:30px}.devui-result__icon-success:before{color:var(--devui-success, #50d4ab)}.devui-result__icon-danger:before{color:var(--devui-danger, #f66f6a)}.devui-result__icon-warning:before{color:var(--devui-warning, #fac20a)}.devui-result__icon-info:before{color:var(--devui-info, #5e7ce0)}.devui-result__title{margin-top:20px;color:var(--devui-text, #252b3a);font-size:var(--devui-font-size-lg, 14px)}.devui-result__desc{margin-top:10px;color:var(--devui-text-weak, #575d6c);font-size:var(--devui-font-size-md, 12px)}.devui-result__extra{margin-top:30px}
1
+ .devui-svg-icon{vertical-align:middle}.devui-result{display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center;box-sizing:border-box;padding:30px}.devui-result__icon-success:before{color:var(--devui-success, #50d4ab)}.devui-result__icon-danger:before{color:var(--devui-danger, #f66f6a)}.devui-result__icon-warning:before{color:var(--devui-warning, #fac20a)}.devui-result__icon-info:before{color:var(--devui-info, #5e7ce0)}.devui-result__title{margin-top:20px;color:var(--devui-text, #252b3a);font-size:var(--devui-font-size-lg, 14px)}.devui-result__desc{margin-top:10px;color:var(--devui-text-weak, #575d6c);font-size:var(--devui-font-size-md, 12px)}.devui-result__extra{margin-top:30px}