mali-applet-ui 0.0.64 → 0.0.65
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.
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="ml-form-item" :class="[className, '', itemTitleAlign ? `title-align-${itemTitleAlign}` : '', itemAlign ? `align-${itemAlign}` : '', {'is-border': isFormBorder, 'is-vertical': itemVertical}]">
|
|
3
|
-
<view class="ml-form-item-
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
<view class="ml-form-item" :class="[className, '', itemTitleAlign ? `title-align-${itemTitleAlign}` : '', itemAlign ? `align-${itemAlign}` : '', {'is-border': isFormBorder, 'is-vertical': itemVertical, 'is-required': isRequired}]">
|
|
3
|
+
<view class="ml-form-item-header" :style="titleStyle">
|
|
4
|
+
<text v-if="isRequired" class="ml-form-item-header-asterisk">*</text>
|
|
5
|
+
<text class="ml-form-item-header-title">
|
|
6
|
+
<slot name="title">{{ title }}</slot>
|
|
7
|
+
</text>
|
|
7
8
|
</view>
|
|
8
9
|
<view class="ml-form-item-content">
|
|
9
10
|
<view class="ml-form-item-content-warpper">
|
|
@@ -11,7 +12,7 @@
|
|
|
11
12
|
<ml-input v-if="matchComponent('MlInput')" :value="itemValue" border @change="modelEvent"></ml-input>
|
|
12
13
|
<ml-date-picker v-else-if="matchComponent('MlDatePicker')" :value="itemValue" border @change="modelEvent"></ml-date-picker>
|
|
13
14
|
<ml-select-picker v-else-if="matchComponent('MlSelectPicker')" :value="itemValue" :options="renderOpts.options" border @change="modelEvent"></ml-select-picker>
|
|
14
|
-
<ml-textarea v-else-if="matchComponent('MlTextarea')" :value="itemValue" :rows="renderOpts.rows || 3" border @change="modelEvent"></ml-textarea>
|
|
15
|
+
<ml-textarea v-else-if="matchComponent('MlTextarea')" :value="itemValue" :rows="renderOpts.rows || 3" :showVoice="renderOpts.showVoice || true" border @change="modelEvent"></ml-textarea>
|
|
15
16
|
<ml-upload v-else-if="matchComponent('MlUpload')" :value="itemValue" :mediatype="renderOpts.mediatype || 'image'" @change="modelEvent"></ml-upload>
|
|
16
17
|
<ml-amount-input v-else-if="matchComponent('MlAmountInput')" :value="itemValue" border @change="modelEvent"></ml-amount-input>
|
|
17
18
|
<ml-amount-text v-else-if="matchComponent('MlAmountText')" :value="itemValue" @change="modelEvent"></ml-amount-text>
|
|
@@ -23,6 +24,8 @@
|
|
|
23
24
|
</template>
|
|
24
25
|
|
|
25
26
|
<script>
|
|
27
|
+
import XEUtils from 'xe-utils'
|
|
28
|
+
|
|
26
29
|
export default {
|
|
27
30
|
name: 'MlFormItem',
|
|
28
31
|
options: {
|
|
@@ -44,6 +47,23 @@ export default {
|
|
|
44
47
|
default: null
|
|
45
48
|
}
|
|
46
49
|
},
|
|
50
|
+
data () {
|
|
51
|
+
return {
|
|
52
|
+
mId: XEUtils.uniqueId('mlFItem')
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
mounted () {
|
|
56
|
+
this.$nextTick(() => {
|
|
57
|
+
if (this.form) {
|
|
58
|
+
this.form.itemList.push(this)
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
},
|
|
62
|
+
beforeDestroy () {
|
|
63
|
+
if (this.form) {
|
|
64
|
+
XEUtils.remove(this.form.itemList, item => item.mId === this.mId)
|
|
65
|
+
}
|
|
66
|
+
},
|
|
47
67
|
computed: {
|
|
48
68
|
titleStyle () {
|
|
49
69
|
return this.itemLabelWidth ? `width:${this.itemLabelWidth};` : ''
|
|
@@ -98,12 +118,7 @@ export default {
|
|
|
98
118
|
return labelWidth
|
|
99
119
|
}
|
|
100
120
|
},
|
|
101
|
-
created () {
|
|
102
|
-
this.init()
|
|
103
|
-
},
|
|
104
121
|
methods: {
|
|
105
|
-
init () {
|
|
106
|
-
},
|
|
107
122
|
matchComponent (name) {
|
|
108
123
|
return this.renderOpts.name === name
|
|
109
124
|
},
|
|
@@ -127,30 +142,34 @@ export default {
|
|
|
127
142
|
border: 0;
|
|
128
143
|
}
|
|
129
144
|
}
|
|
130
|
-
.ml-form-item-
|
|
145
|
+
.ml-form-item-header {
|
|
131
146
|
min-height: 70rpx;
|
|
132
147
|
color: rgba(0, 0, 0, 0.65);
|
|
133
148
|
}
|
|
149
|
+
.ml-form-item-header-asterisk {
|
|
150
|
+
color: red;
|
|
151
|
+
padding-right: 4rpx;
|
|
152
|
+
}
|
|
134
153
|
&.is-vertical {
|
|
135
154
|
flex-direction: column;
|
|
136
155
|
}
|
|
137
156
|
&:not(.is-vertical) {
|
|
138
|
-
.ml-form-item-
|
|
157
|
+
.ml-form-item-header {
|
|
139
158
|
flex-shrink: 0;
|
|
140
159
|
}
|
|
141
160
|
}
|
|
142
161
|
&.title-align-left {
|
|
143
|
-
.ml-form-item-
|
|
162
|
+
.ml-form-item-header {
|
|
144
163
|
text-align: left;
|
|
145
164
|
}
|
|
146
165
|
}
|
|
147
166
|
&.title-align-center {
|
|
148
|
-
.ml-form-item-
|
|
167
|
+
.ml-form-item-header {
|
|
149
168
|
text-align: center;
|
|
150
169
|
}
|
|
151
170
|
}
|
|
152
171
|
&.title-align-right {
|
|
153
|
-
.ml-form-item-
|
|
172
|
+
.ml-form-item-header {
|
|
154
173
|
text-align: right;
|
|
155
174
|
}
|
|
156
175
|
}
|
|
@@ -169,7 +188,7 @@ export default {
|
|
|
169
188
|
text-align: right;
|
|
170
189
|
}
|
|
171
190
|
}
|
|
172
|
-
.ml-form-item-
|
|
191
|
+
.ml-form-item-header {
|
|
173
192
|
display: flex;
|
|
174
193
|
align-items: center;
|
|
175
194
|
padding-right: 20rpx;
|
package/index.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import config from './config'
|
|
2
|
-
import MaliToast from './toast'
|
|
3
|
-
import
|
|
2
|
+
import MaliToast from './modal/toast'
|
|
3
|
+
import MaliModal from './modal/modal'
|
|
4
|
+
import MaliLoading from './modal/loading'
|
|
4
5
|
import * as MaliUtils from './utils'
|
|
5
6
|
|
|
6
7
|
const MaliUI = {
|
|
7
8
|
config,
|
|
8
9
|
MaliUtils,
|
|
9
10
|
MaliToast,
|
|
11
|
+
MaliModal,
|
|
10
12
|
MaliLoading
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
export {
|
|
14
16
|
MaliUtils,
|
|
15
17
|
MaliToast,
|
|
18
|
+
MaliModal,
|
|
16
19
|
MaliLoading
|
|
17
20
|
}
|
|
18
21
|
|
|
File without changes
|
package/modal/modal.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const MaliModal = {
|
|
2
|
+
open (option = {}) {
|
|
3
|
+
return new Promise(resolve => {
|
|
4
|
+
uni.showModal({
|
|
5
|
+
title: option.title || '系统提示',
|
|
6
|
+
content: option.content || '',
|
|
7
|
+
...option,
|
|
8
|
+
success (res) {
|
|
9
|
+
if (res.confirm) {
|
|
10
|
+
resolve('confirm')
|
|
11
|
+
} else if (res.cancel) {
|
|
12
|
+
resolve('cancel')
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
})
|
|
16
|
+
})
|
|
17
|
+
},
|
|
18
|
+
alert (option = {}) {
|
|
19
|
+
return new Promise(resolve => {
|
|
20
|
+
uni.showModal({
|
|
21
|
+
title: option.title || '系统提示',
|
|
22
|
+
content: option.content || '',
|
|
23
|
+
success () {
|
|
24
|
+
resolve('confirm')
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
})
|
|
28
|
+
},
|
|
29
|
+
confirm (option = {}) {
|
|
30
|
+
return new Promise(resolve => {
|
|
31
|
+
uni.showModal({
|
|
32
|
+
title: option.title || '系统提示',
|
|
33
|
+
content: option.content || '',
|
|
34
|
+
showCancel: true,
|
|
35
|
+
success (res) {
|
|
36
|
+
if (res.confirm) {
|
|
37
|
+
resolve('confirm')
|
|
38
|
+
} else if (res.cancel) {
|
|
39
|
+
resolve('cancel')
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default MaliModal
|
|
File without changes
|
package/package.json
CHANGED