linkmore-design 1.0.100 → 1.1.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/dist/LmFilter/filterFns/index.d.ts +5 -5
- package/dist/LmTable/util.d.ts +10 -4
- package/dist/index.umd.js +163 -58
- package/dist/index.umd.min.js +2 -2
- package/dist/variables.css +12504 -0
- package/es/Form/style/form.css +3 -3
- package/es/Form/style/index.css +6063 -3
- package/es/Form/style/tooltip.css +2 -2
- package/es/Form/style/variables.css +6063 -3
- package/es/LmFilter/LmFilter.js +2 -0
- package/es/LmFilter/filterFns/index.d.ts +60 -0
- package/es/LmFilter/filterFns/index.js +72 -102
- package/es/LmTable/Table.js +80 -33
- package/es/LmTable/components/sheelTableCell.js +5 -3
- package/es/LmTable/style/index.css +19 -0
- package/es/LmTable/style/variables.css +19 -0
- package/es/LmTable/util.js +69 -16
- package/es/styles/variables.css +6082 -3
- package/lib/Form/style/form.css +3 -3
- package/lib/Form/style/index.css +6063 -3
- package/lib/Form/style/tooltip.css +2 -2
- package/lib/Form/style/variables.css +6063 -3
- package/lib/LmFilter/LmFilter.js +2 -0
- package/lib/LmFilter/filterFns/index.d.ts +60 -0
- package/lib/LmFilter/filterFns/index.js +41 -54
- package/lib/LmTable/Table.js +80 -33
- package/lib/LmTable/components/sheelTableCell.js +5 -3
- package/lib/LmTable/style/index.css +19 -0
- package/lib/LmTable/style/variables.css +19 -0
- package/lib/LmTable/util.js +69 -16
- package/lib/styles/variables.css +6082 -3
- package/package.json +1 -1
package/es/LmTable/Table.js
CHANGED
|
@@ -59,7 +59,7 @@ var _resetConfig = _interopRequireDefault(require("./resetConfig"));
|
|
|
59
59
|
|
|
60
60
|
var _virTual = require("./virTual");
|
|
61
61
|
|
|
62
|
-
var _excluded = ["columns", "dataSource", "autoSize", "rowClick", "onDoubleClick", "checkConfig", "summary", "pagination", "hiddenPage", "loading", "virtual", "sortOpen", "colSortOpen", "resizeable", "customCheck", "components", "rowSelection", "columnsState", "onChange", "filterChange", "tableRowType", "size", "openSheet", "editSheet", "dataChange", "
|
|
62
|
+
var _excluded = ["columns", "dataSource", "autoSize", "rowClick", "onDoubleClick", "checkConfig", "summary", "pagination", "hiddenPage", "loading", "virtual", "sortOpen", "colSortOpen", "resizeable", "customCheck", "components", "rowSelection", "columnsState", "onChange", "filterChange", "tableRowType", "size", "openSheet", "editSheet", "dataChange", "groupRowKeys", "groupColKeys", "emptyProps"],
|
|
63
63
|
_excluded2 = ["className", "style"],
|
|
64
64
|
_excluded3 = ["onResize", "width", "onResizeStop"];
|
|
65
65
|
var Summary = _proTable.default.Summary;
|
|
@@ -131,9 +131,9 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
131
131
|
_props$editSheet = props.editSheet,
|
|
132
132
|
editSheet = _props$editSheet === void 0 ? false : _props$editSheet,
|
|
133
133
|
dataChange = props.dataChange,
|
|
134
|
-
|
|
134
|
+
groupRowKeys = props.groupRowKeys,
|
|
135
|
+
groupColKeys = props.groupColKeys,
|
|
135
136
|
emptyProps = props.emptyProps,
|
|
136
|
-
columnKeys = props.columnKeys,
|
|
137
137
|
resetProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
138
138
|
var _resetProps$rowKey = resetProps.rowKey,
|
|
139
139
|
rowKey = _resetProps$rowKey === void 0 ? 'id' : _resetProps$rowKey;
|
|
@@ -171,6 +171,12 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
171
171
|
|
|
172
172
|
var deepDataSourceRef = (0, _react.useRef)([]);
|
|
173
173
|
var deepColumnsRef = (0, _react.useRef)([]);
|
|
174
|
+
/** 行分组表格对应数据的隐藏数列表 */
|
|
175
|
+
|
|
176
|
+
var hideListRef = (0, _react.useRef)([]);
|
|
177
|
+
/** 行分组的空行列表数据 */
|
|
178
|
+
|
|
179
|
+
var skipListRef = (0, _react.useRef)([]);
|
|
174
180
|
/** 记录最原始数据 */
|
|
175
181
|
|
|
176
182
|
(0, _react.useEffect)(function () {
|
|
@@ -179,30 +185,33 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
179
185
|
/** 行分组 */
|
|
180
186
|
|
|
181
187
|
var groupDataSource = (0, _react.useMemo)(function () {
|
|
182
|
-
if (!(
|
|
188
|
+
if (!(groupRowKeys === null || groupRowKeys === void 0 ? void 0 : groupRowKeys.length)) {
|
|
183
189
|
return customizeDataSource;
|
|
184
190
|
}
|
|
185
191
|
|
|
186
|
-
return (0, _util.transformWithRowGroup)(customizeDataSource,
|
|
187
|
-
}, [customizeDataSource,
|
|
192
|
+
return (0, _util.transformWithRowGroup)(customizeDataSource, groupRowKeys);
|
|
193
|
+
}, [customizeDataSource, groupRowKeys]);
|
|
188
194
|
/** 列分组 */
|
|
189
195
|
|
|
190
196
|
var _useMemo = (0, _react.useMemo)(function () {
|
|
191
|
-
if (!(
|
|
197
|
+
if (!(groupColKeys === null || groupColKeys === void 0 ? void 0 : groupColKeys.length)) {
|
|
192
198
|
return {
|
|
193
199
|
dataSource: groupDataSource,
|
|
194
200
|
columns: customizeColumns
|
|
195
201
|
};
|
|
196
202
|
}
|
|
197
203
|
|
|
198
|
-
return (0, _util.transformWithColGroup)(customizeColumns, groupDataSource,
|
|
199
|
-
}, [customizeColumns, groupDataSource,
|
|
204
|
+
return (0, _util.transformWithColGroup)(customizeColumns, groupDataSource, groupColKeys);
|
|
205
|
+
}, [customizeColumns, groupDataSource, groupColKeys]),
|
|
200
206
|
columns = _useMemo.columns,
|
|
201
207
|
dataSource = _useMemo.dataSource;
|
|
202
208
|
|
|
203
209
|
(0, _react.useEffect)(function () {
|
|
204
210
|
setExpandedRowKeys([]);
|
|
205
|
-
|
|
211
|
+
deepDataSourceRef.current = [];
|
|
212
|
+
deepColumnsRef.current = [];
|
|
213
|
+
hideListRef.current = [];
|
|
214
|
+
}, [groupRowKeys]);
|
|
206
215
|
/** sheel数据的表格 */
|
|
207
216
|
|
|
208
217
|
var _useState9 = (0, _react.useState)({
|
|
@@ -286,18 +295,46 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
286
295
|
(0, _react.useEffect)(function () {
|
|
287
296
|
var source = [];
|
|
288
297
|
|
|
298
|
+
var dfs = function dfs(children) {
|
|
299
|
+
var num = 0;
|
|
300
|
+
children.forEach(function (item) {
|
|
301
|
+
if (item.children) {
|
|
302
|
+
num += dfs(item.children);
|
|
303
|
+
} else {
|
|
304
|
+
num += 1;
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
return num;
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
var hideList = [];
|
|
311
|
+
|
|
289
312
|
var deepChildren = function deepChildren(arr) {
|
|
290
313
|
arr.forEach(function (item) {
|
|
291
314
|
source.push((0, _lodash.omit)(item, 'children'));
|
|
315
|
+
var prev = hideList.length ? hideList[hideList.length - 1] : 0; // 展开
|
|
292
316
|
|
|
293
317
|
if ((item === null || item === void 0 ? void 0 : item.children) && expandedRowKeys.includes(item.key)) {
|
|
318
|
+
hideList.push(prev);
|
|
294
319
|
deepChildren(item === null || item === void 0 ? void 0 : item.children);
|
|
320
|
+
} // 隐藏
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
if ((item === null || item === void 0 ? void 0 : item.children) && !expandedRowKeys.includes(item.key)) {
|
|
324
|
+
var count = dfs(item.children);
|
|
325
|
+
hideList.push(count + prev);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
if (!(item === null || item === void 0 ? void 0 : item.children)) {
|
|
329
|
+
hideList.push(prev);
|
|
295
330
|
}
|
|
296
331
|
});
|
|
297
332
|
};
|
|
298
333
|
|
|
299
334
|
deepChildren(dataSource);
|
|
300
335
|
deepDataSourceRef.current = source;
|
|
336
|
+
hideListRef.current = hideList;
|
|
337
|
+
skipListRef.current = (0, _util.getSkipList)((groupRowKeys === null || groupRowKeys === void 0 ? void 0 : groupRowKeys.length) ? deepDataSourceRef.current : dataSource);
|
|
301
338
|
}, [dataSource, expandedRowKeys]); // 列分组数据铺平,在框选时获取数据使用
|
|
302
339
|
|
|
303
340
|
(0, _react.useEffect)(function () {
|
|
@@ -315,7 +352,7 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
315
352
|
|
|
316
353
|
deepChildren(columns);
|
|
317
354
|
deepColumnsRef.current = source;
|
|
318
|
-
}, [columns,
|
|
355
|
+
}, [columns, groupColKeys]);
|
|
319
356
|
|
|
320
357
|
var onSortEnd = function onSortEnd(_ref) {
|
|
321
358
|
var oldIndex = _ref.oldIndex,
|
|
@@ -418,8 +455,8 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
418
455
|
return (0, _util.range)(start.j, end.j).map(function (j) {
|
|
419
456
|
var _columns$j, _columns$j2;
|
|
420
457
|
|
|
421
|
-
var columnKey = (
|
|
422
|
-
var dataItem = (
|
|
458
|
+
var columnKey = (groupColKeys === null || groupColKeys === void 0 ? void 0 : groupColKeys.length) ? deepColumnsRef.current[j].dataIndex : (_columns$j = columns[j]) === null || _columns$j === void 0 ? void 0 : _columns$j.dataIndex;
|
|
459
|
+
var dataItem = (groupRowKeys === null || groupRowKeys === void 0 ? void 0 : groupRowKeys.length) ? deepDataSourceRef.current[i] : dataSource[i];
|
|
423
460
|
var cell = dataItem === null || dataItem === void 0 ? void 0 : dataItem[columnKey];
|
|
424
461
|
|
|
425
462
|
if ((_columns$j2 = columns[j]) === null || _columns$j2 === void 0 ? void 0 : _columns$j2.render) {
|
|
@@ -514,14 +551,13 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
514
551
|
end = _shellStatusRef$curre10.end,
|
|
515
552
|
commiting = _shellStatusRef$curre10.commiting; //
|
|
516
553
|
|
|
517
|
-
var innerColumns = (
|
|
518
|
-
var innerDataSource = (
|
|
554
|
+
var innerColumns = (groupColKeys === null || groupColKeys === void 0 ? void 0 : groupColKeys.length) ? deepColumnsRef.current : columns;
|
|
555
|
+
var innerDataSource = (groupRowKeys === null || groupRowKeys === void 0 ? void 0 : groupRowKeys.length) ? deepDataSourceRef.current : dataSource; //
|
|
519
556
|
|
|
520
557
|
var columnsKeysList = innerColumns.map(function (item) {
|
|
521
558
|
return item.dataIndex;
|
|
522
|
-
}); //
|
|
559
|
+
}); // 空行值数组
|
|
523
560
|
|
|
524
|
-
var skipList = (0, _util.getSkipList)(innerDataSource);
|
|
525
561
|
var rowtext = (0, _util.getSelectionRowText)({
|
|
526
562
|
selection: commiting,
|
|
527
563
|
columnsKeysList: columnsKeysList,
|
|
@@ -574,9 +610,20 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
574
610
|
|
|
575
611
|
if ((_isSelected = isSelected(tri, tdj)) === null || _isSelected === void 0 ? void 0 : _isSelected.isSelected) {
|
|
576
612
|
var key = columnsKeysList[tdj];
|
|
577
|
-
var sourceIndex
|
|
613
|
+
var sourceIndex; // 列分组的情况下
|
|
614
|
+
|
|
615
|
+
if (groupColKeys === null || groupColKeys === void 0 ? void 0 : groupColKeys.length) {
|
|
616
|
+
sourceIndex = (0, _util.getDataSourceIndex)({
|
|
617
|
+
key: key,
|
|
618
|
+
dataSource: dataSource
|
|
619
|
+
});
|
|
620
|
+
var arr = key.split('_');
|
|
621
|
+
key = arr[arr.length - 2];
|
|
622
|
+
} else {
|
|
623
|
+
sourceIndex = tri - skipListRef.current[tri] + hideListRef.current[tri];
|
|
624
|
+
}
|
|
578
625
|
|
|
579
|
-
if (sourceIndex < 0) {
|
|
626
|
+
if (sourceIndex < 0 || sourceIndex >= data.length) {
|
|
580
627
|
return;
|
|
581
628
|
} // 行替换
|
|
582
629
|
|
|
@@ -654,7 +701,6 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
654
701
|
j: Math.max(start.j, end.j)
|
|
655
702
|
};
|
|
656
703
|
var parse = defaultParsePaste;
|
|
657
|
-
var changes = [];
|
|
658
704
|
var pasteData = [];
|
|
659
705
|
|
|
660
706
|
if (window.clipboardData && window.clipboardData.getData) {
|
|
@@ -662,9 +708,8 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
662
708
|
pasteData = parse(window.clipboardData.getData('Text'));
|
|
663
709
|
} else if (e.clipboardData && e.clipboardData.getData) {
|
|
664
710
|
pasteData = parse(e.clipboardData.getData('text/plain'));
|
|
665
|
-
}
|
|
711
|
+
} // in order of preference
|
|
666
712
|
|
|
667
|
-
var data = dataSourceRef.current; // in order of preference
|
|
668
713
|
|
|
669
714
|
var resultEnd = [];
|
|
670
715
|
pasteData.forEach(function (row, i) {
|
|
@@ -837,8 +882,10 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
837
882
|
};
|
|
838
883
|
|
|
839
884
|
var dataSourceChange = function dataSourceChange(i, j, newRecord) {
|
|
885
|
+
// 表格中的行数 转化为 对应的数据源索引
|
|
886
|
+
var rowIndex = i - skipListRef.current[i] + hideListRef.current[i];
|
|
840
887
|
var res = (0, _immer.produce)(dataSourceRef.current, function (draft) {
|
|
841
|
-
draft[
|
|
888
|
+
draft[rowIndex] = newRecord;
|
|
842
889
|
});
|
|
843
890
|
dataChange === null || dataChange === void 0 ? void 0 : dataChange(res);
|
|
844
891
|
shellStatusRef.current = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, shellStatusRef.current), {}, {
|
|
@@ -911,18 +958,19 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
911
958
|
var innerColumns = (0, _lodash.cloneDeep)(useColumns);
|
|
912
959
|
traverseColumns(innerColumns, null);
|
|
913
960
|
|
|
914
|
-
if (
|
|
961
|
+
if (groupRowKeys === null || groupRowKeys === void 0 ? void 0 : groupRowKeys.length) {
|
|
915
962
|
/** 如果是进行了行分组,则会生成一列dataIndex为Group的Col, 如果需要修改此处,请备注原因 */
|
|
916
963
|
innerColumns = [{
|
|
917
964
|
type: 'name',
|
|
918
965
|
title: '分组',
|
|
966
|
+
dataIndex: '_group',
|
|
919
967
|
key: '_group',
|
|
920
|
-
|
|
968
|
+
width: 100
|
|
921
969
|
}].concat((0, _toConsumableArray2.default)(innerColumns));
|
|
922
970
|
}
|
|
923
971
|
|
|
924
972
|
return sortOpen ? [sortDefaultColumnItem].concat((0, _toConsumableArray2.default)(innerColumns)) : innerColumns;
|
|
925
|
-
}, [useColumns, sortOpen, selectIng, dataSource,
|
|
973
|
+
}, [useColumns, sortOpen, selectIng, dataSource, groupRowKeys, commitIng]);
|
|
926
974
|
(0, _react.useEffect)(function () {
|
|
927
975
|
setColumns(columns);
|
|
928
976
|
}, [columns]); // 行点击事件
|
|
@@ -1014,8 +1062,8 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1014
1062
|
}),
|
|
1015
1063
|
|
|
1016
1064
|
/** 如果开启了行分组,则需要把checkStrictly关闭,变成受控模式 */
|
|
1017
|
-
checkStrictly: !
|
|
1018
|
-
onChange: function onChange(selectedRowKeys, selectedRows
|
|
1065
|
+
checkStrictly: !(groupRowKeys === null || groupRowKeys === void 0 ? void 0 : groupRowKeys.length),
|
|
1066
|
+
onChange: function onChange(selectedRowKeys, selectedRows) {
|
|
1019
1067
|
setSelectedRows({
|
|
1020
1068
|
selectedRows: selectedRows
|
|
1021
1069
|
});
|
|
@@ -1024,7 +1072,7 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1024
1072
|
}, rowSelection),
|
|
1025
1073
|
onRow: function onRow(record) {
|
|
1026
1074
|
return {
|
|
1027
|
-
onClick: function onClick(
|
|
1075
|
+
onClick: function onClick() {
|
|
1028
1076
|
onRecord(record);
|
|
1029
1077
|
},
|
|
1030
1078
|
onDoubleClick: function onDoubleClick() {
|
|
@@ -1223,7 +1271,7 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1223
1271
|
dataSource: dataSource,
|
|
1224
1272
|
components: tableComponents,
|
|
1225
1273
|
onChange: onTableChange,
|
|
1226
|
-
expandable: {
|
|
1274
|
+
expandable: (resetProps === null || resetProps === void 0 ? void 0 : resetProps.expandable) || {
|
|
1227
1275
|
onExpand: function onExpand() {
|
|
1228
1276
|
shellStatusRef.current = {
|
|
1229
1277
|
start: {},
|
|
@@ -1249,7 +1297,7 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1249
1297
|
dataSource: dataSource,
|
|
1250
1298
|
components: tableComponents,
|
|
1251
1299
|
onChange: onTableChange,
|
|
1252
|
-
expandable: {
|
|
1300
|
+
expandable: (resetProps === null || resetProps === void 0 ? void 0 : resetProps.expandable) || {
|
|
1253
1301
|
onExpand: function onExpand() {
|
|
1254
1302
|
shellStatusRef.current = {
|
|
1255
1303
|
start: {},
|
|
@@ -1361,8 +1409,7 @@ var ResizeSize = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1361
1409
|
return h;
|
|
1362
1410
|
}, [props.hiddenPage, props.customCheck, props.columns, tableSize]);
|
|
1363
1411
|
var throttleSize = (0, _react.useCallback)(function () {
|
|
1364
|
-
var width = tableSize.width
|
|
1365
|
-
height = tableSize.height;
|
|
1412
|
+
var width = tableSize.width;
|
|
1366
1413
|
return /*#__PURE__*/_react.default.createElement(ResetTable, (0, _extends2.default)({
|
|
1367
1414
|
ref: defaultRef
|
|
1368
1415
|
}, props, {
|
|
@@ -124,13 +124,16 @@ var SheelTabelCell = function SheelTabelCell(props) {
|
|
|
124
124
|
|
|
125
125
|
var renderEditor = function renderEditor() {
|
|
126
126
|
if (isEditing) {
|
|
127
|
+
console.log(isEditing, '-----isEditing-----');
|
|
127
128
|
var Editor = (col === null || col === void 0 ? void 0 : col.dataEditor) || InputDataEdit;
|
|
128
129
|
return /*#__PURE__*/React.createElement(Editor, {
|
|
129
130
|
cell: col,
|
|
130
131
|
row: rowIndex,
|
|
131
132
|
col: colIndex,
|
|
132
133
|
value: value,
|
|
133
|
-
onChange:
|
|
134
|
+
onChange: function onChange(value) {
|
|
135
|
+
setValue(value);
|
|
136
|
+
},
|
|
134
137
|
handleSave: saveRenderValue
|
|
135
138
|
});
|
|
136
139
|
}
|
|
@@ -142,12 +145,11 @@ var SheelTabelCell = function SheelTabelCell(props) {
|
|
|
142
145
|
var content = renderComponent() || renderEditor() || renderViewer;
|
|
143
146
|
return /*#__PURE__*/React.createElement("td", Object.assign({}, omit(clearProps, ['commitIng', 'editIng']), {
|
|
144
147
|
// style={{ userSelect: 'none' }}
|
|
145
|
-
className: cls('unselection', sd && selectIng && 'selected', isEnd && 'end', isRightEnd && 'right_end', isEditing && 'editing', isVaildCommit && 'commiting'),
|
|
148
|
+
className: cls(colIndex === undefined && 'row_selection_td', 'unselection', sd && selectIng && 'selected', isEnd && 'end', isRightEnd && 'right_end', isEditing && 'editing', isVaildCommit && 'commiting'),
|
|
146
149
|
onMouseDown: handleMouseDown,
|
|
147
150
|
onMouseOver: handleMouseOver,
|
|
148
151
|
onContextMenu: handleContextMenu,
|
|
149
152
|
onDoubleClick: handleDoubleClick,
|
|
150
|
-
// onKeyUp={onKeyUp}
|
|
151
153
|
key: "".concat(rowIndex, "_").concat(colIndex)
|
|
152
154
|
}), content, isRightEnd && isEnd && !isEditing && /*#__PURE__*/React.createElement("div", {
|
|
153
155
|
ref: endCellRef,
|
|
@@ -888,6 +888,10 @@ p {
|
|
|
888
888
|
color: inherit;
|
|
889
889
|
background: inherit;
|
|
890
890
|
}
|
|
891
|
+
#lm_protable_warp .lm_protable .ant-table td.unselection.row_selection_td:first-child {
|
|
892
|
+
z-index: 1;
|
|
893
|
+
background-color: #fff;
|
|
894
|
+
}
|
|
891
895
|
#lm_protable_warp .lm_protable .ant-table td.selected,
|
|
892
896
|
#lm_protable_warp .lm_protable .ant-table td.editing {
|
|
893
897
|
border: 1px solid var(--primary-color);
|
|
@@ -1570,6 +1574,21 @@ p {
|
|
|
1570
1574
|
.ant-table.ant-table-middle tfoot > tr > td {
|
|
1571
1575
|
padding: 12px 8px !important;
|
|
1572
1576
|
}
|
|
1577
|
+
button.ant-table-row-expand-icon,
|
|
1578
|
+
button.ant-table-row-expand-icon:focus {
|
|
1579
|
+
border-color: #bfbfbf;
|
|
1580
|
+
}
|
|
1581
|
+
button.ant-table-row-expand-icon:hover {
|
|
1582
|
+
border-color: #40a9ff;
|
|
1583
|
+
}
|
|
1584
|
+
button.ant-table-row-expand-icon:hover::before,
|
|
1585
|
+
button.ant-table-row-expand-icon:hover::after {
|
|
1586
|
+
color: #40a9ff;
|
|
1587
|
+
}
|
|
1588
|
+
button.ant-table-row-expand-icon::before,
|
|
1589
|
+
button.ant-table-row-expand-icon::after {
|
|
1590
|
+
color: #bfbfbf;
|
|
1591
|
+
}
|
|
1573
1592
|
.ant-table-tbody > tr.ant-table-measure-row > td {
|
|
1574
1593
|
padding: 0 !important;
|
|
1575
1594
|
}
|
|
@@ -377,6 +377,10 @@
|
|
|
377
377
|
color: inherit;
|
|
378
378
|
background: inherit;
|
|
379
379
|
}
|
|
380
|
+
#lm_protable_warp .lm_protable .ant-table td.unselection.row_selection_td:first-child {
|
|
381
|
+
z-index: 1;
|
|
382
|
+
background-color: #fff;
|
|
383
|
+
}
|
|
380
384
|
#lm_protable_warp .lm_protable .ant-table td.selected,
|
|
381
385
|
#lm_protable_warp .lm_protable .ant-table td.editing {
|
|
382
386
|
border: 1px solid var(--primary-color);
|
|
@@ -1059,6 +1063,21 @@
|
|
|
1059
1063
|
.ant-table.ant-table-middle tfoot > tr > td {
|
|
1060
1064
|
padding: 12px 8px !important;
|
|
1061
1065
|
}
|
|
1066
|
+
button.ant-table-row-expand-icon,
|
|
1067
|
+
button.ant-table-row-expand-icon:focus {
|
|
1068
|
+
border-color: #bfbfbf;
|
|
1069
|
+
}
|
|
1070
|
+
button.ant-table-row-expand-icon:hover {
|
|
1071
|
+
border-color: #40a9ff;
|
|
1072
|
+
}
|
|
1073
|
+
button.ant-table-row-expand-icon:hover::before,
|
|
1074
|
+
button.ant-table-row-expand-icon:hover::after {
|
|
1075
|
+
color: #40a9ff;
|
|
1076
|
+
}
|
|
1077
|
+
button.ant-table-row-expand-icon::before,
|
|
1078
|
+
button.ant-table-row-expand-icon::after {
|
|
1079
|
+
color: #bfbfbf;
|
|
1080
|
+
}
|
|
1062
1081
|
.ant-table-tbody > tr.ant-table-measure-row > td {
|
|
1063
1082
|
padding: 0 !important;
|
|
1064
1083
|
}
|
package/es/LmTable/util.js
CHANGED
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.checkIsSelectd = checkIsSelectd;
|
|
9
9
|
exports.checkStatus = checkStatus;
|
|
10
|
+
exports.getDataSourceIndex = getDataSourceIndex;
|
|
10
11
|
exports.getSelectionColText = getSelectionColText;
|
|
11
12
|
exports.getSelectionRowText = getSelectionRowText;
|
|
12
13
|
exports.getSkipList = getSkipList;
|
|
@@ -66,13 +67,13 @@ function dataGroup(data, key) {
|
|
|
66
67
|
* 列分组数据转换
|
|
67
68
|
* @param columns 表格的columns属性值
|
|
68
69
|
* @param dataSource 表格数据源
|
|
69
|
-
* @param
|
|
70
|
+
* @param groupColKeys 列分组的keys
|
|
70
71
|
* @returns
|
|
71
72
|
*/
|
|
72
73
|
|
|
73
74
|
|
|
74
|
-
function transformWithColGroup(columns, dataSource,
|
|
75
|
-
if (!Array.isArray(
|
|
75
|
+
function transformWithColGroup(columns, dataSource, groupColKeys) {
|
|
76
|
+
if (!Array.isArray(groupColKeys) || !groupColKeys.length) {
|
|
76
77
|
return {
|
|
77
78
|
columns: columns,
|
|
78
79
|
dataSource: dataSource
|
|
@@ -84,7 +85,7 @@ function transformWithColGroup(columns, dataSource, columnKeys) {
|
|
|
84
85
|
var dataSourceCopy = _lodash.default.cloneDeep(dataSource); // 去重
|
|
85
86
|
|
|
86
87
|
|
|
87
|
-
var
|
|
88
|
+
var groupColKeysCopy = (0, _toConsumableArray2.default)(new Set(groupColKeys));
|
|
88
89
|
/**
|
|
89
90
|
* @param {Array} source source数据源,树状结构,行分组会有children子级结构
|
|
90
91
|
* @param {Array} columns 列数据,用于表头,当列分组时会有children子级结构
|
|
@@ -101,7 +102,7 @@ function transformWithColGroup(columns, dataSource, columnKeys) {
|
|
|
101
102
|
source.forEach(function (souItem, i) {
|
|
102
103
|
handledColumns = handledColumns.concat(columns.filter(function (c) {
|
|
103
104
|
// 过滤掉(表头操作) 使用列分组作为key的项
|
|
104
|
-
return
|
|
105
|
+
return groupColKeysCopy.indexOf(c.dataIndex) === -1;
|
|
105
106
|
}).map(function (item) {
|
|
106
107
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
|
|
107
108
|
dataIndex: "".concat(markStr, "_").concat(item.dataIndex, "_").concat(i)
|
|
@@ -126,7 +127,7 @@ function transformWithColGroup(columns, dataSource, columnKeys) {
|
|
|
126
127
|
});
|
|
127
128
|
};
|
|
128
129
|
|
|
129
|
-
var tempColumns = groupBy(dataSourceCopy, columnsCopy,
|
|
130
|
+
var tempColumns = groupBy(dataSourceCopy, columnsCopy, groupColKeysCopy, null);
|
|
130
131
|
var keyMap = new Map();
|
|
131
132
|
|
|
132
133
|
var dataSourceBy = function dataSourceBy(source) {
|
|
@@ -142,7 +143,7 @@ function transformWithColGroup(columns, dataSource, columnKeys) {
|
|
|
142
143
|
} else {
|
|
143
144
|
var str = ''; // 根据筛选条件生成对应的前缀key值,比如[name, age] => 'name_xiaoming_age_18'
|
|
144
145
|
|
|
145
|
-
|
|
146
|
+
groupColKeysCopy.forEach(function (dataIndex, i) {
|
|
146
147
|
if (i !== 0) {
|
|
147
148
|
str += '_';
|
|
148
149
|
}
|
|
@@ -163,6 +164,7 @@ function transformWithColGroup(columns, dataSource, columnKeys) {
|
|
|
163
164
|
}
|
|
164
165
|
|
|
165
166
|
sItem[newKey] = sItem[key];
|
|
167
|
+
sItem["".concat(newKey, "_originIndex")] = sItem.__index;
|
|
166
168
|
});
|
|
167
169
|
}
|
|
168
170
|
|
|
@@ -183,32 +185,44 @@ function transformWithColGroup(columns, dataSource, columnKeys) {
|
|
|
183
185
|
/**
|
|
184
186
|
* 行分组
|
|
185
187
|
* @param {Array} dataSource 数据源
|
|
186
|
-
* @param {Array}
|
|
188
|
+
* @param {Array} groupRowKeys 行分组的keys
|
|
187
189
|
* @returns
|
|
188
190
|
*/
|
|
189
191
|
|
|
190
192
|
|
|
191
|
-
function transformWithRowGroup(dataSource,
|
|
192
|
-
var groupBy = function groupBy(lastFilter, oGroup) {
|
|
193
|
+
function transformWithRowGroup(dataSource, groupRowKeys) {
|
|
194
|
+
var groupBy = function groupBy(lastFilter, oGroup, preKey) {
|
|
193
195
|
if (!(oGroup === null || oGroup === void 0 ? void 0 : oGroup.length)) return lastFilter;
|
|
194
196
|
var group = oGroup.slice();
|
|
195
|
-
var filterKey = group.shift();
|
|
197
|
+
var filterKey = group.shift(); // i:保证顺序
|
|
198
|
+
|
|
199
|
+
var i = 0;
|
|
196
200
|
var map = lastFilter.reduce(function (acc, el) {
|
|
201
|
+
el.__index = i;
|
|
202
|
+
i += 1;
|
|
197
203
|
var value = el[filterKey];
|
|
198
204
|
acc[value] = [].concat((0, _toConsumableArray2.default)(acc[value] || []), [el]);
|
|
199
205
|
return acc;
|
|
200
206
|
}, {});
|
|
201
207
|
return Object.keys(map).map(function (item) {
|
|
208
|
+
var key;
|
|
209
|
+
|
|
210
|
+
if (preKey) {
|
|
211
|
+
key = "".concat(preKey, "_").concat(filterKey, "_").concat(item);
|
|
212
|
+
} else {
|
|
213
|
+
key = "".concat(filterKey, "_").concat(item);
|
|
214
|
+
}
|
|
215
|
+
|
|
202
216
|
return {
|
|
203
217
|
type: filterKey,
|
|
204
218
|
_group: item,
|
|
205
|
-
key:
|
|
206
|
-
children: groupBy(map[item], group)
|
|
219
|
+
key: key,
|
|
220
|
+
children: groupBy(map[item], group, key)
|
|
207
221
|
};
|
|
208
222
|
});
|
|
209
223
|
};
|
|
210
224
|
|
|
211
|
-
return groupBy(dataSource,
|
|
225
|
+
return groupBy(dataSource, groupRowKeys);
|
|
212
226
|
}
|
|
213
227
|
|
|
214
228
|
function checkIsSelectd(i, j) {
|
|
@@ -243,10 +257,10 @@ function checkStatus(i, j, commiting) {
|
|
|
243
257
|
function getSkipList(dataSourceWithGroup) {
|
|
244
258
|
var skipList = dataSourceWithGroup.reduce(function (prev, cur) {
|
|
245
259
|
if (!prev.length) {
|
|
246
|
-
return cur.
|
|
260
|
+
return cur._group ? [1] : [0];
|
|
247
261
|
}
|
|
248
262
|
|
|
249
|
-
if (cur.
|
|
263
|
+
if (cur._group) {
|
|
250
264
|
return [].concat((0, _toConsumableArray2.default)(prev), [prev[prev.length - 1] + 1]);
|
|
251
265
|
}
|
|
252
266
|
|
|
@@ -309,4 +323,43 @@ function getSelectionColText(_ref2) {
|
|
|
309
323
|
});
|
|
310
324
|
});
|
|
311
325
|
return coltext;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* 获取key所对应的原始数据的索引
|
|
329
|
+
* @param {Object} {key, dataSource}
|
|
330
|
+
* @returns {number}
|
|
331
|
+
*/
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
function getDataSourceIndex(_ref3) {
|
|
335
|
+
var key = _ref3.key,
|
|
336
|
+
_ref3$dataSource = _ref3.dataSource,
|
|
337
|
+
dataSource = _ref3$dataSource === void 0 ? [] : _ref3$dataSource;
|
|
338
|
+
var index = -1;
|
|
339
|
+
|
|
340
|
+
var dfs = function dfs(arr) {
|
|
341
|
+
if (!Array.isArray(arr)) {
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
if (index !== -1) {
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
for (var i = 0; i < arr.length; i += 1) {
|
|
350
|
+
var item = arr[i];
|
|
351
|
+
|
|
352
|
+
if (item["".concat(key, "_originIndex")] !== undefined) {
|
|
353
|
+
index = item["".concat(key, "_originIndex")];
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
if (item.children) {
|
|
358
|
+
dfs(item.children);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
dfs(dataSource);
|
|
364
|
+
return index;
|
|
312
365
|
}
|