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
|
@@ -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);
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
|
|
3
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
4
|
+
var t = {};
|
|
5
|
+
|
|
6
|
+
for (var p in s) {
|
|
7
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
11
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
12
|
+
}
|
|
13
|
+
return t;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
17
|
+
import classNames from 'classnames';
|
|
18
|
+
import { throttle } from 'lodash';
|
|
19
|
+
var prefixCls = 'lm_container';
|
|
20
|
+
|
|
21
|
+
var LMContainer = function LMContainer(props) {
|
|
22
|
+
var children = props.children,
|
|
23
|
+
className = props.className,
|
|
24
|
+
responsive = props.responsive,
|
|
25
|
+
others = __rest(props, ["children", "className", "responsive"]);
|
|
26
|
+
|
|
27
|
+
var _useState = useState({
|
|
28
|
+
width: '100%',
|
|
29
|
+
height: '100%'
|
|
30
|
+
}),
|
|
31
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
+
containerSize = _useState2[0],
|
|
33
|
+
setContainerSize = _useState2[1];
|
|
34
|
+
|
|
35
|
+
var containerWrapRef = useRef(null);
|
|
36
|
+
var throttleSize = useCallback(function () {
|
|
37
|
+
var width = containerSize.width,
|
|
38
|
+
height = containerSize.height;
|
|
39
|
+
var responsiveCls = responsive && width !== '100%' ? 'responsive' : '';
|
|
40
|
+
var lm_col = '';
|
|
41
|
+
|
|
42
|
+
if (responsiveCls) {
|
|
43
|
+
if (parseInt(width) < 990) {
|
|
44
|
+
lm_col = 'lm_col_3';
|
|
45
|
+
} else if (parseInt(width) < 1390) {
|
|
46
|
+
lm_col = 'lm_col_4';
|
|
47
|
+
} else {
|
|
48
|
+
lm_col = 'lm_col_5';
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
var classes = classNames(className, prefixCls, responsiveCls, lm_col);
|
|
53
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
54
|
+
ref: containerWrapRef,
|
|
55
|
+
className: classes
|
|
56
|
+
}, others, {
|
|
57
|
+
style: {
|
|
58
|
+
width: width,
|
|
59
|
+
height: height
|
|
60
|
+
}
|
|
61
|
+
}), children);
|
|
62
|
+
}, [containerSize, props]);
|
|
63
|
+
|
|
64
|
+
var changeSize = function changeSize() {
|
|
65
|
+
var _a;
|
|
66
|
+
|
|
67
|
+
var _ref = ((_a = containerWrapRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) || {},
|
|
68
|
+
_ref$width = _ref.width,
|
|
69
|
+
width = _ref$width === void 0 ? '100%' : _ref$width;
|
|
70
|
+
|
|
71
|
+
setContainerSize({
|
|
72
|
+
width: width,
|
|
73
|
+
height: '100%'
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
var handResize = throttle(changeSize, 600);
|
|
78
|
+
useEffect(function () {
|
|
79
|
+
setTimeout(function () {
|
|
80
|
+
changeSize();
|
|
81
|
+
}, 100);
|
|
82
|
+
window.addEventListener('resize', handResize);
|
|
83
|
+
return function () {
|
|
84
|
+
window.removeEventListener('resize', handResize);
|
|
85
|
+
};
|
|
86
|
+
}, []);
|
|
87
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
className: "lm_container_wrapper",
|
|
89
|
+
ref: containerWrapRef,
|
|
90
|
+
style: {
|
|
91
|
+
width: '100%',
|
|
92
|
+
height: '100%'
|
|
93
|
+
}
|
|
94
|
+
}, throttleSize());
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export default LMContainer;
|
package/es/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/es/Form/index.js
CHANGED
|
@@ -21,12 +21,25 @@ 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'; // import useFormItemStatus from 'antd/lib/form/hooks/useFormItemStatus';
|
|
25
|
+
|
|
24
26
|
var classNamePrefix = 'lm_form';
|
|
25
27
|
|
|
26
28
|
var LMForm = function LMForm(props, ref) {
|
|
27
29
|
var children = props.children,
|
|
28
30
|
className = props.className,
|
|
29
|
-
|
|
31
|
+
responsive = props.responsive,
|
|
32
|
+
restProps = __rest(props, ["children", "className", "responsive"]);
|
|
33
|
+
|
|
34
|
+
if (responsive) {
|
|
35
|
+
return /*#__PURE__*/React.createElement(Container, {
|
|
36
|
+
responsive: true
|
|
37
|
+
}, /*#__PURE__*/React.createElement(_Form, Object.assign({
|
|
38
|
+
ref: ref,
|
|
39
|
+
className: classnames(classNamePrefix, className),
|
|
40
|
+
colon: false
|
|
41
|
+
}, restProps), children));
|
|
42
|
+
}
|
|
30
43
|
|
|
31
44
|
return /*#__PURE__*/React.createElement(_Form, Object.assign({
|
|
32
45
|
ref: ref,
|
|
@@ -36,8 +49,23 @@ var LMForm = function LMForm(props, ref) {
|
|
|
36
49
|
};
|
|
37
50
|
|
|
38
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
|
+
|
|
39
67
|
var Form = Reform;
|
|
40
|
-
Form.Item =
|
|
68
|
+
Form.Item = LMFormItem;
|
|
41
69
|
Form.List = _List;
|
|
42
70
|
Form.ErrorList = _Form.ErrorList;
|
|
43
71
|
Form.useForm = useForm;
|
package/es/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/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
|
});
|