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
package/dist/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> {
|
|
@@ -54,7 +54,7 @@ import { PlusCircleOutlined } from '@ant-design/icons';
|
|
|
54
54
|
import moment from 'moment';
|
|
55
55
|
import { arrayMove } from '@dnd-kit/sortable';
|
|
56
56
|
import { Button, Checkbox, IconFont, Input, InputNumber, Radio, Select, Table, Switch, DatePicker, Form, Popover } from 'linkmore-design';
|
|
57
|
-
import { get, set, isFunction, omit, isEqual, pick, isBoolean, isObject } from 'lodash';
|
|
57
|
+
import { get, set, isFunction, omit, isEqual, pick, isBoolean, isObject, debounce } from 'lodash';
|
|
58
58
|
import React, { forwardRef, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState, memo, useCallback } from 'react';
|
|
59
59
|
import { useControllableValue } from 'ahooks';
|
|
60
60
|
import { produce } from 'immer';
|
|
@@ -461,7 +461,16 @@ var EditableCell = function EditableCell(props) {
|
|
|
461
461
|
};
|
|
462
462
|
|
|
463
463
|
var Control = function Control(con) {
|
|
464
|
+
var _a;
|
|
465
|
+
|
|
464
466
|
var resultComponentProps = isFunction(componentProps) ? componentProps === null || componentProps === void 0 ? void 0 : componentProps(record, col) : componentProps;
|
|
467
|
+
|
|
468
|
+
if (isFunction(componentProps) && ((_a = col === null || col === void 0 ? void 0 : col.newOptions) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
469
|
+
resultComponentProps = Object.assign(Object.assign({}, resultComponentProps), {
|
|
470
|
+
options: col === null || col === void 0 ? void 0 : col.newOptions
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
|
|
465
474
|
var clearAttrComponentProps = omit(resultComponentProps, ['optionOnly', 'isOnlyValue', 'quickcopy']);
|
|
466
475
|
|
|
467
476
|
switch (con) {
|
|
@@ -589,7 +598,8 @@ var EditableCell = function EditableCell(props) {
|
|
|
589
598
|
|
|
590
599
|
case 'render':
|
|
591
600
|
{
|
|
592
|
-
var
|
|
601
|
+
var _resultComponentProps = resultComponentProps,
|
|
602
|
+
render = _resultComponentProps.render;
|
|
593
603
|
var fromData = form.getFieldsValue();
|
|
594
604
|
return render === null || render === void 0 ? void 0 : render(Object.assign(Object.assign({}, !isObjEmpty(fromData) ? Object.assign(Object.assign({}, record), _defineProperty({}, dataIndex, fromData[dataIndex])) : record), {
|
|
595
605
|
onChange: save
|
|
@@ -630,7 +640,8 @@ var EditableCell = function EditableCell(props) {
|
|
|
630
640
|
valuePropName: editable === 'switch' ? 'checked' : 'value',
|
|
631
641
|
style: {
|
|
632
642
|
margin: 0
|
|
633
|
-
}
|
|
643
|
+
},
|
|
644
|
+
noStyle: formProps ? false : true
|
|
634
645
|
}, formProps, {
|
|
635
646
|
name: dataIndex
|
|
636
647
|
}), Control(editable)));
|
|
@@ -642,6 +653,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
642
653
|
margin: 0
|
|
643
654
|
}
|
|
644
655
|
}, formProps, {
|
|
656
|
+
noStyle: formProps ? false : true,
|
|
645
657
|
name: [dataIndex, 'value']
|
|
646
658
|
}), Control(editable)));
|
|
647
659
|
}
|
|
@@ -698,7 +710,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
698
710
|
var MemoEditableCell = /*#__PURE__*/memo(EditableCell, function (prev, next) {
|
|
699
711
|
var pickProps = ['record', 'colIndex'];
|
|
700
712
|
var p = pick(prev, pickProps);
|
|
701
|
-
var n = pick(next, pickProps); // console.log(
|
|
713
|
+
var n = pick(next, pickProps); // console.log('333', checkMemoShouldUploadSpecialFun(prev, next), isEqual(p, n))
|
|
702
714
|
|
|
703
715
|
/** TODO: 在record中带有children,子列表数据修改之后,会导致父级的record对比不一样 */
|
|
704
716
|
|
|
@@ -812,7 +824,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
812
824
|
/** 点击添加按钮添加 */
|
|
813
825
|
|
|
814
826
|
|
|
815
|
-
var handleAdd = function
|
|
827
|
+
var handleAdd = debounce(function (row) {
|
|
816
828
|
var _a;
|
|
817
829
|
|
|
818
830
|
var addDataInfo = 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;
|
|
@@ -820,7 +832,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
820
832
|
draft.push(Object.assign(_defineProperty({}, _rowKey, "".concat(Date.now())), addDataInfo || {}));
|
|
821
833
|
});
|
|
822
834
|
setDataSource(res); // onChange?.(res)
|
|
823
|
-
};
|
|
835
|
+
}, 40);
|
|
824
836
|
/** 本地缓存一个选择数据 */
|
|
825
837
|
// useEffect(() => {
|
|
826
838
|
// if (rowSelection) {
|
|
@@ -835,7 +847,6 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
835
847
|
// ;(rowSelection?.onChange as any)?.(selectRows)
|
|
836
848
|
// }
|
|
837
849
|
|
|
838
|
-
|
|
839
850
|
var handleSave = function handleSave(row, options) {
|
|
840
851
|
var _a, _b;
|
|
841
852
|
|
|
@@ -922,7 +933,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
922
933
|
}; // @ts-ignore
|
|
923
934
|
|
|
924
935
|
|
|
925
|
-
var handleTableRowDelete = function
|
|
936
|
+
var handleTableRowDelete = debounce(function (key) {
|
|
926
937
|
var _a, _b, _c;
|
|
927
938
|
|
|
928
939
|
var rkey = isObject(key) ? key[_rowKey] : key;
|
|
@@ -966,35 +977,72 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
966
977
|
|
|
967
978
|
setDataSource(_res);
|
|
968
979
|
}
|
|
969
|
-
};
|
|
970
|
-
|
|
980
|
+
}, 40);
|
|
981
|
+
var handleTableRowReplace = debounce(function (record, defaultRecord) {
|
|
982
|
+
var _a, _b;
|
|
971
983
|
|
|
984
|
+
var rkey = isObject(record) ? record[_rowKey] : record;
|
|
985
|
+
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)
|
|
986
|
+
|
|
987
|
+
var deep = function deep(children) {
|
|
988
|
+
return children.map(function (item) {
|
|
989
|
+
if (item[_rowKey] === rkey) {
|
|
990
|
+
return defaultRecord;
|
|
991
|
+
} else if (preKeys.includes(item[_rowKey]) && item.children) {
|
|
992
|
+
var child = deep(item.children);
|
|
993
|
+
return Object.assign(Object.assign({}, item), {
|
|
994
|
+
children: child
|
|
995
|
+
});
|
|
996
|
+
} else {
|
|
997
|
+
return item;
|
|
998
|
+
}
|
|
999
|
+
});
|
|
1000
|
+
};
|
|
972
1001
|
|
|
973
|
-
|
|
1002
|
+
var res = deep(dataSourceRef.current);
|
|
1003
|
+
setDataSource(res);
|
|
1004
|
+
}, 40);
|
|
1005
|
+
/** 快捷添加 */
|
|
1006
|
+
|
|
1007
|
+
var handleTableRowAdd = debounce(function (record, isAppendInChindren, defaultRecord) {
|
|
974
1008
|
var _a, _b;
|
|
975
1009
|
|
|
976
1010
|
var rkey = isObject(record) ? record[_rowKey] : record;
|
|
977
1011
|
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;
|
|
978
1012
|
var res = produce(dataSourceRef.current, function (draft) {
|
|
979
|
-
var _a, _b, _c, _d;
|
|
1013
|
+
var _a, _b, _c, _d, _e;
|
|
980
1014
|
|
|
981
|
-
if (preKeys.length > 1) {
|
|
1015
|
+
if ((preKeys === null || preKeys === void 0 ? void 0 : preKeys.length) > 1) {
|
|
982
1016
|
var deeps = function deeps(children) {
|
|
983
1017
|
children === null || children === void 0 ? void 0 : children.forEach(function (item, index) {
|
|
984
|
-
var _a;
|
|
1018
|
+
var _a, _b;
|
|
985
1019
|
|
|
986
1020
|
if (preKeys === null || preKeys === void 0 ? void 0 : preKeys.includes(item[_rowKey])) {
|
|
987
1021
|
if (item[_rowKey] === rkey) {
|
|
988
1022
|
if (isAppendInChindren) {
|
|
989
1023
|
if (item === null || item === void 0 ? void 0 : item.children) {
|
|
990
|
-
(
|
|
1024
|
+
if (Array.isArray(defaultRecord)) {
|
|
1025
|
+
var _a2;
|
|
1026
|
+
|
|
1027
|
+
(_a = item === null || item === void 0 ? void 0 : item.children) === null || _a === void 0 ? void 0 : (_a2 = _a).push.apply(_a2, _toConsumableArray(defaultRecord));
|
|
1028
|
+
} else {
|
|
1029
|
+
(_b = item === null || item === void 0 ? void 0 : item.children) === null || _b === void 0 ? void 0 : _b.push(defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now())));
|
|
1030
|
+
}
|
|
991
1031
|
} else {
|
|
992
|
-
|
|
1032
|
+
if (Array.isArray(defaultRecord)) {
|
|
1033
|
+
item.children = _toConsumableArray(defaultRecord);
|
|
1034
|
+
} else {
|
|
1035
|
+
item.children = [defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now()))];
|
|
1036
|
+
}
|
|
993
1037
|
}
|
|
994
1038
|
|
|
995
1039
|
!expandedRowKeys.includes(item[_rowKey]) && setExpandedRowKeys([].concat(_toConsumableArray(expandedRowKeys), [item[_rowKey]]));
|
|
996
1040
|
} else {
|
|
997
|
-
|
|
1041
|
+
if (Array.isArray(defaultRecord)) {
|
|
1042
|
+
children.splice.apply(children, [index + 1, 0].concat(_toConsumableArray(defaultRecord)));
|
|
1043
|
+
} else {
|
|
1044
|
+
children.splice(index + 1, 0, defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now())));
|
|
1045
|
+
}
|
|
998
1046
|
}
|
|
999
1047
|
} else if (item.children) {
|
|
1000
1048
|
deeps(item.children);
|
|
@@ -1012,21 +1060,30 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1012
1060
|
if (index !== -1) {
|
|
1013
1061
|
if (isAppendInChindren) {
|
|
1014
1062
|
if ((_a = draft[index].children) === null || _a === void 0 ? void 0 : _a.length) {
|
|
1015
|
-
|
|
1063
|
+
if (Array.isArray(defaultRecord)) {
|
|
1064
|
+
var _b2;
|
|
1065
|
+
|
|
1066
|
+
(_b = draft[index].children) === null || _b === void 0 ? void 0 : (_b2 = _b).push.apply(_b2, _toConsumableArray(defaultRecord));
|
|
1067
|
+
} else {
|
|
1068
|
+
(_c = draft[index].children) === null || _c === void 0 ? void 0 : _c.push(defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now())));
|
|
1069
|
+
}
|
|
1016
1070
|
} else {
|
|
1017
|
-
draft[index].children = [_defineProperty({}, _rowKey, "".concat(Date.now()))];
|
|
1071
|
+
draft[index].children = Array.isArray(defaultRecord) ? _toConsumableArray(defaultRecord) : [defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now()))];
|
|
1018
1072
|
}
|
|
1019
1073
|
|
|
1020
|
-
!expandedRowKeys.includes((
|
|
1074
|
+
!expandedRowKeys.includes((_d = draft[index]) === null || _d === void 0 ? void 0 : _d[_rowKey]) && setExpandedRowKeys([].concat(_toConsumableArray(expandedRowKeys), [(_e = draft[index]) === null || _e === void 0 ? void 0 : _e[_rowKey]]));
|
|
1021
1075
|
} else {
|
|
1022
|
-
|
|
1076
|
+
if (Array.isArray(defaultRecord)) {
|
|
1077
|
+
draft.splice.apply(draft, [index + 1, 0].concat(_toConsumableArray(defaultRecord)));
|
|
1078
|
+
} else {
|
|
1079
|
+
draft.splice(index + 1, 0, defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now())));
|
|
1080
|
+
}
|
|
1023
1081
|
}
|
|
1024
1082
|
}
|
|
1025
1083
|
}
|
|
1026
1084
|
});
|
|
1027
|
-
console.log(preKeys, '--preKeys', res);
|
|
1028
1085
|
setDataSource(res);
|
|
1029
|
-
};
|
|
1086
|
+
}, 40);
|
|
1030
1087
|
|
|
1031
1088
|
var handleCopy = function handleCopy(key, value, type, rowIndex) {
|
|
1032
1089
|
var res = produce(dataSourceRef.current, function (draft) {
|
|
@@ -1045,8 +1102,9 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1045
1102
|
var hasOnlyOptionsDatas = columns.filter(function (item) {
|
|
1046
1103
|
var _a;
|
|
1047
1104
|
|
|
1048
|
-
|
|
1049
|
-
|
|
1105
|
+
var resultComponentProps = 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;
|
|
1106
|
+
return resultComponentProps === null || resultComponentProps === void 0 ? void 0 : resultComponentProps.optionOnly;
|
|
1107
|
+
}); // const hasOnlyOptionsDatas = columns.filter((item) => item?.componentProps?.optionOnly)
|
|
1050
1108
|
|
|
1051
1109
|
if (hasOnlyOptionsDatas.length) {
|
|
1052
1110
|
return hasOnlyOptionsDatas === null || hasOnlyOptionsDatas === void 0 ? void 0 : hasOnlyOptionsDatas.map(function (item) {
|
|
@@ -1060,9 +1118,13 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1060
1118
|
|
|
1061
1119
|
var DisableOptions = useMemo(function () {
|
|
1062
1120
|
var newColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (item) {
|
|
1063
|
-
var
|
|
1064
|
-
|
|
1065
|
-
|
|
1121
|
+
var _a;
|
|
1122
|
+
|
|
1123
|
+
var resultComponentProps = isFunction(item.componentProps) ? (_a = item.componentProps) === null || _a === void 0 ? void 0 : _a.call(item, {}, item) : item.componentProps;
|
|
1124
|
+
|
|
1125
|
+
var _ref9 = resultComponentProps || {},
|
|
1126
|
+
optionOnly = _ref9.optionOnly,
|
|
1127
|
+
options = _ref9.options;
|
|
1066
1128
|
|
|
1067
1129
|
if (optionOnly && options) {
|
|
1068
1130
|
var dataIndex = item.dataIndex;
|
|
@@ -1074,6 +1136,13 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1074
1136
|
disabled: !!dataIndexData.includes(o === null || o === void 0 ? void 0 : o.value)
|
|
1075
1137
|
});
|
|
1076
1138
|
});
|
|
1139
|
+
|
|
1140
|
+
if (isFunction(item.componentProps)) {
|
|
1141
|
+
return Object.assign(Object.assign({}, item), {
|
|
1142
|
+
newOptions: newOptions
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1077
1146
|
return Object.assign(Object.assign({}, item), {
|
|
1078
1147
|
componentProps: Object.assign(Object.assign({}, item.componentProps), {
|
|
1079
1148
|
options: newOptions
|
|
@@ -1101,7 +1170,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1101
1170
|
fixed: 'left',
|
|
1102
1171
|
render: function render(_, record) {
|
|
1103
1172
|
return /*#__PURE__*/React.createElement(DragHandle, {
|
|
1104
|
-
id: record[_rowKey] || record.id
|
|
1173
|
+
id: record[_rowKey] || (record === null || record === void 0 ? void 0 : record.id)
|
|
1105
1174
|
});
|
|
1106
1175
|
}
|
|
1107
1176
|
} : null, indexCol ? isBoolean(indexCol) ? {
|
|
@@ -1251,8 +1320,8 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1251
1320
|
deleteRowData: function deleteRowData(data) {
|
|
1252
1321
|
return handleTableRowDelete(data);
|
|
1253
1322
|
},
|
|
1254
|
-
addRowData: function addRowData(data,
|
|
1255
|
-
return handleTableRowAdd(data,
|
|
1323
|
+
addRowData: function addRowData(data, defaultValue, addInChild) {
|
|
1324
|
+
return addInChild === 'replace' ? handleTableRowReplace(data, defaultValue) : handleTableRowAdd(data, addInChild, defaultValue);
|
|
1256
1325
|
},
|
|
1257
1326
|
clearSelect: function clearSelect() {
|
|
1258
1327
|
setLocalRowSelectList({
|
|
@@ -12,24 +12,49 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
import React, { forwardRef } from 'react';
|
|
15
|
-
import { useSortable } from '@dnd-kit/sortable';
|
|
16
|
-
|
|
17
|
-
import { CSS } from '@dnd-kit/utilities';
|
|
15
|
+
import { useSortable } from '@dnd-kit/sortable'; // import { omit } from 'lodash'
|
|
16
|
+
|
|
17
|
+
import { CSS } from '@dnd-kit/utilities'; // interface ItemType {
|
|
18
|
+
// children: React.ReactNode
|
|
19
|
+
// }
|
|
20
|
+
// interface ItemInstance {}
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
|
|
18
23
|
var Item = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
19
24
|
var children = _a.children,
|
|
20
|
-
props = __rest(_a, ["children"]);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
25
|
+
props = __rest(_a, ["children"]); // const rProps = omit({ ...props, ...children.props }, [
|
|
26
|
+
// 'isSticky',
|
|
27
|
+
// 'colStart',
|
|
28
|
+
// 'colEnd',
|
|
29
|
+
// 'prefixCls',
|
|
30
|
+
// 'fixLeft',
|
|
31
|
+
// 'fixRight',
|
|
32
|
+
// 'lastFixLeft',
|
|
33
|
+
// 'firstFixRight',
|
|
34
|
+
// 'lastFixRight',
|
|
35
|
+
// 'firstFixLeft',
|
|
36
|
+
// 'isSticky',
|
|
37
|
+
// 'additionalProps',
|
|
38
|
+
// 'rowType',
|
|
39
|
+
// ])
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
/*#__PURE__*/
|
|
44
|
+
// <th {...rProps} ref={ref as any} />
|
|
45
|
+
React.createElement("th", Object.assign({}, props, children.props, {
|
|
46
|
+
ref: ref
|
|
47
|
+
})) // <th {...props} ref={ref as any}>
|
|
48
|
+
// {(children as any)?.props?.children || children}
|
|
49
|
+
// </th>
|
|
50
|
+
|
|
51
|
+
);
|
|
29
52
|
});
|
|
30
53
|
export default function SortableItem(props) {
|
|
54
|
+
var id = props.id;
|
|
55
|
+
|
|
31
56
|
var _useSortable = useSortable({
|
|
32
|
-
id:
|
|
57
|
+
id: id
|
|
33
58
|
}),
|
|
34
59
|
attributes = _useSortable.attributes,
|
|
35
60
|
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;
|
package/es/LmEditTable/util.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
-
import { keyBy, isEqual, pick } from 'lodash';
|
|
3
|
+
import { keyBy, isEqual, pick, isFunction, omit } from 'lodash';
|
|
4
4
|
export function isObjEmpty(obj) {
|
|
5
5
|
var _a;
|
|
6
6
|
|
|
@@ -61,7 +61,7 @@ export function getExpandStatus(children) {
|
|
|
61
61
|
return isExpandRow(children) ? (_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'] : '';
|
|
62
62
|
}
|
|
63
63
|
export function checkMemoShouldUploadSpecialFun(prev, next) {
|
|
64
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
64
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
65
65
|
|
|
66
66
|
var checkExpandStatus = getExpandStatus(prev.children) === getExpandStatus(next.children);
|
|
67
67
|
|
|
@@ -75,9 +75,14 @@ export function checkMemoShouldUploadSpecialFun(prev, next) {
|
|
|
75
75
|
|
|
76
76
|
if (((prevCol === null || prevCol === void 0 ? void 0 : prevCol.render) || (nextCol === null || nextCol === void 0 ? void 0 : nextCol.render)) && !isEqual(pick(prev, ['colIndex', 'record', 'children']), pick(next, ['colIndex', 'record', 'children']))) {
|
|
77
77
|
return false;
|
|
78
|
+
} // console.log(22, prevCol?.editable === 'render', nextCol?.editable === 'render', prevCol?.componentProps, prevCol?.componentProps)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
if (((prevCol === null || prevCol === void 0 ? void 0 : prevCol.editable) === 'render' || (nextCol === null || nextCol === void 0 ? void 0 : nextCol.editable) === 'render') && (((_a = prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) === null || _a === void 0 ? void 0 : _a.render) || ((_b = nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps) === null || _b === void 0 ? void 0 : _b.render)) && !isEqual(omit(prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps, ['render']), omit(nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps, ['render']))) {
|
|
82
|
+
return false;
|
|
78
83
|
}
|
|
79
84
|
|
|
80
|
-
if (((prevCol === null || prevCol === void 0 ? void 0 : prevCol.editable) === 'render' || (nextCol === null || nextCol === void 0 ? void 0 : nextCol.editable) === 'render') && (((
|
|
85
|
+
if (((prevCol === null || prevCol === void 0 ? void 0 : prevCol.editable) === 'render' || (nextCol === null || nextCol === void 0 ? void 0 : nextCol.editable) === 'render') && (((_c = prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) === null || _c === void 0 ? void 0 : _c.render) || ((_d = nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps) === null || _d === void 0 ? void 0 : _d.render)) && !isEqual(pick(prev, ['colIndex', 'record', 'rowIndex']), pick(next, ['colIndex', 'record', 'rowIndex']))) {
|
|
81
86
|
return false;
|
|
82
87
|
}
|
|
83
88
|
|
|
@@ -85,8 +90,15 @@ export function checkMemoShouldUploadSpecialFun(prev, next) {
|
|
|
85
90
|
return false;
|
|
86
91
|
}
|
|
87
92
|
|
|
88
|
-
if ((((
|
|
89
|
-
|
|
93
|
+
if ((((_e = prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) === null || _e === void 0 ? void 0 : _e.optionOnly) || ((_f = nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps) === null || _f === void 0 ? void 0 : _f.optionOnly)) && !isEqual((_g = prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) === null || _g === void 0 ? void 0 : _g.options, (_h = nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps) === null || _h === void 0 ? void 0 : _h.options)) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if ((((_j = prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) === null || _j === void 0 ? void 0 : _j.options) || ((_k = nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps) === null || _k === void 0 ? void 0 : _k.options)) && !isEqual((_l = prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) === null || _l === void 0 ? void 0 : _l.options, (_m = nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps) === null || _m === void 0 ? void 0 : _m.options)) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if ((isFunction(prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) || isFunction(nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps)) && !isEqual(prevCol.newOptions, nextCol.newOptions) && !isEqual(prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps, nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps)) {
|
|
90
102
|
return false;
|
|
91
103
|
}
|
|
92
104
|
|
|
@@ -95,13 +107,17 @@ export function checkMemoShouldUploadSpecialFun(prev, next) {
|
|
|
95
107
|
return false;
|
|
96
108
|
}
|
|
97
109
|
|
|
110
|
+
if (next.className.indexOf('drag-visible') > -1) {
|
|
111
|
+
return isEqual(prev.style, next.style);
|
|
112
|
+
}
|
|
113
|
+
|
|
98
114
|
if (next.className.indexOf('ant-table-selection-column') > -1) {
|
|
99
|
-
return isEqual((
|
|
115
|
+
return isEqual((_p = (_o = prev.children) === null || _o === void 0 ? void 0 : _o[1]) === null || _p === void 0 ? void 0 : _p.props, (_r = (_q = next.children) === null || _q === void 0 ? void 0 : _q[1]) === null || _r === void 0 ? void 0 : _r.props);
|
|
100
116
|
}
|
|
101
117
|
/** 如果启用了快速复制功能,需要实时判断rowIndex与getLength */
|
|
102
118
|
|
|
103
119
|
|
|
104
|
-
if (((
|
|
120
|
+
if (((_s = prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) === null || _s === void 0 ? void 0 : _s.quickcopy) || ((_t = nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps) === null || _t === void 0 ? void 0 : _t.quickcopy)) {
|
|
105
121
|
var pickProps = ['record', 'colIndex', 'rowIndex', 'getLength'];
|
|
106
122
|
var p = pick(prev, pickProps);
|
|
107
123
|
var n = pick(next, pickProps);
|
|
@@ -110,15 +110,6 @@
|
|
|
110
110
|
}
|
|
111
111
|
.lm_filter_basic_item .filter_item_icon .icon_clear {
|
|
112
112
|
display: none;
|
|
113
|
-
opacity: 0;
|
|
114
|
-
}
|
|
115
|
-
.lm_filter_basic_item .filter_item_icon:hover .icon_down {
|
|
116
|
-
display: none;
|
|
117
|
-
opacity: 0;
|
|
118
|
-
}
|
|
119
|
-
.lm_filter_basic_item .filter_item_icon:hover .icon_clear {
|
|
120
|
-
display: inline-block;
|
|
121
|
-
opacity: 1;
|
|
122
113
|
}
|
|
123
114
|
.lm_filter_basic_item.expand .filter_item_icon.addon_after {
|
|
124
115
|
transform: rotateX(180deg);
|
|
@@ -133,6 +124,12 @@
|
|
|
133
124
|
.lm_filter_basic_item.active.lm_filter_complex_item .filter_item_label {
|
|
134
125
|
color: var(--primary-color);
|
|
135
126
|
}
|
|
127
|
+
.lm_filter_basic_item.active:hover .icon_down {
|
|
128
|
+
display: none;
|
|
129
|
+
}
|
|
130
|
+
.lm_filter_basic_item.active:hover .icon_clear {
|
|
131
|
+
display: inline-block;
|
|
132
|
+
}
|
|
136
133
|
.ant-dropdown.filter_dropdown_container_cascader > div {
|
|
137
134
|
transform: translateY(-4px);
|
|
138
135
|
}
|
|
@@ -110,15 +110,6 @@
|
|
|
110
110
|
}
|
|
111
111
|
.lm_filter_basic_item .filter_item_icon .icon_clear {
|
|
112
112
|
display: none;
|
|
113
|
-
opacity: 0;
|
|
114
|
-
}
|
|
115
|
-
.lm_filter_basic_item .filter_item_icon:hover .icon_down {
|
|
116
|
-
display: none;
|
|
117
|
-
opacity: 0;
|
|
118
|
-
}
|
|
119
|
-
.lm_filter_basic_item .filter_item_icon:hover .icon_clear {
|
|
120
|
-
display: inline-block;
|
|
121
|
-
opacity: 1;
|
|
122
113
|
}
|
|
123
114
|
.lm_filter_basic_item.expand .filter_item_icon.addon_after {
|
|
124
115
|
transform: rotateX(180deg);
|
|
@@ -133,6 +124,12 @@
|
|
|
133
124
|
.lm_filter_basic_item.active.lm_filter_complex_item .filter_item_label {
|
|
134
125
|
color: var(--primary-color);
|
|
135
126
|
}
|
|
127
|
+
.lm_filter_basic_item.active:hover .icon_down {
|
|
128
|
+
display: none;
|
|
129
|
+
}
|
|
130
|
+
.lm_filter_basic_item.active:hover .icon_clear {
|
|
131
|
+
display: inline-block;
|
|
132
|
+
}
|
|
136
133
|
.ant-dropdown.filter_dropdown_container_cascader > div {
|
|
137
134
|
transform: translateY(-4px);
|
|
138
135
|
}
|
package/es/LmTable/Table.js
CHANGED
|
@@ -1086,13 +1086,19 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1086
1086
|
var selectedRows = useSelectedRows.selectedRows;
|
|
1087
1087
|
|
|
1088
1088
|
if (tableRowType === 'select' || tableRowType === 'default' && selectedRows.length) {
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
selectedRows
|
|
1095
|
-
|
|
1089
|
+
if ((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.type) === 'radio') {
|
|
1090
|
+
setSelectedRows({
|
|
1091
|
+
selectedRows: [(0, _lodash.isObject)(selectedRows[0]) || !selectedRows.length ? record : record[rowKey]]
|
|
1092
|
+
});
|
|
1093
|
+
} else {
|
|
1094
|
+
var selectIndex = selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows.findIndex(function (v) {
|
|
1095
|
+
return (0, _lodash.isObject)(v) ? v[rowKey] === record[rowKey] : v === record[rowKey];
|
|
1096
|
+
});
|
|
1097
|
+
selectIndex >= 0 ? selectedRows.splice(selectIndex, 1) : selectedRows.push((0, _lodash.isObject)(selectedRows[0]) || !selectedRows.length ? record : record[rowKey]);
|
|
1098
|
+
setSelectedRows({
|
|
1099
|
+
selectedRows: (0, _lodash.cloneDeep)(selectedRows)
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1096
1102
|
}
|
|
1097
1103
|
} else {
|
|
1098
1104
|
rowClick === null || rowClick === void 0 ? void 0 : rowClick(record);
|
|
@@ -1176,7 +1182,7 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1176
1182
|
}); // rowClick?.(reulstSelect)
|
|
1177
1183
|
} : undefined,
|
|
1178
1184
|
onSelect: (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRows) ? function (record, selected) {
|
|
1179
|
-
var reulstSelect = selected ? (0, _lodash.uniqBy)([].concat((0, _toConsumableArray2.default)(rowSelection.selectedRows), [record]), rowKey) : rowSelection.selectedRows.filter(function (item) {
|
|
1185
|
+
var reulstSelect = rowSelection.type === 'radio' ? [record] : selected ? (0, _lodash.uniqBy)([].concat((0, _toConsumableArray2.default)(rowSelection.selectedRows), [record]), rowKey) : rowSelection.selectedRows.filter(function (item) {
|
|
1180
1186
|
return item[rowKey] !== record[rowKey];
|
|
1181
1187
|
});
|
|
1182
1188
|
setSelectedRows({
|
|
@@ -6,6 +6,7 @@ var PictureItem = function PictureItem(_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
|
preview = instance.preview,
|
|
11
12
|
download = instance.download,
|
|
@@ -27,7 +28,7 @@ var PictureItem = function PictureItem(_ref) {
|
|
|
27
28
|
onClick: function onClick() {
|
|
28
29
|
return download(file);
|
|
29
30
|
}
|
|
30
|
-
}, file[fileNames.fileName])), !readOnly && /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
}, file[fileNames.fileName])), !readOnly && !disabled && /*#__PURE__*/React.createElement("div", {
|
|
31
32
|
className: "picture_right lm_upload_item_action"
|
|
32
33
|
}, /*#__PURE__*/React.createElement("div", {
|
|
33
34
|
className: "action_delete",
|