@m4l/layouts 1.0.4 → 2.0.0
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/components/MFHostApp/index.6286a793.js +78 -0
- package/components/MFHostApp/index.d.ts +4 -0
- package/components/MFHostApp/types.d.ts +16 -0
- package/components/MFNoAuthApp/index.d.ts +4 -0
- package/components/MFNoAuthApp/types.d.ts +9 -0
- package/components/index.56bd7864.js +47 -0
- package/components/index.d.ts +3 -0
- package/contexts/AuthContext/index.59755369.js +160 -0
- package/contexts/AuthContext/index.d.ts +5 -0
- package/contexts/AuthContext/types.d.ts +51 -0
- package/contexts/index.d.ts +1 -0
- package/contexts/index.ee173661.js +1 -0
- package/hooks/index.77acdde7.js +1 -0
- package/{dist/hooks → hooks}/index.d.ts +1 -0
- package/hooks/useAuth/index.ae68bf71.js +11 -0
- package/hooks/useAuth/index.d.ts +2 -0
- package/{dist/hooks/useMasterDetail/index.js → hooks/useMasterDetail/index.d45f2a86.js} +4 -2
- package/{dist/hooks/useModule/index.js → hooks/useModule/index.b5f598b1.js} +4 -2
- package/index.d.ts +4 -0
- package/index.js +36 -0
- package/{dist/layouts/MasterDetailLayout/index.d.ts → layouts/MasterDetailLayout/MasterDetailLayout.d.ts} +1 -1
- package/layouts/MasterDetailLayout/classes/constants.d.ts +1 -0
- package/layouts/MasterDetailLayout/classes/index.d.ts +6 -0
- package/layouts/MasterDetailLayout/classes/types.d.ts +6 -0
- package/{dist/layouts → layouts}/MasterDetailLayout/contexts/MasterDetailContext/index.d.ts +1 -1
- package/{dist/layouts → layouts}/MasterDetailLayout/contexts/MasterDetailContext/types.d.ts +2 -3
- package/layouts/MasterDetailLayout/index.748f7ada.js +155 -0
- package/layouts/MasterDetailLayout/styles.d.ts +2 -0
- package/{dist/layouts → layouts}/MasterDetailLayout/types.d.ts +0 -1
- package/layouts/ModuleLayout/classes/constants.d.ts +1 -0
- package/layouts/ModuleLayout/classes/index.d.ts +7 -0
- package/layouts/ModuleLayout/classes/types.d.ts +7 -0
- package/{dist/layouts → layouts}/ModuleLayout/contexts/ModuleContext/index.d.ts +2 -2
- package/{dist/layouts → layouts}/ModuleLayout/contexts/ModuleContext/types.d.ts +4 -9
- package/layouts/ModuleLayout/index.e7218171.js +122 -0
- package/layouts/ModuleLayout/subcomponents/InnerModule/index.d.ts +3 -0
- package/layouts/ModuleLayout/subcomponents/InnerModule/styles.d.ts +2 -0
- package/layouts/ModuleLayout/types.d.ts +16 -0
- package/layouts/NoAuthModuleLayout/dicctionary.d.ts +3 -0
- package/layouts/NoAuthModuleLayout/index.83cd3ea3.js +425 -0
- package/layouts/NoAuthModuleLayout/index.d.ts +3 -0
- package/layouts/NoAuthModuleLayout/subcomponents/InnerModule/index.d.ts +2 -0
- package/layouts/NoAuthModuleLayout/subcomponents/InnerModule/styles.d.ts +2 -0
- package/layouts/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/DesktopContent/index.d.ts +2 -0
- package/layouts/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/DesktopContent/styles.d.ts +10 -0
- package/layouts/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/MobileContent/index.d.ts +2 -0
- package/layouts/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/MobileContent/styles.d.ts +9 -0
- package/layouts/NoAuthModuleLayout/types.d.ts +20 -0
- package/layouts/index.417b6868.js +1 -0
- package/layouts/index.d.ts +6 -0
- package/m4l_layouts/types.d.ts +0 -0
- package/package.json +22 -55
- package/dist/hooks/useResponsive.d.ts +0 -8
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -12
- package/dist/layouts/MasterDetailLayout/components/ButtonDetail/index.d.ts +0 -3
- package/dist/layouts/MasterDetailLayout/index.js +0 -170
- package/dist/layouts/ModuleLayout/components/Header/index.d.ts +0 -2
- package/dist/layouts/ModuleLayout/components/Header/skeleton.d.ts +0 -2
- package/dist/layouts/ModuleLayout/components/Header/styles.d.ts +0 -8
- package/dist/layouts/ModuleLayout/components/Header/types.d.ts +0 -2
- package/dist/layouts/ModuleLayout/components/ModuleContent/index.d.ts +0 -3
- package/dist/layouts/ModuleLayout/components/ModuleContent/styles.d.ts +0 -3
- package/dist/layouts/ModuleLayout/index.js +0 -380
- package/dist/layouts/ModuleLayout/types.d.ts +0 -28
- package/dist/layouts/index.d.ts +0 -2
- package/dist/vendor.js +0 -35
- /package/{dist/hooks → hooks}/useMasterDetail/index.d.ts +0 -0
- /package/{dist/hooks → hooks}/useModule/index.d.ts +0 -0
- /package/{dist/layouts → layouts}/MasterDetailLayout/dicctionary.d.ts +0 -0
- /package/{dist/layouts/ModuleLayout/index.d.ts → layouts/ModuleLayout/ModuleLayout.d.ts} +0 -0
- /package/{dist/layouts → layouts}/ModuleLayout/dicctionary.d.ts +0 -0
- /package/{dist/layouts/ModuleLayout/components/ModuleContent → layouts/ModuleLayout/subcomponents/InnerModule}/types.d.ts +0 -0
- /package/{dist/vite-env.d.ts → vite-env.d.ts} +0 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { unstable_HistoryRouter } from "react-router-dom";
|
|
2
|
+
import { EnvironmentProvider, HostToolsProvider, NetworkProvider, DomainCountryProvider } from "@m4l/core";
|
|
3
|
+
import { LocalesProvider, HostThemeProvider, ResponsiveContainerProvider, FormatterProvider } from "@m4l/graphics";
|
|
4
|
+
import { BaseModule, WindowToolsMFProvider, DynamicMFParmsProvider } from "@m4l/components";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
function MFHostApp(props) {
|
|
7
|
+
const {
|
|
8
|
+
children,
|
|
9
|
+
currentLocale,
|
|
10
|
+
hostTheme,
|
|
11
|
+
environment,
|
|
12
|
+
hostTools,
|
|
13
|
+
axiosOperation,
|
|
14
|
+
formatters,
|
|
15
|
+
isAuth = true,
|
|
16
|
+
moduleId,
|
|
17
|
+
moduleNameField,
|
|
18
|
+
skeletonFlags,
|
|
19
|
+
privileges,
|
|
20
|
+
componentsDictionary,
|
|
21
|
+
dynamicMFStore,
|
|
22
|
+
windowTools,
|
|
23
|
+
observedDivRef
|
|
24
|
+
} = props;
|
|
25
|
+
return /* @__PURE__ */ jsx(EnvironmentProvider, {
|
|
26
|
+
...environment,
|
|
27
|
+
children: /* @__PURE__ */ jsx(HostToolsProvider, {
|
|
28
|
+
...hostTools,
|
|
29
|
+
children: /* @__PURE__ */ jsx(NetworkProvider, {
|
|
30
|
+
axiosOperation,
|
|
31
|
+
children: /* @__PURE__ */ jsx(LocalesProvider, {
|
|
32
|
+
isMicroFrontEnd: true,
|
|
33
|
+
localeHost: currentLocale,
|
|
34
|
+
children: /* @__PURE__ */ jsx(HostThemeProvider, {
|
|
35
|
+
isMicroFrontEnd: true,
|
|
36
|
+
...hostTheme,
|
|
37
|
+
children: /* @__PURE__ */ jsx(ResponsiveContainerProvider, {
|
|
38
|
+
observedDivRef,
|
|
39
|
+
children: /* @__PURE__ */ jsx(unstable_HistoryRouter, {
|
|
40
|
+
history: hostTools.history,
|
|
41
|
+
children: /* @__PURE__ */ jsx(DomainCountryProvider, {
|
|
42
|
+
isMicroFrontEnd: true,
|
|
43
|
+
id: dynamicMFStore?.getState().dynamicMFParameters?.id || 1,
|
|
44
|
+
currency: formatters.currencyFormatter.code,
|
|
45
|
+
currency_decimal_digits: formatters.currencyFormatter.decimalDigits,
|
|
46
|
+
decimal_symbol: formatters.numberFormatter.decimalSymbol,
|
|
47
|
+
thousands_symbol: formatters.numberFormatter.thousandsSymbol,
|
|
48
|
+
children: /* @__PURE__ */ jsx(BaseModule, {
|
|
49
|
+
isAuth,
|
|
50
|
+
moduleId,
|
|
51
|
+
moduleNameField,
|
|
52
|
+
componentsDictionary,
|
|
53
|
+
skeletonFlags,
|
|
54
|
+
privileges,
|
|
55
|
+
children: /* @__PURE__ */ jsx(FormatterProvider, {
|
|
56
|
+
isMicroFrontEnd: true,
|
|
57
|
+
...formatters,
|
|
58
|
+
children: /* @__PURE__ */ jsx(WindowToolsMFProvider, {
|
|
59
|
+
...windowTools,
|
|
60
|
+
children: /* @__PURE__ */ jsx(DynamicMFParmsProvider, {
|
|
61
|
+
store: dynamicMFStore,
|
|
62
|
+
children
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
MFHostApp as M
|
|
78
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AxiosOperation, EnvironmentType, HostToolsType } from '@m4l/core';
|
|
2
|
+
import { Formatters, LocaleType } from '@m4l/graphics';
|
|
3
|
+
import { DynamicMFStore, WindowToolsMF, BaseModuleProps } from '@m4l/components';
|
|
4
|
+
import { HostThemeType } from '@m4l/graphics';
|
|
5
|
+
export interface ByHostProps {
|
|
6
|
+
environment: EnvironmentType;
|
|
7
|
+
hostTools: HostToolsType;
|
|
8
|
+
hostTheme: HostThemeType;
|
|
9
|
+
currentLocale: LocaleType;
|
|
10
|
+
axiosOperation: AxiosOperation;
|
|
11
|
+
formatters: Formatters;
|
|
12
|
+
dynamicMFStore: DynamicMFStore;
|
|
13
|
+
windowTools: WindowToolsMF;
|
|
14
|
+
observedDivRef: Element | Text | null;
|
|
15
|
+
}
|
|
16
|
+
export declare type MFHostAppProps = ByHostProps & BaseModuleProps;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Formatters } from '@m4l/graphics';
|
|
2
|
+
import { WindowToolsMF, BaseModuleProps } from '@m4l/components';
|
|
3
|
+
export interface ByHostProps {
|
|
4
|
+
formatters: Formatters;
|
|
5
|
+
windowTools: WindowToolsMF;
|
|
6
|
+
}
|
|
7
|
+
export interface MFNoAuthAppProps extends ByHostProps, BaseModuleProps {
|
|
8
|
+
observedDivRef: Element | Text | null;
|
|
9
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { DomainCountryProvider } from "@m4l/core";
|
|
2
|
+
import { FormatterProvider, ResponsiveContainerProvider } from "@m4l/graphics";
|
|
3
|
+
import { BaseModule } from "@m4l/components";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
function MFNoAuthApp(props) {
|
|
6
|
+
const {
|
|
7
|
+
children,
|
|
8
|
+
formatters,
|
|
9
|
+
moduleId,
|
|
10
|
+
moduleNameField,
|
|
11
|
+
skeletonFlags,
|
|
12
|
+
privileges,
|
|
13
|
+
componentsDictionary,
|
|
14
|
+
isAuth,
|
|
15
|
+
observedDivRef
|
|
16
|
+
} = props;
|
|
17
|
+
const domianCountry = {
|
|
18
|
+
id: 1,
|
|
19
|
+
currency: "USD",
|
|
20
|
+
currency_decimal_digits: 2,
|
|
21
|
+
decimal_symbol: ".",
|
|
22
|
+
thousands_symbol: ","
|
|
23
|
+
};
|
|
24
|
+
return /* @__PURE__ */ jsx(DomainCountryProvider, {
|
|
25
|
+
isMicroFrontEnd: true,
|
|
26
|
+
...domianCountry,
|
|
27
|
+
children: /* @__PURE__ */ jsx(BaseModule, {
|
|
28
|
+
isAuth,
|
|
29
|
+
moduleId,
|
|
30
|
+
moduleNameField,
|
|
31
|
+
componentsDictionary,
|
|
32
|
+
skeletonFlags,
|
|
33
|
+
privileges,
|
|
34
|
+
children: /* @__PURE__ */ jsx(FormatterProvider, {
|
|
35
|
+
isMicroFrontEnd: true,
|
|
36
|
+
...formatters,
|
|
37
|
+
children: /* @__PURE__ */ jsx(ResponsiveContainerProvider, {
|
|
38
|
+
observedDivRef,
|
|
39
|
+
children
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
MFNoAuthApp as M
|
|
47
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { createContext, useReducer, useEffect } from "react";
|
|
2
|
+
import { useHostTools, useNetwork, useEnvironment, useLocalStorageWithListener, EmitEvents, getLocalStorage, setLocalStorage } from "@m4l/core";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var EnumTypes = /* @__PURE__ */ ((EnumTypes2) => {
|
|
5
|
+
EnumTypes2["Initial"] = "INITIALIZE";
|
|
6
|
+
EnumTypes2["Login"] = "LOGIN";
|
|
7
|
+
EnumTypes2["Logout"] = "LOGOUT";
|
|
8
|
+
return EnumTypes2;
|
|
9
|
+
})(EnumTypes || {});
|
|
10
|
+
const initialState = {
|
|
11
|
+
isAuthenticated: false,
|
|
12
|
+
isInitialized: false,
|
|
13
|
+
user: null
|
|
14
|
+
};
|
|
15
|
+
const JWTReducer = (state, action) => {
|
|
16
|
+
switch (action.type) {
|
|
17
|
+
case "INITIALIZE":
|
|
18
|
+
return {
|
|
19
|
+
isAuthenticated: action.payload.isAuthenticated,
|
|
20
|
+
isInitialized: true,
|
|
21
|
+
user: action.payload.user
|
|
22
|
+
};
|
|
23
|
+
case "LOGIN":
|
|
24
|
+
return {
|
|
25
|
+
...state,
|
|
26
|
+
isAuthenticated: true,
|
|
27
|
+
user: action.payload.user
|
|
28
|
+
};
|
|
29
|
+
case "LOGOUT":
|
|
30
|
+
return {
|
|
31
|
+
...state,
|
|
32
|
+
isAuthenticated: false,
|
|
33
|
+
user: null
|
|
34
|
+
};
|
|
35
|
+
default:
|
|
36
|
+
return state;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const AuthContext = createContext(null);
|
|
40
|
+
function dispatchInitial(dispatch) {
|
|
41
|
+
dispatch({
|
|
42
|
+
type: EnumTypes.Initial,
|
|
43
|
+
payload: {
|
|
44
|
+
isAuthenticated: false,
|
|
45
|
+
user: null
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function AuthProvider(props) {
|
|
50
|
+
const {
|
|
51
|
+
children
|
|
52
|
+
} = props;
|
|
53
|
+
const [state, dispatch] = useReducer(JWTReducer, initialState);
|
|
54
|
+
const {
|
|
55
|
+
events_add_listener
|
|
56
|
+
} = useHostTools();
|
|
57
|
+
const {
|
|
58
|
+
networkOperation
|
|
59
|
+
} = useNetwork();
|
|
60
|
+
const {
|
|
61
|
+
domain_token
|
|
62
|
+
} = useEnvironment();
|
|
63
|
+
const [nextValSession, setNextValSession] = useLocalStorageWithListener(
|
|
64
|
+
"vSession",
|
|
65
|
+
new Date().getTime() + ""
|
|
66
|
+
);
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
const initialize = async () => {
|
|
69
|
+
networkOperation({
|
|
70
|
+
method: "GET",
|
|
71
|
+
endPoint: `auth/login`,
|
|
72
|
+
parms: {
|
|
73
|
+
user_data: true
|
|
74
|
+
},
|
|
75
|
+
checkUnAuthorized: false
|
|
76
|
+
}).then((response) => {
|
|
77
|
+
dispatch({
|
|
78
|
+
type: EnumTypes.Initial,
|
|
79
|
+
payload: {
|
|
80
|
+
isAuthenticated: true,
|
|
81
|
+
user: response.user
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
const useSaved = getLocalStorage("userData", {
|
|
85
|
+
email: response.user.email,
|
|
86
|
+
remember: true
|
|
87
|
+
});
|
|
88
|
+
if (useSaved?.email !== response.user.email) {
|
|
89
|
+
setLocalStorage("userData", {
|
|
90
|
+
email: response.user.email
|
|
91
|
+
}, true);
|
|
92
|
+
}
|
|
93
|
+
}).catch(() => {
|
|
94
|
+
dispatchInitial(dispatch);
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
initialize();
|
|
98
|
+
}, [nextValSession]);
|
|
99
|
+
const login = async (email, password, remember) => {
|
|
100
|
+
await networkOperation({
|
|
101
|
+
endPoint: `auth/login`,
|
|
102
|
+
method: "POST",
|
|
103
|
+
data: {
|
|
104
|
+
email,
|
|
105
|
+
password,
|
|
106
|
+
domain_token
|
|
107
|
+
}
|
|
108
|
+
}).then((response) => {
|
|
109
|
+
const user = response.data;
|
|
110
|
+
if (remember) {
|
|
111
|
+
setLocalStorage("userData", {
|
|
112
|
+
email,
|
|
113
|
+
remember
|
|
114
|
+
});
|
|
115
|
+
} else {
|
|
116
|
+
setLocalStorage("userData", {
|
|
117
|
+
email: "",
|
|
118
|
+
remember
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
dispatch({
|
|
122
|
+
type: EnumTypes.Login,
|
|
123
|
+
payload: {
|
|
124
|
+
user
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
setNextValSession(new Date().getTime() + "");
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
const logout = async (isAuthenticated) => {
|
|
131
|
+
if (isAuthenticated) {
|
|
132
|
+
await networkOperation({
|
|
133
|
+
endPoint: `auth/logout`,
|
|
134
|
+
method: "POST"
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
dispatch({
|
|
138
|
+
type: EnumTypes.Logout
|
|
139
|
+
});
|
|
140
|
+
setNextValSession(new Date().getTime() + "");
|
|
141
|
+
};
|
|
142
|
+
const onNetserviceUnautorized = () => {
|
|
143
|
+
logout(false);
|
|
144
|
+
};
|
|
145
|
+
useEffect(() => {
|
|
146
|
+
events_add_listener(EmitEvents.EMMIT_EVENT_NET_SERVICE_UNAUTHORIZED, onNetserviceUnautorized);
|
|
147
|
+
}, []);
|
|
148
|
+
return /* @__PURE__ */ jsx(AuthContext.Provider, {
|
|
149
|
+
value: {
|
|
150
|
+
...state,
|
|
151
|
+
login,
|
|
152
|
+
logout
|
|
153
|
+
},
|
|
154
|
+
children
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
export {
|
|
158
|
+
AuthContext as A,
|
|
159
|
+
AuthProvider as a
|
|
160
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { AuthProviderProps, SessionContextType } from './types';
|
|
3
|
+
declare const AuthContext: import("react").Context<SessionContextType | null>;
|
|
4
|
+
declare function AuthProvider(props: AuthProviderProps): import("react").JSX.Element;
|
|
5
|
+
export { AuthContext, AuthProvider };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { DomainCountry, Maybe } from '@m4l/core';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export declare enum EnumTypes {
|
|
4
|
+
Initial = "INITIALIZE",
|
|
5
|
+
Login = "LOGIN",
|
|
6
|
+
Logout = "LOGOUT"
|
|
7
|
+
}
|
|
8
|
+
export declare type AuthProviderProps = {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
export declare type ActionMap<M extends {
|
|
12
|
+
[index: string]: any;
|
|
13
|
+
}> = {
|
|
14
|
+
[Key in keyof M]: M[Key] extends undefined ? {
|
|
15
|
+
type: Key;
|
|
16
|
+
} : {
|
|
17
|
+
type: Key;
|
|
18
|
+
payload: M[Key];
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export declare type SessionAuthPayload = {
|
|
22
|
+
[EnumTypes.Initial]: {
|
|
23
|
+
isAuthenticated: boolean;
|
|
24
|
+
user: AuthUser;
|
|
25
|
+
};
|
|
26
|
+
[EnumTypes.Login]: {
|
|
27
|
+
user: AuthUser;
|
|
28
|
+
};
|
|
29
|
+
[EnumTypes.Logout]: undefined;
|
|
30
|
+
};
|
|
31
|
+
export declare type SessionActions = ActionMap<SessionAuthPayload>[keyof ActionMap<SessionAuthPayload>];
|
|
32
|
+
export interface User {
|
|
33
|
+
email: string;
|
|
34
|
+
id: number;
|
|
35
|
+
first_name: string;
|
|
36
|
+
last_name: string;
|
|
37
|
+
account_id: number;
|
|
38
|
+
domain_country: DomainCountry;
|
|
39
|
+
avatar_url?: Maybe<string>;
|
|
40
|
+
user_type_id?: number;
|
|
41
|
+
}
|
|
42
|
+
export declare type AuthUser = Maybe<User>;
|
|
43
|
+
export declare type AuthState = {
|
|
44
|
+
isAuthenticated: boolean;
|
|
45
|
+
isInitialized: boolean;
|
|
46
|
+
user: AuthUser;
|
|
47
|
+
};
|
|
48
|
+
export interface SessionContextType extends AuthState {
|
|
49
|
+
login: (email: string, password: string, remember: boolean) => object | undefined;
|
|
50
|
+
logout: (isAuthenticated: boolean) => Promise<void>;
|
|
51
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AuthContext';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { A as AuthContext } from "../../contexts/AuthContext/index.59755369.js";
|
|
3
|
+
const useAuth = () => {
|
|
4
|
+
const context = useContext(AuthContext);
|
|
5
|
+
if (!context)
|
|
6
|
+
throw new Error("Auth context must be use inside AuthProvider");
|
|
7
|
+
return context;
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
useAuth as u
|
|
11
|
+
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { useContext } from "react";
|
|
2
|
-
import { M as MasterDetailContext } from "../../layouts/MasterDetailLayout/index.js";
|
|
2
|
+
import { M as MasterDetailContext } from "../../layouts/MasterDetailLayout/index.748f7ada.js";
|
|
3
3
|
const useMasterDetail = () => useContext(MasterDetailContext);
|
|
4
|
-
export {
|
|
4
|
+
export {
|
|
5
|
+
useMasterDetail as u
|
|
6
|
+
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { useContext } from "react";
|
|
2
|
-
import { M as ModuleContext } from "../../layouts/ModuleLayout/index.js";
|
|
2
|
+
import { M as ModuleContext } from "../../layouts/ModuleLayout/index.e7218171.js";
|
|
3
3
|
const useModule = () => {
|
|
4
4
|
const context = useContext(ModuleContext);
|
|
5
5
|
if (!context)
|
|
6
6
|
throw new Error("useModule context must be use inside ModuleContext");
|
|
7
7
|
return context;
|
|
8
8
|
};
|
|
9
|
-
export {
|
|
9
|
+
export {
|
|
10
|
+
useModule as u
|
|
11
|
+
};
|
package/index.d.ts
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { M } from "./components/index.56bd7864.js";
|
|
2
|
+
import { M as M2 } from "./components/MFHostApp/index.6286a793.js";
|
|
3
|
+
import { A, a } from "./contexts/AuthContext/index.59755369.js";
|
|
4
|
+
import { a as a2, d, g } from "./layouts/ModuleLayout/index.e7218171.js";
|
|
5
|
+
import { a as a3, d as d2, g as g2 } from "./layouts/MasterDetailLayout/index.748f7ada.js";
|
|
6
|
+
import { N, d as d3, g as g3 } from "./layouts/NoAuthModuleLayout/index.83cd3ea3.js";
|
|
7
|
+
import { u } from "./hooks/useMasterDetail/index.d45f2a86.js";
|
|
8
|
+
import { u as u2 } from "./hooks/useAuth/index.ae68bf71.js";
|
|
9
|
+
import { u as u3 } from "./hooks/useModule/index.b5f598b1.js";
|
|
10
|
+
import "@m4l/core";
|
|
11
|
+
import "@m4l/graphics";
|
|
12
|
+
import "@m4l/components";
|
|
13
|
+
import "react/jsx-runtime";
|
|
14
|
+
import "react-router-dom";
|
|
15
|
+
import "react";
|
|
16
|
+
import "@mui/material/styles";
|
|
17
|
+
import "@mui/material";
|
|
18
|
+
import "@mui/base";
|
|
19
|
+
export {
|
|
20
|
+
A as AuthContext,
|
|
21
|
+
a as AuthProvider,
|
|
22
|
+
M2 as MFHostApp,
|
|
23
|
+
M as MFNoAuthApp,
|
|
24
|
+
a3 as MasterDetailLayout,
|
|
25
|
+
a2 as ModuleLayout,
|
|
26
|
+
N as NoAuthModuleLayout,
|
|
27
|
+
d2 as defaultMasterDetailDictionary,
|
|
28
|
+
d as defaultModuleLayoutDictionary,
|
|
29
|
+
d3 as defaultNoAuthModuleLayoutDictionary,
|
|
30
|
+
g2 as getMasterDetailLayoutComponentsDictionary,
|
|
31
|
+
g as getModuleLayoutComponentsDictionary,
|
|
32
|
+
g3 as getNoAuthModuleLayoutComponentsDictionary,
|
|
33
|
+
u2 as useAuth,
|
|
34
|
+
u as useMasterDetail,
|
|
35
|
+
u3 as useModule
|
|
36
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { MasterDetailLayoutProps } from './types';
|
|
3
|
-
export declare function MasterDetailLayout(props: MasterDetailLayoutProps): JSX.Element;
|
|
3
|
+
export declare function MasterDetailLayout(props: MasterDetailLayoutProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const componentName = "M4LMasterDetailLayout";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MasterDetailLayoutClassesType } from './types';
|
|
2
|
+
export declare const masterDetailLayoutClasses: MasterDetailLayoutClassesType;
|
|
3
|
+
export declare function getMasterDetailLayoutUtilityClass(slot: string): string;
|
|
4
|
+
export declare const useMasterDetailLayoutUtilityClasses: () => {
|
|
5
|
+
root: string;
|
|
6
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { useMasterDetailLayoutUtilityClasses } from ".";
|
|
2
|
+
export interface MasterDetailLayoutClassesType {
|
|
3
|
+
root: string;
|
|
4
|
+
}
|
|
5
|
+
export declare type MasterDetailLayoutClassesKey = keyof MasterDetailLayoutClassesType;
|
|
6
|
+
export declare type Classes = ReturnType<typeof useMasterDetailLayoutUtilityClasses>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MasterDetailContextProps, MasterDetailProviderProps } from './types';
|
|
3
3
|
declare const MasterDetailContext: import("react").Context<MasterDetailContextProps>;
|
|
4
|
-
declare function MasterDetailProvider(props: MasterDetailProviderProps): JSX.Element;
|
|
4
|
+
declare function MasterDetailProvider(props: MasterDetailProviderProps): import("react").JSX.Element;
|
|
5
5
|
export { MasterDetailProvider, MasterDetailContext };
|
|
@@ -4,10 +4,9 @@ export interface MasterDetailContextStateProps {
|
|
|
4
4
|
masterSelection?: MasterSelecion;
|
|
5
5
|
}
|
|
6
6
|
export interface MasterDetailProviderProps {
|
|
7
|
-
masterSelection: MasterSelecion;
|
|
8
|
-
setMasterSelection: (newMasterSelecion: MasterSelecion) => void;
|
|
9
7
|
children: ReactNode;
|
|
8
|
+
onClickViewDetail: () => void;
|
|
10
9
|
}
|
|
11
|
-
export interface MasterDetailContextProps extends MasterDetailContextStateProps {
|
|
10
|
+
export interface MasterDetailContextProps extends MasterDetailContextStateProps, Pick<MasterDetailProviderProps, 'onClickViewDetail'> {
|
|
12
11
|
onChangeMasterSelection: (newMasterSelection: MasterSelecion) => void;
|
|
13
12
|
}
|