mali-applet-ui 0.2.37 → 0.2.38
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.
|
@@ -27,11 +27,10 @@ export default {
|
|
|
27
27
|
},
|
|
28
28
|
methods: {
|
|
29
29
|
clickEvent (e) {
|
|
30
|
-
this.$emit('click', { $event: e })
|
|
31
30
|
},
|
|
32
31
|
tapEvent () {
|
|
33
|
-
this.$emit('tap', {
|
|
34
|
-
this.$emit('click', {
|
|
32
|
+
this.$emit('tap', {})
|
|
33
|
+
this.$emit('click', {})
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
36
|
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="ml-modal" :class="[className || '', `placement-${placement || 'bottom'}`, {'is-visible': visible}]" @tap="tapMaskEvent">
|
|
3
|
+
<view v-if="visible" class="ml-drawer-warpper" @tap.stop.prevent>
|
|
4
|
+
<view v-if="showHeader" class="ml-drawer-header">
|
|
5
|
+
<slot name="header">
|
|
6
|
+
<view v-if="title" class="ml-drawer-header-title">{{ title }}</view>
|
|
7
|
+
</slot>
|
|
8
|
+
</view>
|
|
9
|
+
<view class="ml-drawer-body" :style="bodyStyles">
|
|
10
|
+
<scroll-view scroll-y>
|
|
11
|
+
<slot></slot>
|
|
12
|
+
</scroll-view>
|
|
13
|
+
</view>
|
|
14
|
+
<view v-if="showConfirmButton || showCancelButton || showFooter" class="ml-drawer-footer">
|
|
15
|
+
<slot name="footer">
|
|
16
|
+
<ml-button v-if="showCancelButton" @click="cancelEvent">{{ cancelButtonText }}</ml-button>
|
|
17
|
+
<ml-button v-if="showConfirmButton" status="primary" @click="confirmEvent">{{ confirmButtonText }}</ml-button>
|
|
18
|
+
</slot>
|
|
19
|
+
</view>
|
|
20
|
+
</view>
|
|
21
|
+
</view>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script>
|
|
25
|
+
export default {
|
|
26
|
+
name: 'MlModal',
|
|
27
|
+
props: {
|
|
28
|
+
value: Boolean,
|
|
29
|
+
title: String,
|
|
30
|
+
height: String,
|
|
31
|
+
width: String,
|
|
32
|
+
showHeader: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: true
|
|
35
|
+
},
|
|
36
|
+
showFooter: Boolean,
|
|
37
|
+
placement: String,
|
|
38
|
+
maskClosable: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: true
|
|
41
|
+
},
|
|
42
|
+
showConfirmButton: Boolean,
|
|
43
|
+
confirmButtonText: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: '确认'
|
|
46
|
+
},
|
|
47
|
+
confirmClosable: Boolean,
|
|
48
|
+
showCancelButton: Boolean,
|
|
49
|
+
cancelButtonText: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: '取消'
|
|
52
|
+
},
|
|
53
|
+
cancelClosable: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: true
|
|
56
|
+
},
|
|
57
|
+
className: String
|
|
58
|
+
},
|
|
59
|
+
data () {
|
|
60
|
+
return {
|
|
61
|
+
visible: false,
|
|
62
|
+
animateTime: null
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
computed: {
|
|
66
|
+
bodyStyles () {
|
|
67
|
+
const wSty = this.width ? `width:${this.width};` : ''
|
|
68
|
+
const hSty = this.height ? `height:${this.height};` : ''
|
|
69
|
+
return `${wSty}${hSty}`
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
watch: {
|
|
73
|
+
value (val) {
|
|
74
|
+
if (val) {
|
|
75
|
+
this.open()
|
|
76
|
+
} else {
|
|
77
|
+
this.close()
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
created () {
|
|
82
|
+
this.$nextTick(() => {
|
|
83
|
+
if (this.value) {
|
|
84
|
+
this.open()
|
|
85
|
+
} else {
|
|
86
|
+
this.close()
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
},
|
|
90
|
+
methods: {
|
|
91
|
+
close () {
|
|
92
|
+
clearTimeout(this.animateTime)
|
|
93
|
+
this.visible = false
|
|
94
|
+
this.$emit('input', false)
|
|
95
|
+
this.$emit('hide', {})
|
|
96
|
+
},
|
|
97
|
+
open () {
|
|
98
|
+
clearTimeout(this.animateTime)
|
|
99
|
+
this.visible = true
|
|
100
|
+
this.$emit('show', {})
|
|
101
|
+
this.$emit('input', true)
|
|
102
|
+
},
|
|
103
|
+
tapMaskEvent () {
|
|
104
|
+
if (this.maskClosable) {
|
|
105
|
+
this.close()
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
cancelEvent () {
|
|
109
|
+
if (this.cancelClosable) {
|
|
110
|
+
this.close()
|
|
111
|
+
}
|
|
112
|
+
this.$emit('cancel', {})
|
|
113
|
+
},
|
|
114
|
+
confirmEvent () {
|
|
115
|
+
if (this.confirmClosable) {
|
|
116
|
+
this.close()
|
|
117
|
+
}
|
|
118
|
+
this.$emit('confirm', {})
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
</script>
|
|
123
|
+
|
|
124
|
+
<style lang="scss">
|
|
125
|
+
.ml-drawer {
|
|
126
|
+
display: none;
|
|
127
|
+
position: fixed;
|
|
128
|
+
top: 0;
|
|
129
|
+
left: 0;
|
|
130
|
+
width: $ml-page-full-width;
|
|
131
|
+
height: 100vh;
|
|
132
|
+
z-index: 999;
|
|
133
|
+
background-color: rgba(0, 0, 0, 0.4);
|
|
134
|
+
// #ifdef H5
|
|
135
|
+
left: 50%;
|
|
136
|
+
transform: translateX(-50%);
|
|
137
|
+
// #endif
|
|
138
|
+
&.is-visible {
|
|
139
|
+
display: block;
|
|
140
|
+
}
|
|
141
|
+
.ml-drawer-warpper {
|
|
142
|
+
position: absolute;
|
|
143
|
+
bottom: 0;
|
|
144
|
+
left: 0;
|
|
145
|
+
padding-bottom: 20rpx;
|
|
146
|
+
background: #fff;
|
|
147
|
+
transition: transform 0.25s ease, transform 0.3s ease;
|
|
148
|
+
}
|
|
149
|
+
.ml-drawer-header {
|
|
150
|
+
display: flex;
|
|
151
|
+
flex-direction: row;
|
|
152
|
+
align-items: center;
|
|
153
|
+
padding: 10rpx 20rpx;
|
|
154
|
+
min-height: 90rpx;
|
|
155
|
+
font-size: $uni-font-size-lg;
|
|
156
|
+
}
|
|
157
|
+
.ml-drawer-header-title {
|
|
158
|
+
text-align: center;
|
|
159
|
+
overflow: hidden;
|
|
160
|
+
text-overflow: ellipsis;
|
|
161
|
+
white-space: nowrap;
|
|
162
|
+
}
|
|
163
|
+
.ml-drawer-body {
|
|
164
|
+
padding: 20rpx;
|
|
165
|
+
overflow: auto;
|
|
166
|
+
height: 500rpx;
|
|
167
|
+
}
|
|
168
|
+
.ml-drawer-footer {
|
|
169
|
+
display: flex;
|
|
170
|
+
flex-direction: row;
|
|
171
|
+
align-items: center;
|
|
172
|
+
padding: 20rpx;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
</style>
|
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
<text v-else class="ml-number-input-placeholder">{{ placeholder }}</text>
|
|
9
9
|
</view>
|
|
10
10
|
</view>
|
|
11
|
-
<view v-else class="ml-number-input" :class="[{'is-right': align === 'right', 'is-border': border, 'is-disabled': disabled, 'is-clear': clearable && inpVal}, className]">
|
|
11
|
+
<view v-else class="ml-number-input" :class="[{'is-right': align === 'right', 'is-border': border, 'is-controls': controls, 'is-disabled': disabled, 'is-clear': clearable && inpVal}, className]">
|
|
12
|
+
<view v-if="controls" class="ml-number-input-minus-btn" @click="minusEvent">
|
|
13
|
+
<ml-icon name="minus" />
|
|
14
|
+
</view>
|
|
12
15
|
<input
|
|
13
16
|
class="ml-number-input-inp"
|
|
14
17
|
v-model="inpVal"
|
|
@@ -23,6 +26,9 @@
|
|
|
23
26
|
<view v-if="clearable && !disabled && inpVal" class="ml-number-input-clear-icon" @click.stop="clearEvent">
|
|
24
27
|
<ml-icon name="delete-filling"></ml-icon>
|
|
25
28
|
</view>
|
|
29
|
+
<view v-if="controls" class="ml-number-input-plus-btn" @click="plusEvent">
|
|
30
|
+
<ml-icon name="add" />
|
|
31
|
+
</view>
|
|
26
32
|
</view>
|
|
27
33
|
</template>
|
|
28
34
|
|
|
@@ -81,7 +87,19 @@ export default {
|
|
|
81
87
|
computed: {
|
|
82
88
|
isFromReadonly () {
|
|
83
89
|
return this.form ? this.form.readonly : false
|
|
84
|
-
}
|
|
90
|
+
},
|
|
91
|
+
minNum () {
|
|
92
|
+
if (XEUtils.isNumber(this.min) || this.min) {
|
|
93
|
+
return Number(this.min || 0)
|
|
94
|
+
}
|
|
95
|
+
return null
|
|
96
|
+
},
|
|
97
|
+
maxNum () {
|
|
98
|
+
if (XEUtils.isNumber(this.max) || this.max) {
|
|
99
|
+
return Number(this.max)
|
|
100
|
+
}
|
|
101
|
+
return null
|
|
102
|
+
},
|
|
85
103
|
},
|
|
86
104
|
watch: {
|
|
87
105
|
value (val) {
|
|
@@ -119,6 +137,22 @@ export default {
|
|
|
119
137
|
}
|
|
120
138
|
return { status: true, value: numVal }
|
|
121
139
|
},
|
|
140
|
+
minusEvent () {
|
|
141
|
+
const numVal = XEUtils.toNumber(this.inpVal)
|
|
142
|
+
if (this.minNum === null || (numVal > this.minNum)) {
|
|
143
|
+
this.inpVal = numVal - 1
|
|
144
|
+
this.$emit('input', this.inpVal)
|
|
145
|
+
this.$emit('change', {})
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
plusEvent () {
|
|
149
|
+
const numVal = XEUtils.toNumber(this.inpVal)
|
|
150
|
+
if (this.maxNum === null || (numVal < this.maxNum)) {
|
|
151
|
+
this.inpVal = numVal + 1
|
|
152
|
+
this.$emit('input', this.inpVal)
|
|
153
|
+
this.$emit('change', {})
|
|
154
|
+
}
|
|
155
|
+
},
|
|
122
156
|
blurEvent () {
|
|
123
157
|
const rest = this.checkValue()
|
|
124
158
|
this.updateModel = rest.status
|
|
@@ -126,11 +160,13 @@ export default {
|
|
|
126
160
|
},
|
|
127
161
|
inputEvent () {
|
|
128
162
|
this.$emit('input', this.inpVal)
|
|
163
|
+
this.$emit('change', {})
|
|
129
164
|
},
|
|
130
165
|
clearEvent () {
|
|
131
166
|
this.inpVal = ''
|
|
132
167
|
this.inputEvent()
|
|
133
168
|
this.$emit('clear', { value: this.inpVal })
|
|
169
|
+
this.$emit('change', {})
|
|
134
170
|
}
|
|
135
171
|
}
|
|
136
172
|
}
|
|
@@ -162,13 +198,19 @@ export default {
|
|
|
162
198
|
text-align: right;
|
|
163
199
|
}
|
|
164
200
|
}
|
|
165
|
-
&.is-border
|
|
201
|
+
&.is-border,
|
|
202
|
+
&.is-controls {
|
|
166
203
|
.ml-number-input-inp,
|
|
167
204
|
.ml-number-input-simulate {
|
|
168
205
|
border: 1px solid #e5e5e5;
|
|
169
206
|
border-radius: $ml-border-radius;
|
|
170
207
|
}
|
|
171
208
|
}
|
|
209
|
+
&.is-controls {
|
|
210
|
+
.ml-number-input-simulate {
|
|
211
|
+
border-radius: 0;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
172
214
|
.ml-number-input-inp,
|
|
173
215
|
.ml-number-input-simulate {
|
|
174
216
|
font-size: $uni-font-size-base;
|
|
@@ -190,5 +232,20 @@ export default {
|
|
|
190
232
|
color: #c0c4cc;
|
|
191
233
|
border-radius: 0 $ml-border-radius $ml-border-radius 0;
|
|
192
234
|
}
|
|
235
|
+
.ml-number-input-minus-btn,
|
|
236
|
+
.ml-number-input-plus-btn {
|
|
237
|
+
display: flex;
|
|
238
|
+
align-items: center;
|
|
239
|
+
justify-content: center;
|
|
240
|
+
width: 80rpx;
|
|
241
|
+
border: 1px solid #e5e5e5;
|
|
242
|
+
font-size: 32rpx;
|
|
243
|
+
}
|
|
244
|
+
.ml-number-input-minus-btn {
|
|
245
|
+
border-right: 0;
|
|
246
|
+
}
|
|
247
|
+
.ml-number-input-plus-btn {
|
|
248
|
+
border-left: 0;
|
|
249
|
+
}
|
|
193
250
|
}
|
|
194
251
|
</style>
|