@rjsf/fluentui-rc 6.0.1 → 6.1.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/dist/core.umd.js +35 -12
- package/dist/index.cjs +38 -14
- package/dist/index.cjs.map +3 -3
- package/dist/index.esm.js +36 -12
- package/dist/index.esm.js.map +2 -2
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +2 -2
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js +3 -3
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
- package/lib/FieldTemplate/FieldTemplate.js +2 -1
- package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +24 -4
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +3 -3
- package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +8 -3
- package/src/FieldTemplate/FieldTemplate.tsx +4 -1
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +29 -6
package/dist/core.umd.js
CHANGED
|
@@ -14,16 +14,16 @@
|
|
|
14
14
|
});
|
|
15
15
|
function ArrayFieldItemTemplate(props) {
|
|
16
16
|
const classes = useStyles();
|
|
17
|
-
const { children, buttonsProps, hasToolbar, uiSchema, registry } = props;
|
|
17
|
+
const { children, buttonsProps, displayLabel, hasToolbar, uiSchema, registry } = props;
|
|
18
18
|
const uiOptions = utils.getUiOptions(uiSchema);
|
|
19
19
|
const ArrayFieldItemButtonsTemplate = utils.getTemplate(
|
|
20
20
|
"ArrayFieldItemButtonsTemplate",
|
|
21
21
|
registry,
|
|
22
22
|
uiOptions
|
|
23
23
|
);
|
|
24
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactMigrationV0V9.Flex, { vAlign: "
|
|
24
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactMigrationV0V9.Flex, { vAlign: "start", children: [
|
|
25
25
|
/* @__PURE__ */ jsxRuntime.jsx(reactMigrationV0V9.Flex, { fill: true, className: classes.arrayFieldItem, children }),
|
|
26
|
-
hasToolbar && /* @__PURE__ */ jsxRuntime.jsx(reactMigrationV0V9.Flex, { style: { marginLeft: "8px" }, children: /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldItemButtonsTemplate, { ...buttonsProps }) })
|
|
26
|
+
hasToolbar && /* @__PURE__ */ jsxRuntime.jsx(reactMigrationV0V9.Flex, { style: { marginLeft: "8px", marginTop: displayLabel ? "26px" : 0 }, children: /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldItemButtonsTemplate, { ...buttonsProps }) })
|
|
27
27
|
] });
|
|
28
28
|
}
|
|
29
29
|
function AddButton({
|
|
@@ -294,12 +294,11 @@
|
|
|
294
294
|
}) });
|
|
295
295
|
}
|
|
296
296
|
function FieldHelpTemplate(props) {
|
|
297
|
-
const { fieldPathId, help } = props;
|
|
297
|
+
const { fieldPathId, help, uiSchema = {}, registry } = props;
|
|
298
298
|
if (!help) {
|
|
299
299
|
return null;
|
|
300
300
|
}
|
|
301
|
-
|
|
302
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Caption1, { id, children: help });
|
|
301
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Caption1, { id: utils.helpId(fieldPathId), children: /* @__PURE__ */ jsxRuntime.jsx(core.RichHelp, { help, registry, uiSchema }) });
|
|
303
302
|
}
|
|
304
303
|
function FieldTemplate(props) {
|
|
305
304
|
const {
|
|
@@ -334,6 +333,7 @@
|
|
|
334
333
|
if (hidden) {
|
|
335
334
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "none" }, children });
|
|
336
335
|
}
|
|
336
|
+
const isCheckbox = uiOptions.widget === "checkbox";
|
|
337
337
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
338
338
|
WrapIfAdditionalTemplate2,
|
|
339
339
|
{
|
|
@@ -342,6 +342,8 @@
|
|
|
342
342
|
disabled,
|
|
343
343
|
id,
|
|
344
344
|
label,
|
|
345
|
+
displayLabel,
|
|
346
|
+
rawDescription,
|
|
345
347
|
onKeyRename,
|
|
346
348
|
onKeyRenameBlur,
|
|
347
349
|
onRemoveProperty,
|
|
@@ -352,7 +354,7 @@
|
|
|
352
354
|
registry,
|
|
353
355
|
children: /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.Field, { validationState: rawErrors.length ? "error" : void 0, required, children: [
|
|
354
356
|
children,
|
|
355
|
-
displayLabel && rawDescription ? /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Text, { as: "p", block: true, style: { marginTop: 0, marginBottom: 0 }, children: description }) : null,
|
|
357
|
+
displayLabel && rawDescription && !isCheckbox ? /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Text, { as: "p", block: true, style: { marginTop: 0, marginBottom: 0 }, children: description }) : null,
|
|
356
358
|
errors,
|
|
357
359
|
help
|
|
358
360
|
] })
|
|
@@ -531,10 +533,26 @@
|
|
|
531
533
|
input: {
|
|
532
534
|
width: "100%"
|
|
533
535
|
},
|
|
536
|
+
grow: {
|
|
537
|
+
flexGrow: 1
|
|
538
|
+
},
|
|
539
|
+
halfWidth: {
|
|
540
|
+
width: "46%"
|
|
541
|
+
},
|
|
542
|
+
alignEnd: {
|
|
543
|
+
alignSelf: "flex-end",
|
|
544
|
+
justifyContent: "flex-end"
|
|
545
|
+
},
|
|
546
|
+
alignCenter: {
|
|
547
|
+
alignSelf: "center",
|
|
548
|
+
marginTop: "-14px",
|
|
549
|
+
justifyContent: "flex-end"
|
|
550
|
+
},
|
|
534
551
|
label: {
|
|
535
552
|
marginBottom: "4px"
|
|
536
553
|
}
|
|
537
554
|
});
|
|
555
|
+
var containerTypes = ["object", "array"];
|
|
538
556
|
function WrapIfAdditionalTemplate(props) {
|
|
539
557
|
const {
|
|
540
558
|
children,
|
|
@@ -543,8 +561,10 @@
|
|
|
543
561
|
disabled,
|
|
544
562
|
id,
|
|
545
563
|
label,
|
|
564
|
+
displayLabel,
|
|
546
565
|
onRemoveProperty,
|
|
547
566
|
onKeyRenameBlur,
|
|
567
|
+
rawDescription,
|
|
548
568
|
readonly,
|
|
549
569
|
required,
|
|
550
570
|
schema,
|
|
@@ -556,6 +576,7 @@
|
|
|
556
576
|
const { RemoveButton: RemoveButton2 } = templates.ButtonTemplates;
|
|
557
577
|
const keyLabel = translateString(utils.TranslatableString.KeyLabel, [label]);
|
|
558
578
|
const additional = utils.ADDITIONAL_PROPERTY_FLAG in schema;
|
|
579
|
+
const hasDescription = !!rawDescription;
|
|
559
580
|
const btnStyle = {
|
|
560
581
|
flex: 1,
|
|
561
582
|
paddingLeft: 6,
|
|
@@ -563,10 +584,12 @@
|
|
|
563
584
|
fontWeight: "bold"
|
|
564
585
|
};
|
|
565
586
|
if (!additional) {
|
|
566
|
-
|
|
587
|
+
const { type } = schema;
|
|
588
|
+
const className = containerTypes.includes(type) ? classNames : `${classes.grow} ${classNames}`;
|
|
589
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, style, children });
|
|
567
590
|
}
|
|
568
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactMigrationV0V9.Flex, { gap: "gap.medium", vAlign: "
|
|
569
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Field, { label: keyLabel, required, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
591
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactMigrationV0V9.Flex, { gap: "gap.medium", vAlign: "start", className: classNames, style, children: [
|
|
592
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: classes.halfWidth, children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Field, { label: displayLabel ? keyLabel : void 0, required, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
570
593
|
reactComponents.Input,
|
|
571
594
|
{
|
|
572
595
|
required,
|
|
@@ -581,8 +604,8 @@
|
|
|
581
604
|
}
|
|
582
605
|
}
|
|
583
606
|
) }) }),
|
|
584
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { children }),
|
|
585
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
607
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: classes.halfWidth, children }),
|
|
608
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: hasDescription ? classes.alignCenter : classes.alignEnd, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
586
609
|
RemoveButton2,
|
|
587
610
|
{
|
|
588
611
|
id: utils.buttonId(id, "remove"),
|
package/dist/index.cjs
CHANGED
|
@@ -34,7 +34,7 @@ __export(index_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(index_exports);
|
|
35
35
|
|
|
36
36
|
// src/FluentForm/FluentForm.ts
|
|
37
|
-
var
|
|
37
|
+
var import_core3 = require("@rjsf/core");
|
|
38
38
|
|
|
39
39
|
// src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx
|
|
40
40
|
var import_utils = require("@rjsf/utils");
|
|
@@ -50,16 +50,16 @@ var useStyles = (0, import_react_components.makeStyles)({
|
|
|
50
50
|
});
|
|
51
51
|
function ArrayFieldItemTemplate(props) {
|
|
52
52
|
const classes = useStyles();
|
|
53
|
-
const { children, buttonsProps, hasToolbar, uiSchema, registry } = props;
|
|
53
|
+
const { children, buttonsProps, displayLabel, hasToolbar, uiSchema, registry } = props;
|
|
54
54
|
const uiOptions = (0, import_utils.getUiOptions)(uiSchema);
|
|
55
55
|
const ArrayFieldItemButtonsTemplate = (0, import_utils.getTemplate)(
|
|
56
56
|
"ArrayFieldItemButtonsTemplate",
|
|
57
57
|
registry,
|
|
58
58
|
uiOptions
|
|
59
59
|
);
|
|
60
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_migration_v0_v9.Flex, { vAlign: "
|
|
60
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_migration_v0_v9.Flex, { vAlign: "start", children: [
|
|
61
61
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_migration_v0_v9.Flex, { fill: true, className: classes.arrayFieldItem, children }),
|
|
62
|
-
hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_migration_v0_v9.Flex, { style: { marginLeft: "8px" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrayFieldItemButtonsTemplate, { ...buttonsProps }) })
|
|
62
|
+
hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_migration_v0_v9.Flex, { style: { marginLeft: "8px", marginTop: displayLabel ? "26px" : 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrayFieldItemButtonsTemplate, { ...buttonsProps }) })
|
|
63
63
|
] });
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -371,14 +371,14 @@ function FieldErrorTemplate(props) {
|
|
|
371
371
|
// src/FieldHelpTemplate/FieldHelpTemplate.tsx
|
|
372
372
|
var import_react_components9 = require("@fluentui/react-components");
|
|
373
373
|
var import_utils8 = require("@rjsf/utils");
|
|
374
|
+
var import_core2 = require("@rjsf/core");
|
|
374
375
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
375
376
|
function FieldHelpTemplate(props) {
|
|
376
|
-
const { fieldPathId, help } = props;
|
|
377
|
+
const { fieldPathId, help, uiSchema = {}, registry } = props;
|
|
377
378
|
if (!help) {
|
|
378
379
|
return null;
|
|
379
380
|
}
|
|
380
|
-
|
|
381
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_components9.Caption1, { id, children: help });
|
|
381
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_components9.Caption1, { id: (0, import_utils8.helpId)(fieldPathId), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core2.RichHelp, { help, registry, uiSchema }) });
|
|
382
382
|
}
|
|
383
383
|
|
|
384
384
|
// src/FieldTemplate/FieldTemplate.tsx
|
|
@@ -418,6 +418,7 @@ function FieldTemplate(props) {
|
|
|
418
418
|
if (hidden) {
|
|
419
419
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { display: "none" }, children });
|
|
420
420
|
}
|
|
421
|
+
const isCheckbox = uiOptions.widget === "checkbox";
|
|
421
422
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
422
423
|
WrapIfAdditionalTemplate2,
|
|
423
424
|
{
|
|
@@ -426,6 +427,8 @@ function FieldTemplate(props) {
|
|
|
426
427
|
disabled,
|
|
427
428
|
id,
|
|
428
429
|
label,
|
|
430
|
+
displayLabel,
|
|
431
|
+
rawDescription,
|
|
429
432
|
onKeyRename,
|
|
430
433
|
onKeyRenameBlur,
|
|
431
434
|
onRemoveProperty,
|
|
@@ -436,7 +439,7 @@ function FieldTemplate(props) {
|
|
|
436
439
|
registry,
|
|
437
440
|
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_components10.Field, { validationState: rawErrors.length ? "error" : void 0, required, children: [
|
|
438
441
|
children,
|
|
439
|
-
displayLabel && rawDescription ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_components10.Text, { as: "p", block: true, style: { marginTop: 0, marginBottom: 0 }, children: description }) : null,
|
|
442
|
+
displayLabel && rawDescription && !isCheckbox ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_components10.Text, { as: "p", block: true, style: { marginTop: 0, marginBottom: 0 }, children: description }) : null,
|
|
440
443
|
errors,
|
|
441
444
|
help
|
|
442
445
|
] })
|
|
@@ -648,10 +651,26 @@ var useStyles10 = (0, import_react_components14.makeStyles)({
|
|
|
648
651
|
input: {
|
|
649
652
|
width: "100%"
|
|
650
653
|
},
|
|
654
|
+
grow: {
|
|
655
|
+
flexGrow: 1
|
|
656
|
+
},
|
|
657
|
+
halfWidth: {
|
|
658
|
+
width: "46%"
|
|
659
|
+
},
|
|
660
|
+
alignEnd: {
|
|
661
|
+
alignSelf: "flex-end",
|
|
662
|
+
justifyContent: "flex-end"
|
|
663
|
+
},
|
|
664
|
+
alignCenter: {
|
|
665
|
+
alignSelf: "center",
|
|
666
|
+
marginTop: "-14px",
|
|
667
|
+
justifyContent: "flex-end"
|
|
668
|
+
},
|
|
651
669
|
label: {
|
|
652
670
|
marginBottom: "4px"
|
|
653
671
|
}
|
|
654
672
|
});
|
|
673
|
+
var containerTypes = ["object", "array"];
|
|
655
674
|
function WrapIfAdditionalTemplate(props) {
|
|
656
675
|
const {
|
|
657
676
|
children,
|
|
@@ -660,8 +679,10 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
660
679
|
disabled,
|
|
661
680
|
id,
|
|
662
681
|
label,
|
|
682
|
+
displayLabel,
|
|
663
683
|
onRemoveProperty,
|
|
664
684
|
onKeyRenameBlur,
|
|
685
|
+
rawDescription,
|
|
665
686
|
readonly,
|
|
666
687
|
required,
|
|
667
688
|
schema,
|
|
@@ -673,6 +694,7 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
673
694
|
const { RemoveButton: RemoveButton2 } = templates.ButtonTemplates;
|
|
674
695
|
const keyLabel = translateString(import_utils12.TranslatableString.KeyLabel, [label]);
|
|
675
696
|
const additional = import_utils12.ADDITIONAL_PROPERTY_FLAG in schema;
|
|
697
|
+
const hasDescription = !!rawDescription;
|
|
676
698
|
const btnStyle = {
|
|
677
699
|
flex: 1,
|
|
678
700
|
paddingLeft: 6,
|
|
@@ -680,10 +702,12 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
680
702
|
fontWeight: "bold"
|
|
681
703
|
};
|
|
682
704
|
if (!additional) {
|
|
683
|
-
|
|
705
|
+
const { type } = schema;
|
|
706
|
+
const className = containerTypes.includes(type) ? classNames : `${classes.grow} ${classNames}`;
|
|
707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className, style, children });
|
|
684
708
|
}
|
|
685
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_migration_v0_v96.Flex, { gap: "gap.medium", vAlign: "
|
|
686
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_components14.Field, { label: keyLabel, required, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_migration_v0_v96.Flex, { gap: "gap.medium", vAlign: "start", className: classNames, style, children: [
|
|
710
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: classes.halfWidth, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_components14.Field, { label: displayLabel ? keyLabel : void 0, required, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
687
711
|
import_react_components14.Input,
|
|
688
712
|
{
|
|
689
713
|
required,
|
|
@@ -698,8 +722,8 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
698
722
|
}
|
|
699
723
|
}
|
|
700
724
|
) }) }),
|
|
701
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children }),
|
|
702
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
725
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: classes.halfWidth, children }),
|
|
726
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: hasDescription ? classes.alignCenter : classes.alignEnd, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
703
727
|
RemoveButton2,
|
|
704
728
|
{
|
|
705
729
|
id: (0, import_utils12.buttonId)(id, "remove"),
|
|
@@ -1120,7 +1144,7 @@ var Theme_default = generateTheme();
|
|
|
1120
1144
|
|
|
1121
1145
|
// src/FluentForm/FluentForm.ts
|
|
1122
1146
|
function generateForm() {
|
|
1123
|
-
return (0,
|
|
1147
|
+
return (0, import_core3.withTheme)(generateTheme());
|
|
1124
1148
|
}
|
|
1125
1149
|
var FluentForm_default = generateForm();
|
|
1126
1150
|
|