mali-applet-ui 1.0.67 → 1.0.68
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.
|
@@ -42,7 +42,10 @@ export default {
|
|
|
42
42
|
align: String,
|
|
43
43
|
required: Boolean,
|
|
44
44
|
titleAlign: String,
|
|
45
|
-
vertical:
|
|
45
|
+
vertical: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: null
|
|
48
|
+
},
|
|
46
49
|
visible: {
|
|
47
50
|
type: Boolean,
|
|
48
51
|
default: true
|
|
@@ -135,10 +138,10 @@ export default {
|
|
|
135
138
|
return this.form ? this.form.titleAlign : ''
|
|
136
139
|
},
|
|
137
140
|
itemVertical () {
|
|
138
|
-
if (this.vertical) {
|
|
139
|
-
return
|
|
141
|
+
if (this.vertical === null) {
|
|
142
|
+
return this.form ? this.form.vertical : false
|
|
140
143
|
}
|
|
141
|
-
return this.
|
|
144
|
+
return !!this.vertical
|
|
142
145
|
},
|
|
143
146
|
itemLabelWidth () {
|
|
144
147
|
let labelWidth = this.labelWidth
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<view class="ml-switch" :style="styles">
|
|
3
|
+
<view v-if="openLabel && closeLabel" class="ml-switch-warpper" @tap="toggleEvent">
|
|
4
|
+
<view class="ml-switch-btn" :class="{'is-active': checked}">{{ openLabel }}</view>
|
|
5
|
+
<view class="ml-switch-btn" :class="{'is-active': !checked}">{{ closeLabel }}</view>
|
|
6
|
+
</view>
|
|
7
|
+
<switch v-else class="ml-switch-native" :class="className" :checked="checked" :color="color" @change="changeEvent"></switch>
|
|
8
|
+
</view>
|
|
3
9
|
</template>
|
|
4
10
|
|
|
5
11
|
<script>
|
|
@@ -9,16 +15,41 @@ export default {
|
|
|
9
15
|
virtualHost: true
|
|
10
16
|
},
|
|
11
17
|
props: {
|
|
12
|
-
value: Boolean,
|
|
18
|
+
value: [String, Number, Boolean],
|
|
13
19
|
color: {
|
|
14
20
|
type: String,
|
|
15
21
|
default: '#007aff'
|
|
16
22
|
},
|
|
23
|
+
width: String,
|
|
24
|
+
openLabel: String,
|
|
25
|
+
closeLabel: String,
|
|
26
|
+
openValue: {
|
|
27
|
+
type: [String, Number, Boolean],
|
|
28
|
+
default: true
|
|
29
|
+
},
|
|
30
|
+
closeValue: {
|
|
31
|
+
type: [String, Number, Boolean],
|
|
32
|
+
default: false
|
|
33
|
+
},
|
|
17
34
|
className: String
|
|
18
35
|
},
|
|
36
|
+
computed: {
|
|
37
|
+
styles () {
|
|
38
|
+
const wSys = this.width ? `width: ${this.width};` : ''
|
|
39
|
+
return `${wSys}`
|
|
40
|
+
},
|
|
41
|
+
checked () {
|
|
42
|
+
return this.value === this.openValue
|
|
43
|
+
}
|
|
44
|
+
},
|
|
19
45
|
methods: {
|
|
20
46
|
changeEvent (e) {
|
|
21
|
-
const value = e.detail.value
|
|
47
|
+
const value = e.detail.value ? this.openValue : this.closeValue
|
|
48
|
+
this.$emit('input', value)
|
|
49
|
+
this.$emit('change', { value })
|
|
50
|
+
},
|
|
51
|
+
toggleEvent () {
|
|
52
|
+
const value = this.checked ? this.closeValue : this.openValue
|
|
22
53
|
this.$emit('input', value)
|
|
23
54
|
this.$emit('change', { value })
|
|
24
55
|
}
|
|
@@ -28,6 +59,28 @@ export default {
|
|
|
28
59
|
|
|
29
60
|
<style lang="scss">
|
|
30
61
|
.ml-switch {
|
|
31
|
-
|
|
62
|
+
display: inline-flex;
|
|
63
|
+
.ml-switch-native {
|
|
64
|
+
transform: scale(0.8);
|
|
65
|
+
}
|
|
66
|
+
.ml-switch-warpper {
|
|
67
|
+
display: inline-flex;
|
|
68
|
+
flex-direction: row;
|
|
69
|
+
padding: 8rpx;
|
|
70
|
+
border-radius: $ml-border-radius;
|
|
71
|
+
background: #e5e6e8;
|
|
72
|
+
.ml-switch-btn {
|
|
73
|
+
flex-grow: 1;
|
|
74
|
+
padding: 0 24rpx;
|
|
75
|
+
height: 44rpx;
|
|
76
|
+
line-height: 44rpx;
|
|
77
|
+
font-size: $ml-describe-font-size;
|
|
78
|
+
transition: all 0.3s;
|
|
79
|
+
&.is-active {
|
|
80
|
+
background: #ffffff;
|
|
81
|
+
border-radius: $ml-border-radius;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
32
85
|
}
|
|
33
|
-
</style>
|
|
86
|
+
</style>
|
|
@@ -20,13 +20,18 @@ export default {
|
|
|
20
20
|
props: {
|
|
21
21
|
data: Array,
|
|
22
22
|
height: String,
|
|
23
|
-
|
|
24
|
-
showRadio: Boolean,
|
|
25
|
-
showCheckbox: Boolean,
|
|
23
|
+
// 是否显示顶部全选按钮
|
|
26
24
|
showAllCheckbox: Boolean,
|
|
27
|
-
|
|
25
|
+
// 是是否显示顶部操作按钮
|
|
28
26
|
showCheckboxBtn: Boolean,
|
|
27
|
+
// 单选框
|
|
28
|
+
showRadio: Boolean,
|
|
29
|
+
// 复选框
|
|
30
|
+
showCheckbox: Boolean,
|
|
31
|
+
// (复选框)父子不关联
|
|
32
|
+
checkStrictly: Boolean,
|
|
29
33
|
checkRowKeys: Array,
|
|
34
|
+
halfRowKeys: Array,
|
|
30
35
|
nodeProps: Object
|
|
31
36
|
},
|
|
32
37
|
provide () {
|
|
@@ -72,8 +77,7 @@ export default {
|
|
|
72
77
|
},
|
|
73
78
|
checkRowKeys (value) {
|
|
74
79
|
if (!this.isCheckboxModelUpdate) {
|
|
75
|
-
this.
|
|
76
|
-
this.setCheckboxRow(value, true)
|
|
80
|
+
this.initCheckboxRows(value)
|
|
77
81
|
}
|
|
78
82
|
this.isCheckboxModelUpdate = false
|
|
79
83
|
}
|
|
@@ -135,6 +139,7 @@ export default {
|
|
|
135
139
|
this.isCheckboxModelUpdate = true
|
|
136
140
|
this.$emit('checkbox-change', { row: nodeData, checked, checkedKeys: this.selectCheckboxRowKeys })
|
|
137
141
|
this.$emit('update:checkRowKeys', [...this.selectCheckboxRowKeys])
|
|
142
|
+
this.$emit('update:halfRowKeys', [...this.indeterminateRowKeys])
|
|
138
143
|
},
|
|
139
144
|
expandNodeEvent ({ nodeData, nodeKey }) {
|
|
140
145
|
const nodeIndex = this.expandRowKeys.indexOf(nodeKey)
|
|
@@ -183,6 +188,17 @@ export default {
|
|
|
183
188
|
this.isAllCheckboxChecked = this.treeData.every(item => this.selectCheckboxRowKeys.includes(item[keyField]))
|
|
184
189
|
this.isAllCheckboxIndeterminate = !this.isAllCheckboxChecked && this.treeData.some(item => this.selectCheckboxRowKeys.includes(item[keyField]))
|
|
185
190
|
},
|
|
191
|
+
initCheckboxRows (selecKeys) {
|
|
192
|
+
this.selectCheckboxRowKeys = []
|
|
193
|
+
this.indeterminateRowKeys = []
|
|
194
|
+
selecKeys.forEach(nodeKey => {
|
|
195
|
+
if (!this.selectCheckboxRowKeys.includes(nodeKey)) {
|
|
196
|
+
this.selectCheckboxRowKeys.push(nodeKey)
|
|
197
|
+
}
|
|
198
|
+
})
|
|
199
|
+
// 更新全部节点半选状态
|
|
200
|
+
this.updateCheckStatus()
|
|
201
|
+
},
|
|
186
202
|
setCheckboxRow (key, checked) {
|
|
187
203
|
let keys = key
|
|
188
204
|
if (!XEUtils.isArray(key)) {
|
|
@@ -209,6 +225,7 @@ export default {
|
|
|
209
225
|
this.isCheckboxModelUpdate = true
|
|
210
226
|
this.$emit('checkbox-all', { checkedKeys: this.selectCheckboxRowKeys, checkedRows: [] })
|
|
211
227
|
this.$emit('update:checkRowKeys', [...this.selectCheckboxRowKeys])
|
|
228
|
+
this.$emit('update:halfRowKeys', [...this.indeterminateRowKeys])
|
|
212
229
|
},
|
|
213
230
|
toggleAllCheckboxRow () {
|
|
214
231
|
const { keyField, childrenField } = this
|