linkmore-design 1.1.27-alpha.1 → 1.1.27-alpha.4
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/LmEditTable/EditTable.d.ts +4 -0
- package/dist/LmEditTable/util.d.ts +3 -1
- package/dist/index.umd.js +428 -43
- package/dist/index.umd.min.js +21 -21
- package/dist/variables.css +17 -0
- package/es/CustomTableOption/style/index.css +3 -0
- package/es/CustomTableOption/style/variables.css +3 -0
- package/es/LmEditTable/EditTable.d.ts +4 -0
- package/es/LmEditTable/EditTable.js +329 -12
- package/es/LmEditTable/rowSort/DndContainerRow.js +4 -2
- package/es/LmEditTable/style/index.css +14 -0
- package/es/LmEditTable/style/variables.css +14 -0
- package/es/LmEditTable/util.d.ts +3 -1
- package/es/LmEditTable/util.js +61 -8
- package/es/LmEditTable/virtual/VirtualRow.js +11 -5
- package/es/LmEditTable/virtual/VirtualTable.js +3 -1
- package/es/LmFilter/baseFilter/index.js +3 -2
- package/es/LmFilter/filterFns/index.js +4 -2
- package/es/LmUpload/body/UploadCore.js +1 -1
- package/es/Radio/index.js +9 -1
- package/es/Switch/index.js +7 -2
- package/es/styles/variables.css +17 -0
- package/lib/CustomTableOption/style/index.css +3 -0
- package/lib/CustomTableOption/style/variables.css +3 -0
- package/lib/LmEditTable/EditTable.d.ts +4 -0
- package/lib/LmEditTable/EditTable.js +328 -11
- package/lib/LmEditTable/rowSort/DndContainerRow.js +3 -2
- package/lib/LmEditTable/style/index.css +14 -0
- package/lib/LmEditTable/style/variables.css +14 -0
- package/lib/LmEditTable/util.d.ts +3 -1
- package/lib/LmEditTable/util.js +62 -7
- package/lib/LmEditTable/virtual/VirtualRow.js +11 -5
- package/lib/LmEditTable/virtual/VirtualTable.js +3 -1
- package/lib/LmFilter/baseFilter/index.js +3 -2
- package/lib/LmFilter/filterFns/index.js +4 -2
- package/lib/LmUpload/body/UploadCore.js +1 -1
- package/lib/Radio/index.js +9 -1
- package/lib/Switch/index.js +9 -2
- package/lib/styles/variables.css +17 -0
- package/package.json +1 -1
package/dist/variables.css
CHANGED
|
@@ -1759,6 +1759,9 @@ p {
|
|
|
1759
1759
|
color: var(--primary-color);
|
|
1760
1760
|
cursor: pointer;
|
|
1761
1761
|
}
|
|
1762
|
+
.lm_custom_option_columns .custom_hiddle {
|
|
1763
|
+
display: none;
|
|
1764
|
+
}
|
|
1762
1765
|
.lm_custom_option_columns .fixed_title {
|
|
1763
1766
|
color: var(--color-45);
|
|
1764
1767
|
font-size: 12px;
|
|
@@ -9870,6 +9873,20 @@ p {
|
|
|
9870
9873
|
padding-left: 7px;
|
|
9871
9874
|
box-sizing: border-box;
|
|
9872
9875
|
}
|
|
9876
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table-wrapper,
|
|
9877
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-spin-nested-loading,
|
|
9878
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-spin-container,
|
|
9879
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table,
|
|
9880
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table-container {
|
|
9881
|
+
height: 100%;
|
|
9882
|
+
}
|
|
9883
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table-wrapper .ant-table-body,
|
|
9884
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-spin-nested-loading .ant-table-body,
|
|
9885
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-spin-container .ant-table-body,
|
|
9886
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table .ant-table-body,
|
|
9887
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table-container .ant-table-body {
|
|
9888
|
+
height: calc(100% - 41px);
|
|
9889
|
+
}
|
|
9873
9890
|
.lm_editTable_wrapperRange .inputRange {
|
|
9874
9891
|
display: inline-flex;
|
|
9875
9892
|
align-items: center;
|
|
@@ -15,6 +15,7 @@ interface ILmEditTable extends TableProps<any> {
|
|
|
15
15
|
size?: TableProps<any>['size'];
|
|
16
16
|
colSortOpen?: boolean;
|
|
17
17
|
indexCol?: boolean | Record<string, any>;
|
|
18
|
+
autoSizer?: boolean;
|
|
18
19
|
filterChange?: (data: TableProps<any>['columns']) => void;
|
|
19
20
|
recordCreatorProps?: {
|
|
20
21
|
creatorButtonText?: string;
|
|
@@ -27,6 +28,9 @@ interface ILmEditTable extends TableProps<any> {
|
|
|
27
28
|
rowSelection?: TableProps<any>['rowSelection'] & {
|
|
28
29
|
selectedRows?: Record<string, any>;
|
|
29
30
|
};
|
|
31
|
+
rowDisabled?: {
|
|
32
|
+
disabledRows?: Record<string, any>;
|
|
33
|
+
};
|
|
30
34
|
}
|
|
31
35
|
export interface CountdownHandle {
|
|
32
36
|
setRow: (data: any) => void;
|
|
@@ -61,7 +61,7 @@ import SortableItem from './sortableItem';
|
|
|
61
61
|
import ColSortableItem from './sortableItemCol';
|
|
62
62
|
import DragHandle from './DragHandle';
|
|
63
63
|
import UploadOss from '../UploadOss';
|
|
64
|
-
import { isObjEmpty, deepDataSourcePreKeys, isExpandRow, checkRowKeyByDataSource, checkMemoShouldUploadSpecialFun, checkExpandIconColumnIndex, checkDataSourceIsEmpty } from './util';
|
|
64
|
+
import { isObjEmpty, deepDataSourcePreKeys, isExpandRow, checkRowKeyByDataSource, checkMemoShouldUploadSpecialFun, checkExpandIconColumnIndex, checkDataSourceIsEmpty, checkTableRowIsDisable } from './util';
|
|
65
65
|
import { DraggableContainer, BottomOpetateComponent, QuickOpetate, CustomizeRenderEmpty } from './components';
|
|
66
66
|
import cls from 'classnames';
|
|
67
67
|
import ConfigProvider from '../ConfigProvider';
|
|
@@ -78,8 +78,12 @@ var EditableRow = function EditableRow(_a) {
|
|
|
78
78
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
79
79
|
form = _Form$useForm2[0];
|
|
80
80
|
|
|
81
|
+
var dataKey = props.dataKey,
|
|
82
|
+
pushAllForm = props.pushAllForm;
|
|
83
|
+
pushAllForm === null || pushAllForm === void 0 ? void 0 : pushAllForm(form, dataKey, index);
|
|
81
84
|
return /*#__PURE__*/React.createElement(Form, {
|
|
82
85
|
form: form,
|
|
86
|
+
disabled: props.disabled || false,
|
|
83
87
|
component: false
|
|
84
88
|
}, /*#__PURE__*/React.createElement(EditableContext.Provider, {
|
|
85
89
|
value: form
|
|
@@ -94,6 +98,9 @@ var EditableSortRow = function EditableSortRow(_a) {
|
|
|
94
98
|
_Form$useForm4 = _slicedToArray(_Form$useForm3, 1),
|
|
95
99
|
form = _Form$useForm4[0];
|
|
96
100
|
|
|
101
|
+
var dataKey = props.dataKey,
|
|
102
|
+
pushAllForm = props.pushAllForm;
|
|
103
|
+
pushAllForm === null || pushAllForm === void 0 ? void 0 : pushAllForm(form, dataKey, index);
|
|
97
104
|
return /*#__PURE__*/React.createElement(Form, {
|
|
98
105
|
form: form,
|
|
99
106
|
disabled: props.disabled || false,
|
|
@@ -661,6 +668,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
661
668
|
_props$quickOpetateCl = props.quickOpetateClearAll,
|
|
662
669
|
quickOpetateClearAll = _props$quickOpetateCl === void 0 ? true : _props$quickOpetateCl,
|
|
663
670
|
rowSelection = props.rowSelection,
|
|
671
|
+
rowDisabled = props.rowDisabled,
|
|
664
672
|
virtual = props.virtual,
|
|
665
673
|
sortOpen = props.sortOpen,
|
|
666
674
|
disabled = props.disabled,
|
|
@@ -675,7 +683,9 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
675
683
|
shouldUpdate = _props$shouldUpdate === void 0 ? false : _props$shouldUpdate,
|
|
676
684
|
_props$loading = props.loading,
|
|
677
685
|
loading = _props$loading === void 0 ? false : _props$loading,
|
|
678
|
-
|
|
686
|
+
_props$autoSizer = props.autoSizer,
|
|
687
|
+
autoSizer = _props$autoSizer === void 0 ? false : _props$autoSizer,
|
|
688
|
+
resetProps = __rest(props, ["value", "columns", "isEdit", "isAdd", "onChange", "rowKey", "rowHoverEdit", "isUseForm", "isHoverEdit", "useQuickOpetate", "quickOpetateClearAll", "rowSelection", "rowDisabled", "virtual", "sortOpen", "disabled", "colSortOpen", "indexCol", "filterChange", "size", "recordCreatorProps", "shouldUpdate", "loading", "autoSizer"]);
|
|
679
689
|
|
|
680
690
|
var _useControllableValue = useControllableValue({
|
|
681
691
|
value: checkRowKeyByDataSource(props.value, _rowKey),
|
|
@@ -700,6 +710,14 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
700
710
|
_useControllableValue4 = _slicedToArray(_useControllableValue3, 2),
|
|
701
711
|
localRowSelectList = _useControllableValue4[0],
|
|
702
712
|
setLocalRowSelectList = _useControllableValue4[1];
|
|
713
|
+
|
|
714
|
+
var _useControllableValue5 = useControllableValue({
|
|
715
|
+
value: {
|
|
716
|
+
disabledRows: (rowDisabled === null || rowDisabled === void 0 ? void 0 : rowDisabled.disabledRows) || []
|
|
717
|
+
}
|
|
718
|
+
}),
|
|
719
|
+
_useControllableValue6 = _slicedToArray(_useControllableValue5, 1),
|
|
720
|
+
localDisabledRows = _useControllableValue6[0];
|
|
703
721
|
/** TODO: 当前展开的列 */
|
|
704
722
|
|
|
705
723
|
|
|
@@ -712,7 +730,16 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
712
730
|
var deepDataSourceRef = useRef(deepDataSourcePreKeys(dataSource, _rowKey));
|
|
713
731
|
dataSourceRef.current = dataSource;
|
|
714
732
|
deepDataSourceRef.current = deepDataSourcePreKeys(dataSource, _rowKey);
|
|
733
|
+
var disabledDataSourceRowKeys = useRef(checkTableRowIsDisable(deepDataSourceRef.current, localDisabledRows.disabledRows, _rowKey));
|
|
734
|
+
disabledDataSourceRowKeys.current = checkTableRowIsDisable(deepDataSourceRef.current, localDisabledRows.disabledRows, _rowKey);
|
|
715
735
|
var tableWarpRef = useRef(null);
|
|
736
|
+
var autoSizerRef = useRef(null);
|
|
737
|
+
var allFormListRef = useRef({});
|
|
738
|
+
var scrollToIndexRef = useRef(null);
|
|
739
|
+
|
|
740
|
+
var _Form$useForm5 = Form.useForm(),
|
|
741
|
+
_Form$useForm6 = _slicedToArray(_Form$useForm5, 1),
|
|
742
|
+
checkForm = _Form$useForm6[0];
|
|
716
743
|
|
|
717
744
|
var onColSortEnd = function onColSortEnd(active, over) {
|
|
718
745
|
var _a;
|
|
@@ -1091,7 +1118,6 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1091
1118
|
render: function render(_, record, index) {
|
|
1092
1119
|
var _a, _b, _c;
|
|
1093
1120
|
|
|
1094
|
-
console.log(deepDataSourceRef.current, '--deepDataSourceRef.current', _rowKey);
|
|
1095
1121
|
return ((_c = (_b = (_a = deepDataSourceRef.current) === null || _a === void 0 ? void 0 : _a[record[_rowKey]]) === null || _b === void 0 ? void 0 : _b['_deepIds']) === null || _c === void 0 ? void 0 : _c.join('-')) || "".concat(index + 1);
|
|
1096
1122
|
}
|
|
1097
1123
|
} : Object.assign(Object.assign({
|
|
@@ -1258,12 +1284,249 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1258
1284
|
},
|
|
1259
1285
|
columns: columns.map(function (item) {
|
|
1260
1286
|
return omit(item, ['render', 'sorter', 'onFilter', 'filters', 'componentProps', 'formProps', 'editable']);
|
|
1261
|
-
})
|
|
1287
|
+
}),
|
|
1288
|
+
// verify: async () => {
|
|
1289
|
+
// let allRule = {}
|
|
1290
|
+
// let time
|
|
1291
|
+
// let fullNum = 0
|
|
1292
|
+
// columns.forEach((col: any) => {
|
|
1293
|
+
// if (col?.formProps?.rules) {
|
|
1294
|
+
// allRule[col.dataIndex] = col?.formProps?.rules || []
|
|
1295
|
+
// }
|
|
1296
|
+
// })
|
|
1297
|
+
// const validator = new AsyncValidator(allRule);
|
|
1298
|
+
// let flag = true
|
|
1299
|
+
// let messageIndex = null
|
|
1300
|
+
// let errorRowKey = null
|
|
1301
|
+
// let errorInfo = null
|
|
1302
|
+
// const deepValidator = async (data, index) => {
|
|
1303
|
+
// for (let i = 0; i < data.length; i++) {
|
|
1304
|
+
// if (flag) {
|
|
1305
|
+
// try {
|
|
1306
|
+
// await validator.validate(data[i], (errors, fields) => {
|
|
1307
|
+
// if (errors) {
|
|
1308
|
+
// errorInfo = { errors, fields, value: data[i] };
|
|
1309
|
+
// flag = false
|
|
1310
|
+
// messageIndex = index === null ? i : index
|
|
1311
|
+
// errorRowKey = data?.[i]?.[rowKey]
|
|
1312
|
+
// } else if (data[i].children) {
|
|
1313
|
+
// deepValidator(data[i].children, i)
|
|
1314
|
+
// }
|
|
1315
|
+
// })
|
|
1316
|
+
// } catch (error) {
|
|
1317
|
+
// break;
|
|
1318
|
+
// }
|
|
1319
|
+
// }
|
|
1320
|
+
// }
|
|
1321
|
+
// }
|
|
1322
|
+
// await deepValidator(dataSource, null)
|
|
1323
|
+
// console.log(flag, 'fff')
|
|
1324
|
+
// if (flag) {
|
|
1325
|
+
// return Promise.resolve(dataSource)
|
|
1326
|
+
// } else {
|
|
1327
|
+
// setTimeout(() => {
|
|
1328
|
+
// if (messageIndex !== null) {
|
|
1329
|
+
// scrollToIndexRef.current?.(messageIndex, { align: 'center' })
|
|
1330
|
+
// time = setInterval(async () => {
|
|
1331
|
+
// fullNum++
|
|
1332
|
+
// if (fullNum > 5) {
|
|
1333
|
+
// clearInterval(time)
|
|
1334
|
+
// } else {
|
|
1335
|
+
// const form = (Object.values(allFormListRef.current || []).find((item: any) => item.key === errorRowKey) as any)?.form
|
|
1336
|
+
// if (form) {
|
|
1337
|
+
// try {
|
|
1338
|
+
// await form.validateFields()
|
|
1339
|
+
// console.log('验证成功')
|
|
1340
|
+
// } catch (error) {
|
|
1341
|
+
// console.log('验证失败', error)
|
|
1342
|
+
// return error
|
|
1343
|
+
// } finally {
|
|
1344
|
+
// clearInterval(time)
|
|
1345
|
+
// }
|
|
1346
|
+
// }
|
|
1347
|
+
// }
|
|
1348
|
+
// }, 500)
|
|
1349
|
+
// }
|
|
1350
|
+
// }, 100)
|
|
1351
|
+
// return Promise.reject(errorInfo)
|
|
1352
|
+
// }
|
|
1353
|
+
// },
|
|
1354
|
+
verify: function verify() {
|
|
1355
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
1356
|
+
var time, fullNum, flag, messageIndex, errorRowKey, errorInfo, deepValidator;
|
|
1357
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
1358
|
+
while (1) {
|
|
1359
|
+
switch (_context4.prev = _context4.next) {
|
|
1360
|
+
case 0:
|
|
1361
|
+
fullNum = 0;
|
|
1362
|
+
flag = true;
|
|
1363
|
+
messageIndex = null;
|
|
1364
|
+
errorRowKey = null;
|
|
1365
|
+
errorInfo = null;
|
|
1366
|
+
|
|
1367
|
+
deepValidator = function deepValidator(data, index) {
|
|
1368
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
1369
|
+
var _c, i;
|
|
1370
|
+
|
|
1371
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1372
|
+
while (1) {
|
|
1373
|
+
switch (_context2.prev = _context2.next) {
|
|
1374
|
+
case 0:
|
|
1375
|
+
i = 0;
|
|
1376
|
+
|
|
1377
|
+
case 1:
|
|
1378
|
+
if (!(i < data.length)) {
|
|
1379
|
+
_context2.next = 21;
|
|
1380
|
+
break;
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
if (!flag) {
|
|
1384
|
+
_context2.next = 18;
|
|
1385
|
+
break;
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
_context2.prev = 3;
|
|
1389
|
+
checkForm.resetFields();
|
|
1390
|
+
checkForm.setFieldsValue(data[i]);
|
|
1391
|
+
_context2.next = 8;
|
|
1392
|
+
return checkForm.validateFields();
|
|
1393
|
+
|
|
1394
|
+
case 8:
|
|
1395
|
+
if (data[i].children) {
|
|
1396
|
+
deepValidator(data[i].children, i);
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
_context2.next = 18;
|
|
1400
|
+
break;
|
|
1401
|
+
|
|
1402
|
+
case 11:
|
|
1403
|
+
_context2.prev = 11;
|
|
1404
|
+
_context2.t0 = _context2["catch"](3);
|
|
1405
|
+
errorInfo = {
|
|
1406
|
+
error: _context2.t0,
|
|
1407
|
+
value: data[i]
|
|
1408
|
+
};
|
|
1409
|
+
flag = false;
|
|
1410
|
+
messageIndex = index === null ? i : index;
|
|
1411
|
+
errorRowKey = (_c = data === null || data === void 0 ? void 0 : data[i]) === null || _c === void 0 ? void 0 : _c[_rowKey];
|
|
1412
|
+
return _context2.abrupt("break", 21);
|
|
1413
|
+
|
|
1414
|
+
case 18:
|
|
1415
|
+
i++;
|
|
1416
|
+
_context2.next = 1;
|
|
1417
|
+
break;
|
|
1418
|
+
|
|
1419
|
+
case 21:
|
|
1420
|
+
case "end":
|
|
1421
|
+
return _context2.stop();
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
}, _callee2, null, [[3, 11]]);
|
|
1425
|
+
}));
|
|
1426
|
+
};
|
|
1427
|
+
|
|
1428
|
+
_context4.next = 8;
|
|
1429
|
+
return deepValidator(dataSource, null);
|
|
1430
|
+
|
|
1431
|
+
case 8:
|
|
1432
|
+
if (!flag) {
|
|
1433
|
+
_context4.next = 12;
|
|
1434
|
+
break;
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
return _context4.abrupt("return", Promise.resolve(dataSource));
|
|
1438
|
+
|
|
1439
|
+
case 12:
|
|
1440
|
+
setTimeout(function () {
|
|
1441
|
+
var _a;
|
|
1442
|
+
|
|
1443
|
+
if (messageIndex !== null) {
|
|
1444
|
+
(_a = scrollToIndexRef.current) === null || _a === void 0 ? void 0 : _a.call(scrollToIndexRef, messageIndex, {
|
|
1445
|
+
align: 'center'
|
|
1446
|
+
});
|
|
1447
|
+
time = setInterval(function () {
|
|
1448
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
1449
|
+
var _b, form;
|
|
1450
|
+
|
|
1451
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1452
|
+
while (1) {
|
|
1453
|
+
switch (_context3.prev = _context3.next) {
|
|
1454
|
+
case 0:
|
|
1455
|
+
fullNum++;
|
|
1456
|
+
|
|
1457
|
+
if (!(fullNum > 5)) {
|
|
1458
|
+
_context3.next = 5;
|
|
1459
|
+
break;
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
clearInterval(time);
|
|
1463
|
+
_context3.next = 20;
|
|
1464
|
+
break;
|
|
1465
|
+
|
|
1466
|
+
case 5:
|
|
1467
|
+
form = (_b = Object.values(allFormListRef.current || []).find(function (item) {
|
|
1468
|
+
return item.key === errorRowKey;
|
|
1469
|
+
})) === null || _b === void 0 ? void 0 : _b.form;
|
|
1470
|
+
|
|
1471
|
+
if (!form) {
|
|
1472
|
+
_context3.next = 20;
|
|
1473
|
+
break;
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
_context3.prev = 7;
|
|
1477
|
+
_context3.next = 10;
|
|
1478
|
+
return form.validateFields();
|
|
1479
|
+
|
|
1480
|
+
case 10:
|
|
1481
|
+
console.log('验证成功');
|
|
1482
|
+
_context3.next = 17;
|
|
1483
|
+
break;
|
|
1484
|
+
|
|
1485
|
+
case 13:
|
|
1486
|
+
_context3.prev = 13;
|
|
1487
|
+
_context3.t0 = _context3["catch"](7);
|
|
1488
|
+
console.log('验证失败', _context3.t0);
|
|
1489
|
+
return _context3.abrupt("return", _context3.t0);
|
|
1490
|
+
|
|
1491
|
+
case 17:
|
|
1492
|
+
_context3.prev = 17;
|
|
1493
|
+
clearInterval(time);
|
|
1494
|
+
return _context3.finish(17);
|
|
1495
|
+
|
|
1496
|
+
case 20:
|
|
1497
|
+
case "end":
|
|
1498
|
+
return _context3.stop();
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
}, _callee3, null, [[7, 13, 17, 20]]);
|
|
1502
|
+
}));
|
|
1503
|
+
}, 500);
|
|
1504
|
+
}
|
|
1505
|
+
}, 100);
|
|
1506
|
+
return _context4.abrupt("return", Promise.reject(errorInfo));
|
|
1507
|
+
|
|
1508
|
+
case 14:
|
|
1509
|
+
case "end":
|
|
1510
|
+
return _context4.stop();
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
}, _callee4);
|
|
1514
|
+
}));
|
|
1515
|
+
}
|
|
1262
1516
|
};
|
|
1263
1517
|
});
|
|
1264
1518
|
var isShowAddAction = useMemo(function () {
|
|
1265
1519
|
return isEdit && isAdd || isHoverEdit && isAdd;
|
|
1266
1520
|
}, [isEdit, isAdd, isHoverEdit]);
|
|
1521
|
+
|
|
1522
|
+
var pushAllForm = function pushAllForm(form, key, index) {
|
|
1523
|
+
allFormListRef.current[key] = {
|
|
1524
|
+
form: form,
|
|
1525
|
+
key: key,
|
|
1526
|
+
index: index
|
|
1527
|
+
};
|
|
1528
|
+
};
|
|
1529
|
+
|
|
1267
1530
|
var config = useRef(Object.assign({
|
|
1268
1531
|
pagination: false,
|
|
1269
1532
|
tableLayout: 'fixed',
|
|
@@ -1274,7 +1537,11 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1274
1537
|
return record[_rowKey] || record.index || Math.random();
|
|
1275
1538
|
},
|
|
1276
1539
|
components: {
|
|
1277
|
-
table: virtual ?
|
|
1540
|
+
table: virtual ? function (props) {
|
|
1541
|
+
return /*#__PURE__*/React.createElement(VirtualTable, Object.assign({}, props, {
|
|
1542
|
+
fn: scrollToIndexRef
|
|
1543
|
+
}));
|
|
1544
|
+
} : null,
|
|
1278
1545
|
body: Object.assign({
|
|
1279
1546
|
row: function row(rowProps) {
|
|
1280
1547
|
return sortOpen ? EditableSortRow(Object.assign(Object.assign({}, rowProps), {
|
|
@@ -1283,7 +1550,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1283
1550
|
virtual: virtual
|
|
1284
1551
|
}));
|
|
1285
1552
|
},
|
|
1286
|
-
cell: MemoEditableCell
|
|
1553
|
+
cell: props.shouldUpdate ? EditableCell : MemoEditableCell
|
|
1287
1554
|
}, sortOpen ? {
|
|
1288
1555
|
wrapper: function wrapper(wrapperProps) {
|
|
1289
1556
|
var _a, _b, _c;
|
|
@@ -1307,11 +1574,42 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1307
1574
|
}
|
|
1308
1575
|
},
|
|
1309
1576
|
onRow: function onRow(record, index) {
|
|
1577
|
+
var _a;
|
|
1578
|
+
|
|
1310
1579
|
return {
|
|
1311
|
-
disabled: disabled
|
|
1580
|
+
disabled: disabled || !!((_a = disabledDataSourceRowKeys.current) === null || _a === void 0 ? void 0 : _a.includes(record[_rowKey])),
|
|
1581
|
+
dataKey: record[_rowKey],
|
|
1582
|
+
index: index,
|
|
1583
|
+
pushAllForm: pushAllForm
|
|
1312
1584
|
};
|
|
1313
1585
|
}
|
|
1314
1586
|
}, resetProps));
|
|
1587
|
+
useEffect(function () {
|
|
1588
|
+
var _a;
|
|
1589
|
+
|
|
1590
|
+
if (autoSizer) {
|
|
1591
|
+
var tableClient = (_a = tableWarpRef === null || tableWarpRef === void 0 ? void 0 : tableWarpRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
1592
|
+
var height = (tableClient === null || tableClient === void 0 ? void 0 : tableClient.height) || '100%';
|
|
1593
|
+
var TailorHeight = size === 'middle' ? 48 : 40;
|
|
1594
|
+
|
|
1595
|
+
if (isAdd) {
|
|
1596
|
+
TailorHeight += 48;
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
if (props.summary) {
|
|
1600
|
+
TailorHeight += 48;
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
if (props.pagination) {
|
|
1604
|
+
TailorHeight += 48;
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
autoSizerRef.current = {
|
|
1608
|
+
width: tableClient === null || tableClient === void 0 ? void 0 : tableClient.width,
|
|
1609
|
+
height: typeof height === 'string' ? "calc(".concat(height, " - ").concat(TailorHeight, "px)") : height - TailorHeight
|
|
1610
|
+
};
|
|
1611
|
+
}
|
|
1612
|
+
}, []);
|
|
1315
1613
|
|
|
1316
1614
|
if (colSortOpen) {
|
|
1317
1615
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -1329,7 +1627,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1329
1627
|
items: columns.reduce(function (acc, item) {
|
|
1330
1628
|
return [].concat(_toConsumableArray(acc), [item.dataIndex]);
|
|
1331
1629
|
}, [])
|
|
1332
|
-
}, /*#__PURE__*/React.createElement(Table, Object.assign({}, checkDataSourceIsEmpty(config.current, dataSourceRef.current), {
|
|
1630
|
+
}, /*#__PURE__*/React.createElement(Table, Object.assign({}, checkDataSourceIsEmpty(config.current, dataSourceRef.current, autoSizerRef.current), {
|
|
1333
1631
|
loading: loading,
|
|
1334
1632
|
size: size || 'small',
|
|
1335
1633
|
columns: resultColumns,
|
|
@@ -1354,23 +1652,34 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1354
1652
|
isShowAddAction: isShowAddAction,
|
|
1355
1653
|
recordCreatorProps: recordCreatorProps,
|
|
1356
1654
|
handleAdd: handleAdd
|
|
1357
|
-
})
|
|
1655
|
+
}), /*#__PURE__*/React.createElement(Form, {
|
|
1656
|
+
form: checkForm,
|
|
1657
|
+
component: false
|
|
1658
|
+
}, columns.map(function (item) {
|
|
1659
|
+
return /*#__PURE__*/React.createElement(Form.Item, Object.assign({
|
|
1660
|
+
noStyle: true,
|
|
1661
|
+
name: item.dataIndex
|
|
1662
|
+
}, (item === null || item === void 0 ? void 0 : item['formProps']) || {}));
|
|
1663
|
+
})));
|
|
1358
1664
|
} // @ts-ignore
|
|
1359
1665
|
|
|
1360
1666
|
|
|
1361
1667
|
return /*#__PURE__*/React.createElement("div", {
|
|
1362
|
-
className:
|
|
1668
|
+
className: cls('lm_editTable_warpper', autoSizer && 'lm_editable_autosize'),
|
|
1363
1669
|
ref: tableWarpRef
|
|
1364
1670
|
}, /*#__PURE__*/React.createElement(ConfigProvider, {
|
|
1365
1671
|
renderEmpty: loading ? function () {
|
|
1366
1672
|
return null;
|
|
1367
1673
|
} : CustomizeRenderEmpty
|
|
1368
|
-
}, /*#__PURE__*/React.createElement(Table, Object.assign({}, checkDataSourceIsEmpty(config.current, dataSourceRef.current), {
|
|
1674
|
+
}, /*#__PURE__*/React.createElement(Table, Object.assign({}, checkDataSourceIsEmpty(config.current, dataSourceRef.current, autoSizerRef.current), {
|
|
1369
1675
|
size: size || 'small',
|
|
1370
1676
|
columns: resultColumns,
|
|
1371
1677
|
rowClassName: "editable-row",
|
|
1372
1678
|
bordered: true,
|
|
1373
1679
|
loading: loading,
|
|
1680
|
+
style: autoSizer ? {
|
|
1681
|
+
height: isAdd ? "calc(100% - ".concat(48, "px)") : '100%'
|
|
1682
|
+
} : undefined,
|
|
1374
1683
|
pagination: false,
|
|
1375
1684
|
// components={tableComponents}
|
|
1376
1685
|
expandable: (resetProps === null || resetProps === void 0 ? void 0 : resetProps.expandable) || {
|
|
@@ -1404,6 +1713,14 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1404
1713
|
isShowAddAction: isShowAddAction,
|
|
1405
1714
|
recordCreatorProps: recordCreatorProps,
|
|
1406
1715
|
handleAdd: handleAdd
|
|
1407
|
-
})
|
|
1716
|
+
}), /*#__PURE__*/React.createElement(Form, {
|
|
1717
|
+
form: checkForm,
|
|
1718
|
+
component: false
|
|
1719
|
+
}, columns.map(function (item) {
|
|
1720
|
+
return /*#__PURE__*/React.createElement(Form.Item, Object.assign({
|
|
1721
|
+
noStyle: true,
|
|
1722
|
+
name: item.dataIndex
|
|
1723
|
+
}, (item === null || item === void 0 ? void 0 : item['formProps']) || {}));
|
|
1724
|
+
})));
|
|
1408
1725
|
});
|
|
1409
1726
|
export default /*#__PURE__*/memo(EditTable);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable no-unused-vars */
|
|
2
4
|
import React, { memo } from 'react';
|
|
3
5
|
import { DndContext, closestCenter, KeyboardSensor, PointerSensor, useSensor, useSensors } from '@dnd-kit/core';
|
|
4
6
|
import { restrictToParentElement, restrictToVerticalAxis } from '@dnd-kit/modifiers';
|
|
@@ -53,7 +55,8 @@ var DndContainer = function DndContainer(_ref) {
|
|
|
53
55
|
if (active.id !== over.id) {
|
|
54
56
|
move(active.id, over.id);
|
|
55
57
|
}
|
|
56
|
-
};
|
|
58
|
+
}; // @ts-ignore
|
|
59
|
+
|
|
57
60
|
|
|
58
61
|
var instance = {
|
|
59
62
|
isDragging: isDragging,
|
|
@@ -65,7 +68,6 @@ var DndContainer = function DndContainer(_ref) {
|
|
|
65
68
|
items: items,
|
|
66
69
|
tableWidth: tableWidth
|
|
67
70
|
};
|
|
68
|
-
console.log('instance', instance);
|
|
69
71
|
return /*#__PURE__*/React.createElement(DndContext, {
|
|
70
72
|
sensors: sensors,
|
|
71
73
|
onDragStart: handleDragStart,
|
|
@@ -670,6 +670,20 @@ p {
|
|
|
670
670
|
padding-left: 7px;
|
|
671
671
|
box-sizing: border-box;
|
|
672
672
|
}
|
|
673
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table-wrapper,
|
|
674
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-spin-nested-loading,
|
|
675
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-spin-container,
|
|
676
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table,
|
|
677
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table-container {
|
|
678
|
+
height: 100%;
|
|
679
|
+
}
|
|
680
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table-wrapper .ant-table-body,
|
|
681
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-spin-nested-loading .ant-table-body,
|
|
682
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-spin-container .ant-table-body,
|
|
683
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table .ant-table-body,
|
|
684
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table-container .ant-table-body {
|
|
685
|
+
height: calc(100% - 41px);
|
|
686
|
+
}
|
|
673
687
|
.lm_editTable_wrapperRange .inputRange {
|
|
674
688
|
display: inline-flex;
|
|
675
689
|
align-items: center;
|
|
@@ -158,6 +158,20 @@
|
|
|
158
158
|
padding-left: 7px;
|
|
159
159
|
box-sizing: border-box;
|
|
160
160
|
}
|
|
161
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table-wrapper,
|
|
162
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-spin-nested-loading,
|
|
163
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-spin-container,
|
|
164
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table,
|
|
165
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table-container {
|
|
166
|
+
height: 100%;
|
|
167
|
+
}
|
|
168
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table-wrapper .ant-table-body,
|
|
169
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-spin-nested-loading .ant-table-body,
|
|
170
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-spin-container .ant-table-body,
|
|
171
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table .ant-table-body,
|
|
172
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table-container .ant-table-body {
|
|
173
|
+
height: calc(100% - 41px);
|
|
174
|
+
}
|
|
161
175
|
.lm_editTable_wrapperRange .inputRange {
|
|
162
176
|
display: inline-flex;
|
|
163
177
|
align-items: center;
|
package/es/LmEditTable/util.d.ts
CHANGED
|
@@ -9,7 +9,9 @@ export declare function checkExpandIconColumnIndex({ rowSelection, sortOpen, ind
|
|
|
9
9
|
sortOpen: any;
|
|
10
10
|
indexCol: any;
|
|
11
11
|
}): number;
|
|
12
|
-
export declare function checkDataSourceIsEmpty(config: any, dataSource: any): any;
|
|
12
|
+
export declare function checkDataSourceIsEmpty(config: any, dataSource: any, scrollInfo: any): any;
|
|
13
|
+
/** 根据传入的disabedRows, 得出最终需要disabed的rowKeys */
|
|
14
|
+
export declare function checkTableRowIsDisable(deepDataSource: any, disabledRows: any, rowKey: any): any[];
|
|
13
15
|
declare const _default: {
|
|
14
16
|
isObjEmpty: typeof isObjEmpty;
|
|
15
17
|
};
|