vdesign-ui 0.1.21 → 0.1.23
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/dist/components/actionbar/actionbar-cell/index.vue +34 -0
- package/dist/components/actionbar/index.js +8 -0
- package/dist/components/actionbar/index.vue +39 -0
- package/dist/components/actionbar/style.less +48 -0
- package/dist/components/actions-cell/actions/index.js +7 -0
- package/dist/components/actions-cell/actions/index.vue +76 -0
- package/dist/components/actions-cell/actions/style.less +112 -0
- package/dist/components/actions-cell/index.js +7 -0
- package/dist/components/actions-cell/index.vue +94 -0
- package/dist/components/actions-cell/style.less +39 -0
- package/dist/components/activityviews/index.js +8 -0
- package/dist/components/activityviews/index.vue +140 -0
- package/dist/components/activityviews/style.less +138 -0
- package/dist/components/badge/index.js +8 -0
- package/dist/components/badge/index.vue +49 -0
- package/dist/components/badge/style.less +66 -0
- package/dist/components/button/index.js +8 -0
- package/dist/components/button/index.vue +89 -0
- package/dist/components/button/style.less +563 -0
- package/dist/components/calendar/end.png +0 -0
- package/dist/components/calendar/index-element.vue +84 -0
- package/dist/components/calendar/index.js +8 -0
- package/dist/components/calendar/index.vue +52 -0
- package/dist/components/calendar/start.png +0 -0
- package/dist/components/calendar/style.less +167 -0
- package/dist/components/checkbox/assist.js +34 -0
- package/dist/components/checkbox/checkbox-group/index.js +8 -0
- package/dist/components/checkbox/checkbox-group/index.vue +69 -0
- package/dist/components/checkbox/index.js +8 -0
- package/dist/components/checkbox/index.vue +184 -0
- package/dist/components/checkbox/style.less +291 -0
- package/dist/components/common/state/index.vue +80 -0
- package/dist/components/data-list/index.js +10 -0
- package/dist/components/data-list/index.vue +19 -0
- package/dist/components/data-list/style.less +624 -0
- package/dist/components/datetime-picker/index.js +8 -0
- package/dist/components/datetime-picker/index.vue +37 -0
- package/dist/components/datetime-picker/style.less +24 -0
- package/dist/components/dialog/index.js +8 -0
- package/dist/components/dialog/index.vue +162 -0
- package/dist/components/dialog/overlay-manager.js +18 -0
- package/dist/components/dialog/style.less +132 -0
- package/dist/components/divider/index.js +8 -0
- package/dist/components/divider/index.vue +54 -0
- package/dist/components/divider/style.less +92 -0
- package/dist/components/dropdown/index.js +8 -0
- package/dist/components/dropdown/index.vue +210 -0
- package/dist/components/dropdown/style.less +418 -0
- package/dist/components/empty/404-dark.png +0 -0
- package/dist/components/empty/404.png +0 -0
- package/dist/components/empty/index.js +8 -0
- package/dist/components/empty/index.vue +95 -0
- package/dist/components/empty/network-dark.png +0 -0
- package/dist/components/empty/network.png +0 -0
- package/dist/components/empty/nodata-dark.png +0 -0
- package/dist/components/empty/nodata.png +0 -0
- package/dist/components/empty/style.less +60 -0
- package/dist/components/footer/index.js +7 -0
- package/dist/components/footer/index.vue +29 -0
- package/dist/components/footer/style.less +22 -0
- package/dist/components/footnav/footnav-item/index.js +7 -0
- package/dist/components/footnav/footnav-item/index.vue +75 -0
- package/dist/components/footnav/footnav-item/style.less +39 -0
- package/dist/components/footnav/index.js +7 -0
- package/dist/components/footnav/index.vue +97 -0
- package/dist/components/footnav/style.less +23 -0
- package/dist/components/form/index.js +7 -0
- package/dist/components/form/index.vue +12 -0
- package/dist/components/headnav/index.js +7 -0
- package/dist/components/headnav/index.vue +163 -0
- package/dist/components/headnav/style.less +245 -0
- package/dist/components/icon/font/iconfont.css +1049 -0
- package/dist/components/icon/font/iconfont.js +2 -0
- package/dist/components/icon/index.js +9 -0
- package/dist/components/icon/index.vue +46 -0
- package/dist/components/icon/style.less +44 -0
- package/dist/components/input/calcTextareaHeight.js +266 -0
- package/dist/components/input/index.js +8 -0
- package/dist/components/input/index.vue +343 -0
- package/dist/components/input/password/index.js +8 -0
- package/dist/components/input/password/index.vue +60 -0
- package/dist/components/input/search/index.js +8 -0
- package/dist/components/input/search/index.vue +66 -0
- package/dist/components/input/stepper/index.js +8 -0
- package/dist/components/input/stepper/index.vue +136 -0
- package/dist/components/input/style.less +497 -0
- package/dist/components/list/index.js +8 -0
- package/dist/components/list/index.vue +159 -0
- package/dist/components/list/style.less +292 -0
- package/dist/components/loading/index.js +7 -0
- package/dist/components/loading/index.vue +53 -0
- package/dist/components/loading/loading.png +0 -0
- package/dist/components/loading/refresh.png +0 -0
- package/dist/components/loading/style.less +48 -0
- package/dist/components/mixins/clickoutside.js +81 -0
- package/dist/components/mixins/dom.js +41 -0
- package/dist/components/mixins/languageMixin.js +38 -0
- package/dist/components/mixins/outlineConfigPlugin.js +40 -0
- package/dist/components/mixins/router-link.js +23 -0
- package/dist/components/mixins/themeMixin.js +29 -0
- package/dist/components/noticebar/index.js +8 -0
- package/dist/components/noticebar/index.vue +247 -0
- package/dist/components/noticebar/style.less +332 -0
- package/dist/components/overlay/index.js +8 -0
- package/dist/components/overlay/index.vue +161 -0
- package/dist/components/overlay/style.less +23 -0
- package/dist/components/pagebreak/index.js +7 -0
- package/dist/components/pagebreak/index.vue +60 -0
- package/dist/components/pagebreak/style.less +43 -0
- package/dist/components/popover/index.js +8 -0
- package/dist/components/popover/index.vue +99 -0
- package/dist/components/popover/style.less +346 -0
- package/dist/components/popover/vue-popover.vue +314 -0
- package/dist/components/radio/assist.js +34 -0
- package/dist/components/radio/index.js +8 -0
- package/dist/components/radio/index.vue +158 -0
- package/dist/components/radio/radio-group/index.vue +70 -0
- package/dist/components/radio/style.css +213 -0
- package/dist/components/radio/style.less +302 -0
- package/dist/components/result/completed-dark.png +0 -0
- package/dist/components/result/completed.png +0 -0
- package/dist/components/result/error-dark.png +0 -0
- package/dist/components/result/error.png +0 -0
- package/dist/components/result/index.js +8 -0
- package/dist/components/result/index.vue +75 -0
- package/dist/components/result/style.less +42 -0
- package/dist/components/result/wait-dark.png +0 -0
- package/dist/components/result/wait.png +0 -0
- package/dist/components/selector/index.js +8 -0
- package/dist/components/selector/index.vue +124 -0
- package/dist/components/selector/style.less +474 -0
- package/dist/components/skeleton/index.js +7 -0
- package/dist/components/skeleton/index.vue +142 -0
- package/dist/components/skeleton/style.less +192 -0
- package/dist/components/slider/draggable.js +49 -0
- package/dist/components/slider/index.js +7 -0
- package/dist/components/slider/index.vue +173 -0
- package/dist/components/slider/style.less +96 -0
- package/dist/components/slider/utils.js +60 -0
- package/dist/components/step/index.js +7 -0
- package/dist/components/step/index.vue +48 -0
- package/dist/components/step/style.less +59 -0
- package/dist/components/step-item/index.js +7 -0
- package/dist/components/step-item/index.vue +117 -0
- package/dist/components/step-item/style.less +361 -0
- package/dist/components/style/index.vue +42 -0
- package/dist/components/switch/index.js +8 -0
- package/dist/components/switch/index.vue +72 -0
- package/dist/components/switch/style.less +56 -0
- package/dist/components/tabs/index.js +8 -0
- package/dist/components/tabs/index.vue +145 -0
- package/dist/components/tabs/style.less +385 -0
- package/dist/components/tabs/tab/index.vue +56 -0
- package/dist/components/tag/index.js +7 -0
- package/dist/components/tag/index.vue +50 -0
- package/dist/components/tag/style.less +211 -0
- package/dist/components/title/index.js +8 -0
- package/dist/components/title/index.vue +92 -0
- package/dist/components/title/style.less +188 -0
- package/dist/components/toast/index.js +80 -0
- package/dist/components/toast/index.vue +44 -0
- package/dist/components/toast/style.less +55 -0
- package/dist/components/transition/index.js +8 -0
- package/dist/components/transition/index.vue +13 -0
- package/dist/components/transition/style.less +208 -0
- package/dist/components/upload/index.js +7 -0
- package/dist/components/upload/index.vue +103 -0
- package/dist/components/upload/index1.vue +225 -0
- package/dist/components/upload/style.less +156 -0
- package/dist/demo.html +10 -0
- package/dist/img/404-dark.775df5bb.png +0 -0
- package/dist/img/completed-dark.4183a8a8.png +0 -0
- package/dist/img/error-dark.b80857da.png +0 -0
- package/dist/img/network-dark.11a147bb.png +0 -0
- package/dist/img/nodata-dark.b0ea0e39.png +0 -0
- package/dist/img/wait-dark.6aa28731.png +0 -0
- package/dist/locale/ar.js +98 -0
- package/dist/locale/en.js +98 -0
- package/dist/locale/zh.js +98 -0
- package/dist/token.css +2982 -0
- package/dist/vdesign-ui.common.js +27013 -0
- package/dist/vdesign-ui.css +1 -0
- package/dist/vdesign-ui.umd.js +27023 -0
- package/dist/vdesign-ui.umd.min.js +32 -0
- package/package.json +1 -1
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="wrapClasses" class="vd-input">
|
|
3
|
+
<template v-if="inputTextArea || type !== 'textarea'">
|
|
4
|
+
<span v-if="prefix || $slots.prefix" class="vd-input-form__prefix" :class="borderRightClasses">
|
|
5
|
+
<slot name="prefix">{{ prefix }}</slot>
|
|
6
|
+
</span>
|
|
7
|
+
<input
|
|
8
|
+
v-if="!inputTextArea"
|
|
9
|
+
ref="input"
|
|
10
|
+
v-bind="$attrs"
|
|
11
|
+
:type="passwordIcon ? (passwordVisible ? 'text' : 'password') : type"
|
|
12
|
+
:class="inputClasses"
|
|
13
|
+
:disabled="disabled"
|
|
14
|
+
:placeholder="placeholder"
|
|
15
|
+
:value="currentValue"
|
|
16
|
+
@input="handleInput"
|
|
17
|
+
@focus="handleFocus"
|
|
18
|
+
@blur="handleBlur"
|
|
19
|
+
/>
|
|
20
|
+
|
|
21
|
+
<textarea
|
|
22
|
+
v-else
|
|
23
|
+
ref="textarea"
|
|
24
|
+
v-bind="$attrs"
|
|
25
|
+
:id="elementId"
|
|
26
|
+
:wrap="wrap"
|
|
27
|
+
:type="type"
|
|
28
|
+
:rows="rows"
|
|
29
|
+
:class="inputClasses"
|
|
30
|
+
:disabled="disabled"
|
|
31
|
+
:placeholder="placeholder"
|
|
32
|
+
:value="currentValue"
|
|
33
|
+
@focus="handleFocus"
|
|
34
|
+
@blur="handleBlur"
|
|
35
|
+
@input="handleInput"
|
|
36
|
+
:style="textareaStyles"
|
|
37
|
+
>
|
|
38
|
+
</textarea>
|
|
39
|
+
<div
|
|
40
|
+
v-if="suffix || $slots.suffix || append || $slots.append || isWordLimitVisible"
|
|
41
|
+
class="vd-input-form__right"
|
|
42
|
+
>
|
|
43
|
+
<span v-if="suffix || $slots.suffix" class="vd-input-form__suffix">
|
|
44
|
+
<slot name="suffix">
|
|
45
|
+
<vd-icon name="icon_btn_clean" @click="handleClear"></vd-icon>
|
|
46
|
+
</slot>
|
|
47
|
+
</span>
|
|
48
|
+
<span v-if="append || $slots.append" class="vd-input-form__append">
|
|
49
|
+
<slot name="append">{{ append }}</slot>
|
|
50
|
+
</span>
|
|
51
|
+
<div
|
|
52
|
+
v-if="isWordLimitVisible"
|
|
53
|
+
:class="[
|
|
54
|
+
'vd-input__word-limit',
|
|
55
|
+
{ 'vd-input__word-limit--error': isOverLimit },
|
|
56
|
+
]"
|
|
57
|
+
>
|
|
58
|
+
<span>{{ textLength }}</span
|
|
59
|
+
>/<span>{{ upperLimit }}</span>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
<span
|
|
63
|
+
v-if="passwordClose || passwordIcon"
|
|
64
|
+
class="vd-input-form__password"
|
|
65
|
+
>
|
|
66
|
+
<span v-if="passwordClose" class="vd-input-form__password--close">
|
|
67
|
+
<vd-icon name="icon_btn_close" @click="handleClear"></vd-icon>
|
|
68
|
+
</span>
|
|
69
|
+
<span v-if="passwordIcon" class="vd-input-form__password--password">
|
|
70
|
+
<vd-icon
|
|
71
|
+
:name="passwordVisible ? 'icon_btn_eye' : 'icon_btn_eye_close'"
|
|
72
|
+
@click="handlePasswordVisible"
|
|
73
|
+
></vd-icon>
|
|
74
|
+
</span>
|
|
75
|
+
</span>
|
|
76
|
+
</template>
|
|
77
|
+
<template v-else>
|
|
78
|
+
<textarea
|
|
79
|
+
ref="textarea"
|
|
80
|
+
:type="type"
|
|
81
|
+
v-bind="$attrs"
|
|
82
|
+
:wrap="wrap"
|
|
83
|
+
:class="inputClasses"
|
|
84
|
+
:disabled="disabled"
|
|
85
|
+
:placeholder="placeholder"
|
|
86
|
+
:value="currentValue"
|
|
87
|
+
:rows="rows"
|
|
88
|
+
:name="name"
|
|
89
|
+
@input="handleInput"
|
|
90
|
+
:style="textareaStyles"
|
|
91
|
+
>
|
|
92
|
+
</textarea>
|
|
93
|
+
<div
|
|
94
|
+
v-if="isWordLimitVisible"
|
|
95
|
+
:class="[
|
|
96
|
+
'vd-input__word-limit',
|
|
97
|
+
{ 'vd-input__word-limit--error': isOverLimit },
|
|
98
|
+
]"
|
|
99
|
+
>
|
|
100
|
+
<span>{{ textLength }}</span
|
|
101
|
+
>/<span>{{ upperLimit }}</span>
|
|
102
|
+
</div>
|
|
103
|
+
</template>
|
|
104
|
+
</div>
|
|
105
|
+
</template>
|
|
106
|
+
|
|
107
|
+
<script>
|
|
108
|
+
import calcTextareaHeight from "./calcTextareaHeight";
|
|
109
|
+
const prefixCls = "vd-input";
|
|
110
|
+
|
|
111
|
+
export default {
|
|
112
|
+
name: "vd-input",
|
|
113
|
+
props: {
|
|
114
|
+
type: {
|
|
115
|
+
type: String,
|
|
116
|
+
default: "text",
|
|
117
|
+
},
|
|
118
|
+
prefix: {
|
|
119
|
+
type: [Boolean, String],
|
|
120
|
+
},
|
|
121
|
+
borderRight: {
|
|
122
|
+
type: Boolean,
|
|
123
|
+
default: true
|
|
124
|
+
},
|
|
125
|
+
suffix: {
|
|
126
|
+
type: Boolean,
|
|
127
|
+
},
|
|
128
|
+
// 设计如此,单独的文字
|
|
129
|
+
append: {
|
|
130
|
+
type: Boolean,
|
|
131
|
+
},
|
|
132
|
+
placeholder: {
|
|
133
|
+
type: String,
|
|
134
|
+
},
|
|
135
|
+
error: {
|
|
136
|
+
type: Boolean,
|
|
137
|
+
},
|
|
138
|
+
bigSize: {
|
|
139
|
+
type: Boolean,
|
|
140
|
+
},
|
|
141
|
+
passwordIcon: {
|
|
142
|
+
type: Boolean,
|
|
143
|
+
},
|
|
144
|
+
passwordClose: {
|
|
145
|
+
type: Boolean,
|
|
146
|
+
},
|
|
147
|
+
passwordType: {
|
|
148
|
+
type: String,
|
|
149
|
+
default: "icon_btn_eye_close",
|
|
150
|
+
},
|
|
151
|
+
form: {
|
|
152
|
+
type: String,
|
|
153
|
+
},
|
|
154
|
+
disabled: {
|
|
155
|
+
type: Boolean,
|
|
156
|
+
},
|
|
157
|
+
value: {
|
|
158
|
+
type: [String, Number],
|
|
159
|
+
default: "",
|
|
160
|
+
},
|
|
161
|
+
rows: {
|
|
162
|
+
type: Number,
|
|
163
|
+
default: 2,
|
|
164
|
+
},
|
|
165
|
+
name: {
|
|
166
|
+
type: String,
|
|
167
|
+
},
|
|
168
|
+
// 设计如此多行textarea,跟input属性一样
|
|
169
|
+
inputTextArea: {
|
|
170
|
+
type: Boolean,
|
|
171
|
+
},
|
|
172
|
+
warning: {
|
|
173
|
+
type: Boolean,
|
|
174
|
+
},
|
|
175
|
+
hairline: {
|
|
176
|
+
type: Boolean,
|
|
177
|
+
default: true,
|
|
178
|
+
},
|
|
179
|
+
autosize: {
|
|
180
|
+
type: [Boolean, Object],
|
|
181
|
+
default: false,
|
|
182
|
+
},
|
|
183
|
+
elementId: {
|
|
184
|
+
type: String,
|
|
185
|
+
},
|
|
186
|
+
wrap: {
|
|
187
|
+
type: String,
|
|
188
|
+
default: "soft",
|
|
189
|
+
},
|
|
190
|
+
// 新增0118
|
|
191
|
+
showWordLimit: {
|
|
192
|
+
type: Boolean,
|
|
193
|
+
default: false,
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
data() {
|
|
197
|
+
return {
|
|
198
|
+
focusClass: false,
|
|
199
|
+
currentValue: this.value,
|
|
200
|
+
isOnComposition: false,
|
|
201
|
+
textareaStyles: {},
|
|
202
|
+
passwordVisible: false,
|
|
203
|
+
};
|
|
204
|
+
},
|
|
205
|
+
computed: {
|
|
206
|
+
wrapClasses() {
|
|
207
|
+
return [
|
|
208
|
+
{
|
|
209
|
+
[`${prefixCls}-${this.form}`]: this.form,
|
|
210
|
+
[`${prefixCls}--disabled`]: this.disabled,
|
|
211
|
+
[`${prefixCls}-${this.type}`]: this.type,
|
|
212
|
+
[`${prefixCls}-${this.type}--warning`]: this.warning,
|
|
213
|
+
[`${prefixCls}--bigsize`]: this.bigSize,
|
|
214
|
+
[`${prefixCls}--error`]: this.error,
|
|
215
|
+
[`${prefixCls}--active`]: this.focusClass,
|
|
216
|
+
[`${prefixCls}-inputarea`]: this.inputTextArea,
|
|
217
|
+
"vd-hairline--bottom": this.hairline,
|
|
218
|
+
"vd-textarea-auto": this.inputTextArea,
|
|
219
|
+
},
|
|
220
|
+
];
|
|
221
|
+
},
|
|
222
|
+
borderRightClasses(){
|
|
223
|
+
return [
|
|
224
|
+
"vd-hairline--right",
|
|
225
|
+
{
|
|
226
|
+
[`${prefixCls}--border`]: this.borderRight,
|
|
227
|
+
}
|
|
228
|
+
]
|
|
229
|
+
},
|
|
230
|
+
inputClasses() {
|
|
231
|
+
return [
|
|
232
|
+
`${prefixCls}__control`,
|
|
233
|
+
{
|
|
234
|
+
[`${prefixCls}-${this.type}__control`]: this.type,
|
|
235
|
+
},
|
|
236
|
+
];
|
|
237
|
+
},
|
|
238
|
+
textLength() {
|
|
239
|
+
if (typeof this.value === "number") {
|
|
240
|
+
return String(this.value).length;
|
|
241
|
+
}
|
|
242
|
+
return (this.value || "").length;
|
|
243
|
+
},
|
|
244
|
+
upperLimit() {
|
|
245
|
+
return this.$attrs.maxlength;
|
|
246
|
+
},
|
|
247
|
+
isWordLimitVisible() {
|
|
248
|
+
return (
|
|
249
|
+
this.showWordLimit &&
|
|
250
|
+
this.$attrs.maxlength &&
|
|
251
|
+
(this.type === "text" || this.type === "textarea")
|
|
252
|
+
);
|
|
253
|
+
},
|
|
254
|
+
isOverLimit() {
|
|
255
|
+
return this.textLength >= this.upperLimit;
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
methods: {
|
|
259
|
+
handleFocus(event) {
|
|
260
|
+
if (this.form) {
|
|
261
|
+
this.focusClass = true;
|
|
262
|
+
}
|
|
263
|
+
this.$emit("focus", event);
|
|
264
|
+
},
|
|
265
|
+
handleBlur(event) {
|
|
266
|
+
if (this.form) {
|
|
267
|
+
this.focusClass = false;
|
|
268
|
+
}
|
|
269
|
+
this.$emit("blur", event);
|
|
270
|
+
},
|
|
271
|
+
focus() {
|
|
272
|
+
if (this.type === "textarea") {
|
|
273
|
+
this.$refs.textarea.focus();
|
|
274
|
+
} else {
|
|
275
|
+
this.$refs.input.focus();
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
blur() {
|
|
279
|
+
if (this.type === "textarea") {
|
|
280
|
+
this.$refs.textarea.blur();
|
|
281
|
+
} else {
|
|
282
|
+
this.$refs.input.blur();
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
|
|
286
|
+
handleInput(event) {
|
|
287
|
+
if (this.isOnComposition) return;
|
|
288
|
+
let value = event.target.value;
|
|
289
|
+
if (this.number && value !== "")
|
|
290
|
+
value = Number.isNaN(Number(value)) ? value : Number(value);
|
|
291
|
+
this.$emit("input", value);
|
|
292
|
+
this.setCurrentValue(value);
|
|
293
|
+
this.$emit("change", event);
|
|
294
|
+
},
|
|
295
|
+
|
|
296
|
+
setCurrentValue(value) {
|
|
297
|
+
if (value === this.currentValue) return;
|
|
298
|
+
this.$nextTick(() => {
|
|
299
|
+
this.resizeTextarea();
|
|
300
|
+
});
|
|
301
|
+
this.currentValue = value;
|
|
302
|
+
},
|
|
303
|
+
resizeTextarea() {
|
|
304
|
+
const autosize = this.autosize;
|
|
305
|
+
if (!autosize || this.type !== "textarea") {
|
|
306
|
+
return false;
|
|
307
|
+
}
|
|
308
|
+
const minRows = autosize.minRows;
|
|
309
|
+
const maxRows = autosize.maxRows;
|
|
310
|
+
this.textareaStyles = calcTextareaHeight(
|
|
311
|
+
this.$refs.textarea,
|
|
312
|
+
minRows,
|
|
313
|
+
maxRows
|
|
314
|
+
);
|
|
315
|
+
},
|
|
316
|
+
handleClear() {
|
|
317
|
+
const e = { target: { value: "" } };
|
|
318
|
+
this.$emit("input", "");
|
|
319
|
+
this.setCurrentValue("");
|
|
320
|
+
this.$emit("change", e);
|
|
321
|
+
this.$emit("clear");
|
|
322
|
+
},
|
|
323
|
+
handlePasswordVisible() {
|
|
324
|
+
this.passwordVisible = !this.passwordVisible;
|
|
325
|
+
this.$nextTick(() => {
|
|
326
|
+
this.focus();
|
|
327
|
+
});
|
|
328
|
+
},
|
|
329
|
+
},
|
|
330
|
+
watch: {
|
|
331
|
+
value(val) {
|
|
332
|
+
this.setCurrentValue(val);
|
|
333
|
+
},
|
|
334
|
+
},
|
|
335
|
+
mounted() {
|
|
336
|
+
this.resizeTextarea();
|
|
337
|
+
},
|
|
338
|
+
};
|
|
339
|
+
</script>
|
|
340
|
+
|
|
341
|
+
<style lang="less">
|
|
342
|
+
@import "./style.less";
|
|
343
|
+
</style>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="vd-password">
|
|
3
|
+
<input type="tel" :maxlength="length" v-model="innerValue" @input="handleInput" @focus="handleFocus"
|
|
4
|
+
@blur="handleBlur" class="vd-password__input" />
|
|
5
|
+
<div class="vd-password__security">
|
|
6
|
+
<div class="vd-password__item" v-for="n in length" :key="n" :class="{ 'vd-password-is-filled': n === innerValue.length + 1 }">
|
|
7
|
+
<template v-if="mask">
|
|
8
|
+
<i v-if="n <= innerValue.length" class="mask-icon"></i>
|
|
9
|
+
</template>
|
|
10
|
+
<template v-else>
|
|
11
|
+
{{ innerValue[n - 1] }}
|
|
12
|
+
</template>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script>
|
|
19
|
+
export default {
|
|
20
|
+
name: "vd-password",
|
|
21
|
+
props: {
|
|
22
|
+
value: {
|
|
23
|
+
type: String,
|
|
24
|
+
},
|
|
25
|
+
length: {
|
|
26
|
+
type: Number,
|
|
27
|
+
default: 6,
|
|
28
|
+
},
|
|
29
|
+
mask: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: true,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
data() {
|
|
35
|
+
return {
|
|
36
|
+
innerValue: this.value,
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
watch: {
|
|
40
|
+
value(val) {
|
|
41
|
+
this.innerValue = val;
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
methods: {
|
|
45
|
+
handleInput(e) {
|
|
46
|
+
this.innerValue = e.target.value.slice(0, this.length);
|
|
47
|
+
this.$emit("input", this.innerValue);
|
|
48
|
+
if (this.innerValue.length === this.length) {
|
|
49
|
+
this.$emit("complete", this.innerValue);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
handleFocus() {
|
|
53
|
+
this.$emit("focus");
|
|
54
|
+
},
|
|
55
|
+
handleBlur() {
|
|
56
|
+
this.$emit("blur");
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
</script>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="vd-search">
|
|
3
|
+
<div class="vd-search-content">
|
|
4
|
+
<span v-if="prefix || $slots.prefix" class="vd-search__prefix">
|
|
5
|
+
<slot name="prefix">
|
|
6
|
+
<vd-icon name="icon_nav_search"></vd-icon>
|
|
7
|
+
</slot>
|
|
8
|
+
</span>
|
|
9
|
+
<!-- <input :type="type" :class="inputClasses" :placeholder="placeholder"> -->
|
|
10
|
+
<vd-input
|
|
11
|
+
v-bind="$attrs"
|
|
12
|
+
v-on="listeners"
|
|
13
|
+
form="search"
|
|
14
|
+
:hairline = "false"
|
|
15
|
+
></vd-input>
|
|
16
|
+
<span v-if="suffix || $slots.suffix" class="vd-search__suffix">
|
|
17
|
+
<slot name="suffix">
|
|
18
|
+
<vd-icon v-if="suffix" name="icon_btn_clean"></vd-icon>
|
|
19
|
+
</slot>
|
|
20
|
+
</span>
|
|
21
|
+
|
|
22
|
+
</div>
|
|
23
|
+
<span class="vd-search__action" v-if="$slots.default">
|
|
24
|
+
<slot></slot>
|
|
25
|
+
</span>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script>
|
|
30
|
+
const prefixCls = 'vd-search';
|
|
31
|
+
export default {
|
|
32
|
+
name: 'vd-search',
|
|
33
|
+
inheritAttrs: false,
|
|
34
|
+
props: {
|
|
35
|
+
type: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: 'text'
|
|
38
|
+
},
|
|
39
|
+
prefix: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
},
|
|
42
|
+
suffix: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
data() {
|
|
47
|
+
return {
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
computed: {
|
|
51
|
+
inputClasses() {
|
|
52
|
+
return [
|
|
53
|
+
`${prefixCls}__control`
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
listeners() {
|
|
57
|
+
return {
|
|
58
|
+
...this.$listeners,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
methods: {
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
</script>
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="vd-stepper" :class="wrapClasses">
|
|
3
|
+
<vd-button v-if="!position" :class="minusButtonClass" icon="icon_btn_reduce" size="small"
|
|
4
|
+
@click="onChange('minus')"></vd-button>
|
|
5
|
+
<input type="number" :class="inputClasses" :disabled="disabled" :value="currentValue" :placeholder="placeholder" @input="onInput"
|
|
6
|
+
@blur="onBlur">
|
|
7
|
+
<vd-button v-if="position === 'right'" class="vd-stepper__minus" icon="icon_btn_reduce" size="small"
|
|
8
|
+
@click="onChange('minus')"></vd-button>
|
|
9
|
+
<vd-button :class="plusButtonClass" icon="icon_btn_add" size="small"
|
|
10
|
+
@click="onChange('plus')"></vd-button>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
import languageMixin from '@p/components/mixins/languageMixin.js';
|
|
16
|
+
|
|
17
|
+
const prefixCls = 'vd-stepper';
|
|
18
|
+
export default {
|
|
19
|
+
mixins: [languageMixin],
|
|
20
|
+
name: 'vd-stepper',
|
|
21
|
+
props: {
|
|
22
|
+
value: null,
|
|
23
|
+
integer: Boolean,
|
|
24
|
+
position: String,
|
|
25
|
+
inputCenter: Boolean,
|
|
26
|
+
disabled: Boolean,
|
|
27
|
+
theme: String,
|
|
28
|
+
min: {
|
|
29
|
+
type: [String, Number],
|
|
30
|
+
default: 1
|
|
31
|
+
},
|
|
32
|
+
max: {
|
|
33
|
+
type: [String, Number],
|
|
34
|
+
default: Infinity
|
|
35
|
+
},
|
|
36
|
+
step: {
|
|
37
|
+
type: [String, Number],
|
|
38
|
+
default: 1
|
|
39
|
+
},
|
|
40
|
+
placeholder:String
|
|
41
|
+
},
|
|
42
|
+
data() {
|
|
43
|
+
const value = this.range(this.isDef(this.value) ? this.value : this.defaultValue);
|
|
44
|
+
if (value !== +this.value) {
|
|
45
|
+
this.$emit('input', value);
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
currentValue: value,
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
computed: {
|
|
52
|
+
inputClasses() {
|
|
53
|
+
return [
|
|
54
|
+
`${prefixCls}-input`,
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
wrapClasses() {
|
|
58
|
+
return [
|
|
59
|
+
{
|
|
60
|
+
[`${prefixCls}--disabled`]: this.disabled,
|
|
61
|
+
[`${prefixCls}--${this.theme}`]: this.theme,
|
|
62
|
+
[`${prefixCls}--center`]: this.inputCenter
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
minusButtonClass() {
|
|
68
|
+
const hairlineClass = this.language === 'ar' ? 'vd-hairline--left' : 'vd-hairline--right';
|
|
69
|
+
return `vd-stepper__minus ${hairlineClass}`;
|
|
70
|
+
},
|
|
71
|
+
plusButtonClass() {
|
|
72
|
+
const hairlineClass = this.language === 'ar' ? 'vd-hairline--right' : 'vd-hairline--left';
|
|
73
|
+
return `vd-stepper__plus ${hairlineClass}`;
|
|
74
|
+
}
|
|
75
|
+
// minusDisabled() {
|
|
76
|
+
// return this.disabled || this.currentValue <= this.min;
|
|
77
|
+
// },
|
|
78
|
+
|
|
79
|
+
// plusDisabled() {
|
|
80
|
+
// return this.disabled || this.currentValue >= this.max;
|
|
81
|
+
// }
|
|
82
|
+
},
|
|
83
|
+
watch: {
|
|
84
|
+
value(val) {
|
|
85
|
+
if (val !== this.currentValue) {
|
|
86
|
+
this.currentValue = this.format(val);
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
currentValue(val) {
|
|
91
|
+
this.$emit('input', val);
|
|
92
|
+
this.$emit('change', val);
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
methods: {
|
|
96
|
+
format(value) {
|
|
97
|
+
value = String(value).replace(/[^0-9.-]/g, '');
|
|
98
|
+
return value === '' ? 0 : this.integer ? Math.floor(value) : +value;
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
// limit value range
|
|
102
|
+
range(value) {
|
|
103
|
+
return Math.max(Math.min(this.max, this.format(value)), this.min);
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
onInput(event) {
|
|
107
|
+
const { value } = event.target;
|
|
108
|
+
const formatted = this.format(value);
|
|
109
|
+
if (+value !== formatted) {
|
|
110
|
+
event.target.value = formatted;
|
|
111
|
+
}
|
|
112
|
+
this.currentValue = formatted;
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
onChange(type) {
|
|
116
|
+
if (this[`${type}Disabled`]) {
|
|
117
|
+
this.$emit('overlimit', type);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const diff = type === 'minus' ? -this.step : +this.step;
|
|
121
|
+
const value = Math.round((this.currentValue + diff) * 100) / 100;
|
|
122
|
+
this.currentValue = this.range(value);
|
|
123
|
+
|
|
124
|
+
this.$emit(type);
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
onBlur(event) {
|
|
128
|
+
this.currentValue = this.range(this.currentValue);
|
|
129
|
+
this.$emit('blur', event);
|
|
130
|
+
},
|
|
131
|
+
isDef(value) {
|
|
132
|
+
return value !== undefined && value !== null;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
</script>
|