@rjsf/fluentui-rc 6.0.0-beta.2 → 6.0.0-beta.20
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 +7 -3
- package/dist/core.umd.js +37 -23
- package/dist/{index.js → index.cjs} +112 -94
- package/dist/index.cjs.map +7 -0
- package/dist/index.esm.js +94 -76
- package/dist/index.esm.js.map +4 -4
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +3 -3
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.js +2 -2
- package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js +2 -2
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js +2 -2
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.d.ts +2 -0
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.js +13 -0
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.js.map +1 -0
- package/lib/MultiSchemaFieldTemplate/index.d.ts +2 -0
- package/lib/MultiSchemaFieldTemplate/index.js +3 -0
- package/lib/MultiSchemaFieldTemplate/index.js.map +1 -0
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +3 -3
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
- package/lib/RadioWidget/RadioWidget.js.map +1 -1
- package/lib/RangeWidget/RangeWidget.js.map +1 -1
- package/lib/SelectWidget/SelectWidget.js.map +1 -1
- package/lib/Templates/Templates.js +2 -0
- package/lib/Templates/Templates.js.map +1 -1
- package/lib/TextareaWidget/TextareaWidget.js.map +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +20 -19
- package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +5 -5
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +3 -3
- package/src/CheckboxWidget/CheckboxWidget.tsx +4 -4
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +1 -1
- package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +2 -2
- package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +2 -2
- package/src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx +25 -0
- package/src/MultiSchemaFieldTemplate/index.ts +2 -0
- package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +4 -4
- package/src/RadioWidget/RadioWidget.tsx +1 -1
- package/src/RangeWidget/RangeWidget.tsx +1 -1
- package/src/SelectWidget/SelectWidget.tsx +1 -1
- package/src/Templates/Templates.ts +2 -0
- package/src/TextareaWidget/TextareaWidget.tsx +1 -1
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +1 -1
- package/dist/index.js.map +0 -7
package/README.md
CHANGED
|
@@ -59,11 +59,15 @@ Fluent UI React Components (v9) theme, fields and widgets for `react-jsonschema-
|
|
|
59
59
|
|
|
60
60
|
### Prerequisites
|
|
61
61
|
|
|
62
|
-
- `@fluentui/react-components >= 9
|
|
63
|
-
- `@
|
|
62
|
+
- `@fluentui/react-components >= 9`
|
|
63
|
+
- `@fluentui/react-icons >= 2`
|
|
64
|
+
- `@fluentui/react-migration-v0-v9 >= 9`
|
|
65
|
+
- `@rjsf/core >= 6`
|
|
66
|
+
- `@rjsf/utils >= 6`
|
|
67
|
+
- `@rjsf/validator-ajv8 >= 6`
|
|
64
68
|
|
|
65
69
|
```bash
|
|
66
|
-
yarn add @fluentui/react-components @rjsf/core @rjsf/utils @rjsf/validator-ajv8
|
|
70
|
+
yarn add @fluentui/react-components @fluentui/react-icons @fluentui/react-migration-v0-v9 @rjsf/core @rjsf/utils @rjsf/validator-ajv8
|
|
67
71
|
```
|
|
68
72
|
|
|
69
73
|
### Installation
|
package/dist/core.umd.js
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
function ArrayFieldTemplate(props) {
|
|
43
|
-
const { canAdd, disabled,
|
|
43
|
+
const { canAdd, disabled, fieldPathId, uiSchema, items, onAddClick, readonly, registry, required, schema, title } = props;
|
|
44
44
|
const classes = useStyles2();
|
|
45
45
|
const uiOptions = utils.getUiOptions(uiSchema);
|
|
46
46
|
const ArrayFieldDescriptionTemplate = utils.getTemplate(
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
66
66
|
ArrayFieldTitleTemplate,
|
|
67
67
|
{
|
|
68
|
-
|
|
68
|
+
fieldPathId,
|
|
69
69
|
title: uiOptions.title || title,
|
|
70
70
|
schema,
|
|
71
71
|
uiSchema,
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
77
77
|
ArrayFieldDescriptionTemplate,
|
|
78
78
|
{
|
|
79
|
-
|
|
79
|
+
fieldPathId,
|
|
80
80
|
description: uiOptions.description || schema.description,
|
|
81
81
|
schema,
|
|
82
82
|
uiSchema,
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
canAdd && /* @__PURE__ */ jsxRuntime.jsx(reactMigrationV0V9.Flex, { hAlign: "end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
89
89
|
AddButton2,
|
|
90
90
|
{
|
|
91
|
-
id: utils.buttonId(
|
|
91
|
+
id: utils.buttonId(fieldPathId, "add"),
|
|
92
92
|
className: "rjsf-array-item-add",
|
|
93
93
|
onClick: onAddClick,
|
|
94
94
|
disabled: disabled || readonly,
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
registry
|
|
97
97
|
}
|
|
98
98
|
) })
|
|
99
|
-
] }, `array-item-list-${
|
|
99
|
+
] }, `array-item-list-${fieldPathId.$id}`)
|
|
100
100
|
] });
|
|
101
101
|
}
|
|
102
102
|
var useStyles3 = reactComponents.makeStyles({
|
|
@@ -271,22 +271,22 @@
|
|
|
271
271
|
errorLabel: { color: reactComponents.tokens.colorPaletteRedForeground1 }
|
|
272
272
|
});
|
|
273
273
|
function FieldErrorTemplate(props) {
|
|
274
|
-
const { errors = [],
|
|
274
|
+
const { errors = [], fieldPathId } = props;
|
|
275
275
|
const classes = useStyles6();
|
|
276
276
|
if (errors.length === 0) {
|
|
277
277
|
return null;
|
|
278
278
|
}
|
|
279
|
-
const id = utils.errorId(
|
|
279
|
+
const id = utils.errorId(fieldPathId);
|
|
280
280
|
return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: classes.list, children: errors.map((error, i) => {
|
|
281
281
|
return /* @__PURE__ */ jsxRuntime.jsx("li", { className: classes.listItem, children: /* @__PURE__ */ jsxRuntime.jsx("small", { className: classes.errorLabel, id, children: error }) }, i);
|
|
282
282
|
}) });
|
|
283
283
|
}
|
|
284
284
|
function FieldHelpTemplate(props) {
|
|
285
|
-
const {
|
|
285
|
+
const { fieldPathId, help } = props;
|
|
286
286
|
if (!help) {
|
|
287
287
|
return null;
|
|
288
288
|
}
|
|
289
|
-
const id = utils.helpId(
|
|
289
|
+
const id = utils.helpId(fieldPathId);
|
|
290
290
|
return /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Caption1, { id, children: help });
|
|
291
291
|
}
|
|
292
292
|
function FieldTemplate(props) {
|
|
@@ -357,6 +357,19 @@
|
|
|
357
357
|
}
|
|
358
358
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { style, ...rest, children });
|
|
359
359
|
}
|
|
360
|
+
var useStyles7 = reactComponents.makeStyles({
|
|
361
|
+
root: {
|
|
362
|
+
"> div": { marginBottom: "4px" }
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
function MultiSchemaFieldTemplate(props) {
|
|
366
|
+
const { selector, optionSchemaField } = props;
|
|
367
|
+
const styles = useStyles7();
|
|
368
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.root, children: [
|
|
369
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: selector }),
|
|
370
|
+
optionSchemaField
|
|
371
|
+
] });
|
|
372
|
+
}
|
|
360
373
|
function ObjectFieldTemplate(props) {
|
|
361
374
|
const {
|
|
362
375
|
description,
|
|
@@ -366,7 +379,7 @@
|
|
|
366
379
|
disabled,
|
|
367
380
|
readonly,
|
|
368
381
|
uiSchema,
|
|
369
|
-
|
|
382
|
+
fieldPathId,
|
|
370
383
|
schema,
|
|
371
384
|
formData,
|
|
372
385
|
onAddClick,
|
|
@@ -386,7 +399,7 @@
|
|
|
386
399
|
title && /* @__PURE__ */ jsxRuntime.jsx(
|
|
387
400
|
TitleFieldTemplate,
|
|
388
401
|
{
|
|
389
|
-
id: utils.titleId(
|
|
402
|
+
id: utils.titleId(fieldPathId),
|
|
390
403
|
title,
|
|
391
404
|
required,
|
|
392
405
|
schema,
|
|
@@ -397,7 +410,7 @@
|
|
|
397
410
|
description && /* @__PURE__ */ jsxRuntime.jsx(
|
|
398
411
|
DescriptionFieldTemplate,
|
|
399
412
|
{
|
|
400
|
-
id: utils.descriptionId(
|
|
413
|
+
id: utils.descriptionId(fieldPathId),
|
|
401
414
|
description,
|
|
402
415
|
schema,
|
|
403
416
|
uiSchema,
|
|
@@ -415,7 +428,7 @@
|
|
|
415
428
|
utils.canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsxRuntime.jsx(reactMigrationV0V9.Flex, { hAlign: "end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
416
429
|
AddButton2,
|
|
417
430
|
{
|
|
418
|
-
id: utils.buttonId(
|
|
431
|
+
id: utils.buttonId(fieldPathId, "add"),
|
|
419
432
|
className: "rjsf-object-property-expand",
|
|
420
433
|
onClick: onAddClick(schema),
|
|
421
434
|
disabled: disabled || readonly,
|
|
@@ -426,20 +439,20 @@
|
|
|
426
439
|
] })
|
|
427
440
|
] });
|
|
428
441
|
}
|
|
429
|
-
var
|
|
442
|
+
var useStyles8 = reactComponents.makeStyles({
|
|
430
443
|
buttonRow: {
|
|
431
444
|
marginTop: reactComponents.tokens.spacingVerticalL
|
|
432
445
|
}
|
|
433
446
|
});
|
|
434
447
|
function SubmitButton({ uiSchema }) {
|
|
435
|
-
const classes =
|
|
448
|
+
const classes = useStyles8();
|
|
436
449
|
const { submitText, norender, props: submitButtonProps } = utils.getSubmitButtonOptions(uiSchema);
|
|
437
450
|
if (norender) {
|
|
438
451
|
return null;
|
|
439
452
|
}
|
|
440
453
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes.buttonRow, children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Button, { appearance: "primary", type: "submit", ...submitButtonProps, children: submitText }) });
|
|
441
454
|
}
|
|
442
|
-
var
|
|
455
|
+
var useStyles9 = reactComponents.makeStyles({
|
|
443
456
|
root: {
|
|
444
457
|
marginTop: "8px",
|
|
445
458
|
marginBottom: "8px"
|
|
@@ -449,13 +462,13 @@
|
|
|
449
462
|
id,
|
|
450
463
|
title
|
|
451
464
|
}) {
|
|
452
|
-
const classes =
|
|
465
|
+
const classes = useStyles9();
|
|
453
466
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { id, className: classes.root, children: [
|
|
454
467
|
/* @__PURE__ */ jsxRuntime.jsx(reactComponents.Text, { as: "h5", size: 600, children: title }),
|
|
455
468
|
/* @__PURE__ */ jsxRuntime.jsx(reactComponents.Divider, {})
|
|
456
469
|
] });
|
|
457
470
|
}
|
|
458
|
-
var
|
|
471
|
+
var useStyles10 = reactComponents.makeStyles({
|
|
459
472
|
input: {
|
|
460
473
|
width: "100%"
|
|
461
474
|
},
|
|
@@ -480,7 +493,7 @@
|
|
|
480
493
|
registry
|
|
481
494
|
} = props;
|
|
482
495
|
const { templates, translateString } = registry;
|
|
483
|
-
const classes =
|
|
496
|
+
const classes = useStyles10();
|
|
484
497
|
const { RemoveButton: RemoveButton2 } = templates.ButtonTemplates;
|
|
485
498
|
const keyLabel = translateString(utils.TranslatableString.KeyLabel, [label]);
|
|
486
499
|
const additional = utils.ADDITIONAL_PROPERTY_FLAG in schema;
|
|
@@ -547,6 +560,7 @@
|
|
|
547
560
|
FieldHelpTemplate,
|
|
548
561
|
FieldTemplate,
|
|
549
562
|
GridTemplate,
|
|
563
|
+
MultiSchemaFieldTemplate,
|
|
550
564
|
ObjectFieldTemplate,
|
|
551
565
|
TitleFieldTemplate: TitleField,
|
|
552
566
|
WrapIfAdditionalTemplate
|
|
@@ -577,8 +591,8 @@
|
|
|
577
591
|
);
|
|
578
592
|
const required = utils.schemaRequiresTrueValue(schema);
|
|
579
593
|
const _onChange = ({ target: { checked } }) => onChange(checked);
|
|
580
|
-
const _onBlur = ({ target }) => onBlur(id, target && target.
|
|
581
|
-
const _onFocus = ({ target }) => onFocus(id, target && target.
|
|
594
|
+
const _onBlur = ({ target }) => onBlur(id, target && target.checked);
|
|
595
|
+
const _onFocus = ({ target }) => onFocus(id, target && target.checked);
|
|
582
596
|
const description = options.description ?? schema.description;
|
|
583
597
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
584
598
|
!hideLabel && description && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -812,7 +826,7 @@
|
|
|
812
826
|
);
|
|
813
827
|
}
|
|
814
828
|
var SelectWidget_default = SelectWidget;
|
|
815
|
-
var
|
|
829
|
+
var useStyles11 = reactComponents.makeStyles({
|
|
816
830
|
label: {
|
|
817
831
|
paddingTop: "2px",
|
|
818
832
|
paddingBottom: "2px",
|
|
@@ -837,7 +851,7 @@
|
|
|
837
851
|
options,
|
|
838
852
|
schema
|
|
839
853
|
} = props;
|
|
840
|
-
const classes =
|
|
854
|
+
const classes = useStyles11();
|
|
841
855
|
const _onChange = ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2);
|
|
842
856
|
const _onBlur = ({ target }) => onBlur(id, target && target.value);
|
|
843
857
|
const _onFocus = ({ target }) => onFocus(id, target && target.value);
|