@hi-ui/table 5.0.0-canary.8 → 5.0.0-canary.9
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @hi-ui/table
|
|
2
2
|
|
|
3
|
+
## 5.0.0-canary.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix(table): 修复 resizable 模式下列宽计算问题 (5.0)
|
|
8
|
+
- Updated dependencies [bf65028e6]
|
|
9
|
+
- @hi-ui/button@5.0.0-canary.7
|
|
10
|
+
- @hi-ui/popper@5.0.0-canary.4
|
|
11
|
+
|
|
3
12
|
## 5.0.0-canary.8
|
|
4
13
|
|
|
5
14
|
### Minor Changes
|
|
@@ -41,7 +41,7 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
41
41
|
var exceedWidth = 0;
|
|
42
42
|
var _realColumnsWidth = Array.from(measureRowElement.childNodes).map(function (node, index$1) {
|
|
43
43
|
var _a;
|
|
44
|
-
var realWidth = node.getBoundingClientRect().width ||
|
|
44
|
+
var realWidth = node.getBoundingClientRect().width || 60;
|
|
45
45
|
var _ref2 = (_a = columns[index$1]) !== null && _a !== void 0 ? _a : {},
|
|
46
46
|
fixed = _ref2.fixed;
|
|
47
47
|
var width = index.getGroupItemWidth(columns).colWidths[index$1];
|
|
@@ -157,16 +157,14 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
157
157
|
var resizableHandlerWidth = 4;
|
|
158
158
|
var calcMinColWidths = Array.from(headerTableElement.childNodes).map(function (th, index$1) {
|
|
159
159
|
var minColWidth = index.getGroupItemWidth(columns).minColWidths[index$1];
|
|
160
|
-
if (minColWidth && minColWidth > 0) {
|
|
161
|
-
return minColWidth;
|
|
162
|
-
}
|
|
163
160
|
var thPaddingLeft = parseFloat(window.getComputedStyle(th).getPropertyValue('padding-left'));
|
|
164
161
|
var childNodes = Array.from(th.childNodes);
|
|
165
|
-
|
|
162
|
+
var childNodesWidth = childNodes.map(function (child) {
|
|
166
163
|
return child.offsetWidth;
|
|
167
164
|
}).reduce(function (prev, next) {
|
|
168
165
|
return prev + next;
|
|
169
166
|
}, 0) + thPaddingLeft * 2 + resizableHandlerWidth;
|
|
167
|
+
return childNodesWidth > minColWidth ? minColWidth : childNodesWidth;
|
|
170
168
|
});
|
|
171
169
|
setMinColWidths(calcMinColWidths);
|
|
172
170
|
});
|
package/lib/cjs/utils/index.js
CHANGED
|
@@ -79,7 +79,7 @@ var getGroupItemWidth = function getGroupItemWidth(columns) {
|
|
|
79
79
|
}
|
|
80
80
|
// 如果没有设置列宽度,css 宽度默认是 `auto`,这里对于非数字 width 均设置为 0
|
|
81
81
|
var colWidth = typeAssertion.isNumeric(width) ? Number(width) : 0;
|
|
82
|
-
var minColWidth = typeAssertion.isNumeric(minWidth) ? Number(minWidth) :
|
|
82
|
+
var minColWidth = typeAssertion.isNumeric(minWidth) ? Number(minWidth) : colWidth || 60;
|
|
83
83
|
colWidths.push(colWidth < minColWidth ? minColWidth : colWidth);
|
|
84
84
|
minColWidths.push(minColWidth);
|
|
85
85
|
});
|
|
@@ -29,7 +29,7 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
29
29
|
var exceedWidth = 0;
|
|
30
30
|
var _realColumnsWidth = Array.from(measureRowElement.childNodes).map(function (node, index) {
|
|
31
31
|
var _a;
|
|
32
|
-
var realWidth = node.getBoundingClientRect().width ||
|
|
32
|
+
var realWidth = node.getBoundingClientRect().width || 60;
|
|
33
33
|
var _ref2 = (_a = columns[index]) !== null && _a !== void 0 ? _a : {},
|
|
34
34
|
fixed = _ref2.fixed;
|
|
35
35
|
var width = getGroupItemWidth(columns).colWidths[index];
|
|
@@ -145,16 +145,14 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
145
145
|
var resizableHandlerWidth = 4;
|
|
146
146
|
var calcMinColWidths = Array.from(headerTableElement.childNodes).map(function (th, index) {
|
|
147
147
|
var minColWidth = getGroupItemWidth(columns).minColWidths[index];
|
|
148
|
-
if (minColWidth && minColWidth > 0) {
|
|
149
|
-
return minColWidth;
|
|
150
|
-
}
|
|
151
148
|
var thPaddingLeft = parseFloat(window.getComputedStyle(th).getPropertyValue('padding-left'));
|
|
152
149
|
var childNodes = Array.from(th.childNodes);
|
|
153
|
-
|
|
150
|
+
var childNodesWidth = childNodes.map(function (child) {
|
|
154
151
|
return child.offsetWidth;
|
|
155
152
|
}).reduce(function (prev, next) {
|
|
156
153
|
return prev + next;
|
|
157
154
|
}, 0) + thPaddingLeft * 2 + resizableHandlerWidth;
|
|
155
|
+
return childNodesWidth > minColWidth ? minColWidth : childNodesWidth;
|
|
158
156
|
});
|
|
159
157
|
setMinColWidths(calcMinColWidths);
|
|
160
158
|
});
|
package/lib/esm/utils/index.js
CHANGED
|
@@ -74,7 +74,7 @@ var getGroupItemWidth = function getGroupItemWidth(columns) {
|
|
|
74
74
|
}
|
|
75
75
|
// 如果没有设置列宽度,css 宽度默认是 `auto`,这里对于非数字 width 均设置为 0
|
|
76
76
|
var colWidth = isNumeric(width) ? Number(width) : 0;
|
|
77
|
-
var minColWidth = isNumeric(minWidth) ? Number(minWidth) :
|
|
77
|
+
var minColWidth = isNumeric(minWidth) ? Number(minWidth) : colWidth || 60;
|
|
78
78
|
colWidths.push(colWidth < minColWidth ? minColWidth : colWidth);
|
|
79
79
|
minColWidths.push(minColWidth);
|
|
80
80
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hi-ui/table",
|
|
3
|
-
"version": "5.0.0-canary.
|
|
3
|
+
"version": "5.0.0-canary.9",
|
|
4
4
|
"description": "A sub-package for @hi-ui/hiui.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "HiUI <mi-hiui@xiaomi.com>",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@hi-ui/array-utils": "^5.0.0-canary.2",
|
|
48
|
-
"@hi-ui/button": "^5.0.0-canary.
|
|
48
|
+
"@hi-ui/button": "^5.0.0-canary.7",
|
|
49
49
|
"@hi-ui/checkbox": "^5.0.0-canary.2",
|
|
50
50
|
"@hi-ui/classname": "^5.0.0-canary.2",
|
|
51
51
|
"@hi-ui/dom-utils": "^5.0.0-canary.2",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@hi-ui/loading": "^5.0.0-canary.2",
|
|
59
59
|
"@hi-ui/object-utils": "^5.0.0-canary.2",
|
|
60
60
|
"@hi-ui/pagination": "^5.0.0-canary.4",
|
|
61
|
-
"@hi-ui/popper": "^5.0.0-canary.
|
|
61
|
+
"@hi-ui/popper": "^5.0.0-canary.4",
|
|
62
62
|
"@hi-ui/react-utils": "^5.0.0-canary.2",
|
|
63
63
|
"@hi-ui/scrollbar": "^5.0.0-canary.3",
|
|
64
64
|
"@hi-ui/select": "^5.0.0-canary.7",
|