linkmore-design 1.1.27-alpha.1 → 1.1.27-alpha.2
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 +124 -30
- package/dist/index.umd.min.js +5 -5
- package/dist/variables.css +14 -0
- package/es/LmEditTable/EditTable.d.ts +4 -0
- package/es/LmEditTable/EditTable.js +52 -7
- package/es/LmEditTable/rowSort/DndContainerRow.js +6 -3
- 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 +54 -5
- 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 +14 -0
- package/lib/LmEditTable/EditTable.d.ts +4 -0
- package/lib/LmEditTable/EditTable.js +51 -6
- package/lib/LmEditTable/rowSort/DndContainerRow.js +5 -3
- 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 +55 -4
- 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 +14 -0
- package/package.json +1 -1
package/dist/variables.css
CHANGED
|
@@ -9870,6 +9870,20 @@ p {
|
|
|
9870
9870
|
padding-left: 7px;
|
|
9871
9871
|
box-sizing: border-box;
|
|
9872
9872
|
}
|
|
9873
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table-wrapper,
|
|
9874
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-spin-nested-loading,
|
|
9875
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-spin-container,
|
|
9876
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table,
|
|
9877
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table-container {
|
|
9878
|
+
height: 100%;
|
|
9879
|
+
}
|
|
9880
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table-wrapper .ant-table-body,
|
|
9881
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-spin-nested-loading .ant-table-body,
|
|
9882
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-spin-container .ant-table-body,
|
|
9883
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table .ant-table-body,
|
|
9884
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table-container .ant-table-body {
|
|
9885
|
+
height: calc(100% - 41px);
|
|
9886
|
+
}
|
|
9873
9887
|
.lm_editTable_wrapperRange .inputRange {
|
|
9874
9888
|
display: inline-flex;
|
|
9875
9889
|
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';
|
|
@@ -80,6 +80,7 @@ var EditableRow = function EditableRow(_a) {
|
|
|
80
80
|
|
|
81
81
|
return /*#__PURE__*/React.createElement(Form, {
|
|
82
82
|
form: form,
|
|
83
|
+
disabled: props.disabled || false,
|
|
83
84
|
component: false
|
|
84
85
|
}, /*#__PURE__*/React.createElement(EditableContext.Provider, {
|
|
85
86
|
value: form
|
|
@@ -661,6 +662,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
661
662
|
_props$quickOpetateCl = props.quickOpetateClearAll,
|
|
662
663
|
quickOpetateClearAll = _props$quickOpetateCl === void 0 ? true : _props$quickOpetateCl,
|
|
663
664
|
rowSelection = props.rowSelection,
|
|
665
|
+
rowDisabled = props.rowDisabled,
|
|
664
666
|
virtual = props.virtual,
|
|
665
667
|
sortOpen = props.sortOpen,
|
|
666
668
|
disabled = props.disabled,
|
|
@@ -675,7 +677,9 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
675
677
|
shouldUpdate = _props$shouldUpdate === void 0 ? false : _props$shouldUpdate,
|
|
676
678
|
_props$loading = props.loading,
|
|
677
679
|
loading = _props$loading === void 0 ? false : _props$loading,
|
|
678
|
-
|
|
680
|
+
_props$autoSizer = props.autoSizer,
|
|
681
|
+
autoSizer = _props$autoSizer === void 0 ? false : _props$autoSizer,
|
|
682
|
+
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
683
|
|
|
680
684
|
var _useControllableValue = useControllableValue({
|
|
681
685
|
value: checkRowKeyByDataSource(props.value, _rowKey),
|
|
@@ -700,6 +704,14 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
700
704
|
_useControllableValue4 = _slicedToArray(_useControllableValue3, 2),
|
|
701
705
|
localRowSelectList = _useControllableValue4[0],
|
|
702
706
|
setLocalRowSelectList = _useControllableValue4[1];
|
|
707
|
+
|
|
708
|
+
var _useControllableValue5 = useControllableValue({
|
|
709
|
+
value: {
|
|
710
|
+
disabledRows: (rowDisabled === null || rowDisabled === void 0 ? void 0 : rowDisabled.disabledRows) || []
|
|
711
|
+
}
|
|
712
|
+
}),
|
|
713
|
+
_useControllableValue6 = _slicedToArray(_useControllableValue5, 1),
|
|
714
|
+
localDisabledRows = _useControllableValue6[0];
|
|
703
715
|
/** TODO: 当前展开的列 */
|
|
704
716
|
|
|
705
717
|
|
|
@@ -712,7 +724,10 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
712
724
|
var deepDataSourceRef = useRef(deepDataSourcePreKeys(dataSource, _rowKey));
|
|
713
725
|
dataSourceRef.current = dataSource;
|
|
714
726
|
deepDataSourceRef.current = deepDataSourcePreKeys(dataSource, _rowKey);
|
|
727
|
+
var disabledDataSourceRowKeys = useRef(checkTableRowIsDisable(deepDataSourceRef.current, localDisabledRows.disabledRows, _rowKey));
|
|
728
|
+
disabledDataSourceRowKeys.current = checkTableRowIsDisable(deepDataSourceRef.current, localDisabledRows.disabledRows, _rowKey);
|
|
715
729
|
var tableWarpRef = useRef(null);
|
|
730
|
+
var autoSizerRef = useRef(null);
|
|
716
731
|
|
|
717
732
|
var onColSortEnd = function onColSortEnd(active, over) {
|
|
718
733
|
var _a;
|
|
@@ -1091,7 +1106,6 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1091
1106
|
render: function render(_, record, index) {
|
|
1092
1107
|
var _a, _b, _c;
|
|
1093
1108
|
|
|
1094
|
-
console.log(deepDataSourceRef.current, '--deepDataSourceRef.current', _rowKey);
|
|
1095
1109
|
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
1110
|
}
|
|
1097
1111
|
} : Object.assign(Object.assign({
|
|
@@ -1307,11 +1321,39 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1307
1321
|
}
|
|
1308
1322
|
},
|
|
1309
1323
|
onRow: function onRow(record, index) {
|
|
1324
|
+
var _a;
|
|
1325
|
+
|
|
1310
1326
|
return {
|
|
1311
|
-
disabled: disabled
|
|
1327
|
+
disabled: disabled || !!((_a = disabledDataSourceRowKeys.current) === null || _a === void 0 ? void 0 : _a.includes(record[_rowKey]))
|
|
1312
1328
|
};
|
|
1313
1329
|
}
|
|
1314
1330
|
}, resetProps));
|
|
1331
|
+
useEffect(function () {
|
|
1332
|
+
var _a;
|
|
1333
|
+
|
|
1334
|
+
if (autoSizer) {
|
|
1335
|
+
var tableClient = (_a = tableWarpRef === null || tableWarpRef === void 0 ? void 0 : tableWarpRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
1336
|
+
var height = (tableClient === null || tableClient === void 0 ? void 0 : tableClient.height) || '100%';
|
|
1337
|
+
var TailorHeight = size === 'middle' ? 48 : 40;
|
|
1338
|
+
|
|
1339
|
+
if (isAdd) {
|
|
1340
|
+
TailorHeight += 48;
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
if (props.summary) {
|
|
1344
|
+
TailorHeight += 48;
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
if (props.pagination) {
|
|
1348
|
+
TailorHeight += 48;
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
autoSizerRef.current = {
|
|
1352
|
+
width: tableClient === null || tableClient === void 0 ? void 0 : tableClient.width,
|
|
1353
|
+
height: typeof height === 'string' ? "calc(".concat(height, " - ").concat(TailorHeight, "px)") : height - TailorHeight
|
|
1354
|
+
};
|
|
1355
|
+
}
|
|
1356
|
+
}, []);
|
|
1315
1357
|
|
|
1316
1358
|
if (colSortOpen) {
|
|
1317
1359
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -1329,7 +1371,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1329
1371
|
items: columns.reduce(function (acc, item) {
|
|
1330
1372
|
return [].concat(_toConsumableArray(acc), [item.dataIndex]);
|
|
1331
1373
|
}, [])
|
|
1332
|
-
}, /*#__PURE__*/React.createElement(Table, Object.assign({}, checkDataSourceIsEmpty(config.current, dataSourceRef.current), {
|
|
1374
|
+
}, /*#__PURE__*/React.createElement(Table, Object.assign({}, checkDataSourceIsEmpty(config.current, dataSourceRef.current, autoSizerRef.current), {
|
|
1333
1375
|
loading: loading,
|
|
1334
1376
|
size: size || 'small',
|
|
1335
1377
|
columns: resultColumns,
|
|
@@ -1359,18 +1401,21 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1359
1401
|
|
|
1360
1402
|
|
|
1361
1403
|
return /*#__PURE__*/React.createElement("div", {
|
|
1362
|
-
className:
|
|
1404
|
+
className: cls('lm_editTable_warpper', autoSizer && 'lm_editable_autosize'),
|
|
1363
1405
|
ref: tableWarpRef
|
|
1364
1406
|
}, /*#__PURE__*/React.createElement(ConfigProvider, {
|
|
1365
1407
|
renderEmpty: loading ? function () {
|
|
1366
1408
|
return null;
|
|
1367
1409
|
} : CustomizeRenderEmpty
|
|
1368
|
-
}, /*#__PURE__*/React.createElement(Table, Object.assign({}, checkDataSourceIsEmpty(config.current, dataSourceRef.current), {
|
|
1410
|
+
}, /*#__PURE__*/React.createElement(Table, Object.assign({}, checkDataSourceIsEmpty(config.current, dataSourceRef.current, autoSizerRef.current), {
|
|
1369
1411
|
size: size || 'small',
|
|
1370
1412
|
columns: resultColumns,
|
|
1371
1413
|
rowClassName: "editable-row",
|
|
1372
1414
|
bordered: true,
|
|
1373
1415
|
loading: loading,
|
|
1416
|
+
style: autoSizer ? {
|
|
1417
|
+
height: isAdd ? "calc(100% - ".concat(48, "px)") : '100%'
|
|
1418
|
+
} : undefined,
|
|
1374
1419
|
pagination: false,
|
|
1375
1420
|
// components={tableComponents}
|
|
1376
1421
|
expandable: (resetProps === null || resetProps === void 0 ? void 0 : resetProps.expandable) || {
|
|
@@ -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,
|
|
@@ -64,8 +67,8 @@ var DndContainer = function DndContainer(_ref) {
|
|
|
64
67
|
move: move,
|
|
65
68
|
items: items,
|
|
66
69
|
tableWidth: tableWidth
|
|
67
|
-
};
|
|
68
|
-
|
|
70
|
+
}; // console.log('instance', instance)
|
|
71
|
+
|
|
69
72
|
return /*#__PURE__*/React.createElement(DndContext, {
|
|
70
73
|
sensors: sensors,
|
|
71
74
|
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
|
};
|
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, isFunction, omit } from 'lodash';
|
|
3
|
+
import { keyBy, isEqual, pick, isFunction, omit, isObject } from 'lodash';
|
|
4
4
|
export function isObjEmpty(obj) {
|
|
5
5
|
var _a;
|
|
6
6
|
|
|
@@ -140,17 +140,66 @@ export function checkExpandIconColumnIndex(_ref) {
|
|
|
140
140
|
});
|
|
141
141
|
return arr.length;
|
|
142
142
|
}
|
|
143
|
-
export function checkDataSourceIsEmpty(config, dataSource) {
|
|
143
|
+
export function checkDataSourceIsEmpty(config, dataSource, scrollInfo) {
|
|
144
|
+
var _a, _b;
|
|
145
|
+
|
|
146
|
+
var resultConfig = Object.assign({}, config);
|
|
147
|
+
|
|
148
|
+
if (scrollInfo) {
|
|
149
|
+
resultConfig = Object.assign(Object.assign({}, resultConfig), {
|
|
150
|
+
scroll: {
|
|
151
|
+
x: ((_a = resultConfig.scroll) === null || _a === void 0 ? void 0 : _a.x) || '100%',
|
|
152
|
+
y: scrollInfo.height || ((_b = resultConfig.scroll) === null || _b === void 0 ? void 0 : _b.y)
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
144
157
|
if (dataSource.length) {
|
|
145
|
-
return
|
|
158
|
+
return resultConfig;
|
|
146
159
|
}
|
|
147
160
|
|
|
148
|
-
return Object.assign(Object.assign({},
|
|
149
|
-
components: Object.assign(Object.assign({},
|
|
161
|
+
return Object.assign(Object.assign({}, resultConfig), {
|
|
162
|
+
components: Object.assign(Object.assign({}, resultConfig.components), {
|
|
150
163
|
body: {}
|
|
151
164
|
})
|
|
152
165
|
});
|
|
153
166
|
}
|
|
167
|
+
/** 根据传入的disabedRows, 得出最终需要disabed的rowKeys */
|
|
168
|
+
|
|
169
|
+
export function checkTableRowIsDisable(deepDataSource, disabledRows, rowKey) {
|
|
170
|
+
var disabledRkeys = [];
|
|
171
|
+
|
|
172
|
+
if (!disabledRows.length) {
|
|
173
|
+
return disabledRkeys;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
var disableIds = disabledRows.map(function (item) {
|
|
177
|
+
return isObject(item) ? item === null || item === void 0 ? void 0 : item[rowKey] : item;
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
function deep(children, arrs) {
|
|
181
|
+
children === null || children === void 0 ? void 0 : children.forEach(function (item) {
|
|
182
|
+
arrs.push(item[rowKey]);
|
|
183
|
+
|
|
184
|
+
if (item.children) {
|
|
185
|
+
deep(item.children, arrs);
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (disableIds.length) {
|
|
191
|
+
disableIds === null || disableIds === void 0 ? void 0 : disableIds.forEach(function (item) {
|
|
192
|
+
disabledRkeys.push(item);
|
|
193
|
+
var record = deepDataSource[item];
|
|
194
|
+
|
|
195
|
+
if (record === null || record === void 0 ? void 0 : record.children) {
|
|
196
|
+
deep(record.children, disabledRkeys);
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return disabledRkeys;
|
|
202
|
+
}
|
|
154
203
|
export default {
|
|
155
204
|
isObjEmpty: isObjEmpty
|
|
156
205
|
};
|
|
@@ -16,8 +16,9 @@ var _components = _interopRequireDefault(require("../components"));
|
|
|
16
16
|
// 二级过滤 => 基础过滤组件
|
|
17
17
|
var LmFilterBase = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
18
18
|
var instance = _ref.instance;
|
|
19
|
-
var dataSource = instance.dataSource
|
|
20
|
-
|
|
19
|
+
var dataSource = instance.dataSource,
|
|
20
|
+
enableSearch = instance.enableSearch;
|
|
21
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, enableSearch && /*#__PURE__*/_react.default.createElement(_fuzzySearch.default, {
|
|
21
22
|
instance: instance
|
|
22
23
|
}), dataSource.map(function (v, index) {
|
|
23
24
|
var isHidden = !v.show && typeof v.show === 'boolean';
|
|
@@ -168,6 +168,7 @@ var useCoreOptions = function useCoreOptions(_ref) {
|
|
|
168
168
|
|
|
169
169
|
if (getIsHas(itemValue) && !!item) {
|
|
170
170
|
return [].concat(_toConsumableArray(pre), [{
|
|
171
|
+
relation: obj[cur].mode || 'and',
|
|
171
172
|
fieldName: cur,
|
|
172
173
|
fieldType: (item === null || item === void 0 ? void 0 : item.valueType) || 'string',
|
|
173
174
|
type: item.type,
|
|
@@ -177,7 +178,7 @@ var useCoreOptions = function useCoreOptions(_ref) {
|
|
|
177
178
|
* and 等同于逻辑关系contains: 选中的值包含所有值
|
|
178
179
|
* or 等同于逻辑关系in: 选中的值存在于所有值之中
|
|
179
180
|
*/
|
|
180
|
-
operator:
|
|
181
|
+
operator: 'in'
|
|
181
182
|
}]);
|
|
182
183
|
}
|
|
183
184
|
|
|
@@ -344,11 +345,12 @@ var useCoreOptions = function useCoreOptions(_ref) {
|
|
|
344
345
|
if (getIsHas(itemValue) && !!item) {
|
|
345
346
|
// eslint-disable-next-line no-param-reassign
|
|
346
347
|
pre[cur] = {
|
|
348
|
+
relation: complexFilter[cur].mode || 'and',
|
|
347
349
|
fieldName: cur,
|
|
348
350
|
fieldType: (item === null || item === void 0 ? void 0 : item.valueType) || 'string',
|
|
349
351
|
type: item.type,
|
|
350
352
|
value: Array.isArray(itemValue) ? itemValue : [itemValue],
|
|
351
|
-
operator:
|
|
353
|
+
operator: 'in'
|
|
352
354
|
};
|
|
353
355
|
}
|
|
354
356
|
|
|
@@ -24,7 +24,7 @@ var UploadCore = function UploadCore(_ref) {
|
|
|
24
24
|
var isUploading = getUploadStatus().uploading;
|
|
25
25
|
if (isUploading) return;
|
|
26
26
|
(_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
27
|
-
}, [getUploadStatus]); // 上传触发事件
|
|
27
|
+
}, [disabled, getUploadStatus]); // 上传触发事件
|
|
28
28
|
|
|
29
29
|
var uploadChange = useCallback(function (e) {
|
|
30
30
|
var _a;
|
package/es/Radio/index.js
CHANGED
|
@@ -19,13 +19,21 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
19
19
|
|
|
20
20
|
var _react = _interopRequireDefault(require("react"));
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _DisabledContext = _interopRequireDefault(require("../ConfigProvider/DisabledContext"));
|
|
23
|
+
|
|
24
|
+
var _excluded = ["children", "disabled"],
|
|
23
25
|
_excluded2 = ["children", "size", "buttonStyle", "direction", "className"];
|
|
24
26
|
|
|
25
27
|
var LMRadio = function LMRadio(props) {
|
|
26
28
|
var children = props.children,
|
|
29
|
+
customDisabled = props.disabled,
|
|
27
30
|
restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
31
|
+
|
|
32
|
+
var disabled = _react.default.useContext(_DisabledContext.default);
|
|
33
|
+
|
|
34
|
+
var mergedDisabled = customDisabled || disabled;
|
|
28
35
|
return /*#__PURE__*/_react.default.createElement(_radio.default, (0, _extends2.default)({
|
|
36
|
+
disabled: mergedDisabled,
|
|
29
37
|
className: "lm-radio"
|
|
30
38
|
}, restProps), children);
|
|
31
39
|
};
|
package/es/Switch/index.js
CHANGED
|
@@ -17,16 +17,21 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
17
17
|
|
|
18
18
|
import React from 'react';
|
|
19
19
|
import cls from 'classnames';
|
|
20
|
+
import DisabledContext from '../ConfigProvider/DisabledContext';
|
|
20
21
|
|
|
21
22
|
var Switch = function Switch(props) {
|
|
22
23
|
var _props$size = props.size,
|
|
23
24
|
size = _props$size === void 0 ? 'default' : _props$size,
|
|
24
25
|
className = props.className,
|
|
25
|
-
|
|
26
|
+
customDisabled = props.disabled,
|
|
27
|
+
restProps = __rest(props, ["size", "className", "disabled"]);
|
|
26
28
|
|
|
29
|
+
var disabled = React.useContext(DisabledContext);
|
|
30
|
+
var mergedDisabled = customDisabled || disabled;
|
|
27
31
|
var classs = cls('lm-switch', className, _defineProperty({}, "lm-switch-".concat(size), size));
|
|
28
32
|
return /*#__PURE__*/React.createElement(_Switch, Object.assign({
|
|
29
|
-
className: classs
|
|
33
|
+
className: classs,
|
|
34
|
+
disabled: mergedDisabled
|
|
30
35
|
}, restProps, {
|
|
31
36
|
size: size
|
|
32
37
|
}));
|
package/es/styles/variables.css
CHANGED
|
@@ -9870,6 +9870,20 @@ p {
|
|
|
9870
9870
|
padding-left: 7px;
|
|
9871
9871
|
box-sizing: border-box;
|
|
9872
9872
|
}
|
|
9873
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table-wrapper,
|
|
9874
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-spin-nested-loading,
|
|
9875
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-spin-container,
|
|
9876
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table,
|
|
9877
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table-container {
|
|
9878
|
+
height: 100%;
|
|
9879
|
+
}
|
|
9880
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table-wrapper .ant-table-body,
|
|
9881
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-spin-nested-loading .ant-table-body,
|
|
9882
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-spin-container .ant-table-body,
|
|
9883
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table .ant-table-body,
|
|
9884
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table-container .ant-table-body {
|
|
9885
|
+
height: calc(100% - 41px);
|
|
9886
|
+
}
|
|
9873
9887
|
.lm_editTable_wrapperRange .inputRange {
|
|
9874
9888
|
display: inline-flex;
|
|
9875
9889
|
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;
|
|
@@ -114,6 +114,7 @@ var EditableRow = function EditableRow(_a) {
|
|
|
114
114
|
|
|
115
115
|
return /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Form, {
|
|
116
116
|
form: form,
|
|
117
|
+
disabled: props.disabled || false,
|
|
117
118
|
component: false
|
|
118
119
|
}, /*#__PURE__*/_react.default.createElement(EditableContext.Provider, {
|
|
119
120
|
value: form
|
|
@@ -695,6 +696,7 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
695
696
|
_props$quickOpetateCl = props.quickOpetateClearAll,
|
|
696
697
|
quickOpetateClearAll = _props$quickOpetateCl === void 0 ? true : _props$quickOpetateCl,
|
|
697
698
|
rowSelection = props.rowSelection,
|
|
699
|
+
rowDisabled = props.rowDisabled,
|
|
698
700
|
virtual = props.virtual,
|
|
699
701
|
sortOpen = props.sortOpen,
|
|
700
702
|
disabled = props.disabled,
|
|
@@ -709,7 +711,9 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
709
711
|
shouldUpdate = _props$shouldUpdate === void 0 ? false : _props$shouldUpdate,
|
|
710
712
|
_props$loading = props.loading,
|
|
711
713
|
loading = _props$loading === void 0 ? false : _props$loading,
|
|
712
|
-
|
|
714
|
+
_props$autoSizer = props.autoSizer,
|
|
715
|
+
autoSizer = _props$autoSizer === void 0 ? false : _props$autoSizer,
|
|
716
|
+
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"]);
|
|
713
717
|
|
|
714
718
|
var _useControllableValue = (0, _ahooks.useControllableValue)({
|
|
715
719
|
value: (0, _util.checkRowKeyByDataSource)(props.value, _rowKey),
|
|
@@ -734,6 +738,14 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
734
738
|
_useControllableValue4 = (0, _slicedToArray2.default)(_useControllableValue3, 2),
|
|
735
739
|
localRowSelectList = _useControllableValue4[0],
|
|
736
740
|
setLocalRowSelectList = _useControllableValue4[1];
|
|
741
|
+
|
|
742
|
+
var _useControllableValue5 = (0, _ahooks.useControllableValue)({
|
|
743
|
+
value: {
|
|
744
|
+
disabledRows: (rowDisabled === null || rowDisabled === void 0 ? void 0 : rowDisabled.disabledRows) || []
|
|
745
|
+
}
|
|
746
|
+
}),
|
|
747
|
+
_useControllableValue6 = (0, _slicedToArray2.default)(_useControllableValue5, 1),
|
|
748
|
+
localDisabledRows = _useControllableValue6[0];
|
|
737
749
|
/** TODO: 当前展开的列 */
|
|
738
750
|
|
|
739
751
|
|
|
@@ -746,7 +758,10 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
746
758
|
var deepDataSourceRef = (0, _react.useRef)((0, _util.deepDataSourcePreKeys)(dataSource, _rowKey));
|
|
747
759
|
dataSourceRef.current = dataSource;
|
|
748
760
|
deepDataSourceRef.current = (0, _util.deepDataSourcePreKeys)(dataSource, _rowKey);
|
|
761
|
+
var disabledDataSourceRowKeys = (0, _react.useRef)((0, _util.checkTableRowIsDisable)(deepDataSourceRef.current, localDisabledRows.disabledRows, _rowKey));
|
|
762
|
+
disabledDataSourceRowKeys.current = (0, _util.checkTableRowIsDisable)(deepDataSourceRef.current, localDisabledRows.disabledRows, _rowKey);
|
|
749
763
|
var tableWarpRef = (0, _react.useRef)(null);
|
|
764
|
+
var autoSizerRef = (0, _react.useRef)(null);
|
|
750
765
|
|
|
751
766
|
var onColSortEnd = function onColSortEnd(active, over) {
|
|
752
767
|
var _a;
|
|
@@ -1125,7 +1140,6 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1125
1140
|
render: function render(_, record, index) {
|
|
1126
1141
|
var _a, _b, _c;
|
|
1127
1142
|
|
|
1128
|
-
console.log(deepDataSourceRef.current, '--deepDataSourceRef.current', _rowKey);
|
|
1129
1143
|
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);
|
|
1130
1144
|
}
|
|
1131
1145
|
} : Object.assign(Object.assign({
|
|
@@ -1340,11 +1354,39 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1340
1354
|
}
|
|
1341
1355
|
},
|
|
1342
1356
|
onRow: function onRow(record, index) {
|
|
1357
|
+
var _a;
|
|
1358
|
+
|
|
1343
1359
|
return {
|
|
1344
|
-
disabled: disabled
|
|
1360
|
+
disabled: disabled || !!((_a = disabledDataSourceRowKeys.current) === null || _a === void 0 ? void 0 : _a.includes(record[_rowKey]))
|
|
1345
1361
|
};
|
|
1346
1362
|
}
|
|
1347
1363
|
}, resetProps));
|
|
1364
|
+
(0, _react.useEffect)(function () {
|
|
1365
|
+
var _a;
|
|
1366
|
+
|
|
1367
|
+
if (autoSizer) {
|
|
1368
|
+
var tableClient = (_a = tableWarpRef === null || tableWarpRef === void 0 ? void 0 : tableWarpRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
1369
|
+
var height = (tableClient === null || tableClient === void 0 ? void 0 : tableClient.height) || '100%';
|
|
1370
|
+
var TailorHeight = size === 'middle' ? 48 : 40;
|
|
1371
|
+
|
|
1372
|
+
if (isAdd) {
|
|
1373
|
+
TailorHeight += 48;
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
if (props.summary) {
|
|
1377
|
+
TailorHeight += 48;
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
if (props.pagination) {
|
|
1381
|
+
TailorHeight += 48;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
autoSizerRef.current = {
|
|
1385
|
+
width: tableClient === null || tableClient === void 0 ? void 0 : tableClient.width,
|
|
1386
|
+
height: typeof height === 'string' ? "calc(".concat(height, " - ").concat(TailorHeight, "px)") : height - TailorHeight
|
|
1387
|
+
};
|
|
1388
|
+
}
|
|
1389
|
+
}, []);
|
|
1348
1390
|
|
|
1349
1391
|
if (colSortOpen) {
|
|
1350
1392
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -1362,7 +1404,7 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1362
1404
|
items: columns.reduce(function (acc, item) {
|
|
1363
1405
|
return [].concat((0, _toConsumableArray2.default)(acc), [item.dataIndex]);
|
|
1364
1406
|
}, [])
|
|
1365
|
-
}, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Table, Object.assign({}, (0, _util.checkDataSourceIsEmpty)(config.current, dataSourceRef.current), {
|
|
1407
|
+
}, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Table, Object.assign({}, (0, _util.checkDataSourceIsEmpty)(config.current, dataSourceRef.current, autoSizerRef.current), {
|
|
1366
1408
|
loading: loading,
|
|
1367
1409
|
size: size || 'small',
|
|
1368
1410
|
columns: resultColumns,
|
|
@@ -1392,18 +1434,21 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1392
1434
|
|
|
1393
1435
|
|
|
1394
1436
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
1395
|
-
className:
|
|
1437
|
+
className: (0, _classnames.default)('lm_editTable_warpper', autoSizer && 'lm_editable_autosize'),
|
|
1396
1438
|
ref: tableWarpRef
|
|
1397
1439
|
}, /*#__PURE__*/_react.default.createElement(_ConfigProvider.default, {
|
|
1398
1440
|
renderEmpty: loading ? function () {
|
|
1399
1441
|
return null;
|
|
1400
1442
|
} : _components.CustomizeRenderEmpty
|
|
1401
|
-
}, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Table, Object.assign({}, (0, _util.checkDataSourceIsEmpty)(config.current, dataSourceRef.current), {
|
|
1443
|
+
}, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Table, Object.assign({}, (0, _util.checkDataSourceIsEmpty)(config.current, dataSourceRef.current, autoSizerRef.current), {
|
|
1402
1444
|
size: size || 'small',
|
|
1403
1445
|
columns: resultColumns,
|
|
1404
1446
|
rowClassName: "editable-row",
|
|
1405
1447
|
bordered: true,
|
|
1406
1448
|
loading: loading,
|
|
1449
|
+
style: autoSizer ? {
|
|
1450
|
+
height: isAdd ? "calc(100% - ".concat(48, "px)") : '100%'
|
|
1451
|
+
} : undefined,
|
|
1407
1452
|
pagination: false,
|
|
1408
1453
|
// components={tableComponents}
|
|
1409
1454
|
expandable: (resetProps === null || resetProps === void 0 ? void 0 : resetProps.expandable) || {
|
|
@@ -19,6 +19,7 @@ var _modifiers = require("@dnd-kit/modifiers");
|
|
|
19
19
|
|
|
20
20
|
var _sortable = require("@dnd-kit/sortable");
|
|
21
21
|
|
|
22
|
+
/* eslint-disable no-unused-vars */
|
|
22
23
|
// 可拖拽容器
|
|
23
24
|
var DndContainer = function DndContainer(_ref) {
|
|
24
25
|
var children = _ref.children,
|
|
@@ -69,7 +70,8 @@ var DndContainer = function DndContainer(_ref) {
|
|
|
69
70
|
if (active.id !== over.id) {
|
|
70
71
|
move(active.id, over.id);
|
|
71
72
|
}
|
|
72
|
-
};
|
|
73
|
+
}; // @ts-ignore
|
|
74
|
+
|
|
73
75
|
|
|
74
76
|
var instance = {
|
|
75
77
|
isDragging: isDragging,
|
|
@@ -80,8 +82,8 @@ var DndContainer = function DndContainer(_ref) {
|
|
|
80
82
|
move: move,
|
|
81
83
|
items: items,
|
|
82
84
|
tableWidth: tableWidth
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
+
}; // console.log('instance', instance)
|
|
86
|
+
|
|
85
87
|
return /*#__PURE__*/_react.default.createElement(_core.DndContext, {
|
|
86
88
|
sensors: sensors,
|
|
87
89
|
onDragStart: handleDragStart,
|