@dartech/arsenal-ui 0.0.1 → 0.0.2
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/{index.ts → index.d.ts} +3 -3
- package/index.esm.js +1 -0
- package/index.umd.js +1 -0
- package/package.json +5 -2
- package/src/interfaces/common.d.ts +10 -0
- package/src/interfaces/definition.d.ts +117 -0
- package/src/interfaces/{index.ts → index.d.ts} +3 -3
- package/src/interfaces/ui.d.ts +33 -0
- package/src/lib/Alert/Alert.d.ts +53 -0
- package/src/lib/Alert/index.d.ts +1 -0
- package/src/lib/Definition/CreateDefinition/CreateDefinition.d.ts +11 -0
- package/src/lib/Definition/CreateDefinition/{index.ts → index.d.ts} +1 -1
- package/src/lib/Definition/DefinitionFiller/DefinitionFiller.d.ts +8 -0
- package/src/lib/Definition/DefinitionFiller/WidgetDefinitionFiller.d.ts +9 -0
- package/src/lib/Definition/DefinitionFiller/{index.ts → index.d.ts} +2 -2
- package/src/lib/Definition/{index.ts → index.d.ts} +2 -2
- package/src/lib/DemPropertyField/DemPropertyField.d.ts +59 -0
- package/src/lib/DemPropertyField/DemPropertyView/DemPropertyView.d.ts +8 -0
- package/src/lib/DemPropertyField/DemPropertyView/{index.ts → index.d.ts} +1 -1
- package/src/lib/DemPropertyField/MultipleDemField/MultipleDemField.d.ts +9 -0
- package/src/lib/DemPropertyField/MultipleDemField/{index.tsx → index.d.ts} +1 -1
- package/src/lib/DemPropertyField/RestrictedValuesEditor.d.ts +6 -0
- package/src/lib/DemPropertyField/SingleDemField/SingleDemField.d.ts +9 -0
- package/src/lib/DemPropertyField/SingleDemField/{index.ts → index.d.ts} +1 -1
- package/src/lib/DemPropertyField/{index.ts → index.d.ts} +2 -2
- package/src/lib/DemPropertyField/styles.d.ts +2 -0
- package/src/lib/DemPropertyField/widgets/DemBooleanWidget.d.ts +7 -0
- package/src/lib/DemPropertyField/widgets/DemDateTimeWidget.d.ts +9 -0
- package/src/lib/DemPropertyField/widgets/DemDateWidget.d.ts +9 -0
- package/src/lib/DemPropertyField/widgets/DemFieldWidget.d.ts +11 -0
- package/src/lib/DemPropertyField/widgets/DemFloatWidget.d.ts +10 -0
- package/src/lib/DemPropertyField/widgets/DemIntegerWidget.d.ts +10 -0
- package/src/lib/DemPropertyField/widgets/DemJsonWidget.d.ts +9 -0
- package/src/lib/DemPropertyField/widgets/DemStringWidget.d.ts +10 -0
- package/src/lib/DemPropertyField/widgets/DemTimeWidget.d.ts +9 -0
- package/src/lib/DemPropertyField/widgets/{index.ts → index.d.ts} +1 -1
- package/src/lib/Forms/BackButton.d.ts +7 -0
- package/src/lib/Forms/ControlAceEditor.d.ts +20 -0
- package/src/lib/Forms/ControlAutocomplete.d.ts +49 -0
- package/src/lib/Forms/ControlCheckbox.d.ts +30 -0
- package/src/lib/Forms/ControlDebouncedInput.d.ts +4 -0
- package/src/lib/Forms/ControlInput.d.ts +54 -0
- package/src/lib/Forms/ControlNumberInput.d.ts +43 -0
- package/src/lib/Forms/ControlRadioBtn.d.ts +26 -0
- package/src/lib/Forms/ControlSelect.d.ts +66 -0
- package/src/lib/Forms/CopyButton.d.ts +21 -0
- package/src/lib/Forms/{index.ts → index.d.ts} +10 -10
- package/src/lib/InfoItem/InfoItem.d.ts +10 -0
- package/src/lib/InfoItem/{index.ts → index.d.ts} +1 -1
- package/src/lib/InfoItem/styles.d.ts +2 -0
- package/src/lib/JsonPathPicker/JsonPathPicker.d.ts +10 -0
- package/src/lib/JsonPathPicker/PropertyStep.d.ts +11 -0
- package/src/lib/JsonPathPicker/{index.ts → index.d.ts} +1 -1
- package/src/lib/JsonView/JsonView.d.ts +9 -0
- package/src/lib/JsonView/{index.ts → index.d.ts} +1 -1
- package/src/lib/Loader/Loader.d.ts +21 -0
- package/src/lib/Loader/{index.ts → index.d.ts} +1 -1
- package/src/lib/Modals/JsonModalView.d.ts +10 -0
- package/src/lib/Modals/{index.ts → index.d.ts} +1 -1
- package/src/lib/Property/PropertyValueField/BooleanValueField.d.ts +7 -0
- package/src/lib/Property/PropertyValueField/DateTimeValueField.d.ts +9 -0
- package/src/lib/Property/PropertyValueField/DateValueField.d.ts +9 -0
- package/src/lib/Property/PropertyValueField/EntityValueField.d.ts +9 -0
- package/src/lib/Property/PropertyValueField/JsonValueField.d.ts +10 -0
- package/src/lib/Property/PropertyValueField/PropertyValue.d.ts +10 -0
- package/src/lib/Property/PropertyValueField/PropertyValueField.d.ts +9 -0
- package/src/lib/Property/PropertyValueField/StringValueField.d.ts +9 -0
- package/src/lib/Property/PropertyValueField/TimeValueField.d.ts +9 -0
- package/src/lib/Property/PropertyValueField/ValueComponent.d.ts +15 -0
- package/src/lib/Property/PropertyValueField/{index.ts → index.d.ts} +2 -1
- package/src/lib/Property/PropertyWidget/PropertyWidget.d.ts +9 -0
- package/src/lib/Property/PropertyWidget/{index.ts → index.d.ts} +1 -1
- package/src/lib/Property/UpsertProperty/CreatePropertiesList.d.ts +13 -0
- package/src/lib/Property/UpsertProperty/CreatePropertyFormFields.d.ts +10 -0
- package/src/lib/Property/UpsertProperty/CustomPropertyField.d.ts +7 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/BigDecimalPropertyFields.d.ts +6 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/DateAdditionalFields.d.ts +7 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityAdditionalFields.d.ts +8 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityReferencePropertyFields.d.ts +6 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/PropertyAdditionalFields.d.ts +10 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/StringPropertyFields.d.ts +6 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/{index.ts → index.d.ts} +1 -1
- package/src/lib/Property/UpsertProperty/{index.ts → index.d.ts} +2 -2
- package/src/lib/Property/UpsertProperty/useCustomFields.d.ts +6 -0
- package/src/lib/Property/ViewPropertiesList/ViewPropertiesList.d.ts +8 -0
- package/src/lib/Property/ViewPropertiesList/{index.ts → index.d.ts} +1 -1
- package/src/lib/Property/ViewProperty/EntityPropertiesShortView.d.ts +9 -0
- package/src/lib/Property/ViewProperty/EntityPropertiesView.d.ts +8 -0
- package/src/lib/Property/ViewProperty/PropertyDataTable.d.ts +7 -0
- package/src/lib/Property/ViewProperty/PropertyItem.d.ts +9 -0
- package/src/lib/Property/ViewProperty/ViewProperty.d.ts +9 -0
- package/src/lib/Property/ViewProperty/{index.ts → index.d.ts} +1 -1
- package/src/lib/Property/{index.ts → index.d.ts} +4 -4
- package/src/lib/Status/Status.d.ts +7 -0
- package/src/lib/Status/{index.ts → index.d.ts} +1 -1
- package/src/lib/Status/styles.d.ts +2 -0
- package/src/lib/Table/Table.d.ts +49 -0
- package/src/lib/Table/TableColumnMenu.d.ts +3 -0
- package/src/lib/Table/TablePagination.d.ts +3 -0
- package/src/lib/Table/index.d.ts +1 -0
- package/src/lib/Table/styles.d.ts +2 -0
- package/src/lib/Table/usePagination.d.ts +5 -0
- package/src/lib/Table/useTableQueryPagination.d.ts +11 -0
- package/src/lib/Table/useTableQuerySorting.d.ts +6 -0
- package/src/lib/Tabs/RouteTabs.d.ts +11 -0
- package/src/lib/Tabs/TabPanel.d.ts +25 -0
- package/src/lib/Tabs/{index.ts → index.d.ts} +2 -2
- package/src/lib/TemplateContent/ExpressionDecorator.d.ts +5 -0
- package/src/lib/TemplateContent/TemplateContentEditor.d.ts +9 -0
- package/src/lib/TemplateContent/{index.ts → index.d.ts} +1 -1
- package/src/lib/{index.ts → index.d.ts} +14 -14
- package/src/utils/common.d.ts +7 -0
- package/src/utils/dem.d.ts +7 -0
- package/src/utils/hooks.d.ts +7 -0
- package/src/utils/{index.ts → index.d.ts} +5 -5
- package/src/utils/ui-utils.d.ts +7 -0
- package/src/utils/validators.d.ts +12 -0
- package/.babelrc +0 -12
- package/.eslintrc.json +0 -22
- package/jest.config.js +0 -9
- package/project.json +0 -69
- package/rollup.config.js +0 -135
- package/src/interfaces/common.ts +0 -12
- package/src/interfaces/definition.ts +0 -143
- package/src/interfaces/ui.ts +0 -35
- package/src/lib/Alert/Alert.tsx +0 -108
- package/src/lib/Alert/index.ts +0 -1
- package/src/lib/Definition/CreateDefinition/CreateDefinition.tsx +0 -74
- package/src/lib/Definition/DefinitionFiller/DefinitionFiller.tsx +0 -85
- package/src/lib/Definition/DefinitionFiller/WidgetDefinitionFiller.tsx +0 -96
- package/src/lib/DemPropertyField/DemPropertyField.tsx +0 -93
- package/src/lib/DemPropertyField/DemPropertyView/DemPropertyView.tsx +0 -44
- package/src/lib/DemPropertyField/MultipleDemField/MultipleDemField.tsx +0 -293
- package/src/lib/DemPropertyField/RestrictedValuesEditor.tsx +0 -63
- package/src/lib/DemPropertyField/SingleDemField/SingleDemField.tsx +0 -156
- package/src/lib/DemPropertyField/styles.ts +0 -50
- package/src/lib/DemPropertyField/widgets/DemBooleanWidget.tsx +0 -26
- package/src/lib/DemPropertyField/widgets/DemDateTimeWidget.tsx +0 -34
- package/src/lib/DemPropertyField/widgets/DemDateWidget.tsx +0 -33
- package/src/lib/DemPropertyField/widgets/DemFieldWidget.tsx +0 -67
- package/src/lib/DemPropertyField/widgets/DemFloatWidget.tsx +0 -49
- package/src/lib/DemPropertyField/widgets/DemIntegerWidget.tsx +0 -63
- package/src/lib/DemPropertyField/widgets/DemJsonWidget.tsx +0 -33
- package/src/lib/DemPropertyField/widgets/DemStringWidget.tsx +0 -35
- package/src/lib/DemPropertyField/widgets/DemTimeWidget.tsx +0 -46
- package/src/lib/Forms/BackButton.tsx +0 -45
- package/src/lib/Forms/ControlAceEditor.tsx +0 -103
- package/src/lib/Forms/ControlAutocomplete.tsx +0 -134
- package/src/lib/Forms/ControlCheckbox.tsx +0 -57
- package/src/lib/Forms/ControlDebouncedInput.tsx +0 -69
- package/src/lib/Forms/ControlInput.tsx +0 -102
- package/src/lib/Forms/ControlNumberInput.tsx +0 -144
- package/src/lib/Forms/ControlRadioBtn.tsx +0 -46
- package/src/lib/Forms/ControlSelect.tsx +0 -135
- package/src/lib/Forms/CopyButton.tsx +0 -49
- package/src/lib/InfoItem/InfoItem.tsx +0 -39
- package/src/lib/InfoItem/styles.ts +0 -17
- package/src/lib/JsonPathPicker/JsonPathPicker.tsx +0 -71
- package/src/lib/JsonPathPicker/PropertyStep.tsx +0 -74
- package/src/lib/JsonView/JsonView.tsx +0 -43
- package/src/lib/Loader/Loader.tsx +0 -41
- package/src/lib/Modals/JsonModalView.tsx +0 -52
- package/src/lib/Property/PropertyValueField/BooleanValueField.tsx +0 -41
- package/src/lib/Property/PropertyValueField/DateTimeValueField.tsx +0 -59
- package/src/lib/Property/PropertyValueField/DateValueField.tsx +0 -59
- package/src/lib/Property/PropertyValueField/EntityValueField.tsx +0 -33
- package/src/lib/Property/PropertyValueField/JsonValueField.tsx +0 -64
- package/src/lib/Property/PropertyValueField/PropertyValue.tsx +0 -97
- package/src/lib/Property/PropertyValueField/PropertyValueField.tsx +0 -86
- package/src/lib/Property/PropertyValueField/StringValueField.tsx +0 -21
- package/src/lib/Property/PropertyValueField/TimeValueField.tsx +0 -68
- package/src/lib/Property/PropertyValueField/ValueComponent.tsx +0 -63
- package/src/lib/Property/PropertyWidget/PropertyWidget.tsx +0 -167
- package/src/lib/Property/UpsertProperty/CreatePropertiesList.tsx +0 -131
- package/src/lib/Property/UpsertProperty/CreatePropertyFormFields.tsx +0 -147
- package/src/lib/Property/UpsertProperty/CustomPropertyField.tsx +0 -40
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/BigDecimalPropertyFields.tsx +0 -41
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/DateAdditionalFields.tsx +0 -27
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityAdditionalFields.tsx +0 -133
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityReferencePropertyFields.tsx +0 -46
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/PropertyAdditionalFields.tsx +0 -52
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/StringPropertyFields.tsx +0 -98
- package/src/lib/Property/UpsertProperty/useCustomFields.ts +0 -22
- package/src/lib/Property/ViewPropertiesList/ViewPropertiesList.tsx +0 -50
- package/src/lib/Property/ViewProperty/EntityPropertiesShortView.tsx +0 -41
- package/src/lib/Property/ViewProperty/EntityPropertiesView.tsx +0 -48
- package/src/lib/Property/ViewProperty/PropertyDataTable.tsx +0 -139
- package/src/lib/Property/ViewProperty/PropertyItem.tsx +0 -46
- package/src/lib/Property/ViewProperty/ViewProperty.tsx +0 -52
- package/src/lib/Status/Status.tsx +0 -15
- package/src/lib/Status/styles.ts +0 -14
- package/src/lib/Table/Table.tsx +0 -116
- package/src/lib/Table/TableColumnMenu.tsx +0 -12
- package/src/lib/Table/TablePagination.tsx +0 -42
- package/src/lib/Table/index.ts +0 -1
- package/src/lib/Table/styles.ts +0 -59
- package/src/lib/Table/usePagination.ts +0 -15
- package/src/lib/Table/useTableQueryPagination.ts +0 -49
- package/src/lib/Table/useTableQuerySorting.ts +0 -52
- package/src/lib/Tabs/RouteTabs.tsx +0 -54
- package/src/lib/Tabs/TabPanel.tsx +0 -42
- package/src/lib/TemplateContent/ExpressionDecorator.tsx +0 -7
- package/src/lib/TemplateContent/TemplateContentEditor.tsx +0 -144
- package/src/utils/common.ts +0 -68
- package/src/utils/dem.ts +0 -78
- package/src/utils/hooks.ts +0 -41
- package/src/utils/ui-utils.tsx +0 -71
- package/src/utils/validators.ts +0 -130
- package/tsconfig.json +0 -24
- package/tsconfig.lib.json +0 -22
- package/tsconfig.spec.json +0 -19
@@ -1,63 +0,0 @@
|
|
1
|
-
import Grid from '@material-ui/core/Grid';
|
2
|
-
import Chip from '@material-ui/core/Chip';
|
3
|
-
import TextField from '@material-ui/core/TextField';
|
4
|
-
import Button from '@material-ui/core/Button';
|
5
|
-
|
6
|
-
import { useState } from 'react';
|
7
|
-
import { useFormContext } from 'react-hook-form';
|
8
|
-
import useStyles from './styles';
|
9
|
-
|
10
|
-
type Props = {
|
11
|
-
name: string;
|
12
|
-
};
|
13
|
-
|
14
|
-
const RestrictedValuesEditor = ({ name }: Props) => {
|
15
|
-
const { setValue, watch } = useFormContext();
|
16
|
-
const classes = useStyles();
|
17
|
-
const values = watch(name);
|
18
|
-
|
19
|
-
const [addValue, setAddValue] = useState('');
|
20
|
-
|
21
|
-
const handleAddValueChange = (e) => {
|
22
|
-
setAddValue(e.target.value);
|
23
|
-
};
|
24
|
-
|
25
|
-
const handleDelete = (value: string) => {
|
26
|
-
const filteredValues = values.filter((val) => val !== value);
|
27
|
-
setValue(name, filteredValues);
|
28
|
-
};
|
29
|
-
|
30
|
-
const handleAdd = () => {
|
31
|
-
if (values && values.length) {
|
32
|
-
setValue(name, [...values, addValue]);
|
33
|
-
} else {
|
34
|
-
setValue(name, [addValue]);
|
35
|
-
}
|
36
|
-
setAddValue('');
|
37
|
-
};
|
38
|
-
|
39
|
-
return (
|
40
|
-
<Grid item sm={12}>
|
41
|
-
<div className={classes.restrictedValuesContainer}>
|
42
|
-
{values && values.length
|
43
|
-
? values.map((value) => <Chip key={value} label={value} onDelete={() => handleDelete(value)} />)
|
44
|
-
: null}
|
45
|
-
</div>
|
46
|
-
<div className={classes.restrictedValuesContainer}>
|
47
|
-
<TextField
|
48
|
-
fullWidth
|
49
|
-
variant="outlined"
|
50
|
-
size="small"
|
51
|
-
label="Restricted value"
|
52
|
-
value={addValue}
|
53
|
-
onChange={handleAddValueChange}
|
54
|
-
/>
|
55
|
-
<Button variant="contained" size="small" color="primary" onClick={handleAdd}>
|
56
|
-
Add
|
57
|
-
</Button>
|
58
|
-
</div>
|
59
|
-
</Grid>
|
60
|
-
);
|
61
|
-
};
|
62
|
-
|
63
|
-
export default RestrictedValuesEditor;
|
@@ -1,156 +0,0 @@
|
|
1
|
-
import Grid from '@material-ui/core/Grid';
|
2
|
-
import TextField from '@material-ui/core/TextField';
|
3
|
-
import MenuItem from '@material-ui/core/MenuItem';
|
4
|
-
import Typography from '@material-ui/core/Typography';
|
5
|
-
|
6
|
-
import { useEffect, useState } from 'react';
|
7
|
-
import { useController, useFormContext } from 'react-hook-form';
|
8
|
-
import { validateJson } from '../../../utils';
|
9
|
-
import useStyles from '../styles';
|
10
|
-
|
11
|
-
import { PropertyUnion } from '../../../interfaces';
|
12
|
-
import { DemFieldWidget } from '../widgets';
|
13
|
-
|
14
|
-
type Props = {
|
15
|
-
name: string;
|
16
|
-
label: string;
|
17
|
-
property: PropertyUnion;
|
18
|
-
};
|
19
|
-
|
20
|
-
const defaultFillOptions = [
|
21
|
-
{ value: 'expression', label: 'Expression' },
|
22
|
-
{ value: 'widget', label: 'Widget' },
|
23
|
-
];
|
24
|
-
|
25
|
-
export const SingleDemField = ({ property, name, label }: Props) => {
|
26
|
-
const classes = useStyles();
|
27
|
-
const { setValue, getValues, setError, clearErrors, control } = useFormContext();
|
28
|
-
const {
|
29
|
-
fieldState: { error },
|
30
|
-
} = useController({
|
31
|
-
name,
|
32
|
-
control,
|
33
|
-
});
|
34
|
-
|
35
|
-
const [fillOptions, setFillOptions] = useState(defaultFillOptions);
|
36
|
-
const [selectedFillOption, setSelectedFillOption] = useState(null);
|
37
|
-
const [expression, setExpression] = useState('');
|
38
|
-
const [fieldValue, setFieldValue] = useState(null);
|
39
|
-
|
40
|
-
const handleExpressionChange = (e) => {
|
41
|
-
const { value } = e.target;
|
42
|
-
setExpression(value);
|
43
|
-
setValue(name, value);
|
44
|
-
|
45
|
-
if (property.isRequired && !value.length) {
|
46
|
-
setError(name, { type: 'custom', message: 'Please, fill this field' });
|
47
|
-
} else {
|
48
|
-
clearErrors(name);
|
49
|
-
}
|
50
|
-
};
|
51
|
-
|
52
|
-
const handleFillOptionChange = (e) => {
|
53
|
-
setSelectedFillOption(e.target.value);
|
54
|
-
|
55
|
-
if (e.target.value === 'null') {
|
56
|
-
setValue(name, null);
|
57
|
-
}
|
58
|
-
|
59
|
-
clearErrors(name);
|
60
|
-
};
|
61
|
-
|
62
|
-
const handleValueChange = (value) => {
|
63
|
-
setFieldValue(value);
|
64
|
-
setValue(name, value);
|
65
|
-
|
66
|
-
if (property.isRequired && !(value + '').length) {
|
67
|
-
setError(name, { type: 'custom', message: 'Please, fill this field' });
|
68
|
-
} else if (property.propertyType === 'JSON' && !validateJson(value)) {
|
69
|
-
setError(name, { type: 'custom', message: 'Not valid JSON' });
|
70
|
-
} else {
|
71
|
-
clearErrors(name);
|
72
|
-
}
|
73
|
-
};
|
74
|
-
|
75
|
-
useEffect(() => {
|
76
|
-
if (property) {
|
77
|
-
if (!property.isRequired) {
|
78
|
-
setFillOptions((prevState) => [{ value: 'null', label: 'NULL' }, ...prevState]);
|
79
|
-
}
|
80
|
-
if (
|
81
|
-
property.propertyType === 'DATE' ||
|
82
|
-
property.propertyType === 'DATE_TIME' ||
|
83
|
-
property.propertyType === 'TIME'
|
84
|
-
) {
|
85
|
-
setFillOptions((prevState) => [...prevState, { value: 'string', label: 'String' }]);
|
86
|
-
}
|
87
|
-
}
|
88
|
-
}, [property]);
|
89
|
-
|
90
|
-
useEffect(() => {
|
91
|
-
const { defaultValue } = property;
|
92
|
-
let value;
|
93
|
-
if (typeof getValues(name) === 'boolean' || getValues(name)) {
|
94
|
-
value = getValues(name);
|
95
|
-
} else {
|
96
|
-
value = defaultValue;
|
97
|
-
}
|
98
|
-
|
99
|
-
if (typeof value === 'undefined' || value === null || value === 'null') {
|
100
|
-
setValue(name, null);
|
101
|
-
setSelectedFillOption('null');
|
102
|
-
} else if (value && typeof value === 'string' && value.startsWith('$')) {
|
103
|
-
setValue(name, value);
|
104
|
-
setExpression(value);
|
105
|
-
setSelectedFillOption('expression');
|
106
|
-
} else {
|
107
|
-
setValue(name, value);
|
108
|
-
setFieldValue(value);
|
109
|
-
setSelectedFillOption('widget');
|
110
|
-
}
|
111
|
-
}, [property, name]);
|
112
|
-
|
113
|
-
return (
|
114
|
-
<Grid container spacing={2}>
|
115
|
-
<Grid item sm={12}>
|
116
|
-
<Typography className={classes.inputParameterTitle}>{label}</Typography>
|
117
|
-
</Grid>
|
118
|
-
<Grid item sm={12}>
|
119
|
-
<TextField
|
120
|
-
select
|
121
|
-
fullWidth
|
122
|
-
variant="outlined"
|
123
|
-
size="small"
|
124
|
-
value={selectedFillOption}
|
125
|
-
onChange={handleFillOptionChange}
|
126
|
-
>
|
127
|
-
{fillOptions.map((option) => (
|
128
|
-
<MenuItem key={option.value} value={option.value}>
|
129
|
-
{option.label}
|
130
|
-
</MenuItem>
|
131
|
-
))}
|
132
|
-
</TextField>
|
133
|
-
</Grid>
|
134
|
-
{selectedFillOption === 'expression' && (
|
135
|
-
<Grid item sm={12}>
|
136
|
-
<TextField
|
137
|
-
fullWidth
|
138
|
-
variant="outlined"
|
139
|
-
size="small"
|
140
|
-
label="Expression"
|
141
|
-
value={expression}
|
142
|
-
onChange={handleExpressionChange}
|
143
|
-
/>
|
144
|
-
</Grid>
|
145
|
-
)}
|
146
|
-
{selectedFillOption === 'widget' && (
|
147
|
-
<DemFieldWidget property={property} name={name} value={fieldValue} onChange={handleValueChange} />
|
148
|
-
)}
|
149
|
-
<Grid item sm={12}>
|
150
|
-
<Typography color="secondary">{error?.message}</Typography>
|
151
|
-
</Grid>
|
152
|
-
</Grid>
|
153
|
-
);
|
154
|
-
};
|
155
|
-
|
156
|
-
export default SingleDemField;
|
@@ -1,50 +0,0 @@
|
|
1
|
-
import { makeStyles } from '@material-ui/core/styles';
|
2
|
-
|
3
|
-
export default makeStyles((theme) => ({
|
4
|
-
editor: {
|
5
|
-
position: 'relative',
|
6
|
-
},
|
7
|
-
editorDisabled: {
|
8
|
-
opacity: 0.6,
|
9
|
-
'&:before': {
|
10
|
-
content: '""',
|
11
|
-
display: 'block',
|
12
|
-
position: 'absolute',
|
13
|
-
top: 0,
|
14
|
-
left: 0,
|
15
|
-
width: '100%',
|
16
|
-
height: '100%',
|
17
|
-
zIndex: 5,
|
18
|
-
},
|
19
|
-
},
|
20
|
-
editorCopy: {
|
21
|
-
position: 'absolute',
|
22
|
-
top: 0,
|
23
|
-
right: -53,
|
24
|
-
zIndex: 2,
|
25
|
-
},
|
26
|
-
inputParameterTitle: {
|
27
|
-
fontWeight: 600,
|
28
|
-
},
|
29
|
-
multipleValueTitle: {
|
30
|
-
display: 'flex',
|
31
|
-
justifyContent: 'space-between',
|
32
|
-
},
|
33
|
-
multipleValueContainer: {
|
34
|
-
'&:hover': {
|
35
|
-
backgroundColor: '#f7f7f7',
|
36
|
-
},
|
37
|
-
},
|
38
|
-
restrictedValuesContainer: {
|
39
|
-
width: '100%',
|
40
|
-
display: 'flex',
|
41
|
-
marginBottom: '8px',
|
42
|
-
'& > * ': {
|
43
|
-
marginRight: '4px',
|
44
|
-
|
45
|
-
'&::last-child': {
|
46
|
-
marginRight: 0,
|
47
|
-
},
|
48
|
-
},
|
49
|
-
},
|
50
|
-
}));
|
@@ -1,26 +0,0 @@
|
|
1
|
-
import Grid from '@material-ui/core/Grid';
|
2
|
-
import FormControlLabel from '@material-ui/core/FormControlLabel';
|
3
|
-
import Switch from '@material-ui/core/Switch';
|
4
|
-
|
5
|
-
type Props = {
|
6
|
-
value: string | boolean;
|
7
|
-
onChange: (value: boolean) => void;
|
8
|
-
};
|
9
|
-
|
10
|
-
const DemBooleanWidget = ({ value, onChange }: Props) => {
|
11
|
-
const handleChange = (e) => {
|
12
|
-
const { checked } = e.target;
|
13
|
-
onChange(checked);
|
14
|
-
};
|
15
|
-
|
16
|
-
return (
|
17
|
-
<Grid item sm={12}>
|
18
|
-
<FormControlLabel
|
19
|
-
label={!!value + ''}
|
20
|
-
control={<Switch color="primary" size="small" onChange={handleChange} checked={!!value + '' === 'true'} />}
|
21
|
-
/>
|
22
|
-
</Grid>
|
23
|
-
);
|
24
|
-
};
|
25
|
-
|
26
|
-
export default DemBooleanWidget;
|
@@ -1,34 +0,0 @@
|
|
1
|
-
import Grid from '@material-ui/core/Grid';
|
2
|
-
import TextField from '@mui/material/TextField';
|
3
|
-
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
|
4
|
-
|
5
|
-
import { format } from 'date-fns';
|
6
|
-
import { getDemPropertyDateFormat } from '../../../utils';
|
7
|
-
import { DateTimeProperty } from '../../../interfaces';
|
8
|
-
|
9
|
-
type Props = {
|
10
|
-
property: DateTimeProperty;
|
11
|
-
value: string;
|
12
|
-
onChange: (value: string) => void;
|
13
|
-
};
|
14
|
-
|
15
|
-
const DemDateTimeWidget = ({ property, value, onChange }: Props) => {
|
16
|
-
const handleChange = (date) => {
|
17
|
-
onChange(format(date, getDemPropertyDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX", property.format)));
|
18
|
-
};
|
19
|
-
|
20
|
-
return (
|
21
|
-
<Grid item sm={12}>
|
22
|
-
<DateTimePicker
|
23
|
-
clearable
|
24
|
-
ampm={false}
|
25
|
-
value={value || null}
|
26
|
-
onChange={handleChange}
|
27
|
-
inputFormat={getDemPropertyDateFormat('yyyy-MM-dd HH:mm', property.format)}
|
28
|
-
renderInput={(props) => <TextField {...props} fullWidth variant="outlined" size="small" />}
|
29
|
-
/>
|
30
|
-
</Grid>
|
31
|
-
);
|
32
|
-
};
|
33
|
-
|
34
|
-
export default DemDateTimeWidget;
|
@@ -1,33 +0,0 @@
|
|
1
|
-
import Grid from '@material-ui/core/Grid';
|
2
|
-
import TextField from '@mui/material/TextField';
|
3
|
-
import { DatePicker } from '@mui/x-date-pickers/DatePicker';
|
4
|
-
|
5
|
-
import { format } from 'date-fns';
|
6
|
-
import { getDemPropertyDateFormat } from '../../../utils';
|
7
|
-
import { DateProperty } from '../../../interfaces';
|
8
|
-
|
9
|
-
type Props = {
|
10
|
-
property: DateProperty;
|
11
|
-
value: string;
|
12
|
-
onChange: (value: string) => void;
|
13
|
-
};
|
14
|
-
|
15
|
-
const DemDateWidget = ({ property, value, onChange }: Props) => {
|
16
|
-
const handleChange = (date) => {
|
17
|
-
onChange(format(date, getDemPropertyDateFormat('yyyy-MM-dd', property.format)));
|
18
|
-
};
|
19
|
-
|
20
|
-
return (
|
21
|
-
<Grid item sm={12}>
|
22
|
-
<DatePicker
|
23
|
-
clearable
|
24
|
-
onChange={handleChange}
|
25
|
-
value={value || null}
|
26
|
-
inputFormat={getDemPropertyDateFormat('yyyy-MM-dd', property.format)}
|
27
|
-
renderInput={(props) => <TextField {...props} fullWidth variant="outlined" size="small" />}
|
28
|
-
/>
|
29
|
-
</Grid>
|
30
|
-
);
|
31
|
-
};
|
32
|
-
|
33
|
-
export default DemDateWidget;
|
@@ -1,67 +0,0 @@
|
|
1
|
-
import DemBooleanWidget from './DemBooleanWidget';
|
2
|
-
import DemJsonWidget from './DemJsonWidget';
|
3
|
-
import DemStringWidget from './DemStringWidget';
|
4
|
-
import DemDateWidget from './DemDateWidget';
|
5
|
-
import DemDateTimeWidget from './DemDateTimeWidget';
|
6
|
-
import DemTimeWidget from './DemTimeWidget';
|
7
|
-
import DemFloatWidget from './DemFloatWidget';
|
8
|
-
|
9
|
-
import {
|
10
|
-
BigIntegerProperty,
|
11
|
-
DateProperty,
|
12
|
-
DateTimeProperty,
|
13
|
-
FloatProperty,
|
14
|
-
StringProperty,
|
15
|
-
IntegerProperty,
|
16
|
-
LongProperty,
|
17
|
-
TimeProperty,
|
18
|
-
PropertyUnion,
|
19
|
-
PropertyType,
|
20
|
-
} from '../../../interfaces';
|
21
|
-
import DemIntegerWidget from './DemIntegerWidget';
|
22
|
-
|
23
|
-
type Props = {
|
24
|
-
property: PropertyUnion;
|
25
|
-
label?: string;
|
26
|
-
value: string;
|
27
|
-
name: string;
|
28
|
-
onChange: (value) => void;
|
29
|
-
};
|
30
|
-
|
31
|
-
export const DemFieldWidget = ({ property, value, name, label, onChange }: Props) => {
|
32
|
-
switch (property?.propertyType) {
|
33
|
-
case PropertyType.DATE:
|
34
|
-
return <DemDateWidget property={property as DateProperty} value={value} onChange={onChange} />;
|
35
|
-
case PropertyType.DATE_TIME:
|
36
|
-
return <DemDateTimeWidget property={property as DateTimeProperty} value={value} onChange={onChange} />;
|
37
|
-
case PropertyType.TIME: {
|
38
|
-
return <DemTimeWidget property={property as TimeProperty} value={value} onChange={onChange} />;
|
39
|
-
}
|
40
|
-
case PropertyType.BIG_INTEGER:
|
41
|
-
return (
|
42
|
-
<DemIntegerWidget property={property as BigIntegerProperty} value={value} name={name} onChange={onChange} />
|
43
|
-
);
|
44
|
-
case PropertyType.LONG:
|
45
|
-
return <DemIntegerWidget property={property as LongProperty} value={value} name={name} onChange={onChange} />;
|
46
|
-
case PropertyType.INTEGER:
|
47
|
-
return <DemIntegerWidget property={property as IntegerProperty} value={value} name={name} onChange={onChange} />;
|
48
|
-
case PropertyType.BIG_DECIMAL:
|
49
|
-
case PropertyType.DOUBLE:
|
50
|
-
case PropertyType.FLOAT:
|
51
|
-
return <DemFloatWidget property={property as FloatProperty} value={value} name={name} onChange={onChange} />;
|
52
|
-
case PropertyType.STRING:
|
53
|
-
return <DemStringWidget property={property as StringProperty} value={value} onChange={onChange} label={label} />;
|
54
|
-
case PropertyType.BOOLEAN:
|
55
|
-
return <DemBooleanWidget value={value} onChange={onChange} />;
|
56
|
-
case PropertyType.JSON:
|
57
|
-
return <DemJsonWidget value={value} onChange={onChange} />;
|
58
|
-
case PropertyType.ENTITY:
|
59
|
-
return null;
|
60
|
-
case PropertyType.ENTITY_REFERENCE:
|
61
|
-
return null;
|
62
|
-
default:
|
63
|
-
return <DemStringWidget property={property as StringProperty} value={value} onChange={onChange} label={label} />;
|
64
|
-
}
|
65
|
-
};
|
66
|
-
|
67
|
-
export default DemFieldWidget;
|
@@ -1,49 +0,0 @@
|
|
1
|
-
import Grid from '@material-ui/core/Grid';
|
2
|
-
import TextField from '@material-ui/core/TextField';
|
3
|
-
|
4
|
-
import { useController, useFormContext } from 'react-hook-form';
|
5
|
-
import { validateFloat } from '../../../utils';
|
6
|
-
import { FloatProperty } from '../../../interfaces';
|
7
|
-
|
8
|
-
type Props = {
|
9
|
-
property: FloatProperty;
|
10
|
-
value: string;
|
11
|
-
name: string;
|
12
|
-
onChange: (value: string) => void;
|
13
|
-
};
|
14
|
-
|
15
|
-
const DemFloatWidget = ({ property, value, name, onChange }: Props) => {
|
16
|
-
const { setError, clearErrors, control } = useFormContext();
|
17
|
-
const fieldController = useController({
|
18
|
-
name,
|
19
|
-
control,
|
20
|
-
rules: {
|
21
|
-
validate: (value) => {
|
22
|
-
return validateFloat(value + '').message;
|
23
|
-
},
|
24
|
-
},
|
25
|
-
});
|
26
|
-
|
27
|
-
const handleChange = (e) => {
|
28
|
-
const { value: inputValue } = e.target;
|
29
|
-
const { valid, continuable, message, displayOnChange } = validateFloat(inputValue);
|
30
|
-
|
31
|
-
if (valid || continuable) {
|
32
|
-
onChange(inputValue);
|
33
|
-
}
|
34
|
-
|
35
|
-
if (!valid && displayOnChange) {
|
36
|
-
setError(name, { type: 'custom', message });
|
37
|
-
} else {
|
38
|
-
clearErrors(name);
|
39
|
-
}
|
40
|
-
};
|
41
|
-
|
42
|
-
return (
|
43
|
-
<Grid item sm={12}>
|
44
|
-
<TextField fullWidth variant="outlined" size="small" value={value} onChange={handleChange} />
|
45
|
-
</Grid>
|
46
|
-
);
|
47
|
-
};
|
48
|
-
|
49
|
-
export default DemFloatWidget;
|
@@ -1,63 +0,0 @@
|
|
1
|
-
import Grid from '@material-ui/core/Grid';
|
2
|
-
import TextField from '@material-ui/core/TextField';
|
3
|
-
|
4
|
-
import { useController, useFormContext } from 'react-hook-form';
|
5
|
-
import { validateInteger } from '../../../utils';
|
6
|
-
import { BigIntegerProperty, IntegerProperty, LongProperty } from '../../../interfaces';
|
7
|
-
|
8
|
-
type Props = {
|
9
|
-
property: IntegerProperty | BigIntegerProperty | LongProperty;
|
10
|
-
value: string;
|
11
|
-
name: string;
|
12
|
-
onChange: (value: string) => void;
|
13
|
-
};
|
14
|
-
|
15
|
-
const DemIntegerWidget = ({ property, value, name, onChange }: Props) => {
|
16
|
-
const { setError, clearErrors, control } = useFormContext();
|
17
|
-
const { fieldState: error } = useController({
|
18
|
-
name,
|
19
|
-
control,
|
20
|
-
rules: {
|
21
|
-
validate: (value) => {
|
22
|
-
return validateInteger(value + '', property.propertyType).message;
|
23
|
-
},
|
24
|
-
},
|
25
|
-
});
|
26
|
-
|
27
|
-
const handleChange = (e) => {
|
28
|
-
let { value: inputValue } = e.target;
|
29
|
-
|
30
|
-
if (inputValue.length >= 2 && inputValue.startsWith('0')) {
|
31
|
-
inputValue = inputValue.slice(1);
|
32
|
-
}
|
33
|
-
|
34
|
-
if (inputValue.length >= 2 && inputValue.startsWith('-') && inputValue[1] === '0') {
|
35
|
-
inputValue = inputValue.slice(0, 1) + inputValue.slice(2);
|
36
|
-
}
|
37
|
-
|
38
|
-
if (!inputValue || (inputValue.length < 2 && inputValue[0] === '-')) {
|
39
|
-
onChange(inputValue);
|
40
|
-
return;
|
41
|
-
}
|
42
|
-
|
43
|
-
const { valid, continuable, message } = validateInteger(inputValue, property.propertyType);
|
44
|
-
|
45
|
-
if (valid || continuable) {
|
46
|
-
onChange(inputValue);
|
47
|
-
}
|
48
|
-
|
49
|
-
if (!valid) {
|
50
|
-
setError(name, { type: 'custom', message });
|
51
|
-
} else {
|
52
|
-
clearErrors(name);
|
53
|
-
}
|
54
|
-
};
|
55
|
-
|
56
|
-
return (
|
57
|
-
<Grid item sm={12}>
|
58
|
-
<TextField fullWidth variant="outlined" size="small" value={value} onChange={handleChange} />
|
59
|
-
</Grid>
|
60
|
-
);
|
61
|
-
};
|
62
|
-
|
63
|
-
export default DemIntegerWidget;
|
@@ -1,33 +0,0 @@
|
|
1
|
-
import Grid from '@material-ui/core/Grid';
|
2
|
-
import AceEditor from 'react-ace';
|
3
|
-
|
4
|
-
import 'ace-builds/src-noconflict/ace';
|
5
|
-
import 'ace-builds/src-noconflict/mode-json';
|
6
|
-
|
7
|
-
type Props = {
|
8
|
-
value: string;
|
9
|
-
onChange: (value: string) => void;
|
10
|
-
};
|
11
|
-
|
12
|
-
const DemJsonWidget = ({ value, onChange }: Props) => {
|
13
|
-
return (
|
14
|
-
<Grid item sm={12}>
|
15
|
-
<AceEditor
|
16
|
-
value={value}
|
17
|
-
onChange={onChange}
|
18
|
-
mode="json"
|
19
|
-
width="100%"
|
20
|
-
height="200px"
|
21
|
-
fontSize="16"
|
22
|
-
setOptions={{
|
23
|
-
enableSnippets: false,
|
24
|
-
copyWithEmptySelection: true,
|
25
|
-
showLineNumbers: true,
|
26
|
-
tabSize: 2,
|
27
|
-
}}
|
28
|
-
/>
|
29
|
-
</Grid>
|
30
|
-
);
|
31
|
-
};
|
32
|
-
|
33
|
-
export default DemJsonWidget;
|
@@ -1,35 +0,0 @@
|
|
1
|
-
import Grid from '@material-ui/core/Grid';
|
2
|
-
import TextField from '@material-ui/core/TextField';
|
3
|
-
import MenuItem from '@material-ui/core/MenuItem';
|
4
|
-
|
5
|
-
import { StringProperty } from '../../../interfaces';
|
6
|
-
|
7
|
-
type Props = {
|
8
|
-
property: StringProperty;
|
9
|
-
label?: string;
|
10
|
-
value: string;
|
11
|
-
onChange: (value: string) => void;
|
12
|
-
};
|
13
|
-
|
14
|
-
export const DemStringWidget = ({ property, label, value, onChange }: Props) => {
|
15
|
-
const handleChange = (e) => {
|
16
|
-
onChange(e.target.value);
|
17
|
-
};
|
18
|
-
return (
|
19
|
-
<Grid item sm={12}>
|
20
|
-
{property?.restrictedValues?.length ? (
|
21
|
-
<TextField select fullWidth variant="outlined" size="small" value={value} onChange={handleChange}>
|
22
|
-
{property.restrictedValues.map((restrictedValue) => (
|
23
|
-
<MenuItem key={restrictedValue} value={restrictedValue}>
|
24
|
-
{restrictedValue}
|
25
|
-
</MenuItem>
|
26
|
-
))}
|
27
|
-
</TextField>
|
28
|
-
) : (
|
29
|
-
<TextField fullWidth variant="outlined" size="small" label={label} value={value} onChange={handleChange} />
|
30
|
-
)}
|
31
|
-
</Grid>
|
32
|
-
);
|
33
|
-
};
|
34
|
-
|
35
|
-
export default DemStringWidget;
|
@@ -1,46 +0,0 @@
|
|
1
|
-
import Grid from '@material-ui/core/Grid';
|
2
|
-
import TextField from '@mui/material/TextField';
|
3
|
-
import { TimePicker } from '@mui/x-date-pickers/TimePicker';
|
4
|
-
|
5
|
-
import { useEffect, useState } from 'react';
|
6
|
-
import { format, parse } from 'date-fns';
|
7
|
-
import { getDemPropertyDateFormat } from '../../../utils';
|
8
|
-
import { TimeProperty } from '../../../interfaces';
|
9
|
-
|
10
|
-
type Props = {
|
11
|
-
property: TimeProperty;
|
12
|
-
value: string;
|
13
|
-
onChange: (value: string) => void;
|
14
|
-
};
|
15
|
-
|
16
|
-
const timeFormat = 'HH:mm:ss.SSS';
|
17
|
-
|
18
|
-
const DemTimeWidget = ({ property, value, onChange }: Props) => {
|
19
|
-
const [localTime, setLocalTime] = useState<Date>(null);
|
20
|
-
|
21
|
-
const handleChange = (date) => {
|
22
|
-
setLocalTime(date);
|
23
|
-
onChange(format(date, getDemPropertyDateFormat(timeFormat, property.format)));
|
24
|
-
};
|
25
|
-
|
26
|
-
useEffect(() => {
|
27
|
-
if (value && !localTime) {
|
28
|
-
setLocalTime(parse(value, timeFormat, new Date()));
|
29
|
-
}
|
30
|
-
}, [value, localTime]);
|
31
|
-
|
32
|
-
return (
|
33
|
-
<Grid item sm={12}>
|
34
|
-
<TimePicker
|
35
|
-
clearable
|
36
|
-
ampm={false}
|
37
|
-
value={localTime}
|
38
|
-
onChange={handleChange}
|
39
|
-
inputFormat={getDemPropertyDateFormat(timeFormat, property.format)}
|
40
|
-
renderInput={(props) => <TextField {...props} fullWidth variant="outlined" size="small" />}
|
41
|
-
/>
|
42
|
-
</Grid>
|
43
|
-
);
|
44
|
-
};
|
45
|
-
|
46
|
-
export default DemTimeWidget;
|