linkmore-design 1.1.27-beta.1 → 1.1.27-beta.2

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.
@@ -909,11 +909,10 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
909
909
  };
910
910
  };
911
911
  } else if (openRowGroup) {
912
- col.onCell = function (record, rowIndex) {
912
+ col.onCell = function (record) {
913
913
  i = _i;
914
914
  return {
915
915
  record: record,
916
- rowIndex: rowIndex,
917
916
  col: col,
918
917
  onChangeRecord: function onChangeRecord() {
919
918
  update();
@@ -3,8 +3,6 @@ export interface IProps {
3
3
  record: Record<string, any>;
4
4
  rowKey: string;
5
5
  col: any;
6
- rowIndex: number;
7
- colIndex: number;
8
6
  [key: string]: any;
9
7
  }
10
8
  declare const CalcExpression: React.FC<IProps>;
@@ -288,12 +288,13 @@ export default function DndContainer(_ref2) {
288
288
  };
289
289
  }, [items]);
290
290
  var isOk = function isOk(active, over) {
291
+ var _a, _b;
291
292
  var item = filterColumns.find(function (item) {
292
293
  return item.title === active.id;
293
294
  });
294
- if (over.id === 'row' || items.row.includes(over.id)) {
295
+ if (over.id === 'row' || ((_a = items === null || items === void 0 ? void 0 : items.row) === null || _a === void 0 ? void 0 : _a.includes(over.id))) {
295
296
  return item && item.rowGroup;
296
- } else if (over.id === 'col' || items.col.includes(over.id)) {
297
+ } else if (over.id === 'col' || ((_b = items === null || items === void 0 ? void 0 : items.col) === null || _b === void 0 ? void 0 : _b.includes(over.id))) {
297
298
  return item && item.colGroup;
298
299
  }
299
300
  return true;
@@ -32,7 +32,13 @@ function getSortInsert(tableHeader, value, _ref) {
32
32
  function getSortDndColumns(value, _ref2) {
33
33
  var columns = _ref2.columns;
34
34
  var tableHeader = value.tableHeader;
35
- var hiddenArr = [].concat(_toConsumableArray(value.row), _toConsumableArray(value.col)) || [];
35
+ var hiddenArr = [];
36
+ if (value.row) {
37
+ hiddenArr = [].concat(_toConsumableArray(hiddenArr), _toConsumableArray(value.row));
38
+ }
39
+ if (value.col) {
40
+ hiddenArr = [].concat(_toConsumableArray(hiddenArr), _toConsumableArray(value.col));
41
+ }
36
42
  if (!tableHeader || !tableHeader.length) {
37
43
  return [];
38
44
  }
@@ -106,16 +112,20 @@ function useDndItems(props) {
106
112
  }, [customizeGroupRowKeys, customizeGroupColKeys]);
107
113
  // 初始化
108
114
  var defaultItems = {
109
- row: [],
110
- col: [],
111
115
  tableHeader: []
112
116
  };
117
+ if (openRowGroup) {
118
+ defaultItems.row = [];
119
+ }
120
+ if (openColGroup) {
121
+ defaultItems.col = [];
122
+ }
113
123
  if (openColGroup || openRowGroup || colSortOpen) {
114
124
  treeFind(columns, function (node) {
115
- if (groupRowKeys.includes(node.dataIndex)) {
116
- defaultItems.row.push(node.title);
125
+ if (openRowGroup && groupRowKeys.includes(node.dataIndex)) {
126
+ defaultItems.row && defaultItems.row.push(node.title);
117
127
  } else if (groupColKeys.includes(node.dataIndex)) {
118
- defaultItems.col.push(node.title);
128
+ defaultItems.col && defaultItems.col.push(node.title);
119
129
  } else {
120
130
  defaultItems.tableHeader.push(node.title);
121
131
  }
@@ -139,8 +149,13 @@ function useDndItems(props) {
139
149
  }, [columns]);
140
150
  // 更新
141
151
  var updateItems = function updateItems(value, resume) {
142
- value.row = value.row.filter(Boolean);
143
- value.col = value.col.filter(Boolean);
152
+ var _a;
153
+ if (value.row) {
154
+ value.row = value === null || value === void 0 ? void 0 : value.row.filter(Boolean);
155
+ }
156
+ if (value.col) {
157
+ value.col = value.col.filter(Boolean);
158
+ }
144
159
  if (resume) {
145
160
  // 删除
146
161
  del(value.row, resume);
@@ -150,7 +165,7 @@ function useDndItems(props) {
150
165
  });
151
166
  }
152
167
  // 列分组进行覆盖,只允许存在一个
153
- if (value.col.length >= 2) {
168
+ if (((_a = value === null || value === void 0 ? void 0 : value.col) === null || _a === void 0 ? void 0 : _a.length) >= 2) {
154
169
  value.tableHeader = getSortInsert(value.tableHeader, items.col[0], {
155
170
  columns: columns
156
171
  });
@@ -93,6 +93,7 @@ function transformWithColGroup(columns, dataSource, groupColKeys, groupRowKeys)
93
93
  * @param {Array<string>} oGroup 数组,列分组的keys值
94
94
  * @param {string} markStr
95
95
  * @returns
96
+ * 2万条数据 393ms
96
97
  */
97
98
  var groupBy = function groupBy(source, columns, oGroup, markStr) {
98
99
  if (!(oGroup === null || oGroup === void 0 ? void 0 : oGroup.length)) {
@@ -909,11 +909,10 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
909
909
  };
910
910
  };
911
911
  } else if (openRowGroup) {
912
- col.onCell = function (record, rowIndex) {
912
+ col.onCell = function (record) {
913
913
  i = _i;
914
914
  return {
915
915
  record: record,
916
- rowIndex: rowIndex,
917
916
  col: col,
918
917
  onChangeRecord: function onChangeRecord() {
919
918
  update();
@@ -3,8 +3,6 @@ export interface IProps {
3
3
  record: Record<string, any>;
4
4
  rowKey: string;
5
5
  col: any;
6
- rowIndex: number;
7
- colIndex: number;
8
6
  [key: string]: any;
9
7
  }
10
8
  declare const CalcExpression: React.FC<IProps>;
@@ -294,12 +294,13 @@ function DndContainer(_ref2) {
294
294
  };
295
295
  }, [items]);
296
296
  var isOk = function isOk(active, over) {
297
+ var _a, _b;
297
298
  var item = filterColumns.find(function (item) {
298
299
  return item.title === active.id;
299
300
  });
300
- if (over.id === 'row' || items.row.includes(over.id)) {
301
+ if (over.id === 'row' || ((_a = items === null || items === void 0 ? void 0 : items.row) === null || _a === void 0 ? void 0 : _a.includes(over.id))) {
301
302
  return item && item.rowGroup;
302
- } else if (over.id === 'col' || items.col.includes(over.id)) {
303
+ } else if (over.id === 'col' || ((_b = items === null || items === void 0 ? void 0 : items.col) === null || _b === void 0 ? void 0 : _b.includes(over.id))) {
303
304
  return item && item.colGroup;
304
305
  }
305
306
  return true;
@@ -39,7 +39,13 @@ function getSortInsert(tableHeader, value, _ref) {
39
39
  function getSortDndColumns(value, _ref2) {
40
40
  var columns = _ref2.columns;
41
41
  var tableHeader = value.tableHeader;
42
- var hiddenArr = [].concat((0, _toConsumableArray2.default)(value.row), (0, _toConsumableArray2.default)(value.col)) || [];
42
+ var hiddenArr = [];
43
+ if (value.row) {
44
+ hiddenArr = [].concat((0, _toConsumableArray2.default)(hiddenArr), (0, _toConsumableArray2.default)(value.row));
45
+ }
46
+ if (value.col) {
47
+ hiddenArr = [].concat((0, _toConsumableArray2.default)(hiddenArr), (0, _toConsumableArray2.default)(value.col));
48
+ }
43
49
  if (!tableHeader || !tableHeader.length) {
44
50
  return [];
45
51
  }
@@ -113,16 +119,20 @@ function useDndItems(props) {
113
119
  }, [customizeGroupRowKeys, customizeGroupColKeys]);
114
120
  // 初始化
115
121
  var defaultItems = {
116
- row: [],
117
- col: [],
118
122
  tableHeader: []
119
123
  };
124
+ if (openRowGroup) {
125
+ defaultItems.row = [];
126
+ }
127
+ if (openColGroup) {
128
+ defaultItems.col = [];
129
+ }
120
130
  if (openColGroup || openRowGroup || colSortOpen) {
121
131
  (0, _index.treeFind)(columns, function (node) {
122
- if (groupRowKeys.includes(node.dataIndex)) {
123
- defaultItems.row.push(node.title);
132
+ if (openRowGroup && groupRowKeys.includes(node.dataIndex)) {
133
+ defaultItems.row && defaultItems.row.push(node.title);
124
134
  } else if (groupColKeys.includes(node.dataIndex)) {
125
- defaultItems.col.push(node.title);
135
+ defaultItems.col && defaultItems.col.push(node.title);
126
136
  } else {
127
137
  defaultItems.tableHeader.push(node.title);
128
138
  }
@@ -146,8 +156,13 @@ function useDndItems(props) {
146
156
  }, [columns]);
147
157
  // 更新
148
158
  var updateItems = function updateItems(value, resume) {
149
- value.row = value.row.filter(Boolean);
150
- value.col = value.col.filter(Boolean);
159
+ var _a;
160
+ if (value.row) {
161
+ value.row = value === null || value === void 0 ? void 0 : value.row.filter(Boolean);
162
+ }
163
+ if (value.col) {
164
+ value.col = value.col.filter(Boolean);
165
+ }
151
166
  if (resume) {
152
167
  // 删除
153
168
  del(value.row, resume);
@@ -157,7 +172,7 @@ function useDndItems(props) {
157
172
  });
158
173
  }
159
174
  // 列分组进行覆盖,只允许存在一个
160
- if (value.col.length >= 2) {
175
+ if (((_a = value === null || value === void 0 ? void 0 : value.col) === null || _a === void 0 ? void 0 : _a.length) >= 2) {
161
176
  value.tableHeader = getSortInsert(value.tableHeader, items.col[0], {
162
177
  columns: columns
163
178
  });
@@ -93,6 +93,7 @@ function transformWithColGroup(columns, dataSource, groupColKeys, groupRowKeys)
93
93
  * @param {Array<string>} oGroup 数组,列分组的keys值
94
94
  * @param {string} markStr
95
95
  * @returns
96
+ * 2万条数据 393ms
96
97
  */
97
98
  var groupBy = function groupBy(source, columns, oGroup, markStr) {
98
99
  if (!(oGroup === null || oGroup === void 0 ? void 0 : oGroup.length)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linkmore-design",
3
- "version": "1.1.27-beta.1",
3
+ "version": "1.1.27-beta.2",
4
4
  "author": {
5
5
  "name": "nowthen",
6
6
  "email": "rnlvwyx@gmail.com"