linkmore-design 1.1.13-alpha.0 → 1.1.13-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/CHANGELOG.md +11 -0
- package/dist/Form/demos/disabled.d.ts +2 -0
- package/dist/LmEditTable/EditTable.d.ts +1 -0
- package/dist/LmFilter/LmFilter.d.ts +2 -6
- package/dist/LmTable/expression.d.ts +1 -0
- package/dist/LmTable/hooks/useGroupDataSource.d.ts +7 -0
- package/dist/index.umd.js +210 -62
- package/dist/index.umd.min.js +16 -16
- package/dist/variables.css +3 -0
- package/es/Cascader/index.js +16 -2
- package/es/Form/style/index.css +3 -0
- package/es/Form/style/variables.css +3 -0
- package/es/Input/index.js +21 -9
- package/es/InputNumber/index.js +9 -2
- package/es/LmEditTable/EditTable.d.ts +1 -0
- package/es/LmEditTable/EditTable.js +37 -10
- package/es/LmEditTable/util.js +27 -8
- package/es/LmFilter/LmFilter.js +6 -6
- package/es/LmFilter/components/DropdownFIlter.js +5 -2
- package/es/LmFilter/index.js +0 -3
- package/es/LmTable/Table.js +10 -7
- package/es/LmTable/expression.d.ts +1 -0
- package/es/LmTable/expression.js +31 -0
- package/es/LmTable/hooks/useGroupDataSource.js +50 -0
- package/es/LmUpload/fns/index.js +8 -3
- package/es/Select/index.js +17 -7
- package/es/styles/variables.css +3 -0
- package/lib/Cascader/index.js +16 -2
- package/lib/Form/style/index.css +3 -0
- package/lib/Form/style/variables.css +3 -0
- package/lib/Input/index.js +24 -9
- package/lib/InputNumber/index.js +11 -2
- package/lib/LmEditTable/EditTable.d.ts +1 -0
- package/lib/LmEditTable/EditTable.js +36 -9
- package/lib/LmEditTable/util.js +27 -8
- package/lib/LmFilter/LmFilter.js +6 -6
- package/lib/LmFilter/components/DropdownFIlter.js +5 -2
- package/lib/LmFilter/index.js +0 -3
- package/lib/LmTable/Table.js +10 -7
- package/lib/LmTable/expression.d.ts +1 -0
- package/lib/LmTable/expression.js +41 -0
- package/lib/LmTable/hooks/useGroupDataSource.js +50 -0
- package/lib/LmUpload/fns/index.js +8 -3
- package/lib/Select/index.js +19 -7
- package/lib/styles/variables.css +3 -0
- package/package.json +1 -1
package/dist/variables.css
CHANGED
|
@@ -9001,6 +9001,9 @@ p {
|
|
|
9001
9001
|
.lm_container_wrapper .lm_container.responsive.lm_col_5 .ant-form-item-responsive.nth-five {
|
|
9002
9002
|
margin-right: 0;
|
|
9003
9003
|
}
|
|
9004
|
+
.lm_container_wrapper .lm_container.responsive .ant-cascader {
|
|
9005
|
+
width: 100%;
|
|
9006
|
+
}
|
|
9004
9007
|
.lm_form-item-tip-error .ant-form-item-explain {
|
|
9005
9008
|
width: 100%;
|
|
9006
9009
|
position: absolute;
|
package/es/Cascader/index.js
CHANGED
|
@@ -25,12 +25,26 @@ var LMCascader = function LMCascader(props) {
|
|
|
25
25
|
dropdownClassName = props.dropdownClassName,
|
|
26
26
|
_props$placeholder = props.placeholder,
|
|
27
27
|
placeholder = _props$placeholder === void 0 ? '请选择' : _props$placeholder,
|
|
28
|
-
|
|
28
|
+
defaultLabel = props.defaultLabel,
|
|
29
|
+
others = __rest(props, ["children", "className", "dropdownClassName", "placeholder", "defaultLabel"]);
|
|
30
|
+
|
|
31
|
+
var displayRender = function displayRender(label, selectedOptions) {
|
|
32
|
+
var hasUndefined = selectedOptions.some(function (v) {
|
|
33
|
+
return !v;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
if (hasUndefined && defaultLabel) {
|
|
37
|
+
return defaultLabel;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return label.join('/');
|
|
41
|
+
};
|
|
29
42
|
|
|
30
43
|
return /*#__PURE__*/React.createElement(_Cascader, Object.assign({
|
|
31
44
|
placeholder: placeholder,
|
|
32
45
|
className: classNames(prefixCls, className),
|
|
33
|
-
dropdownClassName: classNames(prefixDropdownCls, dropdownClassName)
|
|
46
|
+
dropdownClassName: classNames(prefixDropdownCls, dropdownClassName),
|
|
47
|
+
displayRender: displayRender
|
|
34
48
|
}, others));
|
|
35
49
|
};
|
|
36
50
|
|
package/es/Form/style/index.css
CHANGED
|
@@ -6663,6 +6663,9 @@ p {
|
|
|
6663
6663
|
.lm_container_wrapper .lm_container.responsive.lm_col_5 .ant-form-item-responsive.nth-five {
|
|
6664
6664
|
margin-right: 0;
|
|
6665
6665
|
}
|
|
6666
|
+
.lm_container_wrapper .lm_container.responsive .ant-cascader {
|
|
6667
|
+
width: 100%;
|
|
6668
|
+
}
|
|
6666
6669
|
.lm_form-item-tip-error .ant-form-item-explain {
|
|
6667
6670
|
width: 100%;
|
|
6668
6671
|
position: absolute;
|
|
@@ -6151,6 +6151,9 @@
|
|
|
6151
6151
|
.lm_container_wrapper .lm_container.responsive.lm_col_5 .ant-form-item-responsive.nth-five {
|
|
6152
6152
|
margin-right: 0;
|
|
6153
6153
|
}
|
|
6154
|
+
.lm_container_wrapper .lm_container.responsive .ant-cascader {
|
|
6155
|
+
width: 100%;
|
|
6156
|
+
}
|
|
6154
6157
|
.lm_form-item-tip-error .ant-form-item-explain {
|
|
6155
6158
|
width: 100%;
|
|
6156
6159
|
position: absolute;
|
package/es/Input/index.js
CHANGED
|
@@ -16,17 +16,27 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
16
16
|
|
|
17
17
|
import React, { forwardRef } from 'react';
|
|
18
18
|
import IconFont from '../IconFont';
|
|
19
|
+
import cn from 'classnames';
|
|
19
20
|
import SizeContext from '../ConfigProvider/SizeContext';
|
|
21
|
+
import DisabledContext from '../ConfigProvider/DisabledContext';
|
|
20
22
|
var LmInput = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
21
|
-
var
|
|
23
|
+
var className = props.className,
|
|
24
|
+
customSize = props.size,
|
|
25
|
+
customDisabled = props.disabled,
|
|
26
|
+
_props$allowClear = props.allowClear,
|
|
22
27
|
allowClear = _props$allowClear === void 0 ? true : _props$allowClear,
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
rest = __rest(props // ===================== Size =====================
|
|
29
|
+
, ["className", "size", "disabled", "allowClear"]); // ===================== Size =====================
|
|
25
30
|
|
|
26
|
-
|
|
31
|
+
|
|
32
|
+
var size = customSize || React.useContext(SizeContext) || 'middle'; // ===================== Disabled =====================
|
|
33
|
+
|
|
34
|
+
var disabled = React.useContext(DisabledContext);
|
|
35
|
+
var mergedDisabled = customDisabled || disabled;
|
|
27
36
|
return /*#__PURE__*/React.createElement(_Input, Object.assign({
|
|
28
37
|
ref: ref,
|
|
29
|
-
className:
|
|
38
|
+
className: cn('lm_input', className),
|
|
39
|
+
disabled: mergedDisabled || undefined,
|
|
30
40
|
size: size
|
|
31
41
|
}, rest, {
|
|
32
42
|
allowClear: allowClear
|
|
@@ -36,7 +46,8 @@ LmInput.Group = _Input.Group;
|
|
|
36
46
|
LmInput.Search = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
37
47
|
var _props$allowClear2 = props.allowClear,
|
|
38
48
|
allowClear = _props$allowClear2 === void 0 ? true : _props$allowClear2,
|
|
39
|
-
|
|
49
|
+
className = props.className,
|
|
50
|
+
rest = __rest(props, ["allowClear", "className"]);
|
|
40
51
|
|
|
41
52
|
return /*#__PURE__*/React.createElement(_Input.Search, Object.assign({
|
|
42
53
|
enterButton: /*#__PURE__*/React.createElement(IconFont, {
|
|
@@ -45,7 +56,7 @@ LmInput.Search = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
45
56
|
}, rest, {
|
|
46
57
|
ref: ref,
|
|
47
58
|
allowClear: allowClear,
|
|
48
|
-
className:
|
|
59
|
+
className: cn('lm_input_search', className)
|
|
49
60
|
}));
|
|
50
61
|
});
|
|
51
62
|
LmInput.TextArea = _Input.TextArea;
|
|
@@ -53,10 +64,11 @@ LmInput.TextArea = _Input.TextArea;
|
|
|
53
64
|
LmInput.Password = function (props) {
|
|
54
65
|
var _props$allowClear3 = props.allowClear,
|
|
55
66
|
allowClear = _props$allowClear3 === void 0 ? true : _props$allowClear3,
|
|
56
|
-
|
|
67
|
+
className = props.className,
|
|
68
|
+
rest = __rest(props, ["allowClear", "className"]);
|
|
57
69
|
|
|
58
70
|
return /*#__PURE__*/React.createElement(_Input.Password, Object.assign({
|
|
59
|
-
className:
|
|
71
|
+
className: cn('lm_input_password', className),
|
|
60
72
|
iconRender: function iconRender(visible) {
|
|
61
73
|
return visible ? /*#__PURE__*/React.createElement(IconFont, {
|
|
62
74
|
type: "lmweb-eye"
|
package/es/InputNumber/index.js
CHANGED
|
@@ -16,17 +16,24 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
16
16
|
|
|
17
17
|
import classNames from 'classnames';
|
|
18
18
|
import React from 'react';
|
|
19
|
+
import DisabledContext from '../ConfigProvider/DisabledContext';
|
|
19
20
|
var prefixCls = 'lm_input-number';
|
|
20
21
|
|
|
21
22
|
var LMInputNumber = function LMInputNumber(props) {
|
|
22
23
|
var children = props.children,
|
|
23
24
|
className = props.className,
|
|
24
|
-
|
|
25
|
+
customDisabled = props.disabled,
|
|
26
|
+
rest = __rest(props // ===================== Disabled =====================
|
|
27
|
+
, ["children", "className", "disabled"]); // ===================== Disabled =====================
|
|
25
28
|
|
|
29
|
+
|
|
30
|
+
var disabled = React.useContext(DisabledContext);
|
|
31
|
+
var mergedDisabled = customDisabled || disabled;
|
|
26
32
|
return /*#__PURE__*/React.createElement(_InputNumber, Object.assign({
|
|
27
33
|
className: classNames(className, prefixCls),
|
|
34
|
+
disabled: mergedDisabled,
|
|
28
35
|
placeholder: "\u8BF7\u8F93\u5165"
|
|
29
|
-
},
|
|
36
|
+
}, rest));
|
|
30
37
|
};
|
|
31
38
|
|
|
32
39
|
var CInputNumber = LMInputNumber;
|
|
@@ -13,6 +13,7 @@ interface ILmEditTable extends TableProps<any> {
|
|
|
13
13
|
sortOpen?: boolean;
|
|
14
14
|
size?: TableProps<any>['size'];
|
|
15
15
|
colSortOpen?: boolean;
|
|
16
|
+
indexCol?: boolean | Record<string, any>;
|
|
16
17
|
filterChange?: (data: TableProps<any>['columns']) => void;
|
|
17
18
|
recordCreatorProps?: {
|
|
18
19
|
creatorButtonText?: string;
|
|
@@ -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 } from 'lodash';
|
|
57
|
+
import { get, set, isFunction, omit, isEqual, pick, isBoolean } 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';
|
|
@@ -290,7 +290,7 @@ var Opetate = function Opetate(_ref) {
|
|
|
290
290
|
fontSize: 16
|
|
291
291
|
}
|
|
292
292
|
})
|
|
293
|
-
})) : /*#__PURE__*/React.createElement(Button, {
|
|
293
|
+
})) : (options === null || options === void 0 ? void 0 : options.includes('add')) || (options === null || options === void 0 ? void 0 : options.includes('addInChildren')) ? /*#__PURE__*/React.createElement(Button, {
|
|
294
294
|
type: "link",
|
|
295
295
|
size: "small",
|
|
296
296
|
icon: /*#__PURE__*/React.createElement(IconFont, {
|
|
@@ -302,7 +302,7 @@ var Opetate = function Opetate(_ref) {
|
|
|
302
302
|
onClick: function onClick() {
|
|
303
303
|
return handleAdd(record, (options === null || options === void 0 ? void 0 : options.includes('addInChildren')) ? true : false);
|
|
304
304
|
}
|
|
305
|
-
}));
|
|
305
|
+
}) : null);
|
|
306
306
|
};
|
|
307
307
|
/*
|
|
308
308
|
表格单元格
|
|
@@ -595,7 +595,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
595
595
|
var fromData = form.getFieldsValue();
|
|
596
596
|
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), {
|
|
597
597
|
onChange: save
|
|
598
|
-
}));
|
|
598
|
+
}), rowIndex);
|
|
599
599
|
}
|
|
600
600
|
|
|
601
601
|
default:
|
|
@@ -701,7 +701,6 @@ var MemoEditableCell = /*#__PURE__*/memo(EditableCell, function (prev, next) {
|
|
|
701
701
|
var pickProps = ['record', 'colIndex'];
|
|
702
702
|
var p = pick(prev, pickProps);
|
|
703
703
|
var n = pick(next, pickProps); // console.log(prev, next, '22', checkMemoShouldUploadSpecialFun(prev, next), isEqual(p, n))
|
|
704
|
-
// console.log(prev, next, '-sss')
|
|
705
704
|
|
|
706
705
|
/** TODO: 在record中带有children,子列表数据修改之后,会导致父级的record对比不一样 */
|
|
707
706
|
|
|
@@ -731,6 +730,8 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
731
730
|
virtual = props.virtual,
|
|
732
731
|
sortOpen = props.sortOpen,
|
|
733
732
|
colSortOpen = props.colSortOpen,
|
|
733
|
+
_props$indexCol = props.indexCol,
|
|
734
|
+
indexCol = _props$indexCol === void 0 ? false : _props$indexCol,
|
|
734
735
|
filterChange = props.filterChange,
|
|
735
736
|
_props$size = props.size,
|
|
736
737
|
size = _props$size === void 0 ? 'small' : _props$size,
|
|
@@ -738,7 +739,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
738
739
|
_props$shouldUpdate = props.shouldUpdate,
|
|
739
740
|
shouldUpdate = _props$shouldUpdate === void 0 ? false : _props$shouldUpdate,
|
|
740
741
|
resetProps = __rest(props // const [dataSource, setDataSource] = useState([]);
|
|
741
|
-
, ["value", "columns", "isEdit", "isAdd", "onChange", "rowKey", "rowHoverEdit", "isUseForm", "isHoverEdit", "useQuickOpetate", "quickOpetateClearAll", "rowSelection", "virtual", "sortOpen", "colSortOpen", "filterChange", "size", "recordCreatorProps", "shouldUpdate"]); // const [dataSource, setDataSource] = useState([]);
|
|
742
|
+
, ["value", "columns", "isEdit", "isAdd", "onChange", "rowKey", "rowHoverEdit", "isUseForm", "isHoverEdit", "useQuickOpetate", "quickOpetateClearAll", "rowSelection", "virtual", "sortOpen", "colSortOpen", "indexCol", "filterChange", "size", "recordCreatorProps", "shouldUpdate"]); // const [dataSource, setDataSource] = useState([]);
|
|
742
743
|
|
|
743
744
|
|
|
744
745
|
var _useControllableValue = useControllableValue({
|
|
@@ -1083,16 +1084,35 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1083
1084
|
var rColumns = hasDisableOptions ? DisableOptions : columns;
|
|
1084
1085
|
var localColumns = [sortOpen ? {
|
|
1085
1086
|
title: '排序',
|
|
1086
|
-
dataIndex: '
|
|
1087
|
+
dataIndex: '_sort',
|
|
1087
1088
|
width: 48,
|
|
1088
1089
|
maxWidth: 48,
|
|
1089
1090
|
className: 'drag-visible',
|
|
1091
|
+
fixed: 'left',
|
|
1090
1092
|
render: function render(_, record) {
|
|
1091
1093
|
return /*#__PURE__*/React.createElement(DragHandle, {
|
|
1092
1094
|
id: record[_rowKey] || record.id
|
|
1093
1095
|
});
|
|
1094
1096
|
}
|
|
1095
|
-
} : null
|
|
1097
|
+
} : null, indexCol ? isBoolean(indexCol) ? {
|
|
1098
|
+
title: '',
|
|
1099
|
+
dataIndex: '_index',
|
|
1100
|
+
width: 48,
|
|
1101
|
+
maxWidth: 48,
|
|
1102
|
+
fixed: 'left',
|
|
1103
|
+
render: function render(_, record, index) {
|
|
1104
|
+
return "".concat(index + 1);
|
|
1105
|
+
}
|
|
1106
|
+
} : Object.assign({
|
|
1107
|
+
title: '',
|
|
1108
|
+
dataIndex: '_index',
|
|
1109
|
+
width: 48,
|
|
1110
|
+
maxWidth: 48,
|
|
1111
|
+
fixed: 'left',
|
|
1112
|
+
render: function render(_, record, index) {
|
|
1113
|
+
return "".concat(index + 1);
|
|
1114
|
+
}
|
|
1115
|
+
}, indexCol || {}) : null].concat(_toConsumableArray(rColumns), [useQuickOpetate ? {
|
|
1096
1116
|
title: '操作',
|
|
1097
1117
|
dataIndex: 'lm_edit_opetate',
|
|
1098
1118
|
width: 68,
|
|
@@ -1130,8 +1150,15 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1130
1150
|
var mapColumns = function mapColumns(col, index) {
|
|
1131
1151
|
var _a, _b;
|
|
1132
1152
|
|
|
1133
|
-
if (!col.editable && !((_a = col.children) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
1134
|
-
|
|
1153
|
+
if (!col.editable && !((_a = col.children) === null || _a === void 0 ? void 0 : _a.length) && (col === null || col === void 0 ? void 0 : col.dataIndex) === '_sort') {
|
|
1154
|
+
var fn = col === null || col === void 0 ? void 0 : col.render;
|
|
1155
|
+
return Object.assign(Object.assign({}, col), {
|
|
1156
|
+
render: function render(text, record, i) {
|
|
1157
|
+
var _a;
|
|
1158
|
+
|
|
1159
|
+
return fn === null || fn === void 0 ? void 0 : fn((_a = dataSource[i]) === null || _a === void 0 ? void 0 : _a[col.dataIndex], dataSource[i], i);
|
|
1160
|
+
}
|
|
1161
|
+
});
|
|
1135
1162
|
}
|
|
1136
1163
|
|
|
1137
1164
|
var newCol = Object.assign(Object.assign({}, col), {
|
package/es/LmEditTable/util.js
CHANGED
|
@@ -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;
|
|
64
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
65
65
|
|
|
66
66
|
var checkExpandStatus = getExpandStatus(prev.children) === getExpandStatus(next.children);
|
|
67
67
|
|
|
@@ -71,24 +71,43 @@ export function checkMemoShouldUploadSpecialFun(prev, next) {
|
|
|
71
71
|
|
|
72
72
|
var prevCol = prev === null || prev === void 0 ? void 0 : prev.col;
|
|
73
73
|
var nextCol = next === null || next === void 0 ? void 0 : next.col;
|
|
74
|
+
/** TODO: 使用了自定义render, 是否要判断rowIndex? 这样排序之后,渲染的性能就会变差 */
|
|
74
75
|
|
|
75
|
-
if (((
|
|
76
|
-
return
|
|
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
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
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(pick(prev, ['colIndex', 'record', 'rowIndex']), pick(next, ['colIndex', 'record', 'rowIndex']))) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (((prevCol === null || prevCol === void 0 ? void 0 : prevCol.fixed) || (nextCol === null || nextCol === void 0 ? void 0 : nextCol.fixed)) && !isEqual(prev === null || prev === void 0 ? void 0 : prev.style, next === null || next === void 0 ? void 0 : next.style)) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if ((((_c = prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) === null || _c === void 0 ? void 0 : _c.optionOnly) || ((_d = nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps) === null || _d === void 0 ? void 0 : _d.optionOnly)) && !isEqual((_e = prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) === null || _e === void 0 ? void 0 : _e.options, (_f = nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps) === null || _f === void 0 ? void 0 : _f.options)) {
|
|
89
|
+
// return isEqual(prevCol?.componentProps?.options, nextCol?.componentProps?.options)
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (((prevCol === null || prevCol === void 0 ? void 0 : prevCol.order) || (nextCol === null || nextCol === void 0 ? void 0 : nextCol.order)) && !isEqual(prevCol === null || prevCol === void 0 ? void 0 : prevCol.order, nextCol === null || nextCol === void 0 ? void 0 : nextCol.order)) {
|
|
94
|
+
// return isEqual(prevCol?.order, nextCol?.fixed)
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (next.className.indexOf('ant-table-selection-column') > -1) {
|
|
99
|
+
return isEqual((_h = (_g = prev.children) === null || _g === void 0 ? void 0 : _g[1]) === null || _h === void 0 ? void 0 : _h.props, (_k = (_j = next.children) === null || _j === void 0 ? void 0 : _j[1]) === null || _k === void 0 ? void 0 : _k.props);
|
|
77
100
|
}
|
|
78
101
|
/** 如果启用了快速复制功能,需要实时判断rowIndex与getLength */
|
|
79
102
|
|
|
80
103
|
|
|
81
|
-
if (((
|
|
104
|
+
if (((_l = prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) === null || _l === void 0 ? void 0 : _l.quickcopy) || ((_m = nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps) === null || _m === void 0 ? void 0 : _m.quickcopy)) {
|
|
82
105
|
var pickProps = ['record', 'colIndex', 'rowIndex', 'getLength'];
|
|
83
106
|
var p = pick(prev, pickProps);
|
|
84
107
|
var n = pick(next, pickProps);
|
|
85
108
|
return isEqual(p, n);
|
|
86
109
|
}
|
|
87
110
|
|
|
88
|
-
if (next.className.indexOf('ant-table-selection-column') > -1) {
|
|
89
|
-
return isEqual((_h = (_g = prev.children) === null || _g === void 0 ? void 0 : _g[1]) === null || _h === void 0 ? void 0 : _h.props, (_k = (_j = next.children) === null || _j === void 0 ? void 0 : _j[1]) === null || _k === void 0 ? void 0 : _k.props);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
111
|
return true;
|
|
93
112
|
}
|
|
94
113
|
export default {
|
package/es/LmFilter/LmFilter.js
CHANGED
|
@@ -21,9 +21,10 @@ var _FilterRoot = _interopRequireDefault(require("./wrapper/FilterRoot"));
|
|
|
21
21
|
|
|
22
22
|
var _localization = require("./localization");
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _components = _interopRequireDefault(require("./components"));
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _excluded = ["searchConfig", "localization"];
|
|
27
|
+
var LmFilter = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
27
28
|
var _ref$searchConfig = _ref.searchConfig,
|
|
28
29
|
searchConfig = _ref$searchConfig === void 0 ? {} : _ref$searchConfig,
|
|
29
30
|
_ref$localization = _ref.localization,
|
|
@@ -64,8 +65,7 @@ var LmFilter = function LmFilter(_ref, ref) {
|
|
|
64
65
|
return /*#__PURE__*/_react.default.createElement(_FilterRoot.default, (0, _extends2.default)({
|
|
65
66
|
ref: ref || defaultRef
|
|
66
67
|
}, defaultProps, resetProps));
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
var _default =
|
|
70
|
-
|
|
68
|
+
});
|
|
69
|
+
LmFilter.FilterControl = _components.default;
|
|
70
|
+
var _default = LmFilter;
|
|
71
71
|
exports.default = _default;
|
|
@@ -9,6 +9,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.default = void 0;
|
|
11
11
|
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
13
|
+
|
|
12
14
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
13
15
|
|
|
14
16
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
@@ -205,7 +207,8 @@ var DropdownFilter = /*#__PURE__*/_react.default.memo(function (_ref2) {
|
|
|
205
207
|
setVisible = _useState2[1];
|
|
206
208
|
|
|
207
209
|
var filterValue = instance.filterValue,
|
|
208
|
-
size = instance.size;
|
|
210
|
+
size = instance.size;
|
|
211
|
+
var popupClassName = item.popupClassName; // 触发查询时关闭下拉框
|
|
209
212
|
|
|
210
213
|
var setFilterValue = function setFilterValue(obj) {
|
|
211
214
|
instance.setFilterValue(obj);
|
|
@@ -239,7 +242,7 @@ var DropdownFilter = /*#__PURE__*/_react.default.memo(function (_ref2) {
|
|
|
239
242
|
instance: resetInstance,
|
|
240
243
|
item: item
|
|
241
244
|
}),
|
|
242
|
-
overlayClassName: "filter_dropdown_container_".concat(item.type),
|
|
245
|
+
overlayClassName: (0, _classnames.default)("filter_dropdown_container_".concat(item.type), (0, _defineProperty2.default)({}, popupClassName, popupClassName)),
|
|
243
246
|
onVisibleChange: function onVisibleChange(v) {
|
|
244
247
|
return setVisible(v);
|
|
245
248
|
} // 未开启则需手动控制下拉展示组件的初始化
|
package/es/LmFilter/index.js
CHANGED
|
@@ -9,8 +9,5 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _LmFilter = _interopRequireDefault(require("./LmFilter"));
|
|
11
11
|
|
|
12
|
-
var _components = _interopRequireDefault(require("./components"));
|
|
13
|
-
|
|
14
|
-
_LmFilter.default.FilterControl = _components.default;
|
|
15
12
|
var _default = _LmFilter.default;
|
|
16
13
|
exports.default = _default;
|
package/es/LmTable/Table.js
CHANGED
|
@@ -61,6 +61,8 @@ var _resetConfig = _interopRequireDefault(require("./resetConfig"));
|
|
|
61
61
|
|
|
62
62
|
var _virTual = require("./virTual");
|
|
63
63
|
|
|
64
|
+
var _useGroupDataSource3 = _interopRequireDefault(require("./hooks/useGroupDataSource"));
|
|
65
|
+
|
|
64
66
|
var _excluded = ["columns", "dataSource", "autoSize", "rowClick", "onDoubleClick", "checkConfig", "summary", "pagination", "hiddenPage", "loading", "virtual", "sortOpen", "colSortOpen", "resizeable", "customCheck", "components", "rowSelection", "columnsState", "onChange", "filterChange", "tableRowType", "size", "openSheet", "editSheet", "dataChange", "groupRowKeys", "groupColKeys", "emptyProps"],
|
|
65
67
|
_excluded2 = ["className", "style"],
|
|
66
68
|
_excluded3 = ["onResize", "width", "onResizeStop"];
|
|
@@ -197,15 +199,16 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
197
199
|
}, [customizeColumns]);
|
|
198
200
|
/** 行分组 */
|
|
199
201
|
|
|
200
|
-
var
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
202
|
+
var _useGroupDataSource = (0, _useGroupDataSource3.default)({
|
|
203
|
+
groupRowKeys: groupRowKeys,
|
|
204
|
+
customizeDataSource: customizeDataSource,
|
|
205
|
+
columnsRef: columnsRef
|
|
206
|
+
}),
|
|
207
|
+
_useGroupDataSource2 = (0, _slicedToArray2.default)(_useGroupDataSource, 1),
|
|
208
|
+
groupDataSource = _useGroupDataSource2[0];
|
|
207
209
|
/** 列分组 */
|
|
208
210
|
|
|
211
|
+
|
|
209
212
|
var _useMemo = (0, _react.useMemo)(function () {
|
|
210
213
|
if (!(groupColKeys === null || groupColKeys === void 0 ? void 0 : groupColKeys.length)) {
|
|
211
214
|
return {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function calcExpression(item: any, needCalcKeys: string[]): void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
// 分组求和计算
|
|
3
|
+
export default function calcExpression(item, needCalcKeys) {
|
|
4
|
+
var _a;
|
|
5
|
+
|
|
6
|
+
if ((_a = item === null || item === void 0 ? void 0 : item.children) === null || _a === void 0 ? void 0 : _a.length) {
|
|
7
|
+
needCalcKeys.forEach(function (dkey) {
|
|
8
|
+
var sum = 0;
|
|
9
|
+
|
|
10
|
+
var _dkey = _slicedToArray(dkey, 2),
|
|
11
|
+
key = _dkey[0],
|
|
12
|
+
expression = _dkey[1];
|
|
13
|
+
|
|
14
|
+
item.children.forEach(function (subItem) {
|
|
15
|
+
if (key in subItem) {
|
|
16
|
+
sum += Number(subItem[key]);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
if (!sum) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (expression === 'sum') {
|
|
25
|
+
item[key] = sum;
|
|
26
|
+
} else if (expression === 'average') {
|
|
27
|
+
item[key] = sum / item.children.length;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
|
|
12
|
+
var _util = require("../util");
|
|
13
|
+
|
|
14
|
+
var _expression = _interopRequireDefault(require("../expression"));
|
|
15
|
+
|
|
16
|
+
/** 行分组 */
|
|
17
|
+
function useGroupDataSource(_ref) {
|
|
18
|
+
var groupRowKeys = _ref.groupRowKeys,
|
|
19
|
+
customizeDataSource = _ref.customizeDataSource,
|
|
20
|
+
columnsRef = _ref.columnsRef;
|
|
21
|
+
var groupDataSource = (0, _react.useMemo)(function () {
|
|
22
|
+
if (!(groupRowKeys === null || groupRowKeys === void 0 ? void 0 : groupRowKeys.length)) {
|
|
23
|
+
return customizeDataSource;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var source = (0, _util.transformWithRowGroup)(customizeDataSource, groupRowKeys); // 获取需要计算的key,生成数组
|
|
27
|
+
|
|
28
|
+
var needCalcKeys = columnsRef.current.filter(function (col) {
|
|
29
|
+
return col.expression;
|
|
30
|
+
}).map(function (col) {
|
|
31
|
+
return [col.dataIndex, col.expression];
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
var deepChildren = function deepChildren(arr) {
|
|
35
|
+
arr === null || arr === void 0 ? void 0 : arr.forEach(function (item) {
|
|
36
|
+
if (item === null || item === void 0 ? void 0 : item.children) {
|
|
37
|
+
deepChildren(item === null || item === void 0 ? void 0 : item.children);
|
|
38
|
+
(0, _expression.default)(item, needCalcKeys);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
deepChildren(source);
|
|
44
|
+
return source;
|
|
45
|
+
}, [customizeDataSource, groupRowKeys]);
|
|
46
|
+
return [groupDataSource];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
var _default = useGroupDataSource;
|
|
50
|
+
exports.default = _default;
|
package/es/LmUpload/fns/index.js
CHANGED
|
@@ -49,16 +49,21 @@ var useCoreOptions = function useCoreOptions(_ref) {
|
|
|
49
49
|
fileAreaSize = props.fileAreaSize,
|
|
50
50
|
enabledOss = props.enabledOss,
|
|
51
51
|
enableCrop = props.enableCrop,
|
|
52
|
-
ossConfig = props.ossConfig;
|
|
52
|
+
ossConfig = props.ossConfig;
|
|
53
|
+
/* 获取两个对象是否存在指定值相等
|
|
54
|
+
* 取用户定义的列字段,如果读取不到则取'fileName'对比
|
|
55
|
+
*/
|
|
53
56
|
|
|
54
57
|
var getHasEqual = useCallback(function (obj1, obj2) {
|
|
55
58
|
var extend = [uid, 'fileName'];
|
|
56
59
|
var flag = false;
|
|
57
60
|
extend.forEach(function (v) {
|
|
58
|
-
if (!flag
|
|
61
|
+
if (!flag && obj1[v] && obj2[v]) {
|
|
62
|
+
flag = obj1[v] === obj2[v];
|
|
63
|
+
}
|
|
59
64
|
});
|
|
60
65
|
return flag;
|
|
61
|
-
}, []); // 从对象中读取存在的指定属性
|
|
66
|
+
}, [uid]); // 从对象中读取存在的指定属性
|
|
62
67
|
|
|
63
68
|
var getFileHasValue = useCallback(function (obj) {
|
|
64
69
|
var extend = [uid, 'fileName'];
|
package/es/Select/index.js
CHANGED
|
@@ -17,18 +17,25 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
17
17
|
import React, { forwardRef, useMemo } from 'react';
|
|
18
18
|
import classNames from 'classnames';
|
|
19
19
|
import SizeContext from '../ConfigProvider/SizeContext';
|
|
20
|
+
import DisabledContext from '../ConfigProvider/DisabledContext';
|
|
20
21
|
var prefixCls = 'lm_select';
|
|
21
22
|
var CLMSelect = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
22
23
|
var children = props.children,
|
|
23
24
|
className = props.className,
|
|
24
25
|
customizeSize = props.size,
|
|
26
|
+
customDisabled = props.disabled,
|
|
25
27
|
dropdownClassName = props.dropdownClassName,
|
|
26
28
|
options = props.options,
|
|
27
29
|
value = props.value,
|
|
28
30
|
defaultLabel = props.defaultLabel,
|
|
29
|
-
|
|
31
|
+
rest = __rest(props // ===================== Size =====================
|
|
32
|
+
, ["children", "className", "size", "disabled", "dropdownClassName", "options", "value", "defaultLabel"]); // ===================== Size =====================
|
|
30
33
|
|
|
31
|
-
|
|
34
|
+
|
|
35
|
+
var size = customizeSize || React.useContext(SizeContext) || 'middle'; // ===================== Disabled =====================
|
|
36
|
+
|
|
37
|
+
var disabled = React.useContext(DisabledContext);
|
|
38
|
+
var mergedDisabled = customDisabled || disabled; // 当前值是否存于选项中
|
|
32
39
|
|
|
33
40
|
var hasOption = useMemo(function () {
|
|
34
41
|
var flag = false;
|
|
@@ -47,24 +54,27 @@ var CLMSelect = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
47
54
|
|
|
48
55
|
if (options) {
|
|
49
56
|
flag = !!options.some(function (v) {
|
|
50
|
-
|
|
57
|
+
var _a, _b;
|
|
58
|
+
|
|
59
|
+
return v[(_b = (_a = props.fieldNames) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 'value'] === value;
|
|
51
60
|
});
|
|
52
61
|
}
|
|
53
62
|
|
|
54
63
|
return flag;
|
|
55
|
-
}, [children, value, options]); // 重组value: 传入value但找不到options项时,展示默认label
|
|
64
|
+
}, [children, value, options, props.fieldNames]); // 重组value: 传入value但找不到options项时,展示默认label
|
|
56
65
|
|
|
57
66
|
var resetValue = useMemo(function () {
|
|
58
67
|
if (value && !hasOption) return defaultLabel !== null && defaultLabel !== void 0 ? defaultLabel : value;
|
|
59
68
|
return value;
|
|
60
|
-
}, [value, hasOption]);
|
|
69
|
+
}, [value, defaultLabel, hasOption]);
|
|
61
70
|
return /*#__PURE__*/React.createElement(_Select, Object.assign({
|
|
62
71
|
className: classNames(className, prefixCls),
|
|
63
72
|
size: size,
|
|
64
73
|
ref: ref,
|
|
65
74
|
value: resetValue,
|
|
66
|
-
options: options
|
|
67
|
-
|
|
75
|
+
options: options,
|
|
76
|
+
disabled: mergedDisabled || undefined
|
|
77
|
+
}, rest, {
|
|
68
78
|
dropdownClassName: classNames('lm_select_dropdown', dropdownClassName)
|
|
69
79
|
}), children);
|
|
70
80
|
});
|
package/es/styles/variables.css
CHANGED
|
@@ -9001,6 +9001,9 @@ p {
|
|
|
9001
9001
|
.lm_container_wrapper .lm_container.responsive.lm_col_5 .ant-form-item-responsive.nth-five {
|
|
9002
9002
|
margin-right: 0;
|
|
9003
9003
|
}
|
|
9004
|
+
.lm_container_wrapper .lm_container.responsive .ant-cascader {
|
|
9005
|
+
width: 100%;
|
|
9006
|
+
}
|
|
9004
9007
|
.lm_form-item-tip-error .ant-form-item-explain {
|
|
9005
9008
|
width: 100%;
|
|
9006
9009
|
position: absolute;
|