@asaleh37/ui-base 1.0.9 → 1.1.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/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/App.tsx +31 -0
- package/src/components/admin/AttachmentGrid.tsx +116 -0
- package/src/components/admin/AuthorityGrid.tsx +88 -0
- package/src/components/admin/BluePrintGrid.tsx +55 -0
- package/src/components/admin/BluePrintPageGrid.tsx +85 -0
- package/src/components/admin/BluePrintPointGrid.tsx +85 -0
- package/src/components/admin/DashboardGrid.tsx +95 -0
- package/src/components/admin/DashboardWidgetGrid.tsx +75 -0
- package/src/components/admin/DataQueryGrid.tsx +75 -0
- package/src/components/admin/DataQueryParameterGrid.tsx +98 -0
- package/src/components/admin/DatasourceConnectionGrid.tsx +98 -0
- package/src/components/admin/EmployeeGrid.tsx +105 -0
- package/src/components/admin/EntityParameterGrid.tsx +125 -0
- package/src/components/admin/ExcelUploaderDetailGrid.tsx +78 -0
- package/src/components/admin/ExcelUploaderHeaderGrid.tsx +78 -0
- package/src/components/admin/LookupGrid.tsx +95 -0
- package/src/components/admin/MailAttachmentGrid.tsx +65 -0
- package/src/components/admin/MailBodyGrid.tsx +105 -0
- package/src/components/admin/MailNotificationQueueGrid.tsx +131 -0
- package/src/components/admin/MailRecipientGrid.tsx +75 -0
- package/src/components/admin/MailTemplateGrid.tsx +145 -0
- package/src/components/admin/NewTableGrid.tsx +65 -0
- package/src/components/admin/NotificationGrid.tsx +115 -0
- package/src/components/admin/NotificationQueueGrid.tsx +125 -0
- package/src/components/admin/OrganizationApplicationGrid.tsx +81 -0
- package/src/components/admin/OrganizationGrid.tsx +65 -0
- package/src/components/admin/OrganizationRankGrid.tsx +85 -0
- package/src/components/admin/OrganizationUnitGrid.tsx +85 -0
- package/src/components/admin/OrganizationUserGrid.tsx +75 -0
- package/src/components/admin/OrganizationUserRoleGrid.tsx +98 -0
- package/src/components/admin/ReportGrid.tsx +155 -0
- package/src/components/admin/ReportParameterGrid.tsx +95 -0
- package/src/components/admin/RoleAuthorityGrid.tsx +65 -0
- package/src/components/admin/RoleGrid.tsx +78 -0
- package/src/components/admin/UserAccountGrid.tsx +65 -0
- package/src/components/admin/UserRequestGrid.tsx +145 -0
- package/src/components/admin/WidgetGrid.tsx +175 -0
- package/src/components/admin/WorkflowDocumentActionGrid.tsx +111 -0
- package/src/components/admin/WorkflowDocumentActionHistoryGrid.tsx +111 -0
- package/src/components/admin/WorkflowDocumentActionMailGrid.tsx +71 -0
- package/src/components/admin/WorkflowDocumentGrid.tsx +185 -0
- package/src/components/admin/WorkflowDocumentMailLogGrid.tsx +141 -0
- package/src/components/admin/WorkflowDocumentStatusGrid.tsx +121 -0
- package/src/components/common/Home.tsx +31 -0
- package/src/components/common/LanguageSwitcher.tsx +25 -0
- package/src/components/common/LayoutHandlers.tsx +12 -0
- package/src/components/common/LoadingMask.tsx +19 -0
- package/src/components/common/Login.tsx +183 -0
- package/src/components/templates/DataEntryTemplates/DataEntryTypes.ts +288 -0
- package/src/components/templates/DataEntryTemplates/DataEntryUtil.ts +201 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormAction.tsx +60 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormElementField.tsx +194 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormElementGroup.tsx +98 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/CheckBox.tsx +64 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/ComboBox.tsx +94 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/Datefield.tsx +65 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/DatetimeField.tsx +64 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/FiltersPanel.tsx +237 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/TemplateTextField.tsx +9 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/TemplateForm.tsx +256 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/DataGridColumnsUtil.tsx +188 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid.tsx +844 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGridMultiRecordAction.tsx +89 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGridRecordAction.tsx +92 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGridTopBar.tsx +228 -0
- package/src/components/templates/DataEntryTemplates/useApiActions.ts +125 -0
- package/src/components/templates/TransferList.tsx +250 -0
- package/src/components/templates/Window/ConfirmationWindow.tsx +55 -0
- package/src/components/templates/visuals/TemplateDashboard.tsx +126 -0
- package/src/components/templates/visuals/charts/TemplateBarChart.tsx +16 -0
- package/src/components/templates/visuals/charts/TemplateDataCard.tsx +60 -0
- package/src/components/templates/visuals/charts/TemplateGauge.tsx +16 -0
- package/src/components/templates/visuals/charts/TemplateLineChart.tsx +16 -0
- package/src/components/templates/visuals/charts/TemplateLineProgress.tsx +40 -0
- package/src/components/templates/visuals/charts/TemplatePieChart.tsx +25 -0
- package/src/hooks/UseConfirmationWindow.tsx +54 -0
- package/src/hooks/UseMobile.tsx +13 -0
- package/src/hooks/UseSession.tsx +26 -0
- package/src/hooks/UseWindow.tsx +106 -0
- package/src/hooks/useAxios.tsx +271 -0
- package/src/hooks/useLoadingMask.tsx +16 -0
- package/src/layout/DrawerHeader.tsx +10 -0
- package/src/layout/Layout.tsx +122 -0
- package/src/layout/MainContent.tsx +43 -0
- package/src/layout/MobileDrawer.tsx +103 -0
- package/src/layout/NavigationTree.tsx +284 -0
- package/src/layout/SideBar.tsx +80 -0
- package/src/layout/TopBar.tsx +142 -0
- package/src/locales/arabic/adminLocalsAr.json +356 -0
- package/src/locales/arabic/common.json +34 -0
- package/src/locales/arabic/index.ts +7 -0
- package/src/locales/english/adminLocalsEn.json +356 -0
- package/src/locales/english/common.json +33 -0
- package/src/locales/english/index.ts +6 -0
- package/src/locales/english/index.tsx +0 -0
- package/src/locales/i18n.ts +15 -0
- package/src/locales/index.ts +9 -0
- package/src/navigationItems/Administration/adminNavigationItems.tsx +182 -0
- package/src/navigationItems/Administration/index.tsx +71 -0
- package/src/navigationItems/common/CommonNavigationItems.tsx +12 -0
- package/src/navigationItems/common/index.tsx +7 -0
- package/src/navigationItems/index.tsx +34 -0
- package/src/redux/features/administration/AdministrationStoresMetaData.ts +72 -0
- package/src/redux/features/business/BusinessStoresMetaData.ts +3 -0
- package/src/redux/features/business/CommonStoreSlice.ts +37 -0
- package/src/redux/features/common/AppInfoSlice.ts +30 -0
- package/src/redux/features/common/AppLayoutSlice.ts +37 -0
- package/src/redux/features/common/LoadingMaskSlice.ts +30 -0
- package/src/redux/features/common/UserSessionSlice.ts +62 -0
- package/src/redux/store.ts +10 -10
- package/src/routes/administration/adminRoutes.tsx +259 -0
- package/src/routes/administration/index.ts +4 -0
- package/src/routes/index.ts +11 -0
- package/src/routes/types/index.ts +5 -0
- package/src/theme/DarkThemeOptions.ts +30 -0
- package/src/theme/LightThemeOptions.ts +34 -0
- package/src/util/AppUtils.ts +18 -0
- package/src/util/constants.ts +2 -0
- package/tsconfig.json +2 -2
- package/src/redux/CounterSlice.ts +0 -17
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { TreeViewBaseItem } from "@mui/x-tree-view/models";
|
|
2
|
+
import { ExtendedTreeItemProps } from "..";
|
|
3
|
+
import { adminNavigationItems } from "./adminNavigationItems";
|
|
4
|
+
|
|
5
|
+
export const AdministrationItems: TreeViewBaseItem<ExtendedTreeItemProps>[] = [
|
|
6
|
+
...adminNavigationItems
|
|
7
|
+
// {
|
|
8
|
+
// id: "1",
|
|
9
|
+
// label: "System Administration",
|
|
10
|
+
// icon: "gears",
|
|
11
|
+
// authority: "DEVELOPMENT_ADMIN",
|
|
12
|
+
// children: [
|
|
13
|
+
// {
|
|
14
|
+
// id: "1.1",
|
|
15
|
+
// label: "Security",
|
|
16
|
+
// icon: "shield",
|
|
17
|
+
// action: "NAVIGATION",
|
|
18
|
+
// actionPayload: { path: "Security" },
|
|
19
|
+
// children: [
|
|
20
|
+
// {
|
|
21
|
+
// id: "1.1.1",
|
|
22
|
+
// label: "Roles",
|
|
23
|
+
// icon: "tag",
|
|
24
|
+
// action: "NAVIGATION",
|
|
25
|
+
// actionPayload: { path: "admin/security/roles" },
|
|
26
|
+
// },
|
|
27
|
+
// {
|
|
28
|
+
// id: "1.1.2",
|
|
29
|
+
// label: "Authorities",
|
|
30
|
+
// icon: "key",
|
|
31
|
+
// action: "NAVIGATION",
|
|
32
|
+
// actionPayload: { path: "admin/security/authorities" },
|
|
33
|
+
// children: [],
|
|
34
|
+
// },
|
|
35
|
+
// ],
|
|
36
|
+
// },
|
|
37
|
+
// {
|
|
38
|
+
// id: "1.2",
|
|
39
|
+
// label: "Development Tools",
|
|
40
|
+
// icon: "code",
|
|
41
|
+
// authority: "DEVELOPMENT_ADMIN",
|
|
42
|
+
// children: [
|
|
43
|
+
// {
|
|
44
|
+
// id: "1.2.1",
|
|
45
|
+
// label: "Datasources",
|
|
46
|
+
// icon: "database",
|
|
47
|
+
// authority: "DEVELOPMENT_ADMIN",
|
|
48
|
+
// action: "NAVIGATION",
|
|
49
|
+
// actionPayload: { path: "admin/datasources" },
|
|
50
|
+
// },
|
|
51
|
+
// {
|
|
52
|
+
// id: "1.2.2",
|
|
53
|
+
// label: "Parameters",
|
|
54
|
+
// icon: "p",
|
|
55
|
+
// authority: "DEVELOPMENT_ADMIN",
|
|
56
|
+
// action: "NAVIGATION",
|
|
57
|
+
// actionPayload: { path: "admin/parameters" },
|
|
58
|
+
// },
|
|
59
|
+
// {
|
|
60
|
+
// id: "1.2.3",
|
|
61
|
+
// label: "System Queries",
|
|
62
|
+
// icon: "file-code",
|
|
63
|
+
// authority: "DEVELOPMENT_ADMIN",
|
|
64
|
+
// action: "NAVIGATION",
|
|
65
|
+
// actionPayload: { path: "admin/queries" },
|
|
66
|
+
// },
|
|
67
|
+
// ],
|
|
68
|
+
// },
|
|
69
|
+
// ],
|
|
70
|
+
// },
|
|
71
|
+
];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TreeViewBaseItem } from "@mui/x-tree-view/models";
|
|
2
|
+
import { ExtendedTreeItemProps } from "..";
|
|
3
|
+
|
|
4
|
+
export const adminNavigationItems: TreeViewBaseItem<ExtendedTreeItemProps>[] = [
|
|
5
|
+
{
|
|
6
|
+
id: "admin.UserRequest",
|
|
7
|
+
label: "USER_REQUEST_PLURAL",
|
|
8
|
+
icon: "circle",
|
|
9
|
+
action: "NAVIGATION",
|
|
10
|
+
actionPayload: { path: "admin/userrequests" },
|
|
11
|
+
},
|
|
12
|
+
];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TreeViewBaseItem } from "@mui/x-tree-view/models";
|
|
2
|
+
import { ExtendedTreeItemProps } from "..";
|
|
3
|
+
import { adminNavigationItems } from "./CommonNavigationItems";
|
|
4
|
+
|
|
5
|
+
export const AdministrationItems: TreeViewBaseItem<ExtendedTreeItemProps>[] = [
|
|
6
|
+
...adminNavigationItems,
|
|
7
|
+
];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { TreeViewBaseItem } from "@mui/x-tree-view/models";
|
|
2
|
+
import { AdministrationItems } from "./Administration";
|
|
3
|
+
import { IconProp } from "@fortawesome/fontawesome-svg-core";
|
|
4
|
+
|
|
5
|
+
export type ExtendedTreeItemProps = {
|
|
6
|
+
icon: IconProp;
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
action?: "NAVIGATION";
|
|
10
|
+
authority?: string;
|
|
11
|
+
actionPayload?: {
|
|
12
|
+
path?: string;
|
|
13
|
+
parameters?: object;
|
|
14
|
+
};
|
|
15
|
+
children?: ExtendedTreeItemProps[];
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const findNavigationItemById = (
|
|
19
|
+
id: string,
|
|
20
|
+
nodes: ExtendedTreeItemProps[]
|
|
21
|
+
): ExtendedTreeItemProps | undefined => {
|
|
22
|
+
for (const node of nodes) {
|
|
23
|
+
if (node.id === id) return node;
|
|
24
|
+
if (node.children) {
|
|
25
|
+
const found = findNavigationItemById(id, node.children);
|
|
26
|
+
if (found) return found;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return undefined;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const NavigationItems: TreeViewBaseItem<ExtendedTreeItemProps>[] = [
|
|
33
|
+
...AdministrationItems,
|
|
34
|
+
];
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { CommonStoresInterface } from "../business/CommonStoreSlice";
|
|
2
|
+
|
|
3
|
+
export const ADMINISTRATION_STORES: CommonStoresInterface = {
|
|
4
|
+
SystemDataSourceType: {
|
|
5
|
+
autoLoad: false,
|
|
6
|
+
data: [{ value: "Mysql" }, { value: "Oracle" }, { value: "DB2" }],
|
|
7
|
+
url: "",
|
|
8
|
+
},
|
|
9
|
+
SystemParameterTypes: {
|
|
10
|
+
autoLoad: false,
|
|
11
|
+
url: "",
|
|
12
|
+
data: [
|
|
13
|
+
{ value: "datetime" },
|
|
14
|
+
{ value: "date" },
|
|
15
|
+
{ value: "text" },
|
|
16
|
+
{ value: "number" },
|
|
17
|
+
{ value: "droplist" },
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
SystemReportTypes: {
|
|
21
|
+
autoLoad: false,
|
|
22
|
+
url: "",
|
|
23
|
+
data: [{ value: "Excel" }, { value: "Jasper" }, { value: "Blueprint" }],
|
|
24
|
+
},
|
|
25
|
+
SystemWidgetTypes: {
|
|
26
|
+
autoLoad: false,
|
|
27
|
+
url: "",
|
|
28
|
+
data: [
|
|
29
|
+
{ name: "LineChart" },
|
|
30
|
+
{ name: "ColumnChart" },
|
|
31
|
+
{ name: "PieChart" },
|
|
32
|
+
{ name: "Card" },
|
|
33
|
+
{ name: "CircularProgress" },
|
|
34
|
+
{ name: "LinearProgress" },
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
SystemMailRecipientTypes: {
|
|
38
|
+
autoLoad: false,
|
|
39
|
+
url: "",
|
|
40
|
+
data: [{ name: "To" }, { name: "CC" }],
|
|
41
|
+
},
|
|
42
|
+
SystemDataSources: {
|
|
43
|
+
autoLoad: true,
|
|
44
|
+
data: [],
|
|
45
|
+
authority: "DEVELOPMENT_ADMIN",
|
|
46
|
+
url: "api/v1/admin/datasourceconnection/all",
|
|
47
|
+
},
|
|
48
|
+
SystemDataQueries: {
|
|
49
|
+
autoLoad: true,
|
|
50
|
+
data: [],
|
|
51
|
+
authority: "DEVELOPMENT_ADMIN",
|
|
52
|
+
url: "api/v1/admin/dataquery/all",
|
|
53
|
+
},
|
|
54
|
+
SystemEntityParameters: {
|
|
55
|
+
autoLoad: true,
|
|
56
|
+
data: [],
|
|
57
|
+
authority: "DEVELOPMENT_ADMIN",
|
|
58
|
+
url: "api/v1/admin/entityparameter/all",
|
|
59
|
+
},
|
|
60
|
+
SystemAuthorities: {
|
|
61
|
+
autoLoad: true,
|
|
62
|
+
data: [],
|
|
63
|
+
authority: "DEVELOPMENT_ADMIN",
|
|
64
|
+
url: "api/v1/admin/authority/all",
|
|
65
|
+
},
|
|
66
|
+
SystemRoles: {
|
|
67
|
+
autoLoad: true,
|
|
68
|
+
data: [],
|
|
69
|
+
authority: "DEVELOPMENT_ADMIN",
|
|
70
|
+
url: "api/v1/admin/role/all",
|
|
71
|
+
},
|
|
72
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
|
2
|
+
import { BUSINESS_STORES } from "./BusinessStoresMetaData";
|
|
3
|
+
import { ADMINISTRATION_STORES } from "../administration/AdministrationStoresMetaData";
|
|
4
|
+
|
|
5
|
+
export interface CommonStoresInterface {
|
|
6
|
+
[key: string]: StoreMetaData;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface setStoreDataProps {
|
|
10
|
+
storeKey: string;
|
|
11
|
+
data: Array<any>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface StoreMetaData {
|
|
15
|
+
url: string;
|
|
16
|
+
data: Array<any>;
|
|
17
|
+
autoLoad: boolean;
|
|
18
|
+
authority?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const initialState: CommonStoresInterface = {
|
|
22
|
+
...BUSINESS_STORES,
|
|
23
|
+
...ADMINISTRATION_STORES,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const commonStoreSlice = createSlice({
|
|
27
|
+
name: "loadingMask",
|
|
28
|
+
initialState,
|
|
29
|
+
reducers: {
|
|
30
|
+
setStoreData(state, action: PayloadAction<setStoreDataProps>) {
|
|
31
|
+
state[action.payload.storeKey].data = action.payload.data;
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export const { setStoreData } = commonStoreSlice.actions;
|
|
37
|
+
export default commonStoreSlice.reducer;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createSlice } from "@reduxjs/toolkit";
|
|
2
|
+
|
|
3
|
+
export type AppInfo = {
|
|
4
|
+
documentTitle: string;
|
|
5
|
+
apiBaseUrl: string;
|
|
6
|
+
appName: string;
|
|
7
|
+
appVersion: string;
|
|
8
|
+
appLogo: any;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const initialState: AppInfo = {
|
|
12
|
+
documentTitle: "",
|
|
13
|
+
apiBaseUrl: "",
|
|
14
|
+
appName: "",
|
|
15
|
+
appVersion: "",
|
|
16
|
+
appLogo: null,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const AppInfoSlice = createSlice({
|
|
20
|
+
name: "AppInfo",
|
|
21
|
+
initialState: initialState,
|
|
22
|
+
reducers: {
|
|
23
|
+
setAppInfo: (state, action) => {
|
|
24
|
+
state = action.payload;
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const AppInfoActions = AppInfoSlice.actions;
|
|
30
|
+
export default AppInfoSlice.reducer;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createSlice } from "@reduxjs/toolkit";
|
|
2
|
+
|
|
3
|
+
export const DRAWER_WIDTH = 350;
|
|
4
|
+
|
|
5
|
+
interface AppLayoutState {
|
|
6
|
+
sideBarOpened: boolean;
|
|
7
|
+
themeMode: "light" | "dark" | string;
|
|
8
|
+
appDirection: "ltr" | "rtl";
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const initialState: AppLayoutState = {
|
|
12
|
+
sideBarOpened: false,
|
|
13
|
+
themeMode: localStorage.getItem("themeMode") || "light",
|
|
14
|
+
appDirection: localStorage.getItem("language") == "ar" ? "rtl" : "ltr",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const AppLayoutSlice = createSlice({
|
|
18
|
+
name: "AppLayout",
|
|
19
|
+
initialState,
|
|
20
|
+
reducers: {
|
|
21
|
+
toggleSideBarState: (state) => {
|
|
22
|
+
state.sideBarOpened = !state.sideBarOpened;
|
|
23
|
+
},
|
|
24
|
+
setSideBarState: (state, action) => {
|
|
25
|
+
state.sideBarOpened = action.payload;
|
|
26
|
+
},
|
|
27
|
+
setThemeMode: (state, action) => {
|
|
28
|
+
state.themeMode = action.payload;
|
|
29
|
+
},
|
|
30
|
+
setAppDirection: (state, action) => {
|
|
31
|
+
state.appDirection = action.payload;
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export const AppLayoutActions = AppLayoutSlice.actions;
|
|
37
|
+
export default AppLayoutSlice.reducer;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
|
2
|
+
|
|
3
|
+
interface LoadingMaskStateValue {
|
|
4
|
+
value: { isOpened: boolean; message?: string | null };
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const initialState: LoadingMaskStateValue = {
|
|
8
|
+
value: { isOpened: false, message: null },
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const loadingMaskSlice = createSlice({
|
|
12
|
+
name: "loadingMask",
|
|
13
|
+
initialState,
|
|
14
|
+
reducers: {
|
|
15
|
+
showLoadingMask: (
|
|
16
|
+
state,
|
|
17
|
+
action: PayloadAction<string | null | undefined>
|
|
18
|
+
) => {
|
|
19
|
+
state.value.isOpened = true;
|
|
20
|
+
state.value.message = action.payload;
|
|
21
|
+
},
|
|
22
|
+
hideLoadingMask: (state) => {
|
|
23
|
+
state.value.isOpened = false;
|
|
24
|
+
state.value.message = null;
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const { showLoadingMask, hideLoadingMask } = loadingMaskSlice.actions;
|
|
30
|
+
export default loadingMaskSlice.reducer;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { createSlice } from "@reduxjs/toolkit";
|
|
2
|
+
|
|
3
|
+
export interface OrganizationProps {
|
|
4
|
+
organizationCode?: string;
|
|
5
|
+
organizationName?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface UserProfileProps {
|
|
8
|
+
username?: string;
|
|
9
|
+
currentOrganizationCode?: string;
|
|
10
|
+
userOrganizations?: Array<OrganizationProps>;
|
|
11
|
+
employeeNumber?: string;
|
|
12
|
+
employeeName?: string;
|
|
13
|
+
divisionCode?: string;
|
|
14
|
+
divisionName?: string;
|
|
15
|
+
departmentCode?: string;
|
|
16
|
+
departmentName?: string;
|
|
17
|
+
rankCode?: string;
|
|
18
|
+
rankName?: string;
|
|
19
|
+
sectionCode?: string;
|
|
20
|
+
sectionName?: string;
|
|
21
|
+
subsectionCode?: string;
|
|
22
|
+
subsectionName?: string;
|
|
23
|
+
extNumber?: string;
|
|
24
|
+
mobileNumber?: string;
|
|
25
|
+
email?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface UserSessionProps {
|
|
29
|
+
value: {
|
|
30
|
+
isAuthenticated: boolean | null;
|
|
31
|
+
userProfile: UserProfileProps | null;
|
|
32
|
+
authorities: Array<{ authority: string }>;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const initialState: UserSessionProps = {
|
|
37
|
+
value: {
|
|
38
|
+
isAuthenticated: null,
|
|
39
|
+
authorities: [],
|
|
40
|
+
userProfile: null,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const UserSessionSlice = createSlice({
|
|
45
|
+
name: "UserSession",
|
|
46
|
+
initialState,
|
|
47
|
+
reducers: {
|
|
48
|
+
setAuthenticated: (state, action) => {
|
|
49
|
+
state.value = action.payload;
|
|
50
|
+
},
|
|
51
|
+
setUnAuthenticated: (state) => {
|
|
52
|
+
state.value = {
|
|
53
|
+
isAuthenticated: false,
|
|
54
|
+
authorities: [],
|
|
55
|
+
userProfile: null,
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export const UserSessionActions = UserSessionSlice.actions;
|
|
62
|
+
export default UserSessionSlice.reducer;
|
package/src/redux/store.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { configureStore } from "@reduxjs/toolkit";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import AppLayoutReducer from "./features/common/AppLayoutSlice";
|
|
3
|
+
import UserSessionReducer from "./features/common/UserSessionSlice";
|
|
4
|
+
import LoadingMaskReducer from "./features/common/LoadingMaskSlice";
|
|
5
|
+
import CommonStoreReducer from "./features/business/CommonStoreSlice";
|
|
6
|
+
import AppInfoReducer from "./features/common/AppInfoSlice";
|
|
7
7
|
|
|
8
8
|
export const store = configureStore({
|
|
9
9
|
reducer: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
AppLayout: AppLayoutReducer,
|
|
11
|
+
UserSession: UserSessionReducer,
|
|
12
|
+
loadingMask: LoadingMaskReducer,
|
|
13
|
+
commonStores: CommonStoreReducer,
|
|
14
|
+
AppInfo: AppInfoReducer,
|
|
15
15
|
},
|
|
16
16
|
});
|
|
17
17
|
|