@campxdev/campx-web-utils 0.2.8 → 0.2.9
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/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@campxdev/campx-web-utils",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"main": "./export.ts",
|
|
5
5
|
"private": false,
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@campxdev/react-blueprint": "^1.2.
|
|
7
|
+
"@campxdev/react-blueprint": "^1.2.3",
|
|
8
8
|
"@hookform/resolvers": "^3.9.0",
|
|
9
9
|
"@mui/x-date-pickers": "^7.12.1",
|
|
10
10
|
"@testing-library/jest-dom": "^5.14.1",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"react-scripts": "5.0.1",
|
|
27
27
|
"react-toastify": "^9.0.1",
|
|
28
28
|
"typescript": "^4.4.2",
|
|
29
|
+
"uuid": "^10.0.0",
|
|
29
30
|
"web-vitals": "^2.1.0",
|
|
30
31
|
"yup": "^1.4.0"
|
|
31
32
|
},
|
package/src/Layout/AppLayout.tsx
CHANGED
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
Icons,
|
|
4
|
-
MuiThemeProvider,
|
|
5
|
-
Sidebar,
|
|
6
|
-
Spinner,
|
|
7
|
-
} from '@campxdev/react-blueprint';
|
|
1
|
+
import { AppHeader, Sidebar, Spinner } from '@campxdev/react-blueprint';
|
|
2
|
+
import { SideMenuItemProps } from '@campxdev/react-blueprint/src/components/Navigation/Sidebar/Sidebar';
|
|
8
3
|
import { Box, Stack, useTheme } from '@mui/material';
|
|
9
4
|
import { Suspense, useState } from 'react';
|
|
10
5
|
import { ErrorBoundary } from '../context/export';
|
|
11
|
-
import {
|
|
12
|
-
SideMenuItemProps,
|
|
13
|
-
SubMenuItemProps,
|
|
14
|
-
} from '@campxdev/react-blueprint/src/components/Navigation/Sidebar/Sidebar';
|
|
15
6
|
|
|
16
7
|
interface Props {
|
|
17
8
|
children?: React.ReactNode;
|
|
@@ -47,8 +38,8 @@ export const AppLayout: React.FC<Props> = ({
|
|
|
47
38
|
/>
|
|
48
39
|
<Box
|
|
49
40
|
sx={{
|
|
50
|
-
backgroundColor: theme.palette.surface.paperBackground,
|
|
51
41
|
borderRadius: '8px',
|
|
42
|
+
height: '-webkit-fill-available',
|
|
52
43
|
...mainContainerSx,
|
|
53
44
|
}}
|
|
54
45
|
onClick={() => {
|
package/src/Pages/main.tsx
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Navigate } from 'react-router-dom';
|
|
2
2
|
import AppContent from '../AppContent';
|
|
3
|
-
import AppLayout from '../Layout/AppLayout';
|
|
3
|
+
import { AppLayout } from '../Layout/AppLayout';
|
|
4
4
|
|
|
5
5
|
export const mainRoutes = [
|
|
6
6
|
{
|
|
7
7
|
path: '/',
|
|
8
|
-
element: <AppLayout />,
|
|
8
|
+
element: <AppLayout menu={[]} />,
|
|
9
9
|
children: [
|
|
10
10
|
{
|
|
11
11
|
index: true,
|
|
@@ -9,6 +9,8 @@ interface ConfirmStateProps {
|
|
|
9
9
|
onConfirm: () => void,
|
|
10
10
|
onCancel: () => void,
|
|
11
11
|
type?: ConfirmDialogType,
|
|
12
|
+
confirmButtonText?: string,
|
|
13
|
+
cancelButtonText?: string,
|
|
12
14
|
) => void;
|
|
13
15
|
}
|
|
14
16
|
|
|
@@ -29,6 +31,8 @@ export const ConfirmDialogProvider = ({
|
|
|
29
31
|
onConfirm: () => void,
|
|
30
32
|
onCancel: () => void,
|
|
31
33
|
type: ConfirmDialogType = 'confirm',
|
|
34
|
+
confirmButtonText?: string,
|
|
35
|
+
cancelButtonText?: string,
|
|
32
36
|
) => {
|
|
33
37
|
ApplicationStore.update((s) => {
|
|
34
38
|
s.confirmDialog = {
|
|
@@ -38,6 +42,8 @@ export const ConfirmDialogProvider = ({
|
|
|
38
42
|
onConfirm,
|
|
39
43
|
onCancel,
|
|
40
44
|
type,
|
|
45
|
+
confirmButtonText,
|
|
46
|
+
cancelButtonText,
|
|
41
47
|
};
|
|
42
48
|
});
|
|
43
49
|
};
|
|
@@ -56,6 +62,8 @@ export const ConfirmDialogProvider = ({
|
|
|
56
62
|
title={confirmDialog.title}
|
|
57
63
|
message={confirmDialog.message}
|
|
58
64
|
type={confirmDialog.type}
|
|
65
|
+
confirmButtonText={confirmDialog.confirmButtonText}
|
|
66
|
+
cancelButtonText={confirmDialog.cancelButtonText}
|
|
59
67
|
onConfirm={() => {
|
|
60
68
|
confirmDialog.onConfirm();
|
|
61
69
|
handleCloseDialog();
|
package/src/hooks/useConfirm.ts
CHANGED
|
@@ -5,6 +5,8 @@ const defaultConfirmDialogState = {
|
|
|
5
5
|
isOpen: false,
|
|
6
6
|
title: '',
|
|
7
7
|
message: '',
|
|
8
|
+
confirmButtonText: '',
|
|
9
|
+
cancelButtonText: '',
|
|
8
10
|
type: 'confirm' as ConfirmDialogType,
|
|
9
11
|
onConfirm: () => {},
|
|
10
12
|
onCancel: () => {},
|
|
@@ -14,10 +16,14 @@ const useConfirm = () => {
|
|
|
14
16
|
const isConfirmed = ({
|
|
15
17
|
title,
|
|
16
18
|
message,
|
|
19
|
+
confirmButtonText,
|
|
20
|
+
cancelButtonText,
|
|
17
21
|
type = 'confirm',
|
|
18
22
|
}: {
|
|
19
23
|
title: string;
|
|
20
24
|
message: string;
|
|
25
|
+
confirmButtonText?: string;
|
|
26
|
+
cancelButtonText?: string;
|
|
21
27
|
type?: ConfirmDialogType;
|
|
22
28
|
}): Promise<boolean> =>
|
|
23
29
|
new Promise((resolve) => {
|
|
@@ -26,6 +32,8 @@ const useConfirm = () => {
|
|
|
26
32
|
isOpen: true,
|
|
27
33
|
title,
|
|
28
34
|
message,
|
|
35
|
+
confirmButtonText,
|
|
36
|
+
cancelButtonText,
|
|
29
37
|
type,
|
|
30
38
|
onConfirm: () => {
|
|
31
39
|
resolve(true);
|
package/tsconfig.json
CHANGED