@rjsf/antd 6.0.0-beta.8 → 6.0.0
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/README.md +8 -4
- package/dist/antd.esm.js +248 -227
- package/dist/antd.esm.js.map +4 -4
- package/dist/antd.umd.js +176 -157
- package/dist/{index.js → index.cjs} +227 -203
- package/dist/index.cjs.map +7 -0
- package/lib/templates/ArrayFieldItemTemplate/index.d.ts +3 -3
- package/lib/templates/ArrayFieldItemTemplate/index.js +1 -1
- package/lib/templates/ArrayFieldItemTemplate/index.js.map +1 -1
- package/lib/templates/ArrayFieldTemplate/index.d.ts +1 -1
- package/lib/templates/ArrayFieldTemplate/index.js +5 -5
- package/lib/templates/ArrayFieldTemplate/index.js.map +1 -1
- package/lib/templates/BaseInputTemplate/index.js +3 -2
- package/lib/templates/BaseInputTemplate/index.js.map +1 -1
- package/lib/templates/FieldErrorTemplate/index.js +2 -2
- package/lib/templates/FieldErrorTemplate/index.js.map +1 -1
- package/lib/templates/FieldTemplate/index.js +3 -2
- package/lib/templates/FieldTemplate/index.js.map +1 -1
- package/lib/templates/IconButton/index.d.ts +2 -2
- package/lib/templates/IconButton/index.js +6 -4
- package/lib/templates/IconButton/index.js.map +1 -1
- package/lib/templates/MultiSchemaFieldTemplate/index.d.ts +2 -0
- package/lib/templates/MultiSchemaFieldTemplate/index.js +6 -0
- package/lib/templates/MultiSchemaFieldTemplate/index.js.map +1 -0
- package/lib/templates/ObjectFieldTemplate/index.js +5 -3
- package/lib/templates/ObjectFieldTemplate/index.js.map +1 -1
- package/lib/templates/OptionalDataControlsTemplate/index.d.ts +10 -0
- package/lib/templates/OptionalDataControlsTemplate/index.js +21 -0
- package/lib/templates/OptionalDataControlsTemplate/index.js.map +1 -0
- package/lib/templates/TitleField/index.d.ts +1 -1
- package/lib/templates/TitleField/index.js +8 -4
- package/lib/templates/TitleField/index.js.map +1 -1
- package/lib/templates/WrapIfAdditionalTemplate/index.js +2 -3
- package/lib/templates/WrapIfAdditionalTemplate/index.js.map +1 -1
- package/lib/templates/index.js +4 -0
- package/lib/templates/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/widgets/AltDateTimeWidget/index.d.ts +1 -1
- package/lib/widgets/AltDateTimeWidget/index.js +2 -2
- package/lib/widgets/AltDateTimeWidget/index.js.map +1 -1
- package/lib/widgets/AltDateWidget/index.d.ts +1 -1
- package/lib/widgets/AltDateWidget/index.js +9 -61
- package/lib/widgets/AltDateWidget/index.js.map +1 -1
- package/lib/widgets/CheckboxWidget/index.js +3 -2
- package/lib/widgets/CheckboxWidget/index.js.map +1 -1
- package/lib/widgets/CheckboxesWidget/index.d.ts +1 -1
- package/lib/widgets/CheckboxesWidget/index.js +4 -3
- package/lib/widgets/CheckboxesWidget/index.js.map +1 -1
- package/lib/widgets/DateTimeWidget/index.js +2 -1
- package/lib/widgets/DateTimeWidget/index.js.map +1 -1
- package/lib/widgets/DateWidget/index.js +2 -1
- package/lib/widgets/DateWidget/index.js.map +1 -1
- package/lib/widgets/PasswordWidget/index.js +2 -1
- package/lib/widgets/PasswordWidget/index.js.map +1 -1
- package/lib/widgets/RadioWidget/index.d.ts +1 -1
- package/lib/widgets/RadioWidget/index.js +4 -3
- package/lib/widgets/RadioWidget/index.js.map +1 -1
- package/lib/widgets/RangeWidget/index.js +2 -1
- package/lib/widgets/RangeWidget/index.js.map +1 -1
- package/lib/widgets/SelectWidget/index.d.ts +1 -1
- package/lib/widgets/SelectWidget/index.js +3 -2
- package/lib/widgets/SelectWidget/index.js.map +1 -1
- package/lib/widgets/TextareaWidget/index.d.ts +1 -1
- package/lib/widgets/TextareaWidget/index.js +3 -2
- package/lib/widgets/TextareaWidget/index.js.map +1 -1
- package/package.json +21 -21
- package/src/templates/ArrayFieldItemTemplate/index.tsx +3 -3
- package/src/templates/ArrayFieldTemplate/index.tsx +12 -18
- package/src/templates/BaseInputTemplate/index.tsx +10 -8
- package/src/templates/FieldErrorTemplate/index.tsx +2 -2
- package/src/templates/FieldTemplate/index.tsx +7 -5
- package/src/templates/IconButton/index.tsx +10 -8
- package/src/templates/MultiSchemaFieldTemplate/index.tsx +16 -0
- package/src/templates/ObjectFieldTemplate/index.tsx +12 -9
- package/src/templates/OptionalDataControlsTemplate/index.tsx +47 -0
- package/src/templates/TitleField/index.tsx +18 -3
- package/src/templates/WrapIfAdditionalTemplate/index.tsx +5 -8
- package/src/templates/index.ts +4 -0
- package/src/widgets/AltDateTimeWidget/index.tsx +2 -2
- package/src/widgets/AltDateWidget/index.tsx +21 -120
- package/src/widgets/CheckboxWidget/index.tsx +5 -3
- package/src/widgets/CheckboxesWidget/index.tsx +17 -4
- package/src/widgets/DateTimeWidget/index.tsx +3 -2
- package/src/widgets/DateWidget/index.tsx +3 -2
- package/src/widgets/PasswordWidget/index.tsx +3 -2
- package/src/widgets/RadioWidget/index.tsx +6 -4
- package/src/widgets/RangeWidget/index.tsx +3 -2
- package/src/widgets/SelectWidget/index.tsx +5 -3
- package/src/widgets/TextareaWidget/index.tsx +5 -3
- package/dist/index.js.map +0 -7
package/dist/antd.esm.js
CHANGED
|
@@ -47,9 +47,9 @@ function ArrayFieldTemplate(props) {
|
|
|
47
47
|
canAdd,
|
|
48
48
|
className,
|
|
49
49
|
disabled,
|
|
50
|
-
|
|
51
|
-
idSchema,
|
|
50
|
+
fieldPathId,
|
|
52
51
|
items,
|
|
52
|
+
optionalDataControl,
|
|
53
53
|
onAddClick,
|
|
54
54
|
readonly,
|
|
55
55
|
registry,
|
|
@@ -64,16 +64,13 @@ function ArrayFieldTemplate(props) {
|
|
|
64
64
|
registry,
|
|
65
65
|
uiOptions
|
|
66
66
|
);
|
|
67
|
-
const ArrayFieldItemTemplate2 = getTemplate2(
|
|
68
|
-
"ArrayFieldItemTemplate",
|
|
69
|
-
registry,
|
|
70
|
-
uiOptions
|
|
71
|
-
);
|
|
72
67
|
const ArrayFieldTitleTemplate = getTemplate2(
|
|
73
68
|
"ArrayFieldTitleTemplate",
|
|
74
69
|
registry,
|
|
75
70
|
uiOptions
|
|
76
71
|
);
|
|
72
|
+
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
73
|
+
const { formContext } = registry;
|
|
77
74
|
const {
|
|
78
75
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
79
76
|
} = registry.templates;
|
|
@@ -86,33 +83,37 @@ function ArrayFieldTemplate(props) {
|
|
|
86
83
|
labelAlign === "left" && `${labelClsBasic}-left`
|
|
87
84
|
// labelCol.className,
|
|
88
85
|
);
|
|
89
|
-
return /* @__PURE__ */ jsx2("fieldset", { className, id:
|
|
86
|
+
return /* @__PURE__ */ jsx2("fieldset", { className, id: fieldPathId.$id, children: /* @__PURE__ */ jsxs2(Row2, { gutter: rowGutter, children: [
|
|
90
87
|
(uiOptions.title || title) && /* @__PURE__ */ jsx2(Col2, { className: labelColClassName, span: 24, children: /* @__PURE__ */ jsx2(
|
|
91
88
|
ArrayFieldTitleTemplate,
|
|
92
89
|
{
|
|
93
|
-
|
|
90
|
+
fieldPathId,
|
|
94
91
|
required,
|
|
95
92
|
title: uiOptions.title || title,
|
|
96
93
|
schema,
|
|
97
94
|
uiSchema,
|
|
98
|
-
registry
|
|
95
|
+
registry,
|
|
96
|
+
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
99
97
|
}
|
|
100
98
|
) }),
|
|
101
99
|
(uiOptions.description || schema.description) && /* @__PURE__ */ jsx2(Col2, { span: 24, style: DESCRIPTION_COL_STYLE, children: /* @__PURE__ */ jsx2(
|
|
102
100
|
ArrayFieldDescriptionTemplate,
|
|
103
101
|
{
|
|
104
102
|
description: uiOptions.description || schema.description,
|
|
105
|
-
|
|
103
|
+
fieldPathId,
|
|
106
104
|
schema,
|
|
107
105
|
uiSchema,
|
|
108
106
|
registry
|
|
109
107
|
}
|
|
110
108
|
) }),
|
|
111
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ jsxs2(Col2, { className: "row array-item-list", span: 24, children: [
|
|
110
|
+
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
111
|
+
items
|
|
112
|
+
] }),
|
|
112
113
|
canAdd && /* @__PURE__ */ jsx2(Col2, { span: 24, children: /* @__PURE__ */ jsx2(Row2, { gutter: rowGutter, justify: "end", children: /* @__PURE__ */ jsx2(Col2, { flex: "192px", children: /* @__PURE__ */ jsx2(
|
|
113
114
|
AddButton2,
|
|
114
115
|
{
|
|
115
|
-
id: buttonId(
|
|
116
|
+
id: buttonId(fieldPathId, "add"),
|
|
116
117
|
className: "rjsf-array-item-add",
|
|
117
118
|
disabled: disabled || readonly,
|
|
118
119
|
onClick: onAddClick,
|
|
@@ -137,8 +138,9 @@ var INPUT_STYLE = {
|
|
|
137
138
|
function BaseInputTemplate(props) {
|
|
138
139
|
const {
|
|
139
140
|
disabled,
|
|
140
|
-
|
|
141
|
+
registry,
|
|
141
142
|
id,
|
|
143
|
+
htmlName,
|
|
142
144
|
onBlur,
|
|
143
145
|
onChange,
|
|
144
146
|
onChangeOverride,
|
|
@@ -150,6 +152,7 @@ function BaseInputTemplate(props) {
|
|
|
150
152
|
value,
|
|
151
153
|
type
|
|
152
154
|
} = props;
|
|
155
|
+
const { formContext } = registry;
|
|
153
156
|
const inputProps = getInputProps(schema, type, options, false);
|
|
154
157
|
const { readonlyAsDisabled = true } = formContext;
|
|
155
158
|
const handleNumberChange = (nextValue) => onChange(nextValue);
|
|
@@ -161,7 +164,7 @@ function BaseInputTemplate(props) {
|
|
|
161
164
|
{
|
|
162
165
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
163
166
|
id,
|
|
164
|
-
name: id,
|
|
167
|
+
name: htmlName || id,
|
|
165
168
|
onBlur: !readonly ? handleBlur : void 0,
|
|
166
169
|
onChange: !readonly ? handleNumberChange : void 0,
|
|
167
170
|
onFocus: !readonly ? handleFocus : void 0,
|
|
@@ -177,7 +180,7 @@ function BaseInputTemplate(props) {
|
|
|
177
180
|
{
|
|
178
181
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
179
182
|
id,
|
|
180
|
-
name: id,
|
|
183
|
+
name: htmlName || id,
|
|
181
184
|
onBlur: !readonly ? handleBlur : void 0,
|
|
182
185
|
onChange: !readonly ? handleTextChange : void 0,
|
|
183
186
|
onFocus: !readonly ? handleFocus : void 0,
|
|
@@ -246,13 +249,18 @@ import {
|
|
|
246
249
|
} from "@rjsf/utils";
|
|
247
250
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
248
251
|
function IconButton(props) {
|
|
249
|
-
const { iconType = "default", icon, onClick, uiSchema, registry, ...otherProps } = props;
|
|
252
|
+
const { iconType = "default", icon, onClick, uiSchema, registry, color, ...otherProps } = props;
|
|
250
253
|
return /* @__PURE__ */ jsx6(
|
|
251
254
|
Button,
|
|
252
255
|
{
|
|
253
256
|
onClick,
|
|
254
257
|
type: iconType,
|
|
255
258
|
icon,
|
|
259
|
+
color,
|
|
260
|
+
style: {
|
|
261
|
+
paddingTop: "4px"
|
|
262
|
+
/* Center the button */
|
|
263
|
+
},
|
|
256
264
|
...otherProps
|
|
257
265
|
}
|
|
258
266
|
);
|
|
@@ -265,9 +273,9 @@ function AddButton(props) {
|
|
|
265
273
|
IconButton,
|
|
266
274
|
{
|
|
267
275
|
title: translateString(TranslatableString2.AddItemButton),
|
|
268
|
-
...props,
|
|
269
|
-
block: true,
|
|
270
276
|
iconType: "primary",
|
|
277
|
+
block: true,
|
|
278
|
+
...props,
|
|
271
279
|
icon: /* @__PURE__ */ jsx6(PlusCircleOutlined, {})
|
|
272
280
|
}
|
|
273
281
|
);
|
|
@@ -299,10 +307,10 @@ function RemoveButton(props) {
|
|
|
299
307
|
IconButton,
|
|
300
308
|
{
|
|
301
309
|
title: translateString(TranslatableString2.RemoveButton),
|
|
302
|
-
...props,
|
|
303
310
|
danger: true,
|
|
304
311
|
block: !!options.block,
|
|
305
312
|
iconType: "primary",
|
|
313
|
+
...props,
|
|
306
314
|
icon: /* @__PURE__ */ jsx6(DeleteOutlined, {})
|
|
307
315
|
}
|
|
308
316
|
);
|
|
@@ -312,11 +320,11 @@ function RemoveButton(props) {
|
|
|
312
320
|
import { errorId } from "@rjsf/utils";
|
|
313
321
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
314
322
|
function FieldErrorTemplate(props) {
|
|
315
|
-
const { errors = [],
|
|
323
|
+
const { errors = [], fieldPathId } = props;
|
|
316
324
|
if (errors.length === 0) {
|
|
317
325
|
return null;
|
|
318
326
|
}
|
|
319
|
-
const id = errorId(
|
|
327
|
+
const id = errorId(fieldPathId);
|
|
320
328
|
return /* @__PURE__ */ jsx7("div", { id, children: errors.map((error) => /* @__PURE__ */ jsx7("div", { children: error }, `field-${id}-error-${error}`)) });
|
|
321
329
|
}
|
|
322
330
|
|
|
@@ -338,13 +346,13 @@ function FieldTemplate(props) {
|
|
|
338
346
|
disabled,
|
|
339
347
|
displayLabel,
|
|
340
348
|
errors,
|
|
341
|
-
formContext,
|
|
342
349
|
help,
|
|
343
350
|
hidden,
|
|
344
351
|
id,
|
|
345
352
|
label,
|
|
346
|
-
|
|
347
|
-
|
|
353
|
+
onKeyRename,
|
|
354
|
+
onKeyRenameBlur,
|
|
355
|
+
onRemoveProperty,
|
|
348
356
|
rawErrors,
|
|
349
357
|
rawDescription,
|
|
350
358
|
rawHelp,
|
|
@@ -354,6 +362,7 @@ function FieldTemplate(props) {
|
|
|
354
362
|
schema,
|
|
355
363
|
uiSchema
|
|
356
364
|
} = props;
|
|
365
|
+
const { formContext } = registry;
|
|
357
366
|
const {
|
|
358
367
|
colon,
|
|
359
368
|
labelCol = VERTICAL_LABEL_COL,
|
|
@@ -389,8 +398,9 @@ function FieldTemplate(props) {
|
|
|
389
398
|
disabled,
|
|
390
399
|
id,
|
|
391
400
|
label,
|
|
392
|
-
|
|
393
|
-
|
|
401
|
+
onKeyRename,
|
|
402
|
+
onKeyRenameBlur,
|
|
403
|
+
onRemoveProperty,
|
|
394
404
|
readonly,
|
|
395
405
|
required,
|
|
396
406
|
schema,
|
|
@@ -428,6 +438,16 @@ function GridTemplate(props) {
|
|
|
428
438
|
return /* @__PURE__ */ jsx9(Row3, { ...rest, children });
|
|
429
439
|
}
|
|
430
440
|
|
|
441
|
+
// src/templates/MultiSchemaFieldTemplate/index.tsx
|
|
442
|
+
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
443
|
+
function MultiSchemaFieldTemplate(props) {
|
|
444
|
+
const { optionSchemaField, selector } = props;
|
|
445
|
+
return /* @__PURE__ */ jsxs5("div", { children: [
|
|
446
|
+
/* @__PURE__ */ jsx10("div", { children: selector }),
|
|
447
|
+
optionSchemaField
|
|
448
|
+
] });
|
|
449
|
+
}
|
|
450
|
+
|
|
431
451
|
// src/templates/ObjectFieldTemplate/index.tsx
|
|
432
452
|
import classNames2 from "classnames";
|
|
433
453
|
import isObject from "lodash/isObject";
|
|
@@ -443,7 +463,7 @@ import {
|
|
|
443
463
|
} from "@rjsf/utils";
|
|
444
464
|
import { Col as Col4, Row as Row4, ConfigProvider as ConfigProvider2 } from "antd";
|
|
445
465
|
import { useContext as useContext2 } from "react";
|
|
446
|
-
import { jsx as
|
|
466
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
447
467
|
var DESCRIPTION_COL_STYLE2 = {
|
|
448
468
|
paddingBottom: "8px"
|
|
449
469
|
};
|
|
@@ -451,10 +471,10 @@ function ObjectFieldTemplate(props) {
|
|
|
451
471
|
const {
|
|
452
472
|
description,
|
|
453
473
|
disabled,
|
|
454
|
-
formContext,
|
|
455
474
|
formData,
|
|
456
|
-
|
|
457
|
-
|
|
475
|
+
fieldPathId,
|
|
476
|
+
onAddProperty,
|
|
477
|
+
optionalDataControl,
|
|
458
478
|
properties,
|
|
459
479
|
readonly,
|
|
460
480
|
required,
|
|
@@ -470,6 +490,8 @@ function ObjectFieldTemplate(props) {
|
|
|
470
490
|
registry,
|
|
471
491
|
uiOptions
|
|
472
492
|
);
|
|
493
|
+
const { formContext } = registry;
|
|
494
|
+
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
473
495
|
const {
|
|
474
496
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
475
497
|
} = registry.templates;
|
|
@@ -510,38 +532,40 @@ function ObjectFieldTemplate(props) {
|
|
|
510
532
|
labelAlign === "left" && `${labelClsBasic}-left`
|
|
511
533
|
// labelCol.className,
|
|
512
534
|
);
|
|
513
|
-
return /* @__PURE__ */
|
|
514
|
-
/* @__PURE__ */
|
|
515
|
-
title && /* @__PURE__ */
|
|
535
|
+
return /* @__PURE__ */ jsxs6("fieldset", { id: fieldPathId.$id, children: [
|
|
536
|
+
/* @__PURE__ */ jsxs6(Row4, { gutter: rowGutter, children: [
|
|
537
|
+
title && /* @__PURE__ */ jsx11(Col4, { className: labelColClassName, span: 24, children: /* @__PURE__ */ jsx11(
|
|
516
538
|
TitleFieldTemplate,
|
|
517
539
|
{
|
|
518
|
-
id: titleId(
|
|
540
|
+
id: titleId(fieldPathId),
|
|
519
541
|
title,
|
|
520
542
|
required,
|
|
521
543
|
schema,
|
|
522
544
|
uiSchema,
|
|
523
|
-
registry
|
|
545
|
+
registry,
|
|
546
|
+
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
524
547
|
}
|
|
525
548
|
) }),
|
|
526
|
-
description && /* @__PURE__ */
|
|
549
|
+
description && /* @__PURE__ */ jsx11(Col4, { span: 24, style: DESCRIPTION_COL_STYLE2, children: /* @__PURE__ */ jsx11(
|
|
527
550
|
DescriptionFieldTemplate,
|
|
528
551
|
{
|
|
529
|
-
id: descriptionId(
|
|
552
|
+
id: descriptionId(fieldPathId),
|
|
530
553
|
description,
|
|
531
554
|
schema,
|
|
532
555
|
uiSchema,
|
|
533
556
|
registry
|
|
534
557
|
}
|
|
535
558
|
) }),
|
|
536
|
-
|
|
559
|
+
!showOptionalDataControlInTitle ? /* @__PURE__ */ jsx11(Col4, { span: 24, children: optionalDataControl }) : void 0,
|
|
560
|
+
properties.filter((e) => !e.hidden).map((element) => /* @__PURE__ */ jsx11(Col4, { span: calculateColSpan(element), children: element.content }, element.name))
|
|
537
561
|
] }),
|
|
538
|
-
canExpand(schema, uiSchema, formData) && /* @__PURE__ */
|
|
562
|
+
canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsx11(Col4, { span: 24, children: /* @__PURE__ */ jsx11(Row4, { gutter: rowGutter, justify: "end", children: /* @__PURE__ */ jsx11(Col4, { flex: "192px", children: /* @__PURE__ */ jsx11(
|
|
539
563
|
AddButton2,
|
|
540
564
|
{
|
|
541
|
-
id: buttonId2(
|
|
565
|
+
id: buttonId2(fieldPathId, "add"),
|
|
542
566
|
className: "rjsf-object-property-expand",
|
|
543
567
|
disabled: disabled || readonly,
|
|
544
|
-
onClick:
|
|
568
|
+
onClick: onAddProperty,
|
|
545
569
|
uiSchema,
|
|
546
570
|
registry
|
|
547
571
|
}
|
|
@@ -549,28 +573,65 @@ function ObjectFieldTemplate(props) {
|
|
|
549
573
|
] });
|
|
550
574
|
}
|
|
551
575
|
|
|
576
|
+
// src/templates/OptionalDataControlsTemplate/index.tsx
|
|
577
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
578
|
+
function OptionalDataControlsTemplate(props) {
|
|
579
|
+
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
580
|
+
if (onAddClick) {
|
|
581
|
+
return /* @__PURE__ */ jsx12(
|
|
582
|
+
AddButton,
|
|
583
|
+
{
|
|
584
|
+
id,
|
|
585
|
+
registry,
|
|
586
|
+
className: "rjsf-add-optional-data",
|
|
587
|
+
onClick: onAddClick,
|
|
588
|
+
title: label,
|
|
589
|
+
size: "small",
|
|
590
|
+
iconType: "default",
|
|
591
|
+
block: false
|
|
592
|
+
}
|
|
593
|
+
);
|
|
594
|
+
} else if (onRemoveClick) {
|
|
595
|
+
return /* @__PURE__ */ jsx12(
|
|
596
|
+
RemoveButton,
|
|
597
|
+
{
|
|
598
|
+
id,
|
|
599
|
+
registry,
|
|
600
|
+
className: "rjsf-remove-optional-data",
|
|
601
|
+
onClick: onRemoveClick,
|
|
602
|
+
title: label,
|
|
603
|
+
size: "small",
|
|
604
|
+
iconType: "default",
|
|
605
|
+
block: false
|
|
606
|
+
}
|
|
607
|
+
);
|
|
608
|
+
}
|
|
609
|
+
return /* @__PURE__ */ jsx12("em", { id, children: label });
|
|
610
|
+
}
|
|
611
|
+
|
|
552
612
|
// src/templates/SubmitButton/index.tsx
|
|
553
613
|
import { Button as Button2 } from "antd";
|
|
554
614
|
import { getSubmitButtonOptions } from "@rjsf/utils";
|
|
555
|
-
import { jsx as
|
|
615
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
556
616
|
function SubmitButton({ uiSchema }) {
|
|
557
617
|
const { submitText, norender, props: submitButtonProps } = getSubmitButtonOptions(uiSchema);
|
|
558
618
|
if (norender) {
|
|
559
619
|
return null;
|
|
560
620
|
}
|
|
561
|
-
return /* @__PURE__ */
|
|
621
|
+
return /* @__PURE__ */ jsx13(Button2, { type: "submit", ...submitButtonProps, htmlType: "submit", children: submitText });
|
|
562
622
|
}
|
|
563
623
|
|
|
564
624
|
// src/templates/TitleField/index.tsx
|
|
565
625
|
import classNames3 from "classnames";
|
|
566
|
-
import { ConfigProvider as ConfigProvider3 } from "antd";
|
|
626
|
+
import { Col as Col5, Divider, Row as Row5, ConfigProvider as ConfigProvider3 } from "antd";
|
|
567
627
|
import { useContext as useContext3 } from "react";
|
|
568
|
-
import { jsx as
|
|
628
|
+
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
569
629
|
function TitleField({
|
|
570
630
|
id,
|
|
571
631
|
required,
|
|
572
632
|
registry,
|
|
573
|
-
title
|
|
633
|
+
title,
|
|
634
|
+
optionalDataControl
|
|
574
635
|
}) {
|
|
575
636
|
const { formContext } = registry;
|
|
576
637
|
const { colon = true } = formContext;
|
|
@@ -593,7 +654,7 @@ function TitleField({
|
|
|
593
654
|
[`${prefixCls}-item-required`]: required,
|
|
594
655
|
[`${prefixCls}-item-no-colon`]: !colon
|
|
595
656
|
});
|
|
596
|
-
|
|
657
|
+
let heading = title ? /* @__PURE__ */ jsx14(
|
|
597
658
|
"label",
|
|
598
659
|
{
|
|
599
660
|
className: labelClassName,
|
|
@@ -603,17 +664,30 @@ function TitleField({
|
|
|
603
664
|
children: labelChildren
|
|
604
665
|
}
|
|
605
666
|
) : null;
|
|
667
|
+
if (optionalDataControl) {
|
|
668
|
+
heading = /* @__PURE__ */ jsxs7(Row5, { children: [
|
|
669
|
+
/* @__PURE__ */ jsx14(Col5, { flex: "auto", children: heading }),
|
|
670
|
+
/* @__PURE__ */ jsx14(Col5, { flex: "none", children: optionalDataControl })
|
|
671
|
+
] });
|
|
672
|
+
}
|
|
673
|
+
return /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
674
|
+
heading,
|
|
675
|
+
/* @__PURE__ */ jsx14(Divider, { size: "small", style: {
|
|
676
|
+
marginBlock: "1px"
|
|
677
|
+
/* pull the margin right up against the label */
|
|
678
|
+
} })
|
|
679
|
+
] });
|
|
606
680
|
}
|
|
607
681
|
|
|
608
682
|
// src/templates/WrapIfAdditionalTemplate/index.tsx
|
|
609
|
-
import { Col as
|
|
683
|
+
import { Col as Col6, Row as Row6, Form as Form2, Input as Input2 } from "antd";
|
|
610
684
|
import {
|
|
611
685
|
ADDITIONAL_PROPERTY_FLAG,
|
|
612
686
|
UI_OPTIONS_KEY,
|
|
613
687
|
TranslatableString as TranslatableString3,
|
|
614
688
|
buttonId as buttonId3
|
|
615
689
|
} from "@rjsf/utils";
|
|
616
|
-
import { jsx as
|
|
690
|
+
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
617
691
|
var VERTICAL_LABEL_COL2 = { span: 24 };
|
|
618
692
|
var VERTICAL_WRAPPER_COL2 = { span: 24 };
|
|
619
693
|
var INPUT_STYLE2 = {
|
|
@@ -627,8 +701,8 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
627
701
|
disabled,
|
|
628
702
|
id,
|
|
629
703
|
label,
|
|
630
|
-
|
|
631
|
-
|
|
704
|
+
onRemoveProperty,
|
|
705
|
+
onKeyRenameBlur,
|
|
632
706
|
readonly,
|
|
633
707
|
required,
|
|
634
708
|
registry,
|
|
@@ -649,16 +723,15 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
649
723
|
const keyLabel = translateString(TranslatableString3.KeyLabel, [label]);
|
|
650
724
|
const additional = ADDITIONAL_PROPERTY_FLAG in schema;
|
|
651
725
|
if (!additional) {
|
|
652
|
-
return /* @__PURE__ */
|
|
726
|
+
return /* @__PURE__ */ jsx15("div", { className: classNames4, style, children });
|
|
653
727
|
}
|
|
654
|
-
const handleBlur = ({ target }) => onKeyChange(target && target.value);
|
|
655
728
|
const uiOptions = uiSchema ? uiSchema[UI_OPTIONS_KEY] : {};
|
|
656
729
|
const buttonUiOptions = {
|
|
657
730
|
...uiSchema,
|
|
658
731
|
[UI_OPTIONS_KEY]: { ...uiOptions, block: true }
|
|
659
732
|
};
|
|
660
|
-
return /* @__PURE__ */
|
|
661
|
-
/* @__PURE__ */
|
|
733
|
+
return /* @__PURE__ */ jsx15("div", { className: classNames4, style, children: /* @__PURE__ */ jsxs8(Row6, { align: toolbarAlign, gutter: rowGutter, children: [
|
|
734
|
+
/* @__PURE__ */ jsx15(Col6, { className: "form-additional", flex: "1", children: /* @__PURE__ */ jsx15("div", { className: "form-group", children: /* @__PURE__ */ jsx15(
|
|
662
735
|
Form2.Item,
|
|
663
736
|
{
|
|
664
737
|
colon,
|
|
@@ -670,7 +743,7 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
670
743
|
required,
|
|
671
744
|
style: wrapperStyle,
|
|
672
745
|
wrapperCol,
|
|
673
|
-
children: /* @__PURE__ */
|
|
746
|
+
children: /* @__PURE__ */ jsx15(
|
|
674
747
|
Input2,
|
|
675
748
|
{
|
|
676
749
|
className: "form-control",
|
|
@@ -678,21 +751,21 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
678
751
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
679
752
|
id: `${id}-key`,
|
|
680
753
|
name: `${id}-key`,
|
|
681
|
-
onBlur: !readonly ?
|
|
754
|
+
onBlur: !readonly ? onKeyRenameBlur : void 0,
|
|
682
755
|
style: INPUT_STYLE2,
|
|
683
756
|
type: "text"
|
|
684
757
|
}
|
|
685
758
|
)
|
|
686
759
|
}
|
|
687
760
|
) }) }),
|
|
688
|
-
/* @__PURE__ */
|
|
689
|
-
/* @__PURE__ */
|
|
761
|
+
/* @__PURE__ */ jsx15(Col6, { className: "form-additional", flex: "1", children }),
|
|
762
|
+
/* @__PURE__ */ jsx15(Col6, { flex: "192px", children: /* @__PURE__ */ jsx15(
|
|
690
763
|
RemoveButton2,
|
|
691
764
|
{
|
|
692
765
|
id: buttonId3(id, "remove"),
|
|
693
766
|
className: "rjsf-object-property-remove",
|
|
694
767
|
disabled: disabled || readonly,
|
|
695
|
-
onClick:
|
|
768
|
+
onClick: onRemoveProperty,
|
|
696
769
|
uiSchema: buttonUiOptions,
|
|
697
770
|
registry
|
|
698
771
|
}
|
|
@@ -719,7 +792,9 @@ function generateTemplates() {
|
|
|
719
792
|
FieldErrorTemplate,
|
|
720
793
|
FieldTemplate,
|
|
721
794
|
GridTemplate,
|
|
795
|
+
MultiSchemaFieldTemplate,
|
|
722
796
|
ObjectFieldTemplate,
|
|
797
|
+
OptionalDataControlsTemplate,
|
|
723
798
|
TitleFieldTemplate: TitleField,
|
|
724
799
|
WrapIfAdditionalTemplate
|
|
725
800
|
};
|
|
@@ -727,117 +802,39 @@ function generateTemplates() {
|
|
|
727
802
|
var templates_default = generateTemplates();
|
|
728
803
|
|
|
729
804
|
// src/widgets/AltDateWidget/index.tsx
|
|
730
|
-
import {
|
|
731
|
-
import { Row as Row6, Col as Col6, Button as Button3 } from "antd";
|
|
805
|
+
import { Row as Row7, Col as Col7, Button as Button3 } from "antd";
|
|
732
806
|
import {
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
parseDateString,
|
|
737
|
-
toDateString,
|
|
738
|
-
TranslatableString as TranslatableString4
|
|
807
|
+
DateElement,
|
|
808
|
+
TranslatableString as TranslatableString4,
|
|
809
|
+
useAltDateWidgetProps
|
|
739
810
|
} from "@rjsf/utils";
|
|
740
|
-
import { jsx as
|
|
741
|
-
var readyForChange = (state) => {
|
|
742
|
-
return Object.values(state).every((value) => value !== -1);
|
|
743
|
-
};
|
|
811
|
+
import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
744
812
|
function AltDateWidget(props) {
|
|
745
|
-
const {
|
|
746
|
-
|
|
747
|
-
disabled,
|
|
748
|
-
formContext,
|
|
749
|
-
id,
|
|
750
|
-
onBlur,
|
|
751
|
-
onChange,
|
|
752
|
-
onFocus,
|
|
753
|
-
options,
|
|
754
|
-
readonly,
|
|
755
|
-
registry,
|
|
756
|
-
showTime,
|
|
757
|
-
value
|
|
758
|
-
} = props;
|
|
759
|
-
const { translateString, widgets } = registry;
|
|
760
|
-
const { SelectWidget: SelectWidget2 } = widgets;
|
|
813
|
+
const { autofocus, disabled, id, name, onBlur, onFocus, options, readonly, registry } = props;
|
|
814
|
+
const { formContext, translateString } = registry;
|
|
761
815
|
const { rowGutter = 24 } = formContext;
|
|
762
|
-
const
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
}
|
|
782
|
-
const nextState = parseDateString((/* @__PURE__ */ new Date()).toJSON(), showTime);
|
|
783
|
-
onChange(toDateString(nextState, showTime));
|
|
784
|
-
};
|
|
785
|
-
const handleClear = (event) => {
|
|
786
|
-
event.preventDefault();
|
|
787
|
-
if (disabled || readonly) {
|
|
788
|
-
return;
|
|
789
|
-
}
|
|
790
|
-
onChange(void 0);
|
|
791
|
-
};
|
|
792
|
-
const renderDateElement = (elemProps) => /* @__PURE__ */ jsx14(
|
|
793
|
-
SelectWidget2,
|
|
794
|
-
{
|
|
795
|
-
autofocus: elemProps.autofocus,
|
|
796
|
-
className: "form-control",
|
|
797
|
-
disabled: elemProps.disabled,
|
|
798
|
-
id: elemProps.id,
|
|
799
|
-
name: elemProps.name,
|
|
800
|
-
onBlur: elemProps.onBlur,
|
|
801
|
-
onChange: (elemValue) => elemProps.select(elemProps.type, elemValue),
|
|
802
|
-
onFocus: elemProps.onFocus,
|
|
803
|
-
options: {
|
|
804
|
-
enumOptions: dateRangeOptions(elemProps.range[0], elemProps.range[1])
|
|
805
|
-
},
|
|
806
|
-
placeholder: elemProps.type,
|
|
807
|
-
readonly: elemProps.readonly,
|
|
808
|
-
schema: { type: "integer" },
|
|
809
|
-
value: elemProps.value,
|
|
810
|
-
registry,
|
|
811
|
-
label: "",
|
|
812
|
-
"aria-describedby": ariaDescribedByIds2(id)
|
|
813
|
-
}
|
|
814
|
-
);
|
|
815
|
-
return /* @__PURE__ */ jsxs7(Row6, { gutter: [Math.floor(rowGutter / 2), Math.floor(rowGutter / 2)], children: [
|
|
816
|
-
getDateElementProps(
|
|
817
|
-
state,
|
|
818
|
-
showTime,
|
|
819
|
-
options.yearsRange,
|
|
820
|
-
options.format
|
|
821
|
-
).map((elemProps, i) => {
|
|
822
|
-
const elemId = id + "_" + elemProps.type;
|
|
823
|
-
return /* @__PURE__ */ jsx14(Col6, { flex: "88px", children: renderDateElement({
|
|
824
|
-
...elemProps,
|
|
825
|
-
autofocus: autofocus && i === 0,
|
|
826
|
-
disabled,
|
|
827
|
-
id: elemId,
|
|
828
|
-
name: id,
|
|
829
|
-
onBlur,
|
|
830
|
-
onFocus,
|
|
831
|
-
readonly,
|
|
832
|
-
registry,
|
|
833
|
-
select: handleChange,
|
|
834
|
-
// NOTE: antd components accept -1 rather than issue a warning
|
|
835
|
-
// like material-ui, so we need to convert -1 to undefined here.
|
|
836
|
-
value: elemProps.value || -1 < 0 ? void 0 : elemProps.value
|
|
837
|
-
}) }, elemId);
|
|
816
|
+
const { elements, handleChange, handleClear, handleSetNow } = useAltDateWidgetProps(props);
|
|
817
|
+
return /* @__PURE__ */ jsxs9(Row7, { gutter: [Math.floor(rowGutter / 2), Math.floor(rowGutter / 2)], children: [
|
|
818
|
+
elements.map((elemProps, i) => {
|
|
819
|
+
const elemId = `${id}_${elemProps.type}`;
|
|
820
|
+
return /* @__PURE__ */ jsx16(Col7, { flex: "88px", children: /* @__PURE__ */ jsx16(
|
|
821
|
+
DateElement,
|
|
822
|
+
{
|
|
823
|
+
rootId: id,
|
|
824
|
+
name,
|
|
825
|
+
select: handleChange,
|
|
826
|
+
...elemProps,
|
|
827
|
+
disabled,
|
|
828
|
+
readonly,
|
|
829
|
+
registry,
|
|
830
|
+
onBlur,
|
|
831
|
+
onFocus,
|
|
832
|
+
autofocus: autofocus && i === 0
|
|
833
|
+
}
|
|
834
|
+
) }, elemId);
|
|
838
835
|
}),
|
|
839
|
-
!options.hideNowButton && /* @__PURE__ */
|
|
840
|
-
!options.hideClearButton && /* @__PURE__ */
|
|
836
|
+
!options.hideNowButton && /* @__PURE__ */ jsx16(Col7, { flex: "88px", children: /* @__PURE__ */ jsx16(Button3, { block: true, className: "btn-now", onClick: handleSetNow, type: "primary", children: translateString(TranslatableString4.NowLabel) }) }),
|
|
837
|
+
!options.hideClearButton && /* @__PURE__ */ jsx16(Col7, { flex: "88px", children: /* @__PURE__ */ jsx16(Button3, { block: true, className: "btn-clear", danger: true, onClick: handleClear, type: "primary", children: translateString(TranslatableString4.ClearLabel) }) })
|
|
841
838
|
] });
|
|
842
839
|
}
|
|
843
840
|
AltDateWidget.defaultProps = {
|
|
@@ -847,30 +844,43 @@ AltDateWidget.defaultProps = {
|
|
|
847
844
|
yearsRange: [1900, (/* @__PURE__ */ new Date()).getFullYear() + 2]
|
|
848
845
|
},
|
|
849
846
|
readonly: false,
|
|
850
|
-
|
|
847
|
+
time: false
|
|
851
848
|
};
|
|
852
849
|
|
|
853
850
|
// src/widgets/AltDateTimeWidget/index.tsx
|
|
854
|
-
import { jsx as
|
|
851
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
855
852
|
function AltDateTimeWidget(props) {
|
|
856
853
|
const { AltDateWidget: AltDateWidget2 } = props.registry.widgets;
|
|
857
|
-
return /* @__PURE__ */
|
|
854
|
+
return /* @__PURE__ */ jsx17(AltDateWidget2, { time: true, ...props });
|
|
858
855
|
}
|
|
859
856
|
AltDateTimeWidget.defaultProps = {
|
|
860
857
|
...AltDateWidget.defaultProps,
|
|
861
|
-
|
|
858
|
+
time: true
|
|
862
859
|
};
|
|
863
860
|
|
|
864
861
|
// src/widgets/CheckboxesWidget/index.tsx
|
|
865
862
|
import { Checkbox } from "antd";
|
|
866
863
|
import {
|
|
867
|
-
ariaDescribedByIds as
|
|
864
|
+
ariaDescribedByIds as ariaDescribedByIds2,
|
|
868
865
|
enumOptionsIndexForValue,
|
|
869
866
|
enumOptionsValueForIndex,
|
|
870
867
|
optionId
|
|
871
868
|
} from "@rjsf/utils";
|
|
872
|
-
import { Fragment as
|
|
873
|
-
function CheckboxesWidget({
|
|
869
|
+
import { Fragment as Fragment3, jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
870
|
+
function CheckboxesWidget({
|
|
871
|
+
autofocus,
|
|
872
|
+
disabled,
|
|
873
|
+
registry,
|
|
874
|
+
id,
|
|
875
|
+
htmlName,
|
|
876
|
+
onBlur,
|
|
877
|
+
onChange,
|
|
878
|
+
onFocus,
|
|
879
|
+
options,
|
|
880
|
+
readonly,
|
|
881
|
+
value
|
|
882
|
+
}) {
|
|
883
|
+
const { formContext } = registry;
|
|
874
884
|
const { readonlyAsDisabled = true } = formContext;
|
|
875
885
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
876
886
|
const handleChange = (nextValue) => onChange(enumOptionsValueForIndex(nextValue, enumOptions, emptyValue));
|
|
@@ -882,28 +892,28 @@ function CheckboxesWidget({ autofocus, disabled, formContext, id, onBlur, onChan
|
|
|
882
892
|
onFocus: !readonly ? handleFocus : void 0
|
|
883
893
|
};
|
|
884
894
|
const selectedIndexes = enumOptionsIndexForValue(value, enumOptions, true);
|
|
885
|
-
return Array.isArray(enumOptions) && enumOptions.length > 0 ? /* @__PURE__ */
|
|
895
|
+
return Array.isArray(enumOptions) && enumOptions.length > 0 ? /* @__PURE__ */ jsx18(Fragment3, { children: /* @__PURE__ */ jsx18(
|
|
886
896
|
Checkbox.Group,
|
|
887
897
|
{
|
|
888
898
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
889
|
-
name: id,
|
|
899
|
+
name: htmlName || id,
|
|
890
900
|
onChange: !readonly ? handleChange : void 0,
|
|
891
901
|
value: selectedIndexes,
|
|
892
902
|
...extraProps,
|
|
893
|
-
"aria-describedby":
|
|
894
|
-
children: Array.isArray(enumOptions) && enumOptions.map((option, i) => /* @__PURE__ */
|
|
895
|
-
/* @__PURE__ */
|
|
903
|
+
"aria-describedby": ariaDescribedByIds2(id),
|
|
904
|
+
children: Array.isArray(enumOptions) && enumOptions.map((option, i) => /* @__PURE__ */ jsxs10("span", { children: [
|
|
905
|
+
/* @__PURE__ */ jsx18(
|
|
896
906
|
Checkbox,
|
|
897
907
|
{
|
|
898
908
|
id: optionId(id, i),
|
|
899
|
-
name: id,
|
|
909
|
+
name: htmlName || id,
|
|
900
910
|
autoFocus: i === 0 ? autofocus : false,
|
|
901
911
|
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
|
|
902
912
|
value: String(i),
|
|
903
913
|
children: option.label
|
|
904
914
|
}
|
|
905
915
|
),
|
|
906
|
-
!inline && /* @__PURE__ */
|
|
916
|
+
!inline && /* @__PURE__ */ jsx18("br", {})
|
|
907
917
|
] }, i))
|
|
908
918
|
}
|
|
909
919
|
) }) : null;
|
|
@@ -912,12 +922,13 @@ function CheckboxesWidget({ autofocus, disabled, formContext, id, onBlur, onChan
|
|
|
912
922
|
// src/widgets/CheckboxWidget/index.tsx
|
|
913
923
|
import { Checkbox as Checkbox2 } from "antd";
|
|
914
924
|
import {
|
|
915
|
-
ariaDescribedByIds as
|
|
925
|
+
ariaDescribedByIds as ariaDescribedByIds3,
|
|
916
926
|
labelValue
|
|
917
927
|
} from "@rjsf/utils";
|
|
918
|
-
import { jsx as
|
|
928
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
919
929
|
function CheckboxWidget(props) {
|
|
920
|
-
const { autofocus, disabled,
|
|
930
|
+
const { autofocus, disabled, registry, id, htmlName, label, hideLabel, onBlur, onChange, onFocus, readonly, value } = props;
|
|
931
|
+
const { formContext } = registry;
|
|
921
932
|
const { readonlyAsDisabled = true } = formContext;
|
|
922
933
|
const handleChange = ({ target }) => onChange(target.checked);
|
|
923
934
|
const handleBlur = ({ target }) => onBlur(id, target && target.checked);
|
|
@@ -926,17 +937,17 @@ function CheckboxWidget(props) {
|
|
|
926
937
|
onBlur: !readonly ? handleBlur : void 0,
|
|
927
938
|
onFocus: !readonly ? handleFocus : void 0
|
|
928
939
|
};
|
|
929
|
-
return /* @__PURE__ */
|
|
940
|
+
return /* @__PURE__ */ jsx19(
|
|
930
941
|
Checkbox2,
|
|
931
942
|
{
|
|
932
943
|
autoFocus: autofocus,
|
|
933
944
|
checked: typeof value === "undefined" ? false : value,
|
|
934
945
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
935
946
|
id,
|
|
936
|
-
name: id,
|
|
947
|
+
name: htmlName || id,
|
|
937
948
|
onChange: !readonly ? handleChange : void 0,
|
|
938
949
|
...extraProps,
|
|
939
|
-
"aria-describedby":
|
|
950
|
+
"aria-describedby": ariaDescribedByIds3(id),
|
|
940
951
|
children: labelValue(label, hideLabel, "")
|
|
941
952
|
}
|
|
942
953
|
);
|
|
@@ -945,21 +956,22 @@ function CheckboxWidget(props) {
|
|
|
945
956
|
// src/widgets/DateTimeWidget/index.tsx
|
|
946
957
|
import dayjs from "dayjs";
|
|
947
958
|
import {
|
|
948
|
-
ariaDescribedByIds as
|
|
959
|
+
ariaDescribedByIds as ariaDescribedByIds4
|
|
949
960
|
} from "@rjsf/utils";
|
|
950
961
|
import { DatePicker } from "antd";
|
|
951
|
-
import { jsx as
|
|
962
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
952
963
|
var DATE_PICKER_STYLE = {
|
|
953
964
|
width: "100%"
|
|
954
965
|
};
|
|
955
966
|
function DateTimeWidget(props) {
|
|
956
|
-
const { disabled,
|
|
967
|
+
const { disabled, registry, id, onBlur, onChange, onFocus, placeholder, readonly, value } = props;
|
|
968
|
+
const { formContext } = registry;
|
|
957
969
|
const { readonlyAsDisabled = true } = formContext;
|
|
958
970
|
const handleChange = (nextValue) => onChange(nextValue && nextValue.toISOString());
|
|
959
971
|
const handleBlur = () => onBlur(id, value);
|
|
960
972
|
const handleFocus = () => onFocus(id, value);
|
|
961
973
|
const getPopupContainer = (node) => node.parentNode;
|
|
962
|
-
return /* @__PURE__ */
|
|
974
|
+
return /* @__PURE__ */ jsx20(
|
|
963
975
|
DatePicker,
|
|
964
976
|
{
|
|
965
977
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
@@ -973,7 +985,7 @@ function DateTimeWidget(props) {
|
|
|
973
985
|
showTime: true,
|
|
974
986
|
style: DATE_PICKER_STYLE,
|
|
975
987
|
value: value && dayjs(value),
|
|
976
|
-
"aria-describedby":
|
|
988
|
+
"aria-describedby": ariaDescribedByIds4(id)
|
|
977
989
|
}
|
|
978
990
|
);
|
|
979
991
|
}
|
|
@@ -981,21 +993,22 @@ function DateTimeWidget(props) {
|
|
|
981
993
|
// src/widgets/DateWidget/index.tsx
|
|
982
994
|
import dayjs2 from "dayjs";
|
|
983
995
|
import {
|
|
984
|
-
ariaDescribedByIds as
|
|
996
|
+
ariaDescribedByIds as ariaDescribedByIds5
|
|
985
997
|
} from "@rjsf/utils";
|
|
986
998
|
import { DatePicker as DatePicker2 } from "antd";
|
|
987
|
-
import { jsx as
|
|
999
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
988
1000
|
var DATE_PICKER_STYLE2 = {
|
|
989
1001
|
width: "100%"
|
|
990
1002
|
};
|
|
991
1003
|
function DateWidget(props) {
|
|
992
|
-
const { disabled,
|
|
1004
|
+
const { disabled, registry, id, onBlur, onChange, onFocus, placeholder, readonly, value } = props;
|
|
1005
|
+
const { formContext } = registry;
|
|
993
1006
|
const { readonlyAsDisabled = true } = formContext;
|
|
994
1007
|
const handleChange = (nextValue) => onChange(nextValue && nextValue.format("YYYY-MM-DD"));
|
|
995
1008
|
const handleBlur = () => onBlur(id, value);
|
|
996
1009
|
const handleFocus = () => onFocus(id, value);
|
|
997
1010
|
const getPopupContainer = (node) => node.parentNode;
|
|
998
|
-
return /* @__PURE__ */
|
|
1011
|
+
return /* @__PURE__ */ jsx21(
|
|
999
1012
|
DatePicker2,
|
|
1000
1013
|
{
|
|
1001
1014
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
@@ -1009,7 +1022,7 @@ function DateWidget(props) {
|
|
|
1009
1022
|
showTime: false,
|
|
1010
1023
|
style: DATE_PICKER_STYLE2,
|
|
1011
1024
|
value: value && dayjs2(value),
|
|
1012
|
-
"aria-describedby":
|
|
1025
|
+
"aria-describedby": ariaDescribedByIds5(id)
|
|
1013
1026
|
}
|
|
1014
1027
|
);
|
|
1015
1028
|
}
|
|
@@ -1017,17 +1030,18 @@ function DateWidget(props) {
|
|
|
1017
1030
|
// src/widgets/PasswordWidget/index.tsx
|
|
1018
1031
|
import { Input as Input3 } from "antd";
|
|
1019
1032
|
import {
|
|
1020
|
-
ariaDescribedByIds as
|
|
1033
|
+
ariaDescribedByIds as ariaDescribedByIds6
|
|
1021
1034
|
} from "@rjsf/utils";
|
|
1022
|
-
import { jsx as
|
|
1035
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
1023
1036
|
function PasswordWidget(props) {
|
|
1024
|
-
const { disabled,
|
|
1037
|
+
const { disabled, registry, id, onBlur, onChange, onFocus, options, placeholder, readonly, value } = props;
|
|
1038
|
+
const { formContext } = registry;
|
|
1025
1039
|
const { readonlyAsDisabled = true } = formContext;
|
|
1026
1040
|
const emptyValue = options.emptyValue || "";
|
|
1027
1041
|
const handleChange = ({ target }) => onChange(target.value === "" ? emptyValue : target.value);
|
|
1028
1042
|
const handleBlur = ({ target }) => onBlur(id, target.value);
|
|
1029
1043
|
const handleFocus = ({ target }) => onFocus(id, target.value);
|
|
1030
|
-
return /* @__PURE__ */
|
|
1044
|
+
return /* @__PURE__ */ jsx22(
|
|
1031
1045
|
Input3.Password,
|
|
1032
1046
|
{
|
|
1033
1047
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
@@ -1038,7 +1052,7 @@ function PasswordWidget(props) {
|
|
|
1038
1052
|
onFocus: !readonly ? handleFocus : void 0,
|
|
1039
1053
|
placeholder,
|
|
1040
1054
|
value: value || "",
|
|
1041
|
-
"aria-describedby":
|
|
1055
|
+
"aria-describedby": ariaDescribedByIds6(id)
|
|
1042
1056
|
}
|
|
1043
1057
|
);
|
|
1044
1058
|
}
|
|
@@ -1046,17 +1060,18 @@ function PasswordWidget(props) {
|
|
|
1046
1060
|
// src/widgets/RadioWidget/index.tsx
|
|
1047
1061
|
import { Radio } from "antd";
|
|
1048
1062
|
import {
|
|
1049
|
-
ariaDescribedByIds as
|
|
1063
|
+
ariaDescribedByIds as ariaDescribedByIds7,
|
|
1050
1064
|
enumOptionsIndexForValue as enumOptionsIndexForValue2,
|
|
1051
1065
|
enumOptionsValueForIndex as enumOptionsValueForIndex2,
|
|
1052
1066
|
optionId as optionId2
|
|
1053
1067
|
} from "@rjsf/utils";
|
|
1054
|
-
import { jsx as
|
|
1068
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
1055
1069
|
function RadioWidget({
|
|
1056
1070
|
autofocus,
|
|
1057
1071
|
disabled,
|
|
1058
|
-
|
|
1072
|
+
registry,
|
|
1059
1073
|
id,
|
|
1074
|
+
htmlName,
|
|
1060
1075
|
onBlur,
|
|
1061
1076
|
onChange,
|
|
1062
1077
|
onFocus,
|
|
@@ -1064,28 +1079,29 @@ function RadioWidget({
|
|
|
1064
1079
|
readonly,
|
|
1065
1080
|
value
|
|
1066
1081
|
}) {
|
|
1082
|
+
const { formContext } = registry;
|
|
1067
1083
|
const { readonlyAsDisabled = true } = formContext;
|
|
1068
1084
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1069
1085
|
const handleChange = ({ target: { value: nextValue } }) => onChange(enumOptionsValueForIndex2(nextValue, enumOptions, emptyValue));
|
|
1070
1086
|
const handleBlur = ({ target }) => onBlur(id, enumOptionsValueForIndex2(target && target.value, enumOptions, emptyValue));
|
|
1071
1087
|
const handleFocus = ({ target }) => onFocus(id, enumOptionsValueForIndex2(target && target.value, enumOptions, emptyValue));
|
|
1072
1088
|
const selectedIndexes = enumOptionsIndexForValue2(value, enumOptions);
|
|
1073
|
-
return /* @__PURE__ */
|
|
1089
|
+
return /* @__PURE__ */ jsx23(
|
|
1074
1090
|
Radio.Group,
|
|
1075
1091
|
{
|
|
1076
1092
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1077
1093
|
id,
|
|
1078
|
-
name: id,
|
|
1094
|
+
name: htmlName || id,
|
|
1079
1095
|
onChange: !readonly ? handleChange : void 0,
|
|
1080
1096
|
onBlur: !readonly ? handleBlur : void 0,
|
|
1081
1097
|
onFocus: !readonly ? handleFocus : void 0,
|
|
1082
1098
|
value: selectedIndexes,
|
|
1083
|
-
"aria-describedby":
|
|
1084
|
-
children: Array.isArray(enumOptions) && enumOptions.map((option, i) => /* @__PURE__ */
|
|
1099
|
+
"aria-describedby": ariaDescribedByIds7(id),
|
|
1100
|
+
children: Array.isArray(enumOptions) && enumOptions.map((option, i) => /* @__PURE__ */ jsx23(
|
|
1085
1101
|
Radio,
|
|
1086
1102
|
{
|
|
1087
1103
|
id: optionId2(id, i),
|
|
1088
|
-
name: id,
|
|
1104
|
+
name: htmlName || id,
|
|
1089
1105
|
autoFocus: i === 0 ? autofocus : false,
|
|
1090
1106
|
disabled: disabled || Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
|
|
1091
1107
|
value: String(i),
|
|
@@ -1100,15 +1116,15 @@ function RadioWidget({
|
|
|
1100
1116
|
// src/widgets/RangeWidget/index.tsx
|
|
1101
1117
|
import { Slider } from "antd";
|
|
1102
1118
|
import {
|
|
1103
|
-
ariaDescribedByIds as
|
|
1119
|
+
ariaDescribedByIds as ariaDescribedByIds8,
|
|
1104
1120
|
rangeSpec
|
|
1105
1121
|
} from "@rjsf/utils";
|
|
1106
|
-
import { jsx as
|
|
1122
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
1107
1123
|
function RangeWidget(props) {
|
|
1108
1124
|
const {
|
|
1109
1125
|
autofocus,
|
|
1110
1126
|
disabled,
|
|
1111
|
-
|
|
1127
|
+
registry,
|
|
1112
1128
|
id,
|
|
1113
1129
|
onBlur,
|
|
1114
1130
|
onChange,
|
|
@@ -1119,6 +1135,7 @@ function RangeWidget(props) {
|
|
|
1119
1135
|
schema,
|
|
1120
1136
|
value
|
|
1121
1137
|
} = props;
|
|
1138
|
+
const { formContext } = registry;
|
|
1122
1139
|
const { readonlyAsDisabled = true } = formContext;
|
|
1123
1140
|
const { min, max, step } = rangeSpec(schema);
|
|
1124
1141
|
const emptyValue = options.emptyValue || "";
|
|
@@ -1130,7 +1147,7 @@ function RangeWidget(props) {
|
|
|
1130
1147
|
onBlur: !readonly ? handleBlur : void 0,
|
|
1131
1148
|
onFocus: !readonly ? handleFocus : void 0
|
|
1132
1149
|
};
|
|
1133
|
-
return /* @__PURE__ */
|
|
1150
|
+
return /* @__PURE__ */ jsx24(
|
|
1134
1151
|
Slider,
|
|
1135
1152
|
{
|
|
1136
1153
|
autoFocus: autofocus,
|
|
@@ -1143,7 +1160,7 @@ function RangeWidget(props) {
|
|
|
1143
1160
|
step,
|
|
1144
1161
|
value,
|
|
1145
1162
|
...extraProps,
|
|
1146
|
-
"aria-describedby":
|
|
1163
|
+
"aria-describedby": ariaDescribedByIds8(id)
|
|
1147
1164
|
}
|
|
1148
1165
|
);
|
|
1149
1166
|
}
|
|
@@ -1151,21 +1168,22 @@ function RangeWidget(props) {
|
|
|
1151
1168
|
// src/widgets/SelectWidget/index.tsx
|
|
1152
1169
|
import { Select } from "antd";
|
|
1153
1170
|
import {
|
|
1154
|
-
ariaDescribedByIds as
|
|
1171
|
+
ariaDescribedByIds as ariaDescribedByIds9,
|
|
1155
1172
|
enumOptionsIndexForValue as enumOptionsIndexForValue3,
|
|
1156
1173
|
enumOptionsValueForIndex as enumOptionsValueForIndex3
|
|
1157
1174
|
} from "@rjsf/utils";
|
|
1158
1175
|
import isString2 from "lodash/isString";
|
|
1159
1176
|
import { useMemo } from "react";
|
|
1160
|
-
import { jsx as
|
|
1177
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
1161
1178
|
var SELECT_STYLE = {
|
|
1162
1179
|
width: "100%"
|
|
1163
1180
|
};
|
|
1164
1181
|
function SelectWidget({
|
|
1165
1182
|
autofocus,
|
|
1166
1183
|
disabled,
|
|
1167
|
-
|
|
1184
|
+
registry,
|
|
1168
1185
|
id,
|
|
1186
|
+
htmlName,
|
|
1169
1187
|
multiple,
|
|
1170
1188
|
onBlur,
|
|
1171
1189
|
onChange,
|
|
@@ -1176,6 +1194,7 @@ function SelectWidget({
|
|
|
1176
1194
|
value,
|
|
1177
1195
|
schema
|
|
1178
1196
|
}) {
|
|
1197
|
+
const { formContext } = registry;
|
|
1179
1198
|
const { readonlyAsDisabled = true } = formContext;
|
|
1180
1199
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1181
1200
|
const handleChange = (nextValue) => onChange(enumOptionsValueForIndex3(nextValue, enumOptions, emptyValue));
|
|
@@ -1190,7 +1209,7 @@ function SelectWidget({
|
|
|
1190
1209
|
const getPopupContainer = (node) => node.parentNode;
|
|
1191
1210
|
const selectedIndexes = enumOptionsIndexForValue3(value, enumOptions, multiple);
|
|
1192
1211
|
const extraProps = {
|
|
1193
|
-
name: id
|
|
1212
|
+
name: htmlName || id
|
|
1194
1213
|
};
|
|
1195
1214
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
1196
1215
|
const selectOptions = useMemo(() => {
|
|
@@ -1208,7 +1227,7 @@ function SelectWidget({
|
|
|
1208
1227
|
}
|
|
1209
1228
|
return void 0;
|
|
1210
1229
|
}, [enumDisabled, enumOptions, placeholder, showPlaceholderOption]);
|
|
1211
|
-
return /* @__PURE__ */
|
|
1230
|
+
return /* @__PURE__ */ jsx25(
|
|
1212
1231
|
Select,
|
|
1213
1232
|
{
|
|
1214
1233
|
autoFocus: autofocus,
|
|
@@ -1224,7 +1243,7 @@ function SelectWidget({
|
|
|
1224
1243
|
value: selectedIndexes,
|
|
1225
1244
|
...extraProps,
|
|
1226
1245
|
filterOption,
|
|
1227
|
-
"aria-describedby":
|
|
1246
|
+
"aria-describedby": ariaDescribedByIds9(id),
|
|
1228
1247
|
options: selectOptions
|
|
1229
1248
|
}
|
|
1230
1249
|
);
|
|
@@ -1233,16 +1252,17 @@ function SelectWidget({
|
|
|
1233
1252
|
// src/widgets/TextareaWidget/index.tsx
|
|
1234
1253
|
import { Input as Input4 } from "antd";
|
|
1235
1254
|
import {
|
|
1236
|
-
ariaDescribedByIds as
|
|
1255
|
+
ariaDescribedByIds as ariaDescribedByIds10
|
|
1237
1256
|
} from "@rjsf/utils";
|
|
1238
|
-
import { jsx as
|
|
1257
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
1239
1258
|
var INPUT_STYLE3 = {
|
|
1240
1259
|
width: "100%"
|
|
1241
1260
|
};
|
|
1242
1261
|
function TextareaWidget({
|
|
1243
1262
|
disabled,
|
|
1244
|
-
|
|
1263
|
+
registry,
|
|
1245
1264
|
id,
|
|
1265
|
+
htmlName,
|
|
1246
1266
|
onBlur,
|
|
1247
1267
|
onChange,
|
|
1248
1268
|
onFocus,
|
|
@@ -1251,6 +1271,7 @@ function TextareaWidget({
|
|
|
1251
1271
|
readonly,
|
|
1252
1272
|
value
|
|
1253
1273
|
}) {
|
|
1274
|
+
const { formContext } = registry;
|
|
1254
1275
|
const { readonlyAsDisabled = true } = formContext;
|
|
1255
1276
|
const handleChange = ({ target }) => onChange(target.value === "" ? options.emptyValue : target.value);
|
|
1256
1277
|
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
@@ -1258,12 +1279,12 @@ function TextareaWidget({
|
|
|
1258
1279
|
const extraProps = {
|
|
1259
1280
|
type: "textarea"
|
|
1260
1281
|
};
|
|
1261
|
-
return /* @__PURE__ */
|
|
1282
|
+
return /* @__PURE__ */ jsx26(
|
|
1262
1283
|
Input4.TextArea,
|
|
1263
1284
|
{
|
|
1264
1285
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1265
1286
|
id,
|
|
1266
|
-
name: id,
|
|
1287
|
+
name: htmlName || id,
|
|
1267
1288
|
onBlur: !readonly ? handleBlur : void 0,
|
|
1268
1289
|
onChange: !readonly ? handleChange : void 0,
|
|
1269
1290
|
onFocus: !readonly ? handleFocus : void 0,
|
|
@@ -1272,7 +1293,7 @@ function TextareaWidget({
|
|
|
1272
1293
|
style: INPUT_STYLE3,
|
|
1273
1294
|
value,
|
|
1274
1295
|
...extraProps,
|
|
1275
|
-
"aria-describedby":
|
|
1296
|
+
"aria-describedby": ariaDescribedByIds10(id)
|
|
1276
1297
|
}
|
|
1277
1298
|
);
|
|
1278
1299
|
}
|