@dartech/arsenal-ui 1.2.5 → 1.2.7
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} +5 -5
- package/index.js +1 -0
- package/package.json +12 -3
- package/src/consts/index.d.ts +12 -0
- package/src/interfaces/common.d.ts +17 -0
- package/src/interfaces/definition.d.ts +107 -0
- package/src/interfaces/{index.ts → index.d.ts} +3 -3
- package/src/interfaces/ui.d.ts +70 -0
- package/src/lib/Alert/Alert.d.ts +53 -0
- package/src/lib/Alert/index.d.ts +1 -0
- package/src/lib/Breadcrumbs/Breadcrumbs.d.ts +9 -0
- package/src/lib/Breadcrumbs/Breadcrumbs.styled.d.ts +2 -0
- package/src/lib/Breadcrumbs/{index.ts → index.d.ts} +1 -1
- package/src/lib/ContentLayout/ContentLayout.d.ts +9 -0
- package/src/lib/ContentLayout/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 +10 -0
- package/src/lib/Definition/DefinitionFiller/{index.ts → index.d.ts} +1 -1
- package/src/lib/Definition/DefinitionValueView/DefinitionValueView.d.ts +8 -0
- package/src/lib/Definition/DefinitionValueView/PropertyDataView.d.ts +9 -0
- package/src/lib/Definition/DefinitionValueView/{index.ts → index.d.ts} +1 -1
- package/src/lib/Definition/{index.ts → index.d.ts} +3 -3
- package/src/lib/Forms/BackButton.d.ts +7 -0
- package/src/lib/Forms/ControlAceEditor.d.ts +24 -0
- package/src/lib/Forms/ControlAutocomplete.d.ts +69 -0
- package/src/lib/Forms/ControlCheckbox.d.ts +51 -0
- package/src/lib/Forms/ControlDate.d.ts +18 -0
- package/src/lib/Forms/ControlDateTime.d.ts +18 -0
- package/src/lib/Forms/ControlDebouncedInput.d.ts +4 -0
- package/src/lib/Forms/ControlInput.d.ts +59 -0
- package/src/lib/Forms/ControlNumberInput.d.ts +51 -0
- package/src/lib/Forms/ControlQueryAutocomplete.d.ts +16 -0
- package/src/lib/Forms/ControlRadio.d.ts +66 -0
- package/src/lib/Forms/ControlSelect.d.ts +67 -0
- package/src/lib/Forms/ControlSwitch.d.ts +19 -0
- package/src/lib/Forms/ControlTime.d.ts +18 -0
- package/src/lib/Forms/CopyButton.d.ts +20 -0
- package/src/lib/Forms/{index.ts → index.d.ts} +15 -15
- package/src/lib/Forms/useAutocomplete.d.ts +10 -0
- 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 +12 -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 +7 -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/PropertyFiller/JsonEditor.d.ts +10 -0
- package/src/lib/Property/PropertyFiller/MultiplePropertyFiller.d.ts +12 -0
- package/src/lib/Property/PropertyFiller/MultiplePropertyWidget.d.ts +11 -0
- package/src/lib/Property/PropertyFiller/PropertyFiller.d.ts +12 -0
- package/src/lib/Property/PropertyFiller/{index.ts → index.d.ts} +2 -2
- package/src/lib/Property/PropertyFiller/usePropertyFiller.d.ts +24 -0
- package/src/lib/Property/PropertyFiller/useStyles.d.ts +12 -0
- package/src/lib/Property/PropertyValidator/NodeValidator.d.ts +6 -0
- package/src/lib/Property/PropertyValidator/NodesList.d.ts +6 -0
- package/src/lib/Property/PropertyValidator/NumericTypeValidator.d.ts +8 -0
- package/src/lib/Property/PropertyValidator/PropertyValidator.d.ts +6 -0
- package/src/lib/Property/PropertyValidator/PropertyValidatorContext.d.ts +3 -0
- package/src/lib/Property/PropertyValidator/StringTypeValidator.d.ts +8 -0
- package/src/lib/Property/PropertyValidator/ValidationNodeSelector.d.ts +7 -0
- package/src/lib/Property/PropertyValidator/index.d.ts +1 -0
- 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/JsonValueField.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/{index.ts → index.d.ts} +1 -1
- package/src/lib/Property/PropertyWidget/PropertyWidget.d.ts +13 -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 +7 -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} +5 -5
- package/src/lib/Sidebar/Sidebar.d.ts +10 -0
- package/src/lib/Sidebar/Sidebar.styled.d.ts +117 -0
- package/src/lib/Sidebar/SidebarContext.d.ts +11 -0
- package/src/lib/Sidebar/SidebarDrawer.d.ts +9 -0
- package/src/lib/Sidebar/SidebarLink/MenuIcon.d.ts +7 -0
- package/src/lib/Sidebar/SidebarLink/SidebarLink.d.ts +7 -0
- package/src/lib/Sidebar/SidebarLink/SidebarLinkItem.d.ts +8 -0
- package/src/lib/Sidebar/SidebarLink/SidebarNestedItem.d.ts +10 -0
- package/src/lib/Sidebar/SidebarLink/{index.ts → index.d.ts} +2 -2
- package/src/lib/Sidebar/index.d.ts +2 -0
- package/src/lib/Status/Status.d.ts +8 -0
- package/src/lib/Status/{index.ts → index.d.ts} +1 -1
- package/src/lib/Status/styles.d.ts +12 -0
- package/src/lib/StepperView/StepperView.d.ts +11 -0
- package/src/lib/StepperView/{index.ts → index.d.ts} +1 -1
- package/src/lib/Table/DataGrid/JsonTypeCell.d.ts +7 -0
- package/src/lib/Table/DataGrid/Table.d.ts +49 -0
- package/src/lib/Table/DataGrid/TableAction.d.ts +13 -0
- package/src/lib/Table/DataGrid/TableColumnMenu.d.ts +3 -0
- package/src/lib/Table/DataGrid/TablePagination.d.ts +3 -0
- package/src/lib/Table/DataGrid/index.d.ts +2 -0
- package/src/lib/Table/DataGrid/styles.d.ts +12 -0
- package/src/lib/Table/DataGrid/usePagination.d.ts +5 -0
- package/src/lib/Table/DataGrid/useTableQueryPagination.d.ts +11 -0
- package/src/lib/Table/DataGrid/useTableQuerySorting.d.ts +6 -0
- package/src/lib/Table/SimpleTable/SimpleTable.d.ts +17 -0
- package/src/lib/Table/SimpleTable/TableActionCell.d.ts +10 -0
- package/src/lib/Table/SimpleTable/index.d.ts +2 -0
- package/src/lib/Table/SimpleTable/useTablePagination.d.ts +7 -0
- package/src/lib/Table/SimpleTable/useTableSorting.d.ts +6 -0
- package/src/lib/Table/index.d.ts +2 -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/{index.ts → index.d.ts} +16 -16
- package/src/theme/baseTheme.d.ts +2 -0
- package/src/theme/index.d.ts +1 -0
- package/src/theme/inputThemeOptions.d.ts +117 -0
- package/src/theme/stepperThemeOptions.d.ts +16 -0
- package/src/theme/tableThemeOptions.d.ts +47 -0
- package/src/theme/typographyThemeOptions.d.ts +29 -0
- package/src/utils/common.d.ts +7 -0
- package/src/utils/dem.d.ts +27 -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 +14 -0
- package/src/utils/validators.d.ts +5 -0
- package/.babelrc +0 -13
- package/.eslintrc.json +0 -22
- package/jest.config.ts +0 -11
- package/project.json +0 -94
- package/rollup.config.js +0 -146
- package/src/assets/chevron_left_gray.svg +0 -3
- package/src/consts/index.ts +0 -13
- package/src/interfaces/common.ts +0 -18
- package/src/interfaces/definition.ts +0 -143
- package/src/interfaces/ui.ts +0 -80
- package/src/lib/Alert/Alert.tsx +0 -108
- package/src/lib/Alert/index.ts +0 -1
- package/src/lib/Breadcrumbs/Breadcrumbs.styled.tsx +0 -16
- package/src/lib/Breadcrumbs/Breadcrumbs.tsx +0 -40
- package/src/lib/ContentLayout/ContentLayout.tsx +0 -31
- package/src/lib/ContentLayout/index.ts +0 -1
- package/src/lib/Definition/CreateDefinition/CreateDefinition.tsx +0 -78
- package/src/lib/Definition/DefinitionFiller/DefinitionFiller.tsx +0 -71
- package/src/lib/Definition/DefinitionValueView/DefinitionValueView.tsx +0 -54
- package/src/lib/Definition/DefinitionValueView/PropertyDataView.tsx +0 -67
- package/src/lib/Forms/BackButton.tsx +0 -46
- package/src/lib/Forms/ControlAceEditor.tsx +0 -125
- package/src/lib/Forms/ControlAutocomplete.tsx +0 -145
- package/src/lib/Forms/ControlCheckbox.tsx +0 -113
- package/src/lib/Forms/ControlDate.tsx +0 -75
- package/src/lib/Forms/ControlDateTime.tsx +0 -77
- package/src/lib/Forms/ControlDebouncedInput.tsx +0 -80
- package/src/lib/Forms/ControlInput.tsx +0 -111
- package/src/lib/Forms/ControlNumberInput.tsx +0 -121
- package/src/lib/Forms/ControlQueryAutocomplete.tsx +0 -197
- package/src/lib/Forms/ControlRadio.tsx +0 -136
- package/src/lib/Forms/ControlSelect.tsx +0 -164
- package/src/lib/Forms/ControlSwitch.tsx +0 -71
- package/src/lib/Forms/ControlTime.tsx +0 -93
- package/src/lib/Forms/CopyButton.tsx +0 -46
- package/src/lib/Forms/useAutocomplete.tsx +0 -47
- package/src/lib/InfoItem/InfoItem.tsx +0 -40
- package/src/lib/InfoItem/styles.ts +0 -17
- package/src/lib/JsonPathPicker/JsonPathPicker.tsx +0 -73
- package/src/lib/JsonPathPicker/PropertyStep.tsx +0 -70
- package/src/lib/JsonView/JsonView.tsx +0 -41
- package/src/lib/Loader/Loader.tsx +0 -41
- package/src/lib/Modals/JsonModalView.tsx +0 -53
- package/src/lib/Property/PropertyFiller/JsonEditor.tsx +0 -58
- package/src/lib/Property/PropertyFiller/MultiplePropertyFiller.tsx +0 -129
- package/src/lib/Property/PropertyFiller/MultiplePropertyWidget.tsx +0 -85
- package/src/lib/Property/PropertyFiller/PropertyFiller.tsx +0 -199
- package/src/lib/Property/PropertyFiller/usePropertyFiller.ts +0 -72
- package/src/lib/Property/PropertyFiller/useStyles.ts +0 -12
- package/src/lib/Property/PropertyValidator/NodeValidator.tsx +0 -92
- package/src/lib/Property/PropertyValidator/NodesList.tsx +0 -26
- package/src/lib/Property/PropertyValidator/NumericTypeValidator.tsx +0 -59
- package/src/lib/Property/PropertyValidator/PropertyValidator.tsx +0 -42
- package/src/lib/Property/PropertyValidator/PropertyValidatorContext.tsx +0 -4
- package/src/lib/Property/PropertyValidator/StringTypeValidator.tsx +0 -36
- package/src/lib/Property/PropertyValidator/ValidationNodeSelector.tsx +0 -62
- package/src/lib/Property/PropertyValidator/index.ts +0 -1
- package/src/lib/Property/PropertyValueField/BooleanValueField.tsx +0 -49
- package/src/lib/Property/PropertyValueField/DateTimeValueField.tsx +0 -58
- package/src/lib/Property/PropertyValueField/DateValueField.tsx +0 -58
- package/src/lib/Property/PropertyValueField/JsonValueField.tsx +0 -65
- package/src/lib/Property/PropertyValueField/PropertyValueField.tsx +0 -49
- package/src/lib/Property/PropertyValueField/StringValueField.tsx +0 -50
- package/src/lib/Property/PropertyValueField/TimeValueField.tsx +0 -67
- package/src/lib/Property/PropertyWidget/PropertyWidget.tsx +0 -115
- package/src/lib/Property/UpsertProperty/CreatePropertiesList.tsx +0 -148
- package/src/lib/Property/UpsertProperty/CreatePropertyFormFields.tsx +0 -158
- 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 -103
- package/src/lib/Property/UpsertProperty/useCustomFields.ts +0 -22
- package/src/lib/Property/ViewPropertiesList/ViewPropertiesList.tsx +0 -37
- package/src/lib/Property/ViewProperty/EntityPropertiesShortView.tsx +0 -40
- package/src/lib/Property/ViewProperty/EntityPropertiesView.tsx +0 -48
- package/src/lib/Property/ViewProperty/PropertyDataTable.tsx +0 -148
- package/src/lib/Property/ViewProperty/PropertyItem.tsx +0 -43
- package/src/lib/Property/ViewProperty/ViewProperty.tsx +0 -52
- package/src/lib/Sidebar/Sidebar.styled.tsx +0 -157
- package/src/lib/Sidebar/Sidebar.tsx +0 -27
- package/src/lib/Sidebar/SidebarContext.tsx +0 -37
- package/src/lib/Sidebar/SidebarDrawer.tsx +0 -50
- package/src/lib/Sidebar/SidebarLink/MenuIcon.tsx +0 -16
- package/src/lib/Sidebar/SidebarLink/SidebarLink.tsx +0 -54
- package/src/lib/Sidebar/SidebarLink/SidebarLinkItem.tsx +0 -54
- package/src/lib/Sidebar/SidebarLink/SidebarNestedItem.tsx +0 -62
- package/src/lib/Sidebar/index.ts +0 -2
- package/src/lib/Status/Status.tsx +0 -16
- package/src/lib/Status/styles.ts +0 -21
- package/src/lib/StepperView/StepperView.tsx +0 -73
- package/src/lib/Table/DataGrid/JsonTypeCell.tsx +0 -51
- package/src/lib/Table/DataGrid/Table.tsx +0 -117
- package/src/lib/Table/DataGrid/TableAction.tsx +0 -43
- package/src/lib/Table/DataGrid/TableColumnMenu.tsx +0 -12
- package/src/lib/Table/DataGrid/TablePagination.tsx +0 -42
- package/src/lib/Table/DataGrid/index.ts +0 -2
- package/src/lib/Table/DataGrid/styles.ts +0 -59
- package/src/lib/Table/DataGrid/usePagination.ts +0 -15
- package/src/lib/Table/DataGrid/useTableQueryPagination.ts +0 -47
- package/src/lib/Table/DataGrid/useTableQuerySorting.ts +0 -47
- package/src/lib/Table/SimpleTable/SimpleTable.tsx +0 -138
- package/src/lib/Table/SimpleTable/TableActionCell.tsx +0 -67
- package/src/lib/Table/SimpleTable/index.ts +0 -2
- package/src/lib/Table/SimpleTable/useTablePagination.ts +0 -54
- package/src/lib/Table/SimpleTable/useTableSorting.ts +0 -50
- package/src/lib/Table/index.ts +0 -2
- package/src/lib/Tabs/RouteTabs.tsx +0 -54
- package/src/lib/Tabs/TabPanel.tsx +0 -42
- package/src/theme/baseTheme.ts +0 -128
- package/src/theme/fonts.d.ts +0 -2
- package/src/theme/index.ts +0 -126
- package/src/theme/inputThemeOptions.ts +0 -126
- package/src/theme/stepperThemeOptions.ts +0 -20
- package/src/theme/tableThemeOptions.ts +0 -50
- package/src/theme/typographyThemeOptions.ts +0 -32
- package/src/utils/common.ts +0 -73
- package/src/utils/dem.ts +0 -431
- package/src/utils/hooks.ts +0 -41
- package/src/utils/ui-utils.tsx +0 -102
- package/src/utils/validators.ts +0 -14
- package/tsconfig.json +0 -25
- package/tsconfig.lib.json +0 -23
- package/tsconfig.spec.json +0 -20
@@ -1,164 +0,0 @@
|
|
1
|
-
import TextField, { TextFieldProps } from '@mui/material/TextField';
|
2
|
-
import MenuItem from '@mui/material/MenuItem';
|
3
|
-
import ClearIcon from '@mui/icons-material/Clear';
|
4
|
-
|
5
|
-
import { useCallback } from 'react';
|
6
|
-
import { useController, Control, useWatch } from 'react-hook-form';
|
7
|
-
import { ValidateFunc } from '../../interfaces';
|
8
|
-
import IconButton from '@mui/material/IconButton';
|
9
|
-
import InputAdornment from '@mui/material/InputAdornment';
|
10
|
-
|
11
|
-
/**
|
12
|
-
* This interface is referencing the [[ControlSelect]] component props.
|
13
|
-
* @category Forms
|
14
|
-
*/
|
15
|
-
export type ControlSelectProps = TextFieldProps & {
|
16
|
-
/**
|
17
|
-
* React Hook Form control `name` propery
|
18
|
-
*/
|
19
|
-
name: string;
|
20
|
-
/**
|
21
|
-
* Label for MUI TextField select component
|
22
|
-
*/
|
23
|
-
label?: string;
|
24
|
-
/**
|
25
|
-
* React Hook Form `control`
|
26
|
-
*/
|
27
|
-
control: Control<any>;
|
28
|
-
/**
|
29
|
-
* Is input required flag
|
30
|
-
*/
|
31
|
-
required?: boolean;
|
32
|
-
/**
|
33
|
-
* React Hook Form `defaultValue`
|
34
|
-
*/
|
35
|
-
defaultValue?: unknown;
|
36
|
-
/**
|
37
|
-
* Is disabled input flag
|
38
|
-
*/
|
39
|
-
disabled?: boolean;
|
40
|
-
/**
|
41
|
-
* React Hook Form validate function
|
42
|
-
* ```typescript
|
43
|
-
* type ValidateFunc = (value: string) => boolean | string;
|
44
|
-
* ```
|
45
|
-
*/
|
46
|
-
validate?: ValidateFunc | Record<string, ValidateFunc>;
|
47
|
-
/**
|
48
|
-
* Hide error message flag
|
49
|
-
*/
|
50
|
-
hideErrorMessage?: boolean;
|
51
|
-
/**
|
52
|
-
* Custom onChange functionƒ
|
53
|
-
*/
|
54
|
-
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
55
|
-
/**
|
56
|
-
* Key for option label
|
57
|
-
*/
|
58
|
-
labelKey?: string;
|
59
|
-
/**
|
60
|
-
* Key for option value
|
61
|
-
*/
|
62
|
-
valueKey?: string;
|
63
|
-
/**
|
64
|
-
* Select options
|
65
|
-
*/
|
66
|
-
options: string[] | unknown[];
|
67
|
-
};
|
68
|
-
|
69
|
-
/**
|
70
|
-
* Material UI `Select` controlled component. Used with react-hook-form
|
71
|
-
* @category Forms
|
72
|
-
*/
|
73
|
-
export const ControlSelect = ({
|
74
|
-
control,
|
75
|
-
validate,
|
76
|
-
name = '',
|
77
|
-
label = '',
|
78
|
-
required = false,
|
79
|
-
defaultValue = '',
|
80
|
-
disabled = false,
|
81
|
-
hideErrorMessage = false,
|
82
|
-
onChange: customOnChange,
|
83
|
-
labelKey,
|
84
|
-
valueKey,
|
85
|
-
options = [],
|
86
|
-
...textFieldProps
|
87
|
-
}: ControlSelectProps) => {
|
88
|
-
const {
|
89
|
-
field: { ref, onChange },
|
90
|
-
fieldState: { error },
|
91
|
-
} = useController({
|
92
|
-
name,
|
93
|
-
control,
|
94
|
-
defaultValue,
|
95
|
-
rules: {
|
96
|
-
required: required && 'Please, fill this field',
|
97
|
-
validate,
|
98
|
-
},
|
99
|
-
});
|
100
|
-
const value = useWatch({ control, name });
|
101
|
-
|
102
|
-
const getValue = useCallback(
|
103
|
-
(option) => {
|
104
|
-
if (typeof option === 'string') return option;
|
105
|
-
return valueKey ? option[valueKey] : option.value;
|
106
|
-
},
|
107
|
-
[valueKey]
|
108
|
-
);
|
109
|
-
const getLabel = useCallback(
|
110
|
-
(option) => {
|
111
|
-
if (typeof option === 'string') return option;
|
112
|
-
return labelKey ? option[labelKey] : option.label;
|
113
|
-
},
|
114
|
-
[labelKey]
|
115
|
-
);
|
116
|
-
|
117
|
-
const handleClear = useCallback(() => {
|
118
|
-
if (customOnChange) {
|
119
|
-
customOnChange(null);
|
120
|
-
} else onChange(null);
|
121
|
-
}, [onChange, customOnChange]);
|
122
|
-
|
123
|
-
return (
|
124
|
-
<TextField
|
125
|
-
select
|
126
|
-
fullWidth
|
127
|
-
size="small"
|
128
|
-
variant="outlined"
|
129
|
-
type="text"
|
130
|
-
inputRef={ref}
|
131
|
-
name={name}
|
132
|
-
label={label}
|
133
|
-
error={!!error}
|
134
|
-
helperText={!hideErrorMessage && error?.message}
|
135
|
-
disabled={disabled}
|
136
|
-
value={value ?? ''}
|
137
|
-
onChange={customOnChange ? customOnChange : onChange}
|
138
|
-
{...textFieldProps}
|
139
|
-
inputProps={{
|
140
|
-
...(textFieldProps?.inputProps ?? {}),
|
141
|
-
value: value ?? '',
|
142
|
-
}}
|
143
|
-
InputProps={{
|
144
|
-
endAdornment:
|
145
|
-
!required && value ? (
|
146
|
-
<InputAdornment position="end" sx={{ mr: 2 }}>
|
147
|
-
<IconButton onClick={handleClear} size="small">
|
148
|
-
<ClearIcon fontSize="small" />
|
149
|
-
</IconButton>
|
150
|
-
</InputAdornment>
|
151
|
-
) : null,
|
152
|
-
...textFieldProps?.InputProps,
|
153
|
-
}}
|
154
|
-
>
|
155
|
-
{options.map((option, index) => (
|
156
|
-
<MenuItem key={index} value={getValue(option)}>
|
157
|
-
{getLabel(option)}
|
158
|
-
</MenuItem>
|
159
|
-
))}
|
160
|
-
</TextField>
|
161
|
-
);
|
162
|
-
};
|
163
|
-
|
164
|
-
export default ControlSelect;
|
@@ -1,71 +0,0 @@
|
|
1
|
-
import Switch, { SwitchProps } from '@mui/material/Switch';
|
2
|
-
import FormControlLabel from '@mui/material/FormControlLabel';
|
3
|
-
import { Control, useController, useWatch } from 'react-hook-form';
|
4
|
-
import { useEffect, useMemo } from 'react';
|
5
|
-
|
6
|
-
type Props = SwitchProps & {
|
7
|
-
/**
|
8
|
-
* React Hook Form `control`
|
9
|
-
*/
|
10
|
-
control: Control<any>;
|
11
|
-
/**
|
12
|
-
* React Hook Form control `name` propery
|
13
|
-
*/
|
14
|
-
name: string;
|
15
|
-
/**
|
16
|
-
* Material-UI FormControlLabel `label` prop
|
17
|
-
*/
|
18
|
-
label?: string;
|
19
|
-
};
|
20
|
-
|
21
|
-
export const ControlSwitch = ({ control, name, label, ...switchProps }: Props) => {
|
22
|
-
const {
|
23
|
-
field: { ref, onChange },
|
24
|
-
} = useController({ control, name });
|
25
|
-
const value = useWatch({ control, name });
|
26
|
-
|
27
|
-
const checked = useMemo(() => {
|
28
|
-
if (typeof value === 'boolean') {
|
29
|
-
return value;
|
30
|
-
} else if (typeof value === 'string') {
|
31
|
-
if (value === 'false') {
|
32
|
-
onChange(false);
|
33
|
-
return false;
|
34
|
-
} else if (value === 'true') {
|
35
|
-
onChange(true);
|
36
|
-
return true;
|
37
|
-
}
|
38
|
-
}
|
39
|
-
return false;
|
40
|
-
}, [value, onChange]);
|
41
|
-
|
42
|
-
useEffect(() => {
|
43
|
-
if (value === null) {
|
44
|
-
onChange(false);
|
45
|
-
}
|
46
|
-
}, [value, onChange]);
|
47
|
-
|
48
|
-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
49
|
-
const { checked } = event.target;
|
50
|
-
onChange(checked);
|
51
|
-
};
|
52
|
-
|
53
|
-
return (
|
54
|
-
<FormControlLabel
|
55
|
-
label={label}
|
56
|
-
name={name}
|
57
|
-
control={
|
58
|
-
<Switch
|
59
|
-
color="primary"
|
60
|
-
size="small"
|
61
|
-
inputRef={ref}
|
62
|
-
onChange={handleChange}
|
63
|
-
checked={checked}
|
64
|
-
{...switchProps}
|
65
|
-
/>
|
66
|
-
}
|
67
|
-
/>
|
68
|
-
);
|
69
|
-
};
|
70
|
-
|
71
|
-
export default ControlSwitch;
|
@@ -1,93 +0,0 @@
|
|
1
|
-
import TextField from '@mui/material/TextField';
|
2
|
-
import { TimePicker } from '@mui/x-date-pickers/TimePicker';
|
3
|
-
|
4
|
-
import { parse, format as dateFnsFormat, isMatch, isValid } from 'date-fns';
|
5
|
-
import { useEffect, useState } from 'react';
|
6
|
-
import { Control, useController, useWatch } from 'react-hook-form';
|
7
|
-
import { TIME_DEFAULT_FORMAT } from '../../interfaces';
|
8
|
-
|
9
|
-
type Props = {
|
10
|
-
/**
|
11
|
-
* React Hook Form `control`
|
12
|
-
*/
|
13
|
-
control: Control<any>;
|
14
|
-
/**
|
15
|
-
* Is input required flag
|
16
|
-
*/
|
17
|
-
required?: boolean;
|
18
|
-
name: string;
|
19
|
-
label?: string;
|
20
|
-
format?: string;
|
21
|
-
hideErrorMessage?: boolean;
|
22
|
-
};
|
23
|
-
|
24
|
-
export const ControlTime = ({
|
25
|
-
control,
|
26
|
-
name,
|
27
|
-
required,
|
28
|
-
label,
|
29
|
-
format = TIME_DEFAULT_FORMAT,
|
30
|
-
hideErrorMessage = false,
|
31
|
-
}: Props) => {
|
32
|
-
const {
|
33
|
-
field: { onChange, ref },
|
34
|
-
fieldState: { error },
|
35
|
-
} = useController({
|
36
|
-
control,
|
37
|
-
name,
|
38
|
-
rules: {
|
39
|
-
required: required && 'Please, fill this field',
|
40
|
-
validate: (val) => {
|
41
|
-
if (isMatch(val, format)) {
|
42
|
-
return true;
|
43
|
-
}
|
44
|
-
return 'Incorrect date format';
|
45
|
-
},
|
46
|
-
},
|
47
|
-
});
|
48
|
-
const value = useWatch({ control, name });
|
49
|
-
|
50
|
-
const [fieldValue, setFieldValue] = useState(null);
|
51
|
-
|
52
|
-
const handleChange = (date: Date) => {
|
53
|
-
setFieldValue(date);
|
54
|
-
onChange(isValid(date) ? dateFnsFormat(date, format) : date);
|
55
|
-
};
|
56
|
-
|
57
|
-
useEffect(() => {
|
58
|
-
if (value && format) {
|
59
|
-
let parsedValue = parse(value, format, new Date());
|
60
|
-
|
61
|
-
if (!isValid(parsedValue)) {
|
62
|
-
parsedValue = parse(value, 'HH:mm:ss.SSS', new Date());
|
63
|
-
}
|
64
|
-
|
65
|
-
setFieldValue(parsedValue);
|
66
|
-
}
|
67
|
-
}, [value, format]);
|
68
|
-
|
69
|
-
return (
|
70
|
-
<TimePicker
|
71
|
-
mask=""
|
72
|
-
inputRef={ref}
|
73
|
-
label={label}
|
74
|
-
ampm={false}
|
75
|
-
value={fieldValue}
|
76
|
-
inputFormat={format}
|
77
|
-
onChange={handleChange}
|
78
|
-
renderInput={(props) => (
|
79
|
-
<TextField
|
80
|
-
{...props}
|
81
|
-
fullWidth
|
82
|
-
size="small"
|
83
|
-
variant="outlined"
|
84
|
-
name={name}
|
85
|
-
error={!!error}
|
86
|
-
helperText={!hideErrorMessage && error?.message}
|
87
|
-
/>
|
88
|
-
)}
|
89
|
-
/>
|
90
|
-
);
|
91
|
-
};
|
92
|
-
|
93
|
-
export default ControlTime;
|
@@ -1,46 +0,0 @@
|
|
1
|
-
import { useState } from 'react';
|
2
|
-
// import FileCopyOutlinedIcon from '@mui/icons-material/FileCopyOutlined';
|
3
|
-
import Tooltip from '@mui/material/Tooltip';
|
4
|
-
import IconButton from '@mui/material/IconButton';
|
5
|
-
import SvgIcon from '@mui/material/SvgIcon';
|
6
|
-
/**
|
7
|
-
* This interface is referencing the [[CopyButton]] component props.
|
8
|
-
* @category Forms
|
9
|
-
*/
|
10
|
-
export interface CopyButtonProps {
|
11
|
-
/**
|
12
|
-
* Text to copy
|
13
|
-
*/
|
14
|
-
copyText: string;
|
15
|
-
/**
|
16
|
-
* Tooltip help text
|
17
|
-
*/
|
18
|
-
helpText?: string;
|
19
|
-
}
|
20
|
-
|
21
|
-
/**
|
22
|
-
* Copy value button
|
23
|
-
* @category Forms
|
24
|
-
*/
|
25
|
-
export const CopyButton = ({ copyText, helpText = 'Copy' }: CopyButtonProps) => {
|
26
|
-
const [tooltipText, setTooltipText] = useState(helpText);
|
27
|
-
|
28
|
-
const onCopy = () => {
|
29
|
-
navigator.clipboard.writeText(copyText);
|
30
|
-
setTooltipText('Copied!');
|
31
|
-
|
32
|
-
setTimeout(() => {
|
33
|
-
setTooltipText(helpText);
|
34
|
-
}, 1000);
|
35
|
-
};
|
36
|
-
|
37
|
-
return tooltipText ? (
|
38
|
-
<Tooltip title={tooltipText} placement="top">
|
39
|
-
<IconButton onClick={onCopy}>
|
40
|
-
<SvgIcon fontSize="small">
|
41
|
-
<path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4 6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z"></path>
|
42
|
-
</SvgIcon>
|
43
|
-
</IconButton>
|
44
|
-
</Tooltip>
|
45
|
-
) : null;
|
46
|
-
};
|
@@ -1,47 +0,0 @@
|
|
1
|
-
import Box from '@mui/material/Box';
|
2
|
-
import { useCallback } from 'react';
|
3
|
-
|
4
|
-
const useAutocomplete = ({ valueKey, labelKey }) => {
|
5
|
-
const isOptionEqualToValue = useCallback(
|
6
|
-
(option, value) => {
|
7
|
-
if (option && value) {
|
8
|
-
if (typeof option === 'string') {
|
9
|
-
return option === value;
|
10
|
-
} else if (valueKey) {
|
11
|
-
return option[valueKey] === value[valueKey] || option[valueKey] === value;
|
12
|
-
} else if (option.value) {
|
13
|
-
return option.value === value.value || option.value === value;
|
14
|
-
}
|
15
|
-
}
|
16
|
-
return false;
|
17
|
-
},
|
18
|
-
[valueKey]
|
19
|
-
);
|
20
|
-
|
21
|
-
const getOptionLabel = useCallback(
|
22
|
-
(option) => {
|
23
|
-
if (!option) return '';
|
24
|
-
if (typeof option === 'string') {
|
25
|
-
return option;
|
26
|
-
} else if (labelKey && option[labelKey]) {
|
27
|
-
return option[labelKey] + '';
|
28
|
-
} else {
|
29
|
-
return option.label + '' || option.name + '' || option.value + '' || option.code + '' || '--no label--';
|
30
|
-
}
|
31
|
-
},
|
32
|
-
[labelKey]
|
33
|
-
);
|
34
|
-
|
35
|
-
const renderOption = useCallback(
|
36
|
-
(props, option) => (
|
37
|
-
<Box {...props} component="li" key={props.id}>
|
38
|
-
{getOptionLabel(option)}
|
39
|
-
</Box>
|
40
|
-
),
|
41
|
-
[getOptionLabel]
|
42
|
-
);
|
43
|
-
|
44
|
-
return { isOptionEqualToValue, getOptionLabel, renderOption };
|
45
|
-
};
|
46
|
-
|
47
|
-
export default useAutocomplete;
|
@@ -1,40 +0,0 @@
|
|
1
|
-
import AceEditor from 'react-ace';
|
2
|
-
import useStyles from './styles';
|
3
|
-
import 'ace-builds/src-noconflict/ace';
|
4
|
-
import 'ace-builds/src-noconflict/mode-json';
|
5
|
-
|
6
|
-
type Props = {
|
7
|
-
title: string;
|
8
|
-
text?: string;
|
9
|
-
json?: any;
|
10
|
-
};
|
11
|
-
|
12
|
-
export const InfoItem = ({ title, text, json }: Props) => {
|
13
|
-
const { classes } = useStyles();
|
14
|
-
|
15
|
-
return (
|
16
|
-
<div className={classes.container}>
|
17
|
-
<div className={classes.title}>{title}</div>
|
18
|
-
{text && <div className={classes.text}>{text}</div>}
|
19
|
-
{json && (
|
20
|
-
<AceEditor
|
21
|
-
readOnly
|
22
|
-
value={json}
|
23
|
-
mode="json"
|
24
|
-
height="300px"
|
25
|
-
width="100%"
|
26
|
-
fontSize="16"
|
27
|
-
setOptions={{
|
28
|
-
enableSnippets: false,
|
29
|
-
copyWithEmptySelection: true,
|
30
|
-
showLineNumbers: true,
|
31
|
-
tabSize: 2,
|
32
|
-
useWorker: false
|
33
|
-
}}
|
34
|
-
/>
|
35
|
-
)}
|
36
|
-
</div>
|
37
|
-
);
|
38
|
-
};
|
39
|
-
|
40
|
-
export default InfoItem;
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import { makeStyles } from 'tss-react/mui';
|
2
|
-
|
3
|
-
export default makeStyles()(() => ({
|
4
|
-
container: {
|
5
|
-
// borderBottom: '1px solid #ccc',
|
6
|
-
paddingBottom: '8px',
|
7
|
-
},
|
8
|
-
title: {
|
9
|
-
fontSize: '14px',
|
10
|
-
fontWeight: 600,
|
11
|
-
color: '#536DFE',
|
12
|
-
},
|
13
|
-
text: {
|
14
|
-
fontSize: '18px',
|
15
|
-
wordWrap: 'break-word',
|
16
|
-
},
|
17
|
-
}));
|
@@ -1,73 +0,0 @@
|
|
1
|
-
import Button from '@mui/material/Button';
|
2
|
-
import Dialog from '@mui/material/Dialog';
|
3
|
-
import DialogTitle from '@mui/material/DialogTitle';
|
4
|
-
import DialogContent from '@mui/material/DialogContent';
|
5
|
-
import DialogActions from '@mui/material/DialogActions';
|
6
|
-
import Typography from '@mui/material/Typography';
|
7
|
-
import PropertyStep from './PropertyStep';
|
8
|
-
|
9
|
-
import { useState } from 'react';
|
10
|
-
import { toast } from 'react-toastify';
|
11
|
-
import { JsonPathPickerProperty } from '../../interfaces';
|
12
|
-
|
13
|
-
type Props = {
|
14
|
-
properties: JsonPathPickerProperty[];
|
15
|
-
open: boolean;
|
16
|
-
onClose: () => void;
|
17
|
-
onPaste: (path: string) => void;
|
18
|
-
};
|
19
|
-
|
20
|
-
export const JsonPathPicker = ({ open = false, onClose, onPaste, properties }: Props) => {
|
21
|
-
const [selectedPropertyPath, setSelectedPropertyPath] = useState<string>('');
|
22
|
-
|
23
|
-
const onCopy = () => {
|
24
|
-
navigator.clipboard.writeText(`$(${selectedPropertyPath})`);
|
25
|
-
toast.success('Copied!');
|
26
|
-
};
|
27
|
-
|
28
|
-
const handlePaste = () => {
|
29
|
-
onPaste(`$(${selectedPropertyPath})`);
|
30
|
-
toast.success('Pasted!');
|
31
|
-
};
|
32
|
-
|
33
|
-
return (
|
34
|
-
<Dialog open={open} onClose={onClose} fullWidth maxWidth="md">
|
35
|
-
<DialogTitle>JSON path picker</DialogTitle>
|
36
|
-
<DialogContent>
|
37
|
-
{properties?.length ? (
|
38
|
-
properties.map((propEl, index) => (
|
39
|
-
<div key={index}>
|
40
|
-
<Typography variant="h6">{propEl.title}</Typography>
|
41
|
-
<PropertyStep
|
42
|
-
properties={propEl.properties}
|
43
|
-
prefix={propEl.pathPrefix}
|
44
|
-
onClick={setSelectedPropertyPath}
|
45
|
-
activePath={selectedPropertyPath}
|
46
|
-
/>
|
47
|
-
</div>
|
48
|
-
))
|
49
|
-
) : (
|
50
|
-
<Typography>Please, add properties</Typography>
|
51
|
-
)}
|
52
|
-
{selectedPropertyPath && (
|
53
|
-
<Typography variant="h6" gutterBottom>
|
54
|
-
Selected path : $({selectedPropertyPath})
|
55
|
-
</Typography>
|
56
|
-
)}
|
57
|
-
</DialogContent>
|
58
|
-
<DialogActions>
|
59
|
-
<Button variant="contained" color="primary" onClick={onCopy}>
|
60
|
-
Copy
|
61
|
-
</Button>
|
62
|
-
<Button variant="contained" color="primary" onClick={handlePaste}>
|
63
|
-
Paste
|
64
|
-
</Button>
|
65
|
-
<Button variant="contained" color="secondary" onClick={onClose}>
|
66
|
-
Close
|
67
|
-
</Button>
|
68
|
-
</DialogActions>
|
69
|
-
</Dialog>
|
70
|
-
);
|
71
|
-
};
|
72
|
-
|
73
|
-
export default JsonPathPicker;
|
@@ -1,70 +0,0 @@
|
|
1
|
-
import Stepper from '@mui/material/Stepper';
|
2
|
-
import Step from '@mui/material/Step';
|
3
|
-
import StepLabel from '@mui/material/StepLabel';
|
4
|
-
import StepContent from '@mui/material/StepContent';
|
5
|
-
|
6
|
-
import { EntityTypeProperty, PropertiesArrayType, PropertyType } from '../../interfaces';
|
7
|
-
import { makeStyles } from 'tss-react/mui';
|
8
|
-
|
9
|
-
type Props = {
|
10
|
-
properties: PropertiesArrayType;
|
11
|
-
parentKey?: string;
|
12
|
-
activePath: string;
|
13
|
-
prefix?: string;
|
14
|
-
onClick: (path: string) => void;
|
15
|
-
};
|
16
|
-
|
17
|
-
const useStyles = makeStyles()(() => ({
|
18
|
-
propertyStepLabel: {
|
19
|
-
'&:hover': {
|
20
|
-
fontWeight: '600',
|
21
|
-
cursor: 'pointer',
|
22
|
-
},
|
23
|
-
},
|
24
|
-
}));
|
25
|
-
|
26
|
-
const PropertyStep = ({ properties, parentKey = '', activePath = '', prefix = '', onClick }: Props) => {
|
27
|
-
const { classes } = useStyles();
|
28
|
-
|
29
|
-
const handleClick = (path: string) => {
|
30
|
-
if (prefix) {
|
31
|
-
onClick(`${prefix}.${path}`);
|
32
|
-
} else {
|
33
|
-
onClick(path);
|
34
|
-
}
|
35
|
-
};
|
36
|
-
|
37
|
-
return (
|
38
|
-
<Stepper orientation="vertical" onClick={(event) => event.stopPropagation()}>
|
39
|
-
{properties &&
|
40
|
-
properties.map((property) => {
|
41
|
-
const fullPropertyPath = parentKey ? `${parentKey}.${property.key}` : property.key;
|
42
|
-
const propertyType = property.propertyType['value'] ?? property.propertyType;
|
43
|
-
return (
|
44
|
-
<Step expanded key={property.key} onClick={() => handleClick(fullPropertyPath)}>
|
45
|
-
<StepLabel StepIconProps={{ icon: '', completed: false, active: activePath === fullPropertyPath }}>
|
46
|
-
<div className={classes.propertyStepLabel}>
|
47
|
-
{property.name} - {property.key} - {propertyType}
|
48
|
-
</div>
|
49
|
-
</StepLabel>
|
50
|
-
<StepContent>
|
51
|
-
<div>
|
52
|
-
{propertyType === PropertyType.ENTITY && (
|
53
|
-
<PropertyStep
|
54
|
-
key={property.key}
|
55
|
-
onClick={onClick}
|
56
|
-
activePath={activePath}
|
57
|
-
properties={(property as EntityTypeProperty).properties as PropertiesArrayType}
|
58
|
-
parentKey={fullPropertyPath}
|
59
|
-
/>
|
60
|
-
)}
|
61
|
-
</div>
|
62
|
-
</StepContent>
|
63
|
-
</Step>
|
64
|
-
);
|
65
|
-
})}
|
66
|
-
</Stepper>
|
67
|
-
);
|
68
|
-
};
|
69
|
-
|
70
|
-
export default PropertyStep;
|
@@ -1,41 +0,0 @@
|
|
1
|
-
import { useMemo } from 'react';
|
2
|
-
import CodeMirror from '@uiw/react-codemirror';
|
3
|
-
import { langs } from '@uiw/codemirror-extensions-langs';
|
4
|
-
|
5
|
-
type Props = {
|
6
|
-
value: unknown;
|
7
|
-
height?: string;
|
8
|
-
};
|
9
|
-
|
10
|
-
|
11
|
-
export const JsonView = ({ value, height = '200px' }: Props) => {
|
12
|
-
|
13
|
-
const stringValue = useMemo(() => {
|
14
|
-
if (typeof value === 'string') {
|
15
|
-
return value;
|
16
|
-
} else if (typeof value === 'object') {
|
17
|
-
try {
|
18
|
-
return JSON.stringify(value, null, 2);
|
19
|
-
} catch (error) {
|
20
|
-
return 'Failed to stringify Object';
|
21
|
-
}
|
22
|
-
}
|
23
|
-
return '';
|
24
|
-
}, [value]);
|
25
|
-
|
26
|
-
return (
|
27
|
-
<CodeMirror
|
28
|
-
readOnly
|
29
|
-
width="100%"
|
30
|
-
value={stringValue}
|
31
|
-
height={height}
|
32
|
-
basicSetup={{
|
33
|
-
autocompletion: true,
|
34
|
-
history: true
|
35
|
-
}}
|
36
|
-
extensions={[langs.json()]}
|
37
|
-
style={{ fontSize: 16 }}
|
38
|
-
|
39
|
-
/>
|
40
|
-
);
|
41
|
-
};
|