n20-common-lib 2.20.2 → 2.20.3
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
|
@@ -368,9 +368,9 @@ export default {
|
|
|
368
368
|
column.minWidth = Math.ceil(textLength * CHAR_WIDTH + PADDING)
|
|
369
369
|
}
|
|
370
370
|
|
|
371
|
-
|
|
371
|
+
// 优先使用width,如果width不存在才使用minWidth
|
|
372
|
+
const width = column.width || column.minWidth
|
|
372
373
|
column['_width_'] = column['_width_'] || parseInt(width)
|
|
373
|
-
/* column['width'] = parseInt(width) */
|
|
374
374
|
columnsWidth += column['_width_']
|
|
375
375
|
})
|
|
376
376
|
|
|
@@ -383,7 +383,10 @@ export default {
|
|
|
383
383
|
return columns.map((column) => {
|
|
384
384
|
if (!column.type) {
|
|
385
385
|
const rate = column['_width_'] / columnsWidth
|
|
386
|
-
column
|
|
386
|
+
// 如果column有width,则保持原width不变;如果没有width,则计算新宽度但不小于minWidth
|
|
387
|
+
if (!column.width) {
|
|
388
|
+
column['width'] = Math.max(windowWidth * rate, column.minWidth)
|
|
389
|
+
}
|
|
387
390
|
return column
|
|
388
391
|
}
|
|
389
392
|
return column
|