@applica-software-guru/react-admin 1.0.42 → 1.0.44
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/bitbucket-pipelines.yml +2 -0
- package/dist/ApplicaAdmin.d.ts.map +1 -1
- package/dist/components/@extended/AnimateButton.d.ts +1 -1
- package/dist/components/@extended/AnimateButton.d.ts.map +1 -1
- package/dist/components/@extended/Avatar.d.ts.map +1 -1
- package/dist/components/@extended/Breadcrumbs.d.ts.map +1 -1
- package/dist/components/@extended/IconButton.d.ts.map +1 -1
- package/dist/components/@extended/LoadingButton.d.ts.map +1 -1
- package/dist/components/@extended/Tooltip.d.ts.map +1 -1
- package/dist/components/@extended/Transitions.d.ts.map +1 -1
- package/dist/components/@extended/progress/CircularWithLabel.d.ts.map +1 -1
- package/dist/components/@extended/progress/CircularWithPath.d.ts.map +1 -1
- package/dist/components/ActionsMenu.d.ts +30 -0
- package/dist/components/ActionsMenu.d.ts.map +1 -0
- package/dist/components/Layout/Drawer/DrawerContent/Navigation/NavCollapse.d.ts +1 -1
- package/dist/components/Layout/Drawer/DrawerContent/Navigation/NavCollapse.d.ts.map +1 -1
- package/dist/components/Layout/Drawer/DrawerContent/Navigation/NavGroup.d.ts.map +1 -1
- package/dist/components/Layout/Drawer/DrawerContent/Navigation/NavItem.d.ts.map +1 -1
- package/dist/components/Layout/Drawer/DrawerHeader/DrawerHeaderStyled.d.ts.map +1 -1
- package/dist/components/Layout/Drawer/DrawerHeader/index.d.ts.map +1 -1
- package/dist/components/Layout/Drawer/MiniDrawerStyled.d.ts.map +1 -1
- package/dist/components/Layout/Drawer/index.d.ts.map +1 -1
- package/dist/components/Layout/Footer.d.ts.map +1 -1
- package/dist/components/Layout/Header/AppBarStyled.d.ts.map +1 -1
- package/dist/components/Layout/Header/HeaderContent/Notification.d.ts.map +1 -1
- package/dist/components/Layout/Header/HeaderContent/NotificationItem.d.ts.map +1 -1
- package/dist/components/Layout/Header/HeaderContent/Profile.d.ts.map +1 -1
- package/dist/components/Layout/Header/HeaderContent/index.d.ts.map +1 -1
- package/dist/components/Layout/Header/index.d.ts.map +1 -1
- package/dist/components/Layout/index.d.ts.map +1 -1
- package/dist/components/MenuPopover/styles.d.ts.map +1 -1
- package/dist/components/Notification.d.ts.map +1 -1
- package/dist/components/ScrollX.d.ts.map +1 -1
- package/dist/components/ra-buttons/CreateInDialogButton.d.ts +62 -0
- package/dist/components/ra-buttons/CreateInDialogButton.d.ts.map +1 -0
- package/dist/components/ra-buttons/EditInDialogButton.d.ts.map +1 -1
- package/dist/components/ra-custom/ListItem.d.ts +45 -0
- package/dist/components/ra-custom/ListItem.d.ts.map +1 -0
- package/dist/components/ra-custom/index.d.ts +3 -0
- package/dist/components/ra-custom/index.d.ts.map +1 -0
- package/dist/components/ra-fields/AttachmentField.d.ts +36 -0
- package/dist/components/ra-fields/AttachmentField.d.ts.map +1 -0
- package/dist/components/ra-fields/BaseAttachmentField.d.ts +32 -0
- package/dist/components/ra-fields/BaseAttachmentField.d.ts.map +1 -0
- package/dist/components/ra-fields/CoverField.d.ts.map +1 -1
- package/dist/components/ra-fields/DateAgoField.d.ts.map +1 -1
- package/dist/components/ra-fields/ReadonlyField.d.ts.map +1 -1
- package/dist/components/ra-forms/CardForm.d.ts.map +1 -1
- package/dist/components/ra-forms/FormHeader.d.ts +29 -0
- package/dist/components/ra-forms/FormHeader.d.ts.map +1 -0
- package/dist/components/ra-forms/LongForm/LongForm.d.ts +98 -0
- package/dist/components/ra-forms/LongForm/LongForm.d.ts.map +1 -0
- package/dist/components/ra-forms/LongForm/LongFormSidebar.d.ts +34 -0
- package/dist/components/ra-forms/LongForm/LongFormSidebar.d.ts.map +1 -0
- package/dist/components/ra-forms/LongForm/LongFormTab.d.ts +45 -0
- package/dist/components/ra-forms/LongForm/LongFormTab.d.ts.map +1 -0
- package/dist/components/ra-forms/LongForm/LongFormTabs.d.ts +23 -0
- package/dist/components/ra-forms/LongForm/LongFormTabs.d.ts.map +1 -0
- package/dist/components/ra-forms/LongForm/LongFormView.d.ts +42 -0
- package/dist/components/ra-forms/LongForm/LongFormView.d.ts.map +1 -0
- package/dist/components/ra-forms/LongForm/index.d.ts +3 -0
- package/dist/components/ra-forms/LongForm/index.d.ts.map +1 -0
- package/dist/components/ra-forms/LongForm/useFormRootPath.d.ts.map +1 -1
- package/dist/components/ra-forms/SimpleForm.d.ts +40 -0
- package/dist/components/ra-forms/SimpleForm.d.ts.map +1 -0
- package/dist/components/ra-forms/SimpleFormIterator.d.ts +6 -0
- package/dist/components/ra-forms/SimpleFormIterator.d.ts.map +1 -0
- package/dist/components/ra-forms/TabbedForm.d.ts.map +1 -1
- package/dist/components/ra-inputs/ArrayInput.d.ts +13 -0
- package/dist/components/ra-inputs/ArrayInput.d.ts.map +1 -0
- package/dist/components/ra-inputs/LabeledArrayInput.d.ts +42 -0
- package/dist/components/ra-inputs/LabeledArrayInput.d.ts.map +1 -0
- package/dist/components/ra-inputs/ReferenceManyInput.d.ts.map +1 -1
- package/dist/components/ra-lists/Empty.d.ts.map +1 -1
- package/dist/components/ra-lists/NotificationList/NotificationList.d.ts.map +1 -1
- package/dist/components/ra-lists/NotificationList/button/MarkAsReadedButton.d.ts.map +1 -1
- package/dist/components/ra-lists/NotificationList/field/NotificationField.d.ts.map +1 -1
- package/dist/contexts/AppConfigContext.d.ts +32 -0
- package/dist/contexts/AppConfigContext.d.ts.map +1 -0
- package/dist/contexts/MenuConfigContext.d.ts.map +1 -1
- package/dist/contexts/MenuPropTypes.d.ts.map +1 -1
- package/dist/dev/useCliErrorCatcher.d.ts +1 -1
- package/dist/hooks/useMenu.d.ts.map +1 -1
- package/dist/i18n/useI18nCatcher.d.ts +1 -1
- package/dist/i18n/useI18nLanguages.d.ts +1 -1
- package/dist/i18n/useI18nLanguages.d.ts.map +1 -1
- package/dist/i18n/useI18nProvider.d.ts.map +1 -1
- package/dist/react-admin.cjs.js +1 -1
- package/dist/react-admin.cjs.js.map +1 -1
- package/dist/react-admin.es.js +299 -784
- package/dist/react-admin.es.js.map +1 -1
- package/dist/react-admin.umd.js +1 -1
- package/dist/react-admin.umd.js.map +1 -1
- package/dist/themes/overrides/OutlinedInput.d.ts.map +1 -1
- package/dist/themes/palette.d.ts.map +1 -1
- package/dist/themes/theme/theme1.d.ts.map +1 -1
- package/dist/themes/theme/theme2.d.ts.map +1 -1
- package/dist/themes/theme/theme3.d.ts.map +1 -1
- package/dist/themes/theme/theme4.d.ts.map +1 -1
- package/dist/themes/theme/theme5.d.ts.map +1 -1
- package/dist/themes/theme/theme6.d.ts.map +1 -1
- package/dist/themes/theme/theme7.d.ts.map +1 -1
- package/dist/themes/theme/theme8.d.ts.map +1 -1
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/lang.d.ts +1 -1
- package/dist/utils/lang.d.ts.map +1 -1
- package/dist/utils/time.d.ts +2 -1
- package/dist/utils/time.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/Admin.jsx +8 -8
- package/src/AdminContext.jsx +9 -9
- package/src/ApplicaAdmin.jsx +30 -35
- package/src/components/@extended/AnimateButton.jsx +25 -33
- package/src/components/@extended/Avatar.jsx +35 -42
- package/src/components/@extended/Breadcrumbs.jsx +62 -96
- package/src/components/@extended/Dot.jsx +14 -14
- package/src/components/@extended/IconButton.jsx +55 -65
- package/src/components/@extended/LoadingButton.jsx +84 -86
- package/src/components/@extended/Tooltip.jsx +24 -27
- package/src/components/@extended/Transitions.jsx +98 -107
- package/src/components/@extended/index.jsx +10 -10
- package/src/components/@extended/progress/CircularWithLabel.jsx +7 -9
- package/src/components/@extended/progress/CircularWithPath.jsx +9 -18
- package/src/components/@extended/progress/LinearWithIcon.jsx +5 -5
- package/src/components/@extended/progress/LinearWithLabel.jsx +5 -5
- package/src/components/@extended/progress/index.jsx +5 -5
- package/src/components/Layout/Drawer/DrawerContent/Navigation/NavCollapse.jsx +112 -131
- package/src/components/Layout/Drawer/DrawerContent/Navigation/NavGroup.jsx +67 -88
- package/src/components/Layout/Drawer/DrawerContent/Navigation/NavItem.jsx +63 -79
- package/src/components/Layout/Drawer/DrawerContent/Navigation/index.jsx +28 -28
- package/src/components/Layout/Drawer/DrawerContent/index.jsx +7 -7
- package/src/components/Layout/Drawer/DrawerHeader/DrawerHeaderStyled.jsx +13 -15
- package/src/components/Layout/Drawer/DrawerHeader/index.jsx +17 -22
- package/src/components/Layout/Drawer/HorizontalBar.jsx +17 -17
- package/src/components/Layout/Drawer/MiniDrawerStyled.jsx +27 -29
- package/src/components/Layout/Drawer/index.jsx +21 -24
- package/src/components/Layout/Footer.jsx +7 -12
- package/src/components/Layout/Header/AppBarStyled.jsx +26 -28
- package/src/components/Layout/Header/HeaderContent/MobileSection.jsx +27 -27
- package/src/components/Layout/Header/HeaderContent/Notification.jsx +34 -55
- package/src/components/Layout/Header/HeaderContent/NotificationItem.jsx +24 -36
- package/src/components/Layout/Header/HeaderContent/Profile.jsx +48 -73
- package/src/components/Layout/Header/HeaderContent/index.jsx +16 -18
- package/src/components/Layout/Header/index.jsx +25 -43
- package/src/components/Layout/index.jsx +36 -52
- package/src/components/Loadable.jsx +4 -4
- package/src/components/Loader.jsx +7 -7
- package/src/components/Logo.jsx +14 -14
- package/src/components/MainIcon.jsx +6 -6
- package/src/components/MenuPopover/MenuPopover.jsx +15 -15
- package/src/components/MenuPopover/getPosition.jsx +40 -40
- package/src/components/MenuPopover/index.jsx +3 -3
- package/src/components/MenuPopover/styles.jsx +20 -20
- package/src/components/Notification.jsx +7 -7
- package/src/components/ScrollTop.jsx +13 -13
- package/src/components/ScrollX.jsx +4 -4
- package/src/components/SmallIcon.jsx +6 -6
- package/src/components/ra-buttons/EditInDialogButton.jsx +39 -45
- package/src/components/ra-buttons/ImpersonateUserButton.jsx +20 -20
- package/src/components/ra-buttons/index.jsx +4 -4
- package/src/components/ra-fields/ActionsField.jsx +12 -12
- package/src/components/ra-fields/CoverField.jsx +20 -26
- package/src/components/ra-fields/DateAgoField.jsx +17 -20
- package/src/components/ra-fields/DateField.jsx +14 -14
- package/src/components/ra-fields/EmailField.jsx +14 -14
- package/src/components/ra-fields/FileField.jsx +23 -23
- package/src/components/ra-fields/FunctionField.jsx +5 -5
- package/src/components/ra-fields/ImageField.jsx +11 -11
- package/src/components/ra-fields/ReadonlyField.jsx +40 -42
- package/src/components/ra-fields/ReferenceManyField.jsx +21 -21
- package/src/components/ra-fields/SizeField.jsx +15 -15
- package/src/components/ra-fields/TextField.jsx +14 -14
- package/src/components/ra-fields/index.jsx +15 -15
- package/src/components/ra-forms/CardForm.jsx +34 -40
- package/src/components/ra-forms/LongForm/useFormRootPath.ts +8 -13
- package/src/components/ra-forms/SimpleForm.tsx +5 -1
- package/src/components/ra-forms/TabbedForm.jsx +10 -10
- package/src/components/ra-forms/Toolbar.jsx +15 -15
- package/src/components/ra-forms/index.jsx +9 -9
- package/src/components/ra-inputs/AutocompleteArrayInput.jsx +7 -7
- package/src/components/ra-inputs/AutocompleteInput.jsx +9 -9
- package/src/components/ra-inputs/BooleanInput.jsx +19 -19
- package/src/components/ra-inputs/DateInput.jsx +13 -13
- package/src/components/ra-inputs/FileInput.jsx +33 -33
- package/src/components/ra-inputs/ImageInput.jsx +19 -19
- package/src/components/ra-inputs/NumberInput.jsx +13 -13
- package/src/components/ra-inputs/RecordInput.jsx +39 -39
- package/src/components/ra-inputs/ReferenceArrayInput.jsx +10 -10
- package/src/components/ra-inputs/ReferenceInput.jsx +10 -10
- package/src/components/ra-inputs/ReferenceManyInput.jsx +13 -24
- package/src/components/ra-inputs/SearchInput.jsx +6 -6
- package/src/components/ra-inputs/SelectArrayInput.jsx +19 -19
- package/src/components/ra-inputs/TimeInput.jsx +21 -21
- package/src/components/ra-lists/Empty.jsx +32 -37
- package/src/components/ra-lists/List.jsx +9 -9
- package/src/components/ra-lists/NotificationList/NotificationList.jsx +14 -16
- package/src/components/ra-lists/NotificationList/button/MarkAsReadedButton.jsx +21 -25
- package/src/components/ra-lists/NotificationList/button/MarkAsUnreadedButton.jsx +19 -19
- package/src/components/ra-lists/NotificationList/button/index.jsx +2 -2
- package/src/components/ra-lists/NotificationList/field/NotificationField.jsx +20 -31
- package/src/components/ra-lists/NotificationList/field/index.jsx +1 -1
- package/src/components/ra-lists/NotificationList/index.jsx +2 -2
- package/src/components/ra-lists/index.jsx +5 -5
- package/src/components/third-party/SimpleBar.jsx +10 -10
- package/src/components/third-party/index.jsx +2 -2
- package/src/contexts/MenuConfigContext.jsx +35 -35
- package/src/contexts/MenuPropTypes.jsx +7 -7
- package/src/contexts/index.jsx +5 -5
- package/src/dev/index.jsx +2 -2
- package/src/dev/useCliErrorCatcher.jsx +32 -32
- package/src/hooks/index.jsx +8 -16
- package/src/hooks/useAppConfig.jsx +4 -4
- package/src/hooks/useBreadcrumbs.jsx +37 -37
- package/src/hooks/useLocalStorage.jsx +16 -16
- package/src/hooks/useMenu.jsx +83 -88
- package/src/hooks/useMenuConfig.jsx +4 -4
- package/src/hooks/useResourceTitle.jsx +13 -13
- package/src/hooks/useThemeConfig.jsx +4 -4
- package/src/i18n/createI18nProvider.jsx +7 -7
- package/src/i18n/index.jsx +4 -4
- package/src/i18n/useI18nCatcher.jsx +26 -26
- package/src/i18n/useI18nLanguages.jsx +12 -16
- package/src/i18n/useI18nProvider.jsx +3 -4
- package/src/themes/getColors.jsx +8 -8
- package/src/themes/getShadow.jsx +17 -17
- package/src/themes/index.jsx +29 -29
- package/src/themes/overrides/Accordion.jsx +9 -9
- package/src/themes/overrides/AccordionDetails.jsx +5 -5
- package/src/themes/overrides/AccordionSummary.jsx +11 -11
- package/src/themes/overrides/Alert.jsx +21 -21
- package/src/themes/overrides/AlertTitle.jsx +5 -5
- package/src/themes/overrides/Autocomplete.jsx +9 -9
- package/src/themes/overrides/Badge.jsx +12 -12
- package/src/themes/overrides/Button.jsx +62 -62
- package/src/themes/overrides/ButtonBase.jsx +4 -4
- package/src/themes/overrides/ButtonGroup.jsx +4 -4
- package/src/themes/overrides/CardContent.jsx +6 -6
- package/src/themes/overrides/Checkbox.jsx +31 -31
- package/src/themes/overrides/Chip.jsx +22 -22
- package/src/themes/overrides/Dialog.jsx +7 -7
- package/src/themes/overrides/DialogContentText.jsx +5 -5
- package/src/themes/overrides/DialogTitle.jsx +5 -5
- package/src/themes/overrides/Fab.jsx +21 -21
- package/src/themes/overrides/IconButton.jsx +8 -8
- package/src/themes/overrides/InputBase.jsx +3 -3
- package/src/themes/overrides/InputLabel.jsx +8 -8
- package/src/themes/overrides/LinearProgress.jsx +6 -6
- package/src/themes/overrides/Link.jsx +4 -4
- package/src/themes/overrides/ListItemButton.jsx +7 -7
- package/src/themes/overrides/ListItemIcon.jsx +5 -5
- package/src/themes/overrides/LoadingButton.jsx +6 -6
- package/src/themes/overrides/OutlinedInput.jsx +20 -21
- package/src/themes/overrides/Pagination.jsx +4 -4
- package/src/themes/overrides/PaginationItem.jsx +55 -55
- package/src/themes/overrides/Popover.jsx +5 -5
- package/src/themes/overrides/Radio.jsx +30 -30
- package/src/themes/overrides/Slider.jsx +20 -20
- package/src/themes/overrides/Switch.jsx +26 -26
- package/src/themes/overrides/Tab.jsx +7 -7
- package/src/themes/overrides/TableBody.jsx +11 -11
- package/src/themes/overrides/TableCell.jsx +12 -12
- package/src/themes/overrides/TableFooter.jsx +5 -5
- package/src/themes/overrides/TableHead.jsx +5 -5
- package/src/themes/overrides/TablePagination.jsx +6 -6
- package/src/themes/overrides/TableRow.jsx +10 -10
- package/src/themes/overrides/Tabs.jsx +5 -5
- package/src/themes/overrides/ToggleButton.jsx +7 -7
- package/src/themes/overrides/Tooltip.jsx +5 -5
- package/src/themes/overrides/TreeItem.jsx +7 -7
- package/src/themes/overrides/Typography.jsx +5 -5
- package/src/themes/overrides/index.jsx +47 -47
- package/src/themes/palette.jsx +22 -34
- package/src/themes/shadows.jsx +4 -4
- package/src/themes/theme/default.jsx +17 -17
- package/src/themes/theme/index.jsx +23 -23
- package/src/themes/theme/theme1.jsx +24 -46
- package/src/themes/theme/theme2.jsx +24 -46
- package/src/themes/theme/theme3.jsx +24 -46
- package/src/themes/theme/theme4.jsx +24 -46
- package/src/themes/theme/theme5.jsx +24 -46
- package/src/themes/theme/theme6.jsx +24 -46
- package/src/themes/theme/theme7.jsx +24 -46
- package/src/themes/theme/theme8.jsx +24 -46
- package/src/themes/typography.jsx +16 -16
- package/src/utils/{lang.js → lang.ts} +4 -4
- package/src/utils/time.ts +14 -0
- package/vite.config.js +2 -2
- package/src/utils/time.js +0 -13
- /package/src/utils/{index.js → index.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import MainCard from '../MainCard'
|
|
2
|
-
import { List as RaList } from 'react-admin'
|
|
3
|
-
import { styled } from '@mui/system'
|
|
1
|
+
import MainCard from '../MainCard';
|
|
2
|
+
import { List as RaList } from 'react-admin';
|
|
3
|
+
import { styled } from '@mui/system';
|
|
4
4
|
|
|
5
5
|
const ApplicaStyledList = styled(RaList, {
|
|
6
6
|
name: 'RaApplicaList',
|
|
@@ -61,21 +61,21 @@ const ApplicaStyledList = styled(RaList, {
|
|
|
61
61
|
'& .RaEmpty-toolbar': {
|
|
62
62
|
margin: theme.spacing(2)
|
|
63
63
|
}
|
|
64
|
-
}))
|
|
64
|
+
}));
|
|
65
65
|
|
|
66
66
|
const List = (props) => {
|
|
67
67
|
return (
|
|
68
68
|
<MainCard content={false}>
|
|
69
69
|
<ApplicaStyledList {...RaList.defaultProps} {...props} />
|
|
70
70
|
</MainCard>
|
|
71
|
-
)
|
|
72
|
-
}
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
73
|
List.defaultProps = {
|
|
74
74
|
...RaList.defaultProps
|
|
75
|
-
}
|
|
75
|
+
};
|
|
76
76
|
|
|
77
77
|
List.propTypes = {
|
|
78
78
|
...RaList.propTypes
|
|
79
|
-
}
|
|
79
|
+
};
|
|
80
80
|
|
|
81
|
-
export default List
|
|
81
|
+
export default List;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { MarkAsReadedButton, MarkAsUnreadedButton } from './button'
|
|
2
|
-
import React, { useCallback, useMemo } from 'react'
|
|
3
|
-
import { darken, lighten, useTheme } from '@mui/material'
|
|
1
|
+
import { MarkAsReadedButton, MarkAsUnreadedButton } from './button';
|
|
2
|
+
import React, { useCallback, useMemo } from 'react';
|
|
3
|
+
import { darken, lighten, useTheme } from '@mui/material';
|
|
4
4
|
|
|
5
|
-
import ActionsMenu from '../../ActionsMenu'
|
|
6
|
-
import { Datagrid } from 'react-admin'
|
|
7
|
-
import { DateAgoField } from '../../ra-fields'
|
|
8
|
-
import { NotificationField } from './field'
|
|
5
|
+
import ActionsMenu from '../../ActionsMenu';
|
|
6
|
+
import { Datagrid } from 'react-admin';
|
|
7
|
+
import { DateAgoField } from '../../ra-fields';
|
|
8
|
+
import { NotificationField } from './field';
|
|
9
9
|
|
|
10
10
|
const NotificationList = ({ ...props }) => {
|
|
11
|
-
const theme = useTheme()
|
|
11
|
+
const theme = useTheme();
|
|
12
12
|
const { mode, colorize, density } = useMemo(
|
|
13
13
|
() => ({
|
|
14
14
|
mode: theme.palette.mode,
|
|
@@ -16,15 +16,13 @@ const NotificationList = ({ ...props }) => {
|
|
|
16
16
|
density: theme.palette.mode === 'dark' ? 0.5 : 0.9
|
|
17
17
|
}),
|
|
18
18
|
[theme.palette.mode]
|
|
19
|
-
)
|
|
19
|
+
);
|
|
20
20
|
const handleRowStyle = useCallback(
|
|
21
21
|
(record) => ({
|
|
22
|
-
backgroundColor: record?.readed
|
|
23
|
-
? colorize(theme.palette.primary[mode], density)
|
|
24
|
-
: colorize(theme.palette.secondary[mode], density)
|
|
22
|
+
backgroundColor: record?.readed ? colorize(theme.palette.primary[mode], density) : colorize(theme.palette.secondary[mode], density)
|
|
25
23
|
}),
|
|
26
24
|
[theme, mode, colorize, density]
|
|
27
|
-
)
|
|
25
|
+
);
|
|
28
26
|
|
|
29
27
|
return (
|
|
30
28
|
<Datagrid {...props} rowStyle={handleRowStyle}>
|
|
@@ -35,7 +33,7 @@ const NotificationList = ({ ...props }) => {
|
|
|
35
33
|
<MarkAsUnreadedButton />
|
|
36
34
|
</ActionsMenu>
|
|
37
35
|
</Datagrid>
|
|
38
|
-
)
|
|
39
|
-
}
|
|
36
|
+
);
|
|
37
|
+
};
|
|
40
38
|
|
|
41
|
-
export default NotificationList
|
|
39
|
+
export default NotificationList;
|
|
@@ -7,20 +7,20 @@ import {
|
|
|
7
7
|
useResourceContext,
|
|
8
8
|
useUnselectAll,
|
|
9
9
|
useUpdateMany
|
|
10
|
-
} from 'react-admin'
|
|
10
|
+
} from 'react-admin';
|
|
11
11
|
|
|
12
|
-
import { Email } from '@mui/icons-material'
|
|
13
|
-
import dayjs from 'dayjs'
|
|
14
|
-
import { useCallback } from 'react'
|
|
12
|
+
import { Email } from '@mui/icons-material';
|
|
13
|
+
import dayjs from 'dayjs';
|
|
14
|
+
import { useCallback } from 'react';
|
|
15
15
|
|
|
16
16
|
const MarkAsReadedButton = () => {
|
|
17
|
-
const refresh = useRefresh()
|
|
18
|
-
const notify = useNotify()
|
|
19
|
-
const unselectAll = useUnselectAll()
|
|
20
|
-
const resource = useResourceContext()
|
|
21
|
-
const { selectedIds, data: tableRows } = useListContext()
|
|
22
|
-
const record = useRecordContext()
|
|
23
|
-
const rows = selectedIds.map((id) => tableRows.find((d) => d.id === id))
|
|
17
|
+
const refresh = useRefresh();
|
|
18
|
+
const notify = useNotify();
|
|
19
|
+
const unselectAll = useUnselectAll();
|
|
20
|
+
const resource = useResourceContext();
|
|
21
|
+
const { selectedIds, data: tableRows } = useListContext();
|
|
22
|
+
const record = useRecordContext();
|
|
23
|
+
const rows = selectedIds.map((id) => tableRows.find((d) => d.id === id));
|
|
24
24
|
const [updateMany, { isLoading }] = useUpdateMany(
|
|
25
25
|
resource,
|
|
26
26
|
{
|
|
@@ -30,28 +30,24 @@ const MarkAsReadedButton = () => {
|
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
onSuccess: () => {
|
|
33
|
-
refresh()
|
|
34
|
-
notify('resources.notifications.messages.readed.done')
|
|
35
|
-
unselectAll(resource)
|
|
33
|
+
refresh();
|
|
34
|
+
notify('resources.notifications.messages.readed.done');
|
|
35
|
+
unselectAll(resource);
|
|
36
36
|
},
|
|
37
37
|
onError: () => notify('ra.notification.readed_error', 'warning'),
|
|
38
38
|
|
|
39
39
|
onFailure: () => notify('ra.notification.readed_error', 'warning')
|
|
40
40
|
}
|
|
41
|
-
)
|
|
41
|
+
);
|
|
42
42
|
const handleUpdateMany = useCallback(() => {
|
|
43
|
-
updateMany()
|
|
44
|
-
}, [updateMany])
|
|
43
|
+
updateMany();
|
|
44
|
+
}, [updateMany]);
|
|
45
45
|
|
|
46
46
|
return (
|
|
47
|
-
<Button
|
|
48
|
-
label="ra.notification.mark_as_readed"
|
|
49
|
-
disabled={isLoading || record?.readed !== null}
|
|
50
|
-
onClick={handleUpdateMany}
|
|
51
|
-
>
|
|
47
|
+
<Button label="ra.notification.mark_as_readed" disabled={isLoading || record?.readed !== null} onClick={handleUpdateMany}>
|
|
52
48
|
<Email />
|
|
53
49
|
</Button>
|
|
54
|
-
)
|
|
55
|
-
}
|
|
50
|
+
);
|
|
51
|
+
};
|
|
56
52
|
|
|
57
|
-
export default MarkAsReadedButton
|
|
53
|
+
export default MarkAsReadedButton;
|
|
@@ -7,19 +7,19 @@ import {
|
|
|
7
7
|
useResourceContext,
|
|
8
8
|
useUnselectAll,
|
|
9
9
|
useUpdateMany
|
|
10
|
-
} from 'react-admin'
|
|
10
|
+
} from 'react-admin';
|
|
11
11
|
|
|
12
|
-
import { Drafts } from '@mui/icons-material'
|
|
13
|
-
import { useCallback } from 'react'
|
|
12
|
+
import { Drafts } from '@mui/icons-material';
|
|
13
|
+
import { useCallback } from 'react';
|
|
14
14
|
|
|
15
15
|
const MarkAsUnreadedButton = () => {
|
|
16
|
-
const refresh = useRefresh()
|
|
17
|
-
const notify = useNotify()
|
|
18
|
-
const unselectAll = useUnselectAll()
|
|
19
|
-
const { selectedIds, data: tableRows } = useListContext()
|
|
20
|
-
const record = useRecordContext()
|
|
21
|
-
const resource = useResourceContext()
|
|
22
|
-
const rows = selectedIds.map((id) => tableRows.find((d) => d.id === id)).concat([record])
|
|
16
|
+
const refresh = useRefresh();
|
|
17
|
+
const notify = useNotify();
|
|
18
|
+
const unselectAll = useUnselectAll();
|
|
19
|
+
const { selectedIds, data: tableRows } = useListContext();
|
|
20
|
+
const record = useRecordContext();
|
|
21
|
+
const resource = useResourceContext();
|
|
22
|
+
const rows = selectedIds.map((id) => tableRows.find((d) => d.id === id)).concat([record]);
|
|
23
23
|
const [updateMany, { isLoading }] = useUpdateMany(
|
|
24
24
|
resource,
|
|
25
25
|
{
|
|
@@ -29,17 +29,17 @@ const MarkAsUnreadedButton = () => {
|
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
onSuccess: () => {
|
|
32
|
-
refresh()
|
|
33
|
-
notify('resources.notifications.messages.unreaded.done')
|
|
34
|
-
unselectAll('notifications')
|
|
32
|
+
refresh();
|
|
33
|
+
notify('resources.notifications.messages.unreaded.done');
|
|
34
|
+
unselectAll('notifications');
|
|
35
35
|
},
|
|
36
36
|
onFailure: () => notify('resources.notifications.messages.unreaded.error', 'warning')
|
|
37
37
|
}
|
|
38
|
-
)
|
|
38
|
+
);
|
|
39
39
|
|
|
40
40
|
const handleUpdateMany = useCallback(() => {
|
|
41
|
-
updateMany()
|
|
42
|
-
}, [updateMany])
|
|
41
|
+
updateMany();
|
|
42
|
+
}, [updateMany]);
|
|
43
43
|
|
|
44
44
|
return (
|
|
45
45
|
<Button
|
|
@@ -50,7 +50,7 @@ const MarkAsUnreadedButton = () => {
|
|
|
50
50
|
>
|
|
51
51
|
<Drafts />
|
|
52
52
|
</Button>
|
|
53
|
-
)
|
|
54
|
-
}
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
55
|
|
|
56
|
-
export default MarkAsUnreadedButton
|
|
56
|
+
export default MarkAsUnreadedButton;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default as MarkAsReadedButton } from './MarkAsReadedButton'
|
|
2
|
-
export { default as MarkAsUnreadedButton } from './MarkAsUnreadedButton'
|
|
1
|
+
export { default as MarkAsReadedButton } from './MarkAsReadedButton';
|
|
2
|
+
export { default as MarkAsUnreadedButton } from './MarkAsUnreadedButton';
|
|
@@ -1,31 +1,20 @@
|
|
|
1
|
-
import { Box, Typography } from '@mui/material'
|
|
2
|
-
import React, { useCallback, useMemo } from 'react'
|
|
3
|
-
import {
|
|
4
|
-
useLocaleState,
|
|
5
|
-
useNotify,
|
|
6
|
-
useRecordContext,
|
|
7
|
-
useRedirect,
|
|
8
|
-
useResourceContext,
|
|
9
|
-
useTranslate,
|
|
10
|
-
useUpdate
|
|
11
|
-
} from 'react-admin'
|
|
1
|
+
import { Box, Typography } from '@mui/material';
|
|
2
|
+
import React, { useCallback, useMemo } from 'react';
|
|
3
|
+
import { useLocaleState, useNotify, useRecordContext, useRedirect, useResourceContext, useTranslate, useUpdate } from 'react-admin';
|
|
12
4
|
|
|
13
|
-
import dayjs from 'dayjs'
|
|
5
|
+
import dayjs from 'dayjs';
|
|
14
6
|
|
|
15
7
|
const NotificationField = (props) => {
|
|
16
|
-
const record = useRecordContext(props)
|
|
17
|
-
const resource = useResourceContext(props)
|
|
18
|
-
const redirect = useRedirect()
|
|
19
|
-
const notify = useNotify()
|
|
20
|
-
const translate = useTranslate()
|
|
21
|
-
const [locale] = useLocaleState()
|
|
8
|
+
const record = useRecordContext(props);
|
|
9
|
+
const resource = useResourceContext(props);
|
|
10
|
+
const redirect = useRedirect();
|
|
11
|
+
const notify = useNotify();
|
|
12
|
+
const translate = useTranslate();
|
|
13
|
+
const [locale] = useLocaleState();
|
|
22
14
|
const readed = useMemo(
|
|
23
|
-
() =>
|
|
24
|
-
record?.readed
|
|
25
|
-
? dayjs(record?.readed).locale(locale).format('ddd, DD MMM YYYY HH:mm:ss')
|
|
26
|
-
: false,
|
|
15
|
+
() => (record?.readed ? dayjs(record?.readed).locale(locale).format('ddd, DD MMM YYYY HH:mm:ss') : false),
|
|
27
16
|
[record?.readed, locale]
|
|
28
|
-
)
|
|
17
|
+
);
|
|
29
18
|
|
|
30
19
|
const [update] = useUpdate(
|
|
31
20
|
resource,
|
|
@@ -40,18 +29,18 @@ const NotificationField = (props) => {
|
|
|
40
29
|
onSuccess: () => {
|
|
41
30
|
if (record?.resource) {
|
|
42
31
|
if (record?.resource.startsWith('/')) {
|
|
43
|
-
redirect(record?.resource)
|
|
32
|
+
redirect(record?.resource);
|
|
44
33
|
} else {
|
|
45
|
-
document.location.href = record?.resource
|
|
34
|
+
document.location.href = record?.resource;
|
|
46
35
|
}
|
|
47
36
|
}
|
|
48
37
|
},
|
|
49
38
|
onFailure: () => {
|
|
50
|
-
notify('ra.notification.readed_error', 'warning')
|
|
39
|
+
notify('ra.notification.readed_error', 'warning');
|
|
51
40
|
}
|
|
52
41
|
}
|
|
53
|
-
)
|
|
54
|
-
const handleUpdate = useCallback(() => update(), [update])
|
|
42
|
+
);
|
|
43
|
+
const handleUpdate = useCallback(() => update(), [update]);
|
|
55
44
|
|
|
56
45
|
return (
|
|
57
46
|
<div onClick={handleUpdate} style={{ cursor: 'pointer' }} role="button" tabIndex={0}>
|
|
@@ -75,6 +64,6 @@ const NotificationField = (props) => {
|
|
|
75
64
|
</Typography>
|
|
76
65
|
)}
|
|
77
66
|
</div>
|
|
78
|
-
)
|
|
79
|
-
}
|
|
80
|
-
export default NotificationField
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
export default NotificationField;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as NotificationField } from './NotificationField'
|
|
1
|
+
export { default as NotificationField } from './NotificationField';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import NotificationList from './NotificationList'
|
|
2
|
-
export default NotificationList
|
|
1
|
+
import NotificationList from './NotificationList';
|
|
2
|
+
export default NotificationList;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Datagrid from './Datagrid'
|
|
2
|
-
import Empty from './Empty'
|
|
3
|
-
import List from './List'
|
|
4
|
-
import NotificationList from './NotificationList'
|
|
5
|
-
export { Datagrid, Empty, NotificationList, List }
|
|
1
|
+
import Datagrid from './Datagrid';
|
|
2
|
+
import Empty from './Empty';
|
|
3
|
+
import List from './List';
|
|
4
|
+
import NotificationList from './NotificationList';
|
|
5
|
+
export { Datagrid, Empty, NotificationList, List };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import 'simplebar/dist/simplebar.min.css'
|
|
1
|
+
import 'simplebar/dist/simplebar.min.css';
|
|
2
2
|
|
|
3
|
-
import { BrowserView, MobileView } from 'react-device-detect'
|
|
4
|
-
import { alpha, styled } from '@mui/material/styles'
|
|
3
|
+
import { BrowserView, MobileView } from 'react-device-detect';
|
|
4
|
+
import { alpha, styled } from '@mui/material/styles';
|
|
5
5
|
|
|
6
|
-
import { Box } from '@mui/material'
|
|
7
|
-
import PropTypes from 'prop-types'
|
|
8
|
-
import SimpleBar from 'simplebar-react'
|
|
6
|
+
import { Box } from '@mui/material';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import SimpleBar from 'simplebar-react';
|
|
9
9
|
|
|
10
10
|
// root style
|
|
11
11
|
const RootStyle = styled(BrowserView)({
|
|
12
12
|
flexGrow: 1,
|
|
13
13
|
height: '100%',
|
|
14
14
|
overflow: 'hidden'
|
|
15
|
-
})
|
|
15
|
+
});
|
|
16
16
|
|
|
17
17
|
// scroll bar wrapper
|
|
18
18
|
const SimpleBarStyle = styled(SimpleBar)(({ theme }) => ({
|
|
@@ -34,7 +34,7 @@ const SimpleBarStyle = styled(SimpleBar)(({ theme }) => ({
|
|
|
34
34
|
'& .simplebar-mask': {
|
|
35
35
|
zIndex: 'inherit'
|
|
36
36
|
}
|
|
37
|
-
}))
|
|
37
|
+
}));
|
|
38
38
|
|
|
39
39
|
// ==============================|| SIMPLE SCROLL BAR ||============================== //
|
|
40
40
|
|
|
@@ -52,10 +52,10 @@ export default function SimpleBarScroll({ children, sx, ...other }) {
|
|
|
52
52
|
</Box>
|
|
53
53
|
</MobileView>
|
|
54
54
|
</>
|
|
55
|
-
)
|
|
55
|
+
);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
SimpleBarScroll.propTypes = {
|
|
59
59
|
children: PropTypes.node,
|
|
60
60
|
sx: PropTypes.object
|
|
61
|
-
}
|
|
61
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import SimpleBar from './SimpleBar'
|
|
1
|
+
import SimpleBar from './SimpleBar';
|
|
2
2
|
|
|
3
|
-
export { SimpleBar }
|
|
3
|
+
export { SimpleBar };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import MenuPropTypes from './MenuPropTypes'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import { createContext } from 'react'
|
|
4
|
-
import { useLocalStorage } from '../hooks'
|
|
1
|
+
import MenuPropTypes from './MenuPropTypes';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { createContext } from 'react';
|
|
4
|
+
import { useLocalStorage } from '../hooks';
|
|
5
5
|
|
|
6
6
|
const initialState = {
|
|
7
7
|
openItem: ['dashboard'],
|
|
@@ -10,62 +10,62 @@ const initialState = {
|
|
|
10
10
|
drawerOpen: false,
|
|
11
11
|
componentDrawerOpen: true,
|
|
12
12
|
menuDashboard: {},
|
|
13
|
-
error: null
|
|
14
|
-
}
|
|
13
|
+
error: null
|
|
14
|
+
};
|
|
15
15
|
|
|
16
|
-
const MenuConfigContext = createContext(initialState)
|
|
16
|
+
const MenuConfigContext = createContext(initialState);
|
|
17
17
|
|
|
18
18
|
const MenuConfigProvider = ({ menu: groups, children }) => {
|
|
19
|
-
const [menu, setMenu] = useLocalStorage('menu-config', { ...initialState })
|
|
19
|
+
const [menu, setMenu] = useLocalStorage('menu-config', { ...initialState });
|
|
20
20
|
|
|
21
21
|
const activeItem = (openItem) => {
|
|
22
22
|
setMenu((menu) => ({
|
|
23
23
|
...menu,
|
|
24
|
-
openItem
|
|
25
|
-
}))
|
|
26
|
-
}
|
|
24
|
+
openItem
|
|
25
|
+
}));
|
|
26
|
+
};
|
|
27
27
|
|
|
28
28
|
const activeID = (selectedID) => {
|
|
29
29
|
setMenu((menu) => ({
|
|
30
30
|
...menu,
|
|
31
|
-
selectedID
|
|
32
|
-
}))
|
|
33
|
-
}
|
|
31
|
+
selectedID
|
|
32
|
+
}));
|
|
33
|
+
};
|
|
34
34
|
|
|
35
35
|
const activeComponent = (openComponent) => {
|
|
36
36
|
setMenu((menu) => ({
|
|
37
37
|
...menu,
|
|
38
|
-
openComponent
|
|
39
|
-
}))
|
|
40
|
-
}
|
|
38
|
+
openComponent
|
|
39
|
+
}));
|
|
40
|
+
};
|
|
41
41
|
|
|
42
42
|
const openDrawer = (drawerOpen) => {
|
|
43
43
|
setMenu((menu) => ({
|
|
44
44
|
...menu,
|
|
45
|
-
drawerOpen
|
|
46
|
-
}))
|
|
47
|
-
}
|
|
45
|
+
drawerOpen
|
|
46
|
+
}));
|
|
47
|
+
};
|
|
48
48
|
|
|
49
49
|
const openComponentDrawer = (componentDrawerOpen) => {
|
|
50
50
|
setMenu((menu) => ({
|
|
51
51
|
...menu,
|
|
52
|
-
componentDrawerOpen
|
|
53
|
-
}))
|
|
54
|
-
}
|
|
52
|
+
componentDrawerOpen
|
|
53
|
+
}));
|
|
54
|
+
};
|
|
55
55
|
|
|
56
56
|
const getMenuSuccess = (menuDashboard) => {
|
|
57
57
|
setMenu((menu) => ({
|
|
58
58
|
...menu,
|
|
59
|
-
menuDashboard
|
|
60
|
-
}))
|
|
61
|
-
}
|
|
59
|
+
menuDashboard
|
|
60
|
+
}));
|
|
61
|
+
};
|
|
62
62
|
|
|
63
63
|
const hasError = (error) => {
|
|
64
64
|
setMenu((menu) => ({
|
|
65
65
|
...menu,
|
|
66
|
-
error
|
|
67
|
-
}))
|
|
68
|
-
}
|
|
66
|
+
error
|
|
67
|
+
}));
|
|
68
|
+
};
|
|
69
69
|
return (
|
|
70
70
|
<MenuConfigContext.Provider
|
|
71
71
|
value={{
|
|
@@ -77,17 +77,17 @@ const MenuConfigProvider = ({ menu: groups, children }) => {
|
|
|
77
77
|
openComponentDrawer,
|
|
78
78
|
activeID,
|
|
79
79
|
getMenuSuccess,
|
|
80
|
-
hasError
|
|
80
|
+
hasError
|
|
81
81
|
}}
|
|
82
82
|
>
|
|
83
83
|
{children}
|
|
84
84
|
</MenuConfigContext.Provider>
|
|
85
|
-
)
|
|
86
|
-
}
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
87
|
|
|
88
88
|
MenuConfigProvider.propTypes = {
|
|
89
89
|
children: PropTypes.node,
|
|
90
|
-
menu: PropTypes.arrayOf(MenuPropTypes)
|
|
91
|
-
}
|
|
90
|
+
menu: PropTypes.arrayOf(MenuPropTypes)
|
|
91
|
+
};
|
|
92
92
|
|
|
93
|
-
export { MenuConfigContext, MenuConfigProvider }
|
|
93
|
+
export { MenuConfigContext, MenuConfigProvider };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import PropTypes from 'prop-types'
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
2
|
|
|
3
3
|
const lazy = (f) => {
|
|
4
4
|
return function () {
|
|
5
|
-
return f.apply(this, arguments)
|
|
6
|
-
}
|
|
7
|
-
}
|
|
5
|
+
return f.apply(this, arguments);
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
8
|
|
|
9
9
|
const MenuPropTypes = PropTypes.shape({
|
|
10
10
|
id: PropTypes.string,
|
|
@@ -13,7 +13,7 @@ const MenuPropTypes = PropTypes.shape({
|
|
|
13
13
|
icon: PropTypes.elementType,
|
|
14
14
|
url: PropTypes.string,
|
|
15
15
|
parent: PropTypes.shape(lazy(() => MenuPropTypes)),
|
|
16
|
-
children: PropTypes.arrayOf(lazy(() => MenuPropTypes))
|
|
17
|
-
})
|
|
16
|
+
children: PropTypes.arrayOf(lazy(() => MenuPropTypes))
|
|
17
|
+
});
|
|
18
18
|
|
|
19
|
-
export default MenuPropTypes
|
|
19
|
+
export default MenuPropTypes;
|
package/src/contexts/index.jsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import MenuPropTypes from './MenuPropTypes'
|
|
2
|
-
export { MenuPropTypes }
|
|
3
|
-
export * from './ThemeConfigContext'
|
|
4
|
-
export * from './MenuConfigContext'
|
|
5
|
-
export * from './AppConfigContext'
|
|
1
|
+
import MenuPropTypes from './MenuPropTypes';
|
|
2
|
+
export { MenuPropTypes };
|
|
3
|
+
export * from './ThemeConfigContext';
|
|
4
|
+
export * from './MenuConfigContext';
|
|
5
|
+
export * from './AppConfigContext';
|
package/src/dev/index.jsx
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import useCliErrorCatcher, { CatchResult } from './useCliErrorCatcher'
|
|
2
|
-
export { useCliErrorCatcher, CatchResult }
|
|
1
|
+
import useCliErrorCatcher, { CatchResult } from './useCliErrorCatcher';
|
|
2
|
+
export { useCliErrorCatcher, CatchResult };
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
import * as React from 'react'
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
|
|
4
4
|
class CatchResult {
|
|
5
5
|
constructor({ catch: catchErr, display: displayErr, log: logErr, error }) {
|
|
6
|
-
this.catch = catchErr
|
|
7
|
-
this.display = displayErr
|
|
8
|
-
this.log = logErr
|
|
9
|
-
this.error = error
|
|
6
|
+
this.catch = catchErr;
|
|
7
|
+
this.display = displayErr;
|
|
8
|
+
this.log = logErr;
|
|
9
|
+
this.error = error;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
isCatched() {
|
|
13
|
-
return this.catch
|
|
13
|
+
return this.catch;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
logError() {
|
|
17
|
-
return this.log
|
|
17
|
+
return this.log;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
displayError() {
|
|
21
|
-
return this.display
|
|
21
|
+
return this.display;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -27,10 +27,10 @@ const putError = ({ apiUrl, endpoint, locale, message, bodyBuilder }) =>
|
|
|
27
27
|
method: 'PUT',
|
|
28
28
|
headers: new Headers({
|
|
29
29
|
Accept: 'application/json',
|
|
30
|
-
'Content-Type': 'application/json'
|
|
30
|
+
'Content-Type': 'application/json'
|
|
31
31
|
}),
|
|
32
|
-
body: JSON.stringify(bodyBuilder(locale, message))
|
|
33
|
-
})
|
|
32
|
+
body: JSON.stringify(bodyBuilder(locale, message))
|
|
33
|
+
});
|
|
34
34
|
|
|
35
35
|
const useCliErrorCatcher = ({
|
|
36
36
|
enabled = true,
|
|
@@ -42,45 +42,45 @@ const useCliErrorCatcher = ({
|
|
|
42
42
|
code: locale,
|
|
43
43
|
message: {
|
|
44
44
|
code: message,
|
|
45
|
-
text: message
|
|
46
|
-
}
|
|
47
|
-
})
|
|
45
|
+
text: message
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
48
|
}) => {
|
|
49
49
|
React.useMemo(() => {
|
|
50
50
|
if (loading) {
|
|
51
|
-
return
|
|
51
|
+
return;
|
|
52
52
|
}
|
|
53
53
|
if (!enabled) {
|
|
54
|
-
return
|
|
54
|
+
return;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
const consoleError = console.error
|
|
57
|
+
const consoleError = console.error;
|
|
58
58
|
|
|
59
59
|
console.error = function (error, ...args) {
|
|
60
60
|
if (!error || typeof error !== 'string') {
|
|
61
|
-
consoleError.apply(console, arguments)
|
|
62
|
-
return
|
|
61
|
+
consoleError.apply(console, arguments);
|
|
62
|
+
return;
|
|
63
63
|
}
|
|
64
|
-
const message = error.replace(/%s/g, () => args.shift())
|
|
65
|
-
const catchResult = catcherFn(message)
|
|
64
|
+
const message = error.replace(/%s/g, () => args.shift());
|
|
65
|
+
const catchResult = catcherFn(message);
|
|
66
66
|
if (!catchResult.isCatched()) {
|
|
67
|
-
consoleError.apply(console, arguments)
|
|
68
|
-
return
|
|
67
|
+
consoleError.apply(console, arguments);
|
|
68
|
+
return;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
if (catchResult.logError()) {
|
|
72
|
-
putError({ apiUrl, endpoint, message, bodyBuilder })
|
|
72
|
+
putError({ apiUrl, endpoint, message, bodyBuilder });
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
if (catchResult.displayError()) {
|
|
76
|
-
consoleError.apply(console, arguments)
|
|
76
|
+
consoleError.apply(console, arguments);
|
|
77
77
|
} else {
|
|
78
|
-
console.debug.apply(console, arguments)
|
|
78
|
+
console.debug.apply(console, arguments);
|
|
79
79
|
}
|
|
80
|
-
}
|
|
81
|
-
}, [apiUrl, loading, bodyBuilder, endpoint, catcherFn, enabled])
|
|
82
|
-
return true
|
|
83
|
-
}
|
|
84
|
-
export { CatchResult }
|
|
80
|
+
};
|
|
81
|
+
}, [apiUrl, loading, bodyBuilder, endpoint, catcherFn, enabled]);
|
|
82
|
+
return true;
|
|
83
|
+
};
|
|
84
|
+
export { CatchResult };
|
|
85
85
|
|
|
86
|
-
export default useCliErrorCatcher
|
|
86
|
+
export default useCliErrorCatcher;
|