@zat-design/sisyphus-react 3.4.0 → 3.4.1
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/index.esm.css +121 -124
- package/es/ProEditTable/components/DndWrapper/index.d.ts +1 -1
- package/es/ProEditTable/components/DndWrapper/index.js +5 -5
- package/es/ProEditTable/components/RenderField/index.js +1 -1
- package/es/ProEditTable/index.js +15 -9
- package/es/ProEditTable/style/index.less +36 -55
- package/es/ProEditTable/utils/index.js +2 -2
- package/es/ProEnum/components/Group.d.ts +7 -0
- package/es/ProEnum/components/Group.js +51 -0
- package/es/ProEnum/index.js +25 -2
- package/es/ProEnum/propsType.d.ts +2 -2
- package/es/ProEnum/propsType.js +1 -1
- package/es/ProEnum/style/index.less +65 -1
- package/es/ProForm/components/base/InputNumber/index.js +2 -2
- package/es/ProForm/components/base/Radio/index.js +1 -1
- package/es/ProForm/components/base/Select/index.js +0 -13
- package/es/ProForm/components/combination/FormList/components/LineFields.js +1 -0
- package/es/ProForm/components/combination/ProNumberRange/style/index.less +20 -19
- package/es/ProForm/components/render/ConfirmWrapper.d.ts +10 -0
- package/es/ProForm/components/render/ConfirmWrapper.js +66 -0
- package/es/ProForm/components/render/Render.js +19 -6
- package/es/ProForm/components/render/RenderFields.js +9 -9
- package/es/ProForm/components/render/propsType.d.ts +5 -2
- package/es/ProForm/style/index.less +6 -1
- package/es/ProForm/utils/useShouldUpdate.js +1 -1
- package/es/ProForm/utils/valueType.js +37 -3
- package/es/ProIcon/index.d.ts +0 -1
- package/es/ProIcon/index.js +6 -4
- package/es/ProIcon/style/index.less +4 -6
- package/es/ProIcon/symbolIcon.js +20 -20
- package/es/ProLayout/components/ProCollapse/style/index.less +17 -7
- package/es/ProLayout/components/ProHeader/style/index.less +109 -101
- package/es/ProTable/components/RenderColumn/index.js +1 -2
- package/es/ProTable/propsType.d.ts +1 -1
- package/es/ProTable/style/index.less +196 -99
- package/es/ProTable/utils.js +1 -1
- package/es/ProThemeTools/component/PrdTools/index.js +3 -3
- package/es/ProThemeTools/index.js +4 -2
- package/es/ProTreeModal/components/SortableItem.js +5 -7
- package/es/ProTreeModal/style/index.less +0 -6
- package/es/style/core/mixins.less +12 -5
- package/lib/ProEditTable/components/DndWrapper/index.d.ts +1 -1
- package/lib/ProEditTable/components/DndWrapper/index.js +5 -5
- package/lib/ProEditTable/components/RenderField/index.js +1 -1
- package/lib/ProEditTable/index.js +13 -7
- package/lib/ProEditTable/style/index.less +36 -55
- package/lib/ProEditTable/utils/index.js +2 -2
- package/lib/ProEnum/components/Group.d.ts +7 -0
- package/lib/ProEnum/components/Group.js +58 -0
- package/lib/ProEnum/index.js +25 -2
- package/lib/ProEnum/propsType.d.ts +2 -2
- package/lib/ProEnum/propsType.js +1 -1
- package/lib/ProEnum/style/index.less +65 -1
- package/lib/ProForm/components/base/InputNumber/index.js +2 -2
- package/lib/ProForm/components/base/Radio/index.js +1 -1
- package/lib/ProForm/components/base/Select/index.js +0 -13
- package/lib/ProForm/components/combination/FormList/components/LineFields.js +1 -0
- package/lib/ProForm/components/combination/ProNumberRange/style/index.less +20 -19
- package/lib/ProForm/components/render/ConfirmWrapper.d.ts +10 -0
- package/lib/ProForm/components/render/ConfirmWrapper.js +72 -0
- package/lib/ProForm/components/render/Render.js +19 -6
- package/lib/ProForm/components/render/RenderFields.js +9 -9
- package/lib/ProForm/components/render/propsType.d.ts +5 -2
- package/lib/ProForm/style/index.less +6 -1
- package/lib/ProForm/utils/useShouldUpdate.js +1 -1
- package/lib/ProForm/utils/valueType.js +37 -3
- package/lib/ProIcon/index.d.ts +0 -1
- package/lib/ProIcon/index.js +6 -4
- package/lib/ProIcon/style/index.less +4 -6
- package/lib/ProIcon/symbolIcon.js +20 -20
- package/lib/ProLayout/components/ProCollapse/style/index.less +17 -7
- package/lib/ProLayout/components/ProHeader/style/index.less +109 -101
- package/lib/ProTable/components/RenderColumn/index.js +1 -2
- package/lib/ProTable/propsType.d.ts +1 -1
- package/lib/ProTable/style/index.less +196 -99
- package/lib/ProTable/utils.js +1 -1
- package/lib/ProThemeTools/component/PrdTools/index.js +2 -2
- package/lib/ProThemeTools/index.js +3 -1
- package/lib/ProTreeModal/components/SortableItem.js +5 -7
- package/lib/ProTreeModal/style/index.less +0 -6
- package/lib/style/core/mixins.less +12 -5
- package/package.json +1 -1
|
@@ -206,7 +206,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
206
206
|
if (!((_names3 = names) === null || _names3 === void 0 ? void 0 : _names3.length)) {
|
|
207
207
|
return {};
|
|
208
208
|
}
|
|
209
|
-
var namesStr = [baseName, index, dataIndex];
|
|
209
|
+
var namesStr = [].concat(_toConsumableArray(baseName), [index, dataIndex]);
|
|
210
210
|
var transform = {};
|
|
211
211
|
if (valueType) {
|
|
212
212
|
transform = valueTypeTransform();
|
package/es/ProEditTable/index.js
CHANGED
|
@@ -12,9 +12,9 @@ import _Form from "antd/es/form";
|
|
|
12
12
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
13
13
|
var _excluded = ["value", "onChange", "className", "columns", "type", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "otherProps", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "originalTip", "rowKey"];
|
|
14
14
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
-
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef } from 'react';
|
|
15
|
+
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
16
16
|
import { get, isArray } from 'lodash';
|
|
17
|
-
import { useDebounceEffect, useSetState } from 'ahooks';
|
|
17
|
+
import { useDebounceEffect, useLocalStorageState, useSetState } from 'ahooks';
|
|
18
18
|
import classnames from 'classnames';
|
|
19
19
|
import { transformColumns } from './utils';
|
|
20
20
|
import { getRandom, getNamePath } from './utils/tools';
|
|
@@ -22,7 +22,7 @@ import { DndWrapper, Row, Validator, Summary, RenderToolbar } from './components
|
|
|
22
22
|
import Empty from '../assets/empty.png';
|
|
23
23
|
import locale, { formatMessage } from '../locale';
|
|
24
24
|
var ProEditTable = function ProEditTable(_ref, ref) {
|
|
25
|
-
var _resetProps$id, _resetProps$id$split, _value$2;
|
|
25
|
+
var _resetProps$id, _resetProps$id$split, _themeConfig$data2, _value$2;
|
|
26
26
|
var value = _ref.value,
|
|
27
27
|
onChange = _ref.onChange,
|
|
28
28
|
className = _ref.className,
|
|
@@ -43,7 +43,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
43
43
|
mulDeletePoConfirmMsg = _ref.mulDeletePoConfirmMsg,
|
|
44
44
|
_ref$otherProps = _ref.otherProps,
|
|
45
45
|
otherProps = _ref$otherProps === void 0 ? {} : _ref$otherProps,
|
|
46
|
-
|
|
46
|
+
configRequiredAlign = _ref.requiredAlign,
|
|
47
47
|
summary = _ref.summary,
|
|
48
48
|
max = _ref.max,
|
|
49
49
|
headerRender = _ref.headerRender,
|
|
@@ -65,6 +65,13 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
65
65
|
getPrefixCls = _React$useContext.getPrefixCls;
|
|
66
66
|
var prefixCls = getPrefixCls();
|
|
67
67
|
disabled = (otherProps === null || otherProps === void 0 ? void 0 : otherProps.disabled) || disabled;
|
|
68
|
+
var _useLocalStorageState = useLocalStorageState('themeConfig'),
|
|
69
|
+
_useLocalStorageState2 = _slicedToArray(_useLocalStorageState, 1),
|
|
70
|
+
themeConfig = _useLocalStorageState2[0];
|
|
71
|
+
var requiredAlign = useMemo(function () {
|
|
72
|
+
var _ref2, _themeConfig$data$zau, _themeConfig$data;
|
|
73
|
+
return (_ref2 = (_themeConfig$data$zau = themeConfig === null || themeConfig === void 0 ? void 0 : (_themeConfig$data = themeConfig.data) === null || _themeConfig$data === void 0 ? void 0 : _themeConfig$data.zauiFormAlign) !== null && _themeConfig$data$zau !== void 0 ? _themeConfig$data$zau : configRequiredAlign) !== null && _ref2 !== void 0 ? _ref2 : 'left';
|
|
74
|
+
}, [themeConfig === null || themeConfig === void 0 ? void 0 : (_themeConfig$data2 = themeConfig.data) === null || _themeConfig$data2 === void 0 ? void 0 : _themeConfig$data2.zauiFormAlign]);
|
|
68
75
|
var _useSetState = useSetState({
|
|
69
76
|
_columns: columns,
|
|
70
77
|
cellNamePath: [],
|
|
@@ -101,8 +108,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
101
108
|
var getRowKey = function getRowKey(record) {
|
|
102
109
|
var key = record.rowKey || getRandom();
|
|
103
110
|
if (rowKey) {
|
|
104
|
-
var
|
|
105
|
-
key = (
|
|
111
|
+
var _ref3;
|
|
112
|
+
key = (_ref3 = typeof rowKey === 'function' ? rowKey(record) : record[rowKey]) !== null && _ref3 !== void 0 ? _ref3 : key;
|
|
106
113
|
}
|
|
107
114
|
return key;
|
|
108
115
|
};
|
|
@@ -226,7 +233,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
226
233
|
return isForbiddenBtn('mulDelete') ? rowSelection : _rowSelection;
|
|
227
234
|
};
|
|
228
235
|
var setColumns = /*#__PURE__*/function () {
|
|
229
|
-
var
|
|
236
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
230
237
|
var nextColumns;
|
|
231
238
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
232
239
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -245,7 +252,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
245
252
|
}, _callee);
|
|
246
253
|
}));
|
|
247
254
|
return function setColumns() {
|
|
248
|
-
return
|
|
255
|
+
return _ref4.apply(this, arguments);
|
|
249
256
|
};
|
|
250
257
|
}();
|
|
251
258
|
useDebounceEffect(function () {
|
|
@@ -355,7 +362,6 @@ ForwardProEditTable.defaultProps = {
|
|
|
355
362
|
type: 'multiple',
|
|
356
363
|
mode: 'multiple',
|
|
357
364
|
insertType: 'after',
|
|
358
|
-
requiredAlign: 'right',
|
|
359
365
|
value: [],
|
|
360
366
|
actionProps: [],
|
|
361
367
|
toolbarProps: [],
|
|
@@ -63,7 +63,8 @@
|
|
|
63
63
|
.drag-wrapper {
|
|
64
64
|
display: flex;
|
|
65
65
|
.drag-icon {
|
|
66
|
-
margin-right: var(--zaui-space-size-
|
|
66
|
+
margin-right: var(--zaui-space-size-md, 16px);
|
|
67
|
+
margin-left: var(--zaui-space-size-xs, 4px);
|
|
67
68
|
cursor: pointer;
|
|
68
69
|
}
|
|
69
70
|
}
|
|
@@ -92,33 +93,8 @@
|
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
.@{ant-prefix}-table-header>table .@{ant-prefix}-table-thead>tr>th:not(.@{ant-prefix}-table-selection-column):not(.@{ant-prefix}-table-row-expand-icon-cell):not([colspan]).is-required {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
&.is-required-left {
|
|
100
|
-
&::before {
|
|
101
|
-
content: "";
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
.pro-edit-table-title {
|
|
105
|
-
&::after {
|
|
106
|
-
width: auto;
|
|
107
|
-
position : static;
|
|
108
|
-
top : 0;
|
|
109
|
-
display : inline-block;
|
|
110
|
-
margin-left: var(--zaui-space-size-xs, 4px);
|
|
111
|
-
color : #ff5050;
|
|
112
|
-
font-size : 14px;
|
|
113
|
-
line-height: 1;
|
|
114
|
-
content : "*";
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
&.is-required-left {
|
|
118
|
-
&::after {
|
|
119
|
-
display: none;
|
|
120
|
-
}
|
|
121
|
-
|
|
96
|
+
&.is-required-right {
|
|
97
|
+
.pro-edit-table-title {
|
|
122
98
|
&::before {
|
|
123
99
|
position : static;
|
|
124
100
|
top : 0;
|
|
@@ -131,6 +107,21 @@
|
|
|
131
107
|
}
|
|
132
108
|
}
|
|
133
109
|
}
|
|
110
|
+
&.is-required-left {
|
|
111
|
+
.pro-edit-table-title {
|
|
112
|
+
&::after {
|
|
113
|
+
width: auto;
|
|
114
|
+
position : static;
|
|
115
|
+
top : 0;
|
|
116
|
+
display : inline-block;
|
|
117
|
+
margin-left: var(--zaui-space-size-xs, 4px);
|
|
118
|
+
color : #ff5050;
|
|
119
|
+
font-size : 14px;
|
|
120
|
+
line-height: 1;
|
|
121
|
+
content : "*";
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
134
125
|
}
|
|
135
126
|
|
|
136
127
|
.@{ant-prefix}-table-scroll-horizontal {
|
|
@@ -166,33 +157,8 @@
|
|
|
166
157
|
}
|
|
167
158
|
|
|
168
159
|
.@{ant-prefix}-table-thead>tr>th:not(.@{ant-prefix}-table-selection-column):not(.@{ant-prefix}-table-row-expand-icon-cell):not([colspan]).is-required {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
&.is-required-left {
|
|
174
|
-
&::before {
|
|
175
|
-
content: "";
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
.pro-edit-table-title {
|
|
179
|
-
&::after {
|
|
180
|
-
width: auto;
|
|
181
|
-
position : static;
|
|
182
|
-
top : 0;
|
|
183
|
-
display : inline-block;
|
|
184
|
-
margin-left: var(--zaui-space-size-xs, 4px);
|
|
185
|
-
color : #ff5050;
|
|
186
|
-
font-size : var(--zaui-font-size-md, 14px);
|
|
187
|
-
line-height: 1;
|
|
188
|
-
content : "*";
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
&.is-required-left {
|
|
192
|
-
&::after {
|
|
193
|
-
display: none;
|
|
194
|
-
}
|
|
195
|
-
|
|
160
|
+
&.is-required-right {
|
|
161
|
+
.pro-edit-table-title {
|
|
196
162
|
&::before {
|
|
197
163
|
position : static;
|
|
198
164
|
top : 0;
|
|
@@ -205,6 +171,21 @@
|
|
|
205
171
|
}
|
|
206
172
|
}
|
|
207
173
|
}
|
|
174
|
+
&.is-required-left {
|
|
175
|
+
.pro-edit-table-title {
|
|
176
|
+
&::after {
|
|
177
|
+
width: auto;
|
|
178
|
+
position : static;
|
|
179
|
+
top : 0;
|
|
180
|
+
display : inline-block;
|
|
181
|
+
margin-left: var(--zaui-space-size-xs, 4px);
|
|
182
|
+
color : #ff5050;
|
|
183
|
+
font-size : 14px;
|
|
184
|
+
line-height: 1;
|
|
185
|
+
content : "*";
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
208
189
|
}
|
|
209
190
|
}
|
|
210
191
|
}
|
|
@@ -250,8 +250,8 @@ export var transformColumns = function transformColumns() {
|
|
|
250
250
|
item.className = classnames(_defineProperty({
|
|
251
251
|
'is-hidden': hidden,
|
|
252
252
|
'is-required': required || labelRequired,
|
|
253
|
-
'is-required-
|
|
254
|
-
'is-required-
|
|
253
|
+
'is-required-left': requiredAlign === 'left',
|
|
254
|
+
'is-required-right': requiredAlign === 'right'
|
|
255
255
|
}, className, className));
|
|
256
256
|
// 防止重复渲染导致className重复添加
|
|
257
257
|
if (item.className) {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { useSetState } from 'ahooks';
|
|
5
|
+
import { useEffect, useRef } from 'react';
|
|
6
|
+
var Group = function Group(props) {
|
|
7
|
+
var value = props.value,
|
|
8
|
+
onChange = props.onChange,
|
|
9
|
+
dataSource = props.dataSource,
|
|
10
|
+
fieldValue = props.fieldValue,
|
|
11
|
+
fieldLabel = props.fieldLabel;
|
|
12
|
+
var idx = useRef(-1);
|
|
13
|
+
var _useSetState = useSetState({
|
|
14
|
+
checked: ''
|
|
15
|
+
}),
|
|
16
|
+
_useSetState2 = _slicedToArray(_useSetState, 2),
|
|
17
|
+
state = _useSetState2[0],
|
|
18
|
+
setState = _useSetState2[1];
|
|
19
|
+
useEffect(function () {
|
|
20
|
+
setState({
|
|
21
|
+
checked: value
|
|
22
|
+
});
|
|
23
|
+
}, [value]);
|
|
24
|
+
var handleClick = function handleClick(val, index) {
|
|
25
|
+
setState({
|
|
26
|
+
checked: val
|
|
27
|
+
});
|
|
28
|
+
idx.current = index;
|
|
29
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(val);
|
|
30
|
+
};
|
|
31
|
+
if (dataSource.length === 0) {
|
|
32
|
+
return _jsx("span", {
|
|
33
|
+
children: "-"
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return _jsx("div", {
|
|
37
|
+
className: "pro-enum-group-root",
|
|
38
|
+
children: dataSource.map(function (item, index) {
|
|
39
|
+
return _jsx("div", {
|
|
40
|
+
onClick: function onClick() {
|
|
41
|
+
if (!item.disabled) {
|
|
42
|
+
handleClick(item[fieldValue], index);
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
className: classNames('pro-enum-group-item', state.checked === item[fieldValue] ? 'pro-enum-group-item-selected' : '', index === idx.current || index + 1 === idx.current ? 'pro-enum-group-item-disabled-after' : '', item.disabled ? 'pro-enum-group-item-disabled' : ''),
|
|
46
|
+
children: item[fieldLabel]
|
|
47
|
+
}, item[fieldValue]);
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
export default Group;
|
package/es/ProEnum/index.js
CHANGED
|
@@ -20,6 +20,7 @@ import { cloneDeep, isFunction, isString, isArray, omit } from 'lodash';
|
|
|
20
20
|
import ProSelect from '../ProSelect';
|
|
21
21
|
import { useProConfig } from '../ProConfigProvider';
|
|
22
22
|
import ProEnumTag from './components/Tag';
|
|
23
|
+
import ProEnumGroup from './components/Group';
|
|
23
24
|
import Container from '../ProForm/components/Container';
|
|
24
25
|
import { isObject } from './utils';
|
|
25
26
|
import getEnumLabel from './utils/getEnumLabel';
|
|
@@ -175,13 +176,27 @@ var ProEnum = function ProEnum(props) {
|
|
|
175
176
|
return _jsx(_Radio.Group, _objectSpread(_objectSpread({}, omit(enumProps, ['fieldNames'])), {}, {
|
|
176
177
|
options: list,
|
|
177
178
|
value: value,
|
|
178
|
-
onChange: onChange
|
|
179
|
+
onChange: onChange,
|
|
180
|
+
children: list.map(function (item) {
|
|
181
|
+
return _jsx(_Radio, {
|
|
182
|
+
value: item[fieldValue],
|
|
183
|
+
disabled: !!item.disabled,
|
|
184
|
+
children: item[label]
|
|
185
|
+
}, item[fieldValue]);
|
|
186
|
+
})
|
|
179
187
|
}));
|
|
180
188
|
case 'Checkbox':
|
|
181
189
|
return _jsx(_Checkbox.Group, _objectSpread(_objectSpread({}, omit(enumProps, ['fieldNames'])), {}, {
|
|
182
190
|
options: list,
|
|
183
191
|
value: value,
|
|
184
|
-
onChange: onChange
|
|
192
|
+
onChange: onChange,
|
|
193
|
+
children: list.map(function (item) {
|
|
194
|
+
return _jsx(_Checkbox, {
|
|
195
|
+
value: item[fieldValue],
|
|
196
|
+
disabled: !!item.disabled,
|
|
197
|
+
children: item[label]
|
|
198
|
+
}, item[fieldValue]);
|
|
199
|
+
})
|
|
185
200
|
}));
|
|
186
201
|
case 'Tag':
|
|
187
202
|
return _jsx(ProEnumTag, {
|
|
@@ -191,6 +206,14 @@ var ProEnum = function ProEnum(props) {
|
|
|
191
206
|
fieldValue: fieldValue,
|
|
192
207
|
dataSource: list
|
|
193
208
|
});
|
|
209
|
+
case 'Group':
|
|
210
|
+
return _jsx(ProEnumGroup, {
|
|
211
|
+
value: value,
|
|
212
|
+
onChange: onChange,
|
|
213
|
+
fieldLabel: label,
|
|
214
|
+
fieldValue: fieldValue,
|
|
215
|
+
dataSource: list
|
|
216
|
+
});
|
|
194
217
|
default:
|
|
195
218
|
return null;
|
|
196
219
|
}
|
|
@@ -42,7 +42,7 @@ export interface ProEnumConfig {
|
|
|
42
42
|
};
|
|
43
43
|
dics: Record<string, DataOption[]>;
|
|
44
44
|
}
|
|
45
|
-
type ProEnumType = 'ProSelect' | 'Radio' | 'Checkbox' | 'Tag';
|
|
45
|
+
type ProEnumType = 'ProSelect' | 'Radio' | 'Checkbox' | 'Tag' | 'Group';
|
|
46
46
|
export interface ProEnum {
|
|
47
47
|
/** 组件展示类型、默认 ProSelect */
|
|
48
48
|
type?: ProEnumType;
|
|
@@ -86,7 +86,7 @@ export type CheckboxPropsMap = {
|
|
|
86
86
|
type?: 'Checkbox';
|
|
87
87
|
} & CheckboxProps;
|
|
88
88
|
export interface TagPropsMap {
|
|
89
|
-
type?: 'Tag';
|
|
89
|
+
type?: 'Tag' | 'Group';
|
|
90
90
|
}
|
|
91
91
|
export type ProEnumProps = Omit<ProEnum, 'type'> & (PropProSelectsMap | PropRadioPropsMap | CheckboxPropsMap | TagPropsMap);
|
|
92
92
|
export {};
|
package/es/ProEnum/propsType.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
align-items: center;
|
|
13
13
|
justify-content: center;
|
|
14
14
|
margin-right: var(--zaui-space-size-sm);
|
|
15
|
-
|
|
15
|
+
margin-bottom: calc(var(--zaui-space-size-sm; 8px) * var(--zaui-size; 1));
|
|
16
16
|
padding: var(--zaui-space-size-xs) 10px;
|
|
17
17
|
background-color: #f5f5f5;
|
|
18
18
|
border-radius: var(--zaui-space-size-xs);
|
|
@@ -23,4 +23,68 @@
|
|
|
23
23
|
color: #fff;
|
|
24
24
|
background-color: var(--zaui-brand);
|
|
25
25
|
}
|
|
26
|
+
&-tag-item-disabled {
|
|
27
|
+
background-color: #f5f5f5;
|
|
28
|
+
pointer-events: none;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&-group-root {
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: row;
|
|
34
|
+
flex-wrap: wrap;
|
|
35
|
+
|
|
36
|
+
.pro-enum-group-item {
|
|
37
|
+
position: relative;
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
margin-bottom: calc(var(--zaui-space-size-sm; 8px) * var(--zaui-size; 1));
|
|
42
|
+
padding: var(--zaui-space-size-sm) var(--zaui-space-border);
|
|
43
|
+
line-height: 18px;
|
|
44
|
+
background-color: #f1f3f6ff;
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
|
|
47
|
+
&::after {
|
|
48
|
+
position: absolute;
|
|
49
|
+
top: var(--zaui-space-size-sm);
|
|
50
|
+
right: 0;
|
|
51
|
+
bottom: var(--zaui-space-size-sm);
|
|
52
|
+
width: 1px;
|
|
53
|
+
background: var(--zaui-brand);
|
|
54
|
+
opacity: 0.7;
|
|
55
|
+
content: '';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&:first-child {
|
|
59
|
+
border-top-left-radius: var(--zaui-space-size-xs);
|
|
60
|
+
border-bottom-left-radius: var(--zaui-space-size-xs);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&:last-child {
|
|
64
|
+
border-top-right-radius: var(--zaui-space-size-xs);
|
|
65
|
+
border-bottom-right-radius: var(--zaui-space-size-xs);
|
|
66
|
+
&::after {
|
|
67
|
+
width: 0;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.pro-enum-group-item-selected {
|
|
73
|
+
color: var(--zaui-brand);
|
|
74
|
+
border: 1px solid var(--zaui-brand);
|
|
75
|
+
&::after {
|
|
76
|
+
width: 0;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.pro-enum-group-item-disabled-after::after {
|
|
81
|
+
width: 0 !important;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.pro-enum-group-item-disabled {
|
|
85
|
+
color: rgba(0, 0, 0, 0.25);
|
|
86
|
+
background: #f5f5f5;
|
|
87
|
+
cursor: not-allowed;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
26
90
|
}
|
|
@@ -68,12 +68,12 @@ var InputNumber = function InputNumber(props) {
|
|
|
68
68
|
return value;
|
|
69
69
|
}
|
|
70
70
|
return num.toLocaleString('en-US', {
|
|
71
|
-
maximumFractionDigits: (props === null || props === void 0 ? void 0 : props.precision) ||
|
|
71
|
+
maximumFractionDigits: (props === null || props === void 0 ? void 0 : props.precision) || 2
|
|
72
72
|
});
|
|
73
73
|
},
|
|
74
74
|
parser: function parser(value) {
|
|
75
75
|
var num = Number(value.replace(/[\s,]+/g, ''));
|
|
76
|
-
return Number.isNaN(num) ? value : num.toFixed((props === null || props === void 0 ? void 0 : props.precision) ||
|
|
76
|
+
return Number.isNaN(num) ? value : num.toFixed((props === null || props === void 0 ? void 0 : props.precision) || 2);
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
79
|
break;
|
|
@@ -56,7 +56,7 @@ var Radio = function Radio(props) {
|
|
|
56
56
|
onChange: function onChange(e) {
|
|
57
57
|
_onChange(e, e.target.value);
|
|
58
58
|
},
|
|
59
|
-
children: !!dataSource.length && dataSource.map(function (radioItem) {
|
|
59
|
+
children: !!(dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) && dataSource.map(function (radioItem) {
|
|
60
60
|
return _jsx(_Radio, {
|
|
61
61
|
value: radioItem[_fieldNames.value],
|
|
62
62
|
children: radioItem[_fieldNames.label]
|
|
@@ -48,19 +48,6 @@ var Select = function Select(props) {
|
|
|
48
48
|
children: value ? transToLabel([value]) : null
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
// 假如dataSource包含code,name, fieldNames没有配置,_fieldNames默认为code, name
|
|
52
|
-
if (Array.isArray(dataSource) && !fieldNames) {
|
|
53
|
-
var _dataSource$filter;
|
|
54
|
-
var hasCodeName = Boolean((_dataSource$filter = dataSource.filter(function (item) {
|
|
55
|
-
return Object.keys(item).includes('code') && Object.keys(item).includes('name');
|
|
56
|
-
})) === null || _dataSource$filter === void 0 ? void 0 : _dataSource$filter.length);
|
|
57
|
-
if (hasCodeName) {
|
|
58
|
-
_fieldNames = {
|
|
59
|
-
label: 'name',
|
|
60
|
-
value: 'code'
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
51
|
return _jsx(_Select, _objectSpread(_objectSpread(_objectSpread({
|
|
65
52
|
placeholder: "".concat(locale.ProForm.selectPlaceHolder),
|
|
66
53
|
allowClear: true,
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
@import (reference) '~antd/es/style/themes/index.less';
|
|
3
3
|
|
|
4
4
|
.pro-number-range {
|
|
5
|
-
|
|
6
5
|
.range-split {
|
|
7
|
-
width
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
width: 32px !important;
|
|
7
|
+
text-align: center !important;
|
|
8
|
+
|
|
9
|
+
border-right: 0px;
|
|
10
|
+
border-left: 0px;
|
|
10
11
|
pointer-events: none;
|
|
11
|
-
|
|
12
|
+
&.ant-input[disabled] {
|
|
13
|
+
background: #fff !important;
|
|
14
|
+
}
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
.@{ant-prefix}-input-status-error {
|
|
@@ -17,8 +20,6 @@
|
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
22
23
|
& .@{ant-prefix}-input-rtl.range-right {
|
|
23
24
|
border-right-width: 0;
|
|
24
25
|
}
|
|
@@ -34,7 +35,7 @@
|
|
|
34
35
|
|
|
35
36
|
.range-left,
|
|
36
37
|
.range-right {
|
|
37
|
-
width
|
|
38
|
+
width: calc(50% - 20px);
|
|
38
39
|
text-align: center;
|
|
39
40
|
}
|
|
40
41
|
|
|
@@ -50,32 +51,32 @@
|
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
.range-right {
|
|
53
|
-
width
|
|
54
|
-
border-top-left-radius
|
|
54
|
+
width: 100%;
|
|
55
|
+
border-top-left-radius: 0;
|
|
55
56
|
border-bottom-left-radius: 0;
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
&.@{ant-prefix}-input-group.@{ant-prefix}-input-group-compact
|
|
60
|
+
&.@{ant-prefix}-input-group.@{ant-prefix}-input-group-compact > *:not(:last-child) {
|
|
60
61
|
margin-right: 0;
|
|
61
62
|
}
|
|
62
63
|
|
|
63
|
-
|
|
64
|
-
border-top-right-radius
|
|
64
|
+
> *:first-child {
|
|
65
|
+
border-top-right-radius: 0 !important;
|
|
65
66
|
border-bottom-right-radius: 0 !important;
|
|
66
67
|
|
|
67
|
-
|
|
68
|
-
border-top-right-radius
|
|
68
|
+
> .@{ant-prefix}-select-selector {
|
|
69
|
+
border-top-right-radius: 0 !important;
|
|
69
70
|
border-bottom-right-radius: 0 !important;
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
|
|
73
|
-
|
|
74
|
-
border-top-left-radius
|
|
74
|
+
> *:last-child {
|
|
75
|
+
border-top-left-radius: 0 !important;
|
|
75
76
|
border-bottom-left-radius: 0 !important;
|
|
76
77
|
|
|
77
|
-
|
|
78
|
-
border-top-left-radius
|
|
78
|
+
> .@{ant-prefix}-select-selector {
|
|
79
|
+
border-top-left-radius: 0 !important;
|
|
79
80
|
border-bottom-left-radius: 0 !important;
|
|
80
81
|
}
|
|
81
82
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ProFormColumnProps } from '../../propsType';
|
|
3
|
+
interface Props<T = any> {
|
|
4
|
+
value?: T;
|
|
5
|
+
onChange?: (value: T, ...rest: any[]) => void;
|
|
6
|
+
confirm: ProFormColumnProps['confirm'];
|
|
7
|
+
[K: string]: any;
|
|
8
|
+
}
|
|
9
|
+
declare const ConfirmWrapper: React.FC<Props>;
|
|
10
|
+
export default ConfirmWrapper;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import "antd/es/modal/style";
|
|
3
|
+
import _Modal from "antd/es/modal";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
+
var _excluded = ["onChange", "children", "confirm"];
|
|
6
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { isFunction, isObject } from 'lodash';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import ProForm from '../../index';
|
|
10
|
+
var defaultConfirmProps = {
|
|
11
|
+
title: '点击确定完成修改'
|
|
12
|
+
};
|
|
13
|
+
var ConfirmWrapper = function ConfirmWrapper(props) {
|
|
14
|
+
var onChange = props.onChange,
|
|
15
|
+
children = props.children,
|
|
16
|
+
confirm = props.confirm,
|
|
17
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
18
|
+
var _ProForm$useFieldProp = ProForm.useFieldProps(),
|
|
19
|
+
form = _ProForm$useFieldProp.form;
|
|
20
|
+
var handleChange = function handleChange(value) {
|
|
21
|
+
for (var _len = arguments.length, other = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
22
|
+
other[_key - 1] = arguments[_key];
|
|
23
|
+
}
|
|
24
|
+
var _value = (value === null || value === void 0 ? void 0 : value.target) ? value.target.value : value;
|
|
25
|
+
if (confirm === true) {
|
|
26
|
+
_Modal.confirm(_objectSpread(_objectSpread({}, defaultConfirmProps), {}, {
|
|
27
|
+
onOk: function onOk() {
|
|
28
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, [_value].concat(other));
|
|
29
|
+
}
|
|
30
|
+
}));
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (isFunction(confirm)) {
|
|
34
|
+
var confirmProps = isFunction(confirm) && confirm(form.getFieldsValue());
|
|
35
|
+
if (confirmProps === true) {
|
|
36
|
+
_Modal.confirm(_objectSpread(_objectSpread({}, defaultConfirmProps), {}, {
|
|
37
|
+
onOk: function onOk() {
|
|
38
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, [_value].concat(other));
|
|
39
|
+
}
|
|
40
|
+
}));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (isObject(confirmProps)) {
|
|
44
|
+
_Modal.confirm(_objectSpread(_objectSpread(_objectSpread({}, defaultConfirmProps), confirmProps), {}, {
|
|
45
|
+
onOk: function onOk() {
|
|
46
|
+
for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
47
|
+
arg[_key2] = arguments[_key2];
|
|
48
|
+
}
|
|
49
|
+
confirmProps === null || confirmProps === void 0 ? void 0 : confirmProps.onOk.apply(confirmProps, arg);
|
|
50
|
+
onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, [_value].concat(other));
|
|
51
|
+
}
|
|
52
|
+
}));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, [_value].concat(other));
|
|
57
|
+
};
|
|
58
|
+
return _jsx(_Fragment, {
|
|
59
|
+
children: /*#__PURE__*/React.isValidElement(children) && /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, rest), {}, {
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
value: rest.value === undefined ? null : rest.value,
|
|
62
|
+
onChange: handleChange
|
|
63
|
+
}))
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
export default ConfirmWrapper;
|