@lambo-design/detail-table 1.0.0-beta.22 → 1.0.0-beta.23
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/Col.js +43 -36
- package/src/components/Row.js +1 -1
- package/src/styles/css/index.less +2 -0
package/package.json
CHANGED
package/src/components/Col.js
CHANGED
|
@@ -28,15 +28,8 @@ const Col = {
|
|
|
28
28
|
const { key } = ctx.data;
|
|
29
29
|
const label = getComponentFromProp(child, "label");
|
|
30
30
|
const slots = getSlots(child);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const totalWidth = 100; // You can adjust this value according to your needs
|
|
34
|
-
const columnWidth = totalWidth / ColProps.totalCols;
|
|
35
|
-
|
|
36
|
-
// Set label and content widths
|
|
37
|
-
const labelWidth = columnWidth * 3 / 10;
|
|
38
|
-
const contentWidth = columnWidth * 7 / 10;
|
|
39
|
-
|
|
31
|
+
const labelColSpan = Math.floor(100 / ColProps.totalCols * 0.3); // 计算 label 的长度
|
|
32
|
+
const contextColSpan = Math.floor(100 / ColProps.totalCols * 0.7); // 计算 context 的长度
|
|
40
33
|
const labelProps = {
|
|
41
34
|
attrs: {},
|
|
42
35
|
class: [
|
|
@@ -48,55 +41,69 @@ const Col = {
|
|
|
48
41
|
],
|
|
49
42
|
key: `${key}-label`,
|
|
50
43
|
style: {
|
|
51
|
-
width: `${
|
|
44
|
+
width: `${labelColSpan}%` // 添加 label 的宽度
|
|
52
45
|
}
|
|
53
46
|
};
|
|
47
|
+
if (layout === "vertical") {
|
|
48
|
+
labelProps.attrs.colSpan = span * 2 - 1;
|
|
49
|
+
}
|
|
54
50
|
|
|
55
51
|
if (bordered) {
|
|
56
52
|
if (type === "label") {
|
|
57
53
|
return createElement("th", labelProps, label);
|
|
58
54
|
}
|
|
59
|
-
|
|
60
55
|
return createElement(
|
|
61
56
|
"td",
|
|
62
57
|
{
|
|
63
58
|
class: `${prefixCls}-item-content`,
|
|
64
59
|
key: `${key}-content`,
|
|
65
|
-
attrs:
|
|
66
|
-
colspan: span * 2 - 1
|
|
67
|
-
},
|
|
60
|
+
attrs:{colSpan: span * 2 - 1},
|
|
68
61
|
style: {
|
|
69
|
-
width: `${
|
|
62
|
+
width: `${contextColSpan}%` // 添加 content 的宽度
|
|
70
63
|
}
|
|
71
64
|
},
|
|
72
65
|
slots.default
|
|
73
66
|
);
|
|
74
67
|
}
|
|
75
|
-
|
|
76
68
|
if (layout === "vertical") {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
[
|
|
92
|
-
createElement("span", labelProps, label),
|
|
69
|
+
if (type === "content") {
|
|
70
|
+
return createElement(
|
|
71
|
+
"td",
|
|
72
|
+
{ colSpan: span, class: `${prefixCls}-item` },
|
|
73
|
+
createElement(
|
|
74
|
+
"span",
|
|
75
|
+
{ class: `${prefixCls}-item-content`, key: `${key}-content`, style: { width: `${contextColSpan}%` } },
|
|
76
|
+
slots.default
|
|
77
|
+
)
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
return createElement(
|
|
81
|
+
"td",
|
|
82
|
+
{ colSpan: span, class: `${prefixCls}-item` },
|
|
93
83
|
createElement(
|
|
94
84
|
"span",
|
|
95
|
-
{
|
|
96
|
-
|
|
85
|
+
{
|
|
86
|
+
class: [
|
|
87
|
+
`${prefixCls}-item-label`,
|
|
88
|
+
{ [`${prefixCls}-item-colon`]: colon }
|
|
89
|
+
],
|
|
90
|
+
key: `${key}-label`,
|
|
91
|
+
style: {
|
|
92
|
+
width: `${labelColSpan}%` // 添加 label 的宽度
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
label
|
|
97
96
|
)
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
return createElement("td", { colSpan: span, class: `${prefixCls}-item` }, [
|
|
100
|
+
createElement("span", labelProps, label),
|
|
101
|
+
createElement(
|
|
102
|
+
"span",
|
|
103
|
+
{ class: `${prefixCls}-item-content`, key: `${key}-content`, style: { width: `${contextColSpan}%` } },
|
|
104
|
+
slots.default
|
|
105
|
+
)
|
|
106
|
+
]);
|
|
100
107
|
}
|
|
101
108
|
};
|
|
102
109
|
|
package/src/components/Row.js
CHANGED
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
font-weight: 500;
|
|
41
41
|
font-size: 14px;
|
|
42
42
|
line-height: 1.5;
|
|
43
|
+
width: 11%;
|
|
43
44
|
|
|
44
45
|
&::after {
|
|
45
46
|
position: relative;
|
|
@@ -67,6 +68,7 @@
|
|
|
67
68
|
color: var(--text-color,@_text-color);;
|
|
68
69
|
font-size: 14px;
|
|
69
70
|
line-height: 1.5;
|
|
71
|
+
width: 22%;
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
&-item {
|