@firecms/collection_editor 3.0.0-beta.2-pre.2 → 3.0.0-beta.2-pre.3
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/form/Field.d.ts +53 -0
- package/dist/form/Formex.d.ts +4 -0
- package/dist/form/index.d.ts +5 -0
- package/dist/form/types.d.ts +25 -0
- package/dist/form/useCreateFormex.d.ts +9 -0
- package/dist/form/utils.d.ts +44 -0
- package/dist/index.es.js +2612 -2328
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/types/collection_editor_controller.d.ts +3 -2
- package/dist/types/config_controller.d.ts +3 -3
- package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +3 -5
- package/dist/ui/collection_editor/CollectionEditorWelcomeView.d.ts +2 -2
- package/dist/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +1 -2
- package/dist/ui/collection_editor/EnumForm.d.ts +1 -2
- package/dist/ui/collection_editor/PropertyEditView.d.ts +5 -5
- package/dist/ui/collection_editor/PropertyTree.d.ts +14 -13
- package/dist/ui/collection_editor/SwitchControl.d.ts +8 -0
- package/dist/ui/collection_editor/properties/CommonPropertyFields.d.ts +0 -1
- package/dist/ui/collection_editor/util.d.ts +1 -0
- package/package.json +5 -5
- package/src/ConfigControllerProvider.tsx +23 -21
- package/src/form/Field.tsx +162 -0
- package/src/form/Formex.tsx +8 -0
- package/src/form/README.md +165 -0
- package/src/form/index.ts +5 -0
- package/src/form/types.ts +27 -0
- package/src/form/useCreateFormex.tsx +137 -0
- package/src/form/utils.ts +169 -0
- package/src/types/collection_editor_controller.tsx +4 -3
- package/src/types/config_controller.tsx +3 -3
- package/src/ui/CollectionViewHeaderAction.tsx +1 -1
- package/src/ui/EditorCollectionAction.tsx +3 -3
- package/src/ui/HomePageEditorCollectionAction.tsx +2 -2
- package/src/ui/MissingReferenceWidget.tsx +2 -1
- package/src/ui/NewCollectionButton.tsx +3 -3
- package/src/ui/NewCollectionCard.tsx +2 -1
- package/src/ui/PropertyAddColumnComponent.tsx +1 -1
- package/src/ui/RootCollectionSuggestions.tsx +2 -1
- package/src/ui/collection_editor/CollectionDetailsForm.tsx +2 -2
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +422 -374
- package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +19 -12
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +26 -18
- package/src/ui/collection_editor/EnumForm.tsx +118 -114
- package/src/ui/collection_editor/GetCodeDialog.tsx +1 -1
- package/src/ui/collection_editor/PropertyEditView.tsx +198 -142
- package/src/ui/collection_editor/PropertyFieldPreview.tsx +5 -1
- package/src/ui/collection_editor/PropertyTree.tsx +132 -113
- package/src/ui/collection_editor/SubcollectionsEditTab.tsx +18 -11
- package/src/ui/collection_editor/SwitchControl.tsx +39 -0
- package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +10 -2
- package/src/ui/collection_editor/properties/BlockPropertyField.tsx +2 -2
- package/src/ui/collection_editor/properties/BooleanPropertyField.tsx +13 -9
- package/src/ui/collection_editor/properties/CommonPropertyFields.tsx +11 -37
- package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +2 -2
- package/src/ui/collection_editor/properties/EnumPropertyField.tsx +3 -6
- package/src/ui/collection_editor/properties/MapPropertyField.tsx +2 -2
- package/src/ui/collection_editor/properties/NumberPropertyField.tsx +2 -2
- package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +11 -14
- package/src/ui/collection_editor/properties/RepeatPropertyField.tsx +10 -9
- package/src/ui/collection_editor/properties/StoragePropertyField.tsx +15 -9
- package/src/ui/collection_editor/properties/StringPropertyField.tsx +2 -2
- package/src/ui/collection_editor/properties/UrlPropertyField.tsx +2 -2
- package/src/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx +27 -18
- package/src/ui/collection_editor/properties/validation/ArrayPropertyValidation.tsx +2 -2
- package/src/ui/collection_editor/properties/validation/GeneralPropertyValidation.tsx +27 -16
- package/src/ui/collection_editor/properties/validation/NumberPropertyValidation.tsx +33 -18
- package/src/ui/collection_editor/properties/validation/StringPropertyValidation.tsx +99 -80
- package/src/ui/collection_editor/util.ts +7 -0
- package/src/ui/collection_editor/utils/strings.ts +2 -1
|
@@ -2,7 +2,7 @@ import React, { useCallback, useState } from "react";
|
|
|
2
2
|
import { MapProperty, Property, PropertyConfig, } from "@firecms/core";
|
|
3
3
|
import { AddIcon, BooleanSwitchWithLabel, Button, Paper, Typography } from "@firecms/ui";
|
|
4
4
|
import { PropertyFormDialog } from "../PropertyEditView";
|
|
5
|
-
import { getIn,
|
|
5
|
+
import { getIn, useFormex } from "../../../form";
|
|
6
6
|
import { PropertyTree } from "../PropertyTree";
|
|
7
7
|
import { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath, namespaceToPropertiesPath } from "../util";
|
|
8
8
|
import { FieldHelperView } from "./FieldHelperView";
|
|
@@ -18,7 +18,7 @@ export function MapPropertyField({ disabled, getData, allowDataInference, proper
|
|
|
18
18
|
const {
|
|
19
19
|
values,
|
|
20
20
|
setFieldValue
|
|
21
|
-
} =
|
|
21
|
+
} = useFormex<MapProperty>();
|
|
22
22
|
|
|
23
23
|
const [propertyDialogOpen, setPropertyDialogOpen] = useState<boolean>(false);
|
|
24
24
|
const [selectedPropertyKey, setSelectedPropertyKey] = useState<string | undefined>();
|
|
@@ -2,13 +2,13 @@ import React from "react";
|
|
|
2
2
|
import { NumberPropertyValidation } from "./validation/NumberPropertyValidation";
|
|
3
3
|
import { ValidationPanel } from "./validation/ValidationPanel";
|
|
4
4
|
import { TextField } from "@firecms/ui";
|
|
5
|
-
import { getIn,
|
|
5
|
+
import { getIn, useFormex } from "../../../form";
|
|
6
6
|
|
|
7
7
|
export function NumberPropertyField({ disabled }: {
|
|
8
8
|
disabled: boolean;
|
|
9
9
|
}) {
|
|
10
10
|
|
|
11
|
-
const { values, setFieldValue } =
|
|
11
|
+
const { values, setFieldValue } = useFormex();
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
14
|
<>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Field, getIn,
|
|
2
|
+
import { Field, getIn, useFormex } from "../../../form";
|
|
3
3
|
import { IconForView, NumberProperty, StringProperty, useNavigationController } from "@firecms/core";
|
|
4
4
|
import { CircularProgress, Select, SelectGroup, SelectItem, Typography, } from "@firecms/ui";
|
|
5
5
|
import { FieldHelperView } from "./FieldHelperView";
|
|
@@ -9,13 +9,18 @@ export function ReferencePropertyField({
|
|
|
9
9
|
multiple,
|
|
10
10
|
disabled,
|
|
11
11
|
showErrors
|
|
12
|
-
}: {
|
|
12
|
+
}: {
|
|
13
|
+
existing: boolean,
|
|
14
|
+
multiple: boolean,
|
|
15
|
+
disabled: boolean,
|
|
16
|
+
showErrors: boolean
|
|
17
|
+
}) {
|
|
13
18
|
|
|
14
19
|
const {
|
|
15
20
|
values,
|
|
16
21
|
handleChange,
|
|
17
22
|
errors,
|
|
18
|
-
} =
|
|
23
|
+
} = useFormex<StringProperty | NumberProperty>();
|
|
19
24
|
|
|
20
25
|
const navigation = useNavigationController();
|
|
21
26
|
|
|
@@ -31,16 +36,15 @@ export function ReferencePropertyField({
|
|
|
31
36
|
return (
|
|
32
37
|
<>
|
|
33
38
|
<div className={"col-span-12"}>
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
|
|
40
|
+
<Field name={pathPath}
|
|
36
41
|
pathPath={pathPath}
|
|
37
42
|
type="select"
|
|
38
|
-
validate={validatePath}
|
|
39
43
|
disabled={existing || disabled}
|
|
40
44
|
value={pathValue}
|
|
41
45
|
error={pathError}
|
|
42
46
|
handleChange={handleChange}
|
|
43
|
-
|
|
47
|
+
as={CollectionsSelect}/>
|
|
44
48
|
|
|
45
49
|
</div>
|
|
46
50
|
|
|
@@ -48,13 +52,6 @@ export function ReferencePropertyField({
|
|
|
48
52
|
);
|
|
49
53
|
}
|
|
50
54
|
|
|
51
|
-
function validatePath(value?: string) {
|
|
52
|
-
let error;
|
|
53
|
-
if (!value) {
|
|
54
|
-
error = "You must specify a target collection for the field";
|
|
55
|
-
}
|
|
56
|
-
return error;
|
|
57
|
-
}
|
|
58
55
|
|
|
59
56
|
export function CollectionsSelect({
|
|
60
57
|
disabled,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useState } from "react";
|
|
2
2
|
import { ArrayProperty, getFieldConfig, Property, PropertyConfig } from "@firecms/core";
|
|
3
3
|
import { Button, Paper, Typography } from "@firecms/ui";
|
|
4
|
-
import { Field, getIn,
|
|
4
|
+
import { Field, getIn, useFormex } from "../../../form";
|
|
5
5
|
import { PropertyFormDialog } from "../PropertyEditView";
|
|
6
6
|
import { PropertyFieldPreview } from "../PropertyFieldPreview";
|
|
7
7
|
import { ArrayPropertyValidation } from "./validation/ArrayPropertyValidation";
|
|
@@ -31,16 +31,17 @@ export function RepeatPropertyField({
|
|
|
31
31
|
errors,
|
|
32
32
|
setFieldValue,
|
|
33
33
|
touched
|
|
34
|
-
} =
|
|
34
|
+
} = useFormex<ArrayProperty>();
|
|
35
35
|
|
|
36
36
|
const [propertyDialogOpen, setPropertyDialogOpen] = useState(false);
|
|
37
37
|
const ofProperty = getIn(values, "of");
|
|
38
38
|
const ofPropertyError = getIn(touched, "of") && getIn(errors, "of");
|
|
39
39
|
|
|
40
|
-
const onPropertyChanged =
|
|
41
|
-
|
|
40
|
+
const onPropertyChanged = ({ id, property, namespace }:
|
|
41
|
+
{ id?: string, property: Property, namespace?: string }) => {
|
|
42
|
+
console.log("onPropertyChanged", id, property, namespace);
|
|
42
43
|
setFieldValue("of", property);
|
|
43
|
-
}
|
|
44
|
+
};
|
|
44
45
|
|
|
45
46
|
const widget = ofProperty && getFieldConfig(ofProperty, propertyConfigs);
|
|
46
47
|
return (
|
|
@@ -52,11 +53,11 @@ export function RepeatPropertyField({
|
|
|
52
53
|
<Field
|
|
53
54
|
name={"of"}
|
|
54
55
|
value={ofProperty}
|
|
55
|
-
validate={(property: Property) => {
|
|
56
|
-
|
|
57
|
-
}}
|
|
56
|
+
// validate={(property: Property) => {
|
|
57
|
+
// return property?.dataType ? undefined : "You need to specify a repeat field";
|
|
58
|
+
// }}
|
|
58
59
|
>
|
|
59
|
-
{() => (
|
|
60
|
+
{({}) => (
|
|
60
61
|
<Paper className="p-2 mt-4">
|
|
61
62
|
|
|
62
63
|
{ofProperty && <PropertyFieldPreview
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { SwitchControl, } from "@firecms/core";
|
|
3
2
|
import {
|
|
4
3
|
Button,
|
|
5
4
|
Checkbox,
|
|
@@ -11,10 +10,11 @@ import {
|
|
|
11
10
|
Typography
|
|
12
11
|
} from "@firecms/ui";
|
|
13
12
|
|
|
14
|
-
import { Field, getIn,
|
|
13
|
+
import { Field, FormexFieldProps, getIn, useFormex } from "../../../form";
|
|
15
14
|
import { GeneralPropertyValidation } from "./validation/GeneralPropertyValidation";
|
|
16
15
|
import { ArrayPropertyValidation } from "./validation/ArrayPropertyValidation";
|
|
17
16
|
import { ValidationPanel } from "./validation/ValidationPanel";
|
|
17
|
+
import { SwitchControl } from "../SwitchControl";
|
|
18
18
|
|
|
19
19
|
const fileTypes: Record<string, string> = {
|
|
20
20
|
"image/*": "Images",
|
|
@@ -37,7 +37,7 @@ export function StoragePropertyField({
|
|
|
37
37
|
const {
|
|
38
38
|
values,
|
|
39
39
|
setFieldValue
|
|
40
|
-
} =
|
|
40
|
+
} = useFormex();
|
|
41
41
|
|
|
42
42
|
const baseStoragePath = multiple ? "of.storage" : "storage";
|
|
43
43
|
const acceptedFiles = `${baseStoragePath}.acceptedFiles`;
|
|
@@ -158,12 +158,18 @@ export function StoragePropertyField({
|
|
|
158
158
|
<li>{"{rand} - Random value used to avoid name collisions"}</li>
|
|
159
159
|
</ul>
|
|
160
160
|
</Typography>
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
161
|
+
|
|
162
|
+
<Field name={storeUrl}
|
|
163
|
+
type="checkbox">
|
|
164
|
+
{({ field, form }: FormexFieldProps) => {
|
|
165
|
+
return <SwitchControl
|
|
166
|
+
label={"Save URL instead of storage path"}
|
|
167
|
+
disabled={existing || disabled}
|
|
168
|
+
form={form}
|
|
169
|
+
field={field}/>
|
|
170
|
+
}}
|
|
171
|
+
</Field>
|
|
172
|
+
|
|
167
173
|
<Typography variant={"caption"} className={"ml-3.5 mt-1 mb-2"}>
|
|
168
174
|
Turn this setting on, if you prefer to save
|
|
169
175
|
the download
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { StringPropertyValidation } from "./validation/StringPropertyValidation";
|
|
3
3
|
import { ValidationPanel } from "./validation/ValidationPanel";
|
|
4
|
-
import { getIn,
|
|
4
|
+
import { getIn, useFormex } from "../../../form";
|
|
5
5
|
|
|
6
6
|
import { TextField } from "@firecms/ui";
|
|
7
7
|
|
|
@@ -15,7 +15,7 @@ export function StringPropertyField({
|
|
|
15
15
|
showErrors: boolean;
|
|
16
16
|
}) {
|
|
17
17
|
|
|
18
|
-
const { values, setFieldValue } =
|
|
18
|
+
const { values, setFieldValue } = useFormex();
|
|
19
19
|
|
|
20
20
|
return (
|
|
21
21
|
<>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { StringPropertyValidation } from "./validation/StringPropertyValidation";
|
|
3
3
|
import { ValidationPanel } from "./validation/ValidationPanel";
|
|
4
|
-
import { getIn,
|
|
4
|
+
import { getIn, useFormex } from "../../../form";
|
|
5
5
|
|
|
6
6
|
import { Select, SelectItem, TextField } from "@firecms/ui";
|
|
7
7
|
|
|
@@ -13,7 +13,7 @@ export function UrlPropertyField({
|
|
|
13
13
|
showErrors: boolean;
|
|
14
14
|
}) {
|
|
15
15
|
|
|
16
|
-
const { values, setFieldValue } =
|
|
16
|
+
const { values, setFieldValue } = useFormex();
|
|
17
17
|
|
|
18
18
|
const urlValue = getIn(values, "url");
|
|
19
19
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { SwitchControl } from "
|
|
3
|
+
import { Field, FormexFieldProps } from "../../../../form";
|
|
4
|
+
import { SwitchControl } from "../../SwitchControl";
|
|
5
5
|
|
|
6
|
-
export function AdvancedPropertyValidation({ disabled }: {
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
export function AdvancedPropertyValidation({ disabled }: {
|
|
7
|
+
disabled: boolean
|
|
8
|
+
}) {
|
|
9
9
|
|
|
10
10
|
const columnWidth = "columnWidth";
|
|
11
11
|
const hideFromCollection = "hideFromCollection";
|
|
@@ -13,23 +13,32 @@ export function AdvancedPropertyValidation({ disabled }: {disabled: boolean}) {
|
|
|
13
13
|
|
|
14
14
|
return (
|
|
15
15
|
|
|
16
|
-
<div className={"grid grid-cols-12 gap-2"}
|
|
16
|
+
<div className={"grid grid-cols-12 gap-2"}>
|
|
17
17
|
<div className={"col-span-12"}>
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
<Field type="checkbox" name={hideFromCollection}>
|
|
19
|
+
{({ field, form }: FormexFieldProps) => {
|
|
20
|
+
return <SwitchControl
|
|
21
|
+
label={"Hide from collection"}
|
|
22
|
+
disabled={disabled}
|
|
23
|
+
form={form}
|
|
24
|
+
tooltip={"Hide this field from the collection view. It will still be visible in the form view"}
|
|
25
|
+
field={field}/>
|
|
26
|
+
}}
|
|
27
|
+
</Field>
|
|
24
28
|
</div>
|
|
25
29
|
|
|
26
30
|
<div className={"col-span-12"}>
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
<Field name={readOnly}
|
|
32
|
+
type="checkbox">
|
|
33
|
+
{({ field, form }: FormexFieldProps) => {
|
|
34
|
+
return <SwitchControl
|
|
35
|
+
label={"Read only"}
|
|
36
|
+
disabled={disabled}
|
|
37
|
+
tooltip={"Is this a read only field. Display only as a preview"}
|
|
38
|
+
form={form}
|
|
39
|
+
field={field}/>
|
|
40
|
+
}}
|
|
41
|
+
</Field>
|
|
33
42
|
</div>
|
|
34
43
|
</div>
|
|
35
44
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
import { getIn,
|
|
3
|
+
import { getIn, useFormex } from "../../../../form";
|
|
4
4
|
import { DebouncedTextField } from "@firecms/ui";
|
|
5
5
|
import { GeneralPropertyValidation } from "./GeneralPropertyValidation";
|
|
6
6
|
|
|
@@ -17,7 +17,7 @@ export function ArrayPropertyValidation({
|
|
|
17
17
|
const {
|
|
18
18
|
values,
|
|
19
19
|
handleChange
|
|
20
|
-
} =
|
|
20
|
+
} = useFormex();
|
|
21
21
|
|
|
22
22
|
const validationMin = "validation.min";
|
|
23
23
|
const validationMax = "validation.max";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { SwitchControl } from "@firecms/core";
|
|
3
|
+
import { Field, FormexFieldProps, getIn, useFormex } from "../../../../form";
|
|
5
4
|
import { DebouncedTextField } from "@firecms/ui";
|
|
5
|
+
import { SwitchControl } from "../../SwitchControl";
|
|
6
6
|
|
|
7
7
|
export function GeneralPropertyValidation({ disabled }: {
|
|
8
8
|
required?: boolean;
|
|
9
|
-
disabled:boolean;
|
|
9
|
+
disabled: boolean;
|
|
10
10
|
}) {
|
|
11
11
|
|
|
12
|
-
const { values, handleChange } =
|
|
12
|
+
const { values, handleChange } = useFormex();
|
|
13
13
|
|
|
14
14
|
const validationRequired = "validation.required";
|
|
15
15
|
const validationRequiredMessage = "validation.requiredMessage";
|
|
@@ -19,21 +19,32 @@ export function GeneralPropertyValidation({ disabled }: {
|
|
|
19
19
|
return (
|
|
20
20
|
<>
|
|
21
21
|
<div className={"col-span-6"}>
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
<Field name={validationRequired}
|
|
23
|
+
type="checkbox">
|
|
24
|
+
{({ field, form }: FormexFieldProps) => {
|
|
25
|
+
return <SwitchControl
|
|
26
|
+
disabled={disabled}
|
|
27
|
+
label={"Required"}
|
|
28
|
+
tooltip={"You won't be able to save this entity if this value is not set"}
|
|
29
|
+
form={form}
|
|
30
|
+
field={field}/>
|
|
31
|
+
}}
|
|
32
|
+
</Field>
|
|
28
33
|
</div>
|
|
29
34
|
|
|
30
35
|
<div className={"col-span-6"}>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
|
|
37
|
+
<Field name={validationUnique}
|
|
38
|
+
type="checkbox">
|
|
39
|
+
{({ field, form }: FormexFieldProps) => {
|
|
40
|
+
return <SwitchControl
|
|
41
|
+
disabled={disabled}
|
|
42
|
+
label={"Unique"}
|
|
43
|
+
tooltip={"There cannot be multiple entities with the same value"}
|
|
44
|
+
form={form}
|
|
45
|
+
field={field}/>
|
|
46
|
+
}}
|
|
47
|
+
</Field>
|
|
37
48
|
</div>
|
|
38
49
|
|
|
39
50
|
{getIn(values, validationRequired) && <div className={"col-span-12"}>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { SwitchControl } from "@firecms/core";
|
|
3
|
+
import { Field, FormexFieldProps, getIn, useFormex } from "../../../../form";
|
|
5
4
|
import { DebouncedTextField } from "@firecms/ui";
|
|
6
5
|
import { GeneralPropertyValidation } from "./GeneralPropertyValidation";
|
|
6
|
+
import { SwitchControl } from "../../SwitchControl";
|
|
7
7
|
|
|
8
8
|
export function NumberPropertyValidation({ disabled }: {
|
|
9
9
|
disabled: boolean;
|
|
@@ -12,7 +12,7 @@ export function NumberPropertyValidation({ disabled }: {
|
|
|
12
12
|
const {
|
|
13
13
|
values,
|
|
14
14
|
handleChange
|
|
15
|
-
} =
|
|
15
|
+
} = useFormex();
|
|
16
16
|
|
|
17
17
|
const validationMin = "validation.min";
|
|
18
18
|
const validationMax = "validation.max";
|
|
@@ -75,25 +75,40 @@ export function NumberPropertyValidation({ disabled }: {
|
|
|
75
75
|
</div>
|
|
76
76
|
|
|
77
77
|
<div className={"col-span-4"}>
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
<Field name={validationPositive}
|
|
79
|
+
type="checkbox">
|
|
80
|
+
{({ field, form }: FormexFieldProps) => {
|
|
81
|
+
return <SwitchControl
|
|
82
|
+
label={"Positive value"}
|
|
83
|
+
disabled={disabled}
|
|
84
|
+
form={form}
|
|
85
|
+
field={field}/>
|
|
86
|
+
}}
|
|
87
|
+
</Field>
|
|
83
88
|
</div>
|
|
84
89
|
<div className={"col-span-4"}>
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
+
<Field name={validationNegative}
|
|
91
|
+
type="checkbox">
|
|
92
|
+
{({ field, form }: FormexFieldProps) => {
|
|
93
|
+
return <SwitchControl
|
|
94
|
+
label={"Negative value"}
|
|
95
|
+
disabled={disabled}
|
|
96
|
+
form={form}
|
|
97
|
+
field={field}/>
|
|
98
|
+
}}
|
|
99
|
+
</Field>
|
|
90
100
|
</div>
|
|
91
101
|
<div className={"col-span-4"}>
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
102
|
+
<Field name={validationInteger}
|
|
103
|
+
type="checkbox">
|
|
104
|
+
{({ field, form }: FormexFieldProps) => {
|
|
105
|
+
return <SwitchControl
|
|
106
|
+
label={"Integer value"}
|
|
107
|
+
disabled={disabled}
|
|
108
|
+
form={form}
|
|
109
|
+
field={field}/>
|
|
110
|
+
}}
|
|
111
|
+
</Field>
|
|
97
112
|
</div>
|
|
98
113
|
</div>
|
|
99
114
|
);
|