@tripup-company/element-ui-extended 0.0.103 → 0.0.104
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/dist/element-ui-extended.common.js +25 -13
- package/dist/element-ui-extended.common.js.map +1 -1
- package/dist/element-ui-extended.umd.js +25 -13
- package/dist/element-ui-extended.umd.js.map +1 -1
- package/dist/element-ui-extended.umd.min.js +1 -1
- package/dist/element-ui-extended.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/CompositeTable/index.vue +6 -1
- package/src/components/GenericTable/index.vue +42 -32
package/package.json
CHANGED
|
@@ -32,10 +32,11 @@
|
|
|
32
32
|
@reset:filter="handleResetTopFilter"
|
|
33
33
|
/>
|
|
34
34
|
</slot>
|
|
35
|
-
<slot name="table" v-bind="{ fields, data }">
|
|
35
|
+
<slot name="table" v-bind="{ fields, data, rowClassName }">
|
|
36
36
|
<generic-table
|
|
37
37
|
:fields="fields"
|
|
38
38
|
:data="data"
|
|
39
|
+
:row-class-name="rowClassName"
|
|
39
40
|
@sort:change="handleChangeSort"
|
|
40
41
|
/>
|
|
41
42
|
</slot>
|
|
@@ -114,6 +115,10 @@ export default {
|
|
|
114
115
|
default: () => [],
|
|
115
116
|
type: Array,
|
|
116
117
|
},
|
|
118
|
+
rowClassName: {
|
|
119
|
+
type: [String, Function],
|
|
120
|
+
default: null,
|
|
121
|
+
},
|
|
117
122
|
topFilter: {
|
|
118
123
|
default() {
|
|
119
124
|
return {};
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<el-table
|
|
3
|
+
<el-table
|
|
4
|
+
:data="data"
|
|
5
|
+
border
|
|
6
|
+
:row-class-name="rowClassName"
|
|
7
|
+
@sort-change="sortChange"
|
|
8
|
+
>
|
|
4
9
|
<template v-for="field in fields">
|
|
5
10
|
<template v-if="field.callback">
|
|
6
11
|
<el-table-column
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
:key="field.prop"
|
|
13
|
+
v-slot="context"
|
|
14
|
+
:prop="field.prop"
|
|
15
|
+
:label="field.label"
|
|
16
|
+
:width="field.width ? field.width : null"
|
|
17
|
+
:sortable="field.sortable ? field.sortable : null"
|
|
13
18
|
>
|
|
14
19
|
<el-link v-if="field.href" :href="customHref(field, context)">
|
|
15
20
|
{{ customLinkLabel(field, context) }}
|
|
16
21
|
</el-link>
|
|
17
22
|
<el-link
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
v-else
|
|
24
|
+
@click.prevent="
|
|
20
25
|
field.callback(field.prop, context.$index, context.row)
|
|
21
26
|
"
|
|
22
27
|
>
|
|
@@ -26,11 +31,11 @@
|
|
|
26
31
|
</template>
|
|
27
32
|
<template v-else-if="field.type && field.type === 'template'">
|
|
28
33
|
<el-table-column
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
:key="field.prop"
|
|
35
|
+
:prop="field.prop"
|
|
36
|
+
:label="field.label"
|
|
37
|
+
:width="field.width ? field.width : null"
|
|
38
|
+
:sortable="field.sortable ? field.sortable : null"
|
|
34
39
|
>
|
|
35
40
|
<template slot-scope="scope">
|
|
36
41
|
<span v-html="field.formatter(scope)"></span>
|
|
@@ -39,27 +44,27 @@
|
|
|
39
44
|
</template>
|
|
40
45
|
<template v-else-if="field.type && field.type === 'component'">
|
|
41
46
|
<el-table-column
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
:key="field.prop"
|
|
48
|
+
:prop="field.prop"
|
|
49
|
+
:label="field.label"
|
|
50
|
+
:width="field.width ? field.width : null"
|
|
51
|
+
:sortable="field.sortable ? field.sortable : null"
|
|
47
52
|
>
|
|
48
53
|
<template slot-scope="scope">
|
|
49
|
-
|
|
54
|
+
<component :is="field.name" v-bind="field.params(scope)" />
|
|
50
55
|
</template>
|
|
51
56
|
</el-table-column>
|
|
52
57
|
</template>
|
|
53
58
|
<template v-else>
|
|
54
59
|
<el-table-column
|
|
55
|
-
|
|
60
|
+
:formatter="
|
|
56
61
|
typeof field.formatter === 'function' ? field.formatter : null
|
|
57
62
|
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
:key="field.prop"
|
|
64
|
+
:prop="field.prop"
|
|
65
|
+
:label="field.label"
|
|
66
|
+
:width="field.width ? field.width : null"
|
|
67
|
+
:sortable="field.sortable ? field.sortable : null"
|
|
63
68
|
/>
|
|
64
69
|
</template>
|
|
65
70
|
</template>
|
|
@@ -81,8 +86,13 @@ export default {
|
|
|
81
86
|
default: () => [],
|
|
82
87
|
type: Array,
|
|
83
88
|
},
|
|
89
|
+
rowClassName: {
|
|
90
|
+
type: [String, Function],
|
|
91
|
+
default: null,
|
|
92
|
+
},
|
|
84
93
|
},
|
|
85
94
|
data: function () {
|
|
95
|
+
console.log(this.rowClassName);
|
|
86
96
|
return {
|
|
87
97
|
loading: false,
|
|
88
98
|
};
|
|
@@ -94,15 +104,15 @@ export default {
|
|
|
94
104
|
},
|
|
95
105
|
customHref(field, context) {
|
|
96
106
|
return field.href
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
107
|
+
? typeof field.href === "function"
|
|
108
|
+
? field.href(field.prop, context.$index, context.row)
|
|
109
|
+
: field.href
|
|
110
|
+
: "#";
|
|
101
111
|
},
|
|
102
112
|
customLinkLabel(field, context) {
|
|
103
113
|
return typeof field.formatter === "function"
|
|
104
|
-
|
|
105
|
-
|
|
114
|
+
? field.formatter(context.row)
|
|
115
|
+
: context.row[field.prop];
|
|
106
116
|
},
|
|
107
117
|
},
|
|
108
118
|
};
|