@hi-ui/table 4.4.0-alpha.8 → 4.4.0

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,27 @@
1
1
  # @hi-ui/table
2
2
 
3
+ ## 4.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#2699](https://github.com/XiaoMi/hiui/pull/2699) [`6c5d9c7ed`](https://github.com/XiaoMi/hiui/commit/6c5d9c7ed21eaebc26638ba6ee54eb3bfe918af4) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: add fixed and rowClassName api
8
+ feat: SettingDrawer 增加 extraHeader showCheckAll itemRender api
9
+ fix: 修复边框模式下样式问题
10
+ feat: SettingDrawer 支持配置列是否禁止拖拽
11
+ fix: 修复 resize 模式下多选时宽度被重置问题
12
+ fix: 修复树形表格节点图标没有对齐问题
13
+ fix: 修复虚拟表格边框样式问题
14
+ fix: 修复虚拟表格下双滚动条问题
15
+ fix: 修复虚拟表格下 size 和 maxHeight 失效问题
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies [[`4ec059bad`](https://github.com/XiaoMi/hiui/commit/4ec059badc67f3facc98288f3e7a67f51938e40f), [`ffd47b89a`](https://github.com/XiaoMi/hiui/commit/ffd47b89a5d7da54ea717fa827123e9c3b2b6d0f), [`cfc37dc37`](https://github.com/XiaoMi/hiui/commit/cfc37dc37c83ce737d88262644c07ca23cde0731), [`2fa5ee5b6`](https://github.com/XiaoMi/hiui/commit/2fa5ee5b6ecc7f95a5224fd91ccfcd263b41d932), [`9cf8e079f`](https://github.com/XiaoMi/hiui/commit/9cf8e079fd3f342d851d7abfecc1c0447c3ac40b)]:
20
+ - @hi-ui/loading@4.2.0
21
+ - @hi-ui/empty-state@4.1.0
22
+ - @hi-ui/tree-utils@4.1.5
23
+ - @hi-ui/scrollbar@4.1.0
24
+
3
25
  ## 4.3.4
4
26
 
5
27
  ### Patch Changes
@@ -36,7 +36,7 @@ var useColWidth = function useColWidth(_ref) {
36
36
  setColWidths = _React$useState[1];
37
37
  var getWidths = React.useCallback(function (measureRowElement) {
38
38
  if (measureRowElement && measureRowElement.childNodes) {
39
- // 超出的宽度,真实的表格宽度超出的每列总和的宽度
39
+ // 超出的宽度,即每列真实的宽度超出设置的宽度的总和
40
40
  var exceedWidth = 0;
41
41
  var _realColumnsWidth = Array.from(measureRowElement.childNodes).map(function (node, index) {
42
42
  var _a;
@@ -51,12 +51,12 @@ var useColWidth = function useColWidth(_ref) {
51
51
  }
52
52
  return realWidth;
53
53
  });
54
- // 如果有多余的宽度,则将多余的宽度平分到没有设置 maxWidth 的列上
54
+ // 如果有多余的宽度,则将多余的宽度平分到没有设置 fixed 的列上
55
55
  if (exceedWidth > 0) {
56
56
  var noFixedColumns = columns.filter(function (item) {
57
57
  return !item.fixed;
58
58
  });
59
- _realColumnsWidth.map(function (item, index) {
59
+ _realColumnsWidth = _realColumnsWidth.map(function (item, index) {
60
60
  if (!columns[index].fixed) {
61
61
  return item + Math.floor(exceedWidth / noFixedColumns.length);
62
62
  }
@@ -105,7 +105,11 @@ var useColWidth = function useColWidth(_ref) {
105
105
  useUpdateEffect.useUpdateEffect(function () {
106
106
  setColWidths(function (prev) {
107
107
  var _a;
108
- return ((_a = measureRowElementRef.current) === null || _a === void 0 ? void 0 : _a.childNodes.length) === prev.length ? getWidths(measureRowElementRef.current) : index.getGroupItemWidth(columns);
108
+ return ((_a = measureRowElementRef.current) === null || _a === void 0 ? void 0 : _a.childNodes.length) === prev.length ?
109
+ // 走更新逻辑
110
+ getWidths(measureRowElementRef.current) :
111
+ // 当列数变化时重新走初始化逻辑
112
+ index.getGroupItemWidth(columns);
109
113
  });
110
114
  }, [columns]);
111
115
  /**
@@ -119,7 +123,7 @@ var useColWidth = function useColWidth(_ref) {
119
123
  setColWidths(getVirtualWidths());
120
124
  } else {
121
125
  // 当第一行有内容时并且没有重新设置列宽时,在去设置列宽
122
- // todo 临时方案:hasResetWidths.current 作用是防止某些浏览器下,下面逻辑死循环
126
+ // Warning hasResetWidths.current 作用是防止某些浏览器下,下面逻辑死循环
123
127
  if ((measureRowElement === null || measureRowElement === void 0 ? void 0 : measureRowElement.childNodes) && hasResetWidths.current === false) {
124
128
  hasResetWidths.current = true;
125
129
  setColWidths(getWidths(measureRowElement));
@@ -24,7 +24,7 @@ var useColWidth = function useColWidth(_ref) {
24
24
  setColWidths = _React$useState[1];
25
25
  var getWidths = useCallback(function (measureRowElement) {
26
26
  if (measureRowElement && measureRowElement.childNodes) {
27
- // 超出的宽度,真实的表格宽度超出的每列总和的宽度
27
+ // 超出的宽度,即每列真实的宽度超出设置的宽度的总和
28
28
  var exceedWidth = 0;
29
29
  var _realColumnsWidth = Array.from(measureRowElement.childNodes).map(function (node, index) {
30
30
  var _a;
@@ -39,12 +39,12 @@ var useColWidth = function useColWidth(_ref) {
39
39
  }
40
40
  return realWidth;
41
41
  });
42
- // 如果有多余的宽度,则将多余的宽度平分到没有设置 maxWidth 的列上
42
+ // 如果有多余的宽度,则将多余的宽度平分到没有设置 fixed 的列上
43
43
  if (exceedWidth > 0) {
44
44
  var noFixedColumns = columns.filter(function (item) {
45
45
  return !item.fixed;
46
46
  });
47
- _realColumnsWidth.map(function (item, index) {
47
+ _realColumnsWidth = _realColumnsWidth.map(function (item, index) {
48
48
  if (!columns[index].fixed) {
49
49
  return item + Math.floor(exceedWidth / noFixedColumns.length);
50
50
  }
@@ -93,7 +93,11 @@ var useColWidth = function useColWidth(_ref) {
93
93
  useUpdateEffect(function () {
94
94
  setColWidths(function (prev) {
95
95
  var _a;
96
- return ((_a = measureRowElementRef.current) === null || _a === void 0 ? void 0 : _a.childNodes.length) === prev.length ? getWidths(measureRowElementRef.current) : getGroupItemWidth(columns);
96
+ return ((_a = measureRowElementRef.current) === null || _a === void 0 ? void 0 : _a.childNodes.length) === prev.length ?
97
+ // 走更新逻辑
98
+ getWidths(measureRowElementRef.current) :
99
+ // 当列数变化时重新走初始化逻辑
100
+ getGroupItemWidth(columns);
97
101
  });
98
102
  }, [columns]);
99
103
  /**
@@ -107,7 +111,7 @@ var useColWidth = function useColWidth(_ref) {
107
111
  setColWidths(getVirtualWidths());
108
112
  } else {
109
113
  // 当第一行有内容时并且没有重新设置列宽时,在去设置列宽
110
- // todo 临时方案:hasResetWidths.current 作用是防止某些浏览器下,下面逻辑死循环
114
+ // Warning hasResetWidths.current 作用是防止某些浏览器下,下面逻辑死循环
111
115
  if ((measureRowElement === null || measureRowElement === void 0 ? void 0 : measureRowElement.childNodes) && hasResetWidths.current === false) {
112
116
  hasResetWidths.current = true;
113
117
  setColWidths(getWidths(measureRowElement));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hi-ui/table",
3
- "version": "4.4.0-alpha.8",
3
+ "version": "4.4.0",
4
4
  "description": "A sub-package for @hi-ui/hiui.",
5
5
  "keywords": [],
6
6
  "author": "HiUI <mi-hiui@xiaomi.com>",
@@ -49,21 +49,21 @@
49
49
  "@hi-ui/classname": "^4.0.4",
50
50
  "@hi-ui/dom-utils": "^4.0.7",
51
51
  "@hi-ui/drawer": "^4.1.3",
52
- "@hi-ui/empty-state": "^4.0.7",
52
+ "@hi-ui/empty-state": "^4.1.0",
53
53
  "@hi-ui/env": "^4.0.4",
54
54
  "@hi-ui/func-utils": "^4.0.4",
55
55
  "@hi-ui/icon-button": "^4.0.8",
56
56
  "@hi-ui/icons": "^4.0.18",
57
- "@hi-ui/loading": "^4.1.3",
57
+ "@hi-ui/loading": "^4.2.0",
58
58
  "@hi-ui/object-utils": "^4.0.4",
59
59
  "@hi-ui/pagination": "^4.0.14",
60
60
  "@hi-ui/popper": "^4.1.3",
61
61
  "@hi-ui/react-utils": "^4.0.4",
62
- "@hi-ui/scrollbar": "^4.1.0-alpha.0",
62
+ "@hi-ui/scrollbar": "^4.1.0",
63
63
  "@hi-ui/select": "^4.2.5",
64
64
  "@hi-ui/spinner": "^4.0.8",
65
65
  "@hi-ui/times": "^4.0.4",
66
- "@hi-ui/tree-utils": "^4.1.4",
66
+ "@hi-ui/tree-utils": "^4.1.5",
67
67
  "@hi-ui/type-assertion": "^4.0.4",
68
68
  "@hi-ui/use-cache": "^4.0.4",
69
69
  "@hi-ui/use-check": "^4.0.5",