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.
- package/alert/index.es.js +2 -2
- package/alert/index.umd.js +1 -1
- package/auto-complete/index.es.js +282 -84
- package/auto-complete/index.umd.js +3 -5
- package/auto-complete/style.css +1 -1
- package/avatar/index.es.js +59 -74
- package/avatar/index.umd.js +1 -1
- package/badge/index.es.js +2 -2
- package/badge/index.umd.js +1 -1
- package/button/index.es.js +111 -38
- package/button/index.umd.js +15 -15
- package/button/style.css +1 -1
- package/card/index.es.js +2 -2
- package/card/index.umd.js +1 -1
- package/checkbox/index.es.js +340 -228
- package/checkbox/index.umd.js +1 -1
- package/checkbox/style.css +1 -1
- package/date-picker/index.es.js +264 -63
- package/date-picker/index.umd.js +1 -1
- package/date-picker/style.css +1 -1
- package/drawer/index.es.js +2 -2
- package/drawer/index.umd.js +1 -1
- package/dropdown/index.es.js +104 -48
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +423 -8
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.es.js +304 -184
- package/form/index.umd.js +15 -15
- package/form/style.css +1 -1
- package/fullscreen/index.es.js +2 -2
- package/fullscreen/index.umd.js +1 -1
- package/grid/index.es.js +8 -6
- package/grid/index.umd.js +1 -1
- package/icon/index.es.js +109 -13
- package/icon/index.umd.js +1 -1
- package/icon/style.css +1 -0
- package/image-preview/index.es.js +2 -2
- package/image-preview/index.umd.js +1 -1
- package/input/index.es.js +278 -30
- package/input/index.umd.js +1 -1
- package/input/style.css +1 -1
- package/input-number/index.es.js +272 -199
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.es.js +2 -2
- package/layout/index.umd.js +1 -1
- package/loading/index.es.js +2 -2
- package/loading/index.umd.js +1 -1
- package/modal/index.es.js +105 -32
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.es.js +105 -32
- package/notification/index.umd.js +1 -1
- package/notification/style.css +1 -1
- package/nuxt/components/CheckboxButton.js +3 -0
- package/nuxt/components/Icon.js +1 -0
- package/nuxt/components/LABEL_DATA.js +3 -0
- package/nuxt/components/Option.js +3 -0
- package/nuxt/components/iconProps.js +1 -0
- package/nuxt/components/svgIconProps.js +3 -0
- package/overlay/index.es.js +2 -2
- package/overlay/index.umd.js +1 -1
- package/package.json +2 -1
- package/pagination/index.es.js +2 -2
- package/pagination/index.umd.js +1 -1
- package/popover/index.es.js +153 -67
- package/popover/index.umd.js +15 -15
- package/popover/style.css +1 -1
- package/progress/index.es.js +2 -2
- package/progress/index.umd.js +2 -2
- package/radio/index.es.js +139 -143
- package/radio/index.umd.js +1 -1
- package/rate/index.es.js +16 -8
- package/rate/index.umd.js +1 -1
- package/result/index.es.js +108 -12
- package/result/index.umd.js +1 -1
- package/result/style.css +1 -1
- package/search/index.es.js +316 -60
- package/search/index.umd.js +16 -16
- package/search/style.css +1 -1
- package/select/index.es.js +7334 -574
- package/select/index.umd.js +27 -1
- package/select/style.css +1 -1
- package/skeleton/index.es.js +2 -2
- package/skeleton/index.umd.js +1 -1
- package/slider/index.es.js +2 -2
- package/slider/index.umd.js +1 -1
- package/splitter/index.es.js +178 -89
- package/splitter/index.umd.js +17 -17
- package/splitter/style.css +1 -1
- package/status/index.es.js +2 -2
- package/status/index.umd.js +1 -1
- package/style.css +1 -1
- package/switch/index.es.js +2 -2
- package/switch/index.umd.js +1 -1
- package/table/index.es.js +1301 -524
- package/table/index.umd.js +18 -18
- package/table/style.css +1 -1
- package/tabs/index.es.js +114 -72
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.es.js +6 -7
- package/tag/index.umd.js +1 -1
- package/textarea/index.es.js +5545 -11
- package/textarea/index.umd.js +35 -1
- package/timeline/index.es.js +108 -12
- package/timeline/index.umd.js +1 -1
- package/timeline/style.css +1 -1
- package/tooltip/index.es.js +168 -79
- package/tooltip/index.umd.js +15 -15
- package/tooltip/style.css +1 -1
- package/tree/index.es.js +338 -227
- package/tree/index.umd.js +1 -1
- package/tree/style.css +1 -1
- package/upload/index.es.js +105 -32
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +3269 -1742
- package/vue-devui.umd.js +29 -23
- package/nuxt/components/FormControl.js +0 -3
- 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 {
|
|
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
|
-
|
|
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
|
-
|
|
148
|
+
radioName,
|
|
149
|
+
isDisabled,
|
|
140
150
|
handleChange
|
|
141
|
-
} =
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
"
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
"
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
"
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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
|
-
|
|
230
|
-
|
|
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 = {
|
package/radio/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
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,
|
|
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 =
|
|
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
|
-
|
|
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
|
|
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"});
|
package/result/index.es.js
CHANGED
|
@@ -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:
|
|
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
|
-
|
|
46
|
-
|
|
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:
|
|
51
|
-
verticalAlign: "text-bottom"
|
|
140
|
+
width: iconSize.value || ""
|
|
52
141
|
}
|
|
53
|
-
},
|
|
54
|
-
|
|
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:
|
|
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
|
});
|
package/result/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
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}
|