linkmore-design 1.0.78 → 1.0.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.umd.js +134 -118
- package/dist/index.umd.min.js +4 -4
- package/es/LmFilter/filterFns/index.js +1 -1
- package/es/LmTable/Table.js +97 -92
- package/es/LmTable/components/inputDataEdit.js +4 -0
- package/es/LmTable/components/sheelTableCell.js +14 -3
- package/es/LmTable/components/tableChartsModal.js +1 -0
- package/es/Modal/index.js +2 -0
- package/lib/LmFilter/filterFns/index.js +1 -1
- package/lib/LmTable/Table.js +97 -92
- package/lib/LmTable/components/inputDataEdit.js +4 -0
- package/lib/LmTable/components/sheelTableCell.js +14 -2
- package/lib/LmTable/components/tableChartsModal.js +1 -0
- package/lib/Modal/index.js +2 -0
- package/package.json +1 -1
|
@@ -587,7 +587,7 @@ var useCoreOptions = function useCoreOptions(_ref) {
|
|
|
587
587
|
var searchQuery = searchKey === null || searchKey === void 0 ? void 0 : searchKey.reduce(function (pre, cur) {
|
|
588
588
|
pre[cur] = (0, _objectSpread4.default)((0, _objectSpread4.default)({}, searchConfig), {}, {
|
|
589
589
|
fieldName: cur,
|
|
590
|
-
value: itemValue
|
|
590
|
+
value: [itemValue]
|
|
591
591
|
});
|
|
592
592
|
return pre;
|
|
593
593
|
}, (0, _objectSpread4.default)({}, state.searchQuery)); // 数据清除时不返回结构体
|
package/es/LmTable/Table.js
CHANGED
|
@@ -37,6 +37,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
37
37
|
|
|
38
38
|
var _reactResizable = require("react-resizable");
|
|
39
39
|
|
|
40
|
+
var _immer = require("immer");
|
|
41
|
+
|
|
40
42
|
var _reactSortableHoc = require("react-sortable-hoc");
|
|
41
43
|
|
|
42
44
|
var _hooks = require("../hooks");
|
|
@@ -53,7 +55,7 @@ var _tableChartsModal = _interopRequireDefault(require("./components/tableCharts
|
|
|
53
55
|
|
|
54
56
|
var _resetConfig = _interopRequireDefault(require("./resetConfig"));
|
|
55
57
|
|
|
56
|
-
var _excluded = ["dataSource", "autoSize", "columns", "rowClick", "onDoubleClick", "checkConfig", "summary", "pagination", "hiddenPage", "loading", "virtual", "sortOpen", "colSortOpen", "resizeable", "customCheck", "components", "rowSelection", "columnsState", "onChange", "filterChange", "tableRowType", "size", "openSheet", "editSheet", "emptyProps"],
|
|
58
|
+
var _excluded = ["dataSource", "autoSize", "columns", "rowClick", "onDoubleClick", "checkConfig", "summary", "pagination", "hiddenPage", "loading", "virtual", "sortOpen", "colSortOpen", "resizeable", "customCheck", "components", "rowSelection", "columnsState", "onChange", "filterChange", "tableRowType", "size", "openSheet", "editSheet", "dataChange", "emptyProps"],
|
|
57
59
|
_excluded2 = ["className", "style"],
|
|
58
60
|
_excluded3 = ["onResize", "width", "onResizeStop"];
|
|
59
61
|
var Summary = _proTable.default.Summary;
|
|
@@ -133,6 +135,7 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
133
135
|
openSheet = _props$openSheet === void 0 ? false : _props$openSheet,
|
|
134
136
|
_props$editSheet = props.editSheet,
|
|
135
137
|
editSheet = _props$editSheet === void 0 ? false : _props$editSheet,
|
|
138
|
+
dataChange = props.dataChange,
|
|
136
139
|
emptyProps = props.emptyProps,
|
|
137
140
|
resetProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
138
141
|
var _resetProps$rowKey = resetProps.rowKey,
|
|
@@ -158,6 +161,7 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
158
161
|
setColumns = _useState6[1];
|
|
159
162
|
|
|
160
163
|
var tableWarpRef = (0, _react.useRef)(null);
|
|
164
|
+
var dataSourceRef = (0, _react.useRef)(null);
|
|
161
165
|
/** 右键的ref */
|
|
162
166
|
|
|
163
167
|
var contentMenuRef = (0, _react.useRef)(null);
|
|
@@ -229,6 +233,12 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
229
233
|
var SortContainer = (0, _reactSortableHoc.SortableContainer)(function (props) {
|
|
230
234
|
return /*#__PURE__*/_react.default.createElement("tbody", props);
|
|
231
235
|
});
|
|
236
|
+
(0, _react.useEffect)(function () {
|
|
237
|
+
dataSourceRef.current = dataSource;
|
|
238
|
+
}, [dataSource]);
|
|
239
|
+
var dataEffect = (0, _react.useMemo)(function () {
|
|
240
|
+
return openSheet ? [dataSource] : [];
|
|
241
|
+
}, [openSheet]);
|
|
232
242
|
|
|
233
243
|
var onSortEnd = function onSortEnd(_ref) {
|
|
234
244
|
var oldIndex = _ref.oldIndex,
|
|
@@ -294,19 +304,40 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
294
304
|
filterChange === null || filterChange === void 0 ? void 0 : filterChange(useColumns);
|
|
295
305
|
});
|
|
296
306
|
};
|
|
307
|
+
|
|
308
|
+
var isSelected = function isSelected(i, j) {
|
|
309
|
+
var _shellStatusRef$curre = shellStatusRef.current,
|
|
310
|
+
start = _shellStatusRef$curre.start,
|
|
311
|
+
end = _shellStatusRef$curre.end,
|
|
312
|
+
editing = _shellStatusRef$curre.editing;
|
|
313
|
+
var maxi = Math.max(start === null || start === void 0 ? void 0 : start.i, end.i);
|
|
314
|
+
var mini = Math.min(start === null || start === void 0 ? void 0 : start.i, end.i);
|
|
315
|
+
var maxj = Math.max(start === null || start === void 0 ? void 0 : start.j, end.j);
|
|
316
|
+
var minj = Math.min(start === null || start === void 0 ? void 0 : start.j, end.j);
|
|
317
|
+
var posX = j >= start.j && j <= end.j;
|
|
318
|
+
var negX = j <= start.j && j >= end.j;
|
|
319
|
+
var posY = i >= start.i && i <= end.i;
|
|
320
|
+
var negY = i <= start.i && i >= end.i;
|
|
321
|
+
return {
|
|
322
|
+
isSelected: posX && posY || negX && posY || negX && negY || posX && negY,
|
|
323
|
+
isEnd: i === maxi && j >= minj && j <= maxj,
|
|
324
|
+
isRightEnd: j === maxj && i >= mini && i <= maxi,
|
|
325
|
+
isEditing: (editing === null || editing === void 0 ? void 0 : editing.i) === i && (editing === null || editing === void 0 ? void 0 : editing.j) === j
|
|
326
|
+
};
|
|
327
|
+
};
|
|
297
328
|
/** 复制功能 */
|
|
298
329
|
|
|
299
330
|
|
|
300
331
|
var handleCopy = function handleCopy(e) {
|
|
301
|
-
var _shellStatusRef$
|
|
332
|
+
var _shellStatusRef$curre2;
|
|
302
333
|
|
|
303
|
-
if (isEmpty((_shellStatusRef$
|
|
334
|
+
if (isEmpty((_shellStatusRef$curre2 = shellStatusRef.current) === null || _shellStatusRef$curre2 === void 0 ? void 0 : _shellStatusRef$curre2.editing)) {
|
|
304
335
|
var _e$clipboardData;
|
|
305
336
|
|
|
306
337
|
e.preventDefault();
|
|
307
|
-
var _shellStatusRef$
|
|
308
|
-
start = _shellStatusRef$
|
|
309
|
-
end = _shellStatusRef$
|
|
338
|
+
var _shellStatusRef$curre3 = shellStatusRef.current,
|
|
339
|
+
start = _shellStatusRef$curre3.start,
|
|
340
|
+
end = _shellStatusRef$curre3.end;
|
|
310
341
|
var text = range(start.i, end.i).map(function (i) {
|
|
311
342
|
return range(start.j, end.j).map(function (j) {
|
|
312
343
|
var _columns$j, _columns$j2;
|
|
@@ -342,9 +373,9 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
342
373
|
};
|
|
343
374
|
|
|
344
375
|
var onMouseOver = function onMouseOver(i, j) {
|
|
345
|
-
var _shellStatusRef$
|
|
376
|
+
var _shellStatusRef$curre4, _shellStatusRef$curre5;
|
|
346
377
|
|
|
347
|
-
if (((_shellStatusRef$
|
|
378
|
+
if (((_shellStatusRef$curre4 = shellStatusRef.current) === null || _shellStatusRef$curre4 === void 0 ? void 0 : _shellStatusRef$curre4.selecting) && isEmpty((_shellStatusRef$curre5 = shellStatusRef.current) === null || _shellStatusRef$curre5 === void 0 ? void 0 : _shellStatusRef$curre5.editing)) {
|
|
348
379
|
shellStatusRef.current = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, shellStatusRef.current), {}, {
|
|
349
380
|
end: {
|
|
350
381
|
i: i,
|
|
@@ -375,23 +406,26 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
375
406
|
|
|
376
407
|
|
|
377
408
|
var handleCut = function handleCut(e) {
|
|
378
|
-
var _shellStatusRef$
|
|
409
|
+
var _shellStatusRef$curre6;
|
|
379
410
|
|
|
380
|
-
if (isEmpty((_shellStatusRef$
|
|
411
|
+
if (isEmpty((_shellStatusRef$curre6 = shellStatusRef.current) === null || _shellStatusRef$curre6 === void 0 ? void 0 : _shellStatusRef$curre6.editing)) {
|
|
381
412
|
e.preventDefault();
|
|
382
413
|
handleCopy(e);
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
414
|
+
/** 暂时先不隐藏 */
|
|
415
|
+
// const { start, end } = shellStatusRef.current
|
|
416
|
+
// clearSelectedCells(start, end)
|
|
386
417
|
}
|
|
387
418
|
};
|
|
388
419
|
/** 内容粘贴 */
|
|
389
420
|
|
|
390
421
|
|
|
391
422
|
var handlePaste = function handlePaste(e) {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
423
|
+
var _shellStatusRef$curre7;
|
|
424
|
+
|
|
425
|
+
if (isEmpty((_shellStatusRef$curre7 = shellStatusRef.current) === null || _shellStatusRef$curre7 === void 0 ? void 0 : _shellStatusRef$curre7.editing)) {
|
|
426
|
+
var _shellStatusRef$curre8 = shellStatusRef.current,
|
|
427
|
+
start = _shellStatusRef$curre8.start,
|
|
428
|
+
end = _shellStatusRef$curre8.end;
|
|
395
429
|
start = {
|
|
396
430
|
i: Math.min(start.i, end.i),
|
|
397
431
|
j: Math.min(start.j, end.j)
|
|
@@ -400,7 +434,7 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
400
434
|
i: Math.max(start.i, end.i),
|
|
401
435
|
j: Math.max(start.j, end.j)
|
|
402
436
|
};
|
|
403
|
-
var parse =
|
|
437
|
+
var parse = defaultParsePaste;
|
|
404
438
|
var changes = [];
|
|
405
439
|
var pasteData = [];
|
|
406
440
|
|
|
@@ -409,50 +443,33 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
409
443
|
pasteData = parse(window.clipboardData.getData('Text'));
|
|
410
444
|
} else if (e.clipboardData && e.clipboardData.getData) {
|
|
411
445
|
pasteData = parse(e.clipboardData.getData('text/plain'));
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
//
|
|
415
|
-
// const additions = []
|
|
416
|
-
// pasteData.forEach((row, i) => {
|
|
417
|
-
// row.forEach((value, j) => {
|
|
418
|
-
// end = { i: start.i + i, j: start.j + j }
|
|
419
|
-
// const cell = data[end.i] && data[end.i][end.j]
|
|
420
|
-
// if (!cell) {
|
|
421
|
-
// additions.push({ row: end.i, col: end.j, value })
|
|
422
|
-
// } else if (!cell.readOnly) {
|
|
423
|
-
// changes.push({ cell, row: end.i, col: end.j, value })
|
|
424
|
-
// }
|
|
425
|
-
// })
|
|
426
|
-
// })
|
|
427
|
-
// if (additions.length) {
|
|
428
|
-
// onCellsChanged(changes, additions)
|
|
429
|
-
// } else {
|
|
430
|
-
// onCellsChanged(changes)
|
|
431
|
-
// }
|
|
432
|
-
// } else if (onPaste) {
|
|
433
|
-
// pasteData.forEach((row, i) => {
|
|
434
|
-
// const rowData = []
|
|
435
|
-
// row.forEach((pastedData, j) => {
|
|
436
|
-
// end = { i: start.i + i, j: start.j + j }
|
|
437
|
-
// const cell = data[end.i] && data[end.i][end.j]
|
|
438
|
-
// rowData.push({ cell: cell, data: pastedData })
|
|
439
|
-
// })
|
|
440
|
-
// changes.push(rowData)
|
|
441
|
-
// })
|
|
442
|
-
// onPaste(changes)
|
|
443
|
-
// } else if (onChange) {
|
|
444
|
-
// pasteData.forEach((row, i) => {
|
|
445
|
-
// row.forEach((value, j) => {
|
|
446
|
-
// end = { i: start.i + i, j: start.j + j }
|
|
447
|
-
// const cell = data[end.i] && data[end.i][end.j]
|
|
448
|
-
// if (cell && !cell.readOnly) {
|
|
449
|
-
// onChange(cell, end.i, end.j, value)
|
|
450
|
-
// }
|
|
451
|
-
// })
|
|
452
|
-
// })
|
|
453
|
-
// }
|
|
454
|
-
// this._setState({ end })
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
var data = dataSourceRef.current; // in order of preference
|
|
455
449
|
|
|
450
|
+
var resultEnd = [];
|
|
451
|
+
pasteData.forEach(function (row, i) {
|
|
452
|
+
row.forEach(function (value, j) {
|
|
453
|
+
resultEnd.push({
|
|
454
|
+
i: start.i + i,
|
|
455
|
+
j: start.j + j,
|
|
456
|
+
value: value
|
|
457
|
+
});
|
|
458
|
+
});
|
|
459
|
+
});
|
|
460
|
+
var columnsKeysList = columns.map(function (item) {
|
|
461
|
+
return item.dataIndex;
|
|
462
|
+
});
|
|
463
|
+
var res = (0, _immer.produce)(dataSourceRef.current, function (draft) {
|
|
464
|
+
resultEnd.forEach(function (item) {
|
|
465
|
+
var _isSelected;
|
|
466
|
+
|
|
467
|
+
if ((_isSelected = isSelected(item.i, item.j)) === null || _isSelected === void 0 ? void 0 : _isSelected.isSelected) {
|
|
468
|
+
draft[item.i][columnsKeysList[item.j]] = item.value;
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
});
|
|
472
|
+
dataChange === null || dataChange === void 0 ? void 0 : dataChange(res);
|
|
456
473
|
}
|
|
457
474
|
};
|
|
458
475
|
|
|
@@ -489,13 +506,13 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
489
506
|
|
|
490
507
|
|
|
491
508
|
var sheelMouseDown = function sheelMouseDown(i, j, e) {
|
|
492
|
-
var _shellStatusRef$
|
|
509
|
+
var _shellStatusRef$curre9, _shellStatusRef$curre10, _shellStatusRef$curre11, _shellStatusRef$curre12, _shellStatusRef$curre13, _shellStatusRef$curre14, _shellStatusRef$curre15, _shellStatusRef$curre16, _shellStatusRef$curre17;
|
|
493
510
|
|
|
494
|
-
var isNowEditingSameCell = !isEmpty((_shellStatusRef$
|
|
495
|
-
var editing = isEmpty((_shellStatusRef$
|
|
511
|
+
var isNowEditingSameCell = !isEmpty((_shellStatusRef$curre9 = shellStatusRef.current) === null || _shellStatusRef$curre9 === void 0 ? void 0 : _shellStatusRef$curre9.editing) && ((_shellStatusRef$curre10 = shellStatusRef.current) === null || _shellStatusRef$curre10 === void 0 ? void 0 : _shellStatusRef$curre10.editing.i) === i && ((_shellStatusRef$curre11 = shellStatusRef.current) === null || _shellStatusRef$curre11 === void 0 ? void 0 : _shellStatusRef$curre11.editing.j) === j;
|
|
512
|
+
var editing = isEmpty((_shellStatusRef$curre12 = shellStatusRef.current) === null || _shellStatusRef$curre12 === void 0 ? void 0 : _shellStatusRef$curre12.editing) || ((_shellStatusRef$curre13 = shellStatusRef.current) === null || _shellStatusRef$curre13 === void 0 ? void 0 : _shellStatusRef$curre13.editing.i) !== i || ((_shellStatusRef$curre14 = shellStatusRef.current) === null || _shellStatusRef$curre14 === void 0 ? void 0 : _shellStatusRef$curre14.editing.j) !== j ? {} : (_shellStatusRef$curre15 = shellStatusRef.current) === null || _shellStatusRef$curre15 === void 0 ? void 0 : _shellStatusRef$curre15.editing;
|
|
496
513
|
shellStatusRef.current = {
|
|
497
514
|
selecting: !isNowEditingSameCell,
|
|
498
|
-
start: (e === null || e === void 0 ? void 0 : e.shiftKey) ? (_shellStatusRef$
|
|
515
|
+
start: (e === null || e === void 0 ? void 0 : e.shiftKey) ? (_shellStatusRef$curre16 = shellStatusRef.current) === null || _shellStatusRef$curre16 === void 0 ? void 0 : _shellStatusRef$curre16.start : {
|
|
499
516
|
i: i,
|
|
500
517
|
j: j
|
|
501
518
|
},
|
|
@@ -508,7 +525,7 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
508
525
|
};
|
|
509
526
|
SetSelectIng(!isNowEditingSameCell);
|
|
510
527
|
|
|
511
|
-
if (isEmpty((_shellStatusRef$
|
|
528
|
+
if (isEmpty((_shellStatusRef$curre17 = shellStatusRef.current) === null || _shellStatusRef$curre17 === void 0 ? void 0 : _shellStatusRef$curre17.editing)) {
|
|
512
529
|
setEditIng(false);
|
|
513
530
|
}
|
|
514
531
|
|
|
@@ -521,9 +538,9 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
521
538
|
|
|
522
539
|
var onContextMenu = function onContextMenu(evt, i, j) {
|
|
523
540
|
evt.preventDefault();
|
|
524
|
-
var _shellStatusRef$
|
|
525
|
-
start = _shellStatusRef$
|
|
526
|
-
end = _shellStatusRef$
|
|
541
|
+
var _shellStatusRef$curre18 = shellStatusRef.current,
|
|
542
|
+
start = _shellStatusRef$curre18.start,
|
|
543
|
+
end = _shellStatusRef$curre18.end;
|
|
527
544
|
|
|
528
545
|
if (isEmpty(start) && isEmpty(end)) {
|
|
529
546
|
sheelMouseDown(i, j, evt);
|
|
@@ -568,7 +585,17 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
568
585
|
}
|
|
569
586
|
};
|
|
570
587
|
|
|
571
|
-
var dataSourceChange = function dataSourceChange(i, j, newRecord) {
|
|
588
|
+
var dataSourceChange = function dataSourceChange(i, j, newRecord) {
|
|
589
|
+
var res = (0, _immer.produce)(dataSourceRef.current, function (draft) {
|
|
590
|
+
draft[i] = newRecord;
|
|
591
|
+
});
|
|
592
|
+
dataChange === null || dataChange === void 0 ? void 0 : dataChange(res);
|
|
593
|
+
shellStatusRef.current = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, shellStatusRef.current), {}, {
|
|
594
|
+
editing: {},
|
|
595
|
+
forceEdit: false,
|
|
596
|
+
clear: {}
|
|
597
|
+
});
|
|
598
|
+
};
|
|
572
599
|
|
|
573
600
|
(0, _react.useEffect)(function () {
|
|
574
601
|
return function () {
|
|
@@ -579,28 +606,6 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
579
606
|
document.removeEventListener('paste', handlePaste);
|
|
580
607
|
};
|
|
581
608
|
}, []);
|
|
582
|
-
|
|
583
|
-
var isSelected = function isSelected(i, j) {
|
|
584
|
-
var _shellStatusRef$curre17 = shellStatusRef.current,
|
|
585
|
-
start = _shellStatusRef$curre17.start,
|
|
586
|
-
end = _shellStatusRef$curre17.end,
|
|
587
|
-
editing = _shellStatusRef$curre17.editing;
|
|
588
|
-
var maxi = Math.max(start === null || start === void 0 ? void 0 : start.i, end.i);
|
|
589
|
-
var mini = Math.min(start === null || start === void 0 ? void 0 : start.i, end.i);
|
|
590
|
-
var maxj = Math.max(start === null || start === void 0 ? void 0 : start.j, end.j);
|
|
591
|
-
var minj = Math.min(start === null || start === void 0 ? void 0 : start.j, end.j);
|
|
592
|
-
var posX = j >= start.j && j <= end.j;
|
|
593
|
-
var negX = j <= start.j && j >= end.j;
|
|
594
|
-
var posY = i >= start.i && i <= end.i;
|
|
595
|
-
var negY = i <= start.i && i >= end.i;
|
|
596
|
-
return {
|
|
597
|
-
isSelected: posX && posY || negX && posY || negX && negY || posX && negY,
|
|
598
|
-
isEnd: i === maxi && j >= minj && j <= maxj,
|
|
599
|
-
isRightEnd: j === maxj && i >= mini && i <= maxi,
|
|
600
|
-
isEditing: (editing === null || editing === void 0 ? void 0 : editing.i) === i && (editing === null || editing === void 0 ? void 0 : editing.j) === j
|
|
601
|
-
};
|
|
602
|
-
};
|
|
603
|
-
|
|
604
609
|
var resetColumns = (0, _react.useCallback)(function () {
|
|
605
610
|
var result = useColumns.filter(function (item) {
|
|
606
611
|
return item.show !== false;
|
|
@@ -640,7 +645,7 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
640
645
|
return obj;
|
|
641
646
|
});
|
|
642
647
|
return sortOpen ? [sortDefaultColumnItem].concat((0, _toConsumableArray2.default)(result)) : result;
|
|
643
|
-
}, [useColumns, sortOpen, selectIng]);
|
|
648
|
+
}, [useColumns, sortOpen, selectIng, dataSource]);
|
|
644
649
|
(0, _react.useEffect)(function () {
|
|
645
650
|
setColumns(columns);
|
|
646
651
|
}, [columns]); // 行点击事件
|
|
@@ -13,6 +13,10 @@ var InputDataEdit = function InputDataEdit(props) {
|
|
|
13
13
|
|
|
14
14
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
15
15
|
}, 150);
|
|
16
|
+
return function () {
|
|
17
|
+
console.log('unmounds');
|
|
18
|
+
handleSave === null || handleSave === void 0 ? void 0 : handleSave(inputRef.current);
|
|
19
|
+
};
|
|
16
20
|
}, []);
|
|
17
21
|
|
|
18
22
|
var handleChange = function handleChange(e) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
3
|
|
|
3
4
|
var __rest = this && this.__rest || function (s, e) {
|
|
@@ -13,7 +14,7 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
13
14
|
return t;
|
|
14
15
|
};
|
|
15
16
|
|
|
16
|
-
import React, { useState } from 'react';
|
|
17
|
+
import React, { useRef, useState } from 'react';
|
|
17
18
|
import cls from 'classnames';
|
|
18
19
|
import { useUpdateEffect } from 'ahooks';
|
|
19
20
|
import InputDataEdit from './inputDataEdit';
|
|
@@ -31,7 +32,8 @@ var SheelTabelCell = function SheelTabelCell(props) {
|
|
|
31
32
|
selectIng = props.selectIng,
|
|
32
33
|
onContextMenu = props.onContextMenu,
|
|
33
34
|
onDoubleClick = props.onDoubleClick,
|
|
34
|
-
|
|
35
|
+
dataSourceChange = props.dataSourceChange,
|
|
36
|
+
restProps = __rest(props, ["record", "col", "rowKey", "children", "rowIndex", "colIndex", "onMouseDown", "onMouseOver", "isSelected", "selectIng", "onContextMenu", "onDoubleClick", "dataSourceChange"]);
|
|
35
37
|
|
|
36
38
|
var onMouseEnter = restProps.onMouseEnter,
|
|
37
39
|
onMouseLeave = restProps.onMouseLeave,
|
|
@@ -52,9 +54,16 @@ var SheelTabelCell = function SheelTabelCell(props) {
|
|
|
52
54
|
value = _useState2[0],
|
|
53
55
|
setValue = _useState2[1];
|
|
54
56
|
|
|
57
|
+
var valueRef = useRef((record === null || record === void 0 ? void 0 : record[col === null || col === void 0 ? void 0 : col.dataIndex]) || '');
|
|
55
58
|
useUpdateEffect(function () {
|
|
56
59
|
console.log(value, '----changeValue');
|
|
60
|
+
valueRef.current = value;
|
|
57
61
|
}, [value]);
|
|
62
|
+
useUpdateEffect(function () {
|
|
63
|
+
if (value !== (record === null || record === void 0 ? void 0 : record[col === null || col === void 0 ? void 0 : col.dataIndex])) {
|
|
64
|
+
setValue(record === null || record === void 0 ? void 0 : record[col === null || col === void 0 ? void 0 : col.dataIndex]);
|
|
65
|
+
}
|
|
66
|
+
}, [record]);
|
|
58
67
|
/** 鼠标点击 */
|
|
59
68
|
|
|
60
69
|
var handleMouseDown = function handleMouseDown(e) {
|
|
@@ -102,7 +111,9 @@ var SheelTabelCell = function SheelTabelCell(props) {
|
|
|
102
111
|
};
|
|
103
112
|
|
|
104
113
|
var saveRenderValue = function saveRenderValue() {
|
|
105
|
-
|
|
114
|
+
if (valueRef.current !== (record === null || record === void 0 ? void 0 : record[col === null || col === void 0 ? void 0 : col.dataIndex])) {
|
|
115
|
+
dataSourceChange === null || dataSourceChange === void 0 ? void 0 : dataSourceChange(rowIndex, colIndex, Object.assign(Object.assign({}, record), _defineProperty({}, col.dataIndex, valueRef.current)));
|
|
116
|
+
}
|
|
106
117
|
};
|
|
107
118
|
|
|
108
119
|
var renderEditor = function renderEditor() {
|
|
@@ -107,6 +107,7 @@ var TableChartsModal = function TableChartsModal(props) {
|
|
|
107
107
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
108
108
|
visible: !!type,
|
|
109
109
|
title: "\u667A\u80FD\u62A5\u8868",
|
|
110
|
+
onOk: onCancel,
|
|
110
111
|
onCancel: onCancel
|
|
111
112
|
}, type === 'column' && /*#__PURE__*/React.createElement(Column, Object.assign({}, config)), type === 'line' && /*#__PURE__*/React.createElement(Line, Object.assign({}, config)), type === 'pie' && /*#__PURE__*/React.createElement(Pie, Object.assign({}, config)));
|
|
112
113
|
};
|
package/es/Modal/index.js
CHANGED
|
@@ -36,10 +36,12 @@ var CLMModal = function CLMModal(props) {
|
|
|
36
36
|
width: size === 'default' ? 552 : 416,
|
|
37
37
|
footer: [/*#__PURE__*/React.createElement(Button, {
|
|
38
38
|
onClick: onCancel,
|
|
39
|
+
key: 'canncel_button',
|
|
39
40
|
size: 'middle'
|
|
40
41
|
}, cancelText), /*#__PURE__*/React.createElement(Button, {
|
|
41
42
|
type: "primary",
|
|
42
43
|
onClick: onOk,
|
|
44
|
+
key: 'ok_button',
|
|
43
45
|
size: 'middle'
|
|
44
46
|
}, okText)]
|
|
45
47
|
}, other, {
|
|
@@ -587,7 +587,7 @@ var useCoreOptions = function useCoreOptions(_ref) {
|
|
|
587
587
|
var searchQuery = searchKey === null || searchKey === void 0 ? void 0 : searchKey.reduce(function (pre, cur) {
|
|
588
588
|
pre[cur] = (0, _objectSpread4.default)((0, _objectSpread4.default)({}, searchConfig), {}, {
|
|
589
589
|
fieldName: cur,
|
|
590
|
-
value: itemValue
|
|
590
|
+
value: [itemValue]
|
|
591
591
|
});
|
|
592
592
|
return pre;
|
|
593
593
|
}, (0, _objectSpread4.default)({}, state.searchQuery)); // 数据清除时不返回结构体
|