xianniu-ui 0.8.6 → 0.8.7
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 +145 -41
- package/lib/xianniu-ui.umd.js +145 -41
- package/lib/xianniu-ui.umd.min.js +9 -9
- package/package.json +1 -1
- package/packages/table/main.vue +71 -17
- package/src/oss/index.js +0 -1
package/package.json
CHANGED
package/packages/table/main.vue
CHANGED
|
@@ -79,6 +79,7 @@
|
|
|
79
79
|
type="selection"
|
|
80
80
|
width="50px"
|
|
81
81
|
align="center"
|
|
82
|
+
:selectable="handleSelectable"
|
|
82
83
|
></el-table-column>
|
|
83
84
|
<el-table-column v-bind="$attrs" v-if="radio" width="40px" align="center">
|
|
84
85
|
<template slot-scope="{ row }">
|
|
@@ -94,15 +95,15 @@
|
|
|
94
95
|
type="index"
|
|
95
96
|
></el-table-column>
|
|
96
97
|
<slot>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
<column
|
|
99
|
+
v-for="(item, idx) in columns"
|
|
100
|
+
:key="idx"
|
|
101
|
+
v-show="item.checked === true"
|
|
102
|
+
v-bind="item"
|
|
103
|
+
></column>
|
|
103
104
|
</slot>
|
|
104
105
|
<template #append v-if="$slots.append">
|
|
105
|
-
|
|
106
|
+
<slot name="append"></slot>
|
|
106
107
|
</template>
|
|
107
108
|
</el-table>
|
|
108
109
|
|
|
@@ -162,6 +163,26 @@ export default {
|
|
|
162
163
|
type: String,
|
|
163
164
|
default: "id",
|
|
164
165
|
},
|
|
166
|
+
disabledList: {
|
|
167
|
+
type: Array,
|
|
168
|
+
require: false,
|
|
169
|
+
default: () => {
|
|
170
|
+
return [];
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
disabledKey: {
|
|
174
|
+
type: String,
|
|
175
|
+
require: false,
|
|
176
|
+
default: "",
|
|
177
|
+
},
|
|
178
|
+
/* 筛选条件,正则 */
|
|
179
|
+
filterQuery: {
|
|
180
|
+
type: Object,
|
|
181
|
+
require: false,
|
|
182
|
+
default: () => {
|
|
183
|
+
return {};
|
|
184
|
+
},
|
|
185
|
+
},
|
|
165
186
|
},
|
|
166
187
|
data() {
|
|
167
188
|
return {
|
|
@@ -169,17 +190,13 @@ export default {
|
|
|
169
190
|
selectedData: [],
|
|
170
191
|
};
|
|
171
192
|
},
|
|
172
|
-
computed: {
|
|
173
|
-
|
|
174
|
-
},
|
|
175
|
-
created() {
|
|
176
|
-
|
|
177
|
-
},
|
|
193
|
+
computed: {},
|
|
194
|
+
created() {},
|
|
178
195
|
updated() {
|
|
179
196
|
!this.$slots.default &&
|
|
180
197
|
this.columns.length &&
|
|
181
198
|
this.columns.forEach((item) => {
|
|
182
|
-
if(item.checked !== true) this.$set(item, "checked", true);
|
|
199
|
+
if (item.checked !== true) this.$set(item, "checked", true);
|
|
183
200
|
});
|
|
184
201
|
},
|
|
185
202
|
methods: {
|
|
@@ -222,9 +239,46 @@ export default {
|
|
|
222
239
|
tableRowClassName({ row, rowIndex }) {
|
|
223
240
|
row.rowIndex = rowIndex;
|
|
224
241
|
},
|
|
225
|
-
headerRowClassName(){
|
|
226
|
-
return
|
|
227
|
-
}
|
|
242
|
+
headerRowClassName() {
|
|
243
|
+
return "cus-table-header";
|
|
244
|
+
},
|
|
245
|
+
handleSelectable(row, idx) {
|
|
246
|
+
if (
|
|
247
|
+
this.selection &&
|
|
248
|
+
this.$attrs.selectable &&
|
|
249
|
+
typeof this.$attrs.selectable === "function"
|
|
250
|
+
) {
|
|
251
|
+
return this.$attrs.selectable(row, idx);
|
|
252
|
+
}
|
|
253
|
+
const list = this.disabledList;
|
|
254
|
+
const filter = this.filterQuery;
|
|
255
|
+
if (
|
|
256
|
+
list &&
|
|
257
|
+
list.length &&
|
|
258
|
+
this.disabledKey &&
|
|
259
|
+
list.includes(row[this.disabledKey])
|
|
260
|
+
) {
|
|
261
|
+
return 0;
|
|
262
|
+
} else if (Object.keys(filter).length) {
|
|
263
|
+
let step = 0;
|
|
264
|
+
Object.keys(filter).forEach((key) => {
|
|
265
|
+
if (filter[key].test(row[key])) {
|
|
266
|
+
step = step + 1;
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
if (step >= Object.keys(filter).length) {
|
|
271
|
+
/* if (isChange) {
|
|
272
|
+
this.key = Date.parse(new Date());
|
|
273
|
+
} */
|
|
274
|
+
return 1;
|
|
275
|
+
} else {
|
|
276
|
+
return 0;
|
|
277
|
+
}
|
|
278
|
+
} else {
|
|
279
|
+
return 1;
|
|
280
|
+
}
|
|
281
|
+
},
|
|
228
282
|
},
|
|
229
283
|
};
|
|
230
284
|
</script>
|