eoss-mobiles 0.3.95 → 0.3.97
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/CHANGELOG.md +95 -0
- package/lib/action-sheet.js +4 -4
- package/lib/button-group.js +4 -4
- package/lib/button.js +4 -4
- package/lib/calendar.js +4 -4
- package/lib/cascader.js +4 -4
- package/lib/cell.js +4 -4
- package/lib/checkbox.js +200 -173
- package/lib/circle.js +4 -4
- package/lib/config/api.js +16 -2
- package/lib/count-down.js +4 -4
- package/lib/date.js +108 -108
- package/lib/empty.js +4 -4
- package/lib/eoss-mobile.common.js +651 -83
- package/lib/esign.js +4 -4
- package/lib/field.js +4 -4
- package/lib/flow-btn.js +194 -167
- package/lib/flow-list.js +196 -167
- package/lib/flow.js +241 -212
- package/lib/form.js +93 -6
- package/lib/grid-item.js +4 -4
- package/lib/grid.js +12 -12
- package/lib/image-preview.js +15 -7
- package/lib/image.js +4 -4
- package/lib/index.js +1 -1
- package/lib/list.js +4 -4
- package/lib/loading.js +86 -86
- package/lib/nav-bar.js +4 -4
- package/lib/notice-bar.js +4 -4
- package/lib/pagination.js +4 -4
- package/lib/picker.js +200 -171
- package/lib/popover.js +4 -4
- package/lib/popup.js +4 -4
- package/lib/pull-refresh.js +4 -4
- package/lib/radio.js +199 -170
- package/lib/rate.js +4 -4
- package/lib/retrial-auth.js +194 -167
- package/lib/search.js +4 -4
- package/lib/selector.js +240 -211
- package/lib/skeleton.js +4 -4
- package/lib/stepper.js +4 -4
- package/lib/swipe.js +4 -4
- package/lib/switch.js +4 -4
- package/lib/tab.js +4 -4
- package/lib/table-column.js +194 -165
- package/lib/table.js +16 -16
- package/lib/tabs.js +4 -4
- package/lib/tag.js +4 -4
- package/lib/theme-chalk/fonts/iconfont.scss +98 -98
- package/lib/theme-chalk/fonts/iconfont1.scss +90 -90
- package/lib/uploader.js +2472 -13
- package/package.json +3 -1
- package/packages/action-sheet/index.js +5 -5
- package/packages/action-sheet/src/main.vue +32 -32
- package/packages/button/index.js +5 -5
- package/packages/button/src/main.vue +15 -15
- package/packages/button-group/index.js +5 -5
- package/packages/button-group/src/main.vue +80 -80
- package/packages/calendar/index.js +5 -5
- package/packages/calendar/src/main.vue +34 -34
- package/packages/cascader/index.js +5 -5
- package/packages/cascader/src/main.vue +39 -39
- package/packages/cell/index.js +5 -5
- package/packages/cell/src/main.vue +77 -77
- package/packages/checkbox/index.js +5 -5
- package/packages/checkbox/src/main.vue +232 -232
- package/packages/circle/index.js +5 -5
- package/packages/circle/src/main.vue +27 -27
- package/packages/count-down/index.js +5 -5
- package/packages/count-down/src/main.vue +27 -27
- package/packages/date/index.js +5 -5
- package/packages/date/src/date-time.vue +290 -290
- package/packages/date/src/main.vue +401 -401
- package/packages/empty/index.js +5 -5
- package/packages/empty/src/main.vue +16 -16
- package/packages/esign/index.js +5 -5
- package/packages/esign/src/main.vue +144 -144
- package/packages/field/index.js +5 -5
- package/packages/field/src/main.vue +235 -235
- package/packages/flow/index.js +5 -5
- package/packages/flow/src/components/Circulate.vue +595 -595
- package/packages/flow/src/components/Handle.vue +2404 -2404
- package/packages/flow/src/components/Message.vue +208 -208
- package/packages/flow/src/components/ProcessSettings.vue +342 -342
- package/packages/flow/src/components/supervise.vue +139 -139
- package/packages/flow/src/flowMix.js +288 -288
- package/packages/flow/src/main.vue +116 -116
- package/packages/flow-btn/index.js +5 -5
- package/packages/flow-btn/src/main.vue +494 -494
- package/packages/flow-list/index.js +5 -5
- package/packages/flow-list/src/main.vue +248 -248
- package/packages/form/index.js +5 -5
- package/packages/form/src/main.vue +548 -523
- package/packages/grid/index.js +5 -5
- package/packages/grid/src/main.vue +486 -486
- package/packages/grid-item/index.js +5 -5
- package/packages/grid-item/src/main.vue +16 -16
- package/packages/image/index.js +5 -5
- package/packages/image/src/main.vue +12 -12
- package/packages/image-preview/index.js +5 -5
- package/packages/image-preview/src/main.vue +41 -34
- package/packages/list/index.js +5 -5
- package/packages/list/src/main.vue +32 -32
- package/packages/loading/index.js +5 -5
- package/packages/loading/src/main.vue +19 -19
- package/packages/nav-bar/index.js +5 -5
- package/packages/nav-bar/src/main.vue +24 -24
- package/packages/notice-bar/index.js +5 -5
- package/packages/notice-bar/src/main.vue +15 -15
- package/packages/pagination/index.js +5 -5
- package/packages/pagination/src/main.vue +73 -73
- package/packages/picker/index.js +5 -5
- package/packages/picker/src/main.vue +604 -604
- package/packages/popover/index.js +5 -5
- package/packages/popover/src/main.vue +32 -32
- package/packages/popup/index.js +5 -5
- package/packages/popup/src/main.vue +27 -27
- package/packages/pull-refresh/index.js +5 -5
- package/packages/pull-refresh/src/main.vue +31 -31
- package/packages/radio/index.js +5 -5
- package/packages/radio/src/main.vue +179 -179
- package/packages/rate/index.js +5 -5
- package/packages/rate/src/main.vue +26 -26
- package/packages/retrial-auth/index.js +5 -5
- package/packages/retrial-auth/src/main.vue +257 -257
- package/packages/search/index.js +5 -5
- package/packages/search/src/main.vue +39 -39
- package/packages/selector/index.js +5 -5
- package/packages/selector/src/main.vue +186 -186
- package/packages/selector/src/selector-tree.vue +1117 -1117
- package/packages/selector/src/tree.vue +405 -405
- package/packages/skeleton/index.js +5 -5
- package/packages/skeleton/src/main.vue +17 -17
- package/packages/stepper/index.js +5 -5
- package/packages/stepper/src/main.vue +25 -25
- package/packages/swipe/index.js +5 -5
- package/packages/swipe/src/main.vue +42 -42
- package/packages/switch/index.js +5 -5
- package/packages/switch/src/main.vue +38 -38
- package/packages/tab/index.js +5 -5
- package/packages/tab/src/main.vue +16 -16
- package/packages/table/index.js +5 -5
- package/packages/table/src/main.vue +1006 -1006
- package/packages/table-column/index.js +5 -5
- package/packages/table-column/src/main.vue +931 -931
- package/packages/table-column/src/mixins/table.js +12 -12
- package/packages/tabs/index.js +5 -5
- package/packages/tabs/src/main.vue +34 -34
- package/packages/tag/index.js +5 -5
- package/packages/tag/src/main.vue +16 -16
- package/packages/theme-chalk/lib/action-sheet.css +0 -0
- package/packages/theme-chalk/lib/base.css +1 -0
- package/packages/theme-chalk/lib/button-group.css +1 -0
- package/packages/theme-chalk/lib/button.css +1 -0
- package/packages/theme-chalk/lib/calendar.css +1 -0
- package/packages/theme-chalk/lib/cascader.css +1 -0
- package/packages/theme-chalk/lib/cell.css +1 -0
- package/packages/theme-chalk/lib/checkbox.css +1 -0
- package/packages/theme-chalk/lib/circle.css +1 -0
- package/packages/theme-chalk/lib/count-down.css +0 -0
- package/packages/theme-chalk/lib/date.css +0 -0
- package/packages/theme-chalk/lib/empty.css +0 -0
- package/packages/theme-chalk/lib/esign.css +1 -0
- package/packages/theme-chalk/lib/field.css +1 -0
- package/packages/theme-chalk/lib/flow-btn.css +1 -0
- package/packages/theme-chalk/lib/flow-list-task-read.css +1 -0
- package/packages/theme-chalk/lib/flow-list.css +1 -0
- package/packages/theme-chalk/lib/flow.css +1 -0
- package/packages/theme-chalk/lib/fonts/iconfont.scss +98 -0
- package/packages/theme-chalk/lib/fonts/iconfont.ttf +0 -0
- package/packages/theme-chalk/lib/fonts/iconfont.woff +0 -0
- package/packages/theme-chalk/lib/fonts/iconfont1.scss +90 -0
- package/packages/theme-chalk/lib/form.css +1 -0
- package/packages/theme-chalk/lib/grid-item.css +1 -0
- package/packages/theme-chalk/lib/grid.css +1 -0
- package/packages/theme-chalk/lib/icon.css +1 -0
- package/packages/theme-chalk/lib/image-preview.css +0 -0
- package/packages/theme-chalk/lib/image.css +0 -0
- package/packages/theme-chalk/lib/index.css +1 -0
- package/packages/theme-chalk/lib/list.css +0 -0
- package/packages/theme-chalk/lib/loading.css +0 -0
- package/packages/theme-chalk/lib/nav-bar.css +0 -0
- package/packages/theme-chalk/lib/navbar.css +1 -0
- package/packages/theme-chalk/lib/notice-bar.css +0 -0
- package/packages/theme-chalk/lib/pagination.css +1 -0
- package/packages/theme-chalk/lib/picker.css +1 -0
- package/packages/theme-chalk/lib/popover.css +0 -0
- package/packages/theme-chalk/lib/popup.css +0 -0
- package/packages/theme-chalk/lib/pull-refresh.css +0 -0
- package/packages/theme-chalk/lib/radio.css +1 -0
- package/packages/theme-chalk/lib/rate.css +0 -0
- package/packages/theme-chalk/lib/retrial-auth.css +1 -0
- package/packages/theme-chalk/lib/search.css +0 -0
- package/packages/theme-chalk/lib/selector.css +1 -0
- package/packages/theme-chalk/lib/skeleton.css +0 -0
- package/packages/theme-chalk/lib/stepper.css +1 -0
- package/packages/theme-chalk/lib/swipe.css +0 -0
- package/packages/theme-chalk/lib/switch.css +1 -0
- package/packages/theme-chalk/lib/tab.css +0 -0
- package/packages/theme-chalk/lib/table-column.css +0 -0
- package/packages/theme-chalk/lib/table.css +1 -0
- package/packages/theme-chalk/lib/tabs.css +1 -0
- package/packages/theme-chalk/lib/tag.css +1 -0
- package/packages/theme-chalk/lib/theme.css +0 -0
- package/packages/theme-chalk/lib/tree.css +1 -0
- package/packages/theme-chalk/lib/uploader.css +0 -0
- package/packages/theme-chalk/src/base.scss +195 -195
- package/packages/theme-chalk/src/button-group.scss +25 -25
- package/packages/theme-chalk/src/button.scss +2 -2
- package/packages/theme-chalk/src/calendar.scss +11 -11
- package/packages/theme-chalk/src/cascader.scss +11 -11
- package/packages/theme-chalk/src/cell.scss +14 -14
- package/packages/theme-chalk/src/checkbox.scss +9 -9
- package/packages/theme-chalk/src/circle.scss +6 -6
- package/packages/theme-chalk/src/common/var.scss +1525 -1525
- package/packages/theme-chalk/src/esign.scss +51 -51
- package/packages/theme-chalk/src/field.scss +98 -98
- package/packages/theme-chalk/src/flow-btn.scss +99 -99
- package/packages/theme-chalk/src/flow-list.scss +122 -122
- package/packages/theme-chalk/src/fonts/iconfont.scss +98 -98
- package/packages/theme-chalk/src/fonts/iconfont1.scss +90 -90
- package/packages/theme-chalk/src/form.scss +33 -33
- package/packages/theme-chalk/src/grid-item.scss +16 -16
- package/packages/theme-chalk/src/grid.scss +46 -46
- package/packages/theme-chalk/src/icon.scss +1661 -1661
- package/packages/theme-chalk/src/mixins/color.scss +117 -117
- package/packages/theme-chalk/src/navbar.scss +5 -5
- package/packages/theme-chalk/src/pagination.scss +12 -12
- package/packages/theme-chalk/src/picker.scss +31 -31
- package/packages/theme-chalk/src/radio.scss +6 -6
- package/packages/theme-chalk/src/retrial-auth.scss +28 -28
- package/packages/theme-chalk/src/selector.scss +247 -247
- package/packages/theme-chalk/src/stepper.scss +9 -9
- package/packages/theme-chalk/src/switch.scss +5 -5
- package/packages/theme-chalk/src/table.scss +86 -86
- package/packages/theme-chalk/src/tabs.scss +31 -31
- package/packages/theme-chalk/src/tag.scss +12 -12
- package/packages/theme-chalk/src/theme.scss +1 -1
- package/packages/theme-chalk/src/tree.scss +127 -127
- package/packages/uploader/index.js +5 -5
- package/packages/uploader/src/main.vue +586 -31
- package/src/config/api.js +18 -0
- package/src/index.js +1 -1
- package/src/utils/axios.js +217 -217
- package/src/utils/date-util.js +312 -312
- package/src/utils/http.js +106 -106
- package/src/utils/rules.js +18 -18
- package/src/utils/store.js +21 -21
- package/packages/theme-chalk/gulpfile.js +0 -25
|
@@ -1,235 +1,235 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="em-input" :class="{'em-input-border':border}">
|
|
3
|
-
<!-- <div :class="{'em-input-border':border}"></div> -->
|
|
4
|
-
<van-field
|
|
5
|
-
:class="{
|
|
6
|
-
'hide-label': hideLabel,
|
|
7
|
-
'input-wrap': labelPosition == 'top',
|
|
8
|
-
'required-right': requiredPosition == 'right',
|
|
9
|
-
'input-right':($attrs['inputAlign'] || $attrs['input-align']) === 'right',
|
|
10
|
-
isRequired:
|
|
11
|
-
(required ||
|
|
12
|
-
(Array.isArray(rules) ? rules[0].required : rules.required)) &&
|
|
13
|
-
requiredPosition != 'right',
|
|
14
|
-
'is-left-icon': leftIcon,
|
|
15
|
-
|
|
16
|
-
}"
|
|
17
|
-
:disabled="$attrs.disabled || !!$attrs.readonly "
|
|
18
|
-
v-model="modelValue"
|
|
19
|
-
:border='border'
|
|
20
|
-
autocomplete="new-password"
|
|
21
|
-
v-bind="$attrs"
|
|
22
|
-
:label-width="labelWidth"
|
|
23
|
-
:placeholder="
|
|
24
|
-
($attrs.disabled || $attrs.readonly) && newPlaceholder == undefined ?'暂无数据' : newPlaceholder != undefined ? newPlaceholder : '请输入' + ($attrs.label || '')
|
|
25
|
-
"
|
|
26
|
-
v-on="$listeners"
|
|
27
|
-
:error-message="newErrorMessage"
|
|
28
|
-
:required="
|
|
29
|
-
required || (Array.isArray(rules) ? rules[0].required : rules.required)
|
|
30
|
-
"
|
|
31
|
-
:autofocus="autofocus"
|
|
32
|
-
:error="
|
|
33
|
-
(!newErrorMessage &&
|
|
34
|
-
!modelValue &&
|
|
35
|
-
rules &&
|
|
36
|
-
(Array.isArray(rules) ? rules[0].required : rules.required) &&
|
|
37
|
-
isBlur) ||
|
|
38
|
-
$attrs.error
|
|
39
|
-
"
|
|
40
|
-
:right-icon="$attrs['right-icon'] || getRightIcon"
|
|
41
|
-
:label-align="labelAlign"
|
|
42
|
-
:type="newType"
|
|
43
|
-
:left-icon="leftIcon"
|
|
44
|
-
:rules="Array.isArray(rules) ? rules : []"
|
|
45
|
-
@blur="handleBlur(rules)"
|
|
46
|
-
@change="handleBlur(rules)"
|
|
47
|
-
@click-right-icon="handleRightIcon"
|
|
48
|
-
>
|
|
49
|
-
<!-- @focus="handleFocus" -->
|
|
50
|
-
<template v-if="!$slots['left-icon'] && leftIcon" slot="left-icon">
|
|
51
|
-
<i :class="`${leftIcon.indexOf('icon-') == -1 ? `van-icon van-icon-${leftIcon}` : `iconfont ${leftIcon}` }`" style="color:#9399A5" />
|
|
52
|
-
</template>
|
|
53
|
-
<template v-if="!$slots.label" slot="label">
|
|
54
|
-
<span
|
|
55
|
-
:class="{
|
|
56
|
-
'em-cell--required':
|
|
57
|
-
(required ||
|
|
58
|
-
(Array.isArray(rules) ? rules[0].required : rules.required)) &&
|
|
59
|
-
requiredPosition == 'right'
|
|
60
|
-
}"
|
|
61
|
-
>{{ label }}</span
|
|
62
|
-
>
|
|
63
|
-
</template>
|
|
64
|
-
<template v-for="(index, name) in $slots" :slot="name">
|
|
65
|
-
<slot :name="name" />
|
|
66
|
-
</template>
|
|
67
|
-
</van-field>
|
|
68
|
-
</div>
|
|
69
|
-
</template>
|
|
70
|
-
<script>
|
|
71
|
-
export default {
|
|
72
|
-
name: 'EmInput',
|
|
73
|
-
inheritAttrs: false,
|
|
74
|
-
props: {
|
|
75
|
-
value: {
|
|
76
|
-
type: [String, Array, Number],
|
|
77
|
-
default: ''
|
|
78
|
-
},
|
|
79
|
-
label: {
|
|
80
|
-
type: String,
|
|
81
|
-
default: ''
|
|
82
|
-
},
|
|
83
|
-
labelAlign: {
|
|
84
|
-
type: String,
|
|
85
|
-
default: 'left'
|
|
86
|
-
},
|
|
87
|
-
required: {
|
|
88
|
-
type: Boolean,
|
|
89
|
-
default: false
|
|
90
|
-
},
|
|
91
|
-
precision: {
|
|
92
|
-
type: Number,
|
|
93
|
-
default: null
|
|
94
|
-
},
|
|
95
|
-
labelWidth: {
|
|
96
|
-
type: [String, Number],
|
|
97
|
-
default: '4em'
|
|
98
|
-
},
|
|
99
|
-
hideLabel: {
|
|
100
|
-
type: Boolean,
|
|
101
|
-
default: false
|
|
102
|
-
},
|
|
103
|
-
rules: {
|
|
104
|
-
type: [Object, Array],
|
|
105
|
-
default() {
|
|
106
|
-
return {};
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
errorMessage: {
|
|
110
|
-
type: String,
|
|
111
|
-
default: ''
|
|
112
|
-
},
|
|
113
|
-
autofocus: {
|
|
114
|
-
type: Boolean,
|
|
115
|
-
default: false
|
|
116
|
-
},
|
|
117
|
-
labelPosition: {
|
|
118
|
-
type: String,
|
|
119
|
-
default: 'left'
|
|
120
|
-
},
|
|
121
|
-
showPassword: {
|
|
122
|
-
type: Boolean,
|
|
123
|
-
default: false
|
|
124
|
-
},
|
|
125
|
-
type: {
|
|
126
|
-
type: String,
|
|
127
|
-
default: 'text'
|
|
128
|
-
},
|
|
129
|
-
requiredPosition: {
|
|
130
|
-
type: String,
|
|
131
|
-
default: 'left'
|
|
132
|
-
},
|
|
133
|
-
leftIcon: {
|
|
134
|
-
type: String,
|
|
135
|
-
default: ''
|
|
136
|
-
},
|
|
137
|
-
border:{
|
|
138
|
-
type:Boolean,
|
|
139
|
-
default:true
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
data() {
|
|
143
|
-
return {
|
|
144
|
-
newPlaceholder: '',
|
|
145
|
-
newErrorMessage: '',
|
|
146
|
-
isBlur: false,
|
|
147
|
-
newType: ''
|
|
148
|
-
};
|
|
149
|
-
},
|
|
150
|
-
computed: {
|
|
151
|
-
getRightIcon: {
|
|
152
|
-
get() {
|
|
153
|
-
let icon = undefined;
|
|
154
|
-
if (this.showPassword) {
|
|
155
|
-
if (this.newType != 'password') {
|
|
156
|
-
icon = 'eye-o';
|
|
157
|
-
} else {
|
|
158
|
-
icon = 'closed-eye';
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
return icon;
|
|
162
|
-
},
|
|
163
|
-
set(val) {
|
|
164
|
-
return val;
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
modelValue: {
|
|
168
|
-
get() {
|
|
169
|
-
let val = this.value;
|
|
170
|
-
return val;
|
|
171
|
-
},
|
|
172
|
-
set(val) {
|
|
173
|
-
return val;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
mounted() {
|
|
178
|
-
this.newType = this.type;
|
|
179
|
-
this.newPlaceholder = this.$attrs.placeholder;
|
|
180
|
-
this.newErrorMessage = this.errorMessage;
|
|
181
|
-
},
|
|
182
|
-
methods: {
|
|
183
|
-
handleRightIcon(event) {
|
|
184
|
-
if (this.showPassword) {
|
|
185
|
-
if (this.newType == 'text') {
|
|
186
|
-
this.newType = 'password';
|
|
187
|
-
} else {
|
|
188
|
-
this.newType = 'text';
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
// this.$emit('click-right-icon', event);
|
|
192
|
-
},
|
|
193
|
-
handleBlur(rules) {
|
|
194
|
-
const _that = this;
|
|
195
|
-
this.isBlur = true;
|
|
196
|
-
if (this.$attrs.type == 'number' && this.precision != null) {
|
|
197
|
-
this.$emit('input', Number(this.value).toFixed(Number(this.precision)));
|
|
198
|
-
}
|
|
199
|
-
if (Array.isArray(rules)) {
|
|
200
|
-
rules.map(x => {
|
|
201
|
-
this.handleBlur(x);
|
|
202
|
-
});
|
|
203
|
-
} else {
|
|
204
|
-
if (rules && rules.required && !rules.validator && !this.value) {
|
|
205
|
-
rules.message && (this.newPlaceholder = '');
|
|
206
|
-
this.newErrorMessage = rules.message;
|
|
207
|
-
|
|
208
|
-
return { name: _that.$attrs.name, message: rules.message };
|
|
209
|
-
} else if (rules && rules.validator) {
|
|
210
|
-
rules.validator(this.value, this.valid);
|
|
211
|
-
} else {
|
|
212
|
-
// this.newPlaceholder = '';
|
|
213
|
-
this.newErrorMessage = '';
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
valid(val) {
|
|
218
|
-
const _that = this;
|
|
219
|
-
if (!this.value) {
|
|
220
|
-
this.newPlaceholder = val;
|
|
221
|
-
this.newErrorMessage = '';
|
|
222
|
-
} else {
|
|
223
|
-
this.newPlaceholder = '';
|
|
224
|
-
this.newErrorMessage = val;
|
|
225
|
-
}
|
|
226
|
-
return {
|
|
227
|
-
name: _that.$attrs.name,
|
|
228
|
-
message: Array.isArray(_that.rules)
|
|
229
|
-
? _that.rules[0].message
|
|
230
|
-
: _that.rules.message
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="em-input" :class="{'em-input-border':border}">
|
|
3
|
+
<!-- <div :class="{'em-input-border':border}"></div> -->
|
|
4
|
+
<van-field
|
|
5
|
+
:class="{
|
|
6
|
+
'hide-label': hideLabel,
|
|
7
|
+
'input-wrap': labelPosition == 'top',
|
|
8
|
+
'required-right': requiredPosition == 'right',
|
|
9
|
+
'input-right':($attrs['inputAlign'] || $attrs['input-align']) === 'right',
|
|
10
|
+
isRequired:
|
|
11
|
+
(required ||
|
|
12
|
+
(Array.isArray(rules) ? rules[0].required : rules.required)) &&
|
|
13
|
+
requiredPosition != 'right',
|
|
14
|
+
'is-left-icon': leftIcon,
|
|
15
|
+
|
|
16
|
+
}"
|
|
17
|
+
:disabled="$attrs.disabled || !!$attrs.readonly "
|
|
18
|
+
v-model="modelValue"
|
|
19
|
+
:border='border'
|
|
20
|
+
autocomplete="new-password"
|
|
21
|
+
v-bind="$attrs"
|
|
22
|
+
:label-width="labelWidth"
|
|
23
|
+
:placeholder="
|
|
24
|
+
($attrs.disabled || $attrs.readonly) && newPlaceholder == undefined ?'暂无数据' : newPlaceholder != undefined ? newPlaceholder : '请输入' + ($attrs.label || '')
|
|
25
|
+
"
|
|
26
|
+
v-on="$listeners"
|
|
27
|
+
:error-message="newErrorMessage"
|
|
28
|
+
:required="
|
|
29
|
+
required || (Array.isArray(rules) ? rules[0].required : rules.required)
|
|
30
|
+
"
|
|
31
|
+
:autofocus="autofocus"
|
|
32
|
+
:error="
|
|
33
|
+
(!newErrorMessage &&
|
|
34
|
+
!modelValue &&
|
|
35
|
+
rules &&
|
|
36
|
+
(Array.isArray(rules) ? rules[0].required : rules.required) &&
|
|
37
|
+
isBlur) ||
|
|
38
|
+
$attrs.error
|
|
39
|
+
"
|
|
40
|
+
:right-icon="$attrs['right-icon'] || getRightIcon"
|
|
41
|
+
:label-align="labelAlign"
|
|
42
|
+
:type="newType"
|
|
43
|
+
:left-icon="leftIcon"
|
|
44
|
+
:rules="Array.isArray(rules) ? rules : []"
|
|
45
|
+
@blur="handleBlur(rules)"
|
|
46
|
+
@change="handleBlur(rules)"
|
|
47
|
+
@click-right-icon="handleRightIcon"
|
|
48
|
+
>
|
|
49
|
+
<!-- @focus="handleFocus" -->
|
|
50
|
+
<template v-if="!$slots['left-icon'] && leftIcon" slot="left-icon">
|
|
51
|
+
<i :class="`${leftIcon.indexOf('icon-') == -1 ? `van-icon van-icon-${leftIcon}` : `iconfont ${leftIcon}` }`" style="color:#9399A5" />
|
|
52
|
+
</template>
|
|
53
|
+
<template v-if="!$slots.label" slot="label">
|
|
54
|
+
<span
|
|
55
|
+
:class="{
|
|
56
|
+
'em-cell--required':
|
|
57
|
+
(required ||
|
|
58
|
+
(Array.isArray(rules) ? rules[0].required : rules.required)) &&
|
|
59
|
+
requiredPosition == 'right'
|
|
60
|
+
}"
|
|
61
|
+
>{{ label }}</span
|
|
62
|
+
>
|
|
63
|
+
</template>
|
|
64
|
+
<template v-for="(index, name) in $slots" :slot="name">
|
|
65
|
+
<slot :name="name" />
|
|
66
|
+
</template>
|
|
67
|
+
</van-field>
|
|
68
|
+
</div>
|
|
69
|
+
</template>
|
|
70
|
+
<script>
|
|
71
|
+
export default {
|
|
72
|
+
name: 'EmInput',
|
|
73
|
+
inheritAttrs: false,
|
|
74
|
+
props: {
|
|
75
|
+
value: {
|
|
76
|
+
type: [String, Array, Number],
|
|
77
|
+
default: ''
|
|
78
|
+
},
|
|
79
|
+
label: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: ''
|
|
82
|
+
},
|
|
83
|
+
labelAlign: {
|
|
84
|
+
type: String,
|
|
85
|
+
default: 'left'
|
|
86
|
+
},
|
|
87
|
+
required: {
|
|
88
|
+
type: Boolean,
|
|
89
|
+
default: false
|
|
90
|
+
},
|
|
91
|
+
precision: {
|
|
92
|
+
type: Number,
|
|
93
|
+
default: null
|
|
94
|
+
},
|
|
95
|
+
labelWidth: {
|
|
96
|
+
type: [String, Number],
|
|
97
|
+
default: '4em'
|
|
98
|
+
},
|
|
99
|
+
hideLabel: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
default: false
|
|
102
|
+
},
|
|
103
|
+
rules: {
|
|
104
|
+
type: [Object, Array],
|
|
105
|
+
default() {
|
|
106
|
+
return {};
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
errorMessage: {
|
|
110
|
+
type: String,
|
|
111
|
+
default: ''
|
|
112
|
+
},
|
|
113
|
+
autofocus: {
|
|
114
|
+
type: Boolean,
|
|
115
|
+
default: false
|
|
116
|
+
},
|
|
117
|
+
labelPosition: {
|
|
118
|
+
type: String,
|
|
119
|
+
default: 'left'
|
|
120
|
+
},
|
|
121
|
+
showPassword: {
|
|
122
|
+
type: Boolean,
|
|
123
|
+
default: false
|
|
124
|
+
},
|
|
125
|
+
type: {
|
|
126
|
+
type: String,
|
|
127
|
+
default: 'text'
|
|
128
|
+
},
|
|
129
|
+
requiredPosition: {
|
|
130
|
+
type: String,
|
|
131
|
+
default: 'left'
|
|
132
|
+
},
|
|
133
|
+
leftIcon: {
|
|
134
|
+
type: String,
|
|
135
|
+
default: ''
|
|
136
|
+
},
|
|
137
|
+
border:{
|
|
138
|
+
type:Boolean,
|
|
139
|
+
default:true
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
data() {
|
|
143
|
+
return {
|
|
144
|
+
newPlaceholder: '',
|
|
145
|
+
newErrorMessage: '',
|
|
146
|
+
isBlur: false,
|
|
147
|
+
newType: ''
|
|
148
|
+
};
|
|
149
|
+
},
|
|
150
|
+
computed: {
|
|
151
|
+
getRightIcon: {
|
|
152
|
+
get() {
|
|
153
|
+
let icon = undefined;
|
|
154
|
+
if (this.showPassword) {
|
|
155
|
+
if (this.newType != 'password') {
|
|
156
|
+
icon = 'eye-o';
|
|
157
|
+
} else {
|
|
158
|
+
icon = 'closed-eye';
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return icon;
|
|
162
|
+
},
|
|
163
|
+
set(val) {
|
|
164
|
+
return val;
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
modelValue: {
|
|
168
|
+
get() {
|
|
169
|
+
let val = this.value;
|
|
170
|
+
return val;
|
|
171
|
+
},
|
|
172
|
+
set(val) {
|
|
173
|
+
return val;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
mounted() {
|
|
178
|
+
this.newType = this.type;
|
|
179
|
+
this.newPlaceholder = this.$attrs.placeholder;
|
|
180
|
+
this.newErrorMessage = this.errorMessage;
|
|
181
|
+
},
|
|
182
|
+
methods: {
|
|
183
|
+
handleRightIcon(event) {
|
|
184
|
+
if (this.showPassword) {
|
|
185
|
+
if (this.newType == 'text') {
|
|
186
|
+
this.newType = 'password';
|
|
187
|
+
} else {
|
|
188
|
+
this.newType = 'text';
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
// this.$emit('click-right-icon', event);
|
|
192
|
+
},
|
|
193
|
+
handleBlur(rules) {
|
|
194
|
+
const _that = this;
|
|
195
|
+
this.isBlur = true;
|
|
196
|
+
if (this.$attrs.type == 'number' && this.precision != null) {
|
|
197
|
+
this.$emit('input', Number(this.value).toFixed(Number(this.precision)));
|
|
198
|
+
}
|
|
199
|
+
if (Array.isArray(rules)) {
|
|
200
|
+
rules.map(x => {
|
|
201
|
+
this.handleBlur(x);
|
|
202
|
+
});
|
|
203
|
+
} else {
|
|
204
|
+
if (rules && rules.required && !rules.validator && !this.value) {
|
|
205
|
+
rules.message && (this.newPlaceholder = '');
|
|
206
|
+
this.newErrorMessage = rules.message;
|
|
207
|
+
|
|
208
|
+
return { name: _that.$attrs.name, message: rules.message };
|
|
209
|
+
} else if (rules && rules.validator) {
|
|
210
|
+
rules.validator(this.value, this.valid);
|
|
211
|
+
} else {
|
|
212
|
+
// this.newPlaceholder = '';
|
|
213
|
+
this.newErrorMessage = '';
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
valid(val) {
|
|
218
|
+
const _that = this;
|
|
219
|
+
if (!this.value) {
|
|
220
|
+
this.newPlaceholder = val;
|
|
221
|
+
this.newErrorMessage = '';
|
|
222
|
+
} else {
|
|
223
|
+
this.newPlaceholder = '';
|
|
224
|
+
this.newErrorMessage = val;
|
|
225
|
+
}
|
|
226
|
+
return {
|
|
227
|
+
name: _that.$attrs.name,
|
|
228
|
+
message: Array.isArray(_that.rules)
|
|
229
|
+
? _that.rules[0].message
|
|
230
|
+
: _that.rules.message
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
</script>
|
package/packages/flow/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import EmFlow from './src/main';
|
|
2
|
-
|
|
3
|
-
EmFlow.install = Vue => Vue.component(EmFlow.name, EmFlow);
|
|
4
|
-
|
|
5
|
-
export default EmFlow;
|
|
1
|
+
import EmFlow from './src/main';
|
|
2
|
+
|
|
3
|
+
EmFlow.install = Vue => Vue.component(EmFlow.name, EmFlow);
|
|
4
|
+
|
|
5
|
+
export default EmFlow;
|