wkjp-list-page 1.0.39 → 1.0.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
|
@@ -867,6 +867,19 @@ export default {
|
|
|
867
867
|
return slotLayout;
|
|
868
868
|
}
|
|
869
869
|
|
|
870
|
+
// 获取表头和内容的最大字符长度
|
|
871
|
+
var maxLen = this.getColumnMaxContentLength(col);
|
|
872
|
+
|
|
873
|
+
// 计算基于内容的宽度(字符数转像素)
|
|
874
|
+
var charPx = Number(this.columnAutoWidthCharPx);
|
|
875
|
+
var pad = Number(this.columnAutoWidthPadding);
|
|
876
|
+
if (!Number.isFinite(charPx) || charPx <= 0) charPx = 16;
|
|
877
|
+
if (!Number.isFinite(pad) || pad < 0) pad = 32;
|
|
878
|
+
|
|
879
|
+
// 计算内容宽度(像素)
|
|
880
|
+
var widthChars = Math.max(maxLen, 1);
|
|
881
|
+
var contentWidthPx = Math.ceil(widthChars * charPx + pad);
|
|
882
|
+
|
|
870
883
|
// 获取用户设置的 minWidth(如果有)
|
|
871
884
|
var userMinWidth = null;
|
|
872
885
|
if (col.minWidth != null && col.minWidth !== "") {
|
|
@@ -880,8 +893,11 @@ export default {
|
|
|
880
893
|
var defaultMinW = Number(this.columnAutoMinWidth);
|
|
881
894
|
if (!Number.isFinite(defaultMinW) || defaultMinW <= 0) defaultMinW = 120;
|
|
882
895
|
|
|
883
|
-
// 计算最终的最小宽度:max(用户设置的minWidth, 默认minWidth)
|
|
884
|
-
var finalMinWidth =
|
|
896
|
+
// 计算最终的最小宽度:max(用户设置的minWidth, 默认minWidth, 内容宽度)
|
|
897
|
+
var finalMinWidth = Math.max(
|
|
898
|
+
defaultMinW,
|
|
899
|
+
contentWidthPx
|
|
900
|
+
);
|
|
885
901
|
if (userMinWidth !== null) {
|
|
886
902
|
finalMinWidth = Math.max(finalMinWidth, userMinWidth);
|
|
887
903
|
}
|