@hsu-react/ui 0.0.3 → 0.0.4

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.
@@ -15,6 +15,8 @@ interface TableTools {
15
15
  columnMgt?: IColumnMgt;
16
16
  }
17
17
  export interface ListPanelTabelProps extends Omit<TableProps, "title"> {
18
+ /** 透传给内部 Table 的 key,用于在异构列集切换时强制重挂载表格 */
19
+ key?: React.Key;
18
20
  title?: string;
19
21
  buttonGroup?: ButtonProps[];
20
22
  tabBarProps?: TabBarProps;
@@ -1,5 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["title", "buttonGroup", "className", "columns", "tabBarProps", "tableTools", "tableContainerClassName", "tips", "otherTool"],
2
+ var _excluded = ["title", "buttonGroup", "className", "columns", "tabBarProps", "tableTools", "tableContainerClassName", "tips", "otherTool", "key"],
3
3
  _excluded2 = ["className"];
4
4
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
5
5
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -75,6 +75,7 @@ var ListPanel = function ListPanel(props) {
75
75
  tableContainerClassName = tableProps.tableContainerClassName,
76
76
  tips = tableProps.tips,
77
77
  otherTool = tableProps.otherTool,
78
+ tableInstanceKey = tableProps.key,
78
79
  tableConfig = _objectWithoutProperties(tableProps, _excluded);
79
80
  var treeClassName = treeProps.className,
80
81
  treeConfig = _objectWithoutProperties(treeProps, _excluded2);
@@ -314,7 +315,7 @@ var ListPanel = function ListPanel(props) {
314
315
  fillPanel: true
315
316
  }, tableConfig), {}, {
316
317
  columns: _columns
317
- })))]
318
+ })), tableInstanceKey)]
318
319
  })]
319
320
  })]
320
321
  }), /*#__PURE__*/_jsx(ColumnMgt, _objectSpread({
@@ -15,6 +15,8 @@ interface TableTools {
15
15
  columnMgt?: IColumnMgt;
16
16
  }
17
17
  export interface ListPanelTabelProps extends Omit<TableProps, "title"> {
18
+ /** 透传给内部 Table 的 key,用于在异构列集切换时强制重挂载表格 */
19
+ key?: React.Key;
18
20
  title?: string;
19
21
  buttonGroup?: ButtonProps[];
20
22
  tabBarProps?: TabBarProps;
@@ -56,6 +56,9 @@ const ListPanel = props => {
56
56
  tableContainerClassName,
57
57
  tips,
58
58
  otherTool,
59
+ // 异构列集切换时用于强制重挂载表格的 key;显式提取,避免随 ...tableConfig
60
+ // 展开进 JSX 触发 React "key prop being spread" 警告
61
+ key: tableInstanceKey,
59
62
  ...tableConfig
60
63
  } = tableProps;
61
64
  const {
@@ -286,7 +289,7 @@ const ListPanel = props => {
286
289
  fillPanel: true,
287
290
  ...tableConfig,
288
291
  columns: _columns
289
- })]
292
+ }, tableInstanceKey)]
290
293
  })]
291
294
  })]
292
295
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ColumnMgt.default, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hsu-react/ui",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "一套基于 React + Ant Design 的中后台业务组件库",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -36,6 +36,8 @@ interface TableTools {
36
36
  }
37
37
 
38
38
  export interface ListPanelTabelProps extends Omit<TableProps, "title"> {
39
+ /** 透传给内部 Table 的 key,用于在异构列集切换时强制重挂载表格 */
40
+ key?: React.Key;
39
41
  title?: string;
40
42
  buttonGroup?: ButtonProps[];
41
43
  tabBarProps?: TabBarProps;
@@ -127,6 +129,9 @@ const ListPanel: ListPanelFC = (props) => {
127
129
  tableContainerClassName,
128
130
  tips,
129
131
  otherTool,
132
+ // 异构列集切换时用于强制重挂载表格的 key;显式提取,避免随 ...tableConfig
133
+ // 展开进 JSX 触发 React "key prop being spread" 警告
134
+ key: tableInstanceKey,
130
135
  ...tableConfig
131
136
  } = tableProps;
132
137
  const { className: treeClassName, ...treeConfig } = treeProps;
@@ -435,6 +440,7 @@ const ListPanel: ListPanelFC = (props) => {
435
440
  otherTool={otherTool}
436
441
  />
437
442
  <Table
443
+ key={tableInstanceKey}
438
444
  className={`${styles.table} ${tableClassName ?? ""}`}
439
445
  {...{
440
446
  scroll: true,