n20-common-lib 2.2.38 → 2.2.40
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 +1 -1
- package/src/components/Filters/index.vue +25 -4
- package/src/components/Layout/HeaderWrap/indexN.vue +1 -1
- package/src/components/SelectTree/index.vue +5 -1
- package/src/components/Table/index.vue +17 -0
- package/src/utils/asciiWidth.js +107 -0
- package/src/utils/repairElementUI.js +3 -102
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
ref="popover"
|
|
4
4
|
v-model="showPop"
|
|
5
5
|
trigger="manual"
|
|
6
|
-
:width="
|
|
6
|
+
:width="widthAs"
|
|
7
7
|
:title="'筛选' | $lc"
|
|
8
8
|
:popper-class="popperClass"
|
|
9
9
|
placement="bottom-end"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
v-if="showPopC"
|
|
17
17
|
v-click-outside="clickOut"
|
|
18
18
|
class="n20-filter p-a-s p-b-0"
|
|
19
|
-
:label-width="
|
|
19
|
+
:label-width="labelWidthAs + 'px'"
|
|
20
20
|
@submit.native.prevent
|
|
21
21
|
>
|
|
22
22
|
<template v-if="!type">
|
|
@@ -83,6 +83,8 @@
|
|
|
83
83
|
import formItemInput from './form-item-input.vue'
|
|
84
84
|
import footerBox from '../FooterBox/index.vue'
|
|
85
85
|
import showColumn, { getColumns } from '../ShowColumn/index.vue'
|
|
86
|
+
import getWidth from '../../utils/asciiWidth'
|
|
87
|
+
|
|
86
88
|
export default {
|
|
87
89
|
name: 'Filters',
|
|
88
90
|
components: {
|
|
@@ -93,7 +95,7 @@ export default {
|
|
|
93
95
|
props: {
|
|
94
96
|
width: {
|
|
95
97
|
type: Number,
|
|
96
|
-
default:
|
|
98
|
+
default: undefined
|
|
97
99
|
},
|
|
98
100
|
defaultShow: {
|
|
99
101
|
type: Number,
|
|
@@ -109,7 +111,7 @@ export default {
|
|
|
109
111
|
},
|
|
110
112
|
labelWidth: {
|
|
111
113
|
type: [String, Number],
|
|
112
|
-
default:
|
|
114
|
+
default: undefined
|
|
113
115
|
},
|
|
114
116
|
type: {
|
|
115
117
|
type: String,
|
|
@@ -166,6 +168,25 @@ export default {
|
|
|
166
168
|
},
|
|
167
169
|
pageId() {
|
|
168
170
|
return 'filter:' + this.filterId
|
|
171
|
+
},
|
|
172
|
+
labelWidthAs() {
|
|
173
|
+
if (this.labelWidth !== undefined) return this.labelWidth
|
|
174
|
+
|
|
175
|
+
if (this.type === 'remote') {
|
|
176
|
+
let maxW = Math.max(4 * 14, ...this.remoteList.map((r) => getWidth(r.label)))
|
|
177
|
+
return maxW + 14
|
|
178
|
+
} else {
|
|
179
|
+
let maxW = Math.max(4 * 14, ...this.minList.map((r) => getWidth(r.label)))
|
|
180
|
+
if (this.showMore) {
|
|
181
|
+
maxW = Math.max(maxW, ...this.moreList.map((r) => getWidth(r.label)))
|
|
182
|
+
}
|
|
183
|
+
return maxW + 14
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
widthAs() {
|
|
187
|
+
if (this.width !== undefined) return this.width
|
|
188
|
+
|
|
189
|
+
return this.labelWidthAs + 240
|
|
169
190
|
}
|
|
170
191
|
},
|
|
171
192
|
methods: {
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
</el-dropdown-item>
|
|
165
165
|
<el-dropdown-item _command="systemSet">
|
|
166
166
|
<el-dropdown trigger="hover" size="medium" placement="left-start" style="width: 100%" @command="setUserFn">
|
|
167
|
-
<div class="flex-box flex-v">
|
|
167
|
+
<div class="flex-box flex-v" @click.stop>
|
|
168
168
|
<span>{{ '系统设置' | $lc }}</span>
|
|
169
169
|
<i class="el-icon-caret-right m-l-auto m-r-0"></i>
|
|
170
170
|
</div>
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
:default-expanded-keys="expandedKeys"
|
|
33
33
|
:highlight-current="!multiple"
|
|
34
34
|
:show-checkbox="multiple"
|
|
35
|
-
:check-strictly="
|
|
35
|
+
:check-strictly="checkStrictly"
|
|
36
36
|
:expand-on-click-node="multiple"
|
|
37
37
|
:filter-node-method="filterNode"
|
|
38
38
|
:size="size"
|
|
@@ -94,6 +94,10 @@ export default {
|
|
|
94
94
|
type: Array,
|
|
95
95
|
default: () => []
|
|
96
96
|
},
|
|
97
|
+
checkStrictly: {
|
|
98
|
+
type: Boolean,
|
|
99
|
+
default: true
|
|
100
|
+
},
|
|
97
101
|
props: {
|
|
98
102
|
type: Object,
|
|
99
103
|
default: () => ({
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
v-if="!bigData"
|
|
4
4
|
ref="el-table"
|
|
5
5
|
:key="colsKey"
|
|
6
|
+
:class="{ 'cell-default-set--': cellDefault, 'clear-in-form-margin': clearInFormMargin }"
|
|
6
7
|
:header-cell-style="{ 'text-align': 'center' }"
|
|
7
8
|
:data="data"
|
|
8
9
|
:height="height"
|
|
@@ -152,6 +153,14 @@ export default {
|
|
|
152
153
|
showSetsize: {
|
|
153
154
|
type: Boolean,
|
|
154
155
|
default: false
|
|
156
|
+
},
|
|
157
|
+
cellDefault: {
|
|
158
|
+
type: Boolean,
|
|
159
|
+
default: false
|
|
160
|
+
},
|
|
161
|
+
clearInFormMargin: {
|
|
162
|
+
type: Boolean,
|
|
163
|
+
default: false
|
|
155
164
|
}
|
|
156
165
|
},
|
|
157
166
|
data() {
|
|
@@ -246,3 +255,11 @@ export default {
|
|
|
246
255
|
}
|
|
247
256
|
}
|
|
248
257
|
</script>
|
|
258
|
+
<style>
|
|
259
|
+
.cell-default-set-- .el-table__body .el-table__cell .cell:empty::before {
|
|
260
|
+
content: '--';
|
|
261
|
+
}
|
|
262
|
+
.clear-in-form-margin .el-table__body .el-table__cell .cell .el-form-item {
|
|
263
|
+
margin-bottom: 0;
|
|
264
|
+
}
|
|
265
|
+
</style>
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// 设置表头最小宽度,保证表头不换行
|
|
2
|
+
const ASCII_W = {
|
|
3
|
+
' ': 4.125,
|
|
4
|
+
0: 8.21875,
|
|
5
|
+
1: 8.21875,
|
|
6
|
+
2: 8.21875,
|
|
7
|
+
3: 8.21875,
|
|
8
|
+
4: 8.21875,
|
|
9
|
+
5: 8.21875,
|
|
10
|
+
6: 8.21875,
|
|
11
|
+
7: 8.21875,
|
|
12
|
+
8: 8.21875,
|
|
13
|
+
9: 8.21875,
|
|
14
|
+
'!': 4.375,
|
|
15
|
+
'"': 6.109375,
|
|
16
|
+
'#': 8.9375,
|
|
17
|
+
$: 8.21875,
|
|
18
|
+
'%': 12.46875,
|
|
19
|
+
'&': 12.1875,
|
|
20
|
+
"'": 3.59375,
|
|
21
|
+
'(': 4.6875,
|
|
22
|
+
')': 4.6875,
|
|
23
|
+
'*': 6.375,
|
|
24
|
+
'+': 10.390625,
|
|
25
|
+
',': 3.375,
|
|
26
|
+
'-': 6.0625,
|
|
27
|
+
'.': 3.375,
|
|
28
|
+
'/': 5.984375,
|
|
29
|
+
':': 3.375,
|
|
30
|
+
';': 3.375,
|
|
31
|
+
'<': 10.390625,
|
|
32
|
+
'=': 10.390625,
|
|
33
|
+
'>': 10.390625,
|
|
34
|
+
'?': 6.765625,
|
|
35
|
+
'@': 14.4375,
|
|
36
|
+
A: 9.859375,
|
|
37
|
+
B: 8.796875,
|
|
38
|
+
C: 9.375,
|
|
39
|
+
D: 10.671875,
|
|
40
|
+
E: 7.703125,
|
|
41
|
+
F: 7.4375,
|
|
42
|
+
G: 10.421875,
|
|
43
|
+
H: 10.828125,
|
|
44
|
+
I: 4.125,
|
|
45
|
+
J: 5.546875,
|
|
46
|
+
K: 8.890625,
|
|
47
|
+
L: 7.1875,
|
|
48
|
+
M: 13.6875,
|
|
49
|
+
N: 11.390625,
|
|
50
|
+
O: 11.421875,
|
|
51
|
+
P: 8.578125,
|
|
52
|
+
Q: 11.421875,
|
|
53
|
+
R: 9.140625,
|
|
54
|
+
S: 8.09375,
|
|
55
|
+
T: 8.03125,
|
|
56
|
+
U: 10.453125,
|
|
57
|
+
V: 9.46875,
|
|
58
|
+
W: 14.25,
|
|
59
|
+
X: 9.03125,
|
|
60
|
+
Y: 8.453125,
|
|
61
|
+
Z: 8.6875,
|
|
62
|
+
'[': 4.6875,
|
|
63
|
+
'\\': 5.828125,
|
|
64
|
+
']': 4.6875,
|
|
65
|
+
'^': 10.390625,
|
|
66
|
+
_: 6.28125,
|
|
67
|
+
'`': 4.140625,
|
|
68
|
+
a: 7.75,
|
|
69
|
+
b: 8.953125,
|
|
70
|
+
c: 7.03125,
|
|
71
|
+
d: 8.96875,
|
|
72
|
+
e: 7.953125,
|
|
73
|
+
f: 4.859375,
|
|
74
|
+
g: 8.96875,
|
|
75
|
+
h: 8.625,
|
|
76
|
+
i: 3.734375,
|
|
77
|
+
j: 3.75,
|
|
78
|
+
k: 7.625,
|
|
79
|
+
l: 3.734375,
|
|
80
|
+
m: 13.125,
|
|
81
|
+
n: 8.640625,
|
|
82
|
+
o: 8.90625,
|
|
83
|
+
p: 8.953125,
|
|
84
|
+
q: 8.96875,
|
|
85
|
+
r: 5.40625,
|
|
86
|
+
s: 6.546875,
|
|
87
|
+
t: 5.21875,
|
|
88
|
+
u: 8.640625,
|
|
89
|
+
v: 7.359375,
|
|
90
|
+
w: 11.0625,
|
|
91
|
+
x: 7.109375,
|
|
92
|
+
y: 7.421875,
|
|
93
|
+
z: 6.890625,
|
|
94
|
+
'{': 4.6875,
|
|
95
|
+
'|': 3.78125,
|
|
96
|
+
'}': 4.6875,
|
|
97
|
+
'~': 10.390625
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export default function getWidth(label) {
|
|
101
|
+
label = label || ''
|
|
102
|
+
let labels = label.match(/./gu) || []
|
|
103
|
+
let labelW = 0
|
|
104
|
+
labels.forEach((s) => (labelW += ASCII_W[s] || 14))
|
|
105
|
+
|
|
106
|
+
return labelW
|
|
107
|
+
}
|
|
@@ -38,104 +38,8 @@ setPropsDefault(ElementUI.Dialog, {
|
|
|
38
38
|
}
|
|
39
39
|
})
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
' ': 4.125,
|
|
44
|
-
0: 8.21875,
|
|
45
|
-
1: 8.21875,
|
|
46
|
-
2: 8.21875,
|
|
47
|
-
3: 8.21875,
|
|
48
|
-
4: 8.21875,
|
|
49
|
-
5: 8.21875,
|
|
50
|
-
6: 8.21875,
|
|
51
|
-
7: 8.21875,
|
|
52
|
-
8: 8.21875,
|
|
53
|
-
9: 8.21875,
|
|
54
|
-
'!': 4.375,
|
|
55
|
-
'"': 6.109375,
|
|
56
|
-
'#': 8.9375,
|
|
57
|
-
$: 8.21875,
|
|
58
|
-
'%': 12.46875,
|
|
59
|
-
'&': 12.1875,
|
|
60
|
-
"'": 3.59375,
|
|
61
|
-
'(': 4.6875,
|
|
62
|
-
')': 4.6875,
|
|
63
|
-
'*': 6.375,
|
|
64
|
-
'+': 10.390625,
|
|
65
|
-
',': 3.375,
|
|
66
|
-
'-': 6.0625,
|
|
67
|
-
'.': 3.375,
|
|
68
|
-
'/': 5.984375,
|
|
69
|
-
':': 3.375,
|
|
70
|
-
';': 3.375,
|
|
71
|
-
'<': 10.390625,
|
|
72
|
-
'=': 10.390625,
|
|
73
|
-
'>': 10.390625,
|
|
74
|
-
'?': 6.765625,
|
|
75
|
-
'@': 14.4375,
|
|
76
|
-
A: 9.859375,
|
|
77
|
-
B: 8.796875,
|
|
78
|
-
C: 9.375,
|
|
79
|
-
D: 10.671875,
|
|
80
|
-
E: 7.703125,
|
|
81
|
-
F: 7.4375,
|
|
82
|
-
G: 10.421875,
|
|
83
|
-
H: 10.828125,
|
|
84
|
-
I: 4.125,
|
|
85
|
-
J: 5.546875,
|
|
86
|
-
K: 8.890625,
|
|
87
|
-
L: 7.1875,
|
|
88
|
-
M: 13.6875,
|
|
89
|
-
N: 11.390625,
|
|
90
|
-
O: 11.421875,
|
|
91
|
-
P: 8.578125,
|
|
92
|
-
Q: 11.421875,
|
|
93
|
-
R: 9.140625,
|
|
94
|
-
S: 8.09375,
|
|
95
|
-
T: 8.03125,
|
|
96
|
-
U: 10.453125,
|
|
97
|
-
V: 9.46875,
|
|
98
|
-
W: 14.25,
|
|
99
|
-
X: 9.03125,
|
|
100
|
-
Y: 8.453125,
|
|
101
|
-
Z: 8.6875,
|
|
102
|
-
'[': 4.6875,
|
|
103
|
-
'\\': 5.828125,
|
|
104
|
-
']': 4.6875,
|
|
105
|
-
'^': 10.390625,
|
|
106
|
-
_: 6.28125,
|
|
107
|
-
'`': 4.140625,
|
|
108
|
-
a: 7.75,
|
|
109
|
-
b: 8.953125,
|
|
110
|
-
c: 7.03125,
|
|
111
|
-
d: 8.96875,
|
|
112
|
-
e: 7.953125,
|
|
113
|
-
f: 4.859375,
|
|
114
|
-
g: 8.96875,
|
|
115
|
-
h: 8.625,
|
|
116
|
-
i: 3.734375,
|
|
117
|
-
j: 3.75,
|
|
118
|
-
k: 7.625,
|
|
119
|
-
l: 3.734375,
|
|
120
|
-
m: 13.125,
|
|
121
|
-
n: 8.640625,
|
|
122
|
-
o: 8.90625,
|
|
123
|
-
p: 8.953125,
|
|
124
|
-
q: 8.96875,
|
|
125
|
-
r: 5.40625,
|
|
126
|
-
s: 6.546875,
|
|
127
|
-
t: 5.21875,
|
|
128
|
-
u: 8.640625,
|
|
129
|
-
v: 7.359375,
|
|
130
|
-
w: 11.0625,
|
|
131
|
-
x: 7.109375,
|
|
132
|
-
y: 7.421875,
|
|
133
|
-
z: 6.890625,
|
|
134
|
-
'{': 4.6875,
|
|
135
|
-
'|': 3.78125,
|
|
136
|
-
'}': 4.6875,
|
|
137
|
-
'~': 10.390625
|
|
138
|
-
}
|
|
41
|
+
import getWidth from './asciiWidth'
|
|
42
|
+
|
|
139
43
|
setMethodsDefault(ElementUI.TableColumn, {
|
|
140
44
|
setColumnWidth(column) {
|
|
141
45
|
if (this.realWidth) {
|
|
@@ -146,10 +50,7 @@ setMethodsDefault(ElementUI.TableColumn, {
|
|
|
146
50
|
}
|
|
147
51
|
if (!column.minWidth) {
|
|
148
52
|
if (!column.width) {
|
|
149
|
-
let
|
|
150
|
-
let labels = label.match(/./gu) || []
|
|
151
|
-
let labelW = 0
|
|
152
|
-
labels.forEach((s) => (labelW += ASCII_W[s] || 14))
|
|
53
|
+
let labelW = getWidth(column.label)
|
|
153
54
|
|
|
154
55
|
let sortable = column.sortable ? 24 : 0
|
|
155
56
|
let filters = column.filters ? 16 : 0
|