@dartech/arsenal-ui 1.2.4 → 1.2.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/.babelrc +13 -0
- package/.eslintrc.json +22 -0
- package/{index.d.ts → index.ts} +5 -5
- package/jest.config.ts +11 -0
- package/package.json +3 -12
- package/project.json +94 -0
- package/rollup.config.js +146 -0
- package/src/assets/chevron_left_gray.svg +3 -0
- package/src/consts/index.ts +13 -0
- package/src/interfaces/common.ts +18 -0
- package/src/interfaces/definition.ts +143 -0
- package/src/interfaces/{index.d.ts → index.ts} +3 -3
- package/src/interfaces/ui.ts +80 -0
- package/src/lib/Alert/Alert.tsx +108 -0
- package/src/lib/Alert/index.ts +1 -0
- package/src/lib/Breadcrumbs/Breadcrumbs.styled.tsx +16 -0
- package/src/lib/Breadcrumbs/Breadcrumbs.tsx +40 -0
- package/src/lib/Breadcrumbs/{index.d.ts → index.ts} +1 -1
- package/src/lib/ContentLayout/ContentLayout.tsx +31 -0
- package/src/lib/ContentLayout/index.ts +1 -0
- package/src/lib/Definition/CreateDefinition/CreateDefinition.tsx +78 -0
- package/src/lib/Definition/CreateDefinition/{index.d.ts → index.ts} +1 -1
- package/src/lib/Definition/DefinitionFiller/DefinitionFiller.tsx +71 -0
- package/src/lib/Definition/DefinitionFiller/{index.d.ts → index.ts} +1 -1
- package/src/lib/Definition/DefinitionValueView/DefinitionValueView.tsx +54 -0
- package/src/lib/Definition/DefinitionValueView/PropertyDataView.tsx +67 -0
- package/src/lib/Definition/DefinitionValueView/{index.d.ts → index.ts} +1 -1
- package/src/lib/Definition/{index.d.ts → index.ts} +3 -3
- package/src/lib/Forms/BackButton.tsx +46 -0
- package/src/lib/Forms/ControlAceEditor.tsx +125 -0
- package/src/lib/Forms/ControlAutocomplete.tsx +145 -0
- package/src/lib/Forms/ControlCheckbox.tsx +113 -0
- package/src/lib/Forms/ControlDate.tsx +75 -0
- package/src/lib/Forms/ControlDateTime.tsx +77 -0
- package/src/lib/Forms/ControlDebouncedInput.tsx +80 -0
- package/src/lib/Forms/ControlInput.tsx +111 -0
- package/src/lib/Forms/ControlNumberInput.tsx +121 -0
- package/src/lib/Forms/ControlQueryAutocomplete.tsx +197 -0
- package/src/lib/Forms/ControlRadio.tsx +136 -0
- package/src/lib/Forms/ControlSelect.tsx +164 -0
- package/src/lib/Forms/ControlSwitch.tsx +71 -0
- package/src/lib/Forms/ControlTime.tsx +93 -0
- package/src/lib/Forms/CopyButton.tsx +46 -0
- package/src/lib/Forms/{index.d.ts → index.ts} +15 -15
- package/src/lib/Forms/useAutocomplete.tsx +47 -0
- package/src/lib/InfoItem/InfoItem.tsx +40 -0
- package/src/lib/InfoItem/{index.d.ts → index.ts} +1 -1
- package/src/lib/InfoItem/styles.ts +17 -0
- package/src/lib/JsonPathPicker/JsonPathPicker.tsx +73 -0
- package/src/lib/JsonPathPicker/PropertyStep.tsx +70 -0
- package/src/lib/JsonPathPicker/{index.d.ts → index.ts} +1 -1
- package/src/lib/JsonView/JsonView.tsx +41 -0
- package/src/lib/JsonView/{index.d.ts → index.ts} +1 -1
- package/src/lib/Loader/Loader.tsx +41 -0
- package/src/lib/Loader/{index.d.ts → index.ts} +1 -1
- package/src/lib/Modals/JsonModalView.tsx +53 -0
- package/src/lib/Modals/{index.d.ts → index.ts} +1 -1
- package/src/lib/Property/PropertyFiller/JsonEditor.tsx +58 -0
- package/src/lib/Property/PropertyFiller/MultiplePropertyFiller.tsx +129 -0
- package/src/lib/Property/PropertyFiller/MultiplePropertyWidget.tsx +85 -0
- package/src/lib/Property/PropertyFiller/PropertyFiller.tsx +199 -0
- package/src/lib/Property/PropertyFiller/{index.d.ts → index.ts} +2 -2
- package/src/lib/Property/PropertyFiller/usePropertyFiller.ts +72 -0
- package/src/lib/Property/PropertyFiller/useStyles.ts +12 -0
- package/src/lib/Property/PropertyValidator/NodeValidator.tsx +92 -0
- package/src/lib/Property/PropertyValidator/NodesList.tsx +26 -0
- package/src/lib/Property/PropertyValidator/NumericTypeValidator.tsx +59 -0
- package/src/lib/Property/PropertyValidator/PropertyValidator.tsx +42 -0
- package/src/lib/Property/PropertyValidator/PropertyValidatorContext.tsx +4 -0
- package/src/lib/Property/PropertyValidator/StringTypeValidator.tsx +36 -0
- package/src/lib/Property/PropertyValidator/ValidationNodeSelector.tsx +62 -0
- package/src/lib/Property/PropertyValidator/index.ts +1 -0
- package/src/lib/Property/PropertyValueField/BooleanValueField.tsx +49 -0
- package/src/lib/Property/PropertyValueField/DateTimeValueField.tsx +58 -0
- package/src/lib/Property/PropertyValueField/DateValueField.tsx +58 -0
- package/src/lib/Property/PropertyValueField/JsonValueField.tsx +65 -0
- package/src/lib/Property/PropertyValueField/PropertyValueField.tsx +49 -0
- package/src/lib/Property/PropertyValueField/StringValueField.tsx +50 -0
- package/src/lib/Property/PropertyValueField/TimeValueField.tsx +67 -0
- package/src/lib/Property/PropertyValueField/{index.d.ts → index.ts} +1 -1
- package/src/lib/Property/PropertyWidget/PropertyWidget.tsx +115 -0
- package/src/lib/Property/PropertyWidget/{index.d.ts → index.ts} +1 -1
- package/src/lib/Property/UpsertProperty/CreatePropertiesList.tsx +148 -0
- package/src/lib/Property/UpsertProperty/CreatePropertyFormFields.tsx +158 -0
- package/src/lib/Property/UpsertProperty/CustomPropertyField.tsx +40 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/BigDecimalPropertyFields.tsx +41 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/DateAdditionalFields.tsx +27 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityAdditionalFields.tsx +133 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityReferencePropertyFields.tsx +46 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/PropertyAdditionalFields.tsx +52 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/StringPropertyFields.tsx +103 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/{index.d.ts → index.ts} +1 -1
- package/src/lib/Property/UpsertProperty/{index.d.ts → index.ts} +2 -2
- package/src/lib/Property/UpsertProperty/useCustomFields.ts +22 -0
- package/src/lib/Property/ViewPropertiesList/ViewPropertiesList.tsx +37 -0
- package/src/lib/Property/ViewPropertiesList/{index.d.ts → index.ts} +1 -1
- package/src/lib/Property/ViewProperty/EntityPropertiesShortView.tsx +40 -0
- package/src/lib/Property/ViewProperty/EntityPropertiesView.tsx +48 -0
- package/src/lib/Property/ViewProperty/PropertyDataTable.tsx +148 -0
- package/src/lib/Property/ViewProperty/PropertyItem.tsx +43 -0
- package/src/lib/Property/ViewProperty/ViewProperty.tsx +52 -0
- package/src/lib/Property/ViewProperty/{index.d.ts → index.ts} +1 -1
- package/src/lib/Property/{index.d.ts → index.ts} +5 -5
- package/src/lib/Sidebar/Sidebar.styled.tsx +157 -0
- package/src/lib/Sidebar/Sidebar.tsx +27 -0
- package/src/lib/Sidebar/SidebarContext.tsx +37 -0
- package/src/lib/Sidebar/SidebarDrawer.tsx +50 -0
- package/src/lib/Sidebar/SidebarLink/MenuIcon.tsx +16 -0
- package/src/lib/Sidebar/SidebarLink/SidebarLink.tsx +54 -0
- package/src/lib/Sidebar/SidebarLink/SidebarLinkItem.tsx +54 -0
- package/src/lib/Sidebar/SidebarLink/SidebarNestedItem.tsx +62 -0
- package/src/lib/Sidebar/SidebarLink/{index.d.ts → index.ts} +2 -2
- package/src/lib/Sidebar/index.ts +2 -0
- package/src/lib/Status/Status.tsx +16 -0
- package/src/lib/Status/{index.d.ts → index.ts} +1 -1
- package/src/lib/Status/styles.ts +21 -0
- package/src/lib/StepperView/StepperView.tsx +73 -0
- package/src/lib/StepperView/{index.d.ts → index.ts} +1 -1
- package/src/lib/Table/DataGrid/JsonTypeCell.tsx +51 -0
- package/src/lib/Table/DataGrid/Table.tsx +117 -0
- package/src/lib/Table/DataGrid/TableAction.tsx +43 -0
- package/src/lib/Table/DataGrid/TableColumnMenu.tsx +12 -0
- package/src/lib/Table/DataGrid/TablePagination.tsx +42 -0
- package/src/lib/Table/DataGrid/index.ts +2 -0
- package/src/lib/Table/DataGrid/styles.ts +59 -0
- package/src/lib/Table/DataGrid/usePagination.ts +15 -0
- package/src/lib/Table/DataGrid/useTableQueryPagination.ts +47 -0
- package/src/lib/Table/DataGrid/useTableQuerySorting.ts +47 -0
- package/src/lib/Table/SimpleTable/SimpleTable.tsx +138 -0
- package/src/lib/Table/SimpleTable/TableActionCell.tsx +67 -0
- package/src/lib/Table/SimpleTable/index.ts +2 -0
- package/src/lib/Table/SimpleTable/useTablePagination.ts +54 -0
- package/src/lib/Table/SimpleTable/useTableSorting.ts +50 -0
- package/src/lib/Table/index.ts +2 -0
- package/src/lib/Tabs/RouteTabs.tsx +54 -0
- package/src/lib/Tabs/TabPanel.tsx +42 -0
- package/src/lib/Tabs/{index.d.ts → index.ts} +2 -2
- package/src/lib/{index.d.ts → index.ts} +16 -16
- package/src/theme/baseTheme.ts +128 -0
- package/src/theme/fonts.d.ts +2 -0
- package/src/theme/index.ts +126 -0
- package/src/theme/inputThemeOptions.ts +126 -0
- package/src/theme/stepperThemeOptions.ts +20 -0
- package/src/theme/tableThemeOptions.ts +50 -0
- package/src/theme/typographyThemeOptions.ts +32 -0
- package/src/utils/common.ts +73 -0
- package/src/utils/dem.ts +431 -0
- package/src/utils/hooks.ts +41 -0
- package/src/utils/{index.d.ts → index.ts} +5 -5
- package/src/utils/ui-utils.tsx +102 -0
- package/src/utils/validators.ts +14 -0
- package/tsconfig.json +25 -0
- package/tsconfig.lib.json +23 -0
- package/tsconfig.spec.json +20 -0
- package/index.js +0 -1
- package/src/consts/index.d.ts +0 -12
- package/src/interfaces/common.d.ts +0 -17
- package/src/interfaces/definition.d.ts +0 -107
- package/src/interfaces/ui.d.ts +0 -70
- package/src/lib/Alert/Alert.d.ts +0 -53
- package/src/lib/Alert/index.d.ts +0 -1
- package/src/lib/Breadcrumbs/Breadcrumbs.d.ts +0 -9
- package/src/lib/Breadcrumbs/Breadcrumbs.styled.d.ts +0 -2
- package/src/lib/ContentLayout/ContentLayout.d.ts +0 -9
- package/src/lib/ContentLayout/index.d.ts +0 -1
- package/src/lib/Definition/CreateDefinition/CreateDefinition.d.ts +0 -11
- package/src/lib/Definition/DefinitionFiller/DefinitionFiller.d.ts +0 -10
- package/src/lib/Definition/DefinitionValueView/DefinitionValueView.d.ts +0 -8
- package/src/lib/Definition/DefinitionValueView/PropertyDataView.d.ts +0 -9
- package/src/lib/Forms/BackButton.d.ts +0 -7
- package/src/lib/Forms/ControlAceEditor.d.ts +0 -24
- package/src/lib/Forms/ControlAutocomplete.d.ts +0 -69
- package/src/lib/Forms/ControlCheckbox.d.ts +0 -51
- package/src/lib/Forms/ControlDate.d.ts +0 -18
- package/src/lib/Forms/ControlDateTime.d.ts +0 -18
- package/src/lib/Forms/ControlDebouncedInput.d.ts +0 -4
- package/src/lib/Forms/ControlInput.d.ts +0 -59
- package/src/lib/Forms/ControlNumberInput.d.ts +0 -51
- package/src/lib/Forms/ControlQueryAutocomplete.d.ts +0 -16
- package/src/lib/Forms/ControlRadio.d.ts +0 -66
- package/src/lib/Forms/ControlSelect.d.ts +0 -67
- package/src/lib/Forms/ControlSwitch.d.ts +0 -19
- package/src/lib/Forms/ControlTime.d.ts +0 -18
- package/src/lib/Forms/CopyButton.d.ts +0 -20
- package/src/lib/Forms/useAutocomplete.d.ts +0 -10
- package/src/lib/InfoItem/InfoItem.d.ts +0 -10
- package/src/lib/InfoItem/styles.d.ts +0 -12
- package/src/lib/JsonPathPicker/JsonPathPicker.d.ts +0 -10
- package/src/lib/JsonPathPicker/PropertyStep.d.ts +0 -11
- package/src/lib/JsonView/JsonView.d.ts +0 -7
- package/src/lib/Loader/Loader.d.ts +0 -21
- package/src/lib/Modals/JsonModalView.d.ts +0 -10
- package/src/lib/Property/PropertyFiller/JsonEditor.d.ts +0 -10
- package/src/lib/Property/PropertyFiller/MultiplePropertyFiller.d.ts +0 -12
- package/src/lib/Property/PropertyFiller/MultiplePropertyWidget.d.ts +0 -11
- package/src/lib/Property/PropertyFiller/PropertyFiller.d.ts +0 -12
- package/src/lib/Property/PropertyFiller/usePropertyFiller.d.ts +0 -24
- package/src/lib/Property/PropertyFiller/useStyles.d.ts +0 -12
- package/src/lib/Property/PropertyValidator/NodeValidator.d.ts +0 -6
- package/src/lib/Property/PropertyValidator/NodesList.d.ts +0 -6
- package/src/lib/Property/PropertyValidator/NumericTypeValidator.d.ts +0 -8
- package/src/lib/Property/PropertyValidator/PropertyValidator.d.ts +0 -6
- package/src/lib/Property/PropertyValidator/PropertyValidatorContext.d.ts +0 -3
- package/src/lib/Property/PropertyValidator/StringTypeValidator.d.ts +0 -8
- package/src/lib/Property/PropertyValidator/ValidationNodeSelector.d.ts +0 -7
- package/src/lib/Property/PropertyValidator/index.d.ts +0 -1
- package/src/lib/Property/PropertyValueField/BooleanValueField.d.ts +0 -7
- package/src/lib/Property/PropertyValueField/DateTimeValueField.d.ts +0 -9
- package/src/lib/Property/PropertyValueField/DateValueField.d.ts +0 -9
- package/src/lib/Property/PropertyValueField/JsonValueField.d.ts +0 -10
- package/src/lib/Property/PropertyValueField/PropertyValueField.d.ts +0 -9
- package/src/lib/Property/PropertyValueField/StringValueField.d.ts +0 -9
- package/src/lib/Property/PropertyValueField/TimeValueField.d.ts +0 -9
- package/src/lib/Property/PropertyWidget/PropertyWidget.d.ts +0 -13
- package/src/lib/Property/UpsertProperty/CreatePropertiesList.d.ts +0 -13
- package/src/lib/Property/UpsertProperty/CreatePropertyFormFields.d.ts +0 -10
- package/src/lib/Property/UpsertProperty/CustomPropertyField.d.ts +0 -7
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/BigDecimalPropertyFields.d.ts +0 -6
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/DateAdditionalFields.d.ts +0 -7
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityAdditionalFields.d.ts +0 -8
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityReferencePropertyFields.d.ts +0 -6
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/PropertyAdditionalFields.d.ts +0 -10
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/StringPropertyFields.d.ts +0 -6
- package/src/lib/Property/UpsertProperty/useCustomFields.d.ts +0 -6
- package/src/lib/Property/ViewPropertiesList/ViewPropertiesList.d.ts +0 -8
- package/src/lib/Property/ViewProperty/EntityPropertiesShortView.d.ts +0 -7
- package/src/lib/Property/ViewProperty/EntityPropertiesView.d.ts +0 -8
- package/src/lib/Property/ViewProperty/PropertyDataTable.d.ts +0 -7
- package/src/lib/Property/ViewProperty/PropertyItem.d.ts +0 -9
- package/src/lib/Property/ViewProperty/ViewProperty.d.ts +0 -9
- package/src/lib/Sidebar/Sidebar.d.ts +0 -10
- package/src/lib/Sidebar/Sidebar.styled.d.ts +0 -117
- package/src/lib/Sidebar/SidebarContext.d.ts +0 -11
- package/src/lib/Sidebar/SidebarDrawer.d.ts +0 -9
- package/src/lib/Sidebar/SidebarLink/MenuIcon.d.ts +0 -7
- package/src/lib/Sidebar/SidebarLink/SidebarLink.d.ts +0 -7
- package/src/lib/Sidebar/SidebarLink/SidebarLinkItem.d.ts +0 -8
- package/src/lib/Sidebar/SidebarLink/SidebarNestedItem.d.ts +0 -10
- package/src/lib/Sidebar/index.d.ts +0 -2
- package/src/lib/Status/Status.d.ts +0 -8
- package/src/lib/Status/styles.d.ts +0 -12
- package/src/lib/StepperView/StepperView.d.ts +0 -11
- package/src/lib/Table/DataGrid/JsonTypeCell.d.ts +0 -7
- package/src/lib/Table/DataGrid/Table.d.ts +0 -49
- package/src/lib/Table/DataGrid/TableAction.d.ts +0 -13
- package/src/lib/Table/DataGrid/TableColumnMenu.d.ts +0 -3
- package/src/lib/Table/DataGrid/TablePagination.d.ts +0 -3
- package/src/lib/Table/DataGrid/index.d.ts +0 -2
- package/src/lib/Table/DataGrid/styles.d.ts +0 -12
- package/src/lib/Table/DataGrid/usePagination.d.ts +0 -5
- package/src/lib/Table/DataGrid/useTableQueryPagination.d.ts +0 -11
- package/src/lib/Table/DataGrid/useTableQuerySorting.d.ts +0 -6
- package/src/lib/Table/SimpleTable/SimpleTable.d.ts +0 -17
- package/src/lib/Table/SimpleTable/TableActionCell.d.ts +0 -10
- package/src/lib/Table/SimpleTable/index.d.ts +0 -2
- package/src/lib/Table/SimpleTable/useTablePagination.d.ts +0 -7
- package/src/lib/Table/SimpleTable/useTableSorting.d.ts +0 -6
- package/src/lib/Table/index.d.ts +0 -2
- package/src/lib/Tabs/RouteTabs.d.ts +0 -11
- package/src/lib/Tabs/TabPanel.d.ts +0 -25
- package/src/theme/baseTheme.d.ts +0 -2
- package/src/theme/index.d.ts +0 -1
- package/src/theme/inputThemeOptions.d.ts +0 -117
- package/src/theme/stepperThemeOptions.d.ts +0 -16
- package/src/theme/tableThemeOptions.d.ts +0 -47
- package/src/theme/typographyThemeOptions.d.ts +0 -29
- package/src/utils/common.d.ts +0 -7
- package/src/utils/dem.d.ts +0 -27
- package/src/utils/hooks.d.ts +0 -7
- package/src/utils/ui-utils.d.ts +0 -8
- package/src/utils/validators.d.ts +0 -5
@@ -0,0 +1,129 @@
|
|
1
|
+
import Box from '@mui/material/Box';
|
2
|
+
import Grid from '@mui/material/Unstable_Grid2';
|
3
|
+
import Select, { SelectChangeEvent } from '@mui/material/Select';
|
4
|
+
import MenuItem from '@mui/material/MenuItem';
|
5
|
+
import FormControl from '@mui/material/FormControl';
|
6
|
+
import InputLabel from '@mui/material/InputLabel';
|
7
|
+
import Typography from '@mui/material/Typography';
|
8
|
+
import JsonEditor from './JsonEditor';
|
9
|
+
import MultiplePropertyWidget from './MultiplePropertyWidget';
|
10
|
+
import { ControlInput } from '../../Forms';
|
11
|
+
|
12
|
+
import { useEffect } from 'react';
|
13
|
+
import { useController, useFormContext, useWatch } from 'react-hook-form';
|
14
|
+
import usePropertyFiller from './usePropertyFiller';
|
15
|
+
import useStyles from './useStyles';
|
16
|
+
|
17
|
+
import { PropertyFillType, PropertyType, PropertyUnion } from '../../../interfaces';
|
18
|
+
|
19
|
+
type Props = {
|
20
|
+
property: PropertyUnion;
|
21
|
+
name: string;
|
22
|
+
useExpression?: boolean;
|
23
|
+
required?: boolean;
|
24
|
+
label?: string;
|
25
|
+
title?: string;
|
26
|
+
};
|
27
|
+
|
28
|
+
export const MultiplePropertyFiller = ({ property, name, useExpression, required, label, title }: Props) => {
|
29
|
+
const { control, clearErrors } = useFormContext();
|
30
|
+
const {
|
31
|
+
field: { ref, onChange },
|
32
|
+
fieldState: { error, isDirty },
|
33
|
+
} = useController({
|
34
|
+
control,
|
35
|
+
name,
|
36
|
+
rules: {
|
37
|
+
validate: (val) => {
|
38
|
+
if (required && !val) {
|
39
|
+
return 'Please, fill this field';
|
40
|
+
}
|
41
|
+
return true;
|
42
|
+
},
|
43
|
+
},
|
44
|
+
});
|
45
|
+
const value = useWatch({ control, name });
|
46
|
+
|
47
|
+
const { propertyType, valueLabel, fillOptionLabel, fillOption, fillOptions, setFillOption } = usePropertyFiller({
|
48
|
+
property,
|
49
|
+
value,
|
50
|
+
isDirty,
|
51
|
+
label,
|
52
|
+
required,
|
53
|
+
useExpression,
|
54
|
+
multipleOptions: true,
|
55
|
+
});
|
56
|
+
|
57
|
+
const handleFillOptionChange = (event: SelectChangeEvent<PropertyFillType>) => {
|
58
|
+
const selectedType = event.target.value as PropertyFillType;
|
59
|
+
|
60
|
+
if (selectedType === 'null') {
|
61
|
+
onChange(null);
|
62
|
+
} else if (selectedType === 'expression' || selectedType === 'json_valid' || selectedType === 'json_notvalid') {
|
63
|
+
onChange('');
|
64
|
+
} else if (selectedType === 'widget') {
|
65
|
+
onChange([]);
|
66
|
+
}
|
67
|
+
setFillOption(selectedType);
|
68
|
+
clearErrors(name);
|
69
|
+
};
|
70
|
+
|
71
|
+
useEffect(() => {
|
72
|
+
if (value === undefined) {
|
73
|
+
onChange(null);
|
74
|
+
}
|
75
|
+
}, [value, onChange]);
|
76
|
+
|
77
|
+
const { classes } = useStyles();
|
78
|
+
return (
|
79
|
+
<Grid>
|
80
|
+
{title && (
|
81
|
+
<Box mb={2}>
|
82
|
+
<Typography variant="h6">{title}</Typography>
|
83
|
+
</Box>
|
84
|
+
)}
|
85
|
+
{fillOptions ? (
|
86
|
+
<Box mb={2}>
|
87
|
+
<FormControl fullWidth size="small" variant="outlined">
|
88
|
+
<InputLabel htmlFor="type-select" className={classes.inputLabel}>
|
89
|
+
{fillOptionLabel}
|
90
|
+
</InputLabel>
|
91
|
+
<Select
|
92
|
+
labelId="type-select"
|
93
|
+
label={fillOptionLabel}
|
94
|
+
value={fillOption || ''}
|
95
|
+
onChange={handleFillOptionChange}
|
96
|
+
>
|
97
|
+
{fillOptions.map((option) => (
|
98
|
+
<MenuItem key={option.value} value={option.value}>
|
99
|
+
{option.label}
|
100
|
+
</MenuItem>
|
101
|
+
))}
|
102
|
+
</Select>
|
103
|
+
</FormControl>
|
104
|
+
</Box>
|
105
|
+
) : null}
|
106
|
+
{fillOption === 'expression' &&
|
107
|
+
(propertyType === PropertyType.JSON ||
|
108
|
+
propertyType === PropertyType.ENTITY ||
|
109
|
+
propertyType === PropertyType.ANY ? (
|
110
|
+
<JsonEditor name={name} inputRef={ref} />
|
111
|
+
) : (
|
112
|
+
<ControlInput required hideErrorMessage control={control} name={name} label={valueLabel} />
|
113
|
+
))}
|
114
|
+
{fillOption === 'json_valid' && <JsonEditor validate name={name} inputRef={ref} />}
|
115
|
+
{fillOption === 'widget' && (
|
116
|
+
<MultiplePropertyWidget
|
117
|
+
property={property}
|
118
|
+
name={name}
|
119
|
+
useExpression={useExpression}
|
120
|
+
required={required}
|
121
|
+
label={label}
|
122
|
+
/>
|
123
|
+
)}
|
124
|
+
{error && <Typography color="secondary">{error.message}</Typography>}
|
125
|
+
</Grid>
|
126
|
+
);
|
127
|
+
};
|
128
|
+
|
129
|
+
export default MultiplePropertyFiller;
|
@@ -0,0 +1,85 @@
|
|
1
|
+
import Box from '@mui/material/Box';
|
2
|
+
import Grid from '@mui/material/Unstable_Grid2';
|
3
|
+
import Button from '@mui/material/Button';
|
4
|
+
import IconButton from '@mui/material/IconButton';
|
5
|
+
import CloseIcon from '@mui/icons-material/Close';
|
6
|
+
import PropertyFiller from './PropertyFiller';
|
7
|
+
|
8
|
+
import { useCallback } from 'react';
|
9
|
+
import { useController, useFormContext, useWatch } from 'react-hook-form';
|
10
|
+
import { removeArrayItem } from '../../../utils';
|
11
|
+
|
12
|
+
import { PropertyUnion } from '../../../interfaces';
|
13
|
+
|
14
|
+
type Props = {
|
15
|
+
name: string;
|
16
|
+
property: PropertyUnion;
|
17
|
+
useExpression?: boolean;
|
18
|
+
required?: boolean;
|
19
|
+
label?: string;
|
20
|
+
};
|
21
|
+
|
22
|
+
const MultiplePropertyWidget = ({ name, property, useExpression, required, label }: Props) => {
|
23
|
+
const { control, setValue, clearErrors } = useFormContext();
|
24
|
+
const controller = useController({
|
25
|
+
control,
|
26
|
+
name,
|
27
|
+
rules: {
|
28
|
+
validate: (val) => {
|
29
|
+
if (!val || (Array.isArray(val) && !val.length)) {
|
30
|
+
return 'Please, fill array';
|
31
|
+
}
|
32
|
+
return true;
|
33
|
+
},
|
34
|
+
},
|
35
|
+
});
|
36
|
+
const values = useWatch({ control, name });
|
37
|
+
|
38
|
+
const handleAddValue = useCallback(() => {
|
39
|
+
if (values && Array.isArray(values)) {
|
40
|
+
setValue(`${name}.${values.length}`, null);
|
41
|
+
} else {
|
42
|
+
setValue(name, [null]);
|
43
|
+
}
|
44
|
+
clearErrors(name);
|
45
|
+
}, [name, values, setValue, clearErrors]);
|
46
|
+
|
47
|
+
const handleDeleteValue = useCallback(
|
48
|
+
(index) => {
|
49
|
+
setValue(name, removeArrayItem(values, index));
|
50
|
+
},
|
51
|
+
[name, values, setValue]
|
52
|
+
);
|
53
|
+
|
54
|
+
return (
|
55
|
+
<Grid container spacing={2} direction="column" xs={12}>
|
56
|
+
{values && Array.isArray(values)
|
57
|
+
? values.map((value, index) => (
|
58
|
+
<Grid key={index} xs={12}>
|
59
|
+
<Box display="flex" alignItems="flex-start" width="100%" p={2} style={{ backgroundColor: '#f1f1f1' }}>
|
60
|
+
<PropertyFiller
|
61
|
+
required={required}
|
62
|
+
property={property}
|
63
|
+
useExpression={useExpression}
|
64
|
+
name={`${name}.${index}`}
|
65
|
+
label={`${label || property.name} (${index + 1})`}
|
66
|
+
/>
|
67
|
+
<Box mt="8px" ml="4px">
|
68
|
+
<IconButton size="small" onClick={() => handleDeleteValue(index)}>
|
69
|
+
<CloseIcon fontSize="small" />
|
70
|
+
</IconButton>
|
71
|
+
</Box>
|
72
|
+
</Box>
|
73
|
+
</Grid>
|
74
|
+
))
|
75
|
+
: null}
|
76
|
+
<Grid>
|
77
|
+
<Button variant="contained" size="small" color="primary" onClick={handleAddValue}>
|
78
|
+
Add value
|
79
|
+
</Button>
|
80
|
+
</Grid>
|
81
|
+
</Grid>
|
82
|
+
);
|
83
|
+
};
|
84
|
+
|
85
|
+
export default MultiplePropertyWidget;
|
@@ -0,0 +1,199 @@
|
|
1
|
+
import Box from '@mui/material/Box';
|
2
|
+
import Grid from '@mui/material/Unstable_Grid2';
|
3
|
+
import Select, { SelectChangeEvent } from '@mui/material/Select';
|
4
|
+
import MenuItem from '@mui/material/MenuItem';
|
5
|
+
import FormControl from '@mui/material/FormControl';
|
6
|
+
import InputLabel from '@mui/material/InputLabel';
|
7
|
+
import Typography from '@mui/material/Typography';
|
8
|
+
import JsonEditor from './JsonEditor';
|
9
|
+
import { ControlInput } from '../../Forms';
|
10
|
+
import { PropertyWidget } from '../PropertyWidget';
|
11
|
+
|
12
|
+
import { useEffect } from 'react';
|
13
|
+
import { useController, useFormContext, useWatch } from 'react-hook-form';
|
14
|
+
import usePropertyFiller from './usePropertyFiller';
|
15
|
+
import useStyles from './useStyles';
|
16
|
+
|
17
|
+
import {
|
18
|
+
PropertyFillType,
|
19
|
+
PropertyType,
|
20
|
+
PropertyUnion,
|
21
|
+
} from '../../../interfaces';
|
22
|
+
import { CreateDefinition } from '../../Definition';
|
23
|
+
import { defaultDefinitionArrayValue } from '../../../consts';
|
24
|
+
import {
|
25
|
+
propertiesArrayToObject,
|
26
|
+
propertiesObjectToArray,
|
27
|
+
} from '../../../utils';
|
28
|
+
|
29
|
+
type Props = {
|
30
|
+
property: PropertyUnion;
|
31
|
+
name: string;
|
32
|
+
useExpression?: boolean;
|
33
|
+
label?: string;
|
34
|
+
required?: boolean;
|
35
|
+
title?: string;
|
36
|
+
};
|
37
|
+
|
38
|
+
export const PropertyFiller = ({
|
39
|
+
property,
|
40
|
+
name,
|
41
|
+
useExpression,
|
42
|
+
label,
|
43
|
+
required,
|
44
|
+
title,
|
45
|
+
}: Props) => {
|
46
|
+
const { control, clearErrors } = useFormContext();
|
47
|
+
const {
|
48
|
+
field: { ref, onChange },
|
49
|
+
fieldState: { error, isDirty },
|
50
|
+
} = useController({
|
51
|
+
name,
|
52
|
+
});
|
53
|
+
const value = useWatch({ control, name });
|
54
|
+
|
55
|
+
const {
|
56
|
+
propertyType,
|
57
|
+
valueLabel,
|
58
|
+
fillOptionLabel,
|
59
|
+
fillOption,
|
60
|
+
fillOptions,
|
61
|
+
setFillOption,
|
62
|
+
} = usePropertyFiller({
|
63
|
+
value,
|
64
|
+
property,
|
65
|
+
isDirty,
|
66
|
+
label,
|
67
|
+
required,
|
68
|
+
useExpression,
|
69
|
+
});
|
70
|
+
|
71
|
+
const handleFillOptionChange = (
|
72
|
+
event: SelectChangeEvent<PropertyFillType>
|
73
|
+
) => {
|
74
|
+
const selectedType = event.target.value as PropertyFillType;
|
75
|
+
if (selectedType === 'null') {
|
76
|
+
onChange(null);
|
77
|
+
// register(name, { value: null });
|
78
|
+
} else if (selectedType === 'widget') {
|
79
|
+
if (
|
80
|
+
propertyType === PropertyType.JSON &&
|
81
|
+
value &&
|
82
|
+
typeof value !== 'string' &&
|
83
|
+
fillOption === 'dem_builder' &&
|
84
|
+
'properties' in value
|
85
|
+
) {
|
86
|
+
const definitionValue = {
|
87
|
+
...value,
|
88
|
+
properties: propertiesArrayToObject(value.property || []),
|
89
|
+
};
|
90
|
+
try {
|
91
|
+
onChange(JSON.stringify(definitionValue, null, '\t'));
|
92
|
+
} catch (error) {
|
93
|
+
console.log('Stringify failed');
|
94
|
+
}
|
95
|
+
} else {
|
96
|
+
onChange(null);
|
97
|
+
}
|
98
|
+
} else if (selectedType === 'expression' || selectedType === 'string') {
|
99
|
+
onChange('');
|
100
|
+
} else if (selectedType === 'dem_builder') {
|
101
|
+
if (value) {
|
102
|
+
try {
|
103
|
+
const definitionValue = JSON.parse(value);
|
104
|
+
definitionValue['properties'] = propertiesObjectToArray(
|
105
|
+
definitionValue['properties'] || {}
|
106
|
+
);
|
107
|
+
onChange(definitionValue);
|
108
|
+
} catch (error) {
|
109
|
+
onChange(defaultDefinitionArrayValue);
|
110
|
+
console.log('Parse failed');
|
111
|
+
}
|
112
|
+
} else {
|
113
|
+
onChange(defaultDefinitionArrayValue);
|
114
|
+
}
|
115
|
+
}
|
116
|
+
setFillOption(selectedType);
|
117
|
+
clearErrors(name);
|
118
|
+
};
|
119
|
+
|
120
|
+
useEffect(() => {
|
121
|
+
if (value === undefined) {
|
122
|
+
onChange(null);
|
123
|
+
}
|
124
|
+
}, [value, onChange]);
|
125
|
+
|
126
|
+
const { classes } = useStyles();
|
127
|
+
return (
|
128
|
+
<Grid xs={12}>
|
129
|
+
{title && (
|
130
|
+
<Box mb={2}>
|
131
|
+
<Typography variant="h6">{title}</Typography>
|
132
|
+
</Box>
|
133
|
+
)}
|
134
|
+
{fillOptions ? (
|
135
|
+
<Box mb={2}>
|
136
|
+
<FormControl fullWidth size="small" variant="outlined">
|
137
|
+
<InputLabel htmlFor="type-select" className={classes.inputLabel}>
|
138
|
+
{fillOptionLabel}
|
139
|
+
</InputLabel>
|
140
|
+
<Select
|
141
|
+
labelId="type-select"
|
142
|
+
label={fillOptionLabel}
|
143
|
+
value={fillOption || ''}
|
144
|
+
onChange={handleFillOptionChange}
|
145
|
+
>
|
146
|
+
{fillOptions.map((option) => (
|
147
|
+
<MenuItem key={option.value} value={option.value}>
|
148
|
+
{option.label}
|
149
|
+
</MenuItem>
|
150
|
+
))}
|
151
|
+
</Select>
|
152
|
+
</FormControl>
|
153
|
+
</Box>
|
154
|
+
) : null}
|
155
|
+
{fillOption === 'expression' &&
|
156
|
+
(propertyType === PropertyType.JSON ||
|
157
|
+
propertyType === PropertyType.ENTITY ||
|
158
|
+
propertyType === PropertyType.ANY ? (
|
159
|
+
<JsonEditor name={name} inputRef={ref} />
|
160
|
+
) : (
|
161
|
+
<ControlInput
|
162
|
+
control={control}
|
163
|
+
name={name}
|
164
|
+
label={valueLabel}
|
165
|
+
required
|
166
|
+
hideErrorMessage
|
167
|
+
/>
|
168
|
+
))}
|
169
|
+
{fillOption === 'string' && (
|
170
|
+
<ControlInput
|
171
|
+
control={control}
|
172
|
+
name={name}
|
173
|
+
label={valueLabel}
|
174
|
+
required
|
175
|
+
hideErrorMessage
|
176
|
+
/>
|
177
|
+
)}
|
178
|
+
{fillOption === 'json_notvalid' && (
|
179
|
+
<JsonEditor name={name} inputRef={ref} />
|
180
|
+
)}
|
181
|
+
{fillOption === 'widget' && (
|
182
|
+
<PropertyWidget
|
183
|
+
property={property}
|
184
|
+
name={name}
|
185
|
+
useExpression={useExpression}
|
186
|
+
label={valueLabel}
|
187
|
+
inputRef={ref}
|
188
|
+
required={required}
|
189
|
+
/>
|
190
|
+
)}
|
191
|
+
{fillOption === 'dem_builder' && (
|
192
|
+
<CreateDefinition title="JSON" definitionFieldName={name} />
|
193
|
+
)}
|
194
|
+
{error && <Typography color="secondary">{error.message}</Typography>}
|
195
|
+
</Grid>
|
196
|
+
);
|
197
|
+
};
|
198
|
+
|
199
|
+
export default PropertyFiller;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export * from './PropertyFiller';
|
2
|
-
export * from './MultiplePropertyFiller';
|
1
|
+
export * from './PropertyFiller';
|
2
|
+
export * from './MultiplePropertyFiller';
|
@@ -0,0 +1,72 @@
|
|
1
|
+
import { useEffect, useMemo, useState } from 'react';
|
2
|
+
import {
|
3
|
+
getMultiplePropertyFillOptions,
|
4
|
+
getSinglePropertyFillOptions,
|
5
|
+
isExpression,
|
6
|
+
isPropertyValueEmpty,
|
7
|
+
} from '../../../utils';
|
8
|
+
|
9
|
+
import { PropertyFillType, PropertyUnion } from '../../../interfaces';
|
10
|
+
|
11
|
+
type Props = {
|
12
|
+
value: unknown;
|
13
|
+
property: PropertyUnion;
|
14
|
+
isDirty: boolean;
|
15
|
+
label?: string;
|
16
|
+
required?: boolean;
|
17
|
+
useExpression?: boolean;
|
18
|
+
multipleOptions?: boolean;
|
19
|
+
};
|
20
|
+
|
21
|
+
const usePropertyFiller = ({
|
22
|
+
value,
|
23
|
+
property,
|
24
|
+
label,
|
25
|
+
isDirty,
|
26
|
+
required = false,
|
27
|
+
useExpression = false,
|
28
|
+
multipleOptions = false,
|
29
|
+
}: Props) => {
|
30
|
+
const valueLabel = useMemo(() => (label ? `${label} (value)` : `${property.name} (value)`), [label, property]);
|
31
|
+
const fillOptionLabel = useMemo(() => (label ? `${label} (widget)` : `${property.name} (widget)`), [label, property]);
|
32
|
+
|
33
|
+
const propertyType = useMemo(
|
34
|
+
() => (typeof property.propertyType === 'string' ? property.propertyType : property['propertyType']['value']),
|
35
|
+
[property]
|
36
|
+
);
|
37
|
+
|
38
|
+
const [fillOption, setFillOption] = useState<PropertyFillType>(null);
|
39
|
+
const fillOptions = useMemo(
|
40
|
+
() =>
|
41
|
+
multipleOptions
|
42
|
+
? getMultiplePropertyFillOptions({ propertyType, required, useExpression })
|
43
|
+
: getSinglePropertyFillOptions({
|
44
|
+
propertyType,
|
45
|
+
required,
|
46
|
+
useExpression,
|
47
|
+
}),
|
48
|
+
[useExpression, required, propertyType, multipleOptions]
|
49
|
+
);
|
50
|
+
|
51
|
+
useEffect(() => {
|
52
|
+
if (!fillOption) {
|
53
|
+
if (isPropertyValueEmpty(value) && fillOptions?.length) {
|
54
|
+
setFillOption(fillOptions[0].value);
|
55
|
+
} else if (useExpression && isExpression(value)) {
|
56
|
+
setFillOption('expression');
|
57
|
+
} else {
|
58
|
+
setFillOption('widget');
|
59
|
+
}
|
60
|
+
} else if (!isDirty) {
|
61
|
+
if (isExpression(value) && fillOption !== 'expression') {
|
62
|
+
setFillOption('expression');
|
63
|
+
} else if (value !== null && value !== undefined && !isExpression(value) && fillOption !== 'widget') {
|
64
|
+
setFillOption('widget');
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}, [value, fillOption, fillOptions, useExpression, isDirty]);
|
68
|
+
|
69
|
+
return { propertyType, valueLabel, fillOptionLabel, fillOption, fillOptions, setFillOption };
|
70
|
+
};
|
71
|
+
|
72
|
+
export default usePropertyFiller;
|
@@ -0,0 +1,92 @@
|
|
1
|
+
import { useContext, useMemo, useEffect } from 'react';
|
2
|
+
import Box from '@mui/material/Box';
|
3
|
+
import { PropertyType } from '../../../interfaces';
|
4
|
+
import { ControlSelect, ControlInput, ControlAceEditor } from '../../Forms';
|
5
|
+
import { PropertyValidatorContext } from './PropertyValidatorContext';
|
6
|
+
import { useWatch, useFormContext } from 'react-hook-form';
|
7
|
+
import { StepperView } from '../../StepperView';
|
8
|
+
import { StringTypeValidator } from './StringTypeValidator';
|
9
|
+
import { NumericTypeValidator } from './NumericTypeValidator';
|
10
|
+
|
11
|
+
type Props = {
|
12
|
+
name: string;
|
13
|
+
}
|
14
|
+
|
15
|
+
const validatorTypes = ['STRING_REGEX', 'JSON_SCHEMA'];
|
16
|
+
|
17
|
+
const numericTypes = new Set([PropertyType.INTEGER, PropertyType.FLOAT, PropertyType.DOUBLE, PropertyType.BIG_DECIMAL, PropertyType.BIG_INTEGER, PropertyType.LONG]);
|
18
|
+
|
19
|
+
const NodeValidator = ({ name }: Props) => {
|
20
|
+
const { control, setValue } = useFormContext();
|
21
|
+
const propertyType = useContext(PropertyValidatorContext);
|
22
|
+
const selectedType = useWatch({ control, name: `${name}.type` });
|
23
|
+
const renderValidator = useMemo(() => {
|
24
|
+
if (selectedType === 'STRING_REGEX') {
|
25
|
+
return (
|
26
|
+
<ControlInput
|
27
|
+
control={control}
|
28
|
+
name={`${name}.pattern`}
|
29
|
+
label="Pattern"
|
30
|
+
/>
|
31
|
+
)
|
32
|
+
}
|
33
|
+
if (selectedType === 'JSON_SCHEMA') {
|
34
|
+
switch (true) {
|
35
|
+
case propertyType === PropertyType.STRING: {
|
36
|
+
return <StringTypeValidator name={`${name}.node`} control={control} />
|
37
|
+
}
|
38
|
+
case numericTypes.has(propertyType as PropertyType): {
|
39
|
+
return <NumericTypeValidator name={`${name}.node`} control={control} />
|
40
|
+
}
|
41
|
+
case propertyType === PropertyType.JSON: {
|
42
|
+
return (
|
43
|
+
<ControlAceEditor
|
44
|
+
label="Properties"
|
45
|
+
control={control}
|
46
|
+
name={`${name}.properties`}
|
47
|
+
validateJson
|
48
|
+
parseValue
|
49
|
+
/>
|
50
|
+
)
|
51
|
+
}
|
52
|
+
default: return 'Not available for type ' + propertyType;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
return null;
|
56
|
+
}, [propertyType, selectedType, control, name]);
|
57
|
+
|
58
|
+
useEffect(() => {
|
59
|
+
if (numericTypes.has(propertyType as PropertyType) && selectedType === 'JSON_SCHEMA') {
|
60
|
+
// setting default values
|
61
|
+
setValue(`${name}.node.exclusiveMinimum`, false)
|
62
|
+
setValue(`${name}.node.exclusiveMaximum`, false)
|
63
|
+
}
|
64
|
+
}, [propertyType, selectedType, setValue, name]);
|
65
|
+
|
66
|
+
return (
|
67
|
+
<StepperView
|
68
|
+
data={[{
|
69
|
+
label: 'Validator',
|
70
|
+
content: (
|
71
|
+
<>
|
72
|
+
<Box>
|
73
|
+
<ControlSelect
|
74
|
+
control={control}
|
75
|
+
name={`${name}.type`}
|
76
|
+
label="Type"
|
77
|
+
options={validatorTypes}
|
78
|
+
onChange={e => {
|
79
|
+
setValue(name, {});
|
80
|
+
setValue(`${name}.type`, e.target.value)
|
81
|
+
}}
|
82
|
+
/>
|
83
|
+
</Box>
|
84
|
+
<Box mt={2}>{renderValidator}</Box>
|
85
|
+
</>
|
86
|
+
)
|
87
|
+
}]}
|
88
|
+
/>
|
89
|
+
)
|
90
|
+
}
|
91
|
+
|
92
|
+
export default NodeValidator;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { useMemo } from 'react';
|
2
|
+
import ValidationNodeSelector from './ValidationNodeSelector';
|
3
|
+
import Box from '@mui/material/Box';
|
4
|
+
import Button from '@mui/material/Button';
|
5
|
+
import { useFieldArray, useFormContext } from 'react-hook-form';
|
6
|
+
|
7
|
+
type Props = {
|
8
|
+
name: string;
|
9
|
+
}
|
10
|
+
|
11
|
+
const NodesList = ({ name }: Props) => {
|
12
|
+
const listItem = useMemo(() => ({
|
13
|
+
type: ''
|
14
|
+
}), []);
|
15
|
+
const { control } = useFormContext();
|
16
|
+
const { fields, append, remove } = useFieldArray({ control, name });
|
17
|
+
|
18
|
+
return (
|
19
|
+
<Box mt={2}>
|
20
|
+
<Button variant="outlined" size="small" onClick={() => append(listItem)}>Add node</Button>
|
21
|
+
{fields.map(({ id }, idx) => <ValidationNodeSelector removeHandle={() => remove(idx)} key={id} name={`${name}.${idx}`} />)}
|
22
|
+
</Box>
|
23
|
+
)
|
24
|
+
}
|
25
|
+
|
26
|
+
export default NodesList;
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { ControlInput, ControlCheckbox } from '../../Forms';
|
3
|
+
import Box from '@mui/material/Box';
|
4
|
+
import Typography from '@mui/material/Typography';
|
5
|
+
import { Control } from 'react-hook-form';
|
6
|
+
|
7
|
+
type Props = {
|
8
|
+
name: string;
|
9
|
+
control: Control<any>;
|
10
|
+
}
|
11
|
+
|
12
|
+
export const NumericTypeValidator = ({ name, control }: Props) => {
|
13
|
+
return (
|
14
|
+
<>
|
15
|
+
<Typography variant="body2" gutterBottom>Node</Typography>
|
16
|
+
<Box>
|
17
|
+
<ControlInput
|
18
|
+
control={control}
|
19
|
+
name={`${name}.multipleOf`}
|
20
|
+
label="Multiple Of"
|
21
|
+
type="number"
|
22
|
+
/>
|
23
|
+
</Box>
|
24
|
+
<Box mt={2}>
|
25
|
+
<ControlInput
|
26
|
+
control={control}
|
27
|
+
name={`${name}.minimum`}
|
28
|
+
label="Minimum"
|
29
|
+
type="number"
|
30
|
+
/>
|
31
|
+
</Box>
|
32
|
+
<Box mt={2}>
|
33
|
+
<ControlInput
|
34
|
+
control={control}
|
35
|
+
name={`${name}.maximum`}
|
36
|
+
label="Maximum"
|
37
|
+
type="number"
|
38
|
+
/>
|
39
|
+
</Box>
|
40
|
+
<Box mt={2}>
|
41
|
+
<ControlCheckbox
|
42
|
+
control={control}
|
43
|
+
name={`${name}.exclusiveMinimum`}
|
44
|
+
label="Exclusive Minimum"
|
45
|
+
defaultValue={'false'}
|
46
|
+
/>
|
47
|
+
<ControlCheckbox
|
48
|
+
control={control}
|
49
|
+
name={`${name}.exclusiveMaximum`}
|
50
|
+
label="Exclusive Maximum"
|
51
|
+
defaultValue={'false'}
|
52
|
+
/>
|
53
|
+
</Box>
|
54
|
+
|
55
|
+
</>
|
56
|
+
)
|
57
|
+
}
|
58
|
+
|
59
|
+
export default NumericTypeValidator;
|