mali-applet-ui 1.0.92 → 1.0.94
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,19 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="ml-list-select-user-page" :class="[className || '', {'is-border': border, 'is-disabled': disabled}]" @tap="tapEvent">
|
|
3
|
-
<view
|
|
4
|
-
<view class="ml-list-select-user-
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<view
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<ml-icon name="close" />
|
|
3
|
+
<view class="ml-list-select-user-list">
|
|
4
|
+
<view v-for="(item, index) in selectRows" :key="index" class="ml-list-select-user-item">
|
|
5
|
+
<view class="ml-list-select-user-name">
|
|
6
|
+
<view class="ml-list-select-user-content">{{ item[optLabelField] }}</view>
|
|
7
|
+
</view>
|
|
8
|
+
<view v-if="clearable" class="ml-list-select-user-del-item" @click="removeItem(item)">
|
|
9
|
+
<ml-icon name="close" />
|
|
10
|
+
</view>
|
|
12
11
|
</view>
|
|
13
12
|
</view>
|
|
14
13
|
<view class="ml-list-select-user-add-item" @click="openUserEvent">
|
|
15
14
|
<view class="ml-list-select-user-add-btn">
|
|
16
|
-
<ml-icon name="add" />
|
|
15
|
+
<ml-icon name="add-circle" />
|
|
17
16
|
</view>
|
|
18
17
|
</view>
|
|
19
18
|
</view>
|
|
@@ -67,11 +66,21 @@ export default {
|
|
|
67
66
|
return XEUtils.eqNull(this.value) || this.value === ''
|
|
68
67
|
},
|
|
69
68
|
selectRows () {
|
|
70
|
-
|
|
69
|
+
if (this.type === 'checkbox') {
|
|
70
|
+
return this.dataList.filter(item => this.value.includes(item[this.optValueField]))
|
|
71
|
+
}
|
|
72
|
+
return this.dataList.filter(item => this.value === item[this.optValueField])
|
|
71
73
|
}
|
|
72
74
|
},
|
|
73
75
|
methods: {
|
|
74
76
|
tapEvent () {
|
|
77
|
+
if (this.disabled) {
|
|
78
|
+
return
|
|
79
|
+
}
|
|
80
|
+
this.$emit('tap', {})
|
|
81
|
+
this.$emit('click', {})
|
|
82
|
+
},
|
|
83
|
+
openUserEvent () {
|
|
75
84
|
if (this.disabled) {
|
|
76
85
|
return
|
|
77
86
|
}
|
|
@@ -95,8 +104,14 @@ export default {
|
|
|
95
104
|
}
|
|
96
105
|
}
|
|
97
106
|
})
|
|
98
|
-
|
|
99
|
-
|
|
107
|
+
},
|
|
108
|
+
removeItem (item) {
|
|
109
|
+
let value = null
|
|
110
|
+
if (this.type === 'checkbox') {
|
|
111
|
+
value = this.value.filter(key => key !== item[this.optValueField])
|
|
112
|
+
}
|
|
113
|
+
this.$emit('input', value)
|
|
114
|
+
this.$emit('change', { value })
|
|
100
115
|
},
|
|
101
116
|
clearEvent () {
|
|
102
117
|
let value = null
|
|
@@ -115,13 +130,26 @@ export default {
|
|
|
115
130
|
display: flex;
|
|
116
131
|
flex-direction: row;
|
|
117
132
|
flex-wrap: wrap;
|
|
118
|
-
.ml-list-select-user-
|
|
133
|
+
.ml-list-select-user-list {
|
|
134
|
+
display: flex;
|
|
135
|
+
flex-direction: row;
|
|
136
|
+
flex-wrap: wrap;
|
|
137
|
+
min-height: 76rpx;
|
|
138
|
+
}
|
|
139
|
+
.ml-list-select-user-item {
|
|
140
|
+
display: flex;
|
|
141
|
+
flex-direction: row;
|
|
142
|
+
align-items: center;
|
|
143
|
+
margin: 8rpx;
|
|
144
|
+
padding: 8rpx 16rpx;
|
|
145
|
+
border-radius: $ml-page-interval-margin;
|
|
146
|
+
background: #F2F2F6;
|
|
147
|
+
}
|
|
119
148
|
.ml-list-select-user-add-item {
|
|
120
|
-
position:
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
text-align: center;
|
|
149
|
+
position: absolute;
|
|
150
|
+
top: -74rpx;
|
|
151
|
+
right: 20rpx;
|
|
152
|
+
font-size: 44rpx;
|
|
125
153
|
}
|
|
126
154
|
.ml-list-select-user-img {
|
|
127
155
|
width: 50rpx;
|
|
@@ -130,32 +158,17 @@ export default {
|
|
|
130
158
|
overflow: hidden;
|
|
131
159
|
}
|
|
132
160
|
.ml-list-select-user-name {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
height: 80rpx;
|
|
141
|
-
line-height: 80rpx;
|
|
142
|
-
text-align: center;
|
|
143
|
-
color: $uni-color-primary;
|
|
144
|
-
background: #DAE6FF;
|
|
145
|
-
border-radius: 50%;
|
|
146
|
-
font-size: 56rpx;
|
|
161
|
+
.ml-list-select-user-content {
|
|
162
|
+
font-size: 28rpx;
|
|
163
|
+
max-width: 140rpx;
|
|
164
|
+
overflow: hidden;
|
|
165
|
+
text-overflow: ellipsis;
|
|
166
|
+
white-space: nowrap;
|
|
167
|
+
}
|
|
147
168
|
}
|
|
148
169
|
.ml-list-select-user-del-item {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
right: 0;
|
|
152
|
-
color: #fff;
|
|
153
|
-
width: 40rpx;
|
|
154
|
-
height: 40rpx;
|
|
155
|
-
line-height: 40rpx;
|
|
156
|
-
font-size: 30rpx;
|
|
157
|
-
border-radius: 50%;
|
|
158
|
-
background: rgba(0, 0, 0, 0.45);
|
|
170
|
+
flex-shrink: 0;
|
|
171
|
+
margin-left: 16rpx;
|
|
159
172
|
}
|
|
160
173
|
}
|
|
161
174
|
</style>
|
|
@@ -29,7 +29,14 @@ export default {
|
|
|
29
29
|
// 复选框
|
|
30
30
|
showCheckbox: Boolean,
|
|
31
31
|
// (复选框)父子不关联
|
|
32
|
-
checkStrictly:
|
|
32
|
+
checkStrictly: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false
|
|
35
|
+
},
|
|
36
|
+
indeterminateToChecked: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: false
|
|
39
|
+
},
|
|
33
40
|
checkRowKeys: Array,
|
|
34
41
|
halfRowKeys: Array,
|
|
35
42
|
nodeProps: Object
|
|
@@ -84,6 +91,7 @@ export default {
|
|
|
84
91
|
},
|
|
85
92
|
created () {
|
|
86
93
|
this.treeData = this.data
|
|
94
|
+
this.initCheckboxRows(this.checkRowKeys)
|
|
87
95
|
},
|
|
88
96
|
methods: {
|
|
89
97
|
selectCheckboxNodeEvent ({ nodeData, nodeKey }) {
|
|
@@ -186,7 +194,7 @@ export default {
|
|
|
186
194
|
updateCheckStatus () {
|
|
187
195
|
const { keyField } = this
|
|
188
196
|
this.isAllCheckboxChecked = this.treeData.every(item => this.selectCheckboxRowKeys.includes(item[keyField]))
|
|
189
|
-
this.isAllCheckboxIndeterminate = !this.isAllCheckboxChecked && this.treeData.some(item => this.selectCheckboxRowKeys.includes(item[keyField]))
|
|
197
|
+
this.isAllCheckboxIndeterminate = !this.isAllCheckboxChecked && this.treeData.some(item => this.selectCheckboxRowKeys.includes(item[keyField]) || this.indeterminateRowKeys.includes(item[keyField]))
|
|
190
198
|
},
|
|
191
199
|
initCheckboxRows (selecKeys) {
|
|
192
200
|
this.selectCheckboxRowKeys = []
|
|
@@ -258,6 +266,7 @@ export default {
|
|
|
258
266
|
.ml-tree {
|
|
259
267
|
padding-left: 16rpx;
|
|
260
268
|
overflow: auto;
|
|
269
|
+
background: #ffffff;
|
|
261
270
|
.ml-tree-checkbox-btns {
|
|
262
271
|
position: sticky;
|
|
263
272
|
left: 0;
|
|
@@ -267,7 +276,6 @@ export default {
|
|
|
267
276
|
align-items: center;
|
|
268
277
|
height: 80rpx;
|
|
269
278
|
border-bottom: 1px solid #e5e5e5;
|
|
270
|
-
background: #ffffff;
|
|
271
279
|
}
|
|
272
280
|
.ml-tree-checkbox-btns-left {
|
|
273
281
|
flex-grow: 1;
|