@asaleh37/ui-base 1.2.0 → 1.2.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.
Files changed (74) hide show
  1. package/.env +4 -0
  2. package/.env.development +1 -0
  3. package/.env.production +1 -0
  4. package/dist/index.d.ts +18 -37
  5. package/dist/index.js +5 -5
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +5 -5
  8. package/dist/index.mjs.map +1 -1
  9. package/index.html +13 -0
  10. package/package.json +1 -1
  11. package/public/__logo.png +0 -0
  12. package/public/logo.png +0 -0
  13. package/public/vite.svg +1 -0
  14. package/rollup.config-1748377725725.cjs +16 -16
  15. package/src/assets/logo.png +0 -0
  16. package/src/components/App.tsx +39 -9
  17. package/src/components/BaseApp.tsx +37 -25
  18. package/src/components/admin/AttachmentGrid.tsx +1 -1
  19. package/src/components/admin/AuthorityGrid.tsx +1 -1
  20. package/src/components/admin/BluePrintGrid.tsx +1 -1
  21. package/src/components/admin/BluePrintPageGrid.tsx +1 -1
  22. package/src/components/admin/BluePrintPointGrid.tsx +1 -1
  23. package/src/components/admin/DashboardGrid.tsx +1 -1
  24. package/src/components/admin/DashboardWidgetGrid.tsx +1 -1
  25. package/src/components/admin/DataQueryGrid.tsx +1 -1
  26. package/src/components/admin/DataQueryParameterGrid.tsx +1 -1
  27. package/src/components/admin/DatasourceConnectionGrid.tsx +1 -1
  28. package/src/components/admin/EmployeeGrid.tsx +1 -1
  29. package/src/components/admin/EntityParameterGrid.tsx +1 -1
  30. package/src/components/admin/ExcelUploaderDetailGrid.tsx +1 -1
  31. package/src/components/admin/ExcelUploaderHeaderGrid.tsx +1 -1
  32. package/src/components/admin/LookupGrid.tsx +1 -1
  33. package/src/components/admin/MailAttachmentGrid.tsx +1 -1
  34. package/src/components/admin/MailBodyGrid.tsx +1 -1
  35. package/src/components/admin/MailNotificationQueueGrid.tsx +1 -1
  36. package/src/components/admin/MailRecipientGrid.tsx +1 -1
  37. package/src/components/admin/MailTemplateGrid.tsx +1 -1
  38. package/src/components/admin/NewTableGrid.tsx +1 -1
  39. package/src/components/admin/NotificationGrid.tsx +1 -1
  40. package/src/components/admin/NotificationQueueGrid.tsx +1 -1
  41. package/src/components/admin/OrganizationApplicationGrid.tsx +1 -1
  42. package/src/components/admin/OrganizationGrid.tsx +1 -1
  43. package/src/components/admin/OrganizationRankGrid.tsx +1 -1
  44. package/src/components/admin/OrganizationUnitGrid.tsx +1 -1
  45. package/src/components/admin/OrganizationUserGrid.tsx +1 -1
  46. package/src/components/admin/OrganizationUserRoleGrid.tsx +1 -1
  47. package/src/components/admin/ReportGrid.tsx +1 -1
  48. package/src/components/admin/ReportParameterGrid.tsx +1 -1
  49. package/src/components/admin/RoleAuthoritiesForm.tsx +65 -0
  50. package/src/components/admin/RoleAuthorityGrid.tsx +1 -1
  51. package/src/components/admin/RoleGrid.tsx +68 -14
  52. package/src/components/admin/UserAccountGrid.tsx +1 -1
  53. package/src/components/admin/UserRequestGrid.tsx +1 -1
  54. package/src/components/admin/WidgetGrid.tsx +1 -1
  55. package/src/components/admin/WorkflowDocumentActionGrid.tsx +1 -1
  56. package/src/components/admin/WorkflowDocumentActionHistoryGrid.tsx +1 -1
  57. package/src/components/admin/WorkflowDocumentActionMailGrid.tsx +1 -1
  58. package/src/components/admin/WorkflowDocumentGrid.tsx +1 -1
  59. package/src/components/admin/WorkflowDocumentMailLogGrid.tsx +1 -1
  60. package/src/components/admin/WorkflowDocumentStatusGrid.tsx +1 -1
  61. package/src/components/common/Home.tsx +3 -0
  62. package/src/components/common/Login.tsx +10 -3
  63. package/src/components/templates/DataEntryTemplates/DataEntryTypes.ts +1 -1
  64. package/src/components/templates/TransferList.tsx +4 -7
  65. package/src/hooks/index.ts +1 -0
  66. package/src/{components/templates/DataEntryTemplates → hooks}/useApiActions.ts +4 -5
  67. package/src/layout/Layout.tsx +36 -29
  68. package/src/main.tsx +25 -0
  69. package/src/redux/features/CounterSlice.tsx +13 -0
  70. package/src/redux/features/common/AppInfoSlice.ts +1 -1
  71. package/src/redux/features/common/CommonStoreSlice.ts +19 -5
  72. package/src/redux/store.ts +25 -24
  73. package/src/util/constants.ts +5 -1
  74. package/vite.config.ts +10 -0
