@kne/react-form-antd 4.1.2 → 4.1.4
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 +450 -39
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +453 -61
- package/dist/index.modern.js.map +1 -1
- package/package.json +2 -2
package/dist/index.modern.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { forwardRef, useCallback, createContext, useContext, useEffect, useState, useRef, useMemo } from 'react';
|
|
2
3
|
import classnames from 'classnames';
|
|
3
4
|
import ReactForm__default, { preset as preset$2, useReset, useSubmit } from '@kne/react-form';
|
|
4
5
|
export * from '@kne/react-form';
|
|
@@ -6,19 +7,18 @@ import { preset as preset$1, widget, hooks, hoc } from '@kne/react-form-helper';
|
|
|
6
7
|
export { hoc, hooks, utils, widget } from '@kne/react-form-helper';
|
|
7
8
|
import merge from 'lodash/merge';
|
|
8
9
|
import { TreeSelect, TimePicker, Input, Switch as Switch$1, Select, Radio, InputNumber, Button, DatePicker, Checkbox as Checkbox$1, Cascader as Cascader$1, Rate as Rate$1, Slider as Slider$1 } from 'antd';
|
|
9
|
-
import {
|
|
10
|
-
import { CloseCircleFilled, CalendarOutlined } from '@ant-design/icons';
|
|
10
|
+
import { createWithIntlProvider, useIntl } from '@kne/react-intl';
|
|
11
11
|
import dayjs from 'dayjs';
|
|
12
12
|
import useControlValue from '@kne/use-control-value';
|
|
13
13
|
|
|
14
|
-
function _extends() {
|
|
15
|
-
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
14
|
+
function _extends$3() {
|
|
15
|
+
return _extends$3 = Object.assign ? Object.assign.bind() : function (n) {
|
|
16
16
|
for (var e = 1; e < arguments.length; e++) {
|
|
17
17
|
var t = arguments[e];
|
|
18
18
|
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
19
19
|
}
|
|
20
20
|
return n;
|
|
21
|
-
}, _extends.apply(null, arguments);
|
|
21
|
+
}, _extends$3.apply(null, arguments);
|
|
22
22
|
}
|
|
23
23
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
24
24
|
if (null == r) return {};
|
|
@@ -52,7 +52,7 @@ var preset = props => {
|
|
|
52
52
|
preset$2(globalParams.rules);
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
const _excluded$
|
|
55
|
+
const _excluded$4 = ["className", "cache", "enterSubmit", "scrollToError", "scrollProps", "type", "size", "children"];
|
|
56
56
|
const {
|
|
57
57
|
ScrollToError,
|
|
58
58
|
EnterSubmit,
|
|
@@ -71,7 +71,7 @@ const Form = forwardRef((originProps, ref) => {
|
|
|
71
71
|
},
|
|
72
72
|
children
|
|
73
73
|
} = originProps,
|
|
74
|
-
props = _objectWithoutPropertiesLoose(originProps, _excluded$
|
|
74
|
+
props = _objectWithoutPropertiesLoose(originProps, _excluded$4);
|
|
75
75
|
const baseClass = 'react-form';
|
|
76
76
|
let computedClass = baseClass;
|
|
77
77
|
const {
|
|
@@ -87,24 +87,24 @@ const Form = forwardRef((originProps, ref) => {
|
|
|
87
87
|
if (size !== 'middle') {
|
|
88
88
|
computedClass += `--${size}`;
|
|
89
89
|
}
|
|
90
|
-
const maxLabel = /*#__PURE__*/
|
|
91
|
-
return /*#__PURE__*/
|
|
90
|
+
const maxLabel = /*#__PURE__*/React__default.createElement(MaxLabelProvider, null, children);
|
|
91
|
+
return /*#__PURE__*/React__default.createElement("form", {
|
|
92
92
|
className: classnames(baseClass, computedClass, className),
|
|
93
93
|
onSubmit: e => {
|
|
94
94
|
e.preventDefault();
|
|
95
95
|
e.stopPropagation();
|
|
96
96
|
}
|
|
97
|
-
}, /*#__PURE__*/
|
|
97
|
+
}, /*#__PURE__*/React__default.createElement(SizeProvider, {
|
|
98
98
|
value: {
|
|
99
99
|
size
|
|
100
100
|
}
|
|
101
|
-
}, /*#__PURE__*/
|
|
101
|
+
}, /*#__PURE__*/React__default.createElement(ReactForm__default, _extends$3({}, props, {
|
|
102
102
|
ref: ref
|
|
103
|
-
}), cache ? /*#__PURE__*/
|
|
103
|
+
}), cache ? /*#__PURE__*/React__default.createElement(FormStore, {
|
|
104
104
|
cache: cache
|
|
105
|
-
}) : null, scrollToError ? /*#__PURE__*/
|
|
105
|
+
}) : null, scrollToError ? /*#__PURE__*/React__default.createElement(ScrollToError, {
|
|
106
106
|
scrollProps: scrollProps
|
|
107
|
-
}) : null, enterSubmit ? /*#__PURE__*/
|
|
107
|
+
}) : null, enterSubmit ? /*#__PURE__*/React__default.createElement(EnterSubmit, null, maxLabel) : maxLabel)));
|
|
108
108
|
});
|
|
109
109
|
|
|
110
110
|
const locale$1 = {
|
|
@@ -127,26 +127,14 @@ const locale = {
|
|
|
127
127
|
SoFar: 'Present'
|
|
128
128
|
};
|
|
129
129
|
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
locale = 'zh-CN'
|
|
139
|
-
} = _ref,
|
|
140
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
141
|
-
const messages = localeMap[locale] || locale$1;
|
|
142
|
-
return /*#__PURE__*/React.createElement(IntlProvider, {
|
|
143
|
-
locale: locale,
|
|
144
|
-
messages: messages
|
|
145
|
-
}, /*#__PURE__*/React.createElement(WrappedComponent, props));
|
|
146
|
-
};
|
|
147
|
-
WithLocaleComponent.displayName = `withLocale(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;
|
|
148
|
-
return WithLocaleComponent;
|
|
149
|
-
};
|
|
130
|
+
const withLocale = createWithIntlProvider({
|
|
131
|
+
defaultLocale: 'zh-CN',
|
|
132
|
+
messages: {
|
|
133
|
+
'zh-CN': locale$1,
|
|
134
|
+
'en-US': locale
|
|
135
|
+
},
|
|
136
|
+
namespace: 'react-form-antd'
|
|
137
|
+
});
|
|
150
138
|
|
|
151
139
|
const {
|
|
152
140
|
useOnChange: useOnChange$b
|
|
@@ -293,7 +281,7 @@ const RadioGroup = _ref => {
|
|
|
293
281
|
const handler = useCallback(e => {
|
|
294
282
|
onChange && onChange(e.target.value);
|
|
295
283
|
}, [onChange]);
|
|
296
|
-
return /*#__PURE__*/
|
|
284
|
+
return /*#__PURE__*/React__default.createElement(Radio.Group, _extends$3({}, props, {
|
|
297
285
|
onChange: handler
|
|
298
286
|
}));
|
|
299
287
|
};
|
|
@@ -369,7 +357,407 @@ PasswordInner.Field = Input.Password;
|
|
|
369
357
|
const InputField = withLocale(InputFieldInner);
|
|
370
358
|
InputField.Password = withLocale(PasswordInner);
|
|
371
359
|
|
|
372
|
-
const
|
|
360
|
+
const IconContext = /*#__PURE__*/createContext({});
|
|
361
|
+
var Context = IconContext;
|
|
362
|
+
|
|
363
|
+
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}
|
|
364
|
+
|
|
365
|
+
const APPEND_ORDER = 'data-rc-order';
|
|
366
|
+
const APPEND_PRIORITY = 'data-rc-priority';
|
|
367
|
+
const MARK_KEY = 'rc-util-key';
|
|
368
|
+
const containerCache = new Map();
|
|
369
|
+
function canUseDom() {
|
|
370
|
+
return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
371
|
+
}
|
|
372
|
+
function contains(root, node) {
|
|
373
|
+
if (!root || !node) {
|
|
374
|
+
return false;
|
|
375
|
+
}
|
|
376
|
+
if (root.contains) {
|
|
377
|
+
return root.contains(node);
|
|
378
|
+
}
|
|
379
|
+
let current = node;
|
|
380
|
+
while (current) {
|
|
381
|
+
if (current === root) {
|
|
382
|
+
return true;
|
|
383
|
+
}
|
|
384
|
+
current = current.parentNode;
|
|
385
|
+
}
|
|
386
|
+
return false;
|
|
387
|
+
}
|
|
388
|
+
function getMark({
|
|
389
|
+
mark
|
|
390
|
+
} = {}) {
|
|
391
|
+
if (mark) {
|
|
392
|
+
return mark.startsWith('data-') ? mark : `data-${mark}`;
|
|
393
|
+
}
|
|
394
|
+
return MARK_KEY;
|
|
395
|
+
}
|
|
396
|
+
function getContainer(option) {
|
|
397
|
+
if (option.attachTo) {
|
|
398
|
+
return option.attachTo;
|
|
399
|
+
}
|
|
400
|
+
const head = document.querySelector('head');
|
|
401
|
+
return head || document.body;
|
|
402
|
+
}
|
|
403
|
+
function getOrder(prepend) {
|
|
404
|
+
if (prepend === 'queue') {
|
|
405
|
+
return 'prependQueue';
|
|
406
|
+
}
|
|
407
|
+
return prepend ? 'prepend' : 'append';
|
|
408
|
+
}
|
|
409
|
+
function findStyles(container) {
|
|
410
|
+
return Array.from((containerCache.get(container) || container).children).filter(node => node.tagName === 'STYLE');
|
|
411
|
+
}
|
|
412
|
+
function injectCSS(css, option = {}) {
|
|
413
|
+
if (!canUseDom()) {
|
|
414
|
+
return null;
|
|
415
|
+
}
|
|
416
|
+
const {
|
|
417
|
+
csp,
|
|
418
|
+
prepend,
|
|
419
|
+
priority = 0
|
|
420
|
+
} = option;
|
|
421
|
+
const mergedOrder = getOrder(prepend);
|
|
422
|
+
const isPrependQueue = mergedOrder === 'prependQueue';
|
|
423
|
+
const styleNode = document.createElement('style');
|
|
424
|
+
styleNode.setAttribute(APPEND_ORDER, mergedOrder);
|
|
425
|
+
if (isPrependQueue && priority) {
|
|
426
|
+
styleNode.setAttribute(APPEND_PRIORITY, `${priority}`);
|
|
427
|
+
}
|
|
428
|
+
if (csp?.nonce) {
|
|
429
|
+
styleNode.nonce = csp.nonce;
|
|
430
|
+
}
|
|
431
|
+
styleNode.innerHTML = css;
|
|
432
|
+
const container = getContainer(option);
|
|
433
|
+
const {
|
|
434
|
+
firstChild
|
|
435
|
+
} = container;
|
|
436
|
+
if (prepend) {
|
|
437
|
+
if (isPrependQueue) {
|
|
438
|
+
const existStyle = (option.styles || findStyles(container)).filter(node => {
|
|
439
|
+
if (!['prepend', 'prependQueue'].includes(node.getAttribute(APPEND_ORDER))) {
|
|
440
|
+
return false;
|
|
441
|
+
}
|
|
442
|
+
const nodePriority = Number(node.getAttribute(APPEND_PRIORITY) || 0);
|
|
443
|
+
return priority >= nodePriority;
|
|
444
|
+
});
|
|
445
|
+
if (existStyle.length) {
|
|
446
|
+
container.insertBefore(styleNode, existStyle[existStyle.length - 1].nextSibling);
|
|
447
|
+
return styleNode;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
container.insertBefore(styleNode, firstChild);
|
|
451
|
+
} else {
|
|
452
|
+
container.appendChild(styleNode);
|
|
453
|
+
}
|
|
454
|
+
return styleNode;
|
|
455
|
+
}
|
|
456
|
+
function findExistNode(key, option = {}) {
|
|
457
|
+
let {
|
|
458
|
+
styles
|
|
459
|
+
} = option;
|
|
460
|
+
styles ||= findStyles(getContainer(option));
|
|
461
|
+
return styles.find(node => node.getAttribute(getMark(option)) === key);
|
|
462
|
+
}
|
|
463
|
+
function syncRealContainer(container, option) {
|
|
464
|
+
const cachedRealContainer = containerCache.get(container);
|
|
465
|
+
if (!cachedRealContainer || !contains(document, cachedRealContainer)) {
|
|
466
|
+
const placeholderStyle = injectCSS('', option);
|
|
467
|
+
if (!placeholderStyle) {
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
const {
|
|
471
|
+
parentNode
|
|
472
|
+
} = placeholderStyle;
|
|
473
|
+
containerCache.set(container, parentNode);
|
|
474
|
+
container.removeChild(placeholderStyle);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
function updateCSS(css, key, originOption = {}) {
|
|
478
|
+
if (!canUseDom()) {
|
|
479
|
+
return null;
|
|
480
|
+
}
|
|
481
|
+
const container = getContainer(originOption);
|
|
482
|
+
const styles = findStyles(container);
|
|
483
|
+
const option = {
|
|
484
|
+
...originOption,
|
|
485
|
+
styles
|
|
486
|
+
};
|
|
487
|
+
syncRealContainer(container, option);
|
|
488
|
+
const existNode = findExistNode(key, option);
|
|
489
|
+
if (existNode) {
|
|
490
|
+
if (option.csp?.nonce && existNode.nonce !== option.csp.nonce) {
|
|
491
|
+
existNode.nonce = option.csp.nonce;
|
|
492
|
+
}
|
|
493
|
+
if (existNode.innerHTML !== css) {
|
|
494
|
+
existNode.innerHTML = css;
|
|
495
|
+
}
|
|
496
|
+
return existNode;
|
|
497
|
+
}
|
|
498
|
+
const newNode = injectCSS(css, option);
|
|
499
|
+
newNode?.setAttribute(getMark(option), key);
|
|
500
|
+
return newNode;
|
|
501
|
+
}
|
|
502
|
+
function getRoot(ele) {
|
|
503
|
+
return ele?.getRootNode?.();
|
|
504
|
+
}
|
|
505
|
+
function getShadowRoot(ele) {
|
|
506
|
+
const root = getRoot(ele);
|
|
507
|
+
return typeof ShadowRoot !== 'undefined' && root instanceof ShadowRoot ? root : null;
|
|
508
|
+
}
|
|
509
|
+
const warned = {};
|
|
510
|
+
function warningOnce(valid, message) {
|
|
511
|
+
if (valid || warned[message]) {
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
|
515
|
+
console.error(`Warning: ${message}`);
|
|
516
|
+
}
|
|
517
|
+
warned[message] = true;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
function camelCase(input) {
|
|
521
|
+
return input.replace(/-(.)/g, (match, g) => g.toUpperCase());
|
|
522
|
+
}
|
|
523
|
+
function warning(valid, message) {
|
|
524
|
+
warningOnce(valid, `[@ant-design/icons] ${message}`);
|
|
525
|
+
}
|
|
526
|
+
function isIconDefinition(target) {
|
|
527
|
+
return target !== null && typeof target === 'object' && typeof target.name === 'string' && typeof target.theme === 'string' && (typeof target.icon === 'object' || typeof target.icon === 'function');
|
|
528
|
+
}
|
|
529
|
+
function normalizeAttrs(attrs = {}) {
|
|
530
|
+
return Object.keys(attrs).reduce((acc, key) => {
|
|
531
|
+
const val = attrs[key];
|
|
532
|
+
switch (key) {
|
|
533
|
+
case 'class':
|
|
534
|
+
acc.className = val;
|
|
535
|
+
delete acc.class;
|
|
536
|
+
break;
|
|
537
|
+
default:
|
|
538
|
+
delete acc[key];
|
|
539
|
+
acc[camelCase(key)] = val;
|
|
540
|
+
}
|
|
541
|
+
return acc;
|
|
542
|
+
}, {});
|
|
543
|
+
}
|
|
544
|
+
function generate(node, key, rootProps) {
|
|
545
|
+
if (!rootProps) {
|
|
546
|
+
return /*#__PURE__*/React__default.createElement(node.tag, {
|
|
547
|
+
key,
|
|
548
|
+
...normalizeAttrs(node.attrs)
|
|
549
|
+
}, (node.children || []).map((child, index) => generate(child, `${key}-${node.tag}-${index}`)));
|
|
550
|
+
}
|
|
551
|
+
return /*#__PURE__*/React__default.createElement(node.tag, {
|
|
552
|
+
key,
|
|
553
|
+
...normalizeAttrs(node.attrs),
|
|
554
|
+
...rootProps
|
|
555
|
+
}, (node.children || []).map((child, index) => generate(child, `${key}-${node.tag}-${index}`)));
|
|
556
|
+
}
|
|
557
|
+
const iconStyles = `
|
|
558
|
+
.anticon {
|
|
559
|
+
display: inline-flex;
|
|
560
|
+
align-items: center;
|
|
561
|
+
color: inherit;
|
|
562
|
+
font-style: normal;
|
|
563
|
+
line-height: 0;
|
|
564
|
+
text-align: center;
|
|
565
|
+
text-transform: none;
|
|
566
|
+
vertical-align: -0.125em;
|
|
567
|
+
text-rendering: optimizeLegibility;
|
|
568
|
+
-webkit-font-smoothing: antialiased;
|
|
569
|
+
-moz-osx-font-smoothing: grayscale;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
.anticon > * {
|
|
573
|
+
line-height: 1;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
.anticon svg {
|
|
577
|
+
display: inline-block;
|
|
578
|
+
vertical-align: inherit;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.anticon::before {
|
|
582
|
+
display: none;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
.anticon .anticon-icon {
|
|
586
|
+
display: block;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
.anticon[tabindex] {
|
|
590
|
+
cursor: pointer;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
.anticon-spin {
|
|
594
|
+
-webkit-animation: loadingCircle 1s infinite linear;
|
|
595
|
+
animation: loadingCircle 1s infinite linear;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
@-webkit-keyframes loadingCircle {
|
|
599
|
+
100% {
|
|
600
|
+
-webkit-transform: rotate(360deg);
|
|
601
|
+
transform: rotate(360deg);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
@keyframes loadingCircle {
|
|
606
|
+
100% {
|
|
607
|
+
-webkit-transform: rotate(360deg);
|
|
608
|
+
transform: rotate(360deg);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
`;
|
|
612
|
+
const useInsertStyles = eleRef => {
|
|
613
|
+
const {
|
|
614
|
+
csp,
|
|
615
|
+
prefixCls,
|
|
616
|
+
layer,
|
|
617
|
+
zeroRuntime
|
|
618
|
+
} = useContext(Context);
|
|
619
|
+
let mergedStyleStr = iconStyles;
|
|
620
|
+
if (prefixCls) {
|
|
621
|
+
mergedStyleStr = mergedStyleStr.replace(/anticon/g, prefixCls);
|
|
622
|
+
}
|
|
623
|
+
if (layer) {
|
|
624
|
+
mergedStyleStr = `@layer ${layer} {\n${mergedStyleStr}\n}`;
|
|
625
|
+
}
|
|
626
|
+
useEffect(() => {
|
|
627
|
+
if (zeroRuntime) {
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
const ele = eleRef.current;
|
|
631
|
+
const shadowRoot = getShadowRoot(ele);
|
|
632
|
+
updateCSS(mergedStyleStr, '@ant-design-icons', {
|
|
633
|
+
prepend: !layer,
|
|
634
|
+
csp,
|
|
635
|
+
attachTo: shadowRoot
|
|
636
|
+
});
|
|
637
|
+
}, []);
|
|
638
|
+
};
|
|
639
|
+
|
|
640
|
+
const IconBase = props => {
|
|
641
|
+
const {
|
|
642
|
+
icon,
|
|
643
|
+
className,
|
|
644
|
+
onClick,
|
|
645
|
+
style,
|
|
646
|
+
primaryColor: _primaryColor,
|
|
647
|
+
secondaryColor: _secondaryColor,
|
|
648
|
+
...restProps
|
|
649
|
+
} = props;
|
|
650
|
+
const svgRef = React.useRef(null);
|
|
651
|
+
useInsertStyles(svgRef);
|
|
652
|
+
warning(isIconDefinition(icon), `icon should be icon definiton, but got ${typeof icon}`);
|
|
653
|
+
if (!isIconDefinition(icon)) {
|
|
654
|
+
return null;
|
|
655
|
+
}
|
|
656
|
+
const target = icon;
|
|
657
|
+
return generate(target.icon, `svg-${target.name}`, {
|
|
658
|
+
className,
|
|
659
|
+
onClick,
|
|
660
|
+
style,
|
|
661
|
+
'data-icon': target.name,
|
|
662
|
+
width: '1em',
|
|
663
|
+
height: '1em',
|
|
664
|
+
fill: 'currentColor',
|
|
665
|
+
'aria-hidden': 'true',
|
|
666
|
+
...restProps,
|
|
667
|
+
ref: svgRef
|
|
668
|
+
});
|
|
669
|
+
};
|
|
670
|
+
IconBase.displayName = 'IconReact';
|
|
671
|
+
var ReactIcon = IconBase;
|
|
672
|
+
|
|
673
|
+
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); }
|
|
674
|
+
const Icon = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
675
|
+
const {
|
|
676
|
+
// affect outter <i>...</i>
|
|
677
|
+
className,
|
|
678
|
+
// affect inner <svg>...</svg>
|
|
679
|
+
icon,
|
|
680
|
+
spin,
|
|
681
|
+
rotate,
|
|
682
|
+
tabIndex,
|
|
683
|
+
onClick,
|
|
684
|
+
twoToneColor: _twoToneColor,
|
|
685
|
+
// other
|
|
686
|
+
...restProps
|
|
687
|
+
} = props;
|
|
688
|
+
const {
|
|
689
|
+
prefixCls = 'anticon',
|
|
690
|
+
rootClassName
|
|
691
|
+
} = React.useContext(Context);
|
|
692
|
+
warning(isIconDefinition(icon), `icon should be icon definiton, but got ${typeof icon}`);
|
|
693
|
+
if (!isIconDefinition(icon)) {
|
|
694
|
+
return null;
|
|
695
|
+
}
|
|
696
|
+
const classString = clsx(rootClassName, prefixCls, {
|
|
697
|
+
[`${prefixCls}-${icon.name}`]: !!icon.name,
|
|
698
|
+
[`${prefixCls}-spin`]: !!spin || icon.name === 'loading'
|
|
699
|
+
}, className);
|
|
700
|
+
let iconTabIndex = tabIndex;
|
|
701
|
+
if (iconTabIndex === undefined && onClick) {
|
|
702
|
+
iconTabIndex = -1;
|
|
703
|
+
}
|
|
704
|
+
const svgStyle = rotate ? {
|
|
705
|
+
msTransform: `rotate(${rotate}deg)`,
|
|
706
|
+
transform: `rotate(${rotate}deg)`
|
|
707
|
+
} : undefined;
|
|
708
|
+
return /*#__PURE__*/React.createElement("span", _extends$2({
|
|
709
|
+
role: "img",
|
|
710
|
+
"aria-label": icon.name
|
|
711
|
+
}, restProps, {
|
|
712
|
+
ref: ref,
|
|
713
|
+
tabIndex: iconTabIndex,
|
|
714
|
+
onClick: onClick,
|
|
715
|
+
className: classString
|
|
716
|
+
}), /*#__PURE__*/React.createElement(ReactIcon, {
|
|
717
|
+
icon: icon,
|
|
718
|
+
style: svgStyle
|
|
719
|
+
}));
|
|
720
|
+
});
|
|
721
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
722
|
+
Icon.displayName = 'AntdIcon';
|
|
723
|
+
}
|
|
724
|
+
var AntdIcon = Icon;
|
|
725
|
+
|
|
726
|
+
// This icon file is generated automatically.
|
|
727
|
+
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" };
|
|
728
|
+
var CalendarOutlinedSvg = CalendarOutlined$2;
|
|
729
|
+
|
|
730
|
+
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); }
|
|
731
|
+
const CalendarOutlined = (props, ref) => /*#__PURE__*/React.createElement(AntdIcon, _extends$1({}, props, {
|
|
732
|
+
ref: ref,
|
|
733
|
+
icon: CalendarOutlinedSvg
|
|
734
|
+
}));
|
|
735
|
+
|
|
736
|
+
/** */
|
|
737
|
+
const RefIcon$1 = /*#__PURE__*/React.forwardRef(CalendarOutlined);
|
|
738
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
739
|
+
RefIcon$1.displayName = 'CalendarOutlined';
|
|
740
|
+
}
|
|
741
|
+
var CalendarOutlined$1 = RefIcon$1;
|
|
742
|
+
|
|
743
|
+
// This icon file is generated automatically.
|
|
744
|
+
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" };
|
|
745
|
+
var CloseCircleFilledSvg = CloseCircleFilled$2;
|
|
746
|
+
|
|
747
|
+
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); }
|
|
748
|
+
const CloseCircleFilled = (props, ref) => /*#__PURE__*/React.createElement(AntdIcon, _extends({}, props, {
|
|
749
|
+
ref: ref,
|
|
750
|
+
icon: CloseCircleFilledSvg
|
|
751
|
+
}));
|
|
752
|
+
|
|
753
|
+
/** */
|
|
754
|
+
const RefIcon = /*#__PURE__*/React.forwardRef(CloseCircleFilled);
|
|
755
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
756
|
+
RefIcon.displayName = 'CloseCircleFilled';
|
|
757
|
+
}
|
|
758
|
+
var CloseCircleFilled$1 = RefIcon;
|
|
759
|
+
|
|
760
|
+
const _excluded$2 = ["soFarText", "soFarValue", "picker", "placeholder"];
|
|
373
761
|
const {
|
|
374
762
|
useOnChange: useOnChange$6
|
|
375
763
|
} = hooks;
|
|
@@ -377,7 +765,8 @@ const PickerTodayInner = _ref => {
|
|
|
377
765
|
let {
|
|
378
766
|
soFarText,
|
|
379
767
|
soFarValue = 'soFar',
|
|
380
|
-
picker = 'date'
|
|
768
|
+
picker = 'date',
|
|
769
|
+
placeholder
|
|
381
770
|
} = _ref,
|
|
382
771
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
383
772
|
const {
|
|
@@ -395,6 +784,13 @@ const PickerTodayInner = _ref => {
|
|
|
395
784
|
const soFarLabel = soFarText || formatMessage({
|
|
396
785
|
id: 'SoFar'
|
|
397
786
|
});
|
|
787
|
+
const placeholderList = Array.isArray(placeholder) ? placeholder : [];
|
|
788
|
+
const startPlaceholder = placeholderList[0] || formatMessage({
|
|
789
|
+
id: 'StartDate'
|
|
790
|
+
});
|
|
791
|
+
const endPlaceholder = placeholderList[1] || formatMessage({
|
|
792
|
+
id: 'EndDate'
|
|
793
|
+
});
|
|
398
794
|
|
|
399
795
|
// 根据 picker 类型获取格式化字符串
|
|
400
796
|
const formatPattern = useMemo(() => {
|
|
@@ -521,7 +917,7 @@ const PickerTodayInner = _ref => {
|
|
|
521
917
|
}, []);
|
|
522
918
|
|
|
523
919
|
// 空的 footer(用于开始时间,保持高度一致)
|
|
524
|
-
const renderEmptyFooter = useCallback(() => /*#__PURE__*/
|
|
920
|
+
const renderEmptyFooter = useCallback(() => /*#__PURE__*/React__default.createElement("div", {
|
|
525
921
|
style: {
|
|
526
922
|
height: 40
|
|
527
923
|
}
|
|
@@ -530,11 +926,11 @@ const PickerTodayInner = _ref => {
|
|
|
530
926
|
// 带至今按钮的 footer
|
|
531
927
|
const renderExtraFooter = useCallback(() => {
|
|
532
928
|
const isCurrentSoFar = !tempStart && isSoFar;
|
|
533
|
-
return /*#__PURE__*/
|
|
929
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
534
930
|
style: {
|
|
535
931
|
textAlign: 'right'
|
|
536
932
|
}
|
|
537
|
-
}, /*#__PURE__*/
|
|
933
|
+
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
538
934
|
type: isCurrentSoFar ? 'primary' : 'default',
|
|
539
935
|
onClick: handleSoFarClick
|
|
540
936
|
}, soFarLabel));
|
|
@@ -552,40 +948,36 @@ const PickerTodayInner = _ref => {
|
|
|
552
948
|
const unit = startOfMap[picker] || 'day';
|
|
553
949
|
return current && current < tempStart.startOf(unit);
|
|
554
950
|
}, [tempStart, picker]);
|
|
555
|
-
return /*#__PURE__*/
|
|
951
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
556
952
|
className: "date-picker-today-container",
|
|
557
953
|
ref: containerRef
|
|
558
|
-
}, /*#__PURE__*/
|
|
954
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
559
955
|
className: "date-picker-today-inputs",
|
|
560
956
|
onClick: handleInputClick,
|
|
561
957
|
onMouseEnter: () => setHovering(true),
|
|
562
958
|
onMouseLeave: () => setHovering(false)
|
|
563
|
-
}, /*#__PURE__*/
|
|
959
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
564
960
|
className: "date-picker-today-start"
|
|
565
|
-
}, /*#__PURE__*/
|
|
961
|
+
}, /*#__PURE__*/React__default.createElement("input", {
|
|
566
962
|
readOnly: true,
|
|
567
|
-
placeholder:
|
|
568
|
-
id: 'StartDate'
|
|
569
|
-
}),
|
|
963
|
+
placeholder: startPlaceholder,
|
|
570
964
|
value: displayText.start,
|
|
571
965
|
className: "ant-input"
|
|
572
|
-
})), /*#__PURE__*/
|
|
966
|
+
})), /*#__PURE__*/React__default.createElement("span", {
|
|
573
967
|
className: "date-picker-today-separator"
|
|
574
|
-
}, "~"), /*#__PURE__*/
|
|
968
|
+
}, "~"), /*#__PURE__*/React__default.createElement("div", {
|
|
575
969
|
className: "date-picker-today-end"
|
|
576
|
-
}, /*#__PURE__*/
|
|
970
|
+
}, /*#__PURE__*/React__default.createElement("input", {
|
|
577
971
|
readOnly: true,
|
|
578
|
-
placeholder:
|
|
579
|
-
id: 'EndDate'
|
|
580
|
-
}),
|
|
972
|
+
placeholder: endPlaceholder,
|
|
581
973
|
value: displayText.end,
|
|
582
974
|
className: `ant-input ${isSoFar ? 'so-far-active' : ''}`
|
|
583
|
-
})), /*#__PURE__*/
|
|
975
|
+
})), /*#__PURE__*/React__default.createElement("span", {
|
|
584
976
|
className: "date-picker-today-suffix"
|
|
585
|
-
}, hasValue && hovering ? /*#__PURE__*/
|
|
977
|
+
}, hasValue && hovering ? /*#__PURE__*/React__default.createElement(CloseCircleFilled$1, {
|
|
586
978
|
className: "date-picker-today-clear",
|
|
587
979
|
onClick: handleClear
|
|
588
|
-
}) : /*#__PURE__*/
|
|
980
|
+
}) : /*#__PURE__*/React__default.createElement(CalendarOutlined$1, null))), /*#__PURE__*/React__default.createElement(DatePicker, {
|
|
589
981
|
picker: picker,
|
|
590
982
|
open: openStart,
|
|
591
983
|
onOpenChange: handleStartOpenChange,
|
|
@@ -601,7 +993,7 @@ const PickerTodayInner = _ref => {
|
|
|
601
993
|
position: 'absolute'
|
|
602
994
|
},
|
|
603
995
|
placement: "bottomLeft"
|
|
604
|
-
}), /*#__PURE__*/
|
|
996
|
+
}), /*#__PURE__*/React__default.createElement(DatePicker, {
|
|
605
997
|
picker: picker,
|
|
606
998
|
open: openEnd,
|
|
607
999
|
onOpenChange: handleEndOpenChange,
|
|
@@ -787,7 +1179,7 @@ Slider.Field = Slider$1;
|
|
|
787
1179
|
|
|
788
1180
|
const ResetButton = props => {
|
|
789
1181
|
const resetProps = useReset();
|
|
790
|
-
return /*#__PURE__*/
|
|
1182
|
+
return /*#__PURE__*/React__default.createElement(Button, _extends$3({}, resetProps, props));
|
|
791
1183
|
};
|
|
792
1184
|
|
|
793
1185
|
const _excluded$1 = ["type", "realtime", "disabled"],
|
|
@@ -805,7 +1197,7 @@ const SubmitButton = _ref => {
|
|
|
805
1197
|
isLoading
|
|
806
1198
|
} = _useSubmit,
|
|
807
1199
|
submitProps = _objectWithoutPropertiesLoose(_useSubmit, _excluded2);
|
|
808
|
-
return /*#__PURE__*/
|
|
1200
|
+
return /*#__PURE__*/React__default.createElement(Button, _extends$3({
|
|
809
1201
|
type: type,
|
|
810
1202
|
loading: isLoading,
|
|
811
1203
|
disabled: disabled || (realtime ? !isPass : false)
|
|
@@ -822,7 +1214,7 @@ const CancelButton = _ref => {
|
|
|
822
1214
|
} = _ref,
|
|
823
1215
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
824
1216
|
const remove = useCacheRemove();
|
|
825
|
-
return /*#__PURE__*/
|
|
1217
|
+
return /*#__PURE__*/React__default.createElement(Button, _extends$3({}, props, {
|
|
826
1218
|
onClick: (...args) => {
|
|
827
1219
|
remove();
|
|
828
1220
|
onClick && onClick(...args);
|