n20-common-lib 2.2.6 → 2.2.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/package.json +2 -1
- package/src/assets/css/_coreLib.scss +6 -6
- package/src/assets/css/cl-form-item.scss +4 -0
- package/src/assets/css/el-table.scss +16 -0
- package/src/assets/css/element.dev.scss +0 -3
- package/src/assets/css/index.scss +0 -2
- package/src/assets/css/umy-table/u-table.scss +63 -0
- package/src/assets/css/umy-table/u-tree-table.scss +34 -0
- package/src/assets/css/umy-table/ux-grid.scss +99 -0
- package/src/components/ApprovalButtons/index.vue +1 -1
- package/src/components/Table/filters.js +28 -0
- package/src/components/Table/index.vue +47 -3
- package/src/components/UTable/ElxTableFilter.vue +105 -0
- package/src/components/UTable/index.js +114 -0
- package/style/index.css +1 -1
- package/style/index.css.map +1 -1
- package/theme/blue.css +1 -1
- package/theme/cctcRed.css +1 -1
- package/theme/green.css +1 -1
- package/theme/lightBlue.css +1 -1
- package/theme/orange.css +1 -1
- package/theme/purple.css +1 -1
- package/theme/red.css +1 -1
- package/theme/yellow.css +1 -1
- package/src/assets/css/alert.scss +0 -28
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n20-common-lib",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"qrcode": "*",
|
|
55
55
|
"resize-detector": "*",
|
|
56
56
|
"strip-json-comments": "*",
|
|
57
|
+
"umy-table": "^1.1.8",
|
|
57
58
|
"v-viewer": "*",
|
|
58
59
|
"vuedraggable": "*"
|
|
59
60
|
},
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
@import './rootvar.scss';
|
|
3
3
|
@import './font-icon.scss';
|
|
4
4
|
|
|
5
|
+
@import './el-button.scss';
|
|
6
|
+
@import './el-table.scss';
|
|
7
|
+
|
|
5
8
|
@import './title-pop.scss';
|
|
6
9
|
@import './cl-form-item.scss';
|
|
7
10
|
@import './cl-approve-card.scss';
|
|
@@ -30,6 +33,9 @@
|
|
|
30
33
|
@import './cl-general-card.scss';
|
|
31
34
|
@import './cl-anchor.scss';
|
|
32
35
|
@import './cl-flow-step.scss';
|
|
36
|
+
@import './umy-table/u-table.scss';
|
|
37
|
+
@import './umy-table/u-tree-table.scss';
|
|
38
|
+
@import './umy-table/ux-grid.scss';
|
|
33
39
|
|
|
34
40
|
@import '../../plugins/Print/print.scss';
|
|
35
41
|
@import './select.scss';
|
|
@@ -38,9 +44,3 @@
|
|
|
38
44
|
/* 临时引入 */
|
|
39
45
|
@import '../../components/ChildRange/style.scss';
|
|
40
46
|
@import '../../components/PageHeader/style.scss';
|
|
41
|
-
.table-header-popover.el-popover {
|
|
42
|
-
padding: 16px;
|
|
43
|
-
}
|
|
44
|
-
.el-form-item__label {
|
|
45
|
-
color: $--color-text-primary;
|
|
46
|
-
}
|
|
@@ -14,6 +14,18 @@
|
|
|
14
14
|
font-size: 12px;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
+
.el-table--small,
|
|
18
|
+
.el-table--mini {
|
|
19
|
+
.el-table__cell {
|
|
20
|
+
.el-button--text {
|
|
21
|
+
padding-top: 2px;
|
|
22
|
+
padding-bottom: 2px;
|
|
23
|
+
}
|
|
24
|
+
.el-link {
|
|
25
|
+
line-height: initial;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
17
29
|
|
|
18
30
|
.el-table th {
|
|
19
31
|
font-weight: $--font-weight-primary;
|
|
@@ -99,3 +111,7 @@
|
|
|
99
111
|
.el-table .descending .sort-caret.descending {
|
|
100
112
|
color: $--color-primary;
|
|
101
113
|
}
|
|
114
|
+
|
|
115
|
+
.table-header-popover.el-popover {
|
|
116
|
+
padding: 16px;
|
|
117
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
.plTableBox {
|
|
2
|
+
width: 100%;
|
|
3
|
+
position: relative;
|
|
4
|
+
.el-table {
|
|
5
|
+
.umy-table-beyond {
|
|
6
|
+
white-space: nowrap !important;
|
|
7
|
+
position: relative;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
.el-table__virtual-wrapper {
|
|
11
|
+
.el-table__body {
|
|
12
|
+
width: 100%;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
.el-table--fixed__virtual-wrapper {
|
|
16
|
+
width: auto !important;
|
|
17
|
+
}
|
|
18
|
+
.el-table__footer-wrapper {
|
|
19
|
+
margin-top: 0 !important;
|
|
20
|
+
}
|
|
21
|
+
.umy-table-header-border-right-none-th {
|
|
22
|
+
border-right: none !important;
|
|
23
|
+
}
|
|
24
|
+
.fixed-columns-roll-style {
|
|
25
|
+
.el-table__body-wrapper {
|
|
26
|
+
z-index: 2 !important;
|
|
27
|
+
}
|
|
28
|
+
.pltableFixedWrapper {
|
|
29
|
+
z-index: 2 !important;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
.myPagination {
|
|
33
|
+
padding-top: 20px;
|
|
34
|
+
text-align: right;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
.modal-backdrop {
|
|
38
|
+
position: fixed;
|
|
39
|
+
top: 0;
|
|
40
|
+
right: 0;
|
|
41
|
+
bottom: 0;
|
|
42
|
+
left: 0;
|
|
43
|
+
z-index: 5555 !important;
|
|
44
|
+
background-color: #000;
|
|
45
|
+
opacity: 0.2;
|
|
46
|
+
}
|
|
47
|
+
.beautifyTableClass {
|
|
48
|
+
.plTbaleTotal {
|
|
49
|
+
.el-table__footer-two {
|
|
50
|
+
border-top: 1px solid #c7c9cc;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.plTableBox {
|
|
56
|
+
.el-table {
|
|
57
|
+
.hidden-columns {
|
|
58
|
+
visibility: hidden;
|
|
59
|
+
position: absolute;
|
|
60
|
+
z-index: -1;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
.cell--tree-node {
|
|
2
|
+
position: relative;
|
|
3
|
+
}
|
|
4
|
+
.pl-tree-cell {
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
text-overflow: ellipsis;
|
|
7
|
+
white-space: nowrap;
|
|
8
|
+
display: block;
|
|
9
|
+
padding-left: 1.5em;
|
|
10
|
+
}
|
|
11
|
+
.tree--btn-wrapper {
|
|
12
|
+
position: absolute;
|
|
13
|
+
top: 50%;
|
|
14
|
+
width: 1em;
|
|
15
|
+
height: 1em;
|
|
16
|
+
line-height: 1em;
|
|
17
|
+
margin-top: -0.5em;
|
|
18
|
+
transition: transform 0.2s ease-in-out;
|
|
19
|
+
z-index: 1;
|
|
20
|
+
user-select: none;
|
|
21
|
+
color: #333333 !important;
|
|
22
|
+
font-size: 16px;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
&.tree--btn-wrapper-show {
|
|
25
|
+
transform: rotate(90deg);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
.reverse-table {
|
|
29
|
+
.u-table--fixed-left-wrapper {
|
|
30
|
+
.u-body--column {
|
|
31
|
+
background-color: $--table-header-background-color;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
.elx-table {
|
|
2
|
+
.elx-body--column,
|
|
3
|
+
.elx-footer--column,
|
|
4
|
+
.elx-header--column {
|
|
5
|
+
&.col--ellipsis {
|
|
6
|
+
height: 40px;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
&.elx-editable .elx-body--column {
|
|
10
|
+
height: 40px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&.border--default,
|
|
14
|
+
&.border--default,
|
|
15
|
+
&.border--outer {
|
|
16
|
+
.elx-table--header-wrapper {
|
|
17
|
+
background-color: --table-header-background-color;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
&.border--full {
|
|
21
|
+
.elx-body--column,
|
|
22
|
+
.elx-footer--column,
|
|
23
|
+
.elx-header--column {
|
|
24
|
+
background-image: linear-gradient($--table-border-color, $--table-border-color),
|
|
25
|
+
linear-gradient($--table-border-color, $--table-border-color);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.elx-cell--checkbox {
|
|
30
|
+
.elx-checkbox--icon {
|
|
31
|
+
width: 16px;
|
|
32
|
+
height: 16px;
|
|
33
|
+
&:before {
|
|
34
|
+
width: 16px;
|
|
35
|
+
height: 16px;
|
|
36
|
+
border: 1px solid $--radio-input-border-color;
|
|
37
|
+
border-radius: 2px;
|
|
38
|
+
}
|
|
39
|
+
&:after {
|
|
40
|
+
left: 6px;
|
|
41
|
+
top: 3px;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.elx-cell--sort {
|
|
47
|
+
display: inline-flex;
|
|
48
|
+
flex-direction: row-reverse;
|
|
49
|
+
align-items: center;
|
|
50
|
+
width: 16px;
|
|
51
|
+
height: 16px;
|
|
52
|
+
line-height: 16px;
|
|
53
|
+
vertical-align: middle;
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
}
|
|
56
|
+
.elx-sort--asc-btn,
|
|
57
|
+
.elx-sort--desc-btn {
|
|
58
|
+
width: 8px;
|
|
59
|
+
height: 16px;
|
|
60
|
+
border: none;
|
|
61
|
+
font-style: normal;
|
|
62
|
+
position: static;
|
|
63
|
+
&:before {
|
|
64
|
+
content: '\e61c';
|
|
65
|
+
font-family: 'core-lib-iconfont';
|
|
66
|
+
font-size: 12px;
|
|
67
|
+
line-height: 12px;
|
|
68
|
+
position: relative;
|
|
69
|
+
left: auto;
|
|
70
|
+
top: 1px;
|
|
71
|
+
right: 3px;
|
|
72
|
+
bottom: auto;
|
|
73
|
+
border: none;
|
|
74
|
+
}
|
|
75
|
+
&:hover {
|
|
76
|
+
color: $--color-primary-light-6;
|
|
77
|
+
}
|
|
78
|
+
&.sort--active {
|
|
79
|
+
color: $--color-primary;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
.elx-sort--desc-btn:before {
|
|
83
|
+
content: '\e61d';
|
|
84
|
+
font-family: 'core-lib-iconfont';
|
|
85
|
+
position: relative;
|
|
86
|
+
right: 1px;
|
|
87
|
+
}
|
|
88
|
+
.elx-cell--filter {
|
|
89
|
+
padding-left: 0;
|
|
90
|
+
}
|
|
91
|
+
.elx-table--filter-wrapper {
|
|
92
|
+
margin-top: 16px;
|
|
93
|
+
}
|
|
94
|
+
.filter--active {
|
|
95
|
+
.elx-cell--title {
|
|
96
|
+
color: $--color-primary;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -58,3 +58,31 @@ export function colftF(colft, fMap) {
|
|
|
58
58
|
if (typeof colft !== 'string') return colft
|
|
59
59
|
return fMap[colft]
|
|
60
60
|
}
|
|
61
|
+
|
|
62
|
+
export function colf_BD_F(colf, map) {
|
|
63
|
+
if (!colf) return undefined
|
|
64
|
+
if (typeof colf !== 'string') {
|
|
65
|
+
return ({ cellValue, row, column }) => colf(row, column, cellValue)
|
|
66
|
+
}
|
|
67
|
+
let sc = colf.split(/{.+?}/g) || []
|
|
68
|
+
let mc = colf.match(/{.+?}/g) || []
|
|
69
|
+
let mck = []
|
|
70
|
+
mc.forEach((t) => {
|
|
71
|
+
t = t.replace(/^{|\s+|}$/g, '').split('|')
|
|
72
|
+
mck.push(t)
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
return ({ row }) => tplFn(row, sc, mck, map)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function colft_BD_F(colft, fMap) {
|
|
79
|
+
let list = undefined
|
|
80
|
+
if (typeof colft !== 'string') {
|
|
81
|
+
list = colft
|
|
82
|
+
} else {
|
|
83
|
+
list = fMap[colft]
|
|
84
|
+
}
|
|
85
|
+
if (Array.isArray(list)) {
|
|
86
|
+
return list.map((item) => ({ ...item, label: item.text }))
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<el-table
|
|
3
|
+
v-if="!bigData"
|
|
3
4
|
ref="el-table"
|
|
4
5
|
:key="colsKey"
|
|
5
6
|
:header-cell-style="{ 'text-align': 'center' }"
|
|
@@ -23,11 +24,45 @@
|
|
|
23
24
|
/>
|
|
24
25
|
</template>
|
|
25
26
|
</el-table>
|
|
27
|
+
<ux-table
|
|
28
|
+
v-else
|
|
29
|
+
:key="colsKey"
|
|
30
|
+
:header-cell-style="{ 'text-align': 'center' }"
|
|
31
|
+
:data="data"
|
|
32
|
+
:height="height"
|
|
33
|
+
v-bind="$attrs"
|
|
34
|
+
v-on="$listeners"
|
|
35
|
+
>
|
|
36
|
+
<template v-for="(item, i) in columns">
|
|
37
|
+
<slot v-if="item.slotName" :name="item.slotName" :column="item"></slot>
|
|
38
|
+
<ux-table-column
|
|
39
|
+
v-else-if="item.render"
|
|
40
|
+
:key="'cl-table-' + i"
|
|
41
|
+
:field="item.prop"
|
|
42
|
+
:title="item.label"
|
|
43
|
+
:type="item.type | typeF"
|
|
44
|
+
v-bind="item"
|
|
45
|
+
>
|
|
46
|
+
<columnRender slot-scope="{ row, $index }" :c-render="item.render" :row="row" :index="$index" />
|
|
47
|
+
</ux-table-column>
|
|
48
|
+
|
|
49
|
+
<ux-table-column
|
|
50
|
+
v-else
|
|
51
|
+
:key="'cl-table-' + i"
|
|
52
|
+
:formatter="item.formatter | colf_BD_F(item.formatterMap)"
|
|
53
|
+
:filters="item.filters | colft_BD_F(filtersMap)"
|
|
54
|
+
:field="item.prop"
|
|
55
|
+
:title="item.label"
|
|
56
|
+
:type="item.type | typeF"
|
|
57
|
+
v-bind="item"
|
|
58
|
+
/>
|
|
59
|
+
</template>
|
|
60
|
+
</ux-table>
|
|
26
61
|
</template>
|
|
27
62
|
|
|
28
63
|
<script>
|
|
29
|
-
import { $lc } from '../../utils/i18n/index'
|
|
30
|
-
import { colfF, colftF } from './filters'
|
|
64
|
+
// import { $lc } from '../../utils/i18n/index'
|
|
65
|
+
import { colfF, colftF, colf_BD_F, colft_BD_F } from './filters'
|
|
31
66
|
|
|
32
67
|
const columnRender = {
|
|
33
68
|
props: {
|
|
@@ -53,9 +88,18 @@ export default {
|
|
|
53
88
|
},
|
|
54
89
|
filters: {
|
|
55
90
|
colfF,
|
|
56
|
-
colftF
|
|
91
|
+
colftF,
|
|
92
|
+
typeF(type) {
|
|
93
|
+
return type && type === 'selection' ? 'checkbox' : type
|
|
94
|
+
},
|
|
95
|
+
colf_BD_F,
|
|
96
|
+
colft_BD_F
|
|
57
97
|
},
|
|
58
98
|
props: {
|
|
99
|
+
bigData: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
default: false
|
|
102
|
+
},
|
|
59
103
|
column: {
|
|
60
104
|
type: Boolean,
|
|
61
105
|
default: false
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="elx-table--filter-wrapper filter--prevent-default p-a"
|
|
4
|
+
:class="{
|
|
5
|
+
't--animat': $parent.animat,
|
|
6
|
+
'is--multiple': filterStore.multiple,
|
|
7
|
+
'filter--active': filterStore.visible
|
|
8
|
+
}"
|
|
9
|
+
:style="filterStore.style"
|
|
10
|
+
>
|
|
11
|
+
<slot v-if="filterStore.visible">
|
|
12
|
+
<el-input
|
|
13
|
+
v-model="searchVal"
|
|
14
|
+
class="input-w m-b"
|
|
15
|
+
:placeholder="'请输入' | $lc"
|
|
16
|
+
clearable
|
|
17
|
+
suffix-icon="el-icon-search"
|
|
18
|
+
/>
|
|
19
|
+
<div v-if="filterStore.multiple">
|
|
20
|
+
<el-checkbox v-model="allCheck" :label="true" :indeterminate="indeterminate">全部</el-checkbox>
|
|
21
|
+
<div class="input-w p-b-s" style="max-height: 226px; overflow: auto">
|
|
22
|
+
<template v-for="filter in filters">
|
|
23
|
+
<el-checkbox
|
|
24
|
+
v-if="filter.label.includes(searchVal)"
|
|
25
|
+
:key="filter.value"
|
|
26
|
+
v-model="filter.checked"
|
|
27
|
+
class="m-t-s m-r-0"
|
|
28
|
+
style="display: block"
|
|
29
|
+
>
|
|
30
|
+
<span class="align-bottom">{{ filter.label }}</span>
|
|
31
|
+
</el-checkbox>
|
|
32
|
+
</template>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
<div v-else>
|
|
36
|
+
<ul class="el-table-filter__list">
|
|
37
|
+
<li class="el-table-filter__list-item text-l" :class="{ 'is-active': !allCheck }">全部</li>
|
|
38
|
+
</ul>
|
|
39
|
+
<ul class="el-table-filter__list" style="max-height: 226px; overflow: auto">
|
|
40
|
+
<template v-for="filter in filters">
|
|
41
|
+
<li
|
|
42
|
+
v-if="filter.label.includes(searchVal)"
|
|
43
|
+
:key="filter.value"
|
|
44
|
+
class="el-table-filter__list-item text-l"
|
|
45
|
+
:class="{ 'is-active': filter.checked }"
|
|
46
|
+
@click="filter.checked = !filter.checked"
|
|
47
|
+
>
|
|
48
|
+
<span class="text-ellipsis align-bottom" style="display: inline-block; max-width: 12em">{{
|
|
49
|
+
filter.label
|
|
50
|
+
}}</span>
|
|
51
|
+
</li>
|
|
52
|
+
</template>
|
|
53
|
+
</ul>
|
|
54
|
+
</div>
|
|
55
|
+
</slot>
|
|
56
|
+
</div>
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<script>
|
|
60
|
+
import { $lc } from '../../utils/i18n/index'
|
|
61
|
+
export default {
|
|
62
|
+
name: 'ElxTableFilter',
|
|
63
|
+
props: {
|
|
64
|
+
filterStore: { type: Object, default: () => ({}) }
|
|
65
|
+
},
|
|
66
|
+
data() {
|
|
67
|
+
return {
|
|
68
|
+
searchVal: '',
|
|
69
|
+
filteredValue: []
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
computed: {
|
|
73
|
+
column() {
|
|
74
|
+
return this.filterStore.column || {}
|
|
75
|
+
},
|
|
76
|
+
filters() {
|
|
77
|
+
return this.filterStore.options
|
|
78
|
+
// _checked
|
|
79
|
+
},
|
|
80
|
+
multiple() {
|
|
81
|
+
return this.filterStore.multiple
|
|
82
|
+
},
|
|
83
|
+
indeterminate() {
|
|
84
|
+
return this.filterStore.isIndeterminate
|
|
85
|
+
},
|
|
86
|
+
allCheck: {
|
|
87
|
+
get() {
|
|
88
|
+
return this.filterStore.isAllSelected
|
|
89
|
+
},
|
|
90
|
+
set(val) {
|
|
91
|
+
this.filterStore.isAllSelected = val
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
watch: {
|
|
96
|
+
'filterStore.visible': {
|
|
97
|
+
handler() {
|
|
98
|
+
console.log(this.filterStore, 1212)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
mounted() {},
|
|
103
|
+
methods: {}
|
|
104
|
+
}
|
|
105
|
+
</script>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { UTable, UTableColumn, UxGrid, UxTableColumn } from 'umy-table'
|
|
2
|
+
|
|
3
|
+
import ElxTableFilter from './ElxTableFilter.vue'
|
|
4
|
+
|
|
5
|
+
function install(Vue) {
|
|
6
|
+
Vue.component('UTable', UTable)
|
|
7
|
+
Vue.component('UTableColumn', UTableColumn)
|
|
8
|
+
repairUtable(Vue) // 美化
|
|
9
|
+
|
|
10
|
+
Vue.component('UxTable', UxGrid)
|
|
11
|
+
|
|
12
|
+
const _created = UxTableColumn.created
|
|
13
|
+
UxTableColumn.created = function () {
|
|
14
|
+
_created.call(this, ...arguments)
|
|
15
|
+
this.$watch('filters', () => {
|
|
16
|
+
this.columnConfig.filters = this.filters
|
|
17
|
+
})
|
|
18
|
+
}
|
|
19
|
+
Vue.component('UxTableColumn', UxTableColumn)
|
|
20
|
+
// 自定义筛选
|
|
21
|
+
Vue.component('ElxTableFilter', ElxTableFilter)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
install
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//
|
|
29
|
+
//
|
|
30
|
+
//
|
|
31
|
+
//
|
|
32
|
+
//
|
|
33
|
+
//
|
|
34
|
+
//
|
|
35
|
+
//
|
|
36
|
+
//
|
|
37
|
+
//
|
|
38
|
+
//
|
|
39
|
+
//
|
|
40
|
+
//
|
|
41
|
+
//
|
|
42
|
+
//
|
|
43
|
+
//
|
|
44
|
+
//
|
|
45
|
+
//
|
|
46
|
+
//
|
|
47
|
+
//
|
|
48
|
+
//
|
|
49
|
+
// 美化表头搜索
|
|
50
|
+
import FilterPanel from '../../utils/tableheaderFilterpanel.vue'
|
|
51
|
+
function setPropsDefault(component, props) {
|
|
52
|
+
let c_props = component.props
|
|
53
|
+
Object.keys(props).forEach((key) => {
|
|
54
|
+
c_props[key] = Object.assign({}, c_props[key], props[key])
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
function setMethodsDefault(component, methods) {
|
|
58
|
+
let c_methods = component.methods
|
|
59
|
+
Object.keys(methods).forEach((key) => {
|
|
60
|
+
c_methods[key] = methods[key]
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
function hasClass(el, cls) {
|
|
64
|
+
if (!el || !cls) return false
|
|
65
|
+
if (cls.indexOf(' ') !== -1) throw new Error('className should not contain space.')
|
|
66
|
+
if (el.classList) {
|
|
67
|
+
return el.classList.contains(cls)
|
|
68
|
+
} else {
|
|
69
|
+
return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function repairUtable(Vue) {
|
|
74
|
+
setPropsDefault(UTableColumn, {
|
|
75
|
+
filterPlacement: {
|
|
76
|
+
default: 'bottom'
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
if (UTable.components.ElTable.components.TableHeader) {
|
|
80
|
+
setMethodsDefault(UTable.components.ElTable.components.TableHeader, {
|
|
81
|
+
handleFilterClick(event, column) {
|
|
82
|
+
event.stopPropagation()
|
|
83
|
+
const target = event.target
|
|
84
|
+
let cell = target.tagName === 'TH' ? target : target.parentNode
|
|
85
|
+
if (hasClass(cell, 'noclick')) return
|
|
86
|
+
cell = cell.querySelector('.el-table__column-filter-trigger') || cell
|
|
87
|
+
const table = this.$parent
|
|
88
|
+
|
|
89
|
+
let filterPanel = this.filterPanels[column.id]
|
|
90
|
+
|
|
91
|
+
if (filterPanel && column.filterOpened) {
|
|
92
|
+
filterPanel.showPopper = false
|
|
93
|
+
return
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (!filterPanel) {
|
|
97
|
+
filterPanel = new Vue(FilterPanel)
|
|
98
|
+
this.filterPanels[column.id] = filterPanel
|
|
99
|
+
if (column.filterPlacement) {
|
|
100
|
+
filterPanel.placement = column.filterPlacement
|
|
101
|
+
}
|
|
102
|
+
filterPanel.table = table
|
|
103
|
+
filterPanel.cell = cell
|
|
104
|
+
filterPanel.column = column
|
|
105
|
+
!this.$isServer && filterPanel.$mount(document.createElement('div'))
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
setTimeout(() => {
|
|
109
|
+
filterPanel.showPopper = true
|
|
110
|
+
}, 16)
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
}
|