linkmore-design 1.0.59 → 1.0.60
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/CardTable/fns/index.d.ts +1 -0
- package/dist/Form/demos/error-tip.d.ts +2 -0
- package/dist/Form/index.d.ts +7 -2
- package/dist/LmEditTable/demos/sinleEdit.d.ts +2 -0
- package/dist/index.umd.js +71 -24
- package/dist/index.umd.min.js +6 -6
- package/es/CardTable/body/TableBodyCell.js +10 -5
- package/es/CardTable/fns/index.js +29 -2
- package/es/CardTable/table/TableRoot.js +46 -13
- package/es/Dropdown/index.js +2 -2
- package/es/Dropdown/style/index.css +19 -1
- package/es/Form/index.d.ts +7 -2
- package/es/Form/index.js +18 -2
- package/es/Form/style/index.css +81 -0
- package/es/IconFont/index.js +1 -1
- package/es/LmEditTable/EditTable.js +47 -17
- package/es/LmFilter/LmFilter.js +1 -1
- package/lib/CardTable/body/TableBodyCell.js +10 -5
- package/lib/CardTable/fns/index.js +29 -2
- package/lib/CardTable/table/TableRoot.js +46 -13
- package/lib/Dropdown/index.js +2 -2
- package/lib/Dropdown/style/index.css +19 -1
- package/lib/Form/index.d.ts +7 -2
- package/lib/Form/index.js +16 -1
- package/lib/Form/style/index.css +81 -0
- package/lib/IconFont/index.js +1 -1
- package/lib/LmEditTable/EditTable.js +47 -17
- package/lib/LmFilter/LmFilter.js +1 -1
- package/package.json +1 -1
|
@@ -26,11 +26,11 @@ var LmCardTableBodyCell = function LmCardTableBodyCell(_ref) {
|
|
|
26
26
|
cell = _ref.cell,
|
|
27
27
|
table = _ref.table;
|
|
28
28
|
var state = table.state,
|
|
29
|
-
cellConfig = table.cellConfig,
|
|
30
29
|
type = table.type,
|
|
31
30
|
components = table.components,
|
|
32
31
|
cellKey = table.cellKey;
|
|
33
|
-
var checkKeys = state.checkboxConfig.checkKeys
|
|
32
|
+
var checkKeys = state.checkboxConfig.checkKeys,
|
|
33
|
+
radioConfig = state.radioConfig; // 渲染的单元格
|
|
34
34
|
|
|
35
35
|
var RenderCell = (0, _react.useMemo)(function () {
|
|
36
36
|
var types = {
|
|
@@ -43,16 +43,21 @@ var LmCardTableBodyCell = function LmCardTableBodyCell(_ref) {
|
|
|
43
43
|
return components.Cell || types[type] || _PictureTextColumn.default;
|
|
44
44
|
}, [components.Cell, type]); // 是否选中
|
|
45
45
|
|
|
46
|
-
var
|
|
46
|
+
var isCheckboxChecked = (0, _react.useMemo)(function () {
|
|
47
47
|
return checkKeys.some(function (v) {
|
|
48
48
|
return v === cell[cellKey];
|
|
49
49
|
});
|
|
50
50
|
}, [checkKeys, cellKey]);
|
|
51
|
+
var isRadioChecked = (0, _react.useMemo)(function () {
|
|
52
|
+
return radioConfig.checkKey === cell[cellKey];
|
|
53
|
+
}, [cellKey, radioConfig.checkKey]);
|
|
51
54
|
var stateConfig = {
|
|
52
|
-
checked:
|
|
55
|
+
checked: isCheckboxChecked
|
|
53
56
|
};
|
|
54
57
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
55
|
-
className: (0, _classnames.default)('lm_card_table_body_cell',
|
|
58
|
+
className: (0, _classnames.default)('lm_card_table_body_cell', {
|
|
59
|
+
'cell_checked': isCheckboxChecked || isRadioChecked
|
|
60
|
+
})
|
|
56
61
|
}, /*#__PURE__*/_react.default.createElement(RenderCell, (0, _extends2.default)({
|
|
57
62
|
index: index,
|
|
58
63
|
cell: cell,
|
|
@@ -17,7 +17,8 @@ var CoreOptions = function CoreOptions(_ref) {
|
|
|
17
17
|
var checkboxConfig = state.checkboxConfig;
|
|
18
18
|
var dataSource = props.dataSource,
|
|
19
19
|
cellKey = props.cellKey,
|
|
20
|
-
checkboxChange = props.checkboxChange
|
|
20
|
+
checkboxChange = props.checkboxChange,
|
|
21
|
+
selectionConfig = props.selectionConfig;
|
|
21
22
|
var checkKeys = checkboxConfig.checkKeys,
|
|
22
23
|
checkValues = checkboxConfig.checkValues,
|
|
23
24
|
checkMethod = checkboxConfig.checkMethod; // 设置选中的值: 第一个参数是数据的键,第二个参数是选中与否, 第三个参数控制是否重置
|
|
@@ -63,6 +64,13 @@ var CoreOptions = function CoreOptions(_ref) {
|
|
|
63
64
|
checkValues: nValues
|
|
64
65
|
}
|
|
65
66
|
});
|
|
67
|
+
dispatch({
|
|
68
|
+
type: 'changeRadioConfig',
|
|
69
|
+
radioConfig: {
|
|
70
|
+
checkKey: '',
|
|
71
|
+
checkValue: ''
|
|
72
|
+
}
|
|
73
|
+
});
|
|
66
74
|
}; // 切换选中状态: 单个切换/批量切换
|
|
67
75
|
|
|
68
76
|
|
|
@@ -126,9 +134,28 @@ var CoreOptions = function CoreOptions(_ref) {
|
|
|
126
134
|
setCheckboxKeys(nKeys, isCheck, reset);
|
|
127
135
|
};
|
|
128
136
|
|
|
137
|
+
var cellClick = function cellClick(cell, index) {
|
|
138
|
+
var _props$cellClick;
|
|
139
|
+
|
|
140
|
+
if (!checkKeys.length) {
|
|
141
|
+
// 校验是否存在单选
|
|
142
|
+
var isRadio = Array.isArray(selectionConfig.type) ? selectionConfig.type.includes('radio') : selectionConfig.type === 'radio';
|
|
143
|
+
isRadio && dispatch({
|
|
144
|
+
type: 'changeRadioConfig',
|
|
145
|
+
radioConfig: {
|
|
146
|
+
checkKey: cell[cellKey],
|
|
147
|
+
checkValue: cell
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
(_props$cellClick = props.cellClick) === null || _props$cellClick === void 0 ? void 0 : _props$cellClick.call(props, cell, index);
|
|
153
|
+
};
|
|
154
|
+
|
|
129
155
|
return {
|
|
130
156
|
setCheckboxKeys: setCheckboxKeys,
|
|
131
|
-
toggleCheckboxKey: toggleCheckboxKey
|
|
157
|
+
toggleCheckboxKey: toggleCheckboxKey,
|
|
158
|
+
cellClick: cellClick
|
|
132
159
|
};
|
|
133
160
|
};
|
|
134
161
|
|
|
@@ -22,14 +22,16 @@ var _TableWrapper = _interopRequireDefault(require("./TableWrapper"));
|
|
|
22
22
|
var _fns = _interopRequireDefault(require("../fns"));
|
|
23
23
|
|
|
24
24
|
var _excluded = ["checkKeys", "trigger", "checkMethod"],
|
|
25
|
-
_excluded2 = ["
|
|
25
|
+
_excluded2 = ["checkKey", "trigger"],
|
|
26
|
+
_excluded3 = ["rowConfig", "cellConfig", "defaultConfig", "checkboxConfig", "radioConfig", "selectionConfig", "pagerConfig", "toolbarConfig"];
|
|
26
27
|
|
|
27
28
|
var reducer = function reducer(state, action) {
|
|
28
29
|
var page = action.page,
|
|
29
30
|
resize = action.resize,
|
|
30
31
|
columnCount = action.columnCount,
|
|
31
32
|
rows = action.rows,
|
|
32
|
-
checkboxConfig = action.checkboxConfig
|
|
33
|
+
checkboxConfig = action.checkboxConfig,
|
|
34
|
+
radioConfig = action.radioConfig;
|
|
33
35
|
|
|
34
36
|
switch (action.type) {
|
|
35
37
|
case 'changePage':
|
|
@@ -59,6 +61,12 @@ var reducer = function reducer(state, action) {
|
|
|
59
61
|
checkboxConfig: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state.checkboxConfig), checkboxConfig)
|
|
60
62
|
});
|
|
61
63
|
|
|
64
|
+
case 'changeRadioConfig':
|
|
65
|
+
// 单选中的Key
|
|
66
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
|
|
67
|
+
radioConfig: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state.radioConfig), radioConfig)
|
|
68
|
+
});
|
|
69
|
+
|
|
62
70
|
default:
|
|
63
71
|
throw new Error();
|
|
64
72
|
}
|
|
@@ -67,27 +75,43 @@ var reducer = function reducer(state, action) {
|
|
|
67
75
|
|
|
68
76
|
var getInitialState = function getInitialState(props) {
|
|
69
77
|
var _props$checkboxConfig = props.checkboxConfig,
|
|
70
|
-
_props$
|
|
71
|
-
|
|
72
|
-
_props$
|
|
73
|
-
trigger = _props$checkboxConfig3 === void 0 ? 'default' : _props$checkboxConfig3,
|
|
74
|
-
_props$checkboxConfig4 = _props$checkboxConfig.checkMethod,
|
|
75
|
-
checkMethod = _props$checkboxConfig4 === void 0 ? true : _props$checkboxConfig4,
|
|
76
|
-
resetCheckCOnfig = (0, _objectWithoutProperties2.default)(_props$checkboxConfig, _excluded),
|
|
78
|
+
checkboxConfig = _props$checkboxConfig === void 0 ? {} : _props$checkboxConfig,
|
|
79
|
+
_props$radioConfig = props.radioConfig,
|
|
80
|
+
radioConfig = _props$radioConfig === void 0 ? {} : _props$radioConfig,
|
|
77
81
|
_props$dataSource = props.dataSource,
|
|
78
82
|
dataSource = _props$dataSource === void 0 ? [] : _props$dataSource,
|
|
79
83
|
cellKey = props.cellKey;
|
|
84
|
+
var _checkboxConfig$check = checkboxConfig.checkKeys,
|
|
85
|
+
checkKeys = _checkboxConfig$check === void 0 ? [] : _checkboxConfig$check,
|
|
86
|
+
_checkboxConfig$trigg = checkboxConfig.trigger,
|
|
87
|
+
checkboxTrigger = _checkboxConfig$trigg === void 0 ? 'default' : _checkboxConfig$trigg,
|
|
88
|
+
_checkboxConfig$check2 = checkboxConfig.checkMethod,
|
|
89
|
+
checkMethod = _checkboxConfig$check2 === void 0 ? true : _checkboxConfig$check2,
|
|
90
|
+
resetCheckCOnfig = (0, _objectWithoutProperties2.default)(checkboxConfig, _excluded);
|
|
91
|
+
var _radioConfig$checkKey = radioConfig.checkKey,
|
|
92
|
+
checkKey = _radioConfig$checkKey === void 0 ? '' : _radioConfig$checkKey,
|
|
93
|
+
_radioConfig$trigger = radioConfig.trigger,
|
|
94
|
+
radioTrigger = _radioConfig$trigger === void 0 ? 'default' : _radioConfig$trigger,
|
|
95
|
+
resetRadioConfig = (0, _objectWithoutProperties2.default)(radioConfig, _excluded2);
|
|
80
96
|
var checkValues = dataSource.filter(function (v) {
|
|
81
97
|
return checkKeys.includes(v[cellKey]);
|
|
82
98
|
}) || [];
|
|
99
|
+
var checkValue = dataSource.find(function (v) {
|
|
100
|
+
return checkKey === v[cellKey];
|
|
101
|
+
});
|
|
83
102
|
return {
|
|
84
103
|
// 复选框的配置
|
|
85
104
|
checkboxConfig: (0, _objectSpread2.default)({
|
|
86
105
|
checkKeys: checkKeys,
|
|
87
106
|
checkValues: checkValues,
|
|
88
|
-
trigger:
|
|
107
|
+
trigger: checkboxTrigger,
|
|
89
108
|
checkMethod: checkMethod
|
|
90
109
|
}, resetCheckCOnfig),
|
|
110
|
+
radioConfig: (0, _objectSpread2.default)({
|
|
111
|
+
checkKey: checkKey,
|
|
112
|
+
checkValue: checkValue,
|
|
113
|
+
trigger: radioTrigger
|
|
114
|
+
}, resetRadioConfig),
|
|
91
115
|
// 分页的配置
|
|
92
116
|
page: {
|
|
93
117
|
pageIndex: 1,
|
|
@@ -127,9 +151,11 @@ var LmCardTableRoot = function LmCardTableRoot(props, ref) {
|
|
|
127
151
|
cellConfig = props.cellConfig,
|
|
128
152
|
defaultConfig = props.defaultConfig,
|
|
129
153
|
checkboxConfig = props.checkboxConfig,
|
|
154
|
+
radioConfig = props.radioConfig,
|
|
155
|
+
selectionConfig = props.selectionConfig,
|
|
130
156
|
pagerConfig = props.pagerConfig,
|
|
131
157
|
toolbarConfig = props.toolbarConfig,
|
|
132
|
-
resetProps = (0, _objectWithoutProperties2.default)(props,
|
|
158
|
+
resetProps = (0, _objectWithoutProperties2.default)(props, _excluded3);
|
|
133
159
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, resetProps), {}, {
|
|
134
160
|
rowConfig: (0, _objectSpread2.default)({
|
|
135
161
|
// 行配置
|
|
@@ -140,6 +166,10 @@ var LmCardTableRoot = function LmCardTableRoot(props, ref) {
|
|
|
140
166
|
width: 192,
|
|
141
167
|
height: 282
|
|
142
168
|
}, cellConfig),
|
|
169
|
+
selectionConfig: (0, _objectSpread2.default)({
|
|
170
|
+
type: ['checkbox', 'radio']
|
|
171
|
+
}, selectionConfig),
|
|
172
|
+
radioConfig: (0, _objectSpread2.default)({}, radioConfig),
|
|
143
173
|
checkboxConfig: (0, _objectSpread2.default)({}, checkboxConfig),
|
|
144
174
|
pagerConfig: (0, _objectSpread2.default)({}, pagerConfig),
|
|
145
175
|
toolbarConfig: (0, _objectSpread2.default)({}, toolbarConfig),
|
|
@@ -151,9 +181,9 @@ var LmCardTableRoot = function LmCardTableRoot(props, ref) {
|
|
|
151
181
|
return (0, _fns.default)({
|
|
152
182
|
state: state,
|
|
153
183
|
dispatch: dispatch,
|
|
154
|
-
props:
|
|
184
|
+
props: configProps
|
|
155
185
|
});
|
|
156
|
-
}, [state, dispatch,
|
|
186
|
+
}, [state, dispatch, configProps]);
|
|
157
187
|
var table = (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, configProps), eventProps), {}, {
|
|
158
188
|
state: state,
|
|
159
189
|
dispatch: dispatch
|
|
@@ -163,6 +193,9 @@ var LmCardTableRoot = function LmCardTableRoot(props, ref) {
|
|
|
163
193
|
return (0, _objectSpread2.default)({
|
|
164
194
|
getCheckboxRecords: function getCheckboxRecords() {
|
|
165
195
|
return state.checkboxConfig.checkValues;
|
|
196
|
+
},
|
|
197
|
+
getRadioRecord: function getRadioRecord() {
|
|
198
|
+
return state.radioConfig.checkValue;
|
|
166
199
|
}
|
|
167
200
|
}, eventProps);
|
|
168
201
|
});
|
package/es/Dropdown/index.js
CHANGED
|
@@ -108,7 +108,7 @@ LMDropdown.Button = function (props) {
|
|
|
108
108
|
type: 'lmweb-down'
|
|
109
109
|
}),
|
|
110
110
|
overlayClassName: classNames(props.overlayClassName, 'lm_dropdown_overlay'),
|
|
111
|
-
className: classNames(props.className, 'lm_dropdown_button', props.disabled ? 'disabled' : '')
|
|
111
|
+
className: classNames(props.className, 'lm_dropdown_button', props.disabled ? 'disabled' : '', props.type)
|
|
112
112
|
}));
|
|
113
113
|
}
|
|
114
114
|
|
|
@@ -124,7 +124,7 @@ LMDropdown.Button = function (props) {
|
|
|
124
124
|
overlayStyle: minwidth ? Object.assign({
|
|
125
125
|
minWidth: minwidth
|
|
126
126
|
}, props.overlayStyle) : Object.assign({}, props.overlayStyle),
|
|
127
|
-
className: classNames(props.className, 'lm_dropdown_button', props.disabled ? 'disabled' : '')
|
|
127
|
+
className: classNames(props.className, 'lm_dropdown_button', props.disabled ? 'disabled' : '', props.type)
|
|
128
128
|
})));
|
|
129
129
|
};
|
|
130
130
|
|
|
@@ -528,10 +528,13 @@ html {
|
|
|
528
528
|
background-color: var(--disabled-bg-color);
|
|
529
529
|
}
|
|
530
530
|
.lm_dropdown_button {
|
|
531
|
-
border-radius:
|
|
531
|
+
border-radius: 4px;
|
|
532
532
|
border: 1px solid var(--color-15);
|
|
533
533
|
box-sizing: content-box;
|
|
534
534
|
}
|
|
535
|
+
.lm_dropdown_button.primary {
|
|
536
|
+
border: 1px solid var(--primary-color);
|
|
537
|
+
}
|
|
535
538
|
.lm_dropdown_button .ant-btn {
|
|
536
539
|
height: 30px;
|
|
537
540
|
border-top: 0px;
|
|
@@ -557,13 +560,28 @@ html {
|
|
|
557
560
|
.lm_dropdown_button .ant-btn .lm_default_icon {
|
|
558
561
|
color: var(--text-color);
|
|
559
562
|
}
|
|
563
|
+
.lm_dropdown_button .ant-btn-primary .anticon {
|
|
564
|
+
color: var(--color-contrast);
|
|
565
|
+
}
|
|
560
566
|
.lm_dropdown_button:hover {
|
|
561
567
|
color: var(--primary-hover-color) !important;
|
|
562
568
|
border: 1px solid var(--primary-hover-color);
|
|
569
|
+
border-radius: 4px;
|
|
563
570
|
}
|
|
564
571
|
.lm_dropdown_button:hover .ant-btn {
|
|
565
572
|
color: var(--primary-hover-color) !important;
|
|
566
573
|
}
|
|
574
|
+
.lm_dropdown_button:hover .anticon {
|
|
575
|
+
color: var(--primary-hover-color);
|
|
576
|
+
}
|
|
577
|
+
.lm_dropdown_button:hover .ant-btn-primary {
|
|
578
|
+
background-color: var(--primary-hover-color);
|
|
579
|
+
color: var(--color-contrast) !important;
|
|
580
|
+
position: relative;
|
|
581
|
+
}
|
|
582
|
+
.lm_dropdown_button:hover .ant-btn-primary .anticon {
|
|
583
|
+
color: var(--color-contrast);
|
|
584
|
+
}
|
|
567
585
|
.lm_dropdown_button.disabled {
|
|
568
586
|
color: var(--disabled-font-color) !important;
|
|
569
587
|
border: 1px solid var(--disabled-border-color);
|
package/es/Form/index.d.ts
CHANGED
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Form as AntdForm, FormInstance, FormProps, List } from 'antd';
|
|
2
|
+
import { Form as AntdForm, FormInstance, FormProps, List, FormItemProps } from 'antd';
|
|
3
3
|
import useFormInstance from 'antd/lib/form/hooks/useFormInstance';
|
|
4
4
|
import { FormProvider } from 'antd/lib/form/context';
|
|
5
5
|
import { useForm, useWatch } from 'antd/lib/form/Form';
|
|
6
6
|
export interface LmFormProps extends FormProps {
|
|
7
7
|
responsive?: Boolean;
|
|
8
8
|
}
|
|
9
|
+
export interface LmFormItemProps extends FormItemProps {
|
|
10
|
+
useStatus: any;
|
|
11
|
+
errorPlacement?: string;
|
|
12
|
+
}
|
|
9
13
|
declare const Reform: <Values = any>(props: FormProps<Values> & {
|
|
10
14
|
children?: React.ReactNode;
|
|
11
15
|
} & {
|
|
12
16
|
ref?: React.Ref<FormInstance<Values>>;
|
|
13
17
|
}) => React.ReactElement;
|
|
18
|
+
declare const LMFormItem: (props: LmFormItemProps) => JSX.Element;
|
|
14
19
|
declare type InternalFormType = typeof Reform;
|
|
15
20
|
interface FormInterface extends InternalFormType {
|
|
16
21
|
useForm: typeof useForm;
|
|
17
22
|
useFormInstance: typeof useFormInstance;
|
|
18
23
|
useWatch: typeof useWatch;
|
|
19
|
-
Item: typeof
|
|
24
|
+
Item: typeof LMFormItem;
|
|
20
25
|
List: typeof List;
|
|
21
26
|
ErrorList: typeof AntdForm.ErrorList;
|
|
22
27
|
Provider: typeof FormProvider;
|
package/es/Form/index.js
CHANGED
|
@@ -21,7 +21,8 @@ import classnames from 'classnames';
|
|
|
21
21
|
import useFormInstance from 'antd/lib/form/hooks/useFormInstance';
|
|
22
22
|
import { FormProvider } from 'antd/lib/form/context';
|
|
23
23
|
import { useForm, useWatch } from 'antd/lib/form/Form';
|
|
24
|
-
import Container from './container';
|
|
24
|
+
import Container from './container'; // import useFormItemStatus from 'antd/lib/form/hooks/useFormItemStatus';
|
|
25
|
+
|
|
25
26
|
var classNamePrefix = 'lm_form';
|
|
26
27
|
|
|
27
28
|
var LMForm = function LMForm(props, ref) {
|
|
@@ -48,8 +49,23 @@ var LMForm = function LMForm(props, ref) {
|
|
|
48
49
|
};
|
|
49
50
|
|
|
50
51
|
var Reform = /*#__PURE__*/React.forwardRef(LMForm);
|
|
52
|
+
|
|
53
|
+
var LMFormItem = function LMFormItem(props) {
|
|
54
|
+
var children = props.children,
|
|
55
|
+
className = props.className,
|
|
56
|
+
_props$errorPlacement = props.errorPlacement,
|
|
57
|
+
errorPlacement = _props$errorPlacement === void 0 ? 'default' : _props$errorPlacement,
|
|
58
|
+
restProps = __rest(props, ["children", "className", "errorPlacement"]);
|
|
59
|
+
|
|
60
|
+
var tipClassName = errorPlacement === 'default' ? '' : "lm_form-item-tip-error lm_form-item-tip-error-".concat(errorPlacement);
|
|
61
|
+
var classes = classnames(className, tipClassName);
|
|
62
|
+
return /*#__PURE__*/React.createElement(_Form.Item, Object.assign({
|
|
63
|
+
className: classes
|
|
64
|
+
}, restProps), children);
|
|
65
|
+
};
|
|
66
|
+
|
|
51
67
|
var Form = Reform;
|
|
52
|
-
Form.Item =
|
|
68
|
+
Form.Item = LMFormItem;
|
|
53
69
|
Form.List = _List;
|
|
54
70
|
Form.ErrorList = _Form.ErrorList;
|
|
55
71
|
Form.useForm = useForm;
|
package/es/Form/style/index.css
CHANGED
|
@@ -564,3 +564,84 @@ html {
|
|
|
564
564
|
.lm_container_wrapper .lm_container.responsive.lm_col_5 .ant-form-item:nth-of-type(5n) {
|
|
565
565
|
margin-right: 0;
|
|
566
566
|
}
|
|
567
|
+
.lm_form .lm_form-item-tip-error .ant-form-item-explain {
|
|
568
|
+
position: absolute;
|
|
569
|
+
display: flex;
|
|
570
|
+
top: 0;
|
|
571
|
+
left: 100%;
|
|
572
|
+
z-index: 100;
|
|
573
|
+
color: #FA4F53;
|
|
574
|
+
pointer-events: none;
|
|
575
|
+
}
|
|
576
|
+
.lm_form .lm_form-item-tip-error .ant-form-item-explain::before {
|
|
577
|
+
content: ' ';
|
|
578
|
+
position: absolute;
|
|
579
|
+
z-index: 10;
|
|
580
|
+
display: inline-block;
|
|
581
|
+
height: 0;
|
|
582
|
+
width: 0;
|
|
583
|
+
background-color: #fff;
|
|
584
|
+
transform: rotate(45deg);
|
|
585
|
+
border-width: 4px;
|
|
586
|
+
border-style: solid;
|
|
587
|
+
}
|
|
588
|
+
.lm_form .lm_form-item-tip-error .ant-form-item-explain .ant-form-item-explain-error {
|
|
589
|
+
line-height: 20px;
|
|
590
|
+
font-size: 12px;
|
|
591
|
+
background-color: #fff;
|
|
592
|
+
padding: 6px 8px;
|
|
593
|
+
box-shadow: 0 0 6px 2px #e3e3e3;
|
|
594
|
+
border-radius: 2px;
|
|
595
|
+
}
|
|
596
|
+
.lm_form .lm_form-item-tip-error-right .ant-form-item-explain::before {
|
|
597
|
+
box-shadow: -1px 1px 1px 0px #f0f0f0;
|
|
598
|
+
border-color: transparent transparent #fff #fff;
|
|
599
|
+
margin-left: 3px;
|
|
600
|
+
margin-top: 12px;
|
|
601
|
+
}
|
|
602
|
+
.lm_form .lm_form-item-tip-error-right .ant-form-item-explain .ant-form-item-explain-error {
|
|
603
|
+
margin-left: 7px;
|
|
604
|
+
}
|
|
605
|
+
.lm_form .lm_form-item-tip-error-left .ant-form-item-explain {
|
|
606
|
+
left: -100%;
|
|
607
|
+
justify-content: flex-end;
|
|
608
|
+
padding-right: 7px;
|
|
609
|
+
}
|
|
610
|
+
.lm_form .lm_form-item-tip-error-left .ant-form-item-explain::before {
|
|
611
|
+
box-shadow: 1px -1px 1px 0px #f0f0f0;
|
|
612
|
+
border-color: #fff #fff transparent transparent;
|
|
613
|
+
margin-left: -11px;
|
|
614
|
+
margin-top: 12px;
|
|
615
|
+
left: 100%;
|
|
616
|
+
}
|
|
617
|
+
.lm_form .lm_form-item-tip-error-left .ant-form-item-explain .ant-form-item-explain-error {
|
|
618
|
+
margin-left: -4px;
|
|
619
|
+
}
|
|
620
|
+
.lm_form .lm_form-item-tip-error-top .ant-form-item-explain {
|
|
621
|
+
top: -39px;
|
|
622
|
+
left: 0;
|
|
623
|
+
justify-content: center;
|
|
624
|
+
}
|
|
625
|
+
.lm_form .lm_form-item-tip-error-top .ant-form-item-explain::before {
|
|
626
|
+
box-shadow: 1px 1px 1px 0px #f0f0f0;
|
|
627
|
+
border-color: transparent #fff #fff transparent;
|
|
628
|
+
background-color: #fff;
|
|
629
|
+
margin-top: 28px;
|
|
630
|
+
}
|
|
631
|
+
.lm_form .lm_form-item-tip-error-top .ant-form-item-explain .ant-form-item-explain-error {
|
|
632
|
+
margin-left: -4px;
|
|
633
|
+
}
|
|
634
|
+
.lm_form .lm_form-item-tip-error-bottom .ant-form-item-explain {
|
|
635
|
+
top: 39px;
|
|
636
|
+
left: 0;
|
|
637
|
+
justify-content: center;
|
|
638
|
+
}
|
|
639
|
+
.lm_form .lm_form-item-tip-error-bottom .ant-form-item-explain::before {
|
|
640
|
+
box-shadow: -1px -1px 1px 0px #f0f0f0;
|
|
641
|
+
border-color: #fff transparent transparent #fff;
|
|
642
|
+
background-color: #fff;
|
|
643
|
+
margin-top: -4px;
|
|
644
|
+
}
|
|
645
|
+
.lm_form .lm_form-item-tip-error-bottom .ant-form-item-explain .ant-form-item-explain-error {
|
|
646
|
+
margin-left: -4px;
|
|
647
|
+
}
|
package/es/IconFont/index.js
CHANGED
|
@@ -8,7 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
var _icons = require("@ant-design/icons");
|
|
9
9
|
|
|
10
10
|
var IconFont = (0, _icons.createFromIconfontCN)({
|
|
11
|
-
scriptUrl: '//at.alicdn.com/t/c/
|
|
11
|
+
scriptUrl: '//at.alicdn.com/t/c/font_2966019_totaqlvhjak.js' // 在 iconfont.cn 上生成
|
|
12
12
|
// scriptUrl: require('./font/iconfont.js'),
|
|
13
13
|
|
|
14
14
|
});
|
|
@@ -238,10 +238,11 @@ var EditableCell = function EditableCell(props) {
|
|
|
238
238
|
handleSave = props.handleSave,
|
|
239
239
|
handleAdd = props.handleAdd,
|
|
240
240
|
handleDelete = props.handleDelete,
|
|
241
|
+
handleCopy = props.handleCopy,
|
|
241
242
|
itemProps = props.itemProps,
|
|
242
243
|
setValid = props.setValid,
|
|
243
244
|
reWriteOriginSource = props.reWriteOriginSource,
|
|
244
|
-
restProps = __rest(props, ["record", "rowKey", "isEdit", "col", "handleTableRowDelete", "handleTableRowAdd", "getLength", "isHoverEdit", "editEnum", "valueType", "children", "handleSave", "handleAdd", "handleDelete", "itemProps", "setValid", "reWriteOriginSource"]);
|
|
245
|
+
restProps = __rest(props, ["record", "rowKey", "isEdit", "col", "handleTableRowDelete", "handleTableRowAdd", "getLength", "isHoverEdit", "editEnum", "valueType", "children", "handleSave", "handleAdd", "handleDelete", "handleCopy", "itemProps", "setValid", "reWriteOriginSource"]);
|
|
245
246
|
/** 去除移入移出功能,保留最纯粹的功能,优化性能 */
|
|
246
247
|
|
|
247
248
|
|
|
@@ -265,44 +266,45 @@ var EditableCell = function EditableCell(props) {
|
|
|
265
266
|
while (1) {
|
|
266
267
|
switch (_context.prev = _context.next) {
|
|
267
268
|
case 0:
|
|
268
|
-
|
|
269
|
-
_context.prev = 1;
|
|
269
|
+
_context.prev = 0;
|
|
270
270
|
_context.t0 = row;
|
|
271
271
|
|
|
272
272
|
if (_context.t0) {
|
|
273
|
-
_context.next =
|
|
273
|
+
_context.next = 6;
|
|
274
274
|
break;
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
-
_context.next =
|
|
277
|
+
_context.next = 5;
|
|
278
278
|
return form.getFieldsValue();
|
|
279
279
|
|
|
280
|
-
case
|
|
280
|
+
case 5:
|
|
281
281
|
_context.t0 = _context.sent;
|
|
282
282
|
|
|
283
|
-
case
|
|
283
|
+
case 6:
|
|
284
284
|
values = _context.t0;
|
|
285
|
-
console.log(Object.assign(Object.assign({
|
|
285
|
+
console.log(Object.assign(Object.assign({
|
|
286
|
+
record: record
|
|
287
|
+
}, values), _defineProperty({}, rowKey, record === null || record === void 0 ? void 0 : record[rowKey])), 'vvvv');
|
|
286
288
|
console.time('testForEach');
|
|
287
|
-
handleSave(Object.assign(Object.assign({}, values), _defineProperty({}, rowKey, record === null || record === void 0 ? void 0 : record[rowKey])));
|
|
289
|
+
handleSave(Object.assign(Object.assign(Object.assign({}, record), values), _defineProperty({}, rowKey, record === null || record === void 0 ? void 0 : record[rowKey])));
|
|
288
290
|
console.timeEnd('testForEach');
|
|
289
|
-
_context.next =
|
|
291
|
+
_context.next = 13;
|
|
290
292
|
return form.validateFields();
|
|
291
293
|
|
|
292
|
-
case
|
|
293
|
-
_context.next =
|
|
294
|
+
case 13:
|
|
295
|
+
_context.next = 17;
|
|
294
296
|
break;
|
|
295
297
|
|
|
296
|
-
case
|
|
297
|
-
_context.prev =
|
|
298
|
-
_context.t1 = _context["catch"](
|
|
298
|
+
case 15:
|
|
299
|
+
_context.prev = 15;
|
|
300
|
+
_context.t1 = _context["catch"](0);
|
|
299
301
|
|
|
300
|
-
case
|
|
302
|
+
case 17:
|
|
301
303
|
case "end":
|
|
302
304
|
return _context.stop();
|
|
303
305
|
}
|
|
304
306
|
}
|
|
305
|
-
}, _callee, null, [[
|
|
307
|
+
}, _callee, null, [[0, 15]]);
|
|
306
308
|
}));
|
|
307
309
|
}; // 触发保存
|
|
308
310
|
|
|
@@ -310,6 +312,15 @@ var EditableCell = function EditableCell(props) {
|
|
|
310
312
|
var handleFormItemChange = function handleFormItemChange(e) {
|
|
311
313
|
save === null || save === void 0 ? void 0 : save();
|
|
312
314
|
};
|
|
315
|
+
/** 快捷刷子,把当前的所有列的值,刷成当前的选中的列 */
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
var copyKey = function copyKey(e) {
|
|
319
|
+
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
320
|
+
console.log(rowKey, record[rowKey], 'fff');
|
|
321
|
+
var dataIndex = col.dataIndex;
|
|
322
|
+
handleCopy === null || handleCopy === void 0 ? void 0 : handleCopy(dataIndex, record[dataIndex]);
|
|
323
|
+
};
|
|
313
324
|
|
|
314
325
|
var Control = function Control(con) {
|
|
315
326
|
switch (con) {
|
|
@@ -331,6 +342,10 @@ var EditableCell = function EditableCell(props) {
|
|
|
331
342
|
noStyle: true
|
|
332
343
|
}, /*#__PURE__*/React.cloneElement(componentProps.addonAfter, {
|
|
333
344
|
onChange: handleFormItemChange
|
|
345
|
+
})) : null,
|
|
346
|
+
suffix: componentProps.quickcopy ? /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(IconFont, {
|
|
347
|
+
onClick: copyKey,
|
|
348
|
+
type: 'lmweb-icon_m_brush'
|
|
334
349
|
})) : null
|
|
335
350
|
}));
|
|
336
351
|
|
|
@@ -714,6 +729,20 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
714
729
|
}
|
|
715
730
|
};
|
|
716
731
|
|
|
732
|
+
var handleCopy = function handleCopy(key, value) {
|
|
733
|
+
var res = produce(dataSourceRef.current, function (draft) {
|
|
734
|
+
draft.forEach(function (item) {
|
|
735
|
+
return item[key] = value;
|
|
736
|
+
});
|
|
737
|
+
});
|
|
738
|
+
|
|
739
|
+
if (onChange) {
|
|
740
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(res);
|
|
741
|
+
} else {
|
|
742
|
+
setDataSource(res);
|
|
743
|
+
}
|
|
744
|
+
};
|
|
745
|
+
|
|
717
746
|
var resultColumns = useMemo(function () {
|
|
718
747
|
var localColumns = [sortOpen ? {
|
|
719
748
|
title: '',
|
|
@@ -787,6 +816,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
787
816
|
isHoverEdit: isHoverEdit,
|
|
788
817
|
handleAdd: handleAdd,
|
|
789
818
|
handleDelete: handleDelete,
|
|
819
|
+
handleCopy: handleCopy,
|
|
790
820
|
editEnum: typeof col.editEnum === 'function' ? col.editEnum(record) : col.editEnum,
|
|
791
821
|
valueType: typeof col.valueType === 'function' ? col.valueType(record) : col.valueType,
|
|
792
822
|
handleSave: handleSave,
|
package/es/LmFilter/LmFilter.js
CHANGED
|
@@ -19,7 +19,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
19
19
|
|
|
20
20
|
var _FilterRoot = _interopRequireDefault(require("./wrapper/FilterRoot"));
|
|
21
21
|
|
|
22
|
-
var _localization = require("./localization
|
|
22
|
+
var _localization = require("./localization");
|
|
23
23
|
|
|
24
24
|
var _excluded = ["localization"];
|
|
25
25
|
|
|
@@ -26,11 +26,11 @@ var LmCardTableBodyCell = function LmCardTableBodyCell(_ref) {
|
|
|
26
26
|
cell = _ref.cell,
|
|
27
27
|
table = _ref.table;
|
|
28
28
|
var state = table.state,
|
|
29
|
-
cellConfig = table.cellConfig,
|
|
30
29
|
type = table.type,
|
|
31
30
|
components = table.components,
|
|
32
31
|
cellKey = table.cellKey;
|
|
33
|
-
var checkKeys = state.checkboxConfig.checkKeys
|
|
32
|
+
var checkKeys = state.checkboxConfig.checkKeys,
|
|
33
|
+
radioConfig = state.radioConfig; // 渲染的单元格
|
|
34
34
|
|
|
35
35
|
var RenderCell = (0, _react.useMemo)(function () {
|
|
36
36
|
var types = {
|
|
@@ -43,16 +43,21 @@ var LmCardTableBodyCell = function LmCardTableBodyCell(_ref) {
|
|
|
43
43
|
return components.Cell || types[type] || _PictureTextColumn.default;
|
|
44
44
|
}, [components.Cell, type]); // 是否选中
|
|
45
45
|
|
|
46
|
-
var
|
|
46
|
+
var isCheckboxChecked = (0, _react.useMemo)(function () {
|
|
47
47
|
return checkKeys.some(function (v) {
|
|
48
48
|
return v === cell[cellKey];
|
|
49
49
|
});
|
|
50
50
|
}, [checkKeys, cellKey]);
|
|
51
|
+
var isRadioChecked = (0, _react.useMemo)(function () {
|
|
52
|
+
return radioConfig.checkKey === cell[cellKey];
|
|
53
|
+
}, [cellKey, radioConfig.checkKey]);
|
|
51
54
|
var stateConfig = {
|
|
52
|
-
checked:
|
|
55
|
+
checked: isCheckboxChecked
|
|
53
56
|
};
|
|
54
57
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
55
|
-
className: (0, _classnames.default)('lm_card_table_body_cell',
|
|
58
|
+
className: (0, _classnames.default)('lm_card_table_body_cell', {
|
|
59
|
+
'cell_checked': isCheckboxChecked || isRadioChecked
|
|
60
|
+
})
|
|
56
61
|
}, /*#__PURE__*/_react.default.createElement(RenderCell, (0, _extends2.default)({
|
|
57
62
|
index: index,
|
|
58
63
|
cell: cell,
|
|
@@ -17,7 +17,8 @@ var CoreOptions = function CoreOptions(_ref) {
|
|
|
17
17
|
var checkboxConfig = state.checkboxConfig;
|
|
18
18
|
var dataSource = props.dataSource,
|
|
19
19
|
cellKey = props.cellKey,
|
|
20
|
-
checkboxChange = props.checkboxChange
|
|
20
|
+
checkboxChange = props.checkboxChange,
|
|
21
|
+
selectionConfig = props.selectionConfig;
|
|
21
22
|
var checkKeys = checkboxConfig.checkKeys,
|
|
22
23
|
checkValues = checkboxConfig.checkValues,
|
|
23
24
|
checkMethod = checkboxConfig.checkMethod; // 设置选中的值: 第一个参数是数据的键,第二个参数是选中与否, 第三个参数控制是否重置
|
|
@@ -63,6 +64,13 @@ var CoreOptions = function CoreOptions(_ref) {
|
|
|
63
64
|
checkValues: nValues
|
|
64
65
|
}
|
|
65
66
|
});
|
|
67
|
+
dispatch({
|
|
68
|
+
type: 'changeRadioConfig',
|
|
69
|
+
radioConfig: {
|
|
70
|
+
checkKey: '',
|
|
71
|
+
checkValue: ''
|
|
72
|
+
}
|
|
73
|
+
});
|
|
66
74
|
}; // 切换选中状态: 单个切换/批量切换
|
|
67
75
|
|
|
68
76
|
|
|
@@ -126,9 +134,28 @@ var CoreOptions = function CoreOptions(_ref) {
|
|
|
126
134
|
setCheckboxKeys(nKeys, isCheck, reset);
|
|
127
135
|
};
|
|
128
136
|
|
|
137
|
+
var cellClick = function cellClick(cell, index) {
|
|
138
|
+
var _props$cellClick;
|
|
139
|
+
|
|
140
|
+
if (!checkKeys.length) {
|
|
141
|
+
// 校验是否存在单选
|
|
142
|
+
var isRadio = Array.isArray(selectionConfig.type) ? selectionConfig.type.includes('radio') : selectionConfig.type === 'radio';
|
|
143
|
+
isRadio && dispatch({
|
|
144
|
+
type: 'changeRadioConfig',
|
|
145
|
+
radioConfig: {
|
|
146
|
+
checkKey: cell[cellKey],
|
|
147
|
+
checkValue: cell
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
(_props$cellClick = props.cellClick) === null || _props$cellClick === void 0 ? void 0 : _props$cellClick.call(props, cell, index);
|
|
153
|
+
};
|
|
154
|
+
|
|
129
155
|
return {
|
|
130
156
|
setCheckboxKeys: setCheckboxKeys,
|
|
131
|
-
toggleCheckboxKey: toggleCheckboxKey
|
|
157
|
+
toggleCheckboxKey: toggleCheckboxKey,
|
|
158
|
+
cellClick: cellClick
|
|
132
159
|
};
|
|
133
160
|
};
|
|
134
161
|
|