@zat-design/sisyphus-react 3.4.0 → 3.4.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +58 -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 +64 -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
|
@@ -25,7 +25,7 @@ var _empty = _interopRequireDefault(require("../assets/empty.png"));
|
|
|
25
25
|
var _locale = _interopRequireWildcard(require("../locale"));
|
|
26
26
|
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"];
|
|
27
27
|
var ProEditTable = function ProEditTable(_ref, ref) {
|
|
28
|
-
var _resetProps$id, _resetProps$id$split, _value$2;
|
|
28
|
+
var _resetProps$id, _resetProps$id$split, _themeConfig$data2, _value$2;
|
|
29
29
|
var value = _ref.value,
|
|
30
30
|
onChange = _ref.onChange,
|
|
31
31
|
className = _ref.className,
|
|
@@ -46,7 +46,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
46
46
|
mulDeletePoConfirmMsg = _ref.mulDeletePoConfirmMsg,
|
|
47
47
|
_ref$otherProps = _ref.otherProps,
|
|
48
48
|
otherProps = _ref$otherProps === void 0 ? {} : _ref$otherProps,
|
|
49
|
-
|
|
49
|
+
configRequiredAlign = _ref.requiredAlign,
|
|
50
50
|
summary = _ref.summary,
|
|
51
51
|
max = _ref.max,
|
|
52
52
|
headerRender = _ref.headerRender,
|
|
@@ -68,6 +68,13 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
68
68
|
getPrefixCls = _React$useContext.getPrefixCls;
|
|
69
69
|
var prefixCls = getPrefixCls();
|
|
70
70
|
disabled = (otherProps === null || otherProps === void 0 ? void 0 : otherProps.disabled) || disabled;
|
|
71
|
+
var _useLocalStorageState = (0, _ahooks.useLocalStorageState)('themeConfig'),
|
|
72
|
+
_useLocalStorageState2 = (0, _slicedToArray2.default)(_useLocalStorageState, 1),
|
|
73
|
+
themeConfig = _useLocalStorageState2[0];
|
|
74
|
+
var requiredAlign = (0, _react.useMemo)(function () {
|
|
75
|
+
var _ref2, _themeConfig$data$zau, _themeConfig$data;
|
|
76
|
+
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';
|
|
77
|
+
}, [themeConfig === null || themeConfig === void 0 ? void 0 : (_themeConfig$data2 = themeConfig.data) === null || _themeConfig$data2 === void 0 ? void 0 : _themeConfig$data2.zauiFormAlign]);
|
|
71
78
|
var _useSetState = (0, _ahooks.useSetState)({
|
|
72
79
|
_columns: columns,
|
|
73
80
|
cellNamePath: [],
|
|
@@ -104,8 +111,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
104
111
|
var getRowKey = function getRowKey(record) {
|
|
105
112
|
var key = record.rowKey || (0, _tools.getRandom)();
|
|
106
113
|
if (rowKey) {
|
|
107
|
-
var
|
|
108
|
-
key = (
|
|
114
|
+
var _ref3;
|
|
115
|
+
key = (_ref3 = typeof rowKey === 'function' ? rowKey(record) : record[rowKey]) !== null && _ref3 !== void 0 ? _ref3 : key;
|
|
109
116
|
}
|
|
110
117
|
return key;
|
|
111
118
|
};
|
|
@@ -229,7 +236,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
229
236
|
return isForbiddenBtn('mulDelete') ? rowSelection : _rowSelection;
|
|
230
237
|
};
|
|
231
238
|
var setColumns = /*#__PURE__*/function () {
|
|
232
|
-
var
|
|
239
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
|
233
240
|
var nextColumns;
|
|
234
241
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
235
242
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -248,7 +255,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
248
255
|
}, _callee);
|
|
249
256
|
}));
|
|
250
257
|
return function setColumns() {
|
|
251
|
-
return
|
|
258
|
+
return _ref4.apply(this, arguments);
|
|
252
259
|
};
|
|
253
260
|
}();
|
|
254
261
|
(0, _ahooks.useDebounceEffect)(function () {
|
|
@@ -358,7 +365,6 @@ ForwardProEditTable.defaultProps = {
|
|
|
358
365
|
type: 'multiple',
|
|
359
366
|
mode: 'multiple',
|
|
360
367
|
insertType: 'after',
|
|
361
|
-
requiredAlign: 'right',
|
|
362
368
|
value: [],
|
|
363
369
|
actionProps: [],
|
|
364
370
|
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
|
}
|
|
@@ -254,8 +254,8 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
|
254
254
|
item.className = (0, _classnames2.default)((0, _defineProperty2.default)({
|
|
255
255
|
'is-hidden': hidden,
|
|
256
256
|
'is-required': required || labelRequired,
|
|
257
|
-
'is-required-
|
|
258
|
-
'is-required-
|
|
257
|
+
'is-required-left': requiredAlign === 'left',
|
|
258
|
+
'is-required-right': requiredAlign === 'right'
|
|
259
259
|
}, className, className));
|
|
260
260
|
// 防止重复渲染导致className重复添加
|
|
261
261
|
if (item.className) {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _ahooks = require("ahooks");
|
|
12
|
+
var _react = require("react");
|
|
13
|
+
var Group = function Group(props) {
|
|
14
|
+
var value = props.value,
|
|
15
|
+
onChange = props.onChange,
|
|
16
|
+
dataSource = props.dataSource,
|
|
17
|
+
fieldValue = props.fieldValue,
|
|
18
|
+
fieldLabel = props.fieldLabel;
|
|
19
|
+
var idx = (0, _react.useRef)(-1);
|
|
20
|
+
var _useSetState = (0, _ahooks.useSetState)({
|
|
21
|
+
checked: ''
|
|
22
|
+
}),
|
|
23
|
+
_useSetState2 = (0, _slicedToArray2.default)(_useSetState, 2),
|
|
24
|
+
state = _useSetState2[0],
|
|
25
|
+
setState = _useSetState2[1];
|
|
26
|
+
(0, _react.useEffect)(function () {
|
|
27
|
+
setState({
|
|
28
|
+
checked: value
|
|
29
|
+
});
|
|
30
|
+
}, [value]);
|
|
31
|
+
var handleClick = function handleClick(val, index) {
|
|
32
|
+
setState({
|
|
33
|
+
checked: val
|
|
34
|
+
});
|
|
35
|
+
idx.current = index;
|
|
36
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(val);
|
|
37
|
+
};
|
|
38
|
+
if (dataSource.length === 0) {
|
|
39
|
+
return (0, _jsxRuntime.jsx)("span", {
|
|
40
|
+
children: "-"
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return (0, _jsxRuntime.jsx)("div", {
|
|
44
|
+
className: "pro-enum-group-root",
|
|
45
|
+
children: dataSource.map(function (item, index) {
|
|
46
|
+
return (0, _jsxRuntime.jsx)("div", {
|
|
47
|
+
onClick: function onClick() {
|
|
48
|
+
if (!item.disabled) {
|
|
49
|
+
handleClick(item[fieldValue], index);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
className: (0, _classnames.default)('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' : ''),
|
|
53
|
+
children: item[fieldLabel]
|
|
54
|
+
}, item[fieldValue]);
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
var _default = exports.default = Group;
|
package/lib/ProEnum/index.js
CHANGED
|
@@ -19,6 +19,7 @@ var _lodash = require("lodash");
|
|
|
19
19
|
var _ProSelect = _interopRequireDefault(require("../ProSelect"));
|
|
20
20
|
var _ProConfigProvider = require("../ProConfigProvider");
|
|
21
21
|
var _Tag = _interopRequireDefault(require("./components/Tag"));
|
|
22
|
+
var _Group = _interopRequireDefault(require("./components/Group"));
|
|
22
23
|
var _Container = _interopRequireDefault(require("../ProForm/components/Container"));
|
|
23
24
|
var _utils = require("./utils");
|
|
24
25
|
var _getEnumLabel = _interopRequireDefault(require("./utils/getEnumLabel"));
|
|
@@ -176,13 +177,27 @@ var ProEnum = function ProEnum(props) {
|
|
|
176
177
|
return (0, _jsxRuntime.jsx)(_antd.Radio.Group, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.omit)(enumProps, ['fieldNames'])), {}, {
|
|
177
178
|
options: list,
|
|
178
179
|
value: value,
|
|
179
|
-
onChange: onChange
|
|
180
|
+
onChange: onChange,
|
|
181
|
+
children: list.map(function (item) {
|
|
182
|
+
return (0, _jsxRuntime.jsx)(_antd.Radio, {
|
|
183
|
+
value: item[fieldValue],
|
|
184
|
+
disabled: !!item.disabled,
|
|
185
|
+
children: item[label]
|
|
186
|
+
}, item[fieldValue]);
|
|
187
|
+
})
|
|
180
188
|
}));
|
|
181
189
|
case 'Checkbox':
|
|
182
190
|
return (0, _jsxRuntime.jsx)(_antd.Checkbox.Group, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.omit)(enumProps, ['fieldNames'])), {}, {
|
|
183
191
|
options: list,
|
|
184
192
|
value: value,
|
|
185
|
-
onChange: onChange
|
|
193
|
+
onChange: onChange,
|
|
194
|
+
children: list.map(function (item) {
|
|
195
|
+
return (0, _jsxRuntime.jsx)(_antd.Checkbox, {
|
|
196
|
+
value: item[fieldValue],
|
|
197
|
+
disabled: !!item.disabled,
|
|
198
|
+
children: item[label]
|
|
199
|
+
}, item[fieldValue]);
|
|
200
|
+
})
|
|
186
201
|
}));
|
|
187
202
|
case 'Tag':
|
|
188
203
|
return (0, _jsxRuntime.jsx)(_Tag.default, {
|
|
@@ -192,6 +207,14 @@ var ProEnum = function ProEnum(props) {
|
|
|
192
207
|
fieldValue: fieldValue,
|
|
193
208
|
dataSource: list
|
|
194
209
|
});
|
|
210
|
+
case 'Group':
|
|
211
|
+
return (0, _jsxRuntime.jsx)(_Group.default, {
|
|
212
|
+
value: value,
|
|
213
|
+
onChange: onChange,
|
|
214
|
+
fieldLabel: label,
|
|
215
|
+
fieldValue: fieldValue,
|
|
216
|
+
dataSource: list
|
|
217
|
+
});
|
|
195
218
|
default:
|
|
196
219
|
return null;
|
|
197
220
|
}
|
|
@@ -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/lib/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
|
}
|
|
@@ -72,12 +72,12 @@ var InputNumber = function InputNumber(props) {
|
|
|
72
72
|
return value;
|
|
73
73
|
}
|
|
74
74
|
return num.toLocaleString('en-US', {
|
|
75
|
-
maximumFractionDigits: (props === null || props === void 0 ? void 0 : props.precision) ||
|
|
75
|
+
maximumFractionDigits: (props === null || props === void 0 ? void 0 : props.precision) || 2
|
|
76
76
|
});
|
|
77
77
|
},
|
|
78
78
|
parser: function parser(value) {
|
|
79
79
|
var num = Number(value.replace(/[\s,]+/g, ''));
|
|
80
|
-
return Number.isNaN(num) ? value : num.toFixed((props === null || props === void 0 ? void 0 : props.precision) ||
|
|
80
|
+
return Number.isNaN(num) ? value : num.toFixed((props === null || props === void 0 ? void 0 : props.precision) || 2);
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
break;
|
|
@@ -62,7 +62,7 @@ var Radio = function Radio(props) {
|
|
|
62
62
|
onChange: function onChange(e) {
|
|
63
63
|
_onChange(e, e.target.value);
|
|
64
64
|
},
|
|
65
|
-
children: !!dataSource.length && dataSource.map(function (radioItem) {
|
|
65
|
+
children: !!(dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) && dataSource.map(function (radioItem) {
|
|
66
66
|
return (0, _jsxRuntime.jsx)(_antd.Radio, {
|
|
67
67
|
value: radioItem[_fieldNames.value],
|
|
68
68
|
children: radioItem[_fieldNames.label]
|
|
@@ -54,19 +54,6 @@ var Select = function Select(props) {
|
|
|
54
54
|
children: value ? transToLabel([value]) : null
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
// 假如dataSource包含code,name, fieldNames没有配置,_fieldNames默认为code, name
|
|
58
|
-
if (Array.isArray(dataSource) && !fieldNames) {
|
|
59
|
-
var _dataSource$filter;
|
|
60
|
-
var hasCodeName = Boolean((_dataSource$filter = dataSource.filter(function (item) {
|
|
61
|
-
return Object.keys(item).includes('code') && Object.keys(item).includes('name');
|
|
62
|
-
})) === null || _dataSource$filter === void 0 ? void 0 : _dataSource$filter.length);
|
|
63
|
-
if (hasCodeName) {
|
|
64
|
-
_fieldNames = {
|
|
65
|
-
label: 'name',
|
|
66
|
-
value: 'code'
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
57
|
return (0, _jsxRuntime.jsx)(_antd.Select, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
71
58
|
placeholder: "".concat(_locale.default.ProForm.selectPlaceHolder),
|
|
72
59
|
allowClear: true,
|
|
@@ -61,6 +61,7 @@ var LineFields = function LineFields(props) {
|
|
|
61
61
|
className: "pro-form-list-drag-handle",
|
|
62
62
|
ref: setActivatorNodeRef,
|
|
63
63
|
children: (0, _jsxRuntime.jsx)(_ProIcon.default, {
|
|
64
|
+
className: "drag-icon",
|
|
64
65
|
type: "drag"
|
|
65
66
|
})
|
|
66
67
|
})), (0, _jsxRuntime.jsx)(_antd.Row, {
|
|
@@ -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,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
var _lodash = require("lodash");
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
var _antd = require("antd");
|
|
14
|
+
var _index = _interopRequireDefault(require("../../index"));
|
|
15
|
+
var _excluded = ["onChange", "children", "confirm"];
|
|
16
|
+
var defaultConfirmProps = {
|
|
17
|
+
title: '操作提示',
|
|
18
|
+
content: '确定要修改该字段吗?'
|
|
19
|
+
};
|
|
20
|
+
var ConfirmWrapper = function ConfirmWrapper(props) {
|
|
21
|
+
var onChange = props.onChange,
|
|
22
|
+
children = props.children,
|
|
23
|
+
confirm = props.confirm,
|
|
24
|
+
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
25
|
+
var _ProForm$useFieldProp = _index.default.useFieldProps(),
|
|
26
|
+
form = _ProForm$useFieldProp.form;
|
|
27
|
+
var handleChange = function handleChange(value) {
|
|
28
|
+
for (var _len = arguments.length, other = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
29
|
+
other[_key - 1] = arguments[_key];
|
|
30
|
+
}
|
|
31
|
+
var _value = (value === null || value === void 0 ? void 0 : value.target) ? value.target.value : value;
|
|
32
|
+
var confirmProps = (0, _lodash.isFunction)(confirm) ? confirm(form.getFieldsValue()) : confirm;
|
|
33
|
+
if (confirmProps === true) {
|
|
34
|
+
_antd.Modal.confirm((0, _objectSpread2.default)((0, _objectSpread2.default)({}, defaultConfirmProps), {}, {
|
|
35
|
+
onOk: function onOk() {
|
|
36
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, [_value].concat(other));
|
|
37
|
+
}
|
|
38
|
+
}));
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if ((0, _lodash.isObject)(confirmProps)) {
|
|
42
|
+
_antd.Modal.confirm((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, defaultConfirmProps), confirmProps), {}, {
|
|
43
|
+
onOk: function onOk() {
|
|
44
|
+
var _confirmProps$onOk;
|
|
45
|
+
for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
46
|
+
arg[_key2] = arguments[_key2];
|
|
47
|
+
}
|
|
48
|
+
(_confirmProps$onOk = confirmProps.onOk) === null || _confirmProps$onOk === void 0 ? void 0 : _confirmProps$onOk.call.apply(_confirmProps$onOk, [confirmProps].concat(arg));
|
|
49
|
+
onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, [_value].concat(other));
|
|
50
|
+
}
|
|
51
|
+
}));
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, [_value].concat(other));
|
|
55
|
+
};
|
|
56
|
+
return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
57
|
+
children: /*#__PURE__*/_react.default.isValidElement(children) && /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, rest), {}, {
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
value: rest.value === undefined ? null : rest.value,
|
|
60
|
+
onChange: handleChange
|
|
61
|
+
}))
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
var _default = exports.default = ConfirmWrapper;
|