xianniu-ui 0.8.7 → 0.8.9
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/lib/xianniu-ui.common.js +43 -33
- package/lib/xianniu-ui.umd.js +43 -33
- package/lib/xianniu-ui.umd.min.js +2 -2
- package/package.json +1 -1
- package/packages/table/main.vue +20 -9
package/package.json
CHANGED
package/packages/table/main.vue
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
<div class="xn-table-box">
|
|
3
3
|
<div class="xn-table-box-tools" :class="{ 'is-border': !border }">
|
|
4
4
|
<div class="flex justify-content-between align-items-center">
|
|
5
|
-
<div class="fz-12" :class="{ 'pb-10':
|
|
6
|
-
<template v-if="
|
|
5
|
+
<div class="fz-12" :class="{ 'pb-10': isSelection }">
|
|
6
|
+
<template v-if="isSelection">
|
|
7
7
|
<span>已选择 {{ selectedData.length }} 项</span>
|
|
8
8
|
<el-button
|
|
9
9
|
type="text"
|
|
@@ -71,17 +71,17 @@
|
|
|
71
71
|
@row-click="singleElection"
|
|
72
72
|
@selection-change="selectionChange"
|
|
73
73
|
:row-class-name="tableRowClassName"
|
|
74
|
-
:class="{ 'disabled-all-selection':
|
|
74
|
+
:class="{ 'disabled-all-selection': isRadio }"
|
|
75
75
|
>
|
|
76
76
|
<el-table-column
|
|
77
|
-
v-if="
|
|
77
|
+
v-if="isSelection && data.length"
|
|
78
78
|
v-bind="$attrs"
|
|
79
79
|
type="selection"
|
|
80
80
|
width="50px"
|
|
81
81
|
align="center"
|
|
82
82
|
:selectable="handleSelectable"
|
|
83
83
|
></el-table-column>
|
|
84
|
-
<el-table-column v-bind="$attrs" v-if="
|
|
84
|
+
<el-table-column v-bind="$attrs" v-if="isRadio" width="40px" align="center">
|
|
85
85
|
<template slot-scope="{ row }">
|
|
86
86
|
<el-radio v-model="radioSelected" :label="row[idKey]"
|
|
87
87
|
> </el-radio
|
|
@@ -142,6 +142,10 @@ export default {
|
|
|
142
142
|
type: Array,
|
|
143
143
|
default: () => [],
|
|
144
144
|
},
|
|
145
|
+
type:{
|
|
146
|
+
type: String,
|
|
147
|
+
default:'',
|
|
148
|
+
},
|
|
145
149
|
stripe: Boolean,
|
|
146
150
|
selection: Boolean,
|
|
147
151
|
radio: Boolean,
|
|
@@ -190,7 +194,14 @@ export default {
|
|
|
190
194
|
selectedData: [],
|
|
191
195
|
};
|
|
192
196
|
},
|
|
193
|
-
computed: {
|
|
197
|
+
computed: {
|
|
198
|
+
isSelection(){
|
|
199
|
+
return this.type === 'selection' || this.selection
|
|
200
|
+
},
|
|
201
|
+
isRadio(){
|
|
202
|
+
return this.type === 'radio' || this.radio
|
|
203
|
+
}
|
|
204
|
+
},
|
|
194
205
|
created() {},
|
|
195
206
|
updated() {
|
|
196
207
|
!this.$slots.default &&
|
|
@@ -204,7 +215,7 @@ export default {
|
|
|
204
215
|
this.$emit("on-page", val);
|
|
205
216
|
},
|
|
206
217
|
singleElection(val, column) {
|
|
207
|
-
if (!this.
|
|
218
|
+
if (!this.isRadio) return;
|
|
208
219
|
const { idKey } = this;
|
|
209
220
|
this.radioSelected = val[idKey];
|
|
210
221
|
const res = this.data.find(
|
|
@@ -227,7 +238,7 @@ export default {
|
|
|
227
238
|
this.$refs.table.toggleRowSelection(row, status);
|
|
228
239
|
},
|
|
229
240
|
clearSelection() {
|
|
230
|
-
if (this.
|
|
241
|
+
if (this.isRadio) {
|
|
231
242
|
this.radioSelected = "";
|
|
232
243
|
return;
|
|
233
244
|
}
|
|
@@ -244,7 +255,7 @@ export default {
|
|
|
244
255
|
},
|
|
245
256
|
handleSelectable(row, idx) {
|
|
246
257
|
if (
|
|
247
|
-
this.
|
|
258
|
+
this.isSelection &&
|
|
248
259
|
this.$attrs.selectable &&
|
|
249
260
|
typeof this.$attrs.selectable === "function"
|
|
250
261
|
) {
|