n20-common-lib 2.22.38 → 2.22.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
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n20-common-lib",
|
|
3
|
-
"version": "2.22.
|
|
3
|
+
"version": "2.22.40",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"serve": "vue-cli-service serve",
|
|
7
7
|
"build": "node versionInfo.js && npm run build:css && vue-cli-service build --testTheme",
|
|
8
|
+
"prepublishOnly": "npm run build:css",
|
|
8
9
|
"test:unit": "vue-cli-service test:unit",
|
|
9
10
|
"lint": "vue-cli-service lint",
|
|
10
11
|
"build:Jenkins_1": "vue-cli-service build --serverConfig ./server-config-jenkins.jsonc",
|
|
@@ -14,9 +14,14 @@ export default {
|
|
|
14
14
|
column: {
|
|
15
15
|
type: Number,
|
|
16
16
|
default: 2
|
|
17
|
+
},
|
|
18
|
+
autoResize: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: true
|
|
17
21
|
}
|
|
18
22
|
},
|
|
19
23
|
created() {
|
|
24
|
+
if (!this.autoResize) return
|
|
20
25
|
this.resize()
|
|
21
26
|
window.addEventListener('resize', this.resize)
|
|
22
27
|
},
|
|
@@ -145,6 +145,47 @@ import empty from '../Empty'
|
|
|
145
145
|
import tableSetSize from '../TableSetSize/index.vue'
|
|
146
146
|
import { $lc } from '../../utils/i18n/index.js'
|
|
147
147
|
import XEUtils from 'xe-utils'
|
|
148
|
+
|
|
149
|
+
/** 将 Element 表格风格的 show-overflow-tooltip 转为 vxe-column 的 show-overflow */
|
|
150
|
+
function hasOverflowTooltipKey(item) {
|
|
151
|
+
return (
|
|
152
|
+
Object.prototype.hasOwnProperty.call(item, 'showOverflowTooltip') ||
|
|
153
|
+
Object.prototype.hasOwnProperty.call(item, 'show-overflow-tooltip')
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function applyTooltipToShowOverflow(item) {
|
|
158
|
+
const explicitOverflow =
|
|
159
|
+
item.showOverflow !== undefined ? item.showOverflow : item['show-overflow']
|
|
160
|
+
const hasTooltipKey = hasOverflowTooltipKey(item)
|
|
161
|
+
if (!hasTooltipKey && explicitOverflow === undefined) {
|
|
162
|
+
return item
|
|
163
|
+
}
|
|
164
|
+
const out = { ...item }
|
|
165
|
+
if (hasTooltipKey) {
|
|
166
|
+
delete out['show-overflow-tooltip']
|
|
167
|
+
delete out.showOverflowTooltip
|
|
168
|
+
}
|
|
169
|
+
if (explicitOverflow !== undefined) {
|
|
170
|
+
out['show-overflow'] = explicitOverflow
|
|
171
|
+
} else if (hasTooltipKey) {
|
|
172
|
+
const tooltipVal = item.showOverflowTooltip ?? item['show-overflow-tooltip']
|
|
173
|
+
// 与 n20 Table(ux-table)overflowF 一致:无 tooltip 时用 ellipsis,仅省略无浮层
|
|
174
|
+
out['show-overflow'] = tooltipVal ? 'tooltip' : 'ellipsis'
|
|
175
|
+
}
|
|
176
|
+
return out
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function mapColumnOverflowForVxe(item) {
|
|
180
|
+
if (!item) return item
|
|
181
|
+
if (item.children && item.children.length) {
|
|
182
|
+
const children = item.children.map(mapColumnOverflowForVxe)
|
|
183
|
+
const childChanged = children.some((c, i) => c !== item.children[i])
|
|
184
|
+
if (!childChanged) return item
|
|
185
|
+
return { ...item, children }
|
|
186
|
+
}
|
|
187
|
+
return applyTooltipToShowOverflow(item)
|
|
188
|
+
}
|
|
148
189
|
const renderer = {
|
|
149
190
|
name: 'renderer',
|
|
150
191
|
props: {
|
|
@@ -244,11 +285,8 @@ export default {
|
|
|
244
285
|
},
|
|
245
286
|
computed: {
|
|
246
287
|
_columns() {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
} else {
|
|
250
|
-
return this.columns
|
|
251
|
-
}
|
|
288
|
+
const raw = this.isAutoWidth ? this.calcColumnWidth(this.columns) : this.columns
|
|
289
|
+
return raw.map(mapColumnOverflowForVxe)
|
|
252
290
|
}
|
|
253
291
|
},
|
|
254
292
|
watch: {
|