@rockshin/tao-ui 0.0.56 → 0.0.58
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/component-manifest.json +1 -1
- package/dist/components/app/app-notices.js +10 -3
- package/dist/components/avatar/avatar.js +1 -1
- package/dist/components/badge/badge.js +2 -2
- package/dist/components/breadcrumb/breadcrumb.js +5 -1
- package/dist/components/calendar/calendar.js +4 -1
- package/dist/components/carousel/carousel.js +8 -2
- package/dist/components/collapse/collapse-panels.js +68 -67
- package/dist/components/date-picker/date-localization.js +12 -14
- package/dist/components/divider/divider.js +1 -1
- package/dist/components/float-button/float-button.js +7 -5
- package/dist/components/form/use-form.d.ts +1 -1
- package/dist/components/form/use-form.js +20 -0
- package/dist/components/image/image.js +135 -143
- package/dist/components/input/otp.js +6 -0
- package/dist/components/input/search.js +7 -5
- package/dist/components/list/list.js +106 -105
- package/dist/components/masonry/masonry.js +1 -1
- package/dist/components/modal/modal.js +112 -35
- package/dist/components/pagination/pagination.d.ts +2 -0
- package/dist/components/pagination/pagination.js +4 -0
- package/dist/components/rate/rate.js +83 -72
- package/dist/components/scroll-area/scroll-area.css +1 -1
- package/dist/components/scroll-area/scroll-area.js +294 -222
- package/dist/components/select/select-tags.js +2 -1
- package/dist/components/select/use-select-selection.d.ts +1 -1
- package/dist/components/select/use-select-selection.js +60 -53
- package/dist/components/statistic/statistic.js +84 -78
- package/dist/components/steps/steps.css +8 -0
- package/dist/components/steps/steps.d.ts +5 -1
- package/dist/components/steps/steps.js +126 -116
- package/dist/components/table/table.js +4 -1
- package/dist/components/upload/upload.js +2 -2
- package/dist/number-input/cursor.js +20 -8
- package/dist/number-input/format.js +12 -4
- package/dist/number-input/use-number-input.js +4 -1
- package/package.json +1 -1
package/component-manifest.json
CHANGED
|
@@ -254,10 +254,17 @@ function useAppMessages(config = {}) {
|
|
|
254
254
|
error: typed('error'),
|
|
255
255
|
loading: typed('loading'),
|
|
256
256
|
destroy: (key_2)=>{
|
|
257
|
-
if (void 0 !== key_2) close(key_2);
|
|
258
|
-
|
|
257
|
+
if (void 0 !== key_2) return void close(key_2);
|
|
258
|
+
const failures = [];
|
|
259
|
+
for (const current of [
|
|
259
260
|
...active.current.keys()
|
|
260
|
-
])
|
|
261
|
+
])try {
|
|
262
|
+
close(current);
|
|
263
|
+
} catch (error) {
|
|
264
|
+
failures.push(error);
|
|
265
|
+
}
|
|
266
|
+
if (1 === failures.length) throw failures[0];
|
|
267
|
+
if (failures.length > 1) throw new AggregateError(failures, 'Message cleanup failed');
|
|
261
268
|
}
|
|
262
269
|
};
|
|
263
270
|
}, [
|
|
@@ -22,7 +22,7 @@ const AvatarRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
22
22
|
const imageSrc = 'string' == typeof src && '' !== src ? src : void 0;
|
|
23
23
|
const hasNativeImage = !customImage && !failed && (!!imageSrc || !!srcSet);
|
|
24
24
|
const hasImage = hasNativeImage || null !== customImage;
|
|
25
|
-
const hasIcon = null != icon && 'boolean' != typeof icon;
|
|
25
|
+
const hasIcon = null != icon && '' !== icon && 'boolean' != typeof icon;
|
|
26
26
|
const [scale, setScale] = useState(1);
|
|
27
27
|
useLayoutEffect(()=>{
|
|
28
28
|
if (hasImage || hasIcon) return;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
|
-
import { forwardRef, isValidElement, useImperativeHandle, useRef } from "react";
|
|
3
|
+
import { Children, forwardRef, isValidElement, useImperativeHandle, useRef } from "react";
|
|
4
4
|
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
5
5
|
import { cx } from "../../utils/semantic.js";
|
|
6
6
|
import "./badge.css";
|
|
@@ -35,7 +35,7 @@ const BadgeRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
35
35
|
const label = void 0 !== numeric && numeric > overflowCount ? `${overflowCount}+` : count;
|
|
36
36
|
const zero = 0 === label || '0' === label;
|
|
37
37
|
const statusMode = (void 0 !== status || void 0 !== color) && (!renderable(label) || zero && !showZero);
|
|
38
|
-
const hasChildren =
|
|
38
|
+
const hasChildren = Children.toArray(children).some(renderable);
|
|
39
39
|
const statusDot = statusMode && (!!text || void 0 !== status || !zero);
|
|
40
40
|
const standaloneStatus = !hasChildren && statusDot;
|
|
41
41
|
const asDot = statusDot || dot && !zero;
|
|
@@ -140,7 +140,8 @@ function Breadcrumb(t0) {
|
|
|
140
140
|
..."button" === content.type ? {
|
|
141
141
|
disabled: true
|
|
142
142
|
} : {},
|
|
143
|
-
onClick: _temp2
|
|
143
|
+
onClick: _temp2,
|
|
144
|
+
onAuxClick: _temp3
|
|
144
145
|
});
|
|
145
146
|
return /*#__PURE__*/ jsx(Slot, {
|
|
146
147
|
...linkProps,
|
|
@@ -282,6 +283,9 @@ function Breadcrumb(t0) {
|
|
|
282
283
|
} else t18 = $[31];
|
|
283
284
|
return t18;
|
|
284
285
|
}
|
|
286
|
+
function _temp3(event_1) {
|
|
287
|
+
return event_1.preventDefault();
|
|
288
|
+
}
|
|
285
289
|
function _temp2(event_0) {
|
|
286
290
|
return event_0.preventDefault();
|
|
287
291
|
}
|
|
@@ -110,7 +110,10 @@ const Calendar = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
110
110
|
props.headerRender ? props.headerRender({
|
|
111
111
|
value,
|
|
112
112
|
type: mode,
|
|
113
|
-
onChange: (date_4)=>
|
|
113
|
+
onChange: (date_4)=>{
|
|
114
|
+
const next_0 = clamp(date_4);
|
|
115
|
+
if (!props.disabledDate?.(next_0)) select(next_0, 'customize');
|
|
116
|
+
},
|
|
114
117
|
onTypeChange: changeMode
|
|
115
118
|
}) : /*#__PURE__*/ jsxs("div", {
|
|
116
119
|
"data-tao-calendar-toolbar": "",
|
|
@@ -185,7 +185,13 @@ const carousel_Carousel = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
185
185
|
const mergedRootRef = useMemo(()=>mergeRefs(rootRef, directionRef), [
|
|
186
186
|
directionRef
|
|
187
187
|
]);
|
|
188
|
-
const
|
|
188
|
+
const slides = Children.map(children, (child)=>{
|
|
189
|
+
if ('string' == typeof child && !child.trim()) return null;
|
|
190
|
+
return 'string' == typeof child || 'number' == typeof child ? /*#__PURE__*/ jsx("span", {
|
|
191
|
+
children: child
|
|
192
|
+
}) : child;
|
|
193
|
+
});
|
|
194
|
+
const childCount = slides?.length ?? 0;
|
|
189
195
|
const itemsPerSlide = (rest.rows ?? 1) * (rest.slidesPerRow ?? 1);
|
|
190
196
|
const count = Math.ceil(childCount / itemsPerSlide);
|
|
191
197
|
const ready = count > 0 && !unslick && null !== responsiveSettings;
|
|
@@ -284,7 +290,7 @@ const carousel_Carousel = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
284
290
|
autoplay: !!autoplay,
|
|
285
291
|
autoplaySpeed: autoplaySpeed,
|
|
286
292
|
waitForAnimate: waitForAnimate,
|
|
287
|
-
children:
|
|
293
|
+
children: slides
|
|
288
294
|
})
|
|
289
295
|
});
|
|
290
296
|
});
|
|
@@ -281,12 +281,13 @@ function CollapsePanel(t0) {
|
|
|
281
281
|
} else t19 = $[27];
|
|
282
282
|
const t20 = open ? "open" : "closed";
|
|
283
283
|
const t21 = disabled || void 0;
|
|
284
|
-
const t22 =
|
|
285
|
-
const t23 =
|
|
286
|
-
const t24 =
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
284
|
+
const t22 = renderBody ? bodyId : void 0;
|
|
285
|
+
const t23 = classNames?.trigger;
|
|
286
|
+
const t24 = styles?.trigger;
|
|
287
|
+
const t25 = !iconOnly && title;
|
|
288
|
+
let t26;
|
|
289
|
+
if ($[28] !== disabled || $[29] !== icon || $[30] !== onToggle || $[31] !== open || $[32] !== t20 || $[33] !== t21 || $[34] !== t22 || $[35] !== t23 || $[36] !== t24 || $[37] !== t25 || $[38] !== titleId) {
|
|
290
|
+
t26 = /*#__PURE__*/ jsxs("button", {
|
|
290
291
|
type: "button",
|
|
291
292
|
"data-tao-collapse-trigger": "",
|
|
292
293
|
"data-tao-collapse-panel-trigger": "",
|
|
@@ -294,33 +295,33 @@ function CollapsePanel(t0) {
|
|
|
294
295
|
"data-disabled": t21,
|
|
295
296
|
disabled: disabled,
|
|
296
297
|
"aria-expanded": open,
|
|
297
|
-
"aria-controls":
|
|
298
|
+
"aria-controls": t22,
|
|
298
299
|
"aria-labelledby": titleId,
|
|
299
300
|
onClick: onToggle,
|
|
300
|
-
className:
|
|
301
|
-
style:
|
|
301
|
+
className: t23,
|
|
302
|
+
style: t24,
|
|
302
303
|
children: [
|
|
303
304
|
icon,
|
|
304
|
-
|
|
305
|
+
t25
|
|
305
306
|
]
|
|
306
307
|
});
|
|
307
|
-
$[28] =
|
|
308
|
-
$[29] =
|
|
309
|
-
$[30] =
|
|
310
|
-
$[31] =
|
|
311
|
-
$[32] =
|
|
312
|
-
$[33] =
|
|
313
|
-
$[34] =
|
|
314
|
-
$[35] =
|
|
315
|
-
$[36] =
|
|
316
|
-
$[37] =
|
|
308
|
+
$[28] = disabled;
|
|
309
|
+
$[29] = icon;
|
|
310
|
+
$[30] = onToggle;
|
|
311
|
+
$[31] = open;
|
|
312
|
+
$[32] = t20;
|
|
313
|
+
$[33] = t21;
|
|
314
|
+
$[34] = t22;
|
|
315
|
+
$[35] = t23;
|
|
316
|
+
$[36] = t24;
|
|
317
|
+
$[37] = t25;
|
|
317
318
|
$[38] = titleId;
|
|
318
|
-
$[39] =
|
|
319
|
-
} else
|
|
320
|
-
const
|
|
321
|
-
let
|
|
319
|
+
$[39] = t26;
|
|
320
|
+
} else t26 = $[39];
|
|
321
|
+
const t27 = iconOnly && title;
|
|
322
|
+
let t28;
|
|
322
323
|
if ($[40] !== classNames?.extra || $[41] !== item.extra || $[42] !== styles?.extra) {
|
|
323
|
-
|
|
324
|
+
t28 = null != item.extra && /*#__PURE__*/ jsx("span", {
|
|
324
325
|
"data-tao-collapse-extra": "",
|
|
325
326
|
className: classNames?.extra,
|
|
326
327
|
style: styles?.extra,
|
|
@@ -329,37 +330,37 @@ function CollapsePanel(t0) {
|
|
|
329
330
|
$[40] = classNames?.extra;
|
|
330
331
|
$[41] = item.extra;
|
|
331
332
|
$[42] = styles?.extra;
|
|
332
|
-
$[43] =
|
|
333
|
-
} else
|
|
334
|
-
let
|
|
335
|
-
if ($[44] !== expandIconPlacement || $[45] !== t13 || $[46] !== t16 || $[47] !== t19 || $[48] !==
|
|
336
|
-
|
|
333
|
+
$[43] = t28;
|
|
334
|
+
} else t28 = $[43];
|
|
335
|
+
let t29;
|
|
336
|
+
if ($[44] !== expandIconPlacement || $[45] !== t13 || $[46] !== t16 || $[47] !== t19 || $[48] !== t26 || $[49] !== t27 || $[50] !== t28) {
|
|
337
|
+
t29 = /*#__PURE__*/ jsxs("div", {
|
|
337
338
|
"data-tao-collapse-header": "",
|
|
338
339
|
"data-tao-trigger-mode": t13,
|
|
339
340
|
"data-tao-icon-placement": expandIconPlacement,
|
|
340
341
|
className: t16,
|
|
341
342
|
style: t19,
|
|
342
343
|
children: [
|
|
343
|
-
t25,
|
|
344
344
|
t26,
|
|
345
|
-
t27
|
|
345
|
+
t27,
|
|
346
|
+
t28
|
|
346
347
|
]
|
|
347
348
|
});
|
|
348
349
|
$[44] = expandIconPlacement;
|
|
349
350
|
$[45] = t13;
|
|
350
351
|
$[46] = t16;
|
|
351
352
|
$[47] = t19;
|
|
352
|
-
$[48] =
|
|
353
|
-
$[49] =
|
|
354
|
-
$[50] =
|
|
355
|
-
$[51] =
|
|
356
|
-
} else
|
|
357
|
-
const
|
|
358
|
-
const
|
|
359
|
-
const
|
|
360
|
-
let
|
|
353
|
+
$[48] = t26;
|
|
354
|
+
$[49] = t27;
|
|
355
|
+
$[50] = t28;
|
|
356
|
+
$[51] = t29;
|
|
357
|
+
} else t29 = $[51];
|
|
358
|
+
const t30 = !open;
|
|
359
|
+
const t31 = classNames?.content;
|
|
360
|
+
const t32 = styles?.content;
|
|
361
|
+
let t33;
|
|
361
362
|
if ($[52] !== classNames?.body || $[53] !== item.children || $[54] !== item.classNames?.body || $[55] !== item.styles?.body || $[56] !== renderBody || $[57] !== styles?.body) {
|
|
362
|
-
|
|
363
|
+
t33 = renderBody && /*#__PURE__*/ jsx("div", {
|
|
363
364
|
"data-tao-collapse-body": "",
|
|
364
365
|
className: cx(classNames?.body, item.classNames?.body),
|
|
365
366
|
style: {
|
|
@@ -374,49 +375,49 @@ function CollapsePanel(t0) {
|
|
|
374
375
|
$[55] = item.styles?.body;
|
|
375
376
|
$[56] = renderBody;
|
|
376
377
|
$[57] = styles?.body;
|
|
377
|
-
$[58] =
|
|
378
|
-
} else
|
|
379
|
-
let
|
|
380
|
-
if ($[59] !== bodyId || $[60] !==
|
|
381
|
-
|
|
378
|
+
$[58] = t33;
|
|
379
|
+
} else t33 = $[58];
|
|
380
|
+
let t34;
|
|
381
|
+
if ($[59] !== bodyId || $[60] !== t30 || $[61] !== t31 || $[62] !== t32 || $[63] !== t33 || $[64] !== titleId) {
|
|
382
|
+
t34 = /*#__PURE__*/ jsx("section", {
|
|
382
383
|
id: bodyId,
|
|
383
384
|
"aria-labelledby": titleId,
|
|
384
|
-
hidden:
|
|
385
|
+
hidden: t30,
|
|
385
386
|
"data-tao-collapse-content": "",
|
|
386
387
|
"data-tao-collapse-panel-content": "",
|
|
387
|
-
className:
|
|
388
|
-
style:
|
|
389
|
-
children:
|
|
388
|
+
className: t31,
|
|
389
|
+
style: t32,
|
|
390
|
+
children: t33
|
|
390
391
|
});
|
|
391
392
|
$[59] = bodyId;
|
|
392
|
-
$[60] =
|
|
393
|
-
$[61] =
|
|
394
|
-
$[62] =
|
|
395
|
-
$[63] =
|
|
393
|
+
$[60] = t30;
|
|
394
|
+
$[61] = t31;
|
|
395
|
+
$[62] = t32;
|
|
396
|
+
$[63] = t33;
|
|
396
397
|
$[64] = titleId;
|
|
397
|
-
$[65] =
|
|
398
|
-
} else
|
|
399
|
-
let
|
|
400
|
-
if ($[66] !== t10 || $[67] !== t12 || $[68] !==
|
|
401
|
-
|
|
398
|
+
$[65] = t34;
|
|
399
|
+
} else t34 = $[65];
|
|
400
|
+
let t35;
|
|
401
|
+
if ($[66] !== t10 || $[67] !== t12 || $[68] !== t29 || $[69] !== t34 || $[70] !== t7 || $[71] !== t8) {
|
|
402
|
+
t35 = /*#__PURE__*/ jsxs("div", {
|
|
402
403
|
"data-tao-collapse-item": "",
|
|
403
404
|
"data-state": t7,
|
|
404
405
|
"data-disabled": t8,
|
|
405
406
|
className: t10,
|
|
406
407
|
style: t12,
|
|
407
408
|
children: [
|
|
408
|
-
|
|
409
|
-
|
|
409
|
+
t29,
|
|
410
|
+
t34
|
|
410
411
|
]
|
|
411
412
|
});
|
|
412
413
|
$[66] = t10;
|
|
413
414
|
$[67] = t12;
|
|
414
|
-
$[68] =
|
|
415
|
-
$[69] =
|
|
415
|
+
$[68] = t29;
|
|
416
|
+
$[69] = t34;
|
|
416
417
|
$[70] = t7;
|
|
417
418
|
$[71] = t8;
|
|
418
|
-
$[72] =
|
|
419
|
-
} else
|
|
420
|
-
return
|
|
419
|
+
$[72] = t35;
|
|
420
|
+
} else t35 = $[72];
|
|
421
|
+
return t35;
|
|
421
422
|
}
|
|
422
423
|
export { CollapsePanels };
|
|
@@ -58,19 +58,17 @@ function parsePickerDate(text, format, locale, numberLocale) {
|
|
|
58
58
|
date.format(`D ${token}`).slice(2)
|
|
59
59
|
];
|
|
60
60
|
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const parsedMonth = dayjs(`${normalized} ${String(selected.month + 1).padStart(2, '0')}`, `${numericFormat} MM`, locale, true);
|
|
74
|
-
return exactResult(parsedMonth);
|
|
61
|
+
for(let month = 0; month < 12; month++){
|
|
62
|
+
const matchesMonth = monthNames(month, monthTokens[0]).some((name)=>normalized.includes(name));
|
|
63
|
+
if (!matchesMonth) continue;
|
|
64
|
+
const numericFormat = namedFormat.replace(/(\[[^\]]*])|(MMMM|MMM)/g, (token, literal)=>{
|
|
65
|
+
if (literal) return literal;
|
|
66
|
+
const name = monthNames(month, token).sort((left, right)=>right.length - left.length).find((candidate)=>normalized.includes(candidate));
|
|
67
|
+
return `[${name}]`;
|
|
68
|
+
});
|
|
69
|
+
const parsed = exactResult(dayjs(`${normalized} ${String(month + 1).padStart(2, '0')}`, `${numericFormat} MM`, locale, true));
|
|
70
|
+
if (parsed.isValid()) return parsed;
|
|
71
|
+
}
|
|
72
|
+
return dayjs(0 / 0);
|
|
75
73
|
}
|
|
76
74
|
export { formatPickerDate, parsePickerDate };
|
|
@@ -24,7 +24,7 @@ const Divider = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
24
24
|
useImperativeHandle(ref, ()=>({
|
|
25
25
|
nativeElement: node.current
|
|
26
26
|
}));
|
|
27
|
-
const hasTitle = 'horizontal' === direction && null != children && 'boolean' != typeof children;
|
|
27
|
+
const hasTitle = 'horizontal' === direction && null != children && '' !== children && 'boolean' != typeof children;
|
|
28
28
|
const margin = 'string' == typeof orientationMargin && /^-?(?:\d+\.?\d*|\.\d+)$/.test(orientationMargin.trim()) ? Number(orientationMargin) : orientationMargin;
|
|
29
29
|
const titleStyle = {
|
|
30
30
|
...'start' === titlePlacement ? {
|
|
@@ -49,7 +49,8 @@ const FloatButtonRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
49
49
|
const slots = 'function' == typeof styles ? styles({
|
|
50
50
|
props: merged
|
|
51
51
|
}) : styles;
|
|
52
|
-
const
|
|
52
|
+
const isLink = null != href;
|
|
53
|
+
const Tag = isLink ? 'a' : 'button';
|
|
53
54
|
const node = useRef(null);
|
|
54
55
|
useImperativeHandle(ref, ()=>node.current);
|
|
55
56
|
const hasLabel = null != label && 'boolean' != typeof label;
|
|
@@ -61,10 +62,10 @@ const FloatButtonRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
61
62
|
},
|
|
62
63
|
href: disabled ? void 0 : href,
|
|
63
64
|
target: target,
|
|
64
|
-
type:
|
|
65
|
-
disabled:
|
|
66
|
-
"aria-disabled":
|
|
67
|
-
tabIndex:
|
|
65
|
+
type: isLink ? void 0 : htmlType,
|
|
66
|
+
disabled: isLink ? void 0 : disabled,
|
|
67
|
+
"aria-disabled": isLink && disabled || void 0,
|
|
68
|
+
tabIndex: isLink && disabled ? -1 : rest.tabIndex,
|
|
68
69
|
"aria-label": props['aria-label'] ?? (hasLabel ? void 0 : 'string' == typeof tooltip ? tooltip : 'Action'),
|
|
69
70
|
"data-tao-float-button": "",
|
|
70
71
|
"data-tao-type": type,
|
|
@@ -80,6 +81,7 @@ const FloatButtonRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
80
81
|
if (disabled) return void event.preventDefault();
|
|
81
82
|
rest.onClick?.(event);
|
|
82
83
|
},
|
|
84
|
+
onAuxClick: disabled ? (event_0)=>event_0.preventDefault() : rest.onAuxClick,
|
|
83
85
|
children: [
|
|
84
86
|
null !== glyph && /*#__PURE__*/ jsx("span", {
|
|
85
87
|
"data-tao-float-button-icon": "",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type FormInstance as RcFormInstance
|
|
1
|
+
import { type NamePath, type FormInstance as RcFormInstance } from '@rc-component/form';
|
|
2
2
|
import { type Options } from 'scroll-into-view-if-needed';
|
|
3
3
|
export type FormScrollOptions = Options & {
|
|
4
4
|
focus?: boolean;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { c } from "react-compiler-runtime";
|
|
2
2
|
import { useForm } from "@rc-component/form";
|
|
3
|
+
import { isEqual } from "@rc-component/util";
|
|
3
4
|
import { getDOM } from "@rc-component/util/es/Dom/findDOMNode";
|
|
4
5
|
import scroll_into_view_if_needed from "scroll-into-view-if-needed";
|
|
5
6
|
const use_form_scroll = scroll_into_view_if_needed;
|
|
7
|
+
const VALIDATION_STATE_KEYS = [
|
|
8
|
+
'errors',
|
|
9
|
+
'warnings',
|
|
10
|
+
'touched',
|
|
11
|
+
'validating'
|
|
12
|
+
];
|
|
6
13
|
const fieldRegistries = new WeakMap();
|
|
7
14
|
function getFieldRegistry(form) {
|
|
8
15
|
return fieldRegistries.get(form);
|
|
@@ -26,6 +33,13 @@ function use_form_useForm(form) {
|
|
|
26
33
|
const fields = new Map();
|
|
27
34
|
instance = {
|
|
28
35
|
...rcForm,
|
|
36
|
+
setFields (nextFields) {
|
|
37
|
+
const stale = nextFields.filter((field)=>"value" in field && VALIDATION_STATE_KEYS.every((key)=>!(key in field)) && !isEqual(field.value, rcForm.getFieldValue(field.name)));
|
|
38
|
+
rcForm.setFields(stale.length ? [
|
|
39
|
+
...stale.map(_temp),
|
|
40
|
+
...nextFields
|
|
41
|
+
] : nextFields);
|
|
42
|
+
},
|
|
29
43
|
scrollToField (name, t1) {
|
|
30
44
|
const options = void 0 === t1 ? {} : t1;
|
|
31
45
|
const targets = fields.get(fieldKey(name));
|
|
@@ -67,4 +81,10 @@ function use_form_useForm(form) {
|
|
|
67
81
|
} else t1 = $[3];
|
|
68
82
|
return t1;
|
|
69
83
|
}
|
|
84
|
+
function _temp(field_0) {
|
|
85
|
+
return {
|
|
86
|
+
name: field_0.name,
|
|
87
|
+
errors: []
|
|
88
|
+
};
|
|
89
|
+
}
|
|
70
90
|
export { fieldKey, getFieldRegistry, use_form_useForm as useForm };
|