@nolwenture/formik-jsonschema-form 1.0.0-beta.4 → 1.0.0-beta.5
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/cjs/Form/components/FieldInput.js +6 -1
- package/dist/cjs/Form/fields/ArrayField/ArrayField.js +20 -8
- package/dist/cjs/Form/fields/BooleanField/BooleanField.js +1 -1
- package/dist/cjs/Form/fields/BooleanField/styledComponents.js +4 -0
- package/dist/cjs/Form/fields/DateField/DateField.js +1 -1
- package/dist/cjs/Form/fields/MultipleChoiceField/MultipleChoiceField.js +1 -1
- package/dist/cjs/Form/fields/ObjectField/ObjectField.js +12 -5
- package/dist/cjs/Form/fields/RadioField/RadioField.js +1 -1
- package/dist/cjs/Form/fields/RadioField/styledComponents.js +4 -0
- package/dist/cjs/Form/fields/SchemaField/SchemaField.js +1 -0
- package/dist/cjs/Form/fields/StringField/StringField.js +5 -2
- package/dist/cjs/Form/fields/TextAreaField/TextAreaField.js +1 -1
- package/dist/cjs/Form/fields/ToggleField/ToggleField.js +1 -1
- package/dist/cjs/Form/fields/ToggleField/styledComponents.js +4 -0
- package/dist/esm/Form/components/FieldInput.js +5 -0
- package/dist/esm/Form/fields/ArrayField/ArrayField.js +20 -8
- package/dist/esm/Form/fields/BooleanField/BooleanField.js +1 -1
- package/dist/esm/Form/fields/BooleanField/styledComponents.js +4 -0
- package/dist/esm/Form/fields/DateField/DateField.js +1 -1
- package/dist/esm/Form/fields/MultipleChoiceField/MultipleChoiceField.js +1 -1
- package/dist/esm/Form/fields/ObjectField/ObjectField.js +12 -5
- package/dist/esm/Form/fields/RadioField/RadioField.js +1 -1
- package/dist/esm/Form/fields/RadioField/styledComponents.js +4 -0
- package/dist/esm/Form/fields/SchemaField/SchemaField.js +1 -0
- package/dist/esm/Form/fields/StringField/StringField.js +5 -2
- package/dist/esm/Form/fields/TextAreaField/TextAreaField.js +1 -1
- package/dist/esm/Form/fields/ToggleField/ToggleField.js +1 -1
- package/dist/esm/Form/fields/ToggleField/styledComponents.js +4 -0
- package/dist/types/Form/components/FieldInput.d.ts +5 -0
- package/dist/types/Form/components/index.d.ts +5 -0
- package/dist/types/Form/templates/ArrayFieldTemplate/types.d.ts +0 -4
- package/dist/types/Form/templates/FieldTemplate/types.d.ts +0 -4
- package/dist/types/FormView/templates/ArrayFieldTemplate/types.d.ts +0 -4
- package/dist/types/FormView/templates/FieldTemplate/types.d.ts +0 -4
- package/dist/types/common/types/Field.d.ts +0 -3
- package/dist/types/common/types/Schemas.d.ts +11 -8
- package/package.json +2 -1
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.FieldInput = exports.FieldHelp = exports.FieldDescription = exports.FieldTitle = exports.FieldWrapper = void 0;
|
|
26
|
+
exports.SelectFieldInput = exports.FieldInput = exports.FieldHelp = exports.FieldDescription = exports.FieldTitle = exports.FieldWrapper = void 0;
|
|
27
27
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
28
|
const styled_components_1 = require("styled-components");
|
|
29
29
|
const formik = __importStar(require("formik"));
|
|
@@ -57,3 +57,8 @@ exports.FieldHelp = styled_components_1.styled.p `
|
|
|
57
57
|
exports.FieldInput = (0, styled_components_1.styled)(({ formikAs, ...props }) => {
|
|
58
58
|
return (0, jsx_runtime_1.jsx)(formik.Field, { ...props, as: formikAs });
|
|
59
59
|
}) ``;
|
|
60
|
+
exports.SelectFieldInput = (0, styled_components_1.styled)(exports.FieldInput) `
|
|
61
|
+
&[readonly] {
|
|
62
|
+
pointer-events: none;
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
@@ -32,7 +32,7 @@ const moveInArray = (values, index, direction) => {
|
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
const ArrayField = (props) => {
|
|
35
|
-
const { fields: { SchemaField }, templates: { ArrayFieldTemplate, FieldTemplate }, components: {
|
|
35
|
+
const { fields: { SchemaField }, templates: { ArrayFieldTemplate, FieldTemplate }, components: { SelectFieldInput, ArrayFieldItem, ArrayFieldItemButtons, ArrayFieldList, ArrayFieldAddButton, ArrayFieldRemoveButton, ArrayFieldUpButton, ArrayFieldDownButton, }, useItemsAsAdditionalItems, } = (0, react_1.useContext)(FormRegistry_1.FormRegistry);
|
|
36
36
|
(0, hooks_1.useSetDefault)(props);
|
|
37
37
|
const { name, schema, uiSchema } = props;
|
|
38
38
|
const { type, props: inputProps } = (0, react_1.useMemo)(() => (0, utils_1.extractUiSchema)(uiSchema), [uiSchema]);
|
|
@@ -98,16 +98,28 @@ const ArrayField = (props) => {
|
|
|
98
98
|
// Backwards compatibility ends
|
|
99
99
|
const { disabled } = (0, react_1.useMemo)(() => (0, utils_1.extractUiSchema)(uiSchema), [uiSchema]);
|
|
100
100
|
const valueArray = Array.isArray(value) ? value : undefined;
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
const preventManipulation = disabled || schema.readOnly;
|
|
102
|
+
return schema.anyOf !== undefined ? ((0, jsx_runtime_1.jsx)(FieldTemplate, { ...props, "data-fjsf-array": name, children: (0, jsx_runtime_1.jsx)(SelectFieldInput, { type,
|
|
103
|
+
readOnly: schema.readOnly,
|
|
104
|
+
...inputProps, name: name, formikAs: "select", multiple: enums?.type === utils_1.EnumsTypes.MULTI_SELECT, children: enums?.values.map((option, index) => ((0, jsx_runtime_1.jsx)("option", { value: option.const, children: option.title }, index))) }) })) : ((0, jsx_runtime_1.jsxs)(ArrayFieldTemplate, { ...props, "data-fjsf-array": name, children: [(0, jsx_runtime_1.jsxs)(ArrayFieldList, { children: [(items || []).map((itemSchema, index) => ((0, jsx_runtime_1.jsx)(ArrayFieldItem, { children: (0, jsx_runtime_1.jsx)(SchemaField, { name: `${name}[${index}]`, schema: prepareChildSchema(itemSchema, schema), uiSchema: {
|
|
105
|
+
disabled,
|
|
106
|
+
...(uiSchema?.[index] || uiSchema?.items),
|
|
107
|
+
},
|
|
103
108
|
// "true" will prevent validation for required array fields
|
|
104
109
|
// since a value always exists in the array
|
|
105
|
-
forceDefaultValue: false }) }, index))), (valueArray?.slice(items.length) || []).map((_, index) => ((0, jsx_runtime_1.jsxs)(ArrayFieldItem, { children: [(0, jsx_runtime_1.jsx)(SchemaField, { name: `${name}[${index + items.length}]`, schema: additionalItems
|
|
106
|
-
? additionalItems
|
|
107
|
-
: {}, uiSchema: {
|
|
110
|
+
forceDefaultValue: false }) }, index))), (valueArray?.slice(items.length) || []).map((_, index) => ((0, jsx_runtime_1.jsxs)(ArrayFieldItem, { children: [(0, jsx_runtime_1.jsx)(SchemaField, { name: `${name}[${index + items.length}]`, schema: prepareChildSchema(additionalItems, schema), uiSchema: {
|
|
108
111
|
disabled,
|
|
109
112
|
...(uiSchema?.[index + items.length] || uiSchema?.items),
|
|
110
|
-
} }), (0, jsx_runtime_1.jsxs)(ArrayFieldItemButtons, { children: [(0, jsx_runtime_1.jsx)(ArrayFieldRemoveButton, { ...(uiSchema?.["ui:removeButtonOptions"]?.props ?? {}), onClick: () => setValue(removeFromArray(value, index + items.length)), children: uiSchema?.["ui:removeButtonOptions"]?.content ?? "-" }), value.length > 1 && index > 0 && ((0, jsx_runtime_1.jsx)(ArrayFieldUpButton, { ...(uiSchema?.["ui:upButtonOptions"]?.props ?? {}), onClick: () => setValue(moveInArray(value, index + items.length, -1)), children: uiSchema?.["ui:upButtonOptions"]?.content ?? "↑" })), value.length > 1 &&
|
|
111
|
-
index < value?.slice(items.length).length - 1 && ((0, jsx_runtime_1.jsx)(ArrayFieldDownButton, { ...(uiSchema?.["ui:downButtonOptions"]?.props ?? {}), onClick: () => setValue(moveInArray(value, index + items.length, 1)), children: uiSchema?.["ui:downButtonOptions"]?.content ?? "↓" }))] })] }, index)))] }), additionalItems && ((0, jsx_runtime_1.jsx)(ArrayFieldAddButton, { ...(uiSchema?.["ui:addButtonOptions"]?.props ?? {}), onClick: () => setValue(appendArray(value)), children: uiSchema?.["ui:addButtonOptions"]?.content ?? "+" }))] }));
|
|
113
|
+
} }), !preventManipulation && ((0, jsx_runtime_1.jsxs)(ArrayFieldItemButtons, { children: [(0, jsx_runtime_1.jsx)(ArrayFieldRemoveButton, { ...(uiSchema?.["ui:removeButtonOptions"]?.props ?? {}), onClick: () => setValue(removeFromArray(value, index + items.length)), children: uiSchema?.["ui:removeButtonOptions"]?.content ?? "-" }), value.length > 1 && index > 0 && ((0, jsx_runtime_1.jsx)(ArrayFieldUpButton, { ...(uiSchema?.["ui:upButtonOptions"]?.props ?? {}), onClick: () => setValue(moveInArray(value, index + items.length, -1)), children: uiSchema?.["ui:upButtonOptions"]?.content ?? "↑" })), value.length > 1 &&
|
|
114
|
+
index < value?.slice(items.length).length - 1 && ((0, jsx_runtime_1.jsx)(ArrayFieldDownButton, { ...(uiSchema?.["ui:downButtonOptions"]?.props ?? {}), onClick: () => setValue(moveInArray(value, index + items.length, 1)), children: uiSchema?.["ui:downButtonOptions"]?.content ?? "↓" }))] }))] }, index)))] }), additionalItems && !preventManipulation && ((0, jsx_runtime_1.jsx)(ArrayFieldAddButton, { ...(uiSchema?.["ui:addButtonOptions"]?.props ?? {}), onClick: () => setValue(appendArray(value)), children: uiSchema?.["ui:addButtonOptions"]?.content ?? "+" }))] }));
|
|
112
115
|
};
|
|
113
116
|
exports.ArrayField = ArrayField;
|
|
117
|
+
function prepareChildSchema(childSchema, parentSchema) {
|
|
118
|
+
if (!childSchema || typeof childSchema === "boolean") {
|
|
119
|
+
return {};
|
|
120
|
+
}
|
|
121
|
+
if (parentSchema.readOnly) {
|
|
122
|
+
return { ...childSchema, readOnly: parentSchema.readOnly };
|
|
123
|
+
}
|
|
124
|
+
return childSchema;
|
|
125
|
+
}
|
|
@@ -13,7 +13,7 @@ const BooleanField = (props) => {
|
|
|
13
13
|
const { name, uiSchema } = props;
|
|
14
14
|
const { label, props: inputProps } = (0, react_1.useMemo)(() => (0, utils_1.extractUiSchema)(uiSchema), [uiSchema]);
|
|
15
15
|
const { values, setValues } = (0, formik_1.useFormikContext)();
|
|
16
|
-
return ((0, jsx_runtime_1.jsx)(FieldTemplate, { ...props, "data-fjsf-boolean": name, children: (0, jsx_runtime_1.jsxs)(BooleanFieldWrapper, { children: [(0, jsx_runtime_1.jsx)(FieldInput, { ...inputProps, name: name, type: "checkbox" }), (0, jsx_runtime_1.jsx)("span", { onClick: () => {
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)(FieldTemplate, { ...props, "data-fjsf-boolean": name, children: (0, jsx_runtime_1.jsxs)(BooleanFieldWrapper, { children: [(0, jsx_runtime_1.jsx)(FieldInput, { readOnly: props.schema.readOnly, ...inputProps, name: name, type: "checkbox" }), (0, jsx_runtime_1.jsx)("span", { onClick: () => {
|
|
17
17
|
setValues({
|
|
18
18
|
...values,
|
|
19
19
|
[name]: !values?.[name],
|
|
@@ -12,6 +12,6 @@ const DateField = (props) => {
|
|
|
12
12
|
(0, hooks_1.useSetDefault)(props);
|
|
13
13
|
const { name, uiSchema } = props;
|
|
14
14
|
const { props: inputProps } = (0, react_1.useMemo)(() => (0, utils_1.extractUiSchema)(uiSchema), [uiSchema]);
|
|
15
|
-
return ((0, jsx_runtime_1.jsx)(FieldTemplate, { ...props, "data-fjsf-string": name, children: (0, jsx_runtime_1.jsx)(styledComponents_1.DateFieldWrapper, { children: (0, jsx_runtime_1.jsx)(FieldInput, { ...inputProps, name: name, type: "date" }) }) }));
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)(FieldTemplate, { ...props, "data-fjsf-string": name, children: (0, jsx_runtime_1.jsx)(styledComponents_1.DateFieldWrapper, { children: (0, jsx_runtime_1.jsx)(FieldInput, { readOnly: props.schema.readOnly, ...inputProps, name: name, type: "date" }) }) }));
|
|
16
16
|
};
|
|
17
17
|
exports.DateField = DateField;
|
|
@@ -27,6 +27,6 @@ const MultipleChoiceField = (props) => {
|
|
|
27
27
|
return { "data-fjsf-string": name };
|
|
28
28
|
}
|
|
29
29
|
})();
|
|
30
|
-
return ((0, jsx_runtime_1.jsx)(FieldTemplate, { ...props, ...fieldDataAttribute, children: (0, jsx_runtime_1.jsx)(MultipleChoiceFieldInput, { inputProps: inputProps, name: name, enums: enums, style: style, value: value, form: form }) }));
|
|
30
|
+
return ((0, jsx_runtime_1.jsx)(FieldTemplate, { ...props, ...fieldDataAttribute, children: (0, jsx_runtime_1.jsx)(MultipleChoiceFieldInput, { inputProps: { readOnly: props.schema.readOnly, ...inputProps }, name: name, enums: enums, style: style, value: value, form: form }) }));
|
|
31
31
|
};
|
|
32
32
|
exports.MultipleChoiceField = MultipleChoiceField;
|
|
@@ -59,7 +59,7 @@ const ObjectField = (props) => {
|
|
|
59
59
|
const childSchema = properties?.[child];
|
|
60
60
|
if (!childSchema)
|
|
61
61
|
return undefined;
|
|
62
|
-
return ((0, jsx_runtime_1.jsx)(SchemaField, { required: required?.includes(child), name: name ? [name, child].join(".") : child, schema:
|
|
62
|
+
return ((0, jsx_runtime_1.jsx)(SchemaField, { required: required?.includes(child), name: name ? [name, child].join(".") : child, schema: prepareChildSchema(childSchema, schema), uiSchema: uiSchema?.[child] }, child));
|
|
63
63
|
}
|
|
64
64
|
else {
|
|
65
65
|
const { title, fields, collapsible } = child;
|
|
@@ -67,14 +67,12 @@ const ObjectField = (props) => {
|
|
|
67
67
|
const childSchema = properties?.[child2];
|
|
68
68
|
if (!childSchema)
|
|
69
69
|
return undefined;
|
|
70
|
-
return ((0, jsx_runtime_1.jsx)(SchemaField, { name: name ? [name, child2].join(".") : child2, schema:
|
|
70
|
+
return ((0, jsx_runtime_1.jsx)(SchemaField, { name: name ? [name, child2].join(".") : child2, schema: prepareChildSchema(childSchema, schema), uiSchema: uiSchema?.[child2] }, child2));
|
|
71
71
|
}) }, fields.join("_")));
|
|
72
72
|
}
|
|
73
73
|
})
|
|
74
74
|
.filter((x) => x), (!hideUnmarkedAdditionalProperties || additionalProperties) &&
|
|
75
|
-
Object.entries(additionalValues || {}).map(([childName]) => ((0, jsx_runtime_1.jsxs)(ObjectFieldItem, { children: [(0, jsx_runtime_1.jsx)(SchemaField, { required: required?.includes(childName), name: name ? [name, childName].join(".") : childName, schema:
|
|
76
|
-
? schema.additionalProperties
|
|
77
|
-
: {}, uiSchema: uiSchema?.[childName] }, childName), (0, jsx_runtime_1.jsx)(ObjectFieldItemButtons, { children: getObjectFieldButton({
|
|
75
|
+
Object.entries(additionalValues || {}).map(([childName]) => ((0, jsx_runtime_1.jsxs)(ObjectFieldItem, { children: [(0, jsx_runtime_1.jsx)(SchemaField, { required: required?.includes(childName), name: name ? [name, childName].join(".") : childName, schema: prepareChildSchema(schema.additionalProperties, schema), uiSchema: uiSchema?.[childName] }, childName), (0, jsx_runtime_1.jsx)(ObjectFieldItemButtons, { children: getObjectFieldButton({
|
|
78
76
|
purpose: types_1.ObjectFieldButtonPurpose.REMOVE,
|
|
79
77
|
onClick: () => {
|
|
80
78
|
const { [childName]: _removedProperty, ...newValue } = value;
|
|
@@ -94,3 +92,12 @@ const ObjectField = (props) => {
|
|
|
94
92
|
})] }));
|
|
95
93
|
};
|
|
96
94
|
exports.ObjectField = ObjectField;
|
|
95
|
+
function prepareChildSchema(childSchema, parentSchema) {
|
|
96
|
+
if (!childSchema || typeof childSchema === "boolean") {
|
|
97
|
+
return {};
|
|
98
|
+
}
|
|
99
|
+
if (parentSchema.readOnly) {
|
|
100
|
+
return { ...childSchema, readOnly: parentSchema.readOnly };
|
|
101
|
+
}
|
|
102
|
+
return childSchema;
|
|
103
|
+
}
|
|
@@ -11,6 +11,6 @@ const RadioField = (props) => {
|
|
|
11
11
|
(0, hooks_1.useSetDefault)(props);
|
|
12
12
|
const { name, uiSchema } = props;
|
|
13
13
|
const { label, props: inputProps } = (0, react_1.useMemo)(() => (0, utils_1.extractUiSchema)(uiSchema), [uiSchema]);
|
|
14
|
-
return ((0, jsx_runtime_1.jsx)(FieldTemplate, { ...props, "data-fjsf-boolean": name, children: (0, jsx_runtime_1.jsx)(RadioFieldInput, { inputProps: inputProps, label: label, name: name }) }));
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)(FieldTemplate, { ...props, "data-fjsf-boolean": name, children: (0, jsx_runtime_1.jsx)(RadioFieldInput, { inputProps: { readOnly: props.schema.readOnly, ...inputProps }, label: label, name: name }) }));
|
|
15
15
|
};
|
|
16
16
|
exports.RadioField = RadioField;
|
|
@@ -14,6 +14,10 @@ exports.RadioFieldContainer = styled_components_1.styled.div `
|
|
|
14
14
|
exports.RadioFieldElement = styled_components_1.styled.label `
|
|
15
15
|
display: inline-flex;
|
|
16
16
|
align-items: center;
|
|
17
|
+
|
|
18
|
+
&:has(input[readonly]) {
|
|
19
|
+
pointer-events: none;
|
|
20
|
+
}
|
|
17
21
|
`;
|
|
18
22
|
exports.RadioFieldInputElement = (0, styled_components_1.styled)(FieldInput_1.FieldInput) `
|
|
19
23
|
margin: unset;
|
|
@@ -33,6 +33,7 @@ const SchemaField = (props) => {
|
|
|
33
33
|
schema: schemaSolvedForReferences.schema,
|
|
34
34
|
uiSchema: schemaSolvedForReferences.uiSchema,
|
|
35
35
|
};
|
|
36
|
+
console.log({ newProps });
|
|
36
37
|
return (0, jsx_runtime_1.jsx)(FieldComponent, { ...newProps });
|
|
37
38
|
};
|
|
38
39
|
exports.SchemaField = SchemaField;
|
|
@@ -9,7 +9,7 @@ const FormRegistry_1 = require("../../FormRegistry");
|
|
|
9
9
|
const hooks_1 = require("../../hooks");
|
|
10
10
|
const styledComponents_1 = require("./styledComponents");
|
|
11
11
|
const StringField = (props) => {
|
|
12
|
-
const { templates: { FieldTemplate }, components: { FieldInput }, } = (0, react_1.useContext)(FormRegistry_1.FormRegistry);
|
|
12
|
+
const { templates: { FieldTemplate }, components: { FieldInput, SelectFieldInput }, } = (0, react_1.useContext)(FormRegistry_1.FormRegistry);
|
|
13
13
|
(0, hooks_1.useSetDefault)(props);
|
|
14
14
|
const { name, uiSchema = {}, schema } = props;
|
|
15
15
|
const { type, placeholder, props: inputProps, } = (0, react_1.useMemo)(() => (0, utils_1.extractUiSchema)(uiSchema), [uiSchema]);
|
|
@@ -20,7 +20,8 @@ const StringField = (props) => {
|
|
|
20
20
|
: { "data-fjsf-number": name };
|
|
21
21
|
switch (enums?.type) {
|
|
22
22
|
case "select":
|
|
23
|
-
return ((0, jsx_runtime_1.jsx)(FieldTemplate, { ...props, ...fieldDataAttribute, children: (0, jsx_runtime_1.jsx)(styledComponents_1.StringFieldWrapper, { children: (0, jsx_runtime_1.jsxs)(
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)(FieldTemplate, { ...props, ...fieldDataAttribute, children: (0, jsx_runtime_1.jsx)(styledComponents_1.StringFieldWrapper, { children: (0, jsx_runtime_1.jsxs)(SelectFieldInput, { type,
|
|
24
|
+
readOnly: props.schema.readOnly,
|
|
24
25
|
...inputProps, name: name, formikAs: "select", onChange: (e) => {
|
|
25
26
|
const selectedOption = enums?.values.find((option) => option.const.toString() === e.target.value);
|
|
26
27
|
const selectedValue = selectedOption
|
|
@@ -31,8 +32,10 @@ const StringField = (props) => {
|
|
|
31
32
|
hidden: true,
|
|
32
33
|
...uiSchema["ui:placeholderOptionOptions"]?.props, children: placeholder }), enums?.values.map((option, index) => ((0, jsx_runtime_1.jsx)("option", { value: option.const.toString(), children: option.title }, index)))] }) }) }));
|
|
33
34
|
default:
|
|
35
|
+
console.log({ props, type, inputProps });
|
|
34
36
|
return ((0, jsx_runtime_1.jsx)(FieldTemplate, { ...props, ...fieldDataAttribute, children: (0, jsx_runtime_1.jsx)(styledComponents_1.StringFieldWrapper, { children: (0, jsx_runtime_1.jsx)(FieldInput, { type,
|
|
35
37
|
placeholder,
|
|
38
|
+
readOnly: props.schema.readOnly,
|
|
36
39
|
...inputProps, name: name }) }) }));
|
|
37
40
|
}
|
|
38
41
|
};
|
|
@@ -11,6 +11,6 @@ const TextAreaField = (props) => {
|
|
|
11
11
|
(0, hooks_1.useSetDefault)(props);
|
|
12
12
|
const { name, uiSchema } = props;
|
|
13
13
|
const { props: inputProps } = (0, react_1.useMemo)(() => (0, utils_1.extractUiSchema)(uiSchema), [uiSchema]);
|
|
14
|
-
return ((0, jsx_runtime_1.jsx)(FieldTemplate, { ...props, "data-fjsf-string": name, children: (0, jsx_runtime_1.jsx)(TextAreaFieldInput, { ...inputProps, name: name, formikAs: "textarea" }) }));
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)(FieldTemplate, { ...props, "data-fjsf-string": name, children: (0, jsx_runtime_1.jsx)(TextAreaFieldInput, { readOnly: props.schema.readOnly, ...inputProps, name: name, formikAs: "textarea" }) }));
|
|
15
15
|
};
|
|
16
16
|
exports.TextAreaField = TextAreaField;
|
|
@@ -11,6 +11,6 @@ const ToggleField = (props) => {
|
|
|
11
11
|
(0, hooks_1.useSetDefault)(props);
|
|
12
12
|
const { name, uiSchema } = props;
|
|
13
13
|
const { props: inputProps } = (0, react_1.useMemo)(() => (0, utils_1.extractUiSchema)(uiSchema), [uiSchema]);
|
|
14
|
-
return ((0, jsx_runtime_1.jsx)(FieldTemplate, { ...props, "data-fjsf-boolean": name, children: (0, jsx_runtime_1.jsx)(ToggleFieldInput, { inputProps: inputProps, name: name }) }));
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)(FieldTemplate, { ...props, "data-fjsf-boolean": name, children: (0, jsx_runtime_1.jsx)(ToggleFieldInput, { inputProps: { readOnly: props.schema.readOnly, ...inputProps }, name: name }) }));
|
|
15
15
|
};
|
|
16
16
|
exports.ToggleField = ToggleField;
|
|
@@ -33,6 +33,10 @@ exports.ToggleFieldLabel = styled_components_1.styled.label `
|
|
|
33
33
|
position: relative;
|
|
34
34
|
display: inline-block;
|
|
35
35
|
width: 2rem;
|
|
36
|
+
|
|
37
|
+
&:has(input[readonly]) {
|
|
38
|
+
pointer-events: none;
|
|
39
|
+
}
|
|
36
40
|
`;
|
|
37
41
|
exports.ToggleFieldInputElement = (0, styled_components_1.styled)(FieldInput_1.FieldInput) `
|
|
38
42
|
opacity: 0;
|
|
@@ -31,3 +31,8 @@ export const FieldHelp = styled.p `
|
|
|
31
31
|
export const FieldInput = styled(({ formikAs, ...props }) => {
|
|
32
32
|
return _jsx(formik.Field, { ...props, as: formikAs });
|
|
33
33
|
}) ``;
|
|
34
|
+
export const SelectFieldInput = styled(FieldInput) `
|
|
35
|
+
&[readonly] {
|
|
36
|
+
pointer-events: none;
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
@@ -29,7 +29,7 @@ const moveInArray = (values, index, direction) => {
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
export const ArrayField = (props) => {
|
|
32
|
-
const { fields: { SchemaField }, templates: { ArrayFieldTemplate, FieldTemplate }, components: {
|
|
32
|
+
const { fields: { SchemaField }, templates: { ArrayFieldTemplate, FieldTemplate }, components: { SelectFieldInput, ArrayFieldItem, ArrayFieldItemButtons, ArrayFieldList, ArrayFieldAddButton, ArrayFieldRemoveButton, ArrayFieldUpButton, ArrayFieldDownButton, }, useItemsAsAdditionalItems, } = useContext(FormRegistry);
|
|
33
33
|
useSetDefault(props);
|
|
34
34
|
const { name, schema, uiSchema } = props;
|
|
35
35
|
const { type, props: inputProps } = useMemo(() => extractUiSchema(uiSchema), [uiSchema]);
|
|
@@ -95,15 +95,27 @@ export const ArrayField = (props) => {
|
|
|
95
95
|
// Backwards compatibility ends
|
|
96
96
|
const { disabled } = useMemo(() => extractUiSchema(uiSchema), [uiSchema]);
|
|
97
97
|
const valueArray = Array.isArray(value) ? value : undefined;
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
const preventManipulation = disabled || schema.readOnly;
|
|
99
|
+
return schema.anyOf !== undefined ? (_jsx(FieldTemplate, { ...props, "data-fjsf-array": name, children: _jsx(SelectFieldInput, { type,
|
|
100
|
+
readOnly: schema.readOnly,
|
|
101
|
+
...inputProps, name: name, formikAs: "select", multiple: enums?.type === EnumsTypes.MULTI_SELECT, children: enums?.values.map((option, index) => (_jsx("option", { value: option.const, children: option.title }, index))) }) })) : (_jsxs(ArrayFieldTemplate, { ...props, "data-fjsf-array": name, children: [_jsxs(ArrayFieldList, { children: [(items || []).map((itemSchema, index) => (_jsx(ArrayFieldItem, { children: _jsx(SchemaField, { name: `${name}[${index}]`, schema: prepareChildSchema(itemSchema, schema), uiSchema: {
|
|
102
|
+
disabled,
|
|
103
|
+
...(uiSchema?.[index] || uiSchema?.items),
|
|
104
|
+
},
|
|
100
105
|
// "true" will prevent validation for required array fields
|
|
101
106
|
// since a value always exists in the array
|
|
102
|
-
forceDefaultValue: false }) }, index))), (valueArray?.slice(items.length) || []).map((_, index) => (_jsxs(ArrayFieldItem, { children: [_jsx(SchemaField, { name: `${name}[${index + items.length}]`, schema: additionalItems
|
|
103
|
-
? additionalItems
|
|
104
|
-
: {}, uiSchema: {
|
|
107
|
+
forceDefaultValue: false }) }, index))), (valueArray?.slice(items.length) || []).map((_, index) => (_jsxs(ArrayFieldItem, { children: [_jsx(SchemaField, { name: `${name}[${index + items.length}]`, schema: prepareChildSchema(additionalItems, schema), uiSchema: {
|
|
105
108
|
disabled,
|
|
106
109
|
...(uiSchema?.[index + items.length] || uiSchema?.items),
|
|
107
|
-
} }), _jsxs(ArrayFieldItemButtons, { children: [_jsx(ArrayFieldRemoveButton, { ...(uiSchema?.["ui:removeButtonOptions"]?.props ?? {}), onClick: () => setValue(removeFromArray(value, index + items.length)), children: uiSchema?.["ui:removeButtonOptions"]?.content ?? "-" }), value.length > 1 && index > 0 && (_jsx(ArrayFieldUpButton, { ...(uiSchema?.["ui:upButtonOptions"]?.props ?? {}), onClick: () => setValue(moveInArray(value, index + items.length, -1)), children: uiSchema?.["ui:upButtonOptions"]?.content ?? "↑" })), value.length > 1 &&
|
|
108
|
-
index < value?.slice(items.length).length - 1 && (_jsx(ArrayFieldDownButton, { ...(uiSchema?.["ui:downButtonOptions"]?.props ?? {}), onClick: () => setValue(moveInArray(value, index + items.length, 1)), children: uiSchema?.["ui:downButtonOptions"]?.content ?? "↓" }))] })] }, index)))] }), additionalItems && (_jsx(ArrayFieldAddButton, { ...(uiSchema?.["ui:addButtonOptions"]?.props ?? {}), onClick: () => setValue(appendArray(value)), children: uiSchema?.["ui:addButtonOptions"]?.content ?? "+" }))] }));
|
|
110
|
+
} }), !preventManipulation && (_jsxs(ArrayFieldItemButtons, { children: [_jsx(ArrayFieldRemoveButton, { ...(uiSchema?.["ui:removeButtonOptions"]?.props ?? {}), onClick: () => setValue(removeFromArray(value, index + items.length)), children: uiSchema?.["ui:removeButtonOptions"]?.content ?? "-" }), value.length > 1 && index > 0 && (_jsx(ArrayFieldUpButton, { ...(uiSchema?.["ui:upButtonOptions"]?.props ?? {}), onClick: () => setValue(moveInArray(value, index + items.length, -1)), children: uiSchema?.["ui:upButtonOptions"]?.content ?? "↑" })), value.length > 1 &&
|
|
111
|
+
index < value?.slice(items.length).length - 1 && (_jsx(ArrayFieldDownButton, { ...(uiSchema?.["ui:downButtonOptions"]?.props ?? {}), onClick: () => setValue(moveInArray(value, index + items.length, 1)), children: uiSchema?.["ui:downButtonOptions"]?.content ?? "↓" }))] }))] }, index)))] }), additionalItems && !preventManipulation && (_jsx(ArrayFieldAddButton, { ...(uiSchema?.["ui:addButtonOptions"]?.props ?? {}), onClick: () => setValue(appendArray(value)), children: uiSchema?.["ui:addButtonOptions"]?.content ?? "+" }))] }));
|
|
109
112
|
};
|
|
113
|
+
function prepareChildSchema(childSchema, parentSchema) {
|
|
114
|
+
if (!childSchema || typeof childSchema === "boolean") {
|
|
115
|
+
return {};
|
|
116
|
+
}
|
|
117
|
+
if (parentSchema.readOnly) {
|
|
118
|
+
return { ...childSchema, readOnly: parentSchema.readOnly };
|
|
119
|
+
}
|
|
120
|
+
return childSchema;
|
|
121
|
+
}
|
|
@@ -10,7 +10,7 @@ export const BooleanField = (props) => {
|
|
|
10
10
|
const { name, uiSchema } = props;
|
|
11
11
|
const { label, props: inputProps } = useMemo(() => extractUiSchema(uiSchema), [uiSchema]);
|
|
12
12
|
const { values, setValues } = useFormikContext();
|
|
13
|
-
return (_jsx(FieldTemplate, { ...props, "data-fjsf-boolean": name, children: _jsxs(BooleanFieldWrapper, { children: [_jsx(FieldInput, { ...inputProps, name: name, type: "checkbox" }), _jsx("span", { onClick: () => {
|
|
13
|
+
return (_jsx(FieldTemplate, { ...props, "data-fjsf-boolean": name, children: _jsxs(BooleanFieldWrapper, { children: [_jsx(FieldInput, { readOnly: props.schema.readOnly, ...inputProps, name: name, type: "checkbox" }), _jsx("span", { onClick: () => {
|
|
14
14
|
setValues({
|
|
15
15
|
...values,
|
|
16
16
|
[name]: !values?.[name],
|
|
@@ -9,5 +9,5 @@ export const DateField = (props) => {
|
|
|
9
9
|
useSetDefault(props);
|
|
10
10
|
const { name, uiSchema } = props;
|
|
11
11
|
const { props: inputProps } = useMemo(() => extractUiSchema(uiSchema), [uiSchema]);
|
|
12
|
-
return (_jsx(FieldTemplate, { ...props, "data-fjsf-string": name, children: _jsx(DateFieldWrapper, { children: _jsx(FieldInput, { ...inputProps, name: name, type: "date" }) }) }));
|
|
12
|
+
return (_jsx(FieldTemplate, { ...props, "data-fjsf-string": name, children: _jsx(DateFieldWrapper, { children: _jsx(FieldInput, { readOnly: props.schema.readOnly, ...inputProps, name: name, type: "date" }) }) }));
|
|
13
13
|
};
|
|
@@ -24,5 +24,5 @@ export const MultipleChoiceField = (props) => {
|
|
|
24
24
|
return { "data-fjsf-string": name };
|
|
25
25
|
}
|
|
26
26
|
})();
|
|
27
|
-
return (_jsx(FieldTemplate, { ...props, ...fieldDataAttribute, children: _jsx(MultipleChoiceFieldInput, { inputProps: inputProps, name: name, enums: enums, style: style, value: value, form: form }) }));
|
|
27
|
+
return (_jsx(FieldTemplate, { ...props, ...fieldDataAttribute, children: _jsx(MultipleChoiceFieldInput, { inputProps: { readOnly: props.schema.readOnly, ...inputProps }, name: name, enums: enums, style: style, value: value, form: form }) }));
|
|
28
28
|
};
|
|
@@ -56,7 +56,7 @@ export const ObjectField = (props) => {
|
|
|
56
56
|
const childSchema = properties?.[child];
|
|
57
57
|
if (!childSchema)
|
|
58
58
|
return undefined;
|
|
59
|
-
return (_jsx(SchemaField, { required: required?.includes(child), name: name ? [name, child].join(".") : child, schema:
|
|
59
|
+
return (_jsx(SchemaField, { required: required?.includes(child), name: name ? [name, child].join(".") : child, schema: prepareChildSchema(childSchema, schema), uiSchema: uiSchema?.[child] }, child));
|
|
60
60
|
}
|
|
61
61
|
else {
|
|
62
62
|
const { title, fields, collapsible } = child;
|
|
@@ -64,14 +64,12 @@ export const ObjectField = (props) => {
|
|
|
64
64
|
const childSchema = properties?.[child2];
|
|
65
65
|
if (!childSchema)
|
|
66
66
|
return undefined;
|
|
67
|
-
return (_jsx(SchemaField, { name: name ? [name, child2].join(".") : child2, schema:
|
|
67
|
+
return (_jsx(SchemaField, { name: name ? [name, child2].join(".") : child2, schema: prepareChildSchema(childSchema, schema), uiSchema: uiSchema?.[child2] }, child2));
|
|
68
68
|
}) }, fields.join("_")));
|
|
69
69
|
}
|
|
70
70
|
})
|
|
71
71
|
.filter((x) => x), (!hideUnmarkedAdditionalProperties || additionalProperties) &&
|
|
72
|
-
Object.entries(additionalValues || {}).map(([childName]) => (_jsxs(ObjectFieldItem, { children: [_jsx(SchemaField, { required: required?.includes(childName), name: name ? [name, childName].join(".") : childName, schema:
|
|
73
|
-
? schema.additionalProperties
|
|
74
|
-
: {}, uiSchema: uiSchema?.[childName] }, childName), _jsx(ObjectFieldItemButtons, { children: getObjectFieldButton({
|
|
72
|
+
Object.entries(additionalValues || {}).map(([childName]) => (_jsxs(ObjectFieldItem, { children: [_jsx(SchemaField, { required: required?.includes(childName), name: name ? [name, childName].join(".") : childName, schema: prepareChildSchema(schema.additionalProperties, schema), uiSchema: uiSchema?.[childName] }, childName), _jsx(ObjectFieldItemButtons, { children: getObjectFieldButton({
|
|
75
73
|
purpose: ObjectFieldButtonPurpose.REMOVE,
|
|
76
74
|
onClick: () => {
|
|
77
75
|
const { [childName]: _removedProperty, ...newValue } = value;
|
|
@@ -90,3 +88,12 @@ export const ObjectField = (props) => {
|
|
|
90
88
|
uiSchema: uiSchema,
|
|
91
89
|
})] }));
|
|
92
90
|
};
|
|
91
|
+
function prepareChildSchema(childSchema, parentSchema) {
|
|
92
|
+
if (!childSchema || typeof childSchema === "boolean") {
|
|
93
|
+
return {};
|
|
94
|
+
}
|
|
95
|
+
if (parentSchema.readOnly) {
|
|
96
|
+
return { ...childSchema, readOnly: parentSchema.readOnly };
|
|
97
|
+
}
|
|
98
|
+
return childSchema;
|
|
99
|
+
}
|
|
@@ -8,5 +8,5 @@ export const RadioField = (props) => {
|
|
|
8
8
|
useSetDefault(props);
|
|
9
9
|
const { name, uiSchema } = props;
|
|
10
10
|
const { label, props: inputProps } = useMemo(() => extractUiSchema(uiSchema), [uiSchema]);
|
|
11
|
-
return (_jsx(FieldTemplate, { ...props, "data-fjsf-boolean": name, children: _jsx(RadioFieldInput, { inputProps: inputProps, label: label, name: name }) }));
|
|
11
|
+
return (_jsx(FieldTemplate, { ...props, "data-fjsf-boolean": name, children: _jsx(RadioFieldInput, { inputProps: { readOnly: props.schema.readOnly, ...inputProps }, label: label, name: name }) }));
|
|
12
12
|
};
|
|
@@ -11,6 +11,10 @@ export const RadioFieldContainer = styled.div `
|
|
|
11
11
|
export const RadioFieldElement = styled.label `
|
|
12
12
|
display: inline-flex;
|
|
13
13
|
align-items: center;
|
|
14
|
+
|
|
15
|
+
&:has(input[readonly]) {
|
|
16
|
+
pointer-events: none;
|
|
17
|
+
}
|
|
14
18
|
`;
|
|
15
19
|
export const RadioFieldInputElement = styled(FieldInput) `
|
|
16
20
|
margin: unset;
|
|
@@ -6,7 +6,7 @@ import { FormRegistry } from "../../FormRegistry";
|
|
|
6
6
|
import { useSetDefault } from "../../hooks";
|
|
7
7
|
import { StringFieldWrapper } from "./styledComponents";
|
|
8
8
|
export const StringField = (props) => {
|
|
9
|
-
const { templates: { FieldTemplate }, components: { FieldInput }, } = useContext(FormRegistry);
|
|
9
|
+
const { templates: { FieldTemplate }, components: { FieldInput, SelectFieldInput }, } = useContext(FormRegistry);
|
|
10
10
|
useSetDefault(props);
|
|
11
11
|
const { name, uiSchema = {}, schema } = props;
|
|
12
12
|
const { type, placeholder, props: inputProps, } = useMemo(() => extractUiSchema(uiSchema), [uiSchema]);
|
|
@@ -17,7 +17,8 @@ export const StringField = (props) => {
|
|
|
17
17
|
: { "data-fjsf-number": name };
|
|
18
18
|
switch (enums?.type) {
|
|
19
19
|
case "select":
|
|
20
|
-
return (_jsx(FieldTemplate, { ...props, ...fieldDataAttribute, children: _jsx(StringFieldWrapper, { children: _jsxs(
|
|
20
|
+
return (_jsx(FieldTemplate, { ...props, ...fieldDataAttribute, children: _jsx(StringFieldWrapper, { children: _jsxs(SelectFieldInput, { type,
|
|
21
|
+
readOnly: props.schema.readOnly,
|
|
21
22
|
...inputProps, name: name, formikAs: "select", onChange: (e) => {
|
|
22
23
|
const selectedOption = enums?.values.find((option) => option.const.toString() === e.target.value);
|
|
23
24
|
const selectedValue = selectedOption
|
|
@@ -28,8 +29,10 @@ export const StringField = (props) => {
|
|
|
28
29
|
hidden: true,
|
|
29
30
|
...uiSchema["ui:placeholderOptionOptions"]?.props, children: placeholder }), enums?.values.map((option, index) => (_jsx("option", { value: option.const.toString(), children: option.title }, index)))] }) }) }));
|
|
30
31
|
default:
|
|
32
|
+
console.log({ props, type, inputProps });
|
|
31
33
|
return (_jsx(FieldTemplate, { ...props, ...fieldDataAttribute, children: _jsx(StringFieldWrapper, { children: _jsx(FieldInput, { type,
|
|
32
34
|
placeholder,
|
|
35
|
+
readOnly: props.schema.readOnly,
|
|
33
36
|
...inputProps, name: name }) }) }));
|
|
34
37
|
}
|
|
35
38
|
};
|
|
@@ -8,5 +8,5 @@ export const TextAreaField = (props) => {
|
|
|
8
8
|
useSetDefault(props);
|
|
9
9
|
const { name, uiSchema } = props;
|
|
10
10
|
const { props: inputProps } = useMemo(() => extractUiSchema(uiSchema), [uiSchema]);
|
|
11
|
-
return (_jsx(FieldTemplate, { ...props, "data-fjsf-string": name, children: _jsx(TextAreaFieldInput, { ...inputProps, name: name, formikAs: "textarea" }) }));
|
|
11
|
+
return (_jsx(FieldTemplate, { ...props, "data-fjsf-string": name, children: _jsx(TextAreaFieldInput, { readOnly: props.schema.readOnly, ...inputProps, name: name, formikAs: "textarea" }) }));
|
|
12
12
|
};
|
|
@@ -8,5 +8,5 @@ export const ToggleField = (props) => {
|
|
|
8
8
|
useSetDefault(props);
|
|
9
9
|
const { name, uiSchema } = props;
|
|
10
10
|
const { props: inputProps } = useMemo(() => extractUiSchema(uiSchema), [uiSchema]);
|
|
11
|
-
return (_jsx(FieldTemplate, { ...props, "data-fjsf-boolean": name, children: _jsx(ToggleFieldInput, { inputProps: inputProps, name: name }) }));
|
|
11
|
+
return (_jsx(FieldTemplate, { ...props, "data-fjsf-boolean": name, children: _jsx(ToggleFieldInput, { inputProps: { readOnly: props.schema.readOnly, ...inputProps }, name: name }) }));
|
|
12
12
|
};
|
|
@@ -30,6 +30,10 @@ export const ToggleFieldLabel = styled.label `
|
|
|
30
30
|
position: relative;
|
|
31
31
|
display: inline-block;
|
|
32
32
|
width: 2rem;
|
|
33
|
+
|
|
34
|
+
&:has(input[readonly]) {
|
|
35
|
+
pointer-events: none;
|
|
36
|
+
}
|
|
33
37
|
`;
|
|
34
38
|
export const ToggleFieldInputElement = styled(FieldInput) `
|
|
35
39
|
opacity: 0;
|
|
@@ -7,3 +7,8 @@ export declare const FieldHelp: import("styled-components/dist/types").IStyledCo
|
|
|
7
7
|
export declare const FieldInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<any, "as">, "ref"> & {
|
|
8
8
|
ref?: unknown;
|
|
9
9
|
}, never>> & string & Omit<({ formikAs, ...props }: Omit<formik.FieldAttributes<any>, "as">) => import("react/jsx-runtime").JSX.Element, keyof React.Component<any, {}, any>>;
|
|
10
|
+
export declare const SelectFieldInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<Omit<Omit<any, "as">, "ref"> & {
|
|
11
|
+
ref?: unknown;
|
|
12
|
+
}, never>, "ref"> & {
|
|
13
|
+
ref?: unknown;
|
|
14
|
+
}, never>> & string;
|
|
@@ -19,6 +19,11 @@ export declare const components: {
|
|
|
19
19
|
FieldInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<any, "as">, "ref"> & {
|
|
20
20
|
ref?: unknown;
|
|
21
21
|
}, never>> & string & Omit<({ formikAs, ...props }: Omit<import("formik").FieldAttributes<any>, "as">) => import("react/jsx-runtime").JSX.Element, keyof import("react").Component<any, {}, any>>;
|
|
22
|
+
SelectFieldInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<Omit<Omit<any, "as">, "ref"> & {
|
|
23
|
+
ref?: unknown;
|
|
24
|
+
}, never>, "ref"> & {
|
|
25
|
+
ref?: unknown;
|
|
26
|
+
}, never>> & string;
|
|
22
27
|
FieldInfoBoxElement: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, import("../../common/types/FieldInfo").FieldInfoBoxElementProps>> & string;
|
|
23
28
|
FieldInfoBoxArrowElement: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, import("../../common/types/FieldInfo").FieldInfoBoxElementProps>> & string;
|
|
24
29
|
FieldInfoBoxInnerElement: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -8,6 +8,9 @@ export type UiSchemaUiOrderType = string | {
|
|
|
8
8
|
collapsible?: boolean;
|
|
9
9
|
};
|
|
10
10
|
export type UiSchema = {
|
|
11
|
+
definitions?: {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
};
|
|
11
14
|
"ui:title"?: React.ReactNode | string;
|
|
12
15
|
"ui:description"?: React.ReactNode | string;
|
|
13
16
|
"ui:help"?: React.ReactNode | string;
|
|
@@ -19,15 +22,7 @@ export type UiSchema = {
|
|
|
19
22
|
"ui:props"?: {
|
|
20
23
|
[key: string]: any;
|
|
21
24
|
};
|
|
22
|
-
"ui:placeholderOptionOptions"?: {
|
|
23
|
-
props: {
|
|
24
|
-
[key: string]: any;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
25
|
"ui:order"?: UiSchemaUiOrderType[];
|
|
28
|
-
definitions?: {
|
|
29
|
-
[key: string]: any;
|
|
30
|
-
};
|
|
31
26
|
"ui:label"?: string | {
|
|
32
27
|
true: string;
|
|
33
28
|
false: string;
|
|
@@ -38,6 +33,14 @@ export type UiSchema = {
|
|
|
38
33
|
props?: {
|
|
39
34
|
[key: string]: any;
|
|
40
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated Will be moved to "ui:options"
|
|
38
|
+
*/
|
|
39
|
+
"ui:placeholderOptionOptions"?: {
|
|
40
|
+
props: {
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
41
44
|
/**
|
|
42
45
|
* @deprecated Will be moved to "ui:options"
|
|
43
46
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nolwenture/formik-jsonschema-form",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.5",
|
|
4
4
|
"description": "Formik form generation from json schema",
|
|
5
5
|
"author": "Antti Vikman <antti.vikman@nolwenture.com>",
|
|
6
6
|
"contributors": [
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"jest-environment-jsdom": "^29.7.0",
|
|
93
93
|
"react": "^18.2.0",
|
|
94
94
|
"react-dom": "^18.2.0",
|
|
95
|
+
"react-redux": "^9.2.0",
|
|
95
96
|
"react-router": "^7.0.1",
|
|
96
97
|
"react-router-dom": "^7.0.1",
|
|
97
98
|
"rimraf": "^6.0.1",
|