linkmore-design 1.0.58 → 1.0.62
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/container.d.ts +8 -0
- package/dist/Form/demos/error-tip.d.ts +2 -0
- package/dist/Form/demos/responsive.d.ts +2 -0
- package/dist/Form/index.d.ts +10 -2
- package/dist/LmEditTable/demos/sinleEdit.d.ts +2 -0
- package/dist/LmFilter/customFilter/index.d.ts +3 -1
- package/dist/LmFilter/filterFns/index.d.ts +11 -1
- package/dist/LmFilter/localization.d.ts +8 -2
- package/dist/index.umd.js +199 -45
- 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/container.d.ts +8 -0
- package/es/Form/container.js +97 -0
- package/es/Form/index.d.ts +10 -2
- package/es/Form/index.js +30 -2
- package/es/Form/style/index.css +121 -1
- package/es/IconFont/index.js +1 -1
- package/es/LmEditTable/EditTable.js +47 -17
- package/es/LmFilter/LmFilter.js +22 -4
- package/es/LmFilter/baseFilter/fuzzySearch.js +6 -1
- package/es/LmFilter/baseFilter/index.js +3 -4
- package/es/LmFilter/complexFilter/drawer.js +27 -20
- package/es/LmFilter/components/CascaderFilter.js +17 -4
- package/es/LmFilter/components/DateFilter.js +3 -7
- package/es/LmFilter/components/DropdownFIlter.js +12 -4
- package/es/LmFilter/components/index.js +1 -1
- package/es/LmFilter/customFilter/index.js +3 -2
- package/es/LmFilter/filterFns/index.js +186 -33
- package/es/LmFilter/localization.d.ts +8 -2
- package/es/LmFilter/localization.js +20 -2
- package/es/LmFilter/style/style.css +1 -3
- package/es/LmFilter/wrapper/Filter.js +10 -3
- package/es/LmFilter/wrapper/FilterContainer.js +0 -4
- package/es/LmFilter/wrapper/FilterRoot.js +51 -34
- package/es/LmTable/Table.js +9 -3
- package/es/LmTable/style/index.css +5 -0
- 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/container.d.ts +8 -0
- package/lib/Form/container.js +112 -0
- package/lib/Form/index.d.ts +10 -2
- package/lib/Form/index.js +30 -2
- package/lib/Form/style/index.css +121 -1
- package/lib/IconFont/index.js +1 -1
- package/lib/LmEditTable/EditTable.js +47 -17
- package/lib/LmFilter/LmFilter.js +22 -4
- package/lib/LmFilter/baseFilter/fuzzySearch.js +6 -1
- package/lib/LmFilter/baseFilter/index.js +3 -4
- package/lib/LmFilter/complexFilter/drawer.js +27 -20
- package/lib/LmFilter/components/CascaderFilter.js +17 -4
- package/lib/LmFilter/components/DateFilter.js +3 -7
- package/lib/LmFilter/components/DropdownFIlter.js +12 -4
- package/lib/LmFilter/components/index.js +1 -1
- package/lib/LmFilter/customFilter/index.js +3 -2
- package/lib/LmFilter/filterFns/index.js +186 -33
- package/lib/LmFilter/localization.d.ts +8 -2
- package/lib/LmFilter/localization.js +20 -2
- package/lib/LmFilter/style/style.css +1 -3
- package/lib/LmFilter/wrapper/Filter.js +10 -3
- package/lib/LmFilter/wrapper/FilterContainer.js +0 -4
- package/lib/LmFilter/wrapper/FilterRoot.js +51 -34
- package/lib/LmTable/Table.js +9 -3
- package/lib/LmTable/style/index.css +5 -0
- package/package.json +3 -3
|
@@ -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/lib/Dropdown/index.js
CHANGED
|
@@ -124,7 +124,7 @@ LMDropdown.Button = function (props) {
|
|
|
124
124
|
type: 'lmweb-down'
|
|
125
125
|
}),
|
|
126
126
|
overlayClassName: (0, _classnames.default)(props.overlayClassName, 'lm_dropdown_overlay'),
|
|
127
|
-
className: (0, _classnames.default)(props.className, 'lm_dropdown_button', props.disabled ? 'disabled' : '')
|
|
127
|
+
className: (0, _classnames.default)(props.className, 'lm_dropdown_button', props.disabled ? 'disabled' : '', props.type)
|
|
128
128
|
}));
|
|
129
129
|
}
|
|
130
130
|
|
|
@@ -140,7 +140,7 @@ LMDropdown.Button = function (props) {
|
|
|
140
140
|
overlayStyle: minwidth ? Object.assign({
|
|
141
141
|
minWidth: minwidth
|
|
142
142
|
}, props.overlayStyle) : Object.assign({}, props.overlayStyle),
|
|
143
|
-
className: (0, _classnames.default)(props.className, 'lm_dropdown_button', props.disabled ? 'disabled' : '')
|
|
143
|
+
className: (0, _classnames.default)(props.className, 'lm_dropdown_button', props.disabled ? 'disabled' : '', props.type)
|
|
144
144
|
})));
|
|
145
145
|
};
|
|
146
146
|
|
|
@@ -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);
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
|
|
16
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
+
|
|
18
|
+
var _lodash = require("lodash");
|
|
19
|
+
|
|
20
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
21
|
+
var t = {};
|
|
22
|
+
|
|
23
|
+
for (var p in s) {
|
|
24
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
28
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
29
|
+
}
|
|
30
|
+
return t;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
var prefixCls = 'lm_container';
|
|
34
|
+
|
|
35
|
+
var LMContainer = function LMContainer(props) {
|
|
36
|
+
var children = props.children,
|
|
37
|
+
className = props.className,
|
|
38
|
+
responsive = props.responsive,
|
|
39
|
+
others = __rest(props, ["children", "className", "responsive"]);
|
|
40
|
+
|
|
41
|
+
var _useState = (0, _react.useState)({
|
|
42
|
+
width: '100%',
|
|
43
|
+
height: '100%'
|
|
44
|
+
}),
|
|
45
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
46
|
+
containerSize = _useState2[0],
|
|
47
|
+
setContainerSize = _useState2[1];
|
|
48
|
+
|
|
49
|
+
var containerWrapRef = (0, _react.useRef)(null);
|
|
50
|
+
var throttleSize = (0, _react.useCallback)(function () {
|
|
51
|
+
var width = containerSize.width,
|
|
52
|
+
height = containerSize.height;
|
|
53
|
+
var responsiveCls = responsive && width !== '100%' ? 'responsive' : '';
|
|
54
|
+
var lm_col = '';
|
|
55
|
+
|
|
56
|
+
if (responsiveCls) {
|
|
57
|
+
if (parseInt(width) < 990) {
|
|
58
|
+
lm_col = 'lm_col_3';
|
|
59
|
+
} else if (parseInt(width) < 1390) {
|
|
60
|
+
lm_col = 'lm_col_4';
|
|
61
|
+
} else {
|
|
62
|
+
lm_col = 'lm_col_5';
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
var classes = (0, _classnames.default)(className, prefixCls, responsiveCls, lm_col);
|
|
67
|
+
return /*#__PURE__*/_react.default.createElement("div", Object.assign({
|
|
68
|
+
ref: containerWrapRef,
|
|
69
|
+
className: classes
|
|
70
|
+
}, others, {
|
|
71
|
+
style: {
|
|
72
|
+
width: width,
|
|
73
|
+
height: height
|
|
74
|
+
}
|
|
75
|
+
}), children);
|
|
76
|
+
}, [containerSize, props]);
|
|
77
|
+
|
|
78
|
+
var changeSize = function changeSize() {
|
|
79
|
+
var _a;
|
|
80
|
+
|
|
81
|
+
var _ref = ((_a = containerWrapRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) || {},
|
|
82
|
+
_ref$width = _ref.width,
|
|
83
|
+
width = _ref$width === void 0 ? '100%' : _ref$width;
|
|
84
|
+
|
|
85
|
+
setContainerSize({
|
|
86
|
+
width: width,
|
|
87
|
+
height: '100%'
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
var handResize = (0, _lodash.throttle)(changeSize, 600);
|
|
92
|
+
(0, _react.useEffect)(function () {
|
|
93
|
+
setTimeout(function () {
|
|
94
|
+
changeSize();
|
|
95
|
+
}, 100);
|
|
96
|
+
window.addEventListener('resize', handResize);
|
|
97
|
+
return function () {
|
|
98
|
+
window.removeEventListener('resize', handResize);
|
|
99
|
+
};
|
|
100
|
+
}, []);
|
|
101
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
102
|
+
className: "lm_container_wrapper",
|
|
103
|
+
ref: containerWrapRef,
|
|
104
|
+
style: {
|
|
105
|
+
width: '100%',
|
|
106
|
+
height: '100%'
|
|
107
|
+
}
|
|
108
|
+
}, throttleSize());
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
var _default = LMContainer;
|
|
112
|
+
exports.default = _default;
|
package/lib/Form/index.d.ts
CHANGED
|
@@ -1,19 +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
|
+
export interface LmFormProps extends FormProps {
|
|
7
|
+
responsive?: Boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface LmFormItemProps extends FormItemProps {
|
|
10
|
+
useStatus: any;
|
|
11
|
+
errorPlacement?: string;
|
|
12
|
+
}
|
|
6
13
|
declare const Reform: <Values = any>(props: FormProps<Values> & {
|
|
7
14
|
children?: React.ReactNode;
|
|
8
15
|
} & {
|
|
9
16
|
ref?: React.Ref<FormInstance<Values>>;
|
|
10
17
|
}) => React.ReactElement;
|
|
18
|
+
declare const LMFormItem: (props: LmFormItemProps) => JSX.Element;
|
|
11
19
|
declare type InternalFormType = typeof Reform;
|
|
12
20
|
interface FormInterface extends InternalFormType {
|
|
13
21
|
useForm: typeof useForm;
|
|
14
22
|
useFormInstance: typeof useFormInstance;
|
|
15
23
|
useWatch: typeof useWatch;
|
|
16
|
-
Item: typeof
|
|
24
|
+
Item: typeof LMFormItem;
|
|
17
25
|
List: typeof List;
|
|
18
26
|
ErrorList: typeof AntdForm.ErrorList;
|
|
19
27
|
Provider: typeof FormProvider;
|
package/lib/Form/index.js
CHANGED
|
@@ -25,6 +25,8 @@ var _context = require("antd/lib/form/context");
|
|
|
25
25
|
|
|
26
26
|
var _Form2 = require("antd/lib/form/Form");
|
|
27
27
|
|
|
28
|
+
var _container = _interopRequireDefault(require("./container"));
|
|
29
|
+
|
|
28
30
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
29
31
|
var t = {};
|
|
30
32
|
|
|
@@ -38,12 +40,24 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
38
40
|
return t;
|
|
39
41
|
};
|
|
40
42
|
|
|
43
|
+
// import useFormItemStatus from 'antd/lib/form/hooks/useFormItemStatus';
|
|
41
44
|
var classNamePrefix = 'lm_form';
|
|
42
45
|
|
|
43
46
|
var LMForm = function LMForm(props, ref) {
|
|
44
47
|
var children = props.children,
|
|
45
48
|
className = props.className,
|
|
46
|
-
|
|
49
|
+
responsive = props.responsive,
|
|
50
|
+
restProps = __rest(props, ["children", "className", "responsive"]);
|
|
51
|
+
|
|
52
|
+
if (responsive) {
|
|
53
|
+
return /*#__PURE__*/_react.default.createElement(_container.default, {
|
|
54
|
+
responsive: true
|
|
55
|
+
}, /*#__PURE__*/_react.default.createElement(_form.default, Object.assign({
|
|
56
|
+
ref: ref,
|
|
57
|
+
className: (0, _classnames.default)(classNamePrefix, className),
|
|
58
|
+
colon: false
|
|
59
|
+
}, restProps), children));
|
|
60
|
+
}
|
|
47
61
|
|
|
48
62
|
return /*#__PURE__*/_react.default.createElement(_form.default, Object.assign({
|
|
49
63
|
ref: ref,
|
|
@@ -54,8 +68,22 @@ var LMForm = function LMForm(props, ref) {
|
|
|
54
68
|
|
|
55
69
|
var Reform = /*#__PURE__*/_react.default.forwardRef(LMForm);
|
|
56
70
|
|
|
71
|
+
var LMFormItem = function LMFormItem(props) {
|
|
72
|
+
var children = props.children,
|
|
73
|
+
className = props.className,
|
|
74
|
+
_props$errorPlacement = props.errorPlacement,
|
|
75
|
+
errorPlacement = _props$errorPlacement === void 0 ? 'default' : _props$errorPlacement,
|
|
76
|
+
restProps = __rest(props, ["children", "className", "errorPlacement"]);
|
|
77
|
+
|
|
78
|
+
var tipClassName = errorPlacement === 'default' ? '' : "lm_form-item-tip-error lm_form-item-tip-error-".concat(errorPlacement);
|
|
79
|
+
var classes = (0, _classnames.default)(className, tipClassName);
|
|
80
|
+
return /*#__PURE__*/_react.default.createElement(_form.default.Item, Object.assign({
|
|
81
|
+
className: classes
|
|
82
|
+
}, restProps), children);
|
|
83
|
+
};
|
|
84
|
+
|
|
57
85
|
var Form = Reform;
|
|
58
|
-
Form.Item =
|
|
86
|
+
Form.Item = LMFormItem;
|
|
59
87
|
Form.List = _list.default;
|
|
60
88
|
Form.ErrorList = _form.default.ErrorList;
|
|
61
89
|
Form.useForm = _Form2.useForm;
|
package/lib/Form/style/index.css
CHANGED
|
@@ -506,6 +506,9 @@ html {
|
|
|
506
506
|
.lm_form .ant-form-item {
|
|
507
507
|
margin-bottom: 16px;
|
|
508
508
|
}
|
|
509
|
+
.lm_form .ant-form-item .ant-form-item-explain {
|
|
510
|
+
line-height: 24px;
|
|
511
|
+
}
|
|
509
512
|
.lm_form .ant-form-item-label {
|
|
510
513
|
display: flex !important;
|
|
511
514
|
align-items: center;
|
|
@@ -527,5 +530,122 @@ html {
|
|
|
527
530
|
margin-right: 0;
|
|
528
531
|
}
|
|
529
532
|
.lm_form .ant-form-item-control {
|
|
530
|
-
width:
|
|
533
|
+
width: 100%;
|
|
534
|
+
}
|
|
535
|
+
.lm_container_wrapper {
|
|
536
|
+
overflow: auto;
|
|
537
|
+
}
|
|
538
|
+
.lm_container_wrapper .lm_container.responsive {
|
|
539
|
+
min-width: 990px;
|
|
540
|
+
}
|
|
541
|
+
.lm_container_wrapper .lm_container.responsive .lm_form {
|
|
542
|
+
display: flex;
|
|
543
|
+
flex-direction: row;
|
|
544
|
+
flex-wrap: wrap;
|
|
545
|
+
}
|
|
546
|
+
.lm_container_wrapper .lm_container.responsive .lm_form .ant-form-item {
|
|
547
|
+
margin-right: 24px;
|
|
548
|
+
}
|
|
549
|
+
.lm_container_wrapper .lm_container.responsive .lm_form .ant-form-item .ant-form-item-control {
|
|
550
|
+
width: 100%;
|
|
551
|
+
}
|
|
552
|
+
.lm_container_wrapper .lm_container.responsive.lm_col_3 .ant-form-item {
|
|
553
|
+
width: calc(33.3333% - 16px);
|
|
554
|
+
}
|
|
555
|
+
.lm_container_wrapper .lm_container.responsive.lm_col_3 .ant-form-item:nth-of-type(3n) {
|
|
556
|
+
margin-right: 0;
|
|
557
|
+
}
|
|
558
|
+
.lm_container_wrapper .lm_container.responsive.lm_col_4 .ant-form-item {
|
|
559
|
+
width: calc(25% - 18px);
|
|
560
|
+
}
|
|
561
|
+
.lm_container_wrapper .lm_container.responsive.lm_col_4 .ant-form-item:nth-of-type(4n) {
|
|
562
|
+
margin-right: 0;
|
|
563
|
+
}
|
|
564
|
+
.lm_container_wrapper .lm_container.responsive.lm_col_5 .ant-form-item {
|
|
565
|
+
width: calc(20% - 96px / 5);
|
|
566
|
+
}
|
|
567
|
+
.lm_container_wrapper .lm_container.responsive.lm_col_5 .ant-form-item:nth-of-type(5n) {
|
|
568
|
+
margin-right: 0;
|
|
569
|
+
}
|
|
570
|
+
.lm_form .lm_form-item-tip-error .ant-form-item-explain {
|
|
571
|
+
width: 100%;
|
|
572
|
+
position: absolute;
|
|
573
|
+
display: flex;
|
|
574
|
+
top: 0;
|
|
575
|
+
left: 100%;
|
|
576
|
+
z-index: 100;
|
|
577
|
+
color: #FA4F53;
|
|
578
|
+
pointer-events: none;
|
|
579
|
+
}
|
|
580
|
+
.lm_form .lm_form-item-tip-error .ant-form-item-explain::before {
|
|
581
|
+
content: ' ';
|
|
582
|
+
position: absolute;
|
|
583
|
+
z-index: 10;
|
|
584
|
+
display: inline-block;
|
|
585
|
+
height: 0;
|
|
586
|
+
width: 0;
|
|
587
|
+
background-color: #fff;
|
|
588
|
+
transform: rotate(45deg);
|
|
589
|
+
border-width: 4px;
|
|
590
|
+
border-style: solid;
|
|
591
|
+
}
|
|
592
|
+
.lm_form .lm_form-item-tip-error .ant-form-item-explain .ant-form-item-explain-error {
|
|
593
|
+
line-height: 20px;
|
|
594
|
+
font-size: 12px;
|
|
595
|
+
background-color: #fff;
|
|
596
|
+
padding: 6px 8px;
|
|
597
|
+
box-shadow: 0 0 6px 2px #e3e3e3;
|
|
598
|
+
border-radius: 2px;
|
|
599
|
+
}
|
|
600
|
+
.lm_form .lm_form-item-tip-error-right .ant-form-item-explain::before {
|
|
601
|
+
box-shadow: -1px 1px 1px 0px #f0f0f0;
|
|
602
|
+
border-color: transparent transparent #fff #fff;
|
|
603
|
+
margin-left: 3px;
|
|
604
|
+
margin-top: 12px;
|
|
605
|
+
}
|
|
606
|
+
.lm_form .lm_form-item-tip-error-right .ant-form-item-explain .ant-form-item-explain-error {
|
|
607
|
+
margin-left: 7px;
|
|
608
|
+
}
|
|
609
|
+
.lm_form .lm_form-item-tip-error-left .ant-form-item-explain {
|
|
610
|
+
left: -100%;
|
|
611
|
+
justify-content: flex-end;
|
|
612
|
+
padding-right: 7px;
|
|
613
|
+
}
|
|
614
|
+
.lm_form .lm_form-item-tip-error-left .ant-form-item-explain::before {
|
|
615
|
+
box-shadow: 1px -1px 1px 0px #f0f0f0;
|
|
616
|
+
border-color: #fff #fff transparent transparent;
|
|
617
|
+
margin-left: -11px;
|
|
618
|
+
margin-top: 12px;
|
|
619
|
+
left: 100%;
|
|
620
|
+
}
|
|
621
|
+
.lm_form .lm_form-item-tip-error-left .ant-form-item-explain .ant-form-item-explain-error {
|
|
622
|
+
margin-left: -4px;
|
|
623
|
+
}
|
|
624
|
+
.lm_form .lm_form-item-tip-error-top .ant-form-item-explain {
|
|
625
|
+
top: -39px;
|
|
626
|
+
left: 0;
|
|
627
|
+
justify-content: center;
|
|
628
|
+
}
|
|
629
|
+
.lm_form .lm_form-item-tip-error-top .ant-form-item-explain::before {
|
|
630
|
+
box-shadow: 1px 1px 1px 0px #f0f0f0;
|
|
631
|
+
border-color: transparent #fff #fff transparent;
|
|
632
|
+
background-color: #fff;
|
|
633
|
+
margin-top: 28px;
|
|
634
|
+
}
|
|
635
|
+
.lm_form .lm_form-item-tip-error-top .ant-form-item-explain .ant-form-item-explain-error {
|
|
636
|
+
margin-left: -4px;
|
|
637
|
+
}
|
|
638
|
+
.lm_form .lm_form-item-tip-error-bottom .ant-form-item-explain {
|
|
639
|
+
top: 39px;
|
|
640
|
+
left: 0;
|
|
641
|
+
justify-content: center;
|
|
642
|
+
}
|
|
643
|
+
.lm_form .lm_form-item-tip-error-bottom .ant-form-item-explain::before {
|
|
644
|
+
box-shadow: -1px -1px 1px 0px #f0f0f0;
|
|
645
|
+
border-color: #fff transparent transparent #fff;
|
|
646
|
+
background-color: #fff;
|
|
647
|
+
margin-top: -4px;
|
|
648
|
+
}
|
|
649
|
+
.lm_form .lm_form-item-tip-error-bottom .ant-form-item-explain .ant-form-item-explain-error {
|
|
650
|
+
margin-left: -4px;
|
|
531
651
|
}
|
package/lib/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
|
});
|
|
@@ -267,10 +267,11 @@ var EditableCell = function EditableCell(props) {
|
|
|
267
267
|
handleSave = props.handleSave,
|
|
268
268
|
handleAdd = props.handleAdd,
|
|
269
269
|
handleDelete = props.handleDelete,
|
|
270
|
+
handleCopy = props.handleCopy,
|
|
270
271
|
itemProps = props.itemProps,
|
|
271
272
|
setValid = props.setValid,
|
|
272
273
|
reWriteOriginSource = props.reWriteOriginSource,
|
|
273
|
-
restProps = __rest(props, ["record", "rowKey", "isEdit", "col", "handleTableRowDelete", "handleTableRowAdd", "getLength", "isHoverEdit", "editEnum", "valueType", "children", "handleSave", "handleAdd", "handleDelete", "itemProps", "setValid", "reWriteOriginSource"]);
|
|
274
|
+
restProps = __rest(props, ["record", "rowKey", "isEdit", "col", "handleTableRowDelete", "handleTableRowAdd", "getLength", "isHoverEdit", "editEnum", "valueType", "children", "handleSave", "handleAdd", "handleDelete", "handleCopy", "itemProps", "setValid", "reWriteOriginSource"]);
|
|
274
275
|
/** 去除移入移出功能,保留最纯粹的功能,优化性能 */
|
|
275
276
|
|
|
276
277
|
|
|
@@ -294,44 +295,45 @@ var EditableCell = function EditableCell(props) {
|
|
|
294
295
|
while (1) {
|
|
295
296
|
switch (_context.prev = _context.next) {
|
|
296
297
|
case 0:
|
|
297
|
-
|
|
298
|
-
_context.prev = 1;
|
|
298
|
+
_context.prev = 0;
|
|
299
299
|
_context.t0 = row;
|
|
300
300
|
|
|
301
301
|
if (_context.t0) {
|
|
302
|
-
_context.next =
|
|
302
|
+
_context.next = 6;
|
|
303
303
|
break;
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
-
_context.next =
|
|
306
|
+
_context.next = 5;
|
|
307
307
|
return form.getFieldsValue();
|
|
308
308
|
|
|
309
|
-
case
|
|
309
|
+
case 5:
|
|
310
310
|
_context.t0 = _context.sent;
|
|
311
311
|
|
|
312
|
-
case
|
|
312
|
+
case 6:
|
|
313
313
|
values = _context.t0;
|
|
314
|
-
console.log(Object.assign(Object.assign({
|
|
314
|
+
console.log(Object.assign(Object.assign({
|
|
315
|
+
record: record
|
|
316
|
+
}, values), (0, _defineProperty2.default)({}, rowKey, record === null || record === void 0 ? void 0 : record[rowKey])), 'vvvv');
|
|
315
317
|
console.time('testForEach');
|
|
316
|
-
handleSave(Object.assign(Object.assign({}, values), (0, _defineProperty2.default)({}, rowKey, record === null || record === void 0 ? void 0 : record[rowKey])));
|
|
318
|
+
handleSave(Object.assign(Object.assign(Object.assign({}, record), values), (0, _defineProperty2.default)({}, rowKey, record === null || record === void 0 ? void 0 : record[rowKey])));
|
|
317
319
|
console.timeEnd('testForEach');
|
|
318
|
-
_context.next =
|
|
320
|
+
_context.next = 13;
|
|
319
321
|
return form.validateFields();
|
|
320
322
|
|
|
321
|
-
case
|
|
322
|
-
_context.next =
|
|
323
|
+
case 13:
|
|
324
|
+
_context.next = 17;
|
|
323
325
|
break;
|
|
324
326
|
|
|
325
|
-
case
|
|
326
|
-
_context.prev =
|
|
327
|
-
_context.t1 = _context["catch"](
|
|
327
|
+
case 15:
|
|
328
|
+
_context.prev = 15;
|
|
329
|
+
_context.t1 = _context["catch"](0);
|
|
328
330
|
|
|
329
|
-
case
|
|
331
|
+
case 17:
|
|
330
332
|
case "end":
|
|
331
333
|
return _context.stop();
|
|
332
334
|
}
|
|
333
335
|
}
|
|
334
|
-
}, _callee, null, [[
|
|
336
|
+
}, _callee, null, [[0, 15]]);
|
|
335
337
|
}));
|
|
336
338
|
}; // 触发保存
|
|
337
339
|
|
|
@@ -339,6 +341,15 @@ var EditableCell = function EditableCell(props) {
|
|
|
339
341
|
var handleFormItemChange = function handleFormItemChange(e) {
|
|
340
342
|
save === null || save === void 0 ? void 0 : save();
|
|
341
343
|
};
|
|
344
|
+
/** 快捷刷子,把当前的所有列的值,刷成当前的选中的列 */
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
var copyKey = function copyKey(e) {
|
|
348
|
+
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
349
|
+
console.log(rowKey, record[rowKey], 'fff');
|
|
350
|
+
var dataIndex = col.dataIndex;
|
|
351
|
+
handleCopy === null || handleCopy === void 0 ? void 0 : handleCopy(dataIndex, record[dataIndex]);
|
|
352
|
+
};
|
|
342
353
|
|
|
343
354
|
var Control = function Control(con) {
|
|
344
355
|
switch (con) {
|
|
@@ -360,6 +371,10 @@ var EditableCell = function EditableCell(props) {
|
|
|
360
371
|
noStyle: true
|
|
361
372
|
}, /*#__PURE__*/_react.default.cloneElement(componentProps.addonAfter, {
|
|
362
373
|
onChange: handleFormItemChange
|
|
374
|
+
})) : null,
|
|
375
|
+
suffix: componentProps.quickcopy ? /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.IconFont, {
|
|
376
|
+
onClick: copyKey,
|
|
377
|
+
type: 'lmweb-icon_m_brush'
|
|
363
378
|
})) : null
|
|
364
379
|
}));
|
|
365
380
|
|
|
@@ -742,6 +757,20 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
742
757
|
}
|
|
743
758
|
};
|
|
744
759
|
|
|
760
|
+
var handleCopy = function handleCopy(key, value) {
|
|
761
|
+
var res = (0, _immer.produce)(dataSourceRef.current, function (draft) {
|
|
762
|
+
draft.forEach(function (item) {
|
|
763
|
+
return item[key] = value;
|
|
764
|
+
});
|
|
765
|
+
});
|
|
766
|
+
|
|
767
|
+
if (onChange) {
|
|
768
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(res);
|
|
769
|
+
} else {
|
|
770
|
+
setDataSource(res);
|
|
771
|
+
}
|
|
772
|
+
};
|
|
773
|
+
|
|
745
774
|
var resultColumns = (0, _react.useMemo)(function () {
|
|
746
775
|
var localColumns = [sortOpen ? {
|
|
747
776
|
title: '',
|
|
@@ -815,6 +844,7 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
815
844
|
isHoverEdit: isHoverEdit,
|
|
816
845
|
handleAdd: handleAdd,
|
|
817
846
|
handleDelete: handleDelete,
|
|
847
|
+
handleCopy: handleCopy,
|
|
818
848
|
editEnum: typeof col.editEnum === 'function' ? col.editEnum(record) : col.editEnum,
|
|
819
849
|
valueType: typeof col.valueType === 'function' ? col.valueType(record) : col.valueType,
|
|
820
850
|
handleSave: handleSave,
|