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/input/index.es.js
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
2
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
3
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var __objRest = (source, exclude) => {
|
|
5
|
+
var target = {};
|
|
6
|
+
for (var prop in source)
|
|
7
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
8
|
+
target[prop] = source[prop];
|
|
9
|
+
if (source != null && __getOwnPropSymbols)
|
|
10
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
11
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
12
|
+
target[prop] = source[prop];
|
|
13
|
+
}
|
|
14
|
+
return target;
|
|
15
|
+
};
|
|
16
|
+
import { inject, computed, ref, toRefs, defineComponent, createVNode, resolveDynamicComponent, mergeProps, shallowRef, watch } from "vue";
|
|
2
17
|
const inputProps = {
|
|
3
18
|
modelValue: {
|
|
4
19
|
type: String,
|
|
@@ -15,6 +30,26 @@ const inputProps = {
|
|
|
15
30
|
size: {
|
|
16
31
|
type: String,
|
|
17
32
|
default: "md"
|
|
33
|
+
},
|
|
34
|
+
validateEvent: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: true
|
|
37
|
+
},
|
|
38
|
+
prefix: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: ""
|
|
41
|
+
},
|
|
42
|
+
suffix: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: ""
|
|
45
|
+
},
|
|
46
|
+
showPassword: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
49
|
+
},
|
|
50
|
+
clearable: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: false
|
|
18
53
|
}
|
|
19
54
|
};
|
|
20
55
|
const FORM_ITEM_TOKEN = Symbol("dFormItem");
|
|
@@ -28,8 +63,8 @@ function createBem(namespace, element, modifier) {
|
|
|
28
63
|
}
|
|
29
64
|
return cls;
|
|
30
65
|
}
|
|
31
|
-
function useNamespace(block) {
|
|
32
|
-
const namespace = `devui-${block}`;
|
|
66
|
+
function useNamespace(block, needDot = false) {
|
|
67
|
+
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
33
68
|
const b = () => createBem(namespace);
|
|
34
69
|
const e = (element) => element ? createBem(namespace, element) : "";
|
|
35
70
|
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
@@ -41,23 +76,36 @@ function useNamespace(block) {
|
|
|
41
76
|
em
|
|
42
77
|
};
|
|
43
78
|
}
|
|
44
|
-
function useInputRender(props) {
|
|
79
|
+
function useInputRender(props, ctx) {
|
|
45
80
|
const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
|
|
46
81
|
const isValidateError = computed(() => (formItemContext == null ? void 0 : formItemContext.validateState) === "error");
|
|
47
82
|
const ns = useNamespace("input");
|
|
83
|
+
const slotNs = useNamespace("input-slot");
|
|
48
84
|
const isFocus = ref(false);
|
|
49
85
|
const { error, size, disabled } = toRefs(props);
|
|
86
|
+
const slots = ctx.slots;
|
|
87
|
+
const _a = ctx.attrs, { style, class: customClass } = _a, otherAttrs = __objRest(_a, ["style", "class"]);
|
|
88
|
+
const customStyle = { style };
|
|
50
89
|
const wrapClasses = computed(() => ({
|
|
51
|
-
[ns.
|
|
90
|
+
[ns.e("wrapper")]: true,
|
|
52
91
|
[ns.m("focus")]: isFocus.value,
|
|
53
92
|
[ns.m("disabled")]: disabled.value,
|
|
54
93
|
[ns.m("error")]: error.value || isValidateError.value,
|
|
55
|
-
[ns.m("feedback")]: formItemContext == null ? void 0 : formItemContext.showFeedback
|
|
56
|
-
[ns.m(size.value)]: true
|
|
94
|
+
[ns.m("feedback")]: formItemContext == null ? void 0 : formItemContext.showFeedback
|
|
57
95
|
}));
|
|
58
|
-
|
|
96
|
+
const inputClasses = computed(() => [
|
|
97
|
+
{
|
|
98
|
+
[ns.b()]: true,
|
|
99
|
+
[ns.m(size.value)]: true,
|
|
100
|
+
[slotNs.b()]: slots.prepend || slots.append,
|
|
101
|
+
[ns.m("append")]: slots.append,
|
|
102
|
+
[ns.m("prepend")]: slots.prepend
|
|
103
|
+
},
|
|
104
|
+
customClass
|
|
105
|
+
]);
|
|
106
|
+
return { isFocus, wrapClasses, inputClasses, customStyle, otherAttrs };
|
|
59
107
|
}
|
|
60
|
-
function useInputEvent(isFocus, ctx) {
|
|
108
|
+
function useInputEvent(isFocus, props, ctx) {
|
|
61
109
|
const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
|
|
62
110
|
const onFocus = (e) => {
|
|
63
111
|
isFocus.value = true;
|
|
@@ -66,7 +114,9 @@ function useInputEvent(isFocus, ctx) {
|
|
|
66
114
|
const onBlur = (e) => {
|
|
67
115
|
isFocus.value = false;
|
|
68
116
|
ctx.emit("blur", e);
|
|
69
|
-
|
|
117
|
+
if (props.validateEvent) {
|
|
118
|
+
formItemContext == null ? void 0 : formItemContext.validate("blur").catch((err) => console.warn(err));
|
|
119
|
+
}
|
|
70
120
|
};
|
|
71
121
|
const onInput = (e) => {
|
|
72
122
|
ctx.emit("update:modelValue", e.target.value);
|
|
@@ -77,14 +127,154 @@ function useInputEvent(isFocus, ctx) {
|
|
|
77
127
|
const onKeydown = (e) => {
|
|
78
128
|
ctx.emit("keydown", e);
|
|
79
129
|
};
|
|
80
|
-
|
|
130
|
+
const onClear = () => {
|
|
131
|
+
ctx.emit("update:modelValue", "");
|
|
132
|
+
ctx.emit("clear");
|
|
133
|
+
};
|
|
134
|
+
return { onFocus, onBlur, onInput, onChange, onKeydown, onClear };
|
|
135
|
+
}
|
|
136
|
+
function useInputFunction(input2) {
|
|
137
|
+
const refInput = computed(() => input2.value);
|
|
138
|
+
const select = () => {
|
|
139
|
+
var _a;
|
|
140
|
+
(_a = refInput.value) == null ? void 0 : _a.select();
|
|
141
|
+
};
|
|
142
|
+
const focus = () => {
|
|
143
|
+
var _a;
|
|
144
|
+
(_a = refInput.value) == null ? void 0 : _a.focus();
|
|
145
|
+
};
|
|
146
|
+
const blur = () => {
|
|
147
|
+
var _a;
|
|
148
|
+
(_a = refInput.value) == null ? void 0 : _a.blur();
|
|
149
|
+
};
|
|
150
|
+
return { select, focus, blur };
|
|
81
151
|
}
|
|
82
152
|
var input = "";
|
|
153
|
+
function isUrl(value) {
|
|
154
|
+
return /^((http|https):)?\/\//.test(value);
|
|
155
|
+
}
|
|
156
|
+
const DEFAULT_PREFIX = "icon";
|
|
157
|
+
const iconProps = {
|
|
158
|
+
name: {
|
|
159
|
+
type: String,
|
|
160
|
+
default: "",
|
|
161
|
+
required: true
|
|
162
|
+
},
|
|
163
|
+
size: {
|
|
164
|
+
type: [Number, String],
|
|
165
|
+
default: "inherit"
|
|
166
|
+
},
|
|
167
|
+
color: {
|
|
168
|
+
type: String,
|
|
169
|
+
default: "inherit"
|
|
170
|
+
},
|
|
171
|
+
component: {
|
|
172
|
+
type: Object,
|
|
173
|
+
default: null
|
|
174
|
+
},
|
|
175
|
+
classPrefix: {
|
|
176
|
+
type: String,
|
|
177
|
+
default: DEFAULT_PREFIX
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
const svgIconProps = {
|
|
181
|
+
name: {
|
|
182
|
+
type: String,
|
|
183
|
+
default: "",
|
|
184
|
+
required: true
|
|
185
|
+
},
|
|
186
|
+
color: {
|
|
187
|
+
type: String,
|
|
188
|
+
default: "inherit"
|
|
189
|
+
},
|
|
190
|
+
size: {
|
|
191
|
+
type: [Number, String],
|
|
192
|
+
default: "inherit"
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
var icon = "";
|
|
196
|
+
var svgIcon = defineComponent({
|
|
197
|
+
name: "DSvgIcon",
|
|
198
|
+
props: svgIconProps,
|
|
199
|
+
setup(props) {
|
|
200
|
+
const {
|
|
201
|
+
name,
|
|
202
|
+
color,
|
|
203
|
+
size
|
|
204
|
+
} = toRefs(props);
|
|
205
|
+
const ns = useNamespace("svg-icon");
|
|
206
|
+
const iconName = computed(() => `#icon-${name.value}`);
|
|
207
|
+
const iconSize = computed(() => {
|
|
208
|
+
return typeof size.value === "number" ? `${size.value}px` : size.value;
|
|
209
|
+
});
|
|
210
|
+
const styles = {
|
|
211
|
+
width: iconSize.value,
|
|
212
|
+
height: iconSize.value
|
|
213
|
+
};
|
|
214
|
+
return () => {
|
|
215
|
+
return createVNode("svg", {
|
|
216
|
+
"class": ns.b(),
|
|
217
|
+
"style": styles
|
|
218
|
+
}, [createVNode("use", {
|
|
219
|
+
"xlink:href": iconName.value,
|
|
220
|
+
"fill": color.value
|
|
221
|
+
}, null)]);
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
var Icon = defineComponent({
|
|
226
|
+
name: "DIcon",
|
|
227
|
+
props: iconProps,
|
|
228
|
+
setup(props, {
|
|
229
|
+
attrs
|
|
230
|
+
}) {
|
|
231
|
+
const {
|
|
232
|
+
component,
|
|
233
|
+
name,
|
|
234
|
+
size,
|
|
235
|
+
color,
|
|
236
|
+
classPrefix
|
|
237
|
+
} = toRefs(props);
|
|
238
|
+
const IconComponent = component.value ? resolveDynamicComponent(component.value) : resolveDynamicComponent(svgIcon);
|
|
239
|
+
const iconSize = computed(() => {
|
|
240
|
+
return typeof size.value === "number" ? `${size.value}px` : size.value;
|
|
241
|
+
});
|
|
242
|
+
const svgIconDom = () => {
|
|
243
|
+
return createVNode(IconComponent, mergeProps({
|
|
244
|
+
"name": name.value,
|
|
245
|
+
"color": color.value,
|
|
246
|
+
"size": iconSize.value
|
|
247
|
+
}, attrs), null);
|
|
248
|
+
};
|
|
249
|
+
const imgIconDom = () => {
|
|
250
|
+
return createVNode("img", mergeProps({
|
|
251
|
+
"src": name.value,
|
|
252
|
+
"alt": name.value.split("/")[name.value.split("/").length - 1],
|
|
253
|
+
"style": {
|
|
254
|
+
width: iconSize.value || ""
|
|
255
|
+
}
|
|
256
|
+
}, attrs), null);
|
|
257
|
+
};
|
|
258
|
+
const fontIconDom = () => {
|
|
259
|
+
const fontIconClass = /^icon-/.test(name.value) ? name.value : `${classPrefix.value}-${name.value}`;
|
|
260
|
+
return createVNode("i", mergeProps({
|
|
261
|
+
"class": [classPrefix.value, fontIconClass],
|
|
262
|
+
"style": {
|
|
263
|
+
fontSize: iconSize.value,
|
|
264
|
+
color: color.value
|
|
265
|
+
}
|
|
266
|
+
}, attrs), null);
|
|
267
|
+
};
|
|
268
|
+
return () => {
|
|
269
|
+
return component.value ? svgIconDom() : isUrl(name.value) ? imgIconDom() : fontIconDom();
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
});
|
|
83
273
|
var Input = defineComponent({
|
|
84
274
|
name: "DInput",
|
|
85
275
|
inheritAttrs: false,
|
|
86
276
|
props: inputProps,
|
|
87
|
-
emits: ["update:modelValue", "focus", "blur", "input", "change", "keydown"],
|
|
277
|
+
emits: ["update:modelValue", "focus", "blur", "input", "change", "keydown", "clear"],
|
|
88
278
|
setup(props, ctx) {
|
|
89
279
|
const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
|
|
90
280
|
const {
|
|
@@ -92,33 +282,91 @@ var Input = defineComponent({
|
|
|
92
282
|
disabled
|
|
93
283
|
} = toRefs(props);
|
|
94
284
|
const ns = useNamespace("input");
|
|
285
|
+
const slotNs = useNamespace("input-slot");
|
|
95
286
|
const {
|
|
96
287
|
isFocus,
|
|
97
|
-
wrapClasses
|
|
98
|
-
|
|
288
|
+
wrapClasses,
|
|
289
|
+
inputClasses,
|
|
290
|
+
customStyle,
|
|
291
|
+
otherAttrs
|
|
292
|
+
} = useInputRender(props, ctx);
|
|
99
293
|
const {
|
|
100
294
|
onFocus,
|
|
101
295
|
onBlur,
|
|
102
296
|
onInput,
|
|
103
297
|
onChange,
|
|
104
|
-
onKeydown
|
|
105
|
-
|
|
298
|
+
onKeydown,
|
|
299
|
+
onClear
|
|
300
|
+
} = useInputEvent(isFocus, props, ctx);
|
|
301
|
+
const input2 = shallowRef();
|
|
302
|
+
const {
|
|
303
|
+
select,
|
|
304
|
+
focus,
|
|
305
|
+
blur
|
|
306
|
+
} = useInputFunction(input2);
|
|
307
|
+
const passwordVisible = ref(false);
|
|
308
|
+
const clickPasswordIcon = () => {
|
|
309
|
+
passwordVisible.value = !passwordVisible.value;
|
|
310
|
+
focus();
|
|
311
|
+
};
|
|
312
|
+
const prefixVisiable = ctx.slots.prefix || props.prefix;
|
|
313
|
+
const suffixVisiable = ctx.slots.suffix || props.suffix || props.showPassword || props.clearable;
|
|
314
|
+
const showPwdVisible = computed(() => props.showPassword && !props.disabled);
|
|
315
|
+
const showClearable = computed(() => props.clearable && !props.disabled);
|
|
106
316
|
watch(() => props.modelValue, () => {
|
|
107
|
-
|
|
317
|
+
if (props.validateEvent) {
|
|
318
|
+
formItemContext == null ? void 0 : formItemContext.validate("change").catch((err) => console.warn(err));
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
ctx.expose({
|
|
322
|
+
select,
|
|
323
|
+
focus,
|
|
324
|
+
blur
|
|
108
325
|
});
|
|
109
|
-
return () =>
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
"
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
"
|
|
118
|
-
|
|
119
|
-
"
|
|
120
|
-
|
|
121
|
-
|
|
326
|
+
return () => {
|
|
327
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
328
|
+
return createVNode("div", mergeProps({
|
|
329
|
+
"class": inputClasses.value
|
|
330
|
+
}, customStyle), [ctx.slots.prepend && createVNode("div", {
|
|
331
|
+
"class": slotNs.e("prepend")
|
|
332
|
+
}, [(_b = (_a = ctx.slots).prepend) == null ? void 0 : _b.call(_a)]), createVNode("div", {
|
|
333
|
+
"class": wrapClasses.value
|
|
334
|
+
}, [prefixVisiable && createVNode("span", {
|
|
335
|
+
"class": slotNs.e("prefix")
|
|
336
|
+
}, [ctx.slots.prefix && createVNode("div", null, [(_d = (_c = ctx.slots).prefix) == null ? void 0 : _d.call(_c)]), props.prefix && createVNode(Icon, {
|
|
337
|
+
"size": props.size,
|
|
338
|
+
"name": props.prefix
|
|
339
|
+
}, null)]), createVNode("input", mergeProps({
|
|
340
|
+
"ref": input2,
|
|
341
|
+
"value": modelValue.value,
|
|
342
|
+
"disabled": disabled.value,
|
|
343
|
+
"class": ns.e("inner")
|
|
344
|
+
}, otherAttrs, {
|
|
345
|
+
"type": props.showPassword ? passwordVisible.value ? "text" : "password" : "text",
|
|
346
|
+
"onInput": onInput,
|
|
347
|
+
"onFocus": onFocus,
|
|
348
|
+
"onBlur": onBlur,
|
|
349
|
+
"onChange": onChange,
|
|
350
|
+
"onKeydown": onKeydown
|
|
351
|
+
}), null), suffixVisiable && createVNode("span", {
|
|
352
|
+
"class": slotNs.e("suffix")
|
|
353
|
+
}, [props.suffix && createVNode(Icon, {
|
|
354
|
+
"size": props.size,
|
|
355
|
+
"name": props.suffix
|
|
356
|
+
}, null), ctx.slots.suffix && createVNode("div", null, [(_f = (_e = ctx.slots).suffix) == null ? void 0 : _f.call(_e)]), showPwdVisible.value && createVNode(Icon, {
|
|
357
|
+
"size": props.size,
|
|
358
|
+
"class": ns.em("password", "icon"),
|
|
359
|
+
"name": passwordVisible.value ? "preview" : "preview-forbidden",
|
|
360
|
+
"onClick": clickPasswordIcon
|
|
361
|
+
}, null), showClearable.value && createVNode(Icon, {
|
|
362
|
+
"size": props.size,
|
|
363
|
+
"class": ns.em("clear", "icon"),
|
|
364
|
+
"name": "close",
|
|
365
|
+
"onClick": onClear
|
|
366
|
+
}, null)])]), ctx.slots.append && createVNode("div", {
|
|
367
|
+
"class": slotNs.e("append")
|
|
368
|
+
}, [(_h = (_g = ctx.slots).append) == null ? void 0 : _h.call(_g)])]);
|
|
369
|
+
};
|
|
122
370
|
}
|
|
123
371
|
});
|
|
124
372
|
var index = {
|
package/input/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
var j=Object.getOwnPropertySymbols;var ee=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable;var A=(u,e)=>{var m={};for(var d in u)ee.call(u,d)&&e.indexOf(d)<0&&(m[d]=u[d]);if(u!=null&&j)for(var d of j(u))e.indexOf(d)<0&&ne.call(u,d)&&(m[d]=u[d]);return m};(function(u,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(u=typeof globalThis!="undefined"?globalThis:u||self,e(u.index={},u.Vue))})(this,function(u,e){"use strict";const m={modelValue:{type:String,default:""},disabled:{type:Boolean,default:!1},error:{type:Boolean,default:!1},size:{type:String,default:"md"},validateEvent:{type:Boolean,default:!0},prefix:{type:String,default:""},suffix:{type:String,default:""},showPassword:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1}},d=Symbol("dFormItem");function g(n,t,s){let o=n;return t&&(o+=`__${t}`),s&&(o+=`--${s}`),o}function y(n,t=!1){const s=t?`.devui-${n}`:`devui-${n}`;return{b:()=>g(s),e:c=>c?g(s,c):"",m:c=>c?g(s,"",c):"",em:(c,f)=>c&&f?g(s,c,f):""}}function K(n,t){const s=e.inject(d,void 0),o=e.computed(()=>(s==null?void 0:s.validateState)==="error"),a=y("input"),l=y("input-slot"),r=e.ref(!1),{error:c,size:f,disabled:v}=e.toRefs(n),i=t.slots,w=t.attrs,{style:p,class:b}=w,S=A(w,["style","class"]),P={style:p},z=e.computed(()=>({[a.e("wrapper")]:!0,[a.m("focus")]:r.value,[a.m("disabled")]:v.value,[a.m("error")]:c.value||o.value,[a.m("feedback")]:s==null?void 0:s.showFeedback})),C=e.computed(()=>[{[a.b()]:!0,[a.m(f.value)]:!0,[l.b()]:i.prepend||i.append,[a.m("append")]:i.append,[a.m("prepend")]:i.prepend},b]);return{isFocus:r,wrapClasses:z,inputClasses:C,customStyle:P,otherAttrs:S}}function M(n,t,s){const o=e.inject(d,void 0);return{onFocus:i=>{n.value=!0,s.emit("focus",i)},onBlur:i=>{n.value=!1,s.emit("blur",i),t.validateEvent&&(o==null||o.validate("blur").catch(p=>console.warn(p)))},onInput:i=>{s.emit("update:modelValue",i.target.value)},onChange:i=>{s.emit("change",i.target.value)},onKeydown:i=>{s.emit("keydown",i)},onClear:()=>{s.emit("update:modelValue",""),s.emit("clear")}}}function O(n){const t=e.computed(()=>n.value);return{select:()=>{var l;(l=t.value)==null||l.select()},focus:()=>{var l;(l=t.value)==null||l.focus()},blur:()=>{var l;(l=t.value)==null||l.blur()}}}var te="";function q(n){return/^((http|https):)?\/\//.test(n)}const x={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"}},U={name:{type:String,default:"",required:!0},color:{type:String,default:"inherit"},size:{type:[Number,String],default:"inherit"}};var oe="",L=e.defineComponent({name:"DSvgIcon",props:U,setup(n){const{name:t,color:s,size:o}=e.toRefs(n),a=y("svg-icon"),l=e.computed(()=>`#icon-${t.value}`),r=e.computed(()=>typeof o.value=="number"?`${o.value}px`:o.value),c={width:r.value,height:r.value};return()=>e.createVNode("svg",{class:a.b(),style:c},[e.createVNode("use",{"xlink:href":l.value,fill:s.value},null)])}}),h=e.defineComponent({name:"DIcon",props:x,setup(n,{attrs:t}){const{component:s,name:o,size:a,color:l,classPrefix:r}=e.toRefs(n),c=s.value?e.resolveDynamicComponent(s.value):e.resolveDynamicComponent(L),f=e.computed(()=>typeof a.value=="number"?`${a.value}px`:a.value),v=()=>e.createVNode(c,e.mergeProps({name:o.value,color:l.value,size:f.value},t),null),i=()=>e.createVNode("img",e.mergeProps({src:o.value,alt:o.value.split("/")[o.value.split("/").length-1],style:{width:f.value||""}},t),null),p=()=>{const b=/^icon-/.test(o.value)?o.value:`${r.value}-${o.value}`;return e.createVNode("i",e.mergeProps({class:[r.value,b],style:{fontSize:f.value,color:l.value}},t),null)};return()=>s.value?v():q(o.value)?i():p()}}),I=e.defineComponent({name:"DInput",inheritAttrs:!1,props:m,emits:["update:modelValue","focus","blur","input","change","keydown","clear"],setup(n,t){const s=e.inject(d,void 0),{modelValue:o,disabled:a}=e.toRefs(n),l=y("input"),r=y("input-slot"),{isFocus:c,wrapClasses:f,inputClasses:v,customStyle:i,otherAttrs:p}=K(n,t),{onFocus:b,onBlur:S,onInput:P,onChange:z,onKeydown:C,onClear:w}=M(c,n,t),F=e.shallowRef(),{select:G,focus:E,blur:H}=O(F),V=e.ref(!1),J=()=>{V.value=!V.value,E()},Q=t.slots.prefix||n.prefix,W=t.slots.suffix||n.suffix||n.showPassword||n.clearable,Y=e.computed(()=>n.showPassword&&!n.disabled),Z=e.computed(()=>n.clearable&&!n.disabled);return e.watch(()=>n.modelValue,()=>{n.validateEvent&&(s==null||s.validate("change").catch(N=>console.warn(N)))}),t.expose({select:G,focus:E,blur:H}),()=>{var N,B,D,R,$,_,k,T;return e.createVNode("div",e.mergeProps({class:v.value},i),[t.slots.prepend&&e.createVNode("div",{class:r.e("prepend")},[(B=(N=t.slots).prepend)==null?void 0:B.call(N)]),e.createVNode("div",{class:f.value},[Q&&e.createVNode("span",{class:r.e("prefix")},[t.slots.prefix&&e.createVNode("div",null,[(R=(D=t.slots).prefix)==null?void 0:R.call(D)]),n.prefix&&e.createVNode(h,{size:n.size,name:n.prefix},null)]),e.createVNode("input",e.mergeProps({ref:F,value:o.value,disabled:a.value,class:l.e("inner")},p,{type:n.showPassword?V.value?"text":"password":"text",onInput:P,onFocus:b,onBlur:S,onChange:z,onKeydown:C}),null),W&&e.createVNode("span",{class:r.e("suffix")},[n.suffix&&e.createVNode(h,{size:n.size,name:n.suffix},null),t.slots.suffix&&e.createVNode("div",null,[(_=($=t.slots).suffix)==null?void 0:_.call($)]),Y.value&&e.createVNode(h,{size:n.size,class:l.em("password","icon"),name:V.value?"preview":"preview-forbidden",onClick:J},null),Z.value&&e.createVNode(h,{size:n.size,class:l.em("clear","icon"),name:"close",onClick:w},null)])]),t.slots.append&&e.createVNode("div",{class:r.e("append")},[(T=(k=t.slots).append)==null?void 0:T.call(k)])])}}}),X={title:"Input \u8F93\u5165\u6846",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(n){n.component(I.name,I)}};u.Input=I,u.default=X,u.inputProps=m,Object.defineProperty(u,"__esModule",{value:!0}),u[Symbol.toStringTag]="Module"});
|
package/input/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.devui-
|
|
1
|
+
.devui-input__wrapper{display:inline-flex;align-items:center;justify-content:center;width:100%;padding:0 8px;box-sizing:border-box;border:1px solid var(--devui-form-control-line, #adb0b8);border-radius:var(--devui-border-radius, 2px);background-color:var(--devui-form-control-bg, #ffffff);transition:border-color .3s var(--devui-animation-ease-in-out-smooth, cubic-bezier(.645, .045, .355, 1));height:100%}.devui-input__wrapper:not(.devui-input--error):not(.devui-input--disabled):hover{border-color:var(--devui-form-control-line-hover, #575d6c)}.devui-input--focus:not(.devui-input--error){border-color:var(--devui-form-control-line-active, #5e7ce0)}.devui-input--focus:not(.devui-input--error):hover{border-color:var(--devui-form-control-line-active, #5e7ce0)}.devui-input--disabled{border-color:var(--devui-disabled-line, #dfe1e6);background-color:var(--devui-disabled-bg, #f5f5f6);cursor:not-allowed}.devui-input--disabled:hover{border-color:var(--devui-disabled-line, #dfe1e6)}.devui-input--disabled .devui-input__inner{color:var(--devui-disabled-text, #adb0b8);cursor:not-allowed}.devui-input--error{border-color:var(--devui-danger-line, #f66f6a);background-color:var(--devui-danger-bg, #ffeeed)}.devui-input--sm{height:26px;font-size:var(--devui-font-size-sm, 12px)}.devui-input--md{height:28px;font-size:var(--devui-font-size, 12px)}.devui-input--lg{height:46px;font-size:var(--devui-font-size-lg, 14px)}.devui-input--feedback{padding-right:28px}.devui-input__inner{width:100%;height:100%;color:var(--devui-text, #252b3a);font-size:inherit;padding:4px 0;border:none;background:none;outline:none}.devui-input--prepend .devui-input__wrapper{border-top-left-radius:0;border-bottom-left-radius:0}.devui-input--append .devui-input__wrapper{border-top-right-radius:0;border-bottom-right-radius:0}.devui-input-slot{display:inline-flex;width:100%;align-items:stretch}.devui-input-slot__prepend,.devui-input-slot__append{color:var(--devui-text);position:relative;display:inline-flex;align-items:center;justify-content:center;min-height:100%;padding:0 20px;white-space:nowrap;border:1px solid var(--devui-form-control-line, #adb0b8);border-radius:var(--devui-border-radius, 2px);background-color:var(--devui-form-control-bg, #ffffff)}.devui-input-slot__prepend .devui-button,.devui-input-slot__prepend .devui-select .devui-select__input,.devui-input-slot__append .devui-button,.devui-input-slot__append .devui-select .devui-select__input{border:none;background-color:transparent;color:inherit}.devui-input-slot__prepend .devui-button,.devui-input-slot__prepend .devui-select__selection,.devui-input-slot__append .devui-button,.devui-input-slot__append .devui-select__selection{display:inline-block;margin:0 -20px}.devui-input-slot__prepend{border-right:0;border-top-right-radius:0;border-bottom-right-radius:0}.devui-input-slot__append{border-left:0;border-top-left-radius:0;border-bottom-left-radius:0}.devui-input-slot__prefix,.devui-input-slot__suffix{display:inline-flex;white-space:nowrap;flex-shrink:0;flex-wrap:nowrap;align-items:center}.devui-input-slot__prefix>*{margin-right:8px}.devui-input-slot__suffix>*{margin-left:8px}.devui-input__clear--icon,.devui-input__password--icon{cursor:pointer}.devui-svg-icon{vertical-align:middle}
|