@kne/react-form-antd 4.1.2 → 4.1.3
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.js +452 -39
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +455 -61
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,27 +5,45 @@ var reactFormHelper = require('@kne/react-form-helper');
|
|
|
5
5
|
var merge = require('lodash/merge');
|
|
6
6
|
var antd = require('antd');
|
|
7
7
|
var reactIntl = require('@kne/react-intl');
|
|
8
|
-
var icons = require('@ant-design/icons');
|
|
9
8
|
var dayjs = require('dayjs');
|
|
10
9
|
var useControlValue = require('@kne/use-control-value');
|
|
11
10
|
|
|
12
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
12
|
|
|
13
|
+
function _interopNamespace(e) {
|
|
14
|
+
if (e && e.__esModule) return e;
|
|
15
|
+
var n = Object.create(null);
|
|
16
|
+
if (e) {
|
|
17
|
+
Object.keys(e).forEach(function (k) {
|
|
18
|
+
if (k !== 'default') {
|
|
19
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return e[k]; }
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
n["default"] = e;
|
|
28
|
+
return n;
|
|
29
|
+
}
|
|
30
|
+
|
|
14
31
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
32
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
15
33
|
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
16
34
|
var ReactForm__default = /*#__PURE__*/_interopDefaultLegacy(ReactForm);
|
|
17
35
|
var merge__default = /*#__PURE__*/_interopDefaultLegacy(merge);
|
|
18
36
|
var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
|
|
19
37
|
var useControlValue__default = /*#__PURE__*/_interopDefaultLegacy(useControlValue);
|
|
20
38
|
|
|
21
|
-
function _extends() {
|
|
22
|
-
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
39
|
+
function _extends$3() {
|
|
40
|
+
return _extends$3 = Object.assign ? Object.assign.bind() : function (n) {
|
|
23
41
|
for (var e = 1; e < arguments.length; e++) {
|
|
24
42
|
var t = arguments[e];
|
|
25
43
|
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
26
44
|
}
|
|
27
45
|
return n;
|
|
28
|
-
}, _extends.apply(null, arguments);
|
|
46
|
+
}, _extends$3.apply(null, arguments);
|
|
29
47
|
}
|
|
30
48
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
31
49
|
if (null == r) return {};
|
|
@@ -59,7 +77,7 @@ var preset = (function (props) {
|
|
|
59
77
|
ReactForm.preset(globalParams.rules);
|
|
60
78
|
});
|
|
61
79
|
|
|
62
|
-
var _excluded$
|
|
80
|
+
var _excluded$4 = ["className", "cache", "enterSubmit", "scrollToError", "scrollProps", "type", "size", "children"];
|
|
63
81
|
var ScrollToError = reactFormHelper.widget.ScrollToError,
|
|
64
82
|
EnterSubmit = reactFormHelper.widget.EnterSubmit,
|
|
65
83
|
FormStore = reactFormHelper.widget.FormStore,
|
|
@@ -77,7 +95,7 @@ var Form = React.forwardRef(function (originProps, ref) {
|
|
|
77
95
|
block: 'center'
|
|
78
96
|
} : _originProps$scrollPr,
|
|
79
97
|
children = originProps.children,
|
|
80
|
-
props = _objectWithoutPropertiesLoose(originProps, _excluded$
|
|
98
|
+
props = _objectWithoutPropertiesLoose(originProps, _excluded$4);
|
|
81
99
|
var baseClass = 'react-form';
|
|
82
100
|
var computedClass = baseClass;
|
|
83
101
|
var _Object$assign = Object.assign({
|
|
@@ -103,7 +121,7 @@ var Form = React.forwardRef(function (originProps, ref) {
|
|
|
103
121
|
value: {
|
|
104
122
|
size: size
|
|
105
123
|
}
|
|
106
|
-
}, /*#__PURE__*/React__default["default"].createElement(ReactForm__default["default"], _extends({}, props, {
|
|
124
|
+
}, /*#__PURE__*/React__default["default"].createElement(ReactForm__default["default"], _extends$3({}, props, {
|
|
107
125
|
ref: ref
|
|
108
126
|
}), cache ? /*#__PURE__*/React__default["default"].createElement(FormStore, {
|
|
109
127
|
cache: cache
|
|
@@ -132,25 +150,14 @@ var locale = {
|
|
|
132
150
|
SoFar: 'Present'
|
|
133
151
|
};
|
|
134
152
|
|
|
135
|
-
var
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
locale = _ref$locale === void 0 ? 'zh-CN' : _ref$locale,
|
|
144
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
145
|
-
var messages = localeMap[locale] || locale$1;
|
|
146
|
-
return /*#__PURE__*/React__default["default"].createElement(reactIntl.IntlProvider, {
|
|
147
|
-
locale: locale,
|
|
148
|
-
messages: messages
|
|
149
|
-
}, /*#__PURE__*/React__default["default"].createElement(WrappedComponent, props));
|
|
150
|
-
};
|
|
151
|
-
WithLocaleComponent.displayName = "withLocale(" + (WrappedComponent.displayName || WrappedComponent.name || 'Component') + ")";
|
|
152
|
-
return WithLocaleComponent;
|
|
153
|
-
};
|
|
153
|
+
var withLocale = reactIntl.createWithIntlProvider({
|
|
154
|
+
defaultLocale: 'zh-CN',
|
|
155
|
+
messages: {
|
|
156
|
+
'zh-CN': locale$1,
|
|
157
|
+
'en-US': locale
|
|
158
|
+
},
|
|
159
|
+
namespace: 'react-form-antd'
|
|
160
|
+
});
|
|
154
161
|
|
|
155
162
|
var useOnChange$b = reactFormHelper.hooks.useOnChange;
|
|
156
163
|
var TreeSelectInner = function TreeSelectInner(props) {
|
|
@@ -274,7 +281,7 @@ var RadioGroup = function RadioGroup(_ref) {
|
|
|
274
281
|
var handler = React.useCallback(function (e) {
|
|
275
282
|
onChange && onChange(e.target.value);
|
|
276
283
|
}, [onChange]);
|
|
277
|
-
return /*#__PURE__*/React__default["default"].createElement(antd.Radio.Group, _extends({}, props, {
|
|
284
|
+
return /*#__PURE__*/React__default["default"].createElement(antd.Radio.Group, _extends$3({}, props, {
|
|
278
285
|
onChange: handler
|
|
279
286
|
}));
|
|
280
287
|
};
|
|
@@ -343,7 +350,409 @@ PasswordInner.Field = antd.Input.Password;
|
|
|
343
350
|
var InputField = withLocale(InputFieldInner);
|
|
344
351
|
InputField.Password = withLocale(PasswordInner);
|
|
345
352
|
|
|
346
|
-
|
|
353
|
+
const IconContext = /*#__PURE__*/React.createContext({});
|
|
354
|
+
var Context = IconContext;
|
|
355
|
+
|
|
356
|
+
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
357
|
+
|
|
358
|
+
const APPEND_ORDER = 'data-rc-order';
|
|
359
|
+
const APPEND_PRIORITY = 'data-rc-priority';
|
|
360
|
+
const MARK_KEY = 'rc-util-key';
|
|
361
|
+
const containerCache = new Map();
|
|
362
|
+
function canUseDom() {
|
|
363
|
+
return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
364
|
+
}
|
|
365
|
+
function contains(root, node) {
|
|
366
|
+
if (!root || !node) {
|
|
367
|
+
return false;
|
|
368
|
+
}
|
|
369
|
+
if (root.contains) {
|
|
370
|
+
return root.contains(node);
|
|
371
|
+
}
|
|
372
|
+
let current = node;
|
|
373
|
+
while (current) {
|
|
374
|
+
if (current === root) {
|
|
375
|
+
return true;
|
|
376
|
+
}
|
|
377
|
+
current = current.parentNode;
|
|
378
|
+
}
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
function getMark({
|
|
382
|
+
mark
|
|
383
|
+
} = {}) {
|
|
384
|
+
if (mark) {
|
|
385
|
+
return mark.startsWith('data-') ? mark : `data-${mark}`;
|
|
386
|
+
}
|
|
387
|
+
return MARK_KEY;
|
|
388
|
+
}
|
|
389
|
+
function getContainer(option) {
|
|
390
|
+
if (option.attachTo) {
|
|
391
|
+
return option.attachTo;
|
|
392
|
+
}
|
|
393
|
+
const head = document.querySelector('head');
|
|
394
|
+
return head || document.body;
|
|
395
|
+
}
|
|
396
|
+
function getOrder(prepend) {
|
|
397
|
+
if (prepend === 'queue') {
|
|
398
|
+
return 'prependQueue';
|
|
399
|
+
}
|
|
400
|
+
return prepend ? 'prepend' : 'append';
|
|
401
|
+
}
|
|
402
|
+
function findStyles(container) {
|
|
403
|
+
return Array.from((containerCache.get(container) || container).children).filter(node => node.tagName === 'STYLE');
|
|
404
|
+
}
|
|
405
|
+
function injectCSS(css, option = {}) {
|
|
406
|
+
if (!canUseDom()) {
|
|
407
|
+
return null;
|
|
408
|
+
}
|
|
409
|
+
const {
|
|
410
|
+
csp,
|
|
411
|
+
prepend,
|
|
412
|
+
priority = 0
|
|
413
|
+
} = option;
|
|
414
|
+
const mergedOrder = getOrder(prepend);
|
|
415
|
+
const isPrependQueue = mergedOrder === 'prependQueue';
|
|
416
|
+
const styleNode = document.createElement('style');
|
|
417
|
+
styleNode.setAttribute(APPEND_ORDER, mergedOrder);
|
|
418
|
+
if (isPrependQueue && priority) {
|
|
419
|
+
styleNode.setAttribute(APPEND_PRIORITY, `${priority}`);
|
|
420
|
+
}
|
|
421
|
+
if (csp?.nonce) {
|
|
422
|
+
styleNode.nonce = csp.nonce;
|
|
423
|
+
}
|
|
424
|
+
styleNode.innerHTML = css;
|
|
425
|
+
const container = getContainer(option);
|
|
426
|
+
const {
|
|
427
|
+
firstChild
|
|
428
|
+
} = container;
|
|
429
|
+
if (prepend) {
|
|
430
|
+
if (isPrependQueue) {
|
|
431
|
+
const existStyle = (option.styles || findStyles(container)).filter(node => {
|
|
432
|
+
if (!['prepend', 'prependQueue'].includes(node.getAttribute(APPEND_ORDER))) {
|
|
433
|
+
return false;
|
|
434
|
+
}
|
|
435
|
+
const nodePriority = Number(node.getAttribute(APPEND_PRIORITY) || 0);
|
|
436
|
+
return priority >= nodePriority;
|
|
437
|
+
});
|
|
438
|
+
if (existStyle.length) {
|
|
439
|
+
container.insertBefore(styleNode, existStyle[existStyle.length - 1].nextSibling);
|
|
440
|
+
return styleNode;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
container.insertBefore(styleNode, firstChild);
|
|
444
|
+
} else {
|
|
445
|
+
container.appendChild(styleNode);
|
|
446
|
+
}
|
|
447
|
+
return styleNode;
|
|
448
|
+
}
|
|
449
|
+
function findExistNode(key, option = {}) {
|
|
450
|
+
let {
|
|
451
|
+
styles
|
|
452
|
+
} = option;
|
|
453
|
+
styles ||= findStyles(getContainer(option));
|
|
454
|
+
return styles.find(node => node.getAttribute(getMark(option)) === key);
|
|
455
|
+
}
|
|
456
|
+
function syncRealContainer(container, option) {
|
|
457
|
+
const cachedRealContainer = containerCache.get(container);
|
|
458
|
+
if (!cachedRealContainer || !contains(document, cachedRealContainer)) {
|
|
459
|
+
const placeholderStyle = injectCSS('', option);
|
|
460
|
+
if (!placeholderStyle) {
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
const {
|
|
464
|
+
parentNode
|
|
465
|
+
} = placeholderStyle;
|
|
466
|
+
containerCache.set(container, parentNode);
|
|
467
|
+
container.removeChild(placeholderStyle);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
function updateCSS(css, key, originOption = {}) {
|
|
471
|
+
if (!canUseDom()) {
|
|
472
|
+
return null;
|
|
473
|
+
}
|
|
474
|
+
const container = getContainer(originOption);
|
|
475
|
+
const styles = findStyles(container);
|
|
476
|
+
const option = {
|
|
477
|
+
...originOption,
|
|
478
|
+
styles
|
|
479
|
+
};
|
|
480
|
+
syncRealContainer(container, option);
|
|
481
|
+
const existNode = findExistNode(key, option);
|
|
482
|
+
if (existNode) {
|
|
483
|
+
if (option.csp?.nonce && existNode.nonce !== option.csp.nonce) {
|
|
484
|
+
existNode.nonce = option.csp.nonce;
|
|
485
|
+
}
|
|
486
|
+
if (existNode.innerHTML !== css) {
|
|
487
|
+
existNode.innerHTML = css;
|
|
488
|
+
}
|
|
489
|
+
return existNode;
|
|
490
|
+
}
|
|
491
|
+
const newNode = injectCSS(css, option);
|
|
492
|
+
newNode?.setAttribute(getMark(option), key);
|
|
493
|
+
return newNode;
|
|
494
|
+
}
|
|
495
|
+
function getRoot(ele) {
|
|
496
|
+
return ele?.getRootNode?.();
|
|
497
|
+
}
|
|
498
|
+
function getShadowRoot(ele) {
|
|
499
|
+
const root = getRoot(ele);
|
|
500
|
+
return typeof ShadowRoot !== 'undefined' && root instanceof ShadowRoot ? root : null;
|
|
501
|
+
}
|
|
502
|
+
const warned = {};
|
|
503
|
+
function warningOnce(valid, message) {
|
|
504
|
+
if (valid || warned[message]) {
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
|
508
|
+
console.error(`Warning: ${message}`);
|
|
509
|
+
}
|
|
510
|
+
warned[message] = true;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
function camelCase(input) {
|
|
514
|
+
return input.replace(/-(.)/g, (match, g) => g.toUpperCase());
|
|
515
|
+
}
|
|
516
|
+
function warning(valid, message) {
|
|
517
|
+
warningOnce(valid, `[@ant-design/icons] ${message}`);
|
|
518
|
+
}
|
|
519
|
+
function isIconDefinition(target) {
|
|
520
|
+
return typeof target === 'object' && typeof target.name === 'string' && typeof target.theme === 'string' && (typeof target.icon === 'object' || typeof target.icon === 'function');
|
|
521
|
+
}
|
|
522
|
+
function normalizeAttrs(attrs = {}) {
|
|
523
|
+
return Object.keys(attrs).reduce((acc, key) => {
|
|
524
|
+
const val = attrs[key];
|
|
525
|
+
switch (key) {
|
|
526
|
+
case 'class':
|
|
527
|
+
acc.className = val;
|
|
528
|
+
delete acc.class;
|
|
529
|
+
break;
|
|
530
|
+
default:
|
|
531
|
+
delete acc[key];
|
|
532
|
+
acc[camelCase(key)] = val;
|
|
533
|
+
}
|
|
534
|
+
return acc;
|
|
535
|
+
}, {});
|
|
536
|
+
}
|
|
537
|
+
function generate(node, key, rootProps) {
|
|
538
|
+
if (!rootProps) {
|
|
539
|
+
return /*#__PURE__*/React__default["default"].createElement(node.tag, {
|
|
540
|
+
key,
|
|
541
|
+
...normalizeAttrs(node.attrs)
|
|
542
|
+
}, (node.children || []).map((child, index) => generate(child, `${key}-${node.tag}-${index}`)));
|
|
543
|
+
}
|
|
544
|
+
return /*#__PURE__*/React__default["default"].createElement(node.tag, {
|
|
545
|
+
key,
|
|
546
|
+
...normalizeAttrs(node.attrs),
|
|
547
|
+
...rootProps
|
|
548
|
+
}, (node.children || []).map((child, index) => generate(child, `${key}-${node.tag}-${index}`)));
|
|
549
|
+
}
|
|
550
|
+
const iconStyles = `
|
|
551
|
+
.anticon {
|
|
552
|
+
display: inline-flex;
|
|
553
|
+
align-items: center;
|
|
554
|
+
color: inherit;
|
|
555
|
+
font-style: normal;
|
|
556
|
+
line-height: 0;
|
|
557
|
+
text-align: center;
|
|
558
|
+
text-transform: none;
|
|
559
|
+
vertical-align: -0.125em;
|
|
560
|
+
text-rendering: optimizeLegibility;
|
|
561
|
+
-webkit-font-smoothing: antialiased;
|
|
562
|
+
-moz-osx-font-smoothing: grayscale;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
.anticon > * {
|
|
566
|
+
line-height: 1;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
.anticon svg {
|
|
570
|
+
display: inline-block;
|
|
571
|
+
vertical-align: inherit;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
.anticon::before {
|
|
575
|
+
display: none;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
.anticon .anticon-icon {
|
|
579
|
+
display: block;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
.anticon[tabindex] {
|
|
583
|
+
cursor: pointer;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
.anticon-spin {
|
|
587
|
+
-webkit-animation: loadingCircle 1s infinite linear;
|
|
588
|
+
animation: loadingCircle 1s infinite linear;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
@-webkit-keyframes loadingCircle {
|
|
592
|
+
100% {
|
|
593
|
+
-webkit-transform: rotate(360deg);
|
|
594
|
+
transform: rotate(360deg);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
@keyframes loadingCircle {
|
|
599
|
+
100% {
|
|
600
|
+
-webkit-transform: rotate(360deg);
|
|
601
|
+
transform: rotate(360deg);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
`;
|
|
605
|
+
const useInsertStyles = eleRef => {
|
|
606
|
+
const {
|
|
607
|
+
csp,
|
|
608
|
+
prefixCls,
|
|
609
|
+
layer,
|
|
610
|
+
zeroRuntime
|
|
611
|
+
} = React.useContext(Context);
|
|
612
|
+
let mergedStyleStr = iconStyles;
|
|
613
|
+
if (prefixCls) {
|
|
614
|
+
mergedStyleStr = mergedStyleStr.replace(/anticon/g, prefixCls);
|
|
615
|
+
}
|
|
616
|
+
if (layer) {
|
|
617
|
+
mergedStyleStr = `@layer ${layer} {\n${mergedStyleStr}\n}`;
|
|
618
|
+
}
|
|
619
|
+
React.useEffect(() => {
|
|
620
|
+
if (zeroRuntime) {
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
const ele = eleRef.current;
|
|
624
|
+
const shadowRoot = getShadowRoot(ele);
|
|
625
|
+
updateCSS(mergedStyleStr, '@ant-design-icons', {
|
|
626
|
+
prepend: !layer,
|
|
627
|
+
csp,
|
|
628
|
+
attachTo: shadowRoot
|
|
629
|
+
});
|
|
630
|
+
}, []);
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
const IconBase = props => {
|
|
634
|
+
const {
|
|
635
|
+
icon,
|
|
636
|
+
className,
|
|
637
|
+
onClick,
|
|
638
|
+
style,
|
|
639
|
+
primaryColor: _primaryColor,
|
|
640
|
+
secondaryColor: _secondaryColor,
|
|
641
|
+
...restProps
|
|
642
|
+
} = props;
|
|
643
|
+
const svgRef = React__namespace.useRef(null);
|
|
644
|
+
useInsertStyles(svgRef);
|
|
645
|
+
warning(isIconDefinition(icon), `icon should be icon definiton, but got ${icon}`);
|
|
646
|
+
if (!isIconDefinition(icon)) {
|
|
647
|
+
return null;
|
|
648
|
+
}
|
|
649
|
+
const target = icon;
|
|
650
|
+
return generate(target.icon, `svg-${target.name}`, {
|
|
651
|
+
className,
|
|
652
|
+
onClick,
|
|
653
|
+
style,
|
|
654
|
+
'data-icon': target.name,
|
|
655
|
+
width: '1em',
|
|
656
|
+
height: '1em',
|
|
657
|
+
fill: 'currentColor',
|
|
658
|
+
'aria-hidden': 'true',
|
|
659
|
+
...restProps,
|
|
660
|
+
ref: svgRef
|
|
661
|
+
});
|
|
662
|
+
};
|
|
663
|
+
IconBase.displayName = 'IconReact';
|
|
664
|
+
var ReactIcon = IconBase;
|
|
665
|
+
|
|
666
|
+
function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
|
|
667
|
+
const Icon = /*#__PURE__*/React__namespace.forwardRef((props, ref) => {
|
|
668
|
+
const {
|
|
669
|
+
// affect outter <i>...</i>
|
|
670
|
+
className,
|
|
671
|
+
// affect inner <svg>...</svg>
|
|
672
|
+
icon,
|
|
673
|
+
spin,
|
|
674
|
+
rotate,
|
|
675
|
+
tabIndex,
|
|
676
|
+
onClick,
|
|
677
|
+
twoToneColor: _twoToneColor,
|
|
678
|
+
// other
|
|
679
|
+
...restProps
|
|
680
|
+
} = props;
|
|
681
|
+
const {
|
|
682
|
+
prefixCls = 'anticon',
|
|
683
|
+
rootClassName
|
|
684
|
+
} = React__namespace.useContext(Context);
|
|
685
|
+
const classString = clsx(rootClassName, prefixCls, {
|
|
686
|
+
[`${prefixCls}-${icon.name}`]: !!icon.name,
|
|
687
|
+
[`${prefixCls}-spin`]: !!spin || icon.name === 'loading'
|
|
688
|
+
}, className);
|
|
689
|
+
let iconTabIndex = tabIndex;
|
|
690
|
+
if (iconTabIndex === undefined && onClick) {
|
|
691
|
+
iconTabIndex = -1;
|
|
692
|
+
}
|
|
693
|
+
const svgStyle = rotate ? {
|
|
694
|
+
msTransform: `rotate(${rotate}deg)`,
|
|
695
|
+
transform: `rotate(${rotate}deg)`
|
|
696
|
+
} : undefined;
|
|
697
|
+
return /*#__PURE__*/React__namespace.createElement("span", _extends$2({
|
|
698
|
+
role: "img",
|
|
699
|
+
"aria-label": icon.name
|
|
700
|
+
}, restProps, {
|
|
701
|
+
ref: ref,
|
|
702
|
+
tabIndex: iconTabIndex,
|
|
703
|
+
onClick: onClick,
|
|
704
|
+
className: classString
|
|
705
|
+
}), /*#__PURE__*/React__namespace.createElement(ReactIcon, {
|
|
706
|
+
icon: icon,
|
|
707
|
+
style: svgStyle
|
|
708
|
+
}));
|
|
709
|
+
});
|
|
710
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
711
|
+
Icon.displayName = 'AntdIcon';
|
|
712
|
+
}
|
|
713
|
+
var AntdIcon = Icon;
|
|
714
|
+
|
|
715
|
+
// This icon file is generated automatically.
|
|
716
|
+
|
|
717
|
+
var CalendarOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z" } }] }, "name": "calendar", "theme": "outlined" };
|
|
718
|
+
var _default$1 = CalendarOutlined$2;
|
|
719
|
+
|
|
720
|
+
var CalendarOutlinedSvg = _default$1;
|
|
721
|
+
|
|
722
|
+
function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
|
|
723
|
+
const CalendarOutlined = (props, ref) => /*#__PURE__*/React__namespace.createElement(AntdIcon, _extends$1({}, props, {
|
|
724
|
+
ref: ref,
|
|
725
|
+
icon: CalendarOutlinedSvg
|
|
726
|
+
}));
|
|
727
|
+
|
|
728
|
+
/** */
|
|
729
|
+
const RefIcon$1 = /*#__PURE__*/React__namespace.forwardRef(CalendarOutlined);
|
|
730
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
731
|
+
RefIcon$1.displayName = 'CalendarOutlined';
|
|
732
|
+
}
|
|
733
|
+
var CalendarOutlined$1 = RefIcon$1;
|
|
734
|
+
|
|
735
|
+
// This icon file is generated automatically.
|
|
736
|
+
|
|
737
|
+
var CloseCircleFilled$2 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z" } }] }, "name": "close-circle", "theme": "filled" };
|
|
738
|
+
var _default = CloseCircleFilled$2;
|
|
739
|
+
|
|
740
|
+
var CloseCircleFilledSvg = _default;
|
|
741
|
+
|
|
742
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
743
|
+
const CloseCircleFilled = (props, ref) => /*#__PURE__*/React__namespace.createElement(AntdIcon, _extends({}, props, {
|
|
744
|
+
ref: ref,
|
|
745
|
+
icon: CloseCircleFilledSvg
|
|
746
|
+
}));
|
|
747
|
+
|
|
748
|
+
/** */
|
|
749
|
+
const RefIcon = /*#__PURE__*/React__namespace.forwardRef(CloseCircleFilled);
|
|
750
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
751
|
+
RefIcon.displayName = 'CloseCircleFilled';
|
|
752
|
+
}
|
|
753
|
+
var CloseCircleFilled$1 = RefIcon;
|
|
754
|
+
|
|
755
|
+
var _excluded$2 = ["soFarText", "soFarValue", "picker", "placeholder"];
|
|
347
756
|
var useOnChange$6 = reactFormHelper.hooks.useOnChange;
|
|
348
757
|
var PickerTodayInner = function PickerTodayInner(_ref) {
|
|
349
758
|
var soFarText = _ref.soFarText,
|
|
@@ -351,6 +760,7 @@ var PickerTodayInner = function PickerTodayInner(_ref) {
|
|
|
351
760
|
soFarValue = _ref$soFarValue === void 0 ? 'soFar' : _ref$soFarValue,
|
|
352
761
|
_ref$picker = _ref.picker,
|
|
353
762
|
picker = _ref$picker === void 0 ? 'date' : _ref$picker,
|
|
763
|
+
placeholder = _ref.placeholder,
|
|
354
764
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
355
765
|
var _useIntl = reactIntl.useIntl(),
|
|
356
766
|
formatMessage = _useIntl.formatMessage;
|
|
@@ -378,6 +788,13 @@ var PickerTodayInner = function PickerTodayInner(_ref) {
|
|
|
378
788
|
var soFarLabel = soFarText || formatMessage({
|
|
379
789
|
id: 'SoFar'
|
|
380
790
|
});
|
|
791
|
+
var placeholderList = Array.isArray(placeholder) ? placeholder : [];
|
|
792
|
+
var startPlaceholder = placeholderList[0] || formatMessage({
|
|
793
|
+
id: 'StartDate'
|
|
794
|
+
});
|
|
795
|
+
var endPlaceholder = placeholderList[1] || formatMessage({
|
|
796
|
+
id: 'EndDate'
|
|
797
|
+
});
|
|
381
798
|
|
|
382
799
|
// 根据 picker 类型获取格式化字符串
|
|
383
800
|
var formatPattern = React.useMemo(function () {
|
|
@@ -559,9 +976,7 @@ var PickerTodayInner = function PickerTodayInner(_ref) {
|
|
|
559
976
|
className: "date-picker-today-start"
|
|
560
977
|
}, /*#__PURE__*/React__default["default"].createElement("input", {
|
|
561
978
|
readOnly: true,
|
|
562
|
-
placeholder:
|
|
563
|
-
id: 'StartDate'
|
|
564
|
-
}),
|
|
979
|
+
placeholder: startPlaceholder,
|
|
565
980
|
value: displayText.start,
|
|
566
981
|
className: "ant-input"
|
|
567
982
|
})), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
@@ -570,17 +985,15 @@ var PickerTodayInner = function PickerTodayInner(_ref) {
|
|
|
570
985
|
className: "date-picker-today-end"
|
|
571
986
|
}, /*#__PURE__*/React__default["default"].createElement("input", {
|
|
572
987
|
readOnly: true,
|
|
573
|
-
placeholder:
|
|
574
|
-
id: 'EndDate'
|
|
575
|
-
}),
|
|
988
|
+
placeholder: endPlaceholder,
|
|
576
989
|
value: displayText.end,
|
|
577
990
|
className: "ant-input " + (isSoFar ? 'so-far-active' : '')
|
|
578
991
|
})), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
579
992
|
className: "date-picker-today-suffix"
|
|
580
|
-
}, hasValue && hovering ? /*#__PURE__*/React__default["default"].createElement(
|
|
993
|
+
}, hasValue && hovering ? /*#__PURE__*/React__default["default"].createElement(CloseCircleFilled$1, {
|
|
581
994
|
className: "date-picker-today-clear",
|
|
582
995
|
onClick: handleClear
|
|
583
|
-
}) : /*#__PURE__*/React__default["default"].createElement(
|
|
996
|
+
}) : /*#__PURE__*/React__default["default"].createElement(CalendarOutlined$1, null))), /*#__PURE__*/React__default["default"].createElement(antd.DatePicker, {
|
|
584
997
|
picker: picker,
|
|
585
998
|
open: openStart,
|
|
586
999
|
onOpenChange: handleStartOpenChange,
|
|
@@ -766,7 +1179,7 @@ Slider.Field = antd.Slider;
|
|
|
766
1179
|
|
|
767
1180
|
var ResetButton = function ResetButton(props) {
|
|
768
1181
|
var resetProps = ReactForm.useReset();
|
|
769
|
-
return /*#__PURE__*/React__default["default"].createElement(antd.Button, _extends({}, resetProps, props));
|
|
1182
|
+
return /*#__PURE__*/React__default["default"].createElement(antd.Button, _extends$3({}, resetProps, props));
|
|
770
1183
|
};
|
|
771
1184
|
|
|
772
1185
|
var _excluded$1 = ["type", "realtime", "disabled"],
|
|
@@ -782,7 +1195,7 @@ var SubmitButton = function SubmitButton(_ref) {
|
|
|
782
1195
|
isPass = _useSubmit.isPass,
|
|
783
1196
|
isLoading = _useSubmit.isLoading,
|
|
784
1197
|
submitProps = _objectWithoutPropertiesLoose(_useSubmit, _excluded2);
|
|
785
|
-
return /*#__PURE__*/React__default["default"].createElement(antd.Button, _extends({
|
|
1198
|
+
return /*#__PURE__*/React__default["default"].createElement(antd.Button, _extends$3({
|
|
786
1199
|
type: type,
|
|
787
1200
|
loading: isLoading,
|
|
788
1201
|
disabled: disabled || (realtime ? !isPass : false)
|
|
@@ -795,7 +1208,7 @@ var CancelButton = function CancelButton(_ref) {
|
|
|
795
1208
|
var _onClick = _ref.onClick,
|
|
796
1209
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
797
1210
|
var remove = useCacheRemove();
|
|
798
|
-
return /*#__PURE__*/React__default["default"].createElement(antd.Button, _extends({}, props, {
|
|
1211
|
+
return /*#__PURE__*/React__default["default"].createElement(antd.Button, _extends$3({}, props, {
|
|
799
1212
|
onClick: function onClick() {
|
|
800
1213
|
remove();
|
|
801
1214
|
_onClick && _onClick.apply(void 0, [].slice.call(arguments));
|