xianniu-ui 0.8.5 → 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 +161 -44
- package/lib/xianniu-ui.umd.js +161 -44
- package/lib/xianniu-ui.umd.min.js +7 -7
- package/package.json +1 -1
- package/packages/table/main.vue +73 -18
- package/src/oss/index.js +0 -1
- package/src/utils/dayjs.js +1 -0
- package/src/utils/reg.js +4 -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: {
|
|
@@ -194,6 +211,7 @@ export default {
|
|
|
194
211
|
(item, idx) => item[idKey] === val[idKey] && idx === val.rowIndex
|
|
195
212
|
);
|
|
196
213
|
this.$emit("on-single", res, column);
|
|
214
|
+
this.$emit("on-radio", res, column);
|
|
197
215
|
},
|
|
198
216
|
handleToolsItem(row, index) {
|
|
199
217
|
this.$emit("on-tools", { row, index });
|
|
@@ -202,6 +220,7 @@ export default {
|
|
|
202
220
|
selectionChange(val) {
|
|
203
221
|
this.selectedData = val;
|
|
204
222
|
this.$emit("selection-change", val);
|
|
223
|
+
this.$emit("on-selection", val);
|
|
205
224
|
// this.$refs.table.get
|
|
206
225
|
},
|
|
207
226
|
toggleRowSelection(row, status) {
|
|
@@ -220,10 +239,46 @@ export default {
|
|
|
220
239
|
tableRowClassName({ row, rowIndex }) {
|
|
221
240
|
row.rowIndex = rowIndex;
|
|
222
241
|
},
|
|
223
|
-
headerRowClassName(
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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
|
+
},
|
|
227
282
|
},
|
|
228
283
|
};
|
|
229
284
|
</script>
|
package/src/oss/index.js
CHANGED
package/src/utils/dayjs.js
CHANGED
package/src/utils/reg.js
CHANGED
|
@@ -9,7 +9,10 @@ const Reg = {
|
|
|
9
9
|
positiveInteger: /^[1-9]\d*$/, // 正整数
|
|
10
10
|
twoDecimal: /(^[0-9]{1,20}$)|(^[0-9]{1,20}[.][0-9]{1,2}$)/, // 2位小数
|
|
11
11
|
text: /^[a-z\d\u4E00-\u9FA5]+$/i, // 不含特殊字符和标点
|
|
12
|
-
getCity: /.+?(省|市|自治区|自治州|县|区)/g //获取地址中的省市区[省,市,区]
|
|
12
|
+
getCity: /.+?(省|市|自治区|自治州|县|区)/g, //获取地址中的省市区[省,市,区]
|
|
13
|
+
Tel: /^[0-9-]{7,18}$/, // 座机号
|
|
14
|
+
telAndPhone: /^[0-9-]{7,18}$/ || /^[0-9]{7,18}$/ || /^1\d{10}$/, // 校验手机号、座机号 010-88888888 01088888888
|
|
15
|
+
oneDecimal: /(^[0-9]{1,20}$)|(^[0-9]{1,20}[.][0-9]{1}$)/ // 1位小数
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
export default Reg
|