@kne/react-form-antd 2.1.35 → 2.1.37
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.css +8 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +222 -128
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +210 -141
- package/dist/index.modern.js.map +1 -1
- package/package.json +22 -21
package/dist/index.modern.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { forwardRef, useRef, useState, useEffect, useMemo, useCallback, useImperativeHandle } from 'react';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import classnames from 'classnames';
|
|
4
5
|
import ReactForm__default, { preset as preset$2, useSubmit, useReset } from '@kne/react-form';
|
|
@@ -7,7 +8,8 @@ import { preset as preset$1, widget, hooks, hoc } from '@kne/react-form-helper';
|
|
|
7
8
|
export { hooks, utils, widget } from '@kne/react-form-helper';
|
|
8
9
|
import merge from 'lodash/merge';
|
|
9
10
|
import get from 'lodash/get';
|
|
10
|
-
import {
|
|
11
|
+
import { Modal, Row, Col, Tooltip, Slider, message, Upload as Upload$1, Cascader as Cascader$2, Checkbox as Checkbox$2, DatePicker as DatePicker$1, Button, Input as Input$1, InputNumber as InputNumber$1, Radio, Select as Select$1, Switch as Switch$2, TimePicker as TimePicker$1, TreeSelect as TreeSelect$1, Space } from 'antd';
|
|
12
|
+
import withLayer from '@kne/with-layer';
|
|
11
13
|
import { LoadingOutlined, PlusOutlined, UploadOutlined } from '@ant-design/icons';
|
|
12
14
|
import AvatarEditor from 'react-avatar-editor';
|
|
13
15
|
import omit from 'lodash/omit';
|
|
@@ -19,7 +21,7 @@ import groupBy from 'lodash/groupBy';
|
|
|
19
21
|
import uniqueId from 'lodash/uniqueId';
|
|
20
22
|
|
|
21
23
|
function _extends() {
|
|
22
|
-
_extends = Object.assign
|
|
24
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
23
25
|
for (var i = 1; i < arguments.length; i++) {
|
|
24
26
|
var source = arguments[i];
|
|
25
27
|
|
|
@@ -32,7 +34,6 @@ function _extends() {
|
|
|
32
34
|
|
|
33
35
|
return target;
|
|
34
36
|
};
|
|
35
|
-
|
|
36
37
|
return _extends.apply(this, arguments);
|
|
37
38
|
}
|
|
38
39
|
|
|
@@ -96,7 +97,7 @@ var preset = (props => {
|
|
|
96
97
|
preset$2(globalParams.rules);
|
|
97
98
|
});
|
|
98
99
|
|
|
99
|
-
const _excluded$
|
|
100
|
+
const _excluded$9 = ["className", "cache", "enterSubmit", "scrollToError", "scrollProps", "type", "size", "children"];
|
|
100
101
|
const {
|
|
101
102
|
ScrollToError,
|
|
102
103
|
EnterSubmit,
|
|
@@ -113,7 +114,7 @@ const Form = forwardRef((originProps, ref) => {
|
|
|
113
114
|
scrollProps,
|
|
114
115
|
children
|
|
115
116
|
} = originProps,
|
|
116
|
-
props = _objectWithoutPropertiesLoose(originProps, _excluded$
|
|
117
|
+
props = _objectWithoutPropertiesLoose(originProps, _excluded$9);
|
|
117
118
|
|
|
118
119
|
const baseClass = 'react-form';
|
|
119
120
|
let computedClass = baseClass;
|
|
@@ -133,24 +134,24 @@ const Form = forwardRef((originProps, ref) => {
|
|
|
133
134
|
computedClass += `--${size}`;
|
|
134
135
|
}
|
|
135
136
|
|
|
136
|
-
const maxLabel = /*#__PURE__*/
|
|
137
|
-
return /*#__PURE__*/
|
|
137
|
+
const maxLabel = /*#__PURE__*/React__default.createElement(MaxLabelProvider, null, children);
|
|
138
|
+
return /*#__PURE__*/React__default.createElement("form", {
|
|
138
139
|
className: classnames(baseClass, computedClass, className),
|
|
139
140
|
onSubmit: e => {
|
|
140
141
|
e.preventDefault();
|
|
141
142
|
e.stopPropagation();
|
|
142
143
|
}
|
|
143
|
-
}, /*#__PURE__*/
|
|
144
|
+
}, /*#__PURE__*/React__default.createElement(SizeProvider, {
|
|
144
145
|
value: {
|
|
145
146
|
size
|
|
146
147
|
}
|
|
147
|
-
}, /*#__PURE__*/
|
|
148
|
+
}, /*#__PURE__*/React__default.createElement(ReactForm__default, _extends({}, props, {
|
|
148
149
|
ref: ref
|
|
149
|
-
}), cache ? /*#__PURE__*/
|
|
150
|
+
}), cache ? /*#__PURE__*/React__default.createElement(FormStore, {
|
|
150
151
|
cache: cache
|
|
151
|
-
}) : null, scrollToError ? /*#__PURE__*/
|
|
152
|
+
}) : null, scrollToError ? /*#__PURE__*/React__default.createElement(ScrollToError, {
|
|
152
153
|
scrollProps: scrollProps
|
|
153
|
-
}) : null, enterSubmit ? /*#__PURE__*/
|
|
154
|
+
}) : null, enterSubmit ? /*#__PURE__*/React__default.createElement(EnterSubmit, null, maxLabel) : maxLabel)));
|
|
154
155
|
});
|
|
155
156
|
Form.defaultProps = {
|
|
156
157
|
scrollToError: true,
|
|
@@ -172,10 +173,160 @@ Form.propTypes = {
|
|
|
172
173
|
})
|
|
173
174
|
};
|
|
174
175
|
|
|
176
|
+
const RotateIcon = props => /*#__PURE__*/React.createElement("svg", _extends({
|
|
177
|
+
width: "1em",
|
|
178
|
+
height: "1em",
|
|
179
|
+
viewBox: "0 0 14 14",
|
|
180
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
181
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink"
|
|
182
|
+
}, props), /*#__PURE__*/React.createElement("title", null, "\u65CB\u8F6C"), /*#__PURE__*/React.createElement("g", {
|
|
183
|
+
id: "PC\\u7AEF",
|
|
184
|
+
stroke: "none",
|
|
185
|
+
strokeWidth: 1,
|
|
186
|
+
fill: "none",
|
|
187
|
+
fillRule: "evenodd"
|
|
188
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
189
|
+
id: "\\u56FE\\u6807",
|
|
190
|
+
transform: "translate(-77.000000, -1567.000000)",
|
|
191
|
+
fill: "#222222",
|
|
192
|
+
fillRule: "nonzero"
|
|
193
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
194
|
+
id: "\\u65CB\\u8F6C",
|
|
195
|
+
transform: "translate(77.000000, 1567.000000)"
|
|
196
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
197
|
+
d: "M9.16414904,5.6345426 C9.35110931,5.6345426 9.53041217,5.70881228 9.66261304,5.84101315 C9.79481391,5.97321402 9.86908359,6.15251688 9.86908359,6.33947715 L9.86908359,12.683888 C9.86908359,13.0732126 9.55347364,13.3888226 9.16414904,13.3888226 L0.704934547,13.3888226 C0.315609953,13.3888226 1.8189894e-12,13.0732126 1.8189894e-12,12.683888 L1.8189894e-12,6.33947715 C1.8189894e-12,6.15251688 0.0742696765,5.97321402 0.206470548,5.84101315 C0.33867142,5.70881228 0.517974281,5.6345426 0.704934547,5.6345426 L9.16414904,5.6345426 Z M8.4592145,7.04441168 L1.40986909,7.04441168 L1.40986909,11.9789535 L8.4592145,11.9789535 L8.4592145,7.04441168 Z M7.58258803,0.714885198 C7.63035214,0.738767256 7.66052367,0.787585825 7.66052367,0.840987728 L7.66052367,2.02739256 C11.1625178,2.03011634 14,4.86980822 14,8.37180343 C14,8.62367799 13.8656872,8.85643618 13.6475639,8.98238459 C13.4294405,9.108333 13.1606904,9.108333 12.942567,8.98238459 C12.7244437,8.85643618 12.5900924,8.62367799 12.5901309,8.37180343 C12.5901323,5.64845715 10.3838686,3.43998499 7.66052367,3.43726164 L7.66052367,4.50664733 C7.66052367,4.56004923 7.63035214,4.6088678 7.58258803,4.63274986 C7.53482391,4.65663192 7.47766614,4.65147801 7.43494462,4.61943686 L4.99093655,2.78660706 C4.95543522,2.75998107 4.93454178,2.71819419 4.93454178,2.67381753 C4.93454178,2.62944087 4.95543522,2.58765399 4.99093655,2.561028 L7.43494462,0.728198195 C7.47766614,0.696157053 7.53482391,0.691003139 7.58258803,0.714885198 Z",
|
|
198
|
+
id: "\\u5F62\\u72B6\\u7ED3\\u5408"
|
|
199
|
+
})))));
|
|
200
|
+
|
|
201
|
+
const FullIcon = props => /*#__PURE__*/React.createElement("svg", _extends({
|
|
202
|
+
width: "1em",
|
|
203
|
+
height: "1em",
|
|
204
|
+
viewBox: "0 0 14 14",
|
|
205
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
206
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink"
|
|
207
|
+
}, props), /*#__PURE__*/React.createElement("title", null, "\u5145\u6EE1"), /*#__PURE__*/React.createElement("g", {
|
|
208
|
+
id: "PC\\u7AEF",
|
|
209
|
+
stroke: "none",
|
|
210
|
+
strokeWidth: 1,
|
|
211
|
+
fill: "none",
|
|
212
|
+
fillRule: "evenodd"
|
|
213
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
214
|
+
id: "\\u56FE\\u6807",
|
|
215
|
+
transform: "translate(-145.000000, -1567.000000)",
|
|
216
|
+
fill: "#222222",
|
|
217
|
+
fillRule: "nonzero"
|
|
218
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
219
|
+
id: "\\u5145\\u6EE1",
|
|
220
|
+
transform: "translate(145.000000, 1567.000000)"
|
|
221
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
222
|
+
d: "M12.09375,0 C12.35,0 12.6,0.05 12.8359375,0.15 C13.0640625,0.2453125 13.2671875,0.3828125 13.4421875,0.5578125 C13.6171875,0.7328125 13.7546875,0.9375 13.85,1.1640625 C13.95,1.4 14,1.65 14,1.90625 L14,1.90625 L14,12.09375 C14,12.35 13.95,12.6 13.85,12.8359375 C13.7546875,13.0640625 13.6171875,13.2671875 13.4421875,13.4421875 C13.2671875,13.6171875 13.0625,13.7546875 12.8359375,13.85 C12.6,13.95 12.35,14 12.09375,14 L12.09375,14 L1.90625,14 C1.65,14 1.4,13.95 1.1640625,13.85 C0.9359375,13.7546875 0.7328125,13.6171875 0.5578125,13.4421875 C0.3828125,13.2671875 0.2453125,13.0625 0.15,12.8359375 C0.05,12.6 0,12.35 0,12.09375 L0,12.09375 L0,1.90625 C0,1.65 0.05,1.4 0.15,1.1640625 C0.2453125,0.9359375 0.3828125,0.7328125 0.5578125,0.5578125 C0.7328125,0.3828125 0.9375,0.2453125 1.1640625,0.15 C1.4,0.05 1.65,0 1.90625,0 L1.90625,0 Z M12.09375,1.125 L1.90625,1.125 C1.475,1.125 1.125,1.475 1.125,1.90625 L1.125,1.90625 L1.125,12.09375 C1.125,12.525 1.475,12.875 1.90625,12.875 L1.90625,12.875 L12.09375,12.875 C12.525,12.875 12.875,12.525 12.875,12.09375 L12.875,12.09375 L12.875,1.90625 C12.875,1.475 12.525,1.125 12.09375,1.125 L12.09375,1.125 Z M2.5734375,7.484375 C2.878125,7.490625 3.125,7.740625 3.125,8.046875 L3.125,8.046875 L3.125,10.0640625 L5.1265625,8.0625 C5.3453125,7.84375 5.703125,7.84375 5.921875,8.0625 C6.140625,8.28125 6.140625,8.6390625 5.921875,8.8578125 L5.921875,8.8578125 L3.903125,10.875 L5.909375,10.875 C6.2265625,10.875 6.4890625,11.13125 6.484375,11.4484375 C6.478125,11.7546875 6.228125,12 5.921875,12 L5.921875,12 L2.5734375,12 C2.25625,12 2,11.74375 2,11.4265625 L2,11.4265625 L2,8.0578125 C2,7.740625 2.2578125,7.478125 2.5734375,7.484375 Z M11.4296875,2 C11.7453125,2 12,2.25625 12,2.5703125 L12,2.5703125 L12,5.940625 C12,6.2578125 11.7421875,6.5203125 11.4265625,6.5140625 C11.121875,6.5078125 10.875,6.2578125 10.875,5.9515625 L10.875,5.9515625 L10.875,3.9359375 L8.8734375,5.9375 C8.6546875,6.15625 8.296875,6.15625 8.078125,5.9375 C7.859375,5.71875 7.859375,5.3609375 8.078125,5.1421875 L8.078125,5.1421875 L10.0953125,3.125 L8.0890625,3.125 C7.771875,3.125 7.509375,2.86875 7.515625,2.5515625 C7.521875,2.2453125 7.771875,2 8.078125,2 L8.078125,2 Z",
|
|
223
|
+
id: "\\u5F62\\u72B6\\u7ED3\\u5408"
|
|
224
|
+
})))));
|
|
225
|
+
|
|
226
|
+
const getPopupContainer = triggerNode => {
|
|
227
|
+
const findAntdPopupContainer = el => {
|
|
228
|
+
if (el === document.body || !el.parentElement) {
|
|
229
|
+
return document.body;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const targetEl = [].slice.call(el.classList, 0).find(className => ['ant-modal-body', 'ant-modal-content', 'ant-popover-content'].indexOf(className) > -1);
|
|
233
|
+
|
|
234
|
+
if (targetEl) {
|
|
235
|
+
return el;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return findAntdPopupContainer(el.parentElement);
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
return findAntdPopupContainer(triggerNode);
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
const _excluded$8 = ["close", "file", "editor", "onComplete"];
|
|
175
245
|
const {
|
|
176
246
|
useOnChange: useOnChange$d
|
|
177
247
|
} = hooks;
|
|
178
248
|
const avatarParams = globalParams.field.avatar;
|
|
249
|
+
const createAvatarEditor = withLayer(_ref => {
|
|
250
|
+
let {
|
|
251
|
+
close,
|
|
252
|
+
file,
|
|
253
|
+
editor,
|
|
254
|
+
onComplete
|
|
255
|
+
} = _ref,
|
|
256
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$8);
|
|
257
|
+
|
|
258
|
+
const editorRef = useRef(null);
|
|
259
|
+
const [rotate, setRotate] = useState(0);
|
|
260
|
+
const [scale, setScale] = useState(() => {
|
|
261
|
+
if (editor.width === editor.height) {
|
|
262
|
+
return 1;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return 0.35;
|
|
266
|
+
});
|
|
267
|
+
return /*#__PURE__*/React__default.createElement(Modal, _extends({}, props, {
|
|
268
|
+
centered: true,
|
|
269
|
+
onOk: () => {
|
|
270
|
+
onComplete && onComplete(editorRef.current.getImage().toDataURL());
|
|
271
|
+
close();
|
|
272
|
+
}
|
|
273
|
+
}), editor.tips ? /*#__PURE__*/React__default.createElement("div", {
|
|
274
|
+
className: "react-form-avatar-tips"
|
|
275
|
+
}, editor.tips) : null, /*#__PURE__*/React__default.createElement("div", {
|
|
276
|
+
style: {
|
|
277
|
+
"width": editor.width,
|
|
278
|
+
"margin": "auto"
|
|
279
|
+
}
|
|
280
|
+
}, /*#__PURE__*/React__default.createElement(AvatarEditor, {
|
|
281
|
+
ref: editorRef,
|
|
282
|
+
image: file,
|
|
283
|
+
width: editor.width,
|
|
284
|
+
height: editor.height,
|
|
285
|
+
border: 1,
|
|
286
|
+
borderRadius: editor.borderRadius,
|
|
287
|
+
color: [24, 144, 255, 1] // RGBA
|
|
288
|
+
,
|
|
289
|
+
scale: scale,
|
|
290
|
+
rotate: rotate
|
|
291
|
+
}), /*#__PURE__*/React__default.createElement(Row, {
|
|
292
|
+
gutter: 4,
|
|
293
|
+
align: "middle"
|
|
294
|
+
}, /*#__PURE__*/React__default.createElement(Col, {
|
|
295
|
+
span: 4
|
|
296
|
+
}, /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
297
|
+
title: "\u65CB\u8F6C",
|
|
298
|
+
getPopupContainer: getPopupContainer
|
|
299
|
+
}, /*#__PURE__*/React__default.createElement(RotateIcon, {
|
|
300
|
+
className: "react-form-avatar-btn",
|
|
301
|
+
onClick: () => {
|
|
302
|
+
setRotate(rotate => {
|
|
303
|
+
return rotate + 90;
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
}))), /*#__PURE__*/React__default.createElement(Col, {
|
|
307
|
+
span: 4
|
|
308
|
+
}, /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
309
|
+
title: "\u5145\u6EE1",
|
|
310
|
+
getPopupContainer: getPopupContainer
|
|
311
|
+
}, /*#__PURE__*/React__default.createElement(FullIcon, {
|
|
312
|
+
className: "react-form-avatar-btn",
|
|
313
|
+
onClick: () => {
|
|
314
|
+
setScale(1);
|
|
315
|
+
}
|
|
316
|
+
}))), /*#__PURE__*/React__default.createElement(Col, {
|
|
317
|
+
flex: 1
|
|
318
|
+
}, /*#__PURE__*/React__default.createElement(Slider, {
|
|
319
|
+
tooltip: {
|
|
320
|
+
formatter: () => '大小',
|
|
321
|
+
getPopupContainer
|
|
322
|
+
},
|
|
323
|
+
value: scale,
|
|
324
|
+
step: 0.05,
|
|
325
|
+
min: 0.2,
|
|
326
|
+
max: 3,
|
|
327
|
+
onChange: setScale
|
|
328
|
+
})))));
|
|
329
|
+
});
|
|
179
330
|
|
|
180
331
|
const _Avatar = ({
|
|
181
332
|
className,
|
|
@@ -190,13 +341,14 @@ const _Avatar = ({
|
|
|
190
341
|
extraRender,
|
|
191
342
|
onError,
|
|
192
343
|
openEditor,
|
|
344
|
+
editorTips,
|
|
193
345
|
editor: targetEditor,
|
|
194
346
|
previewImg,
|
|
195
347
|
previewRender
|
|
196
348
|
}) => {
|
|
197
349
|
const [loading, setLoading] = useState(false);
|
|
198
350
|
const [showImageUrl, setImageUrl] = useState(imageUrl);
|
|
199
|
-
|
|
351
|
+
useRef();
|
|
200
352
|
const defaultEditor = {
|
|
201
353
|
open: false,
|
|
202
354
|
width: 250,
|
|
@@ -204,10 +356,12 @@ const _Avatar = ({
|
|
|
204
356
|
borderRadius: 1,
|
|
205
357
|
text: "确定",
|
|
206
358
|
cancelText: '取消',
|
|
207
|
-
title: "裁剪图片"
|
|
359
|
+
title: "裁剪图片",
|
|
360
|
+
tips: null
|
|
208
361
|
};
|
|
209
362
|
const editor = merge({}, defaultEditor, {
|
|
210
|
-
open: openEditor
|
|
363
|
+
open: openEditor,
|
|
364
|
+
tips: editorTips
|
|
211
365
|
}, targetEditor);
|
|
212
366
|
useEffect(() => {
|
|
213
367
|
setImageUrl(imageUrl);
|
|
@@ -233,71 +387,7 @@ const _Avatar = ({
|
|
|
233
387
|
});
|
|
234
388
|
};
|
|
235
389
|
|
|
236
|
-
const
|
|
237
|
-
file
|
|
238
|
-
}) => {
|
|
239
|
-
const [rotate, setRotate] = useState(0);
|
|
240
|
-
const [scale, setScale] = useState(() => {
|
|
241
|
-
if (editor.width === editor.height) {
|
|
242
|
-
return 1;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
return 0.35;
|
|
246
|
-
});
|
|
247
|
-
|
|
248
|
-
const onChange = v => {
|
|
249
|
-
setRotate(v);
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
const onChangeScale = v => {
|
|
253
|
-
setScale(v);
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
257
|
-
style: {
|
|
258
|
-
"width": editor.width,
|
|
259
|
-
"margin": "auto"
|
|
260
|
-
}
|
|
261
|
-
}, /*#__PURE__*/React.createElement(AvatarEditor, {
|
|
262
|
-
ref: editorRef,
|
|
263
|
-
image: file,
|
|
264
|
-
width: editor.width,
|
|
265
|
-
height: editor.height,
|
|
266
|
-
border: 1,
|
|
267
|
-
borderRadius: editor.borderRadius,
|
|
268
|
-
color: [24, 144, 255, 1] // RGBA
|
|
269
|
-
,
|
|
270
|
-
scale: scale,
|
|
271
|
-
rotate: rotate
|
|
272
|
-
}), /*#__PURE__*/React.createElement(Row, {
|
|
273
|
-
gutter: 4
|
|
274
|
-
}, /*#__PURE__*/React.createElement(Col, {
|
|
275
|
-
span: 4
|
|
276
|
-
}, /*#__PURE__*/React.createElement("span", null, "\u65CB\u8F6C")), /*#__PURE__*/React.createElement(Col, {
|
|
277
|
-
span: 15
|
|
278
|
-
}, /*#__PURE__*/React.createElement(Slider, {
|
|
279
|
-
tooltipVisible: false,
|
|
280
|
-
defaultValue: rotate,
|
|
281
|
-
min: -180,
|
|
282
|
-
max: 180,
|
|
283
|
-
onChange: onChange
|
|
284
|
-
}))), /*#__PURE__*/React.createElement(Row, {
|
|
285
|
-
gutter: 4
|
|
286
|
-
}, /*#__PURE__*/React.createElement(Col, {
|
|
287
|
-
span: 4
|
|
288
|
-
}, /*#__PURE__*/React.createElement("span", null, "\u653E\u5927")), /*#__PURE__*/React.createElement(Col, {
|
|
289
|
-
span: 15
|
|
290
|
-
}, /*#__PURE__*/React.createElement(Slider, {
|
|
291
|
-
tooltipVisible: false,
|
|
292
|
-
defaultValue: scale,
|
|
293
|
-
step: 0.05,
|
|
294
|
-
min: 0.2,
|
|
295
|
-
max: 3,
|
|
296
|
-
onChange: onChangeScale
|
|
297
|
-
}))));
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
const uploadButton = /*#__PURE__*/React.createElement("div", null, loading ? /*#__PURE__*/React.createElement(LoadingOutlined, null) : /*#__PURE__*/React.createElement(PlusOutlined, null), children);
|
|
390
|
+
const uploadButton = /*#__PURE__*/React__default.createElement("div", null, loading ? /*#__PURE__*/React__default.createElement(LoadingOutlined, null) : /*#__PURE__*/React__default.createElement(PlusOutlined, null), children);
|
|
301
391
|
|
|
302
392
|
const beforeUpload = async file => {
|
|
303
393
|
return new Promise((resolve, reject) => {
|
|
@@ -327,17 +417,15 @@ const _Avatar = ({
|
|
|
327
417
|
|
|
328
418
|
|
|
329
419
|
if (editor.open) {
|
|
330
|
-
|
|
420
|
+
createAvatarEditor({
|
|
421
|
+
editor,
|
|
422
|
+
file,
|
|
331
423
|
title: editor.title,
|
|
332
424
|
icon: "",
|
|
333
425
|
width: editor.width * 2,
|
|
334
|
-
content: /*#__PURE__*/React.createElement(AvatarEditorBox, {
|
|
335
|
-
file: file
|
|
336
|
-
}),
|
|
337
426
|
cancelText: editor.cancelText,
|
|
338
427
|
okText: editor.text,
|
|
339
|
-
|
|
340
|
-
let base64 = editorRef.current.getImage().toDataURL();
|
|
428
|
+
onComplete: base64 => {
|
|
341
429
|
setImageUrl(base64);
|
|
342
430
|
let blob = dataURLtoBlob(base64);
|
|
343
431
|
const files = new window.File([blob], file.name, {
|
|
@@ -345,7 +433,6 @@ const _Avatar = ({
|
|
|
345
433
|
});
|
|
346
434
|
onBeforeUpload && onBeforeUpload(files);
|
|
347
435
|
resolve(files);
|
|
348
|
-
close();
|
|
349
436
|
}
|
|
350
437
|
});
|
|
351
438
|
} else {
|
|
@@ -379,7 +466,7 @@ const _Avatar = ({
|
|
|
379
466
|
Object.assign(headers, avatarParams.getHeaders());
|
|
380
467
|
}
|
|
381
468
|
|
|
382
|
-
return /*#__PURE__*/
|
|
469
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Upload$1, _extends({}, omit(avatarParams, ['action', 'transformResponse', 'headers', 'getHeaders']), {
|
|
383
470
|
headers: headers,
|
|
384
471
|
className: classnames(className, "react-form-avatar"),
|
|
385
472
|
listType: "picture-card",
|
|
@@ -387,11 +474,11 @@ const _Avatar = ({
|
|
|
387
474
|
action: action || avatarParams.action,
|
|
388
475
|
beforeUpload: beforeUpload,
|
|
389
476
|
onChange: onChange
|
|
390
|
-
}), /*#__PURE__*/
|
|
477
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
391
478
|
className: "react-form-avatar-inner"
|
|
392
|
-
}, previewImg && showImageUrl ? previewRender ? previewRender(showImageUrl) : /*#__PURE__*/
|
|
479
|
+
}, previewImg && showImageUrl ? previewRender ? previewRender(showImageUrl) : /*#__PURE__*/React__default.createElement("div", {
|
|
393
480
|
className: "preview"
|
|
394
|
-
}, /*#__PURE__*/
|
|
481
|
+
}, /*#__PURE__*/React__default.createElement("img", {
|
|
395
482
|
src: showImageUrl,
|
|
396
483
|
alt: "avatar"
|
|
397
484
|
})) : uploadButton, extraRender ? extraRender(showImageUrl) : '')));
|
|
@@ -401,7 +488,7 @@ _Avatar.defaultProps = {
|
|
|
401
488
|
imageType: ["image/jpeg", "image/png"],
|
|
402
489
|
fileSize: 2,
|
|
403
490
|
// 单位MB
|
|
404
|
-
children: /*#__PURE__*/
|
|
491
|
+
children: /*#__PURE__*/React__default.createElement("div", {
|
|
405
492
|
className: "ant-upload-text"
|
|
406
493
|
}, "\u70B9\u51FB\u4E0A\u4F20"),
|
|
407
494
|
extraRender: null,
|
|
@@ -468,24 +555,6 @@ CheckboxGroup$1.defaultProps = {
|
|
|
468
555
|
fieldName: 'checkboxGroup'
|
|
469
556
|
};
|
|
470
557
|
|
|
471
|
-
const getPopupContainer = triggerNode => {
|
|
472
|
-
const findAntdPopupContainer = el => {
|
|
473
|
-
if (el === document.body || !el.parentElement) {
|
|
474
|
-
return document.body;
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
const targetEl = [].slice.call(el.classList, 0).find(className => ['ant-modal-body', 'ant-modal-content', 'ant-popover-content'].indexOf(className) > -1);
|
|
478
|
-
|
|
479
|
-
if (targetEl) {
|
|
480
|
-
return el;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
return findAntdPopupContainer(el.parentElement);
|
|
484
|
-
};
|
|
485
|
-
|
|
486
|
-
return findAntdPopupContainer(triggerNode);
|
|
487
|
-
};
|
|
488
|
-
|
|
489
558
|
const {
|
|
490
559
|
useOnChange: useOnChange$9
|
|
491
560
|
} = hooks;
|
|
@@ -592,7 +661,7 @@ const PickerToday = _ref => {
|
|
|
592
661
|
};
|
|
593
662
|
|
|
594
663
|
const foot = () => {
|
|
595
|
-
return /*#__PURE__*/
|
|
664
|
+
return /*#__PURE__*/React__default.createElement(Button, {
|
|
596
665
|
type: newData.showZj ? 'primary' : 'default',
|
|
597
666
|
onClick: v => {
|
|
598
667
|
ref_d.current.blur();
|
|
@@ -601,20 +670,20 @@ const PickerToday = _ref => {
|
|
|
601
670
|
}, soFarText || '至今');
|
|
602
671
|
};
|
|
603
672
|
|
|
604
|
-
return /*#__PURE__*/
|
|
673
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
605
674
|
style: {
|
|
606
675
|
display: 'flex'
|
|
607
676
|
}
|
|
608
|
-
}, /*#__PURE__*/
|
|
677
|
+
}, /*#__PURE__*/React__default.createElement(DatePicker$1, _extends({}, _extends({
|
|
609
678
|
showToday: false
|
|
610
679
|
}, props, {
|
|
611
680
|
placeholder: newData.placeholder[0],
|
|
612
681
|
value: newData.start
|
|
613
682
|
}), {
|
|
614
683
|
onChange: startChange
|
|
615
|
-
})), /*#__PURE__*/
|
|
684
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
616
685
|
className: 'svg_box'
|
|
617
|
-
}, /*#__PURE__*/
|
|
686
|
+
}, /*#__PURE__*/React__default.createElement("svg", {
|
|
618
687
|
viewBox: "0 0 1024 1024",
|
|
619
688
|
focusable: "false",
|
|
620
689
|
"data-icon": "swap-right",
|
|
@@ -622,13 +691,13 @@ const PickerToday = _ref => {
|
|
|
622
691
|
height: "1em",
|
|
623
692
|
fill: "currentColor",
|
|
624
693
|
"aria-hidden": "true"
|
|
625
|
-
}, /*#__PURE__*/
|
|
694
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
626
695
|
d: "M873.1 596.2l-164-208A32 32 0 00684 376h-64.8c-6.7 0-10.4 7.7-6.3 13l144.3 183H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h695.9c26.8 0 41.7-30.8 25.2-51.8z"
|
|
627
|
-
}))), /*#__PURE__*/
|
|
696
|
+
}))), /*#__PURE__*/React__default.createElement("div", {
|
|
628
697
|
className: newData.showZj ? 'data_range_picker data_range_picker_dis' : 'data_range_picker'
|
|
629
|
-
}, /*#__PURE__*/
|
|
698
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
630
699
|
className: newData.showZj ? 'zhijin zhijin_show' : 'zhijin'
|
|
631
|
-
}, soFarText || '至今'), /*#__PURE__*/
|
|
700
|
+
}, soFarText || '至今'), /*#__PURE__*/React__default.createElement(DatePicker$1, _extends({}, _extends({
|
|
632
701
|
showToday: false
|
|
633
702
|
}, props, {
|
|
634
703
|
placeholder: newData.showZj ? '' : newData.placeholder[1],
|
|
@@ -707,7 +776,7 @@ const RadioGroup$1 = _ref => {
|
|
|
707
776
|
const handler = useCallback(e => {
|
|
708
777
|
onChange && onChange(e.target.value);
|
|
709
778
|
}, [onChange]);
|
|
710
|
-
return /*#__PURE__*/
|
|
779
|
+
return /*#__PURE__*/React__default.createElement(Radio.Group, _extends({}, props, {
|
|
711
780
|
onChange: handler
|
|
712
781
|
}));
|
|
713
782
|
};
|
|
@@ -765,7 +834,7 @@ const withFetch = WrappedComponent => {
|
|
|
765
834
|
useEffect(() => {
|
|
766
835
|
onLoaded && onLoaded(dataRef.current);
|
|
767
836
|
}, []);
|
|
768
|
-
return /*#__PURE__*/
|
|
837
|
+
return /*#__PURE__*/React__default.createElement(WrappedComponent, _extends({}, props, children({
|
|
769
838
|
data,
|
|
770
839
|
fetchProps,
|
|
771
840
|
loadMore,
|
|
@@ -801,7 +870,7 @@ const withFetch = WrappedComponent => {
|
|
|
801
870
|
});
|
|
802
871
|
Fetch.field = forwardRef((props, ref) => {
|
|
803
872
|
const emitter = useFetchEmitter(ref);
|
|
804
|
-
return /*#__PURE__*/
|
|
873
|
+
return /*#__PURE__*/React__default.createElement(FieldInner, _extends({}, props, {
|
|
805
874
|
fetchEmitter: emitter
|
|
806
875
|
}));
|
|
807
876
|
});
|
|
@@ -866,7 +935,7 @@ const _SelectFetch = withFetch$1(_ref => {
|
|
|
866
935
|
useEffect(() => {
|
|
867
936
|
onLoaded && onLoaded(dataRef.current);
|
|
868
937
|
}, []);
|
|
869
|
-
return /*#__PURE__*/
|
|
938
|
+
return /*#__PURE__*/React__default.createElement(Select$1, props, children({
|
|
870
939
|
data,
|
|
871
940
|
refresh,
|
|
872
941
|
isLoading,
|
|
@@ -899,7 +968,7 @@ SelectFetch$1.field = forwardRef((props, ref) => {
|
|
|
899
968
|
setData: data => emitter.emit('select-fetch-set-data', data)
|
|
900
969
|
};
|
|
901
970
|
}, [emitter]);
|
|
902
|
-
return /*#__PURE__*/
|
|
971
|
+
return /*#__PURE__*/React__default.createElement(_SelectFetch, _extends({}, props, {
|
|
903
972
|
emitter: emitter
|
|
904
973
|
}));
|
|
905
974
|
});
|
|
@@ -1135,7 +1204,7 @@ const _Upload = _ref => {
|
|
|
1135
1204
|
}
|
|
1136
1205
|
|
|
1137
1206
|
const UploadComponent = drag ? Dragger : Upload$1;
|
|
1138
|
-
return /*#__PURE__*/
|
|
1207
|
+
return /*#__PURE__*/React__default.createElement(UploadComponent, _extends({}, omit(uploadParams, ['action', 'transformResponse']), {
|
|
1139
1208
|
headers: headers,
|
|
1140
1209
|
action: action || uploadParams.action,
|
|
1141
1210
|
fileList: valueList,
|
|
@@ -1154,9 +1223,9 @@ _Upload.defaultProps = {
|
|
|
1154
1223
|
maxLength: 1,
|
|
1155
1224
|
children: ({
|
|
1156
1225
|
size
|
|
1157
|
-
}) => /*#__PURE__*/
|
|
1226
|
+
}) => /*#__PURE__*/React__default.createElement(Button, {
|
|
1158
1227
|
size: size
|
|
1159
|
-
}, /*#__PURE__*/
|
|
1228
|
+
}, /*#__PURE__*/React__default.createElement(UploadOutlined, null), "\u70B9\u51FB\u4E0A\u4F20"),
|
|
1160
1229
|
onError: info => message.error(info),
|
|
1161
1230
|
onUploadComplete: () => {}
|
|
1162
1231
|
};
|
|
@@ -1188,7 +1257,7 @@ const SubmitButton = _ref => {
|
|
|
1188
1257
|
} = _useSubmit,
|
|
1189
1258
|
submitProps = _objectWithoutPropertiesLoose(_useSubmit, _excluded2$1);
|
|
1190
1259
|
|
|
1191
|
-
return /*#__PURE__*/
|
|
1260
|
+
return /*#__PURE__*/React__default.createElement(Button, _extends({
|
|
1192
1261
|
loading: isLoading,
|
|
1193
1262
|
disabled: disabled || (realTime ? !isPass : false)
|
|
1194
1263
|
}, submitProps, props));
|
|
@@ -1201,7 +1270,7 @@ SubmitButton.defaultProps = {
|
|
|
1201
1270
|
|
|
1202
1271
|
const ResetButton = props => {
|
|
1203
1272
|
const resetProps = useReset();
|
|
1204
|
-
return /*#__PURE__*/
|
|
1273
|
+
return /*#__PURE__*/React__default.createElement(Button, _extends({}, resetProps, props));
|
|
1205
1274
|
};
|
|
1206
1275
|
|
|
1207
1276
|
const _excluded$1 = ["onClick"];
|
|
@@ -1216,7 +1285,7 @@ const CancelButton = _ref => {
|
|
|
1216
1285
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
1217
1286
|
|
|
1218
1287
|
const remove = useCacheRemove();
|
|
1219
|
-
return /*#__PURE__*/
|
|
1288
|
+
return /*#__PURE__*/React__default.createElement(Button, _extends({}, props, {
|
|
1220
1289
|
onClick: (...args) => {
|
|
1221
1290
|
remove();
|
|
1222
1291
|
onClick && onClick(...args);
|
|
@@ -1236,17 +1305,17 @@ const CommonModal = forwardRef(({
|
|
|
1236
1305
|
children
|
|
1237
1306
|
}, ref) => {
|
|
1238
1307
|
const TargetForm = formProps.hasOwnProperty('url') ? FetchForm : Form;
|
|
1239
|
-
return /*#__PURE__*/
|
|
1308
|
+
return /*#__PURE__*/React__default.createElement(TargetForm, _extends({}, formProps, {
|
|
1240
1309
|
ref: ref
|
|
1241
|
-
}), /*#__PURE__*/
|
|
1310
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
1242
1311
|
className: "ant-modal-body"
|
|
1243
|
-
}, children), /*#__PURE__*/
|
|
1312
|
+
}, children), /*#__PURE__*/React__default.createElement("div", {
|
|
1244
1313
|
className: "ant-modal-footer"
|
|
1245
|
-
}, footer ? footer : /*#__PURE__*/
|
|
1314
|
+
}, footer ? footer : /*#__PURE__*/React__default.createElement(Space, null, isReset ? /*#__PURE__*/React__default.createElement(ResetButton, null, "\u91CD\u7F6E") : /*#__PURE__*/React__default.createElement(CancelButton, {
|
|
1246
1315
|
onClick: () => {
|
|
1247
1316
|
onCancel && onCancel();
|
|
1248
1317
|
}
|
|
1249
|
-
}, "\u53D6\u6D88"), /*#__PURE__*/
|
|
1318
|
+
}, "\u53D6\u6D88"), /*#__PURE__*/React__default.createElement(SubmitButton, {
|
|
1250
1319
|
type: "primary"
|
|
1251
1320
|
}, "\u786E\u5B9A"))));
|
|
1252
1321
|
});
|
|
@@ -1260,10 +1329,10 @@ const FormModal = forwardRef((_ref, ref) => {
|
|
|
1260
1329
|
} = _ref,
|
|
1261
1330
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
1262
1331
|
|
|
1263
|
-
return /*#__PURE__*/
|
|
1332
|
+
return /*#__PURE__*/React__default.createElement(Modal, _extends({}, props, {
|
|
1264
1333
|
className: classnames(className, 'react-form-modal'),
|
|
1265
1334
|
footer: null
|
|
1266
|
-
}), /*#__PURE__*/
|
|
1335
|
+
}), /*#__PURE__*/React__default.createElement(CommonModal, {
|
|
1267
1336
|
ref: ref,
|
|
1268
1337
|
formProps: formProps,
|
|
1269
1338
|
footer: footer,
|
|
@@ -1284,13 +1353,13 @@ FormModal.modal = _ref2 => {
|
|
|
1284
1353
|
props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
1285
1354
|
|
|
1286
1355
|
return Modal.info(_extends({}, props, {
|
|
1287
|
-
title: title ? /*#__PURE__*/
|
|
1356
|
+
title: title ? /*#__PURE__*/React__default.createElement("div", {
|
|
1288
1357
|
className: "ant-modal-header"
|
|
1289
|
-
}, /*#__PURE__*/
|
|
1358
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
1290
1359
|
className: "ant-modal-title"
|
|
1291
1360
|
}, title)) : null,
|
|
1292
1361
|
className: classnames(className, 'react-form-modal'),
|
|
1293
|
-
content: /*#__PURE__*/
|
|
1362
|
+
content: /*#__PURE__*/React__default.createElement(CommonModal, {
|
|
1294
1363
|
formProps: formProps,
|
|
1295
1364
|
footer: footer,
|
|
1296
1365
|
isReset: isReset,
|