linkmore-design 1.1.13-alpha.5 → 1.1.13-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/CHANGELOG.md +73 -0
- package/dist/LmEditTable/EditTable.d.ts +1 -1
- package/dist/index.umd.js +192 -61
- package/dist/index.umd.min.js +2 -2
- package/dist/variables.css +29 -9
- package/es/LmEditTable/EditTable.d.ts +1 -1
- package/es/LmEditTable/EditTable.js +100 -31
- package/es/LmEditTable/sortableItemCol.js +38 -13
- package/es/LmEditTable/style/index.css +6 -0
- package/es/LmEditTable/style/variables.css +6 -0
- package/es/LmEditTable/util.js +23 -7
- package/es/LmFilter/style/index.css +6 -9
- package/es/LmFilter/style/variables.css +6 -9
- package/es/LmTable/Table.js +14 -8
- package/es/LmUpload/UploadList/ItemPicture.js +2 -1
- package/es/LmUpload/UploadList/ItemPictureCard.js +11 -2
- package/es/LmUpload/UploadList/ItemText.js +2 -1
- package/es/LmUpload/UploadList/index.js +2 -1
- package/es/LmUpload/body/UploadCore.js +4 -1
- package/es/LmUpload/style/index.css +17 -0
- package/es/LmUpload/style/variables.css +17 -0
- package/es/TreeSelect/index.js +2 -1
- package/es/styles/variables.css +29 -9
- package/lib/LmEditTable/EditTable.d.ts +1 -1
- package/lib/LmEditTable/EditTable.js +99 -30
- package/lib/LmEditTable/sortableItemCol.js +34 -11
- package/lib/LmEditTable/style/index.css +6 -0
- package/lib/LmEditTable/style/variables.css +6 -0
- package/lib/LmEditTable/util.js +22 -6
- package/lib/LmFilter/style/index.css +6 -9
- package/lib/LmFilter/style/variables.css +6 -9
- package/lib/LmTable/Table.js +14 -8
- package/lib/LmUpload/UploadList/ItemPicture.js +2 -1
- package/lib/LmUpload/UploadList/ItemPictureCard.js +11 -2
- package/lib/LmUpload/UploadList/ItemText.js +2 -1
- package/lib/LmUpload/UploadList/index.js +2 -1
- package/lib/LmUpload/body/UploadCore.js +5 -1
- package/lib/LmUpload/style/index.css +17 -0
- package/lib/LmUpload/style/variables.css +17 -0
- package/lib/TreeSelect/index.js +2 -1
- package/lib/styles/variables.css +29 -9
- package/package.json +1 -1
|
@@ -67,6 +67,7 @@ var PictureItem = function PictureItem(_ref) {
|
|
|
67
67
|
instance = _ref.instance,
|
|
68
68
|
listeners = _ref.listeners;
|
|
69
69
|
var dispatch = instance.dispatch,
|
|
70
|
+
disabled = instance.disabled,
|
|
70
71
|
readOnly = instance.readOnly,
|
|
71
72
|
size = instance.size,
|
|
72
73
|
remove = instance.remove,
|
|
@@ -140,7 +141,15 @@ var PictureItem = function PictureItem(_ref) {
|
|
|
140
141
|
})), /*#__PURE__*/React.createElement("div", {
|
|
141
142
|
className: "lm_upload_item_mask"
|
|
142
143
|
}, /*#__PURE__*/React.createElement("div", {
|
|
143
|
-
className: "lm_upload_item_action"
|
|
144
|
+
className: "lm_upload_item_action",
|
|
145
|
+
onKeyDown: function onKeyDown(e) {
|
|
146
|
+
e.stopPropagation();
|
|
147
|
+
e.preventDefault();
|
|
148
|
+
},
|
|
149
|
+
onPointerDown: function onPointerDown(e) {
|
|
150
|
+
e.stopPropagation();
|
|
151
|
+
e.preventDefault();
|
|
152
|
+
}
|
|
144
153
|
}, /*#__PURE__*/React.createElement("div", {
|
|
145
154
|
className: "action_preview",
|
|
146
155
|
onClick: handlePreview
|
|
@@ -149,7 +158,7 @@ var PictureItem = function PictureItem(_ref) {
|
|
|
149
158
|
style: {
|
|
150
159
|
fontSize: resetSize.fontSize
|
|
151
160
|
}
|
|
152
|
-
})), !readOnly && /*#__PURE__*/React.createElement("div", {
|
|
161
|
+
})), !readOnly && !disabled && /*#__PURE__*/React.createElement("div", {
|
|
153
162
|
className: "action_delete",
|
|
154
163
|
onClick: function onClick() {
|
|
155
164
|
return remove(file);
|
|
@@ -6,6 +6,7 @@ var TextItem = function TextItem(_ref) {
|
|
|
6
6
|
var file = _ref.file,
|
|
7
7
|
instance = _ref.instance;
|
|
8
8
|
var readOnly = instance.readOnly,
|
|
9
|
+
disabled = instance.disabled,
|
|
9
10
|
remove = instance.remove,
|
|
10
11
|
download = instance.download,
|
|
11
12
|
fileNames = instance.fileNames;
|
|
@@ -22,7 +23,7 @@ var TextItem = function TextItem(_ref) {
|
|
|
22
23
|
onClick: function onClick() {
|
|
23
24
|
return download(file);
|
|
24
25
|
}
|
|
25
|
-
}, file[fileNames.fileName])), !readOnly && /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
}, file[fileNames.fileName])), !readOnly && !disabled && /*#__PURE__*/React.createElement("div", {
|
|
26
27
|
className: "text_right lm_upload_item_text_action"
|
|
27
28
|
}, /*#__PURE__*/React.createElement("div", {
|
|
28
29
|
className: "action_delete",
|
|
@@ -11,6 +11,7 @@ var LmUploadList = function LmUploadList(_ref) {
|
|
|
11
11
|
itemRender = instance.itemRender,
|
|
12
12
|
listType = instance.listType,
|
|
13
13
|
showUploadList = instance.showUploadList,
|
|
14
|
+
disabled = instance.disabled,
|
|
14
15
|
enableDrag = instance.enableDrag,
|
|
15
16
|
fileNames = instance.fileNames,
|
|
16
17
|
move = instance.move;
|
|
@@ -46,7 +47,7 @@ var LmUploadList = function LmUploadList(_ref) {
|
|
|
46
47
|
}
|
|
47
48
|
};
|
|
48
49
|
|
|
49
|
-
if (enableDrag) {
|
|
50
|
+
if (!disabled && enableDrag) {
|
|
50
51
|
return /*#__PURE__*/React.createElement(LmDrag, {
|
|
51
52
|
options: fileList,
|
|
52
53
|
rowKey: uid,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
2
3
|
import UploadPicture from './UploadPicture'; // 上传核心
|
|
3
4
|
// 渲染上传区域样式, 仅用于触发上传事件
|
|
4
5
|
// type: 'card' 图片 | 'drag' 拖拽
|
|
@@ -10,6 +11,7 @@ var UploadCore = function UploadCore(_ref) {
|
|
|
10
11
|
|
|
11
12
|
var inputRef = React.useRef(null);
|
|
12
13
|
var accept = instance.accept,
|
|
14
|
+
disabled = instance.disabled,
|
|
13
15
|
children = instance.children,
|
|
14
16
|
beforeUpload = instance.beforeUpload,
|
|
15
17
|
getUploadStatus = instance.getUploadStatus,
|
|
@@ -18,6 +20,7 @@ var UploadCore = function UploadCore(_ref) {
|
|
|
18
20
|
var handleClick = useCallback(function () {
|
|
19
21
|
var _a;
|
|
20
22
|
|
|
23
|
+
if (disabled) return;
|
|
21
24
|
var isUploading = getUploadStatus().uploading;
|
|
22
25
|
if (isUploading) return;
|
|
23
26
|
(_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
@@ -43,7 +46,7 @@ var UploadCore = function UploadCore(_ref) {
|
|
|
43
46
|
};
|
|
44
47
|
return !getIsMaxCount() && /*#__PURE__*/React.createElement("div", {
|
|
45
48
|
onClick: handleClick,
|
|
46
|
-
className:
|
|
49
|
+
className: cn('lm_upload_core', disabled && 'disabled')
|
|
47
50
|
}, children || /*#__PURE__*/React.createElement(UploadPicture, {
|
|
48
51
|
instance: instance
|
|
49
52
|
}), /*#__PURE__*/React.createElement("input", Object.assign({
|
|
@@ -122,6 +122,7 @@
|
|
|
122
122
|
gap: 8px;
|
|
123
123
|
}
|
|
124
124
|
.lm_upload_wrapper .lm_upload_core {
|
|
125
|
+
position: relative;
|
|
125
126
|
display: inline-flex;
|
|
126
127
|
vertical-align: middle;
|
|
127
128
|
}
|
|
@@ -136,6 +137,12 @@
|
|
|
136
137
|
cursor: pointer;
|
|
137
138
|
transition: all 0.3s;
|
|
138
139
|
}
|
|
140
|
+
.lm_upload_wrapper .lm_upload_core .lm_upload_core_picture::after {
|
|
141
|
+
position: absolute;
|
|
142
|
+
background-color: var(--disabled-bg-color);
|
|
143
|
+
cursor: not-allowed;
|
|
144
|
+
inset: 0;
|
|
145
|
+
}
|
|
139
146
|
.lm_upload_wrapper .lm_upload_core .lm_upload_core_picture:hover {
|
|
140
147
|
border-color: var(--primary-color);
|
|
141
148
|
}
|
|
@@ -151,6 +158,16 @@
|
|
|
151
158
|
margin-top: var(--gap);
|
|
152
159
|
color: var(--color-45);
|
|
153
160
|
}
|
|
161
|
+
.lm_upload_wrapper .lm_upload_core.disabled .lm_upload_core_picture {
|
|
162
|
+
border-color: var(--disabled-border-color);
|
|
163
|
+
}
|
|
164
|
+
.lm_upload_wrapper .lm_upload_core.disabled .lm_upload_core_picture::after {
|
|
165
|
+
content: '';
|
|
166
|
+
}
|
|
167
|
+
.lm_upload_wrapper .lm_upload_core.disabled .lm_upload_core_picture .lm_upload_core_picture_action .action_plus,
|
|
168
|
+
.lm_upload_wrapper .lm_upload_core.disabled .lm_upload_core_picture .lm_upload_core_picture_action .tip {
|
|
169
|
+
color: var(--disabled-font-color);
|
|
170
|
+
}
|
|
154
171
|
.lm_upload_wrapper .lm_upload_progress {
|
|
155
172
|
width: 100%;
|
|
156
173
|
height: 2px;
|
|
@@ -122,6 +122,7 @@
|
|
|
122
122
|
gap: 8px;
|
|
123
123
|
}
|
|
124
124
|
.lm_upload_wrapper .lm_upload_core {
|
|
125
|
+
position: relative;
|
|
125
126
|
display: inline-flex;
|
|
126
127
|
vertical-align: middle;
|
|
127
128
|
}
|
|
@@ -136,6 +137,12 @@
|
|
|
136
137
|
cursor: pointer;
|
|
137
138
|
transition: all 0.3s;
|
|
138
139
|
}
|
|
140
|
+
.lm_upload_wrapper .lm_upload_core .lm_upload_core_picture::after {
|
|
141
|
+
position: absolute;
|
|
142
|
+
background-color: var(--disabled-bg-color);
|
|
143
|
+
cursor: not-allowed;
|
|
144
|
+
inset: 0;
|
|
145
|
+
}
|
|
139
146
|
.lm_upload_wrapper .lm_upload_core .lm_upload_core_picture:hover {
|
|
140
147
|
border-color: var(--primary-color);
|
|
141
148
|
}
|
|
@@ -151,6 +158,16 @@
|
|
|
151
158
|
margin-top: var(--gap);
|
|
152
159
|
color: var(--color-45);
|
|
153
160
|
}
|
|
161
|
+
.lm_upload_wrapper .lm_upload_core.disabled .lm_upload_core_picture {
|
|
162
|
+
border-color: var(--disabled-border-color);
|
|
163
|
+
}
|
|
164
|
+
.lm_upload_wrapper .lm_upload_core.disabled .lm_upload_core_picture::after {
|
|
165
|
+
content: '';
|
|
166
|
+
}
|
|
167
|
+
.lm_upload_wrapper .lm_upload_core.disabled .lm_upload_core_picture .lm_upload_core_picture_action .action_plus,
|
|
168
|
+
.lm_upload_wrapper .lm_upload_core.disabled .lm_upload_core_picture .lm_upload_core_picture_action .tip {
|
|
169
|
+
color: var(--disabled-font-color);
|
|
170
|
+
}
|
|
154
171
|
.lm_upload_wrapper .lm_upload_progress {
|
|
155
172
|
width: 100%;
|
|
156
173
|
height: 2px;
|
package/es/TreeSelect/index.js
CHANGED
|
@@ -82,7 +82,8 @@ var CLMTreeSelect = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
82
82
|
className: 'lm_tree_select',
|
|
83
83
|
value: resetValue,
|
|
84
84
|
size: mergeSize,
|
|
85
|
-
disabled: mergedDisabled
|
|
85
|
+
disabled: mergedDisabled,
|
|
86
|
+
treeData: treeData
|
|
86
87
|
}, resetProps), children);
|
|
87
88
|
});
|
|
88
89
|
var LMTreeSelect = CLMTreeSelect;
|
package/es/styles/variables.css
CHANGED
|
@@ -9813,6 +9813,12 @@ p {
|
|
|
9813
9813
|
padding-left: 8px;
|
|
9814
9814
|
padding-right: 8px;
|
|
9815
9815
|
}
|
|
9816
|
+
.lm_editTable_warpper .ant-table-thead > tr > th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before {
|
|
9817
|
+
background-color: rgba(0, 0, 0, 0.06) !important;
|
|
9818
|
+
}
|
|
9819
|
+
.lm_editTable_warpper .ant-table-thead > tr > th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before {
|
|
9820
|
+
background-color: rgba(0, 0, 0, 0.06) !important;
|
|
9821
|
+
}
|
|
9816
9822
|
.lm_editTable_warpper .ant-picker {
|
|
9817
9823
|
height: 24px !important;
|
|
9818
9824
|
padding: 2px 8px;
|
|
@@ -9968,15 +9974,6 @@ p {
|
|
|
9968
9974
|
}
|
|
9969
9975
|
.lm_filter_basic_item .filter_item_icon .icon_clear {
|
|
9970
9976
|
display: none;
|
|
9971
|
-
opacity: 0;
|
|
9972
|
-
}
|
|
9973
|
-
.lm_filter_basic_item .filter_item_icon:hover .icon_down {
|
|
9974
|
-
display: none;
|
|
9975
|
-
opacity: 0;
|
|
9976
|
-
}
|
|
9977
|
-
.lm_filter_basic_item .filter_item_icon:hover .icon_clear {
|
|
9978
|
-
display: inline-block;
|
|
9979
|
-
opacity: 1;
|
|
9980
9977
|
}
|
|
9981
9978
|
.lm_filter_basic_item.expand .filter_item_icon.addon_after {
|
|
9982
9979
|
transform: rotateX(180deg);
|
|
@@ -9991,6 +9988,12 @@ p {
|
|
|
9991
9988
|
.lm_filter_basic_item.active.lm_filter_complex_item .filter_item_label {
|
|
9992
9989
|
color: var(--primary-color);
|
|
9993
9990
|
}
|
|
9991
|
+
.lm_filter_basic_item.active:hover .icon_down {
|
|
9992
|
+
display: none;
|
|
9993
|
+
}
|
|
9994
|
+
.lm_filter_basic_item.active:hover .icon_clear {
|
|
9995
|
+
display: inline-block;
|
|
9996
|
+
}
|
|
9994
9997
|
.ant-dropdown.filter_dropdown_container_cascader > div {
|
|
9995
9998
|
transform: translateY(-4px);
|
|
9996
9999
|
}
|
|
@@ -11909,6 +11912,7 @@ button.ant-table-row-expand-icon::after {
|
|
|
11909
11912
|
gap: 8px;
|
|
11910
11913
|
}
|
|
11911
11914
|
.lm_upload_wrapper .lm_upload_core {
|
|
11915
|
+
position: relative;
|
|
11912
11916
|
display: inline-flex;
|
|
11913
11917
|
vertical-align: middle;
|
|
11914
11918
|
}
|
|
@@ -11923,6 +11927,12 @@ button.ant-table-row-expand-icon::after {
|
|
|
11923
11927
|
cursor: pointer;
|
|
11924
11928
|
transition: all 0.3s;
|
|
11925
11929
|
}
|
|
11930
|
+
.lm_upload_wrapper .lm_upload_core .lm_upload_core_picture::after {
|
|
11931
|
+
position: absolute;
|
|
11932
|
+
background-color: var(--disabled-bg-color);
|
|
11933
|
+
cursor: not-allowed;
|
|
11934
|
+
inset: 0;
|
|
11935
|
+
}
|
|
11926
11936
|
.lm_upload_wrapper .lm_upload_core .lm_upload_core_picture:hover {
|
|
11927
11937
|
border-color: var(--primary-color);
|
|
11928
11938
|
}
|
|
@@ -11938,6 +11948,16 @@ button.ant-table-row-expand-icon::after {
|
|
|
11938
11948
|
margin-top: var(--gap);
|
|
11939
11949
|
color: var(--color-45);
|
|
11940
11950
|
}
|
|
11951
|
+
.lm_upload_wrapper .lm_upload_core.disabled .lm_upload_core_picture {
|
|
11952
|
+
border-color: var(--disabled-border-color);
|
|
11953
|
+
}
|
|
11954
|
+
.lm_upload_wrapper .lm_upload_core.disabled .lm_upload_core_picture::after {
|
|
11955
|
+
content: '';
|
|
11956
|
+
}
|
|
11957
|
+
.lm_upload_wrapper .lm_upload_core.disabled .lm_upload_core_picture .lm_upload_core_picture_action .action_plus,
|
|
11958
|
+
.lm_upload_wrapper .lm_upload_core.disabled .lm_upload_core_picture .lm_upload_core_picture_action .tip {
|
|
11959
|
+
color: var(--disabled-font-color);
|
|
11960
|
+
}
|
|
11941
11961
|
.lm_upload_wrapper .lm_upload_progress {
|
|
11942
11962
|
width: 100%;
|
|
11943
11963
|
height: 2px;
|
|
@@ -33,7 +33,7 @@ export interface CountdownHandle {
|
|
|
33
33
|
clearSelect: () => void;
|
|
34
34
|
customSetCheckboxRecords: (data: any[]) => void;
|
|
35
35
|
deleteRowData: (record: string | Record<string, any>) => void;
|
|
36
|
-
addRowData: (record: string | Record<string, any>,
|
|
36
|
+
addRowData: (record: string | Record<string, any>, defaultValue?: Record<string, any> | Record<string, any>[], addInChild?: boolean | 'replace') => void;
|
|
37
37
|
valid: () => void;
|
|
38
38
|
}
|
|
39
39
|
interface ILmColumns extends TableColumnType<any> {
|
|
@@ -494,7 +494,16 @@ var EditableCell = function EditableCell(props) {
|
|
|
494
494
|
};
|
|
495
495
|
|
|
496
496
|
var Control = function Control(con) {
|
|
497
|
+
var _a;
|
|
498
|
+
|
|
497
499
|
var resultComponentProps = (0, _lodash.isFunction)(componentProps) ? componentProps === null || componentProps === void 0 ? void 0 : componentProps(record, col) : componentProps;
|
|
500
|
+
|
|
501
|
+
if ((0, _lodash.isFunction)(componentProps) && ((_a = col === null || col === void 0 ? void 0 : col.newOptions) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
502
|
+
resultComponentProps = Object.assign(Object.assign({}, resultComponentProps), {
|
|
503
|
+
options: col === null || col === void 0 ? void 0 : col.newOptions
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
|
|
498
507
|
var clearAttrComponentProps = (0, _lodash.omit)(resultComponentProps, ['optionOnly', 'isOnlyValue', 'quickcopy']);
|
|
499
508
|
|
|
500
509
|
switch (con) {
|
|
@@ -622,7 +631,8 @@ var EditableCell = function EditableCell(props) {
|
|
|
622
631
|
|
|
623
632
|
case 'render':
|
|
624
633
|
{
|
|
625
|
-
var
|
|
634
|
+
var _resultComponentProps = resultComponentProps,
|
|
635
|
+
render = _resultComponentProps.render;
|
|
626
636
|
var fromData = form.getFieldsValue();
|
|
627
637
|
return render === null || render === void 0 ? void 0 : render(Object.assign(Object.assign({}, !(0, _util.isObjEmpty)(fromData) ? Object.assign(Object.assign({}, record), (0, _defineProperty2.default)({}, dataIndex, fromData[dataIndex])) : record), {
|
|
628
638
|
onChange: save
|
|
@@ -663,7 +673,8 @@ var EditableCell = function EditableCell(props) {
|
|
|
663
673
|
valuePropName: editable === 'switch' ? 'checked' : 'value',
|
|
664
674
|
style: {
|
|
665
675
|
margin: 0
|
|
666
|
-
}
|
|
676
|
+
},
|
|
677
|
+
noStyle: formProps ? false : true
|
|
667
678
|
}, formProps, {
|
|
668
679
|
name: dataIndex
|
|
669
680
|
}), Control(editable)));
|
|
@@ -675,6 +686,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
675
686
|
margin: 0
|
|
676
687
|
}
|
|
677
688
|
}, formProps, {
|
|
689
|
+
noStyle: formProps ? false : true,
|
|
678
690
|
name: [dataIndex, 'value']
|
|
679
691
|
}), Control(editable)));
|
|
680
692
|
}
|
|
@@ -731,7 +743,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
731
743
|
var MemoEditableCell = /*#__PURE__*/(0, _react.memo)(EditableCell, function (prev, next) {
|
|
732
744
|
var pickProps = ['record', 'colIndex'];
|
|
733
745
|
var p = (0, _lodash.pick)(prev, pickProps);
|
|
734
|
-
var n = (0, _lodash.pick)(next, pickProps); // console.log(
|
|
746
|
+
var n = (0, _lodash.pick)(next, pickProps); // console.log('333', checkMemoShouldUploadSpecialFun(prev, next), isEqual(p, n))
|
|
735
747
|
|
|
736
748
|
/** TODO: 在record中带有children,子列表数据修改之后,会导致父级的record对比不一样 */
|
|
737
749
|
|
|
@@ -845,7 +857,7 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
845
857
|
/** 点击添加按钮添加 */
|
|
846
858
|
|
|
847
859
|
|
|
848
|
-
var handleAdd = function
|
|
860
|
+
var handleAdd = (0, _lodash.debounce)(function (row) {
|
|
849
861
|
var _a;
|
|
850
862
|
|
|
851
863
|
var addDataInfo = (0, _lodash.isFunction)(recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.initData) ? (_a = recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.initData) === null || _a === void 0 ? void 0 : _a.call(recordCreatorProps) : recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.initData;
|
|
@@ -853,7 +865,7 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
853
865
|
draft.push(Object.assign((0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())), addDataInfo || {}));
|
|
854
866
|
});
|
|
855
867
|
setDataSource(res); // onChange?.(res)
|
|
856
|
-
};
|
|
868
|
+
}, 40);
|
|
857
869
|
/** 本地缓存一个选择数据 */
|
|
858
870
|
// useEffect(() => {
|
|
859
871
|
// if (rowSelection) {
|
|
@@ -868,7 +880,6 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
868
880
|
// ;(rowSelection?.onChange as any)?.(selectRows)
|
|
869
881
|
// }
|
|
870
882
|
|
|
871
|
-
|
|
872
883
|
var handleSave = function handleSave(row, options) {
|
|
873
884
|
var _a, _b;
|
|
874
885
|
|
|
@@ -955,7 +966,7 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
955
966
|
}; // @ts-ignore
|
|
956
967
|
|
|
957
968
|
|
|
958
|
-
var handleTableRowDelete = function
|
|
969
|
+
var handleTableRowDelete = (0, _lodash.debounce)(function (key) {
|
|
959
970
|
var _a, _b, _c;
|
|
960
971
|
|
|
961
972
|
var rkey = (0, _lodash.isObject)(key) ? key[_rowKey] : key;
|
|
@@ -999,35 +1010,72 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
999
1010
|
|
|
1000
1011
|
setDataSource(_res);
|
|
1001
1012
|
}
|
|
1002
|
-
};
|
|
1003
|
-
|
|
1013
|
+
}, 40);
|
|
1014
|
+
var handleTableRowReplace = (0, _lodash.debounce)(function (record, defaultRecord) {
|
|
1015
|
+
var _a, _b;
|
|
1004
1016
|
|
|
1017
|
+
var rkey = (0, _lodash.isObject)(record) ? record[_rowKey] : record;
|
|
1018
|
+
var preKeys = (_b = (_a = deepDataSourceRef === null || deepDataSourceRef === void 0 ? void 0 : deepDataSourceRef.current) === null || _a === void 0 ? void 0 : _a[rkey]) === null || _b === void 0 ? void 0 : _b.preKeys; // const res = cloneDeep(dataSourceRef.current)
|
|
1019
|
+
|
|
1020
|
+
var deep = function deep(children) {
|
|
1021
|
+
return children.map(function (item) {
|
|
1022
|
+
if (item[_rowKey] === rkey) {
|
|
1023
|
+
return defaultRecord;
|
|
1024
|
+
} else if (preKeys.includes(item[_rowKey]) && item.children) {
|
|
1025
|
+
var child = deep(item.children);
|
|
1026
|
+
return Object.assign(Object.assign({}, item), {
|
|
1027
|
+
children: child
|
|
1028
|
+
});
|
|
1029
|
+
} else {
|
|
1030
|
+
return item;
|
|
1031
|
+
}
|
|
1032
|
+
});
|
|
1033
|
+
};
|
|
1005
1034
|
|
|
1006
|
-
|
|
1035
|
+
var res = deep(dataSourceRef.current);
|
|
1036
|
+
setDataSource(res);
|
|
1037
|
+
}, 40);
|
|
1038
|
+
/** 快捷添加 */
|
|
1039
|
+
|
|
1040
|
+
var handleTableRowAdd = (0, _lodash.debounce)(function (record, isAppendInChindren, defaultRecord) {
|
|
1007
1041
|
var _a, _b;
|
|
1008
1042
|
|
|
1009
1043
|
var rkey = (0, _lodash.isObject)(record) ? record[_rowKey] : record;
|
|
1010
1044
|
var preKeys = (_b = (_a = deepDataSourceRef === null || deepDataSourceRef === void 0 ? void 0 : deepDataSourceRef.current) === null || _a === void 0 ? void 0 : _a[rkey]) === null || _b === void 0 ? void 0 : _b.preKeys;
|
|
1011
1045
|
var res = (0, _immer.produce)(dataSourceRef.current, function (draft) {
|
|
1012
|
-
var _a, _b, _c, _d;
|
|
1046
|
+
var _a, _b, _c, _d, _e;
|
|
1013
1047
|
|
|
1014
|
-
if (preKeys.length > 1) {
|
|
1048
|
+
if ((preKeys === null || preKeys === void 0 ? void 0 : preKeys.length) > 1) {
|
|
1015
1049
|
var deeps = function deeps(children) {
|
|
1016
1050
|
children === null || children === void 0 ? void 0 : children.forEach(function (item, index) {
|
|
1017
|
-
var _a;
|
|
1051
|
+
var _a, _b;
|
|
1018
1052
|
|
|
1019
1053
|
if (preKeys === null || preKeys === void 0 ? void 0 : preKeys.includes(item[_rowKey])) {
|
|
1020
1054
|
if (item[_rowKey] === rkey) {
|
|
1021
1055
|
if (isAppendInChindren) {
|
|
1022
1056
|
if (item === null || item === void 0 ? void 0 : item.children) {
|
|
1023
|
-
(
|
|
1057
|
+
if (Array.isArray(defaultRecord)) {
|
|
1058
|
+
var _a2;
|
|
1059
|
+
|
|
1060
|
+
(_a = item === null || item === void 0 ? void 0 : item.children) === null || _a === void 0 ? void 0 : (_a2 = _a).push.apply(_a2, (0, _toConsumableArray2.default)(defaultRecord));
|
|
1061
|
+
} else {
|
|
1062
|
+
(_b = item === null || item === void 0 ? void 0 : item.children) === null || _b === void 0 ? void 0 : _b.push(defaultRecord || (0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())));
|
|
1063
|
+
}
|
|
1024
1064
|
} else {
|
|
1025
|
-
|
|
1065
|
+
if (Array.isArray(defaultRecord)) {
|
|
1066
|
+
item.children = (0, _toConsumableArray2.default)(defaultRecord);
|
|
1067
|
+
} else {
|
|
1068
|
+
item.children = [defaultRecord || (0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now()))];
|
|
1069
|
+
}
|
|
1026
1070
|
}
|
|
1027
1071
|
|
|
1028
1072
|
!expandedRowKeys.includes(item[_rowKey]) && setExpandedRowKeys([].concat((0, _toConsumableArray2.default)(expandedRowKeys), [item[_rowKey]]));
|
|
1029
1073
|
} else {
|
|
1030
|
-
|
|
1074
|
+
if (Array.isArray(defaultRecord)) {
|
|
1075
|
+
children.splice.apply(children, [index + 1, 0].concat((0, _toConsumableArray2.default)(defaultRecord)));
|
|
1076
|
+
} else {
|
|
1077
|
+
children.splice(index + 1, 0, defaultRecord || (0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())));
|
|
1078
|
+
}
|
|
1031
1079
|
}
|
|
1032
1080
|
} else if (item.children) {
|
|
1033
1081
|
deeps(item.children);
|
|
@@ -1045,21 +1093,30 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1045
1093
|
if (index !== -1) {
|
|
1046
1094
|
if (isAppendInChindren) {
|
|
1047
1095
|
if ((_a = draft[index].children) === null || _a === void 0 ? void 0 : _a.length) {
|
|
1048
|
-
|
|
1096
|
+
if (Array.isArray(defaultRecord)) {
|
|
1097
|
+
var _b2;
|
|
1098
|
+
|
|
1099
|
+
(_b = draft[index].children) === null || _b === void 0 ? void 0 : (_b2 = _b).push.apply(_b2, (0, _toConsumableArray2.default)(defaultRecord));
|
|
1100
|
+
} else {
|
|
1101
|
+
(_c = draft[index].children) === null || _c === void 0 ? void 0 : _c.push(defaultRecord || (0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())));
|
|
1102
|
+
}
|
|
1049
1103
|
} else {
|
|
1050
|
-
draft[index].children = [(0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now()))];
|
|
1104
|
+
draft[index].children = Array.isArray(defaultRecord) ? (0, _toConsumableArray2.default)(defaultRecord) : [defaultRecord || (0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now()))];
|
|
1051
1105
|
}
|
|
1052
1106
|
|
|
1053
|
-
!expandedRowKeys.includes((
|
|
1107
|
+
!expandedRowKeys.includes((_d = draft[index]) === null || _d === void 0 ? void 0 : _d[_rowKey]) && setExpandedRowKeys([].concat((0, _toConsumableArray2.default)(expandedRowKeys), [(_e = draft[index]) === null || _e === void 0 ? void 0 : _e[_rowKey]]));
|
|
1054
1108
|
} else {
|
|
1055
|
-
|
|
1109
|
+
if (Array.isArray(defaultRecord)) {
|
|
1110
|
+
draft.splice.apply(draft, [index + 1, 0].concat((0, _toConsumableArray2.default)(defaultRecord)));
|
|
1111
|
+
} else {
|
|
1112
|
+
draft.splice(index + 1, 0, defaultRecord || (0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())));
|
|
1113
|
+
}
|
|
1056
1114
|
}
|
|
1057
1115
|
}
|
|
1058
1116
|
}
|
|
1059
1117
|
});
|
|
1060
|
-
console.log(preKeys, '--preKeys', res);
|
|
1061
1118
|
setDataSource(res);
|
|
1062
|
-
};
|
|
1119
|
+
}, 40);
|
|
1063
1120
|
|
|
1064
1121
|
var handleCopy = function handleCopy(key, value, type, rowIndex) {
|
|
1065
1122
|
var res = (0, _immer.produce)(dataSourceRef.current, function (draft) {
|
|
@@ -1078,8 +1135,9 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1078
1135
|
var hasOnlyOptionsDatas = columns.filter(function (item) {
|
|
1079
1136
|
var _a;
|
|
1080
1137
|
|
|
1081
|
-
|
|
1082
|
-
|
|
1138
|
+
var resultComponentProps = (0, _lodash.isFunction)(item === null || item === void 0 ? void 0 : item.componentProps) ? (_a = item === null || item === void 0 ? void 0 : item.componentProps) === null || _a === void 0 ? void 0 : _a.call(item, {}, item) : item === null || item === void 0 ? void 0 : item.componentProps;
|
|
1139
|
+
return resultComponentProps === null || resultComponentProps === void 0 ? void 0 : resultComponentProps.optionOnly;
|
|
1140
|
+
}); // const hasOnlyOptionsDatas = columns.filter((item) => item?.componentProps?.optionOnly)
|
|
1083
1141
|
|
|
1084
1142
|
if (hasOnlyOptionsDatas.length) {
|
|
1085
1143
|
return hasOnlyOptionsDatas === null || hasOnlyOptionsDatas === void 0 ? void 0 : hasOnlyOptionsDatas.map(function (item) {
|
|
@@ -1093,9 +1151,13 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1093
1151
|
|
|
1094
1152
|
var DisableOptions = (0, _react.useMemo)(function () {
|
|
1095
1153
|
var newColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (item) {
|
|
1096
|
-
var
|
|
1097
|
-
|
|
1098
|
-
|
|
1154
|
+
var _a;
|
|
1155
|
+
|
|
1156
|
+
var resultComponentProps = (0, _lodash.isFunction)(item.componentProps) ? (_a = item.componentProps) === null || _a === void 0 ? void 0 : _a.call(item, {}, item) : item.componentProps;
|
|
1157
|
+
|
|
1158
|
+
var _ref9 = resultComponentProps || {},
|
|
1159
|
+
optionOnly = _ref9.optionOnly,
|
|
1160
|
+
options = _ref9.options;
|
|
1099
1161
|
|
|
1100
1162
|
if (optionOnly && options) {
|
|
1101
1163
|
var dataIndex = item.dataIndex;
|
|
@@ -1107,6 +1169,13 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1107
1169
|
disabled: !!dataIndexData.includes(o === null || o === void 0 ? void 0 : o.value)
|
|
1108
1170
|
});
|
|
1109
1171
|
});
|
|
1172
|
+
|
|
1173
|
+
if ((0, _lodash.isFunction)(item.componentProps)) {
|
|
1174
|
+
return Object.assign(Object.assign({}, item), {
|
|
1175
|
+
newOptions: newOptions
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1110
1179
|
return Object.assign(Object.assign({}, item), {
|
|
1111
1180
|
componentProps: Object.assign(Object.assign({}, item.componentProps), {
|
|
1112
1181
|
options: newOptions
|
|
@@ -1134,7 +1203,7 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1134
1203
|
fixed: 'left',
|
|
1135
1204
|
render: function render(_, record) {
|
|
1136
1205
|
return /*#__PURE__*/_react.default.createElement(_DragHandle.default, {
|
|
1137
|
-
id: record[_rowKey] || record.id
|
|
1206
|
+
id: record[_rowKey] || (record === null || record === void 0 ? void 0 : record.id)
|
|
1138
1207
|
});
|
|
1139
1208
|
}
|
|
1140
1209
|
} : null, indexCol ? (0, _lodash.isBoolean)(indexCol) ? {
|
|
@@ -1283,8 +1352,8 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1283
1352
|
deleteRowData: function deleteRowData(data) {
|
|
1284
1353
|
return handleTableRowDelete(data);
|
|
1285
1354
|
},
|
|
1286
|
-
addRowData: function addRowData(data,
|
|
1287
|
-
return handleTableRowAdd(data,
|
|
1355
|
+
addRowData: function addRowData(data, defaultValue, addInChild) {
|
|
1356
|
+
return addInChild === 'replace' ? handleTableRowReplace(data, defaultValue) : handleTableRowAdd(data, addInChild, defaultValue);
|
|
1288
1357
|
},
|
|
1289
1358
|
clearSelect: function clearSelect() {
|
|
1290
1359
|
setLocalRowSelectList({
|
|
@@ -11,8 +11,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
|
|
12
12
|
var _sortable = require("@dnd-kit/sortable");
|
|
13
13
|
|
|
14
|
-
var _lodash = require("lodash");
|
|
15
|
-
|
|
16
14
|
var _utilities = require("@dnd-kit/utilities");
|
|
17
15
|
|
|
18
16
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
@@ -28,22 +26,47 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
28
26
|
return t;
|
|
29
27
|
};
|
|
30
28
|
|
|
29
|
+
// interface ItemType {
|
|
30
|
+
// children: React.ReactNode
|
|
31
|
+
// }
|
|
32
|
+
// interface ItemInstance {}
|
|
33
|
+
// @ts-ignore
|
|
31
34
|
var Item = /*#__PURE__*/(0, _react.forwardRef)(function (_a, ref) {
|
|
32
35
|
var children = _a.children,
|
|
33
|
-
props = __rest(_a, ["children"]);
|
|
36
|
+
props = __rest(_a, ["children"]); // const rProps = omit({ ...props, ...children.props }, [
|
|
37
|
+
// 'isSticky',
|
|
38
|
+
// 'colStart',
|
|
39
|
+
// 'colEnd',
|
|
40
|
+
// 'prefixCls',
|
|
41
|
+
// 'fixLeft',
|
|
42
|
+
// 'fixRight',
|
|
43
|
+
// 'lastFixLeft',
|
|
44
|
+
// 'firstFixRight',
|
|
45
|
+
// 'lastFixRight',
|
|
46
|
+
// 'firstFixLeft',
|
|
47
|
+
// 'isSticky',
|
|
48
|
+
// 'additionalProps',
|
|
49
|
+
// 'rowType',
|
|
50
|
+
// ])
|
|
51
|
+
|
|
34
52
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
ref
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
53
|
+
return (
|
|
54
|
+
/*#__PURE__*/
|
|
55
|
+
// <th {...rProps} ref={ref as any} />
|
|
56
|
+
_react.default.createElement("th", Object.assign({}, props, children.props, {
|
|
57
|
+
ref: ref
|
|
58
|
+
})) // <th {...props} ref={ref as any}>
|
|
59
|
+
// {(children as any)?.props?.children || children}
|
|
60
|
+
// </th>
|
|
61
|
+
|
|
62
|
+
);
|
|
42
63
|
});
|
|
43
64
|
|
|
44
65
|
function SortableItem(props) {
|
|
66
|
+
var id = props.id;
|
|
67
|
+
|
|
45
68
|
var _useSortable = (0, _sortable.useSortable)({
|
|
46
|
-
id:
|
|
69
|
+
id: id
|
|
47
70
|
}),
|
|
48
71
|
attributes = _useSortable.attributes,
|
|
49
72
|
listeners = _useSortable.listeners,
|
|
@@ -613,6 +613,12 @@ p {
|
|
|
613
613
|
padding-left: 8px;
|
|
614
614
|
padding-right: 8px;
|
|
615
615
|
}
|
|
616
|
+
.lm_editTable_warpper .ant-table-thead > tr > th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before {
|
|
617
|
+
background-color: rgba(0, 0, 0, 0.06) !important;
|
|
618
|
+
}
|
|
619
|
+
.lm_editTable_warpper .ant-table-thead > tr > th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before {
|
|
620
|
+
background-color: rgba(0, 0, 0, 0.06) !important;
|
|
621
|
+
}
|
|
616
622
|
.lm_editTable_warpper .ant-picker {
|
|
617
623
|
height: 24px !important;
|
|
618
624
|
padding: 2px 8px;
|
|
@@ -101,6 +101,12 @@
|
|
|
101
101
|
padding-left: 8px;
|
|
102
102
|
padding-right: 8px;
|
|
103
103
|
}
|
|
104
|
+
.lm_editTable_warpper .ant-table-thead > tr > th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before {
|
|
105
|
+
background-color: rgba(0, 0, 0, 0.06) !important;
|
|
106
|
+
}
|
|
107
|
+
.lm_editTable_warpper .ant-table-thead > tr > th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before {
|
|
108
|
+
background-color: rgba(0, 0, 0, 0.06) !important;
|
|
109
|
+
}
|
|
104
110
|
.lm_editTable_warpper .ant-picker {
|
|
105
111
|
height: 24px !important;
|
|
106
112
|
padding: 2px 8px;
|