@@ -1,7 +1,9 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
+ import { useAxios, useWindow } from "../../hooks";
6
+ import RoleAuthoritiesForm from "./RoleAuthoritiesForm";
5
7
 
6
8
  const RoleGrid: React.FC = () => {
7
9
  const [data, setData] = useState([]);
@@ -12,7 +14,37 @@ const RoleGrid: React.FC = () => {
12
14
  findById: "api/v1/admin/role",
13
15
  setData: setData,
14
16
  });
15
-
17
+ const [selectedRole, setSelectedRole] = useState<any>(null);
18
+ const { handleGetRequest } = useAxios();
19
+ const [selectedRoleAuthorities, setSelectedRoleAuthorities] = useState<any>(
20
+ []
21
+ );
22
+ const [
23
+ selectedRoleAvailableAuthorities,
24
+ setSelectedRoleAvailableAuthorities,
25
+ ] = useState<any>([]);
26
+ const {
27
+ Window: RoleAuthoritiesWindow,
28
+ setWindowState: setRoleAuthorirtiesWindowOpen,
29
+ } = useWindow({
30
+ width: "50%",
31
+ windowIcon: "key",
32
+ windowTitle: "Role Authorities",
33
+ });
34
+ const loadRoleAuthorities = async (data: any) => {
35
+ await handleGetRequest({
36
+ endPointURI: "api/v1/admin/role/authorities",
37
+ showMask: true,
38
+ parameters: {
39
+ roleId: data.id,
40
+ },
41
+ successCallBkFn: (response: any) => {
42
+ setRoleAuthorirtiesWindowOpen(true);
43
+ setSelectedRoleAuthorities(response.data.selectedAuthorities);
44
+ setSelectedRoleAvailableAuthorities(response.data.availableAuthorities);
45
+ },
46
+ });
47
+ };
16
48
  const formElements: Array<FormElementProps> = [
17
49
  {
18
50
  type: "field",
@@ -60,18 +92,40 @@ const RoleGrid: React.FC = () => {
60
92
  ];
61
93
 
62
94
  return (
63
- <TemplateGrid
64
- apiActions={apiActions}
65
- data={data}
66
- setData={setData}
67
- editMode={{ editMode: "row", reloadAfterSave: true }}
68
- formElements={formElements}
69
- keyColumnName={"id"}
70
- gridTitle="ROLE_PLURAL"
71
- girdIcon="table-cells"
72
- editAction={{ isEnabled: true, authority: "ROLE_EDIT" }}
73
- deleteAction={{ isEnabled: true, authority: "ROLE_DELETE" }}
74
- />
95
+ <>
96
+ <RoleAuthoritiesWindow>
97
+ <RoleAuthoritiesForm
98
+ roleId={selectedRole?.id}
99
+ availableAuthorities={selectedRoleAvailableAuthorities}
100
+ currentRoleAuthorities={selectedRoleAuthorities}
101
+ closeModalFn={() => {
102
+ setRoleAuthorirtiesWindowOpen(false);
103
+ }}
104
+ />
105
+ </RoleAuthoritiesWindow>
106
+ <TemplateGrid
107
+ rowActions={[
108
+ {
109
+ icon: "key",
110
+ label: "authorities",
111
+ actionFn: async (data) => {
112
+ setSelectedRole(data);
113
+ loadRoleAuthorities(data);
114
+ },
115
+ },
116
+ ]}
117
+ apiActions={apiActions}
118
+ data={data}
119
+ setData={setData}
120
+ editMode={{ editMode: "row", reloadAfterSave: true }}
121
+ formElements={formElements}
122
+ keyColumnName={"id"}
123
+ gridTitle="ROLE_PLURAL"
124
+ girdIcon="table-cells"
125
+ editAction={{ isEnabled: true, authority: "ROLE_EDIT" }}
126
+ deleteAction={{ isEnabled: true, authority: "ROLE_DELETE" }}
127
+ />
128
+ </>
75
129
  );
76
130
  };
77
131
 
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const UserAccountGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const UserRequestGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const WidgetGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const WorkflowDocumentActionGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const WorkflowDocumentActionHistoryGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const WorkflowDocumentActionMailGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const WorkflowDocumentGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const WorkflowDocumentMailLogGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const WorkflowDocumentStatusGrid: React.FC = () => {
@@ -1,7 +1,9 @@
1
1
  import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
2
2
  import { Box } from "@mui/material";
3
+ import { useSelector } from "react-redux";
3
4
 
4
5
  const Home: React.FC = () => {
6
+ const counter = useSelector((state) => state.counter.value);
5
7
  return (
6
8
  <Box
7
9
  sx={{
@@ -24,6 +26,7 @@ const Home: React.FC = () => {
24
26
  />
25
27
  ] to navigate to your authorized system modules
26
28
  </div>
29
+ <div>counter [{counter}]</div>
27
30
  </Box>
28
31
  );
29
32
  };
@@ -14,6 +14,7 @@ import axios from "axios";
14
14
  import { toast } from "react-toastify";
15
15
  import { RootState } from "../../redux/store";
16
16
  import { UserSessionActions } from "../../redux/features/common/UserSessionSlice";
17
+ import { DARK_THEME_INITIAL_MAIN_COLOR, DARK_THEME_INITIAL_SECANDARY_COLOR } from "../../util";
17
18
 
18
19
  const Login: React.FC = () => {
19
20
  const appInfo = useSelector((state: RootState) => state.AppInfo.value);
@@ -73,7 +74,10 @@ const Login: React.FC = () => {
73
74
  /* Custom Scrollbar */
74
75
  * {
75
76
  scrollbar-width: thin;
76
- scrollbar-color: ${appInfo.appTheme.dark.primaryColor} #121212;
77
+ scrollbar-color: ${
78
+ appInfo.appTheme?.dark?.primaryColor ||
79
+ DARK_THEME_INITIAL_MAIN_COLOR
80
+ } #121212;
77
81
  }
78
82
 
79
83
  /* Webkit Browsers */
@@ -87,10 +91,13 @@ const Login: React.FC = () => {
87
91
  palette: {
88
92
  mode: "dark",
89
93
  primary: {
90
- main: appInfo.appTheme.dark.primaryColor,
94
+ main:
95
+ appInfo.appTheme?.dark?.primaryColor || DARK_THEME_INITIAL_MAIN_COLOR,
91
96
  },
92
97
  secondary: {
93
- main: appInfo.appTheme.dark.secondaryColor,
98
+ main:
99
+ appInfo.appTheme?.dark?.secondaryColor ||
100
+ DARK_THEME_INITIAL_SECANDARY_COLOR,
94
101
  },
95
102
  },
96
103
  });
@@ -8,7 +8,7 @@ import {
8
8
  } from "@mui/x-data-grid-premium";
9
9
  import { UseFormReturn } from "react-hook-form";
10
10
  import { SxProps } from "@mui/material";
11
- import { ApiActions } from "./useApiActions";
11
+ import { ApiActions } from "../../../hooks/useApiActions";
12
12
  export type MakeOptional<T, K extends keyof T> = Omit<T, K> &
13
13
  Partial<Pick<T, K>>;
14
14
 
@@ -8,7 +8,7 @@ import ListItemIcon from "@mui/material/ListItemIcon";
8
8
  import Checkbox from "@mui/material/Checkbox";
9
9
  import Button from "@mui/material/Button";
10
10
  import Divider from "@mui/material/Divider";
11
- import { Box, Grid2 } from "@mui/material";
11
+ import { Box, Grid2, ListItemButton } from "@mui/material";
12
12
  import TemplateTextField from "./DataEntryTemplates/TemplateDataForm/FormFields/TemplateTextField";
13
13
 
14
14
  function not(a, b) {
@@ -172,27 +172,24 @@ const TransferList: React.FC<TransferListProps> = ({
172
172
  const labelId = `transfer-list-all-item-${value[valueField]}-label`;
173
173
 
174
174
  return (
175
- <ListItem
175
+ <ListItemButton
176
176
  key={value[valueField]}
177
177
  role="listitem"
178
- component="button"
179
178
  onClick={handleToggle(value)}
179
+ sx={{ cursor: "pointer" }}
180
180
  >
181
181
  <ListItemIcon>
182
182
  <Checkbox
183
183
  checked={checked.indexOf(value) !== -1}
184
184
  tabIndex={-1}
185
185
  disableRipple
186
- inputProps={{
187
- "aria-labelledby": labelId,
188
- }}
189
186
  />
190
187
  </ListItemIcon>
191
188
  <ListItemText
192
189
  id={value[valueField]}
193
190
  primary={value[displayField]}
194
191
  />
195
- </ListItem>
192
+ </ListItemButton>
196
193
  );
197
194
  })}
198
195
  </List>
@@ -4,3 +4,4 @@ export { default as useLoadingMask } from "./useLoadingMask";
4
4
  export { useIsMobile } from "./UseMobile";
5
5
  export { default as useSession } from "./UseSession";
6
6
  export { useWindow } from "./UseWindow";
7
+ export { default as useApiActions } from "./useApiActions";
@@ -1,8 +1,7 @@
1
1
  import { useDispatch, useSelector } from "react-redux";
2
- import { RootState } from "../../../redux/store";
3
- import useSession from "../../../hooks/UseSession";
4
- import useAxios from "../../../hooks/useAxios";
5
- import { setStoreData } from "../../../redux/features/common/CommonStoreSlice";
2
+ import useSession from "./UseSession";
3
+ import useAxios from "./useAxios";
4
+ import { setStoreData } from "../redux/features/common/CommonStoreSlice";
6
5
 
7
6
  export type ApiActionsProps = {
8
7
  findAll?: string;
@@ -25,7 +24,7 @@ export type ApiActions = {
25
24
  const useApiActions: (apiActionsProps: ApiActionsProps) => ApiActions = (
26
25
  apiActionsProps: ApiActionsProps
27
26
  ) => {
28
- const CommonStores = useSelector((state: RootState) => state.commonStores);
27
+ const CommonStores = useSelector((state: any) => state.commonStores.stores);
29
28
  const dispatch = useDispatch();
30
29
  const session = useSession();
31
30
  const { handleGetRequest, handlePostRequest, handleDeleteRequest } =
@@ -8,8 +8,7 @@ import MainContent from "./MainContent";
8
8
  import { BrowserRouter } from "react-router-dom";
9
9
  import MobileDrawer from "./MobileDrawer";
10
10
  import { ToastContainer } from "react-toastify";
11
- import { useEffect } from "react";
12
- import { RootState } from "../redux/store";
11
+ import { useEffect, useState } from "react";
13
12
  import useLoadingMask from "../hooks/useLoadingMask";
14
13
  import { useIsMobile } from "../hooks/UseMobile";
15
14
  import useSession from "../hooks/UseSession";
@@ -25,10 +24,11 @@ const Main = styled("main", {
25
24
  })<{
26
25
  open?: boolean;
27
26
  }>(({ theme: any, open }) => {
28
- const AppLayout = useSelector((state: RootState) => state.AppLayout);
27
+ const AppLayout = useSelector((state: any) => state.AppLayout);
29
28
  const dispatch = useDispatch();
30
29
  const { show, hide } = useLoadingMask();
31
- const CommonStores = useSelector((state: RootState) => state.commonStores);
30
+ const commonStores = useSelector((state: any) => state.commonStores);
31
+ const [isAutoLoadLoaded, setAutoLoadLoaded] = useState<boolean>(false);
32
32
  const theme = useTheme();
33
33
  const isMobile = useIsMobile();
34
34
  const { isUserAuthorized } = useSession();
@@ -36,34 +36,41 @@ const Main = styled("main", {
36
36
  // loadCommonStores
37
37
  const { handleGetRequest } = useAxios();
38
38
  const loadCommonStores = async () => {
39
- show("Loading ... please wait");
40
- let storeKeys = Object.keys(CommonStores);
41
- for (let storeKey of storeKeys) {
42
- if (
43
- (CommonStores[storeKey]?.authority === undefined ||
44
- CommonStores[storeKey]?.authority === null ||
45
- isUserAuthorized(CommonStores[storeKey]?.authority)) &&
46
- CommonStores[storeKey]?.url != "" &&
47
- CommonStores[storeKey].autoLoad === true
48
- ) {
49
- await handleGetRequest({
50
- endPointURI: CommonStores[storeKey].url,
51
- showMask: false,
52
- successCallBkFn: (response) => {
53
- dispatch(setStoreData({ storeKey, data: response.data }));
54
- },
55
- failureCallBkFn: () => {
56
- dispatch(setStoreData({ storeKey, data: [] }));
57
- },
58
- });
39
+ debugger;
40
+ if (!isAutoLoadLoaded) {
41
+ setAutoLoadLoaded(true);
42
+ show("Loading ... please wait");
43
+ const stores = commonStores.stores;
44
+ const storeKeys = commonStores.storeKeys;
45
+ for (let storeKey of storeKeys) {
46
+ if (
47
+ (stores[storeKey]?.authority === undefined ||
48
+ stores[storeKey]?.authority === null ||
49
+ isUserAuthorized(stores[storeKey]?.authority)) &&
50
+ stores[storeKey]?.url != "" &&
51
+ stores[storeKey].autoLoad === true
52
+ ) {
53
+ await handleGetRequest({
54
+ endPointURI: stores[storeKey].url,
55
+ showMask: false,
56
+ successCallBkFn: (response) => {
57
+ dispatch(setStoreData({ storeKey, data: response.data }));
58
+ },
59
+ failureCallBkFn: () => {
60
+ dispatch(setStoreData({ storeKey, data: [] }));
61
+ },
62
+ });
63
+ }
59
64
  }
65
+ hide();
60
66
  }
61
- hide();
62
67
  };
63
68
 
64
69
  useEffect(() => {
65
- loadCommonStores();
66
- }, []);
70
+ if (commonStores.storeKeys) {
71
+ loadCommonStores();
72
+ }
73
+ }, [commonStores.storeKeys]);
67
74
 
68
75
  return {
69
76
  display: "flex",
@@ -95,10 +102,10 @@ const Main = styled("main", {
95
102
  });
96
103
 
97
104
  export default function Layout() {
98
- const AppLayoutState = useSelector((state: RootState) => state.AppLayout);
105
+ const AppLayoutState = useSelector((state: any) => state.AppLayout);
99
106
  const isMobile = useIsMobile();
100
107
  const UserSession: UserSessionProps = useSelector(
101
- (state: RootState) => state.UserSession
108
+ (state: any) => state.UserSession
102
109
  );
103
110
  return (
104
111
  <BrowserRouter>
package/src/main.tsx ADDED
@@ -0,0 +1,25 @@
1
+ import { StrictMode } from "react";
2
+ import { createRoot } from "react-dom/client";
3
+ import { BaseApp } from "./components";
4
+ import logo from "./assets/logo.png";
5
+ import CounterReducer from "./redux/features/CounterSlice";
6
+
7
+ createRoot(document.getElementById("root")!).render(
8
+ <BaseApp
9
+ apiBaseUrl="http://localhost:8080/as-api"
10
+ appLogo={logo}
11
+ appName="UI Base Library"
12
+ appVersion="0.0"
13
+ businessCommonStoresMetaData={{}}
14
+ businessNavigationItems={[]}
15
+ businessReduxReducers={
16
+ {
17
+ counter: CounterReducer
18
+ }
19
+ }
20
+ businessRoutes={[]}
21
+ documentTitle="UI Base"
22
+ enableAdministrationModule={true}
23
+ muiPremiumKey="c2bd611fa642666253500ab9c8e4f78fTz0xMTE4MjEsRT0xNzc2OTg4Nzk5MDAwLFM9cHJlbWl1bSxMTT1zdWJzY3JpcHRpb24sUFY9aW5pdGlhbCxLVj0y"
24
+ />
25
+ );
@@ -0,0 +1,13 @@
1
+ import { createSlice } from "@reduxjs/toolkit";
2
+
3
+ const CounterSlice = createSlice({
4
+ name: "counter",
5
+ initialState: { value: 0 },
6
+ reducers: {
7
+ increment: (state) => {
8
+ state.value = state.value + 1;
9
+ },
10
+ },
11
+ });
12
+
13
+ export default CounterSlice.reducer;
@@ -15,7 +15,7 @@ export type AppInfo = {
15
15
  businessCommonStoresMetaData: { [key: string]: StoreMetaData };
16
16
  muiPremiumKey: string;
17
17
  enableAdministrationModule: boolean;
18
- appTheme: {
18
+ appTheme?: {
19
19
  light: { primaryColor: string; secondaryColor: string };
20
20
  dark: { primaryColor: string; secondaryColor: string };
21
21
  };
@@ -1,7 +1,9 @@
1
1
  import { createSlice, PayloadAction } from "@reduxjs/toolkit";
2
2
 
3
3
  export interface CommonStoresInterface {
4
- [key: string]: StoreMetaData;
4
+ stores: { [key: string]: StoreMetaData };
5
+ storeKeys: Array<String>;
6
+ isAutoLoadLoaded: boolean;
5
7
  }
6
8
 
7
9
  interface setStoreDataProps {
@@ -16,17 +18,29 @@ export interface StoreMetaData {
16
18
  authority?: string;
17
19
  }
18
20
 
19
- export const commonStoresInitialState: CommonStoresInterface = {};
21
+ export const commonStoresInitialState: CommonStoresInterface = {
22
+ stores: {},
23
+ storeKeys: [],
24
+ isAutoLoadLoaded: false,
25
+ };
20
26
 
21
27
  const commonStoreSlice = createSlice({
22
28
  name: "loadingMask",
23
29
  initialState: commonStoresInitialState,
24
30
  reducers: {
25
- setStoreData(state, action: PayloadAction<setStoreDataProps>) {
26
- state[action.payload.storeKey].data = action.payload.data;
31
+ setStoresMetaData: (state, action) => {
32
+ state.stores = action.payload;
33
+ state.storeKeys = Object.keys(action.payload);
34
+ },
35
+ setStoreData: (state, action: PayloadAction<setStoreDataProps>) => {
36
+ state.stores[action.payload.storeKey].data = action.payload.data;
37
+ },
38
+ setAutoLoadLoaded: () => {
39
+ state.isAutoLoadLoaded = true;
27
40
  },
28
41
  },
29
42
  });
30
43
 
31
- export const { setStoreData } = commonStoreSlice.actions;
44
+ export const { setStoreData, setStoresMetaData, setAutoLoadLoaded } =
45
+ commonStoreSlice.actions;
32
46
  export default commonStoreSlice.reducer;
@@ -1,28 +1,29 @@
1
- import { configureStore, Reducer } from "@reduxjs/toolkit";
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/common/CommonStoreSlice";
6
- import AppInfoReducer from "./features/common/AppInfoSlice";
1
+ // import { configureStore, Reducer } from "@reduxjs/toolkit";
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/common/CommonStoreSlice";
6
+ // import AppInfoReducer from "./features/common/AppInfoSlice";
7
7
 
8
- const reducers = {
9
- AppLayout: AppLayoutReducer,
10
- UserSession: UserSessionReducer,
11
- loadingMask: LoadingMaskReducer,
12
- commonStores: CommonStoreReducer,
13
- AppInfo: AppInfoReducer,
14
- };
8
+ // const reducers = {
9
+ // AppLayout: AppLayoutReducer,
10
+ // UserSession: UserSessionReducer,
11
+ // loadingMask: LoadingMaskReducer,
12
+ // commonStores: CommonStoreReducer,
13
+ // AppInfo: AppInfoReducer,
14
+ // };
15
15
 
16
- export function addReducer(key: string, reducer: Reducer<any>) {
17
- if (!reducers[key]) {
18
- reducers[key] = reducer;
19
- }
20
- }
16
+ // export function addReducer(key: string, reducer: Reducer<any>) {
17
+ // debugger;
18
+ // // if (!reducers[key]) {
19
+ // reducers[key] = reducer;
20
+ // // }
21
+ // }
21
22
 
22
- export const store = configureStore({
23
- reducer: reducers,
24
- });
23
+ // export const store = configureStore({
24
+ // reducer: reducers,
25
+ // });
25
26
 
26
- // Infer the `RootState` and `AppDispatch` types from the store itself
27
- export type RootState = ReturnType<typeof store.getState>;
28
- export type AppDispatch = typeof store.dispatch;
27
+ // // Infer the `RootState` and `AppDispatch` types from the store itself
28
+ // export type RootState = ReturnType<typeof store.getState>;
29
+ // export type AppDispatch = typeof store.dispatch;
@@ -1,2 +1,6 @@
1
1
  export const DATE_FORMAT = "YYYY-MM-DD";
2
- export const DATE_TIME_FORMAT = "YYYY-MM-DD HH:mm:ss";
2
+ export const DATE_TIME_FORMAT = "YYYY-MM-DD HH:mm:ss";
3
+ export const LIGHT_THEME_INITIAL_MAIN_COLOR = "#37505C";
4
+ export const LIGHT_THEME_INITIAL_SECANDARY_COLOR = "#ff6d00";
5
+ export const DARK_THEME_INITIAL_MAIN_COLOR = "#ea690e";
6
+ export const DARK_THEME_INITIAL_SECANDARY_COLOR = "#74776B";
package/vite.config.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { defineConfig } from "vite";
2
+ import react from "@vitejs/plugin-react";
3
+
4
+ // https://vite.dev/config/
5
+ export default defineConfig({
6
+ plugins: [react()],
7
+ server: {
8
+ port: 3000,
9
+ },
10
+ });