@dartech/arsenal-ui 1.2.6 → 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 -132
- 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,52 +0,0 @@
|
|
1
|
-
import Box from '@mui/material/Box';
|
2
|
-
import Typography from '@mui/material/Typography';
|
3
|
-
import Accordion from '@mui/material/Accordion';
|
4
|
-
import AccordionSummary from '@mui/material/AccordionSummary';
|
5
|
-
import AccordionDetails from '@mui/material/AccordionDetails';
|
6
|
-
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
7
|
-
import PropertyDataTable from './PropertyDataTable';
|
8
|
-
import EntityPropertiesView from './EntityPropertiesView';
|
9
|
-
|
10
|
-
import { useEffect, useState } from 'react';
|
11
|
-
import { propertiesObjectToArray } from '../../../utils';
|
12
|
-
import { PropertiesObjectType, PropertyType, PropertyUnion } from '../../../interfaces';
|
13
|
-
|
14
|
-
type Props = {
|
15
|
-
property: PropertyUnion;
|
16
|
-
parentNames?: string[];
|
17
|
-
defaultExpanded?: boolean;
|
18
|
-
};
|
19
|
-
|
20
|
-
export const ViewProperty = ({ property, parentNames = [], defaultExpanded = true }: Props) => {
|
21
|
-
const [expanded, setExpanded] = useState(true);
|
22
|
-
|
23
|
-
useEffect(() => {
|
24
|
-
setExpanded(defaultExpanded);
|
25
|
-
}, [defaultExpanded]);
|
26
|
-
|
27
|
-
return (
|
28
|
-
<Accordion
|
29
|
-
elevation={3}
|
30
|
-
style={{ backgroundColor: parentNames.length % 2 === 1 ? '#f1f1f1' : '#fff' }}
|
31
|
-
expanded={expanded}
|
32
|
-
onChange={() => setExpanded((prevState) => !prevState)}
|
33
|
-
>
|
34
|
-
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
|
35
|
-
<Typography style={{ wordBreak: 'break-word', fontWeight: '600' }}>{property.name}</Typography>
|
36
|
-
</AccordionSummary>
|
37
|
-
<AccordionDetails>
|
38
|
-
<Box width="100%">
|
39
|
-
<PropertyDataTable property={property} />
|
40
|
-
{property.propertyType === PropertyType.ENTITY && (
|
41
|
-
<EntityPropertiesView
|
42
|
-
properties={propertiesObjectToArray(property.properties as PropertiesObjectType)}
|
43
|
-
parentNames={[...parentNames, property.name]}
|
44
|
-
/>
|
45
|
-
)}
|
46
|
-
</Box>
|
47
|
-
</AccordionDetails>
|
48
|
-
</Accordion>
|
49
|
-
);
|
50
|
-
};
|
51
|
-
|
52
|
-
export default ViewProperty;
|
@@ -1,157 +0,0 @@
|
|
1
|
-
import MuiDrawer from '@mui/material/Drawer';
|
2
|
-
import MuiList from '@mui/material/List';
|
3
|
-
import MuiListItem from '@mui/material/ListItem';
|
4
|
-
import MuiListItemIcon from '@mui/material/ListItemIcon';
|
5
|
-
import MuiListItemButton from '@mui/material/ListItemButton';
|
6
|
-
import MuiListSubheader from '@mui/material/ListSubheader';
|
7
|
-
import MuiListItemText from '@mui/material/ListItemText';
|
8
|
-
import Toolbar from '@mui/material/Toolbar';
|
9
|
-
import MuiButtonBase from '@mui/material/ButtonBase';
|
10
|
-
import { styled } from '@mui/material/styles';
|
11
|
-
|
12
|
-
const drawerWidth = 248;
|
13
|
-
|
14
|
-
export const Container = styled('div')({
|
15
|
-
position: 'relative',
|
16
|
-
'&:hover': {
|
17
|
-
'.button-collapse': {
|
18
|
-
opacity: 1,
|
19
|
-
},
|
20
|
-
},
|
21
|
-
});
|
22
|
-
|
23
|
-
export const Drawer = styled(MuiDrawer)((props) => ({
|
24
|
-
width: drawerWidth,
|
25
|
-
flexShrink: 0,
|
26
|
-
position: 'relative',
|
27
|
-
transition: 'all 0.3s ease-in-out',
|
28
|
-
'& .MuiDrawer-paper': {
|
29
|
-
backgroundColor: props.theme.palette.secondary.main,
|
30
|
-
width: drawerWidth,
|
31
|
-
boxSizing: 'border-box',
|
32
|
-
borderRight: 'none',
|
33
|
-
borderRadius: 0,
|
34
|
-
transition: 'all 0.3s ease-in-out',
|
35
|
-
overflow: 'hidden',
|
36
|
-
},
|
37
|
-
|
38
|
-
'&.collapsed': {
|
39
|
-
width: 64,
|
40
|
-
'& .MuiDrawer-paper': {
|
41
|
-
width: 64,
|
42
|
-
},
|
43
|
-
},
|
44
|
-
}));
|
45
|
-
|
46
|
-
export const Header = styled(Toolbar)(({ theme }) => ({
|
47
|
-
backgroundColor: '#fff',
|
48
|
-
borderRight: '1px solid rgba(38, 40, 66, 0.08)',
|
49
|
-
fontSize: 24,
|
50
|
-
fontWeight: 600,
|
51
|
-
// padding: theme.spacing(1, 4)
|
52
|
-
}));
|
53
|
-
|
54
|
-
export const List = styled(MuiList)((props) => ({
|
55
|
-
padding: props.theme.spacing(3),
|
56
|
-
margin: 0,
|
57
|
-
}));
|
58
|
-
|
59
|
-
export const ListItem = styled(MuiListItem)((props) => ({
|
60
|
-
color: '#fff',
|
61
|
-
height: props.theme.spacing(11),
|
62
|
-
overflow: 'hidden',
|
63
|
-
}));
|
64
|
-
|
65
|
-
export const ListItemButton = styled(MuiListItemButton)(({ theme }) => ({
|
66
|
-
borderRadius: theme.spacing(2.5),
|
67
|
-
padding: theme.spacing(2),
|
68
|
-
height: theme.spacing(11),
|
69
|
-
'&.active': {
|
70
|
-
backgroundColor: 'rgba(38, 40, 66, 0.12)',
|
71
|
-
'&.main': {
|
72
|
-
backgroundColor: 'rgba(255, 255, 255, 0.12)',
|
73
|
-
borderLeft: '4px solid #E0613A',
|
74
|
-
},
|
75
|
-
},
|
76
|
-
'&:hover': {
|
77
|
-
backgroundColor: 'rgba(255, 255, 255, 0.08)',
|
78
|
-
},
|
79
|
-
|
80
|
-
'&.collapsed': {
|
81
|
-
width: theme.spacing(11),
|
82
|
-
'&.active': {
|
83
|
-
'&.main': {
|
84
|
-
border: 'none',
|
85
|
-
backgroundColor: '#E0613A',
|
86
|
-
},
|
87
|
-
},
|
88
|
-
},
|
89
|
-
}));
|
90
|
-
|
91
|
-
export const ListItemIcon = styled(MuiListItemIcon)(({ theme }) => ({
|
92
|
-
color: '#fff',
|
93
|
-
width: 20,
|
94
|
-
height: 20,
|
95
|
-
minWidth: 20,
|
96
|
-
marginRight: theme.spacing(2),
|
97
|
-
'& svg': {
|
98
|
-
marginLeft: 2,
|
99
|
-
fill: '#fff',
|
100
|
-
color: '#fff',
|
101
|
-
},
|
102
|
-
'&.collapsed': {
|
103
|
-
marginRight: 0,
|
104
|
-
},
|
105
|
-
}));
|
106
|
-
|
107
|
-
export const ListSubheader = styled(MuiListSubheader)(() => ({
|
108
|
-
backgroundColor: 'inherit',
|
109
|
-
color: '#fff',
|
110
|
-
paddingLeft: 0,
|
111
|
-
textTransform: 'uppercase',
|
112
|
-
}));
|
113
|
-
|
114
|
-
export const ListItemText = styled(MuiListItemText)((props) => ({
|
115
|
-
width: '100%',
|
116
|
-
|
117
|
-
'& > *': {
|
118
|
-
overflow: 'hidden',
|
119
|
-
textOverflow: 'ellipsis',
|
120
|
-
wordBreak: 'break-all',
|
121
|
-
whiteSpace: 'nowrap',
|
122
|
-
},
|
123
|
-
|
124
|
-
'&.collapsed': {
|
125
|
-
display: 'none',
|
126
|
-
},
|
127
|
-
}));
|
128
|
-
|
129
|
-
export const ChildrenList = styled(MuiList)((props) => ({
|
130
|
-
margin: 0,
|
131
|
-
padding: 0,
|
132
|
-
'& .MuiListItemText-root': {
|
133
|
-
paddingLeft: props.theme.spacing(7),
|
134
|
-
},
|
135
|
-
}));
|
136
|
-
|
137
|
-
export const CollapseButton = styled(MuiButtonBase)((props) => ({
|
138
|
-
position: 'absolute',
|
139
|
-
top: props.theme.spacing(10),
|
140
|
-
left: 'calc(100% - 16px)',
|
141
|
-
width: props.theme.spacing(8),
|
142
|
-
height: props.theme.spacing(8),
|
143
|
-
border: '1px solid #E0E3EA',
|
144
|
-
borderRadius: '50%',
|
145
|
-
boxShadow: '0px 2px 8px rgba(0, 0, 0, 0.12)',
|
146
|
-
backgroundColor: '#fff',
|
147
|
-
zIndex: 8000,
|
148
|
-
opacity: 0,
|
149
|
-
transition: 'all 0.3s ease-in-out',
|
150
|
-
|
151
|
-
'&.collapsed': {
|
152
|
-
img: {
|
153
|
-
transition: 'all 0.3s ease-in-out',
|
154
|
-
transform: 'rotate(180deg)',
|
155
|
-
},
|
156
|
-
},
|
157
|
-
}));
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import { ThemeProvider } from '@mui/material/styles';
|
2
|
-
import { SidebarContextProvider } from './SidebarContext';
|
3
|
-
import { theme as defaultTheme } from '@dartech/arsenal-ui';
|
4
|
-
import SidebarDrawer from './SidebarDrawer';
|
5
|
-
import type { Route } from '@dartech/arsenal-ui';
|
6
|
-
|
7
|
-
type Props = {
|
8
|
-
routes: Route[];
|
9
|
-
theme?: any;
|
10
|
-
title?: string;
|
11
|
-
id?: string;
|
12
|
-
};
|
13
|
-
|
14
|
-
export const Sidebar = ({
|
15
|
-
routes,
|
16
|
-
theme = defaultTheme,
|
17
|
-
title = '',
|
18
|
-
id
|
19
|
-
}: Props) => {
|
20
|
-
return (
|
21
|
-
<ThemeProvider theme={theme}>
|
22
|
-
<SidebarContextProvider>
|
23
|
-
<SidebarDrawer title={title} routes={routes} id={id} />
|
24
|
-
</SidebarContextProvider>
|
25
|
-
</ThemeProvider>
|
26
|
-
);
|
27
|
-
};
|
@@ -1,37 +0,0 @@
|
|
1
|
-
import { createContext, useCallback, useContext, useState } from 'react';
|
2
|
-
|
3
|
-
type SidebarContextProps = {
|
4
|
-
collapsed: boolean;
|
5
|
-
toggleCollapse: () => void;
|
6
|
-
};
|
7
|
-
|
8
|
-
export const SidebarContext = createContext<SidebarContextProps>({
|
9
|
-
collapsed: false,
|
10
|
-
toggleCollapse: () => {
|
11
|
-
console.log('collapse toggle');
|
12
|
-
},
|
13
|
-
});
|
14
|
-
|
15
|
-
export const useSidebarContext = () => useContext(SidebarContext);
|
16
|
-
|
17
|
-
export const SidebarContextProvider = ({ children }) => {
|
18
|
-
const [collapsed, setCollapsed] = useState(
|
19
|
-
localStorage.getItem('sidebar_collapsed') === 'true'
|
20
|
-
);
|
21
|
-
|
22
|
-
const toggleCollapse = useCallback(() => {
|
23
|
-
setCollapsed(!collapsed);
|
24
|
-
localStorage.setItem('sidebar_collapsed', `${!collapsed}`);
|
25
|
-
window.dispatchEvent(new CustomEvent('sidebar_collapsed', {
|
26
|
-
detail: {
|
27
|
-
collapsed: !collapsed
|
28
|
-
}
|
29
|
-
}))
|
30
|
-
}, [collapsed]);
|
31
|
-
|
32
|
-
return (
|
33
|
-
<SidebarContext.Provider value={{ collapsed, toggleCollapse }}>
|
34
|
-
{children}
|
35
|
-
</SidebarContext.Provider>
|
36
|
-
);
|
37
|
-
};
|
@@ -1,50 +0,0 @@
|
|
1
|
-
import SidebarLink from './SidebarLink';
|
2
|
-
import {
|
3
|
-
Container,
|
4
|
-
CollapseButton,
|
5
|
-
Drawer,
|
6
|
-
Header,
|
7
|
-
List,
|
8
|
-
} from './Sidebar.styled';
|
9
|
-
import ArrowIcon from '../../assets/chevron_left_gray.svg';
|
10
|
-
import classnames from 'classnames';
|
11
|
-
import type { Route } from '../../interfaces';
|
12
|
-
import { useSidebarContext } from './SidebarContext';
|
13
|
-
|
14
|
-
type Props = {
|
15
|
-
title?: string;
|
16
|
-
routes: Route[];
|
17
|
-
id?: string;
|
18
|
-
};
|
19
|
-
|
20
|
-
const SidebarDrawer = ({ title, routes, id }: Props) => {
|
21
|
-
const { collapsed, toggleCollapse } = useSidebarContext();
|
22
|
-
|
23
|
-
return (
|
24
|
-
<Container>
|
25
|
-
<CollapseButton
|
26
|
-
className={classnames('button-collapse', {
|
27
|
-
collapsed,
|
28
|
-
})}
|
29
|
-
onClick={toggleCollapse}
|
30
|
-
>
|
31
|
-
<img src={ArrowIcon} alt="collapse" />
|
32
|
-
</CollapseButton>
|
33
|
-
<Drawer
|
34
|
-
variant="permanent"
|
35
|
-
anchor="left"
|
36
|
-
className={classnames({ collapsed })}
|
37
|
-
id={id}
|
38
|
-
>
|
39
|
-
{!!title && <Header>{title}</Header>}
|
40
|
-
<List>
|
41
|
-
{routes.map((route, index) => (
|
42
|
-
<SidebarLink key={index} route={route} />
|
43
|
-
))}
|
44
|
-
</List>
|
45
|
-
</Drawer>
|
46
|
-
</Container>
|
47
|
-
);
|
48
|
-
};
|
49
|
-
|
50
|
-
export default SidebarDrawer;
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import Box from '@mui/material/Box';
|
2
|
-
|
3
|
-
type Props = {
|
4
|
-
src: string;
|
5
|
-
alt?: string;
|
6
|
-
}
|
7
|
-
|
8
|
-
export const MenuIcon = ({src, alt}: Props) => {
|
9
|
-
return (
|
10
|
-
<Box sx={{ width: 20, height: 20, display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
|
11
|
-
<img src={src} alt={alt} />
|
12
|
-
</Box>
|
13
|
-
)
|
14
|
-
}
|
15
|
-
|
16
|
-
export default MenuIcon
|
@@ -1,54 +0,0 @@
|
|
1
|
-
import Collapse from '@mui/material/Collapse';
|
2
|
-
import SidebarLinkItem from './SidebarLinkItem';
|
3
|
-
import SidebarNestedItem from './SidebarNestedItem';
|
4
|
-
import type { Route } from '../../../interfaces';
|
5
|
-
import { useEffect, useMemo, useState } from 'react';
|
6
|
-
import { useLocation } from 'react-router-dom';
|
7
|
-
import { ChildrenList } from '../Sidebar.styled';
|
8
|
-
import { useSidebarContext } from '../SidebarContext';
|
9
|
-
|
10
|
-
type Props = {
|
11
|
-
route: Route;
|
12
|
-
};
|
13
|
-
|
14
|
-
const SidebarLink = ({ route }: Props) => {
|
15
|
-
const location = useLocation();
|
16
|
-
const { collapsed } = useSidebarContext();
|
17
|
-
|
18
|
-
const [open, setOpen] = useState(false);
|
19
|
-
|
20
|
-
const isActive = useMemo(
|
21
|
-
() => !!route.link && location.pathname.startsWith(route.link),
|
22
|
-
[location.pathname, route]
|
23
|
-
);
|
24
|
-
|
25
|
-
const handleClick = () => {
|
26
|
-
setOpen(!open);
|
27
|
-
};
|
28
|
-
|
29
|
-
useEffect(() => {
|
30
|
-
setOpen(isActive);
|
31
|
-
}, [isActive]);
|
32
|
-
|
33
|
-
return route.children?.length && !collapsed ? (
|
34
|
-
<>
|
35
|
-
<SidebarNestedItem
|
36
|
-
route={route}
|
37
|
-
isActive={isActive}
|
38
|
-
handleClick={handleClick}
|
39
|
-
isListOpen={open || !route.link}
|
40
|
-
/>
|
41
|
-
<Collapse in={open || !route.link} timeout="auto">
|
42
|
-
<ChildrenList>
|
43
|
-
{route.children?.map((childRoute, index) => (
|
44
|
-
<SidebarLink key={index} route={childRoute} />
|
45
|
-
))}
|
46
|
-
</ChildrenList>
|
47
|
-
</Collapse>
|
48
|
-
</>
|
49
|
-
) : (
|
50
|
-
<SidebarLinkItem route={route} isActive={isActive} />
|
51
|
-
);
|
52
|
-
};
|
53
|
-
|
54
|
-
export default SidebarLink;
|
@@ -1,54 +0,0 @@
|
|
1
|
-
import { Link as RouterLink } from 'react-router-dom';
|
2
|
-
import {
|
3
|
-
ListItem,
|
4
|
-
ListItemButton,
|
5
|
-
ListItemIcon,
|
6
|
-
ListSubheader,
|
7
|
-
ListItemText,
|
8
|
-
} from '../Sidebar.styled';
|
9
|
-
import classnames from 'classnames';
|
10
|
-
import type { Route } from '../../../interfaces';
|
11
|
-
import { useSidebarContext } from '../SidebarContext';
|
12
|
-
|
13
|
-
type Props = {
|
14
|
-
route: Route;
|
15
|
-
isActive: boolean;
|
16
|
-
};
|
17
|
-
|
18
|
-
const SidebarLinkItem = ({ route, isActive }: Props) => {
|
19
|
-
const { collapsed } = useSidebarContext();
|
20
|
-
|
21
|
-
return route.link ? (
|
22
|
-
<ListItem
|
23
|
-
disablePadding
|
24
|
-
{...{
|
25
|
-
component: RouterLink,
|
26
|
-
replace: true,
|
27
|
-
to: { pathname: route.link, search: route.query },
|
28
|
-
}}
|
29
|
-
>
|
30
|
-
<ListItemButton
|
31
|
-
className={classnames({
|
32
|
-
active: isActive,
|
33
|
-
main: route.main,
|
34
|
-
collapsed,
|
35
|
-
})}
|
36
|
-
>
|
37
|
-
{route.icon && (
|
38
|
-
<ListItemIcon className={classnames({ collapsed })}>
|
39
|
-
{route.icon}
|
40
|
-
</ListItemIcon>
|
41
|
-
)}
|
42
|
-
<ListItemText
|
43
|
-
primary={route.name}
|
44
|
-
primaryTypographyProps={{ variant: 'body2' }}
|
45
|
-
className={classnames({ collapsed })}
|
46
|
-
/>
|
47
|
-
</ListItemButton>
|
48
|
-
</ListItem>
|
49
|
-
) : (
|
50
|
-
<ListSubheader>{route.name}</ListSubheader>
|
51
|
-
);
|
52
|
-
};
|
53
|
-
|
54
|
-
export default SidebarLinkItem;
|
@@ -1,62 +0,0 @@
|
|
1
|
-
import type { Route } from '../../../interfaces';
|
2
|
-
import {
|
3
|
-
ListItem,
|
4
|
-
ListItemButton,
|
5
|
-
ListItemIcon,
|
6
|
-
ListSubheader,
|
7
|
-
ListItemText,
|
8
|
-
} from '../Sidebar.styled';
|
9
|
-
import Box from '@mui/material/Box';
|
10
|
-
import ArrowIcon from '../../../assets/chevron_left.svg';
|
11
|
-
|
12
|
-
import classnames from 'classnames';
|
13
|
-
import { useSidebarContext } from '../SidebarContext';
|
14
|
-
|
15
|
-
type Props = {
|
16
|
-
route: Route;
|
17
|
-
isActive: boolean;
|
18
|
-
isListOpen: boolean;
|
19
|
-
handleClick: () => void;
|
20
|
-
};
|
21
|
-
|
22
|
-
function SidebarNestedItem({
|
23
|
-
route,
|
24
|
-
isActive,
|
25
|
-
isListOpen,
|
26
|
-
handleClick,
|
27
|
-
}: Props) {
|
28
|
-
const { collapsed } = useSidebarContext();
|
29
|
-
|
30
|
-
return route?.link ? (
|
31
|
-
<ListItem disablePadding onClick={handleClick}>
|
32
|
-
<ListItemButton
|
33
|
-
className={classnames({
|
34
|
-
active: isActive,
|
35
|
-
main: route.main,
|
36
|
-
collapsed,
|
37
|
-
})}
|
38
|
-
>
|
39
|
-
{route.icon && <ListItemIcon>{route.icon}</ListItemIcon>}
|
40
|
-
<ListItemText
|
41
|
-
primary={route.name}
|
42
|
-
primaryTypographyProps={{ variant: 'body2' }}
|
43
|
-
className={classnames({ collapsed })}
|
44
|
-
/>
|
45
|
-
<Box
|
46
|
-
component="img"
|
47
|
-
src={ArrowIcon}
|
48
|
-
mr={3}
|
49
|
-
sx={{
|
50
|
-
transition: 'transform .3s',
|
51
|
-
transform: `rotate(${isListOpen ? '-90deg' : 0})`,
|
52
|
-
opacity: collapsed ? 0 : 1,
|
53
|
-
}}
|
54
|
-
/>
|
55
|
-
</ListItemButton>
|
56
|
-
</ListItem>
|
57
|
-
) : (
|
58
|
-
<ListSubheader>{route.name}</ListSubheader>
|
59
|
-
);
|
60
|
-
}
|
61
|
-
|
62
|
-
export default SidebarNestedItem;
|
package/src/lib/Sidebar/index.ts
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
import useStyles from './styles';
|
2
|
-
import cn from 'classnames';
|
3
|
-
import { StatusVariant } from '../../interfaces';
|
4
|
-
|
5
|
-
type Props = {
|
6
|
-
text: string;
|
7
|
-
status?: StatusVariant;
|
8
|
-
};
|
9
|
-
|
10
|
-
export const Status = ({ text, status = 'default' }: Props) => {
|
11
|
-
const { classes } = useStyles();
|
12
|
-
|
13
|
-
return <div className={cn(classes['root'], { [status]: true })}>{text}</div>;
|
14
|
-
};
|
15
|
-
|
16
|
-
export default Status;
|
package/src/lib/Status/styles.ts
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
import { makeStyles } from 'tss-react/mui';
|
2
|
-
|
3
|
-
export default makeStyles()((theme) => ({
|
4
|
-
root: {
|
5
|
-
backgroundColor: '#eee',
|
6
|
-
fontSize: '14px',
|
7
|
-
padding: '0 8px',
|
8
|
-
borderRadius: '10px',
|
9
|
-
width: 'fit-content',
|
10
|
-
|
11
|
-
'&.success': {
|
12
|
-
backgroundColor: '#a9dfa9',
|
13
|
-
},
|
14
|
-
'&.error': {
|
15
|
-
backgroundColor: '#ff7e7e',
|
16
|
-
},
|
17
|
-
'&.warning': {
|
18
|
-
backgroundColor: theme.palette.warning.main,
|
19
|
-
},
|
20
|
-
},
|
21
|
-
}));
|
@@ -1,73 +0,0 @@
|
|
1
|
-
import { ReactNode } from 'react';
|
2
|
-
import Stepper from '@mui/material/Stepper';
|
3
|
-
import Step from '@mui/material/Step';
|
4
|
-
import StepLabel from '@mui/material/StepLabel';
|
5
|
-
import StepContent from '@mui/material/StepContent';
|
6
|
-
import StepConnector from '@mui/material/StepConnector';
|
7
|
-
import { makeStyles } from 'tss-react/mui';
|
8
|
-
|
9
|
-
export type StepperDataItem = { label: string | ReactNode; content: ReactNode };
|
10
|
-
|
11
|
-
export type StepperData = StepperDataItem[];
|
12
|
-
|
13
|
-
type Props = {
|
14
|
-
data: StepperData;
|
15
|
-
};
|
16
|
-
|
17
|
-
const useStyles = makeStyles()(() => ({
|
18
|
-
content: {
|
19
|
-
marginLeft: '4px',
|
20
|
-
},
|
21
|
-
connector: {
|
22
|
-
marginLeft: '4px',
|
23
|
-
},
|
24
|
-
stepper: {
|
25
|
-
padding: '12px',
|
26
|
-
},
|
27
|
-
label: {
|
28
|
-
display: 'flex',
|
29
|
-
alignItems: 'flex-start',
|
30
|
-
},
|
31
|
-
}));
|
32
|
-
|
33
|
-
const StepIcon = () => (
|
34
|
-
<div
|
35
|
-
style={{
|
36
|
-
display: 'inline-block',
|
37
|
-
width: '10px',
|
38
|
-
height: '10px',
|
39
|
-
borderRadius: '50%',
|
40
|
-
backgroundColor: '#536DFE',
|
41
|
-
marginTop: '5px',
|
42
|
-
}}
|
43
|
-
/>
|
44
|
-
);
|
45
|
-
|
46
|
-
export const StepperView = ({ data }: Props) => {
|
47
|
-
const { classes } = useStyles();
|
48
|
-
|
49
|
-
return (
|
50
|
-
<Stepper
|
51
|
-
nonLinear
|
52
|
-
orientation="vertical"
|
53
|
-
className={classes.stepper}
|
54
|
-
connector={<StepConnector className={classes.connector} />}
|
55
|
-
>
|
56
|
-
{data.filter(Boolean).map((item, index) => (
|
57
|
-
<Step expanded key={index}>
|
58
|
-
<StepLabel
|
59
|
-
className={classes.label}
|
60
|
-
StepIconComponent={StepIcon}
|
61
|
-
StepIconProps={{ icon: '', completed: false, active: true }}
|
62
|
-
>
|
63
|
-
{item.label}
|
64
|
-
</StepLabel>
|
65
|
-
<StepContent className={classes.content}>{item.content}</StepContent>
|
66
|
-
</Step>
|
67
|
-
))}
|
68
|
-
<Step />
|
69
|
-
</Stepper>
|
70
|
-
);
|
71
|
-
};
|
72
|
-
|
73
|
-
export default StepperView;
|
@@ -1,51 +0,0 @@
|
|
1
|
-
import { useCallback, MouseEvent } from 'react';
|
2
|
-
import Box from '@mui/material/Box';
|
3
|
-
import Tooltip from '@mui/material/Tooltip';
|
4
|
-
import SvgIcon from '@mui/material/SvgIcon';
|
5
|
-
import IconButton from '@mui/material/IconButton';
|
6
|
-
import { getJsonStringValue, useToggle } from '../../../utils';
|
7
|
-
import { CopyButton } from '../../Forms';
|
8
|
-
import { JsonView } from '../../JsonView';
|
9
|
-
import { JsonModalView } from '../../Modals';
|
10
|
-
|
11
|
-
const JsonTypeCell = ({
|
12
|
-
value,
|
13
|
-
copyButton = false,
|
14
|
-
textField = false,
|
15
|
-
}: {
|
16
|
-
value: any;
|
17
|
-
copyButton?: boolean;
|
18
|
-
textField?: boolean;
|
19
|
-
}) => {
|
20
|
-
const { open: jsonModalOpen, onOpen: onJsonModalOpen, onClose: onJsonModalClose } = useToggle();
|
21
|
-
|
22
|
-
const handleClickOpen = useCallback((e: MouseEvent) => {
|
23
|
-
e.stopPropagation();
|
24
|
-
onJsonModalOpen();
|
25
|
-
}, [onJsonModalOpen])
|
26
|
-
|
27
|
-
return (
|
28
|
-
<Box width="100%">
|
29
|
-
<Box display="flex" alignItems="center" justifyContent="flex-end" pt={1} mb={2}>
|
30
|
-
{copyButton && <CopyButton copyText={getJsonStringValue(value)} />}
|
31
|
-
<Tooltip title="Open" placement="top">
|
32
|
-
<IconButton size="small" onClick={handleClickOpen}>
|
33
|
-
<SvgIcon>
|
34
|
-
<path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z" />
|
35
|
-
</SvgIcon>
|
36
|
-
</IconButton>
|
37
|
-
</Tooltip>
|
38
|
-
</Box>
|
39
|
-
{textField ? (
|
40
|
-
<Box overflow="hidden" whiteSpace="nowrap">
|
41
|
-
{typeof value === 'object' ? JSON.stringify(value) : value}
|
42
|
-
</Box>
|
43
|
-
) : (
|
44
|
-
<JsonView value={value} />
|
45
|
-
)}
|
46
|
-
<JsonModalView open={jsonModalOpen} value={getJsonStringValue(value)} onClose={onJsonModalClose} />
|
47
|
-
</Box>
|
48
|
-
);
|
49
|
-
};
|
50
|
-
|
51
|
-
export default JsonTypeCell;
|