mali-applet-ui 0.1.75 → 0.1.77
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/components/ml-checkbox/ml-checkbox.vue +4 -1
- package/components/ml-drawer/ml-drawer.vue +5 -0
- package/components/ml-list-group/ml-list-group.vue +17 -0
- package/components/ml-list-item/ml-list-item.vue +22 -0
- package/components/ml-list-menu-group/ml-list-menu-group.vue +17 -0
- package/components/ml-list-menu-item/ml-list-menu-item.vue +22 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="ml-checkbox" :class="[className || '', {'is-vertical': vertical, 'is-checked': checked, 'is-disabled': disabled}]" @tap="tapEvent">
|
|
2
|
+
<view class="ml-checkbox" :class="[className || '', {'is-vertical': vertical, 'is-checked': checked, 'is-half': indeterminate, 'is-disabled': disabled}]" @tap="tapEvent">
|
|
3
3
|
<view class="ml-checkbox-icon">
|
|
4
4
|
<ml-icon :name="checked ? 'checkbox-checked' : (indeterminate ? 'checkbox-indeterminate' : 'checkbox-unchecked')"></ml-icon>
|
|
5
5
|
</view>
|
|
@@ -64,6 +64,9 @@ export default {
|
|
|
64
64
|
&.is-checked {
|
|
65
65
|
color: $uni-color-primary;
|
|
66
66
|
}
|
|
67
|
+
&.is-half {
|
|
68
|
+
color: $uni-color-primary;
|
|
69
|
+
}
|
|
67
70
|
&.is-disabled {
|
|
68
71
|
color: rgba(0,0,0,0.25);
|
|
69
72
|
}
|
|
@@ -178,7 +178,11 @@ export default {
|
|
|
178
178
|
transition: transform 0.25s ease, transform 0.3s ease;
|
|
179
179
|
}
|
|
180
180
|
.ml-drawer-header {
|
|
181
|
+
display: flex;
|
|
182
|
+
flex-direction: row;
|
|
183
|
+
align-items: center;
|
|
181
184
|
padding: 10rpx 20rpx;
|
|
185
|
+
min-height: 80rpx;
|
|
182
186
|
}
|
|
183
187
|
.ml-drawer-header-title {
|
|
184
188
|
text-align: center;
|
|
@@ -197,6 +201,7 @@ export default {
|
|
|
197
201
|
.ml-drawer-footer {
|
|
198
202
|
display: flex;
|
|
199
203
|
flex-direction: row;
|
|
204
|
+
align-items: center;
|
|
200
205
|
padding: 20rpx;
|
|
201
206
|
}
|
|
202
207
|
}
|
|
@@ -24,6 +24,8 @@ export default {
|
|
|
24
24
|
type: [Array, Boolean, Number, String],
|
|
25
25
|
default: null
|
|
26
26
|
},
|
|
27
|
+
isAllChecked: Boolean,
|
|
28
|
+
isAllIndeterminate: Boolean,
|
|
27
29
|
type: String,
|
|
28
30
|
vertical: Boolean,
|
|
29
31
|
showPage: Boolean,
|
|
@@ -54,6 +56,7 @@ export default {
|
|
|
54
56
|
total: 0
|
|
55
57
|
},
|
|
56
58
|
selectValue: null,
|
|
59
|
+
itemList: [],
|
|
57
60
|
selection: []
|
|
58
61
|
}
|
|
59
62
|
},
|
|
@@ -94,6 +97,11 @@ export default {
|
|
|
94
97
|
}
|
|
95
98
|
})
|
|
96
99
|
},
|
|
100
|
+
mounted () {
|
|
101
|
+
if (this.type === 'checkbox') {
|
|
102
|
+
setTimeout(() => this.updateStatus(), 10)
|
|
103
|
+
}
|
|
104
|
+
},
|
|
97
105
|
methods: {
|
|
98
106
|
getParams () {
|
|
99
107
|
return this.showPage ? {
|
|
@@ -171,6 +179,12 @@ export default {
|
|
|
171
179
|
}
|
|
172
180
|
}
|
|
173
181
|
},
|
|
182
|
+
updateStatus () {
|
|
183
|
+
const isAllChecked = this.selection.length > 0 && this.selection.length === this.itemList.length
|
|
184
|
+
const isAllIndeterminate = this.selection.length > 0 && this.selection.length < this.itemList.length
|
|
185
|
+
this.$emit('update:isAllChecked', isAllChecked)
|
|
186
|
+
this.$emit('update:isAllIndeterminate', isAllIndeterminate)
|
|
187
|
+
},
|
|
174
188
|
updateChecked () {
|
|
175
189
|
let rest = null
|
|
176
190
|
this.updateModel = true
|
|
@@ -182,6 +196,7 @@ export default {
|
|
|
182
196
|
this.$emit('update:checked', rest)
|
|
183
197
|
}
|
|
184
198
|
this.$emit('change', { checked: rest })
|
|
199
|
+
this.updateStatus()
|
|
185
200
|
},
|
|
186
201
|
toggleCheckboxRow (label) {
|
|
187
202
|
const index = this.selection.indexOf(label)
|
|
@@ -227,8 +242,10 @@ export default {
|
|
|
227
242
|
const { value: label } = params
|
|
228
243
|
if (this.type === 'checkbox') {
|
|
229
244
|
this.toggleCheckboxRow(label)
|
|
245
|
+
this.$emit('checkbox-change', {})
|
|
230
246
|
} else if (this.type === 'radio') {
|
|
231
247
|
this.setRadioRow(label)
|
|
248
|
+
this.$emit('radio-change', {})
|
|
232
249
|
}
|
|
233
250
|
}
|
|
234
251
|
}
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
</template>
|
|
22
22
|
|
|
23
23
|
<script>
|
|
24
|
+
import XEUtils from 'xe-utils'
|
|
25
|
+
|
|
24
26
|
export default {
|
|
25
27
|
name: 'MlListItem',
|
|
26
28
|
options: {
|
|
@@ -54,6 +56,11 @@ export default {
|
|
|
54
56
|
default: null
|
|
55
57
|
}
|
|
56
58
|
},
|
|
59
|
+
data () {
|
|
60
|
+
return {
|
|
61
|
+
mId: XEUtils.uniqueId('mlListItem')
|
|
62
|
+
}
|
|
63
|
+
},
|
|
57
64
|
computed: {
|
|
58
65
|
styles () {
|
|
59
66
|
const cr = this.color ? `color:${this.color};` : ''
|
|
@@ -79,6 +86,21 @@ export default {
|
|
|
79
86
|
return this.listGroup ? this.listGroup.type : ''
|
|
80
87
|
}
|
|
81
88
|
},
|
|
89
|
+
mounted () {
|
|
90
|
+
this.$nextTick(() => {
|
|
91
|
+
if (this.listGroup) {
|
|
92
|
+
this.listGroup.itemList.push({
|
|
93
|
+
mId: this.mId,
|
|
94
|
+
value: this.value,
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
},
|
|
99
|
+
beforeDestroy () {
|
|
100
|
+
if (this.listGroup) {
|
|
101
|
+
XEUtils.remove(this.listGroup.itemList, item => item.mId === this.mId)
|
|
102
|
+
}
|
|
103
|
+
},
|
|
82
104
|
methods: {
|
|
83
105
|
clickEvent () {
|
|
84
106
|
this.$emit('click', {})
|
|
@@ -25,6 +25,8 @@ export default {
|
|
|
25
25
|
type: [Array, Boolean, Number, String],
|
|
26
26
|
default: null
|
|
27
27
|
},
|
|
28
|
+
isAllChecked: Boolean,
|
|
29
|
+
isAllIndeterminate: Boolean,
|
|
28
30
|
type: String,
|
|
29
31
|
vertical: Boolean,
|
|
30
32
|
prefixIcon: String,
|
|
@@ -34,6 +36,7 @@ export default {
|
|
|
34
36
|
data () {
|
|
35
37
|
return {
|
|
36
38
|
selectValue: null,
|
|
39
|
+
itemList: [],
|
|
37
40
|
selection: []
|
|
38
41
|
}
|
|
39
42
|
},
|
|
@@ -65,7 +68,18 @@ export default {
|
|
|
65
68
|
}
|
|
66
69
|
}
|
|
67
70
|
},
|
|
71
|
+
mounted () {
|
|
72
|
+
if (this.type === 'checkbox') {
|
|
73
|
+
setTimeout(() => this.updateStatus(), 10)
|
|
74
|
+
}
|
|
75
|
+
},
|
|
68
76
|
methods: {
|
|
77
|
+
updateStatus () {
|
|
78
|
+
const isAllChecked = this.selection.length > 0 && this.selection.length === this.itemList.length
|
|
79
|
+
const isAllIndeterminate = this.selection.length > 0 && this.selection.length < this.itemList.length
|
|
80
|
+
this.$emit('update:isAllChecked', isAllChecked)
|
|
81
|
+
this.$emit('update:isAllIndeterminate', isAllIndeterminate)
|
|
82
|
+
},
|
|
69
83
|
updateChecked () {
|
|
70
84
|
let rest = null
|
|
71
85
|
this.updateModel = true
|
|
@@ -77,6 +91,7 @@ export default {
|
|
|
77
91
|
this.$emit('update:checked', rest)
|
|
78
92
|
}
|
|
79
93
|
this.$emit('change', { checked: rest })
|
|
94
|
+
this.updateStatus()
|
|
80
95
|
},
|
|
81
96
|
toggleCheckboxRow (label) {
|
|
82
97
|
const index = this.selection.indexOf(label)
|
|
@@ -122,8 +137,10 @@ export default {
|
|
|
122
137
|
const { value: label } = params
|
|
123
138
|
if (this.type === 'checkbox') {
|
|
124
139
|
this.toggleCheckboxRow(label)
|
|
140
|
+
this.$emit('checkbox-change', {})
|
|
125
141
|
} else if (this.type === 'radio') {
|
|
126
142
|
this.setRadioRow(label)
|
|
143
|
+
this.$emit('radio-change', {})
|
|
127
144
|
}
|
|
128
145
|
}
|
|
129
146
|
}
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
</template>
|
|
25
25
|
|
|
26
26
|
<script>
|
|
27
|
+
import XEUtils from 'xe-utils'
|
|
28
|
+
|
|
27
29
|
export default {
|
|
28
30
|
name: 'MlListMenuItem',
|
|
29
31
|
options: {
|
|
@@ -55,6 +57,11 @@ export default {
|
|
|
55
57
|
default: null
|
|
56
58
|
}
|
|
57
59
|
},
|
|
60
|
+
data () {
|
|
61
|
+
return {
|
|
62
|
+
mId: XEUtils.uniqueId('mlListMenuItem')
|
|
63
|
+
}
|
|
64
|
+
},
|
|
58
65
|
computed: {
|
|
59
66
|
hasCheckedChecked () {
|
|
60
67
|
return this.selection.includes(this.value)
|
|
@@ -75,6 +82,21 @@ export default {
|
|
|
75
82
|
return this.listMenuGroup ? this.listMenuGroup.type : ''
|
|
76
83
|
}
|
|
77
84
|
},
|
|
85
|
+
mounted () {
|
|
86
|
+
this.$nextTick(() => {
|
|
87
|
+
if (this.listGroup) {
|
|
88
|
+
this.listGroup.itemList.push({
|
|
89
|
+
mId: this.mId,
|
|
90
|
+
value: this.value,
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
},
|
|
95
|
+
beforeDestroy () {
|
|
96
|
+
if (this.listGroup) {
|
|
97
|
+
XEUtils.remove(this.listGroup.itemList, item => item.mId === this.mId)
|
|
98
|
+
}
|
|
99
|
+
},
|
|
78
100
|
methods: {
|
|
79
101
|
getDotNum (num) {
|
|
80
102
|
return num > 99 ? '99+' : num
|