@dartech/arsenal-ui 1.3.0 → 1.3.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} +5 -5
- package/index.js +1 -0
- package/package.json +10 -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/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/styled.d.ts +18 -0
- package/src/lib/Property/PropertyFiller/usePropertyFiller.d.ts +24 -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/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 +44 -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 +16 -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 -89
- 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 -41
- 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 -134
- 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,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;
|
@@ -1,117 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import TablePagination from './TablePagination';
|
3
|
-
import TableColumnMenu from './TableColumnMenu';
|
4
|
-
import useTableQueryPagination from './useTableQueryPagination';
|
5
|
-
import useTableQuerySorting from './useTableQuerySorting';
|
6
|
-
import usePagination from './usePagination';
|
7
|
-
import { DataGrid, GridCellParams, GridColumns, GridFeatureMode, GridRowsProp } from '@mui/x-data-grid';
|
8
|
-
import useStyles from './styles';
|
9
|
-
import Box from '@mui/material/Box';
|
10
|
-
|
11
|
-
/**
|
12
|
-
* This interface is referencing the [[Table]] component props.
|
13
|
-
* @category Common UI components
|
14
|
-
*/
|
15
|
-
export interface TableProps {
|
16
|
-
/**
|
17
|
-
* Data loading state
|
18
|
-
*/
|
19
|
-
loading?: boolean;
|
20
|
-
/**
|
21
|
-
* Table columns
|
22
|
-
*/
|
23
|
-
columns: GridColumns;
|
24
|
-
/**
|
25
|
-
* Table rows
|
26
|
-
*/
|
27
|
-
rows: GridRowsProp;
|
28
|
-
/**
|
29
|
-
* Rows count to display
|
30
|
-
*/
|
31
|
-
rowCount: number;
|
32
|
-
disableMargin?: boolean;
|
33
|
-
/**
|
34
|
-
* Data display mode.
|
35
|
-
* Values: `client` | `server`;
|
36
|
-
* Default: `server`
|
37
|
-
*/
|
38
|
-
mode?: GridFeatureMode;
|
39
|
-
/**
|
40
|
-
* Page size. Default `10`
|
41
|
-
*/
|
42
|
-
initialPageSize?: number;
|
43
|
-
/**
|
44
|
-
* On cell click handler function
|
45
|
-
* ```typescript
|
46
|
-
* (params: GridCellParams, event: React.MouseEvent) => void;
|
47
|
-
* ```
|
48
|
-
*/
|
49
|
-
onCellClick?: (params: GridCellParams, event: React.MouseEvent) => void;
|
50
|
-
pagination?: boolean;
|
51
|
-
}
|
52
|
-
|
53
|
-
/**
|
54
|
-
* Main data display component. MUI DataGrid used
|
55
|
-
* @category Common UI components
|
56
|
-
*/
|
57
|
-
export const Table = ({
|
58
|
-
columns,
|
59
|
-
rows,
|
60
|
-
rowCount,
|
61
|
-
loading,
|
62
|
-
disableMargin,
|
63
|
-
mode = 'server',
|
64
|
-
initialPageSize = 10,
|
65
|
-
pagination = true,
|
66
|
-
onCellClick,
|
67
|
-
}: TableProps) => {
|
68
|
-
const { classes } = useStyles();
|
69
|
-
|
70
|
-
const { page, size, onPageChange, onSizeChange } = useTableQueryPagination({ mode });
|
71
|
-
const { onColumnHeaderClick, getSortedColumns } = useTableQuerySorting();
|
72
|
-
|
73
|
-
const { pageSize, handlePageSizeChange } = usePagination(initialPageSize);
|
74
|
-
|
75
|
-
const tableProps = {
|
76
|
-
sortingMode: mode,
|
77
|
-
paginationMode: mode,
|
78
|
-
pageSize: mode === 'server' ? size : pagination ? pageSize : rowCount,
|
79
|
-
onPageSizeChange: mode === 'server' ? onSizeChange : handlePageSizeChange,
|
80
|
-
components: {
|
81
|
-
Pagination: TablePagination,
|
82
|
-
},
|
83
|
-
};
|
84
|
-
|
85
|
-
if (mode === 'server') {
|
86
|
-
tableProps['sortModel'] = [];
|
87
|
-
tableProps['onColumnHeaderClick'] = onColumnHeaderClick;
|
88
|
-
tableProps['page'] = page;
|
89
|
-
tableProps['onPageChange'] = onPageChange;
|
90
|
-
tableProps.components['ColumnMenu'] = TableColumnMenu;
|
91
|
-
}
|
92
|
-
|
93
|
-
|
94
|
-
return (
|
95
|
-
<Box mt={disableMargin ? 0 : 2}>
|
96
|
-
<DataGrid
|
97
|
-
autoHeight
|
98
|
-
hideFooterPagination={!pagination}
|
99
|
-
hideFooter={!pagination}
|
100
|
-
disableSelectionOnClick
|
101
|
-
showColumnRightBorder
|
102
|
-
showCellRightBorder
|
103
|
-
className={classes.root}
|
104
|
-
loading={loading}
|
105
|
-
rows={rows}
|
106
|
-
columns={getSortedColumns(columns)}
|
107
|
-
rowCount={rowCount}
|
108
|
-
rowsPerPageOptions={[10, 20, 50, 100]}
|
109
|
-
onCellClick={onCellClick}
|
110
|
-
{...tableProps}
|
111
|
-
/>
|
112
|
-
|
113
|
-
</Box>
|
114
|
-
);
|
115
|
-
};
|
116
|
-
|
117
|
-
export default Table;
|
@@ -1,43 +0,0 @@
|
|
1
|
-
import Tooltip from '@mui/material/Tooltip';
|
2
|
-
import { GridActionsCellItem } from '@mui/x-data-grid';
|
3
|
-
import IconButton from '@mui/material/IconButton';
|
4
|
-
import { Link } from 'react-router-dom';
|
5
|
-
import React, { ReactElement } from 'react';
|
6
|
-
|
7
|
-
type Props = {
|
8
|
-
icon: ReactElement;
|
9
|
-
onClick?: () => void;
|
10
|
-
label: string;
|
11
|
-
showInMenu?: boolean;
|
12
|
-
location?: {
|
13
|
-
pathname: string;
|
14
|
-
state?: Record<string, unknown>;
|
15
|
-
}
|
16
|
-
};
|
17
|
-
|
18
|
-
export const TableAction = ({ icon, label, showInMenu, onClick, location }: Props) => {
|
19
|
-
if (location) {
|
20
|
-
return (
|
21
|
-
<IconButton component={Link} to={location} size="small">
|
22
|
-
<Tooltip title={label} arrow>
|
23
|
-
{React.cloneElement(icon, { fontSize: 'small' })}
|
24
|
-
</Tooltip>
|
25
|
-
</IconButton>
|
26
|
-
)
|
27
|
-
}
|
28
|
-
return (
|
29
|
-
<GridActionsCellItem
|
30
|
-
nonce=""
|
31
|
-
onResize={undefined}
|
32
|
-
onResizeCapture={undefined}
|
33
|
-
icon={
|
34
|
-
<Tooltip title={label} arrow>
|
35
|
-
{icon}
|
36
|
-
</Tooltip>
|
37
|
-
}
|
38
|
-
onClick={onClick}
|
39
|
-
label={label}
|
40
|
-
showInMenu={showInMenu}
|
41
|
-
/>
|
42
|
-
);
|
43
|
-
};
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { GridColumnMenuContainer, GridFilterMenuItem } from '@mui/x-data-grid';
|
3
|
-
|
4
|
-
const TableColumnMenu = ({ hideMenu, currentColumn, onUnsort, ...rest }: any) => {
|
5
|
-
return (
|
6
|
-
<GridColumnMenuContainer hideMenu={hideMenu} currentColumn={currentColumn} {...rest}>
|
7
|
-
<GridFilterMenuItem onClick={hideMenu} column={currentColumn} />
|
8
|
-
</GridColumnMenuContainer>
|
9
|
-
);
|
10
|
-
};
|
11
|
-
|
12
|
-
export default TableColumnMenu;
|
@@ -1,42 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import Box from '@mui/material/Box';
|
3
|
-
import Pagination from '@mui/material/Pagination';
|
4
|
-
import MuiTablePagination from '@mui/material/TablePagination';
|
5
|
-
import {
|
6
|
-
gridPageCountSelector,
|
7
|
-
gridPageSelector,
|
8
|
-
gridRowCountSelector,
|
9
|
-
gridPageSizeSelector,
|
10
|
-
useGridApiContext,
|
11
|
-
useGridSelector,
|
12
|
-
} from '@mui/x-data-grid';
|
13
|
-
|
14
|
-
const TablePagination = () => {
|
15
|
-
const apiRef = useGridApiContext();
|
16
|
-
const page = useGridSelector(apiRef, gridPageSelector);
|
17
|
-
const pageCount = useGridSelector(apiRef, gridPageCountSelector);
|
18
|
-
const rowCount = useGridSelector(apiRef, gridRowCountSelector);
|
19
|
-
const pageSize = useGridSelector(apiRef, gridPageSizeSelector);
|
20
|
-
|
21
|
-
const onPageChange = (value) => apiRef.current.setPage(value);
|
22
|
-
const onRowsPerPageChange = (event: React.ChangeEvent<HTMLInputElement>) =>
|
23
|
-
apiRef.current.setPageSize(parseInt(event.target.value, 10));
|
24
|
-
|
25
|
-
return (
|
26
|
-
<Box px={2} display="flex" alignItems="center">
|
27
|
-
<MuiTablePagination
|
28
|
-
component="div"
|
29
|
-
page={page}
|
30
|
-
count={rowCount}
|
31
|
-
rowsPerPage={pageSize}
|
32
|
-
rowsPerPageOptions={[10, 20, 50, 100]}
|
33
|
-
onPageChange={(event, value) => onPageChange(value)}
|
34
|
-
onRowsPerPageChange={onRowsPerPageChange}
|
35
|
-
ActionsComponent={undefined}
|
36
|
-
/>
|
37
|
-
<Pagination count={pageCount} page={page + 1} onChange={(event, value) => onPageChange(value - 1)} />
|
38
|
-
</Box>
|
39
|
-
);
|
40
|
-
};
|
41
|
-
|
42
|
-
export default TablePagination;
|
@@ -1,59 +0,0 @@
|
|
1
|
-
import { makeStyles } from 'tss-react/mui';
|
2
|
-
|
3
|
-
export default makeStyles()({
|
4
|
-
root: {
|
5
|
-
width: '100%',
|
6
|
-
|
7
|
-
'& .MuiDataGrid-virtualScrollerContent': {
|
8
|
-
height: 'auto !important',
|
9
|
-
minHeight: '56px !important',
|
10
|
-
},
|
11
|
-
|
12
|
-
'& .MuiDataGrid-virtualScrollerRenderZone': {
|
13
|
-
position: 'static',
|
14
|
-
},
|
15
|
-
|
16
|
-
'& .MuiDataGrid-renderingZone': {
|
17
|
-
maxHeight: 'none !important',
|
18
|
-
},
|
19
|
-
|
20
|
-
'& .MuiDataGrid-cell': {
|
21
|
-
maxHeight: 'none !important',
|
22
|
-
lineHeight: 'unset !important',
|
23
|
-
// whiteSpace: 'normal !important',
|
24
|
-
textOverflow: 'ellipsis',
|
25
|
-
wordBreak: 'break-all',
|
26
|
-
|
27
|
-
'& .MuiDataGrid-actionsCell': {
|
28
|
-
width: '100%',
|
29
|
-
gridGap: '4px',
|
30
|
-
flexWrap: 'wrap',
|
31
|
-
|
32
|
-
'& > button[aria-label="more"]': {
|
33
|
-
marginLeft: 'auto',
|
34
|
-
},
|
35
|
-
},
|
36
|
-
},
|
37
|
-
|
38
|
-
'& .MuiDataGrid-row': {
|
39
|
-
maxHeight: 'none !important',
|
40
|
-
},
|
41
|
-
|
42
|
-
'& .Sorted': {
|
43
|
-
'& .MuiDataGrid-iconButtonContainer': {
|
44
|
-
visibility: 'visible',
|
45
|
-
width: 'auto',
|
46
|
-
|
47
|
-
'& svg': {
|
48
|
-
opacity: '1 !important',
|
49
|
-
},
|
50
|
-
},
|
51
|
-
|
52
|
-
'&.--desc': {
|
53
|
-
'& svg': {
|
54
|
-
transform: 'rotate(180deg)',
|
55
|
-
},
|
56
|
-
},
|
57
|
-
},
|
58
|
-
},
|
59
|
-
});
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import { useEffect, useState } from 'react';
|
2
|
-
|
3
|
-
const usePagination = (initialPageSize?: number) => {
|
4
|
-
const [pageSize, setPageSize] = useState(10);
|
5
|
-
|
6
|
-
useEffect(() => {
|
7
|
-
setPageSize(initialPageSize);
|
8
|
-
}, [initialPageSize]);
|
9
|
-
|
10
|
-
const handlePageSizeChange = (size) => setPageSize(size);
|
11
|
-
|
12
|
-
return { pageSize, handlePageSizeChange };
|
13
|
-
};
|
14
|
-
|
15
|
-
export default usePagination;
|
@@ -1,47 +0,0 @@
|
|
1
|
-
import { useEffect } from 'react';
|
2
|
-
import { useSearchParams } from 'react-router-dom';
|
3
|
-
import { GridFeatureMode } from '@mui/x-data-grid';
|
4
|
-
|
5
|
-
interface Props {
|
6
|
-
mode: GridFeatureMode;
|
7
|
-
}
|
8
|
-
|
9
|
-
export const useTableQueryPagination = ({ mode }: Props) => {
|
10
|
-
const [queryParams, setQueryParams] = useSearchParams();
|
11
|
-
|
12
|
-
const page = +queryParams.get('page') || 0;
|
13
|
-
const size = +queryParams.get('size') || 10;
|
14
|
-
|
15
|
-
const onPageChange = (newPage: number) => {
|
16
|
-
queryParams.set('page', `${newPage}`);
|
17
|
-
setQueryParams(queryParams, { replace: true });
|
18
|
-
};
|
19
|
-
|
20
|
-
const onSizeChange = (count: number) => {
|
21
|
-
queryParams.set('size', `${count}`);
|
22
|
-
setQueryParams(queryParams, { replace: true });
|
23
|
-
};
|
24
|
-
|
25
|
-
useEffect(() => {
|
26
|
-
if (mode === 'server') {
|
27
|
-
if (!queryParams.has('page')) {
|
28
|
-
queryParams.set('page', '0');
|
29
|
-
}
|
30
|
-
|
31
|
-
if (!queryParams.has('size')) {
|
32
|
-
queryParams.set('size', `10`);
|
33
|
-
}
|
34
|
-
|
35
|
-
setQueryParams(queryParams, { replace: true });
|
36
|
-
}
|
37
|
-
}, [mode, queryParams, setQueryParams]);
|
38
|
-
|
39
|
-
return {
|
40
|
-
page,
|
41
|
-
size,
|
42
|
-
onPageChange,
|
43
|
-
onSizeChange,
|
44
|
-
};
|
45
|
-
};
|
46
|
-
|
47
|
-
export default useTableQueryPagination;
|
@@ -1,47 +0,0 @@
|
|
1
|
-
import { useSearchParams } from 'react-router-dom';
|
2
|
-
import { GridColumnHeaderParams, GridColumns } from '@mui/x-data-grid';
|
3
|
-
|
4
|
-
export const useTableQuerySorting = () => {
|
5
|
-
const [queryParams, setQueryParams] = useSearchParams();
|
6
|
-
const sortParams = queryParams.getAll('sort').map((param) => param.split(','));
|
7
|
-
|
8
|
-
const onColumnHeaderClick = ({ field }: GridColumnHeaderParams) => {
|
9
|
-
let keyFound = false;
|
10
|
-
|
11
|
-
const sortValues = queryParams.getAll('sort');
|
12
|
-
queryParams.delete('sort');
|
13
|
-
|
14
|
-
sortValues.forEach((sortValue) => {
|
15
|
-
const [key, sort] = sortValue.split(',');
|
16
|
-
if (key === field) {
|
17
|
-
keyFound = true;
|
18
|
-
if (sort === 'asc') {
|
19
|
-
queryParams.append('sort', `${key},desc`);
|
20
|
-
}
|
21
|
-
} else {
|
22
|
-
queryParams.append('sort', `${key},${sort}`);
|
23
|
-
}
|
24
|
-
});
|
25
|
-
|
26
|
-
if (!keyFound) {
|
27
|
-
queryParams.append('sort', `${field},asc`);
|
28
|
-
}
|
29
|
-
setQueryParams(queryParams, { replace: true });
|
30
|
-
};
|
31
|
-
|
32
|
-
const getSortedColumns = (columns: GridColumns): GridColumns => {
|
33
|
-
return columns.map((column) => {
|
34
|
-
const columnSort = sortParams.find((param) => param[0] === column.field);
|
35
|
-
if (columnSort) {
|
36
|
-
column.headerClassName = `Sorted --${columnSort[1]} `;
|
37
|
-
} else {
|
38
|
-
column.headerClassName = '';
|
39
|
-
}
|
40
|
-
return column;
|
41
|
-
});
|
42
|
-
};
|
43
|
-
|
44
|
-
return { onColumnHeaderClick, getSortedColumns };
|
45
|
-
};
|
46
|
-
|
47
|
-
export default useTableQuerySorting;
|