linkmore-design 1.1.28-alpha.5 → 1.1.28-alpha.7
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/index.umd.js +132 -105
- package/dist/index.umd.min.js +1 -1
- package/dist/variables.css +1 -6
- package/es/CustomTableOption/columnsSort.js +2 -3
- package/es/LmEditTable/EditTable.js +120 -92
- package/es/LmEditTable/style/index.css +1 -6
- package/es/LmEditTable/style/variables.css +1 -6
- package/es/LmEditTable/util.js +2 -2
- package/es/styles/variables.css +1 -6
- package/lib/CustomTableOption/columnsSort.js +2 -3
- package/lib/LmEditTable/EditTable.js +120 -92
- package/lib/LmEditTable/style/index.css +1 -6
- package/lib/LmEditTable/style/variables.css +1 -6
- package/lib/LmEditTable/util.js +2 -2
- package/lib/styles/variables.css +1 -6
- package/package.json +1 -1
|
@@ -591,7 +591,13 @@ var EditableCell = function EditableCell(props) {
|
|
|
591
591
|
onClick: toggleEdit
|
|
592
592
|
}, childNode);
|
|
593
593
|
} else if (isEdit && editable) {
|
|
594
|
-
childNode = /*#__PURE__*/_react.default.createElement(
|
|
594
|
+
childNode = /*#__PURE__*/_react.default.createElement("div", {
|
|
595
|
+
style: {
|
|
596
|
+
display: 'flex',
|
|
597
|
+
flexDirection: 'row',
|
|
598
|
+
flexWrap: 'nowrap'
|
|
599
|
+
}
|
|
600
|
+
}, (0, _util.isExpandRow)(childNode) && childNode[0], /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Form.Item, Object.assign({
|
|
595
601
|
errorPlacement: "right",
|
|
596
602
|
valuePropName: editable === 'switch' ? 'checked' : 'value',
|
|
597
603
|
style: {
|
|
@@ -603,7 +609,13 @@ var EditableCell = function EditableCell(props) {
|
|
|
603
609
|
}), Control(editable)));
|
|
604
610
|
|
|
605
611
|
if (editable === 'input' && ((resultComponentProps === null || resultComponentProps === void 0 ? void 0 : resultComponentProps.addonBefore) || (resultComponentProps === null || resultComponentProps === void 0 ? void 0 : resultComponentProps.addonAfter))) {
|
|
606
|
-
childNode = /*#__PURE__*/_react.default.createElement(
|
|
612
|
+
childNode = /*#__PURE__*/_react.default.createElement("div", {
|
|
613
|
+
style: {
|
|
614
|
+
display: 'flex',
|
|
615
|
+
flexDirection: 'row',
|
|
616
|
+
flexWrap: 'nowrap'
|
|
617
|
+
}
|
|
618
|
+
}, (0, _util.isExpandRow)(childNode) && childNode[0], /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Form.Item, Object.assign({
|
|
607
619
|
errorPlacement: "right",
|
|
608
620
|
style: {
|
|
609
621
|
margin: 0
|
|
@@ -808,80 +820,7 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
808
820
|
draft.push(Object.assign((0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())), addDataInfo || {}));
|
|
809
821
|
});
|
|
810
822
|
setDataSource(res);
|
|
811
|
-
}, 40);
|
|
812
|
-
|
|
813
|
-
var handleSave = function handleSave(row, options) {
|
|
814
|
-
var _a, _b;
|
|
815
|
-
|
|
816
|
-
var preKeys = (_b = (_a = deepDataSourceRef === null || deepDataSourceRef === void 0 ? void 0 : deepDataSourceRef.current) === null || _a === void 0 ? void 0 : _a[row[_rowKey]]) === null || _b === void 0 ? void 0 : _b.preKeys;
|
|
817
|
-
var res = (0, _immer.produce)(dataSourceRef.current, function (draft) {
|
|
818
|
-
if (options === null || options === void 0 ? void 0 : options.only) {
|
|
819
|
-
var _ref = options === null || options === void 0 ? void 0 : options.only,
|
|
820
|
-
key = _ref.key,
|
|
821
|
-
value = _ref.value;
|
|
822
|
-
|
|
823
|
-
if ((preKeys === null || preKeys === void 0 ? void 0 : preKeys.length) > 1) {
|
|
824
|
-
var deeps = function deeps(children) {
|
|
825
|
-
children === null || children === void 0 ? void 0 : children.forEach(function (item) {
|
|
826
|
-
var _a;
|
|
827
|
-
|
|
828
|
-
if (preKeys.includes(item[_rowKey])) {
|
|
829
|
-
if (item[_rowKey] === row[_rowKey]) {
|
|
830
|
-
children === null || children === void 0 ? void 0 : children.forEach(function (c) {
|
|
831
|
-
c[key] = value;
|
|
832
|
-
});
|
|
833
|
-
(_a = Object.keys(item)) === null || _a === void 0 ? void 0 : _a.forEach(function (v) {
|
|
834
|
-
item[v] = row[v] || item[v];
|
|
835
|
-
});
|
|
836
|
-
} else if (item.children) {
|
|
837
|
-
deeps(item.children);
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
});
|
|
841
|
-
};
|
|
842
|
-
|
|
843
|
-
deeps(draft);
|
|
844
|
-
} else {
|
|
845
|
-
draft === null || draft === void 0 ? void 0 : draft.forEach(function (item, index) {
|
|
846
|
-
if (row[_rowKey] === item[_rowKey]) {
|
|
847
|
-
draft[index] = row;
|
|
848
|
-
} else {
|
|
849
|
-
draft[index][key] = value;
|
|
850
|
-
}
|
|
851
|
-
});
|
|
852
|
-
}
|
|
853
|
-
} else {
|
|
854
|
-
if ((preKeys === null || preKeys === void 0 ? void 0 : preKeys.length) > 1) {
|
|
855
|
-
var _deeps = function _deeps(children) {
|
|
856
|
-
children === null || children === void 0 ? void 0 : children.forEach(function (item) {
|
|
857
|
-
var _a;
|
|
858
|
-
|
|
859
|
-
if (preKeys.includes(item[_rowKey])) {
|
|
860
|
-
if (item[_rowKey] === row[_rowKey]) {
|
|
861
|
-
(_a = Object.keys(row)) === null || _a === void 0 ? void 0 : _a.forEach(function (v) {
|
|
862
|
-
item[v] = row[v] || item[v];
|
|
863
|
-
});
|
|
864
|
-
} else if (item.children) {
|
|
865
|
-
_deeps(item.children);
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
});
|
|
869
|
-
};
|
|
870
|
-
|
|
871
|
-
_deeps(draft);
|
|
872
|
-
} else {
|
|
873
|
-
var index = draft.findIndex(function (item) {
|
|
874
|
-
return row[_rowKey] === item[_rowKey];
|
|
875
|
-
});
|
|
876
|
-
|
|
877
|
-
if (index !== -1) {
|
|
878
|
-
draft[index] = row;
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
});
|
|
883
|
-
setDataSource(res);
|
|
884
|
-
}; // const reWriteOriginSource = (rowKey: string, rowValue, dataIndex: number, nextValue) => {
|
|
823
|
+
}, 40); // const reWriteOriginSource = (rowKey: string, rowValue, dataIndex: number, nextValue) => {
|
|
885
824
|
// setDataSource((prevDataSource) => {
|
|
886
825
|
// return prevDataSource?.map((item) => {
|
|
887
826
|
// if (get(item, rowKey) === rowValue) {
|
|
@@ -895,7 +834,6 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
895
834
|
|
|
896
835
|
/** 删除当前行 */
|
|
897
836
|
|
|
898
|
-
|
|
899
837
|
var handleTableRowDelete = (0, _lodash.debounce)(function (key) {
|
|
900
838
|
var _a, _b, _c;
|
|
901
839
|
|
|
@@ -968,7 +906,7 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
968
906
|
|
|
969
907
|
var res = deep(dataSourceRef.current);
|
|
970
908
|
setDataSource(res);
|
|
971
|
-
},
|
|
909
|
+
}, 20);
|
|
972
910
|
/** 快捷添加 */
|
|
973
911
|
|
|
974
912
|
var handleTableRowAdd = (0, _lodash.debounce)(function (record, isAppendInChindren, defaultRecord) {
|
|
@@ -1051,8 +989,87 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1051
989
|
});
|
|
1052
990
|
setDataSource(res);
|
|
1053
991
|
}, 50);
|
|
992
|
+
|
|
993
|
+
var handleSave = function handleSave(row, options) {
|
|
994
|
+
var _a, _b;
|
|
995
|
+
|
|
996
|
+
var preKeys = (_b = (_a = deepDataSourceRef === null || deepDataSourceRef === void 0 ? void 0 : deepDataSourceRef.current) === null || _a === void 0 ? void 0 : _a[row[_rowKey]]) === null || _b === void 0 ? void 0 : _b.preKeys;
|
|
997
|
+
|
|
998
|
+
if (options === null || options === void 0 ? void 0 : options.only) {
|
|
999
|
+
var res = (0, _immer.produce)(dataSourceRef.current, function (draft) {
|
|
1000
|
+
if (options === null || options === void 0 ? void 0 : options.only) {
|
|
1001
|
+
var _ref7 = options === null || options === void 0 ? void 0 : options.only,
|
|
1002
|
+
key = _ref7.key,
|
|
1003
|
+
value = _ref7.value;
|
|
1004
|
+
|
|
1005
|
+
if ((preKeys === null || preKeys === void 0 ? void 0 : preKeys.length) > 1) {
|
|
1006
|
+
var deeps = function deeps(children) {
|
|
1007
|
+
children === null || children === void 0 ? void 0 : children.forEach(function (item) {
|
|
1008
|
+
var _a;
|
|
1009
|
+
|
|
1010
|
+
if (preKeys.includes(item[_rowKey])) {
|
|
1011
|
+
if (item[_rowKey] === row[_rowKey]) {
|
|
1012
|
+
children === null || children === void 0 ? void 0 : children.forEach(function (c) {
|
|
1013
|
+
c[key] = value;
|
|
1014
|
+
});
|
|
1015
|
+
(_a = Object.keys(item)) === null || _a === void 0 ? void 0 : _a.forEach(function (v) {
|
|
1016
|
+
item[v] = row[v] || item[v];
|
|
1017
|
+
});
|
|
1018
|
+
} else if (item.children) {
|
|
1019
|
+
deeps(item.children);
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
});
|
|
1023
|
+
};
|
|
1024
|
+
|
|
1025
|
+
deeps(draft);
|
|
1026
|
+
} else {
|
|
1027
|
+
draft === null || draft === void 0 ? void 0 : draft.forEach(function (item, index) {
|
|
1028
|
+
if (row[_rowKey] === item[_rowKey]) {
|
|
1029
|
+
draft[index] = row;
|
|
1030
|
+
} else {
|
|
1031
|
+
draft[index][key] = value;
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
} else {
|
|
1036
|
+
if ((preKeys === null || preKeys === void 0 ? void 0 : preKeys.length) > 1) {
|
|
1037
|
+
var _deeps = function _deeps(children) {
|
|
1038
|
+
children === null || children === void 0 ? void 0 : children.forEach(function (item) {
|
|
1039
|
+
var _a;
|
|
1040
|
+
|
|
1041
|
+
if (preKeys.includes(item[_rowKey])) {
|
|
1042
|
+
if (item[_rowKey] === row[_rowKey]) {
|
|
1043
|
+
(_a = Object.keys(row)) === null || _a === void 0 ? void 0 : _a.forEach(function (v) {
|
|
1044
|
+
item[v] = row[v] || item[v];
|
|
1045
|
+
});
|
|
1046
|
+
} else if (item.children) {
|
|
1047
|
+
_deeps(item.children);
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
});
|
|
1051
|
+
};
|
|
1052
|
+
|
|
1053
|
+
_deeps(draft);
|
|
1054
|
+
} else {
|
|
1055
|
+
var index = draft.findIndex(function (item) {
|
|
1056
|
+
return row[_rowKey] === item[_rowKey];
|
|
1057
|
+
});
|
|
1058
|
+
|
|
1059
|
+
if (index !== -1) {
|
|
1060
|
+
draft[index] = row;
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
});
|
|
1065
|
+
setDataSource(res);
|
|
1066
|
+
} else {
|
|
1067
|
+
handleTableRowReplace(row[_rowKey], row);
|
|
1068
|
+
}
|
|
1069
|
+
};
|
|
1054
1070
|
/** 快捷刷子功能 */
|
|
1055
1071
|
|
|
1072
|
+
|
|
1056
1073
|
var handleCopy = function handleCopy(key, value, type, rowIndex) {
|
|
1057
1074
|
var res = (0, _immer.produce)(dataSourceRef.current, function (draft) {
|
|
1058
1075
|
draft === null || draft === void 0 ? void 0 : draft.forEach(function (item, index) {
|
|
@@ -1647,6 +1664,29 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1647
1664
|
};
|
|
1648
1665
|
}
|
|
1649
1666
|
}, []);
|
|
1667
|
+
var checkFormItem = (0, _react.useMemo)(function () {
|
|
1668
|
+
var arr = [];
|
|
1669
|
+
columns.forEach(function (item) {
|
|
1670
|
+
var _a;
|
|
1671
|
+
|
|
1672
|
+
if (item.children) {
|
|
1673
|
+
(_a = item.children) === null || _a === void 0 ? void 0 : _a.forEach(function (c) {
|
|
1674
|
+
arr.push( /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Form.Item, Object.assign({
|
|
1675
|
+
noStyle: true,
|
|
1676
|
+
key: c.dataIndex,
|
|
1677
|
+
name: c.dataIndex
|
|
1678
|
+
}, (c === null || c === void 0 ? void 0 : c['formProps']) || {}), c.dataIndex || 'text'));
|
|
1679
|
+
});
|
|
1680
|
+
} else {
|
|
1681
|
+
arr.push( /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Form.Item, Object.assign({
|
|
1682
|
+
noStyle: true,
|
|
1683
|
+
key: item.dataIndex,
|
|
1684
|
+
name: item.dataIndex
|
|
1685
|
+
}, (item === null || item === void 0 ? void 0 : item['formProps']) || {}), item.dataIndex || 'text'));
|
|
1686
|
+
}
|
|
1687
|
+
});
|
|
1688
|
+
return arr;
|
|
1689
|
+
}, [columns]);
|
|
1650
1690
|
|
|
1651
1691
|
if (colSortOpen) {
|
|
1652
1692
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -1696,13 +1736,7 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1696
1736
|
}, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Form, {
|
|
1697
1737
|
form: checkForm,
|
|
1698
1738
|
component: false
|
|
1699
|
-
},
|
|
1700
|
-
return /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Form.Item, Object.assign({
|
|
1701
|
-
noStyle: true,
|
|
1702
|
-
key: item.dataIndex,
|
|
1703
|
-
name: item.dataIndex
|
|
1704
|
-
}, (item === null || item === void 0 ? void 0 : item['formProps']) || {}), item.dataIndex || 'text');
|
|
1705
|
-
}))));
|
|
1739
|
+
}, checkFormItem)));
|
|
1706
1740
|
} // @ts-ignore
|
|
1707
1741
|
|
|
1708
1742
|
|
|
@@ -1762,13 +1796,7 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1762
1796
|
}, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Form, {
|
|
1763
1797
|
form: checkForm,
|
|
1764
1798
|
component: false
|
|
1765
|
-
},
|
|
1766
|
-
return /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Form.Item, Object.assign({
|
|
1767
|
-
noStyle: true,
|
|
1768
|
-
key: item.dataIndex,
|
|
1769
|
-
name: item.dataIndex
|
|
1770
|
-
}, (item === null || item === void 0 ? void 0 : item['formProps']) || {}), item.dataIndex || 'text');
|
|
1771
|
-
}))));
|
|
1799
|
+
}, checkFormItem)));
|
|
1772
1800
|
});
|
|
1773
1801
|
|
|
1774
1802
|
var _default = /*#__PURE__*/(0, _react.memo)(EditTable);
|
|
@@ -530,7 +530,7 @@ p {
|
|
|
530
530
|
content: '-';
|
|
531
531
|
}
|
|
532
532
|
.lm_editTable_warpper .ant-table-thead .ant-table-cell {
|
|
533
|
-
height: 40px;
|
|
533
|
+
min-height: 40px;
|
|
534
534
|
padding: 10px 8px;
|
|
535
535
|
font-family: PingFangSC-Medium;
|
|
536
536
|
font-size: 12px;
|
|
@@ -559,11 +559,6 @@ p {
|
|
|
559
559
|
.lm_editTable_warpper .lm_custom_cell_td {
|
|
560
560
|
position: relative;
|
|
561
561
|
}
|
|
562
|
-
.lm_editTable_warpper .lm_custom_cell_td.ant-table-cell-with-append {
|
|
563
|
-
display: flex;
|
|
564
|
-
flex-direction: row;
|
|
565
|
-
flex-wrap: nowrap;
|
|
566
|
-
}
|
|
567
562
|
.lm_editTable_warpper .lm_custom_cell_td.ant-table-cell-with-append .ant-table-row-expand-icon {
|
|
568
563
|
margin-right: 8px;
|
|
569
564
|
flex: none;
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
content: '-';
|
|
19
19
|
}
|
|
20
20
|
.lm_editTable_warpper .ant-table-thead .ant-table-cell {
|
|
21
|
-
height: 40px;
|
|
21
|
+
min-height: 40px;
|
|
22
22
|
padding: 10px 8px;
|
|
23
23
|
font-family: PingFangSC-Medium;
|
|
24
24
|
font-size: 12px;
|
|
@@ -47,11 +47,6 @@
|
|
|
47
47
|
.lm_editTable_warpper .lm_custom_cell_td {
|
|
48
48
|
position: relative;
|
|
49
49
|
}
|
|
50
|
-
.lm_editTable_warpper .lm_custom_cell_td.ant-table-cell-with-append {
|
|
51
|
-
display: flex;
|
|
52
|
-
flex-direction: row;
|
|
53
|
-
flex-wrap: nowrap;
|
|
54
|
-
}
|
|
55
50
|
.lm_editTable_warpper .lm_custom_cell_td.ant-table-cell-with-append .ant-table-row-expand-icon {
|
|
56
51
|
margin-right: 8px;
|
|
57
52
|
flex: none;
|
package/lib/LmEditTable/util.js
CHANGED
|
@@ -49,9 +49,9 @@ function deepDataSourcePreKeys(dataSource, rowKey) {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
function isExpandRow(children) {
|
|
52
|
-
var _a, _b, _c, _d, _e;
|
|
52
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
53
53
|
|
|
54
|
-
return ['Collapse row', 'Expand row'].includes((_e = (_d = (_c = (_b = (_a = children === null || children === void 0 ? void 0 : children[0]) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.children) === null || _c === void 0 ? void 0 : _c[1]) === null || _d === void 0 ? void 0 : _d.props) === null || _e === void 0 ? void 0 : _e['aria-label']);
|
|
54
|
+
return ['Collapse row', 'Expand row'].includes((_e = (_d = (_c = (_b = (_a = children === null || children === void 0 ? void 0 : children[0]) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.children) === null || _c === void 0 ? void 0 : _c[1]) === null || _d === void 0 ? void 0 : _d.props) === null || _e === void 0 ? void 0 : _e['aria-label']) || ((_l = (_k = (_j = (_h = (_g = (_f = children === null || children === void 0 ? void 0 : children[0]) === null || _f === void 0 ? void 0 : _f.props) === null || _g === void 0 ? void 0 : _g.children) === null || _h === void 0 ? void 0 : _h[1]) === null || _j === void 0 ? void 0 : _j.props) === null || _k === void 0 ? void 0 : _k.className) === null || _l === void 0 ? void 0 : _l.indexOf('ant-table-row-expand-icon')) > -1;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
function checkRowKeyByDataSource(dataSource, rowKey) {
|
package/lib/styles/variables.css
CHANGED
|
@@ -9734,7 +9734,7 @@ p {
|
|
|
9734
9734
|
content: '-';
|
|
9735
9735
|
}
|
|
9736
9736
|
.lm_editTable_warpper .ant-table-thead .ant-table-cell {
|
|
9737
|
-
height: 40px;
|
|
9737
|
+
min-height: 40px;
|
|
9738
9738
|
padding: 10px 8px;
|
|
9739
9739
|
font-family: PingFangSC-Medium;
|
|
9740
9740
|
font-size: 12px;
|
|
@@ -9763,11 +9763,6 @@ p {
|
|
|
9763
9763
|
.lm_editTable_warpper .lm_custom_cell_td {
|
|
9764
9764
|
position: relative;
|
|
9765
9765
|
}
|
|
9766
|
-
.lm_editTable_warpper .lm_custom_cell_td.ant-table-cell-with-append {
|
|
9767
|
-
display: flex;
|
|
9768
|
-
flex-direction: row;
|
|
9769
|
-
flex-wrap: nowrap;
|
|
9770
|
-
}
|
|
9771
9766
|
.lm_editTable_warpper .lm_custom_cell_td.ant-table-cell-with-append .ant-table-row-expand-icon {
|
|
9772
9767
|
margin-right: 8px;
|
|
9773
9768
|
flex: none;
|