@dashadmin/dash-admin-state 1.3.25 → 1.3.28

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 (70) hide show
  1. package/dist/DefaultThemeSettings.js +34 -1
  2. package/dist/defaults/defaultAuth.js +9 -1
  3. package/dist/defaults/defaultCommon.js +44 -1
  4. package/dist/defaults/defaultFormState.js +5 -1
  5. package/dist/defaults/defaultPage.js +9 -1
  6. package/dist/defaults/defaultSettings.js +51 -1
  7. package/dist/hooks/DashAdminStateSelectors.js +149 -1
  8. package/dist/hooks/useLocalStorage.js +69 -1
  9. package/dist/index.js +41 -691
  10. package/dist/redux/ReduxStoreAccesor.js +19 -1
  11. package/dist/redux/actions/ActionTypes.js +84 -1
  12. package/dist/redux/actions/Auth.js +6 -1
  13. package/dist/redux/actions/Common.js +51 -1
  14. package/dist/redux/actions/ComponentData.js +33 -1
  15. package/dist/redux/actions/Menu.js +5 -1
  16. package/dist/redux/actions/Page.js +7 -1
  17. package/dist/redux/actions/Resources.js +21 -1
  18. package/dist/redux/actions/Setting.js +90 -1
  19. package/dist/redux/actions/index.js +6 -1
  20. package/dist/redux/reducers/Auth.js +55 -1
  21. package/dist/redux/reducers/Common.js +134 -1
  22. package/dist/redux/reducers/ComponentData.js +59 -1
  23. package/dist/redux/reducers/FormData.js +32 -1
  24. package/dist/redux/reducers/Menu.js +22 -1
  25. package/dist/redux/reducers/Page.js +30 -1
  26. package/dist/redux/reducers/Resources.js +19 -1
  27. package/dist/redux/reducers/Settings.js +79 -1
  28. package/dist/redux/reducers/index.js +25 -1
  29. package/dist/redux/sagas/index.js +9 -1
  30. package/dist/redux/store/index.js +35 -1
  31. package/package.json +75 -57
  32. package/src/DefaultThemeSettings.tsx +33 -0
  33. package/src/defaults/defaultAuth.tsx +8 -0
  34. package/src/defaults/defaultCommon.tsx +55 -0
  35. package/src/defaults/defaultFormState.tsx +4 -0
  36. package/src/defaults/defaultPage.tsx +9 -0
  37. package/src/defaults/defaultSettings.tsx +61 -0
  38. package/src/hooks/DashAdminStateSelectors.tsx +142 -0
  39. package/src/hooks/useLocalStorage.tsx +79 -0
  40. package/src/index.tsx +34 -0
  41. package/src/redux/ReduxStoreAccesor.tsx +18 -0
  42. package/src/redux/actions/ActionTypes.tsx +47 -0
  43. package/src/redux/actions/Auth.tsx +5 -0
  44. package/src/redux/actions/Common.tsx +51 -0
  45. package/src/redux/actions/ComponentData.tsx +78 -0
  46. package/src/redux/actions/Menu.tsx +4 -0
  47. package/src/redux/actions/Page.tsx +6 -0
  48. package/src/redux/actions/Resources.tsx +19 -0
  49. package/src/redux/actions/Setting.tsx +91 -0
  50. package/src/redux/actions/index.tsx +7 -0
  51. package/src/redux/interfaces/IAuthState.tsx +7 -0
  52. package/src/redux/interfaces/ICommonState.tsx +25 -0
  53. package/src/redux/interfaces/IComponentData.tsx +32 -0
  54. package/src/redux/interfaces/IDASHAppState.tsx +53 -0
  55. package/src/redux/interfaces/IDashResourceGroupsIcons.tsx +5 -0
  56. package/src/redux/interfaces/IFormDataState.tsx +6 -0
  57. package/src/redux/interfaces/IPage.tsx +27 -0
  58. package/src/redux/interfaces/IResources.tsx +0 -0
  59. package/src/redux/interfaces/ISettings.tsx +27 -0
  60. package/src/redux/reducers/Auth.tsx +38 -0
  61. package/src/redux/reducers/Common.tsx +144 -0
  62. package/src/redux/reducers/ComponentData.tsx +52 -0
  63. package/src/redux/reducers/FormData.tsx +21 -0
  64. package/src/redux/reducers/Menu.tsx +27 -0
  65. package/src/redux/reducers/Page.tsx +17 -0
  66. package/src/redux/reducers/Resources.tsx +19 -0
  67. package/src/redux/reducers/Settings.tsx +78 -0
  68. package/src/redux/reducers/index.tsx +25 -0
  69. package/src/redux/sagas/index.tsx +8 -0
  70. package/src/redux/store/index.tsx +33 -0
@@ -1 +1,30 @@
1
- const r="UPDATE_PAGE",a=(e={},t)=>t.type===r?{...e,...t.payload}:e;var p=a;export{r as ACTION_UPDATE_PAGE,p as default};
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ const ACTION_UPDATE_PAGE = "UPDATE_PAGE";
18
+ const PageReducer = (state = {}, action) => {
19
+ switch (action.type) {
20
+ case ACTION_UPDATE_PAGE:
21
+ return __spreadValues(__spreadValues({}, state), action.payload);
22
+ default:
23
+ return state;
24
+ }
25
+ };
26
+ var Page_default = PageReducer;
27
+ export {
28
+ ACTION_UPDATE_PAGE,
29
+ Page_default as default
30
+ };
@@ -1 +1,19 @@
1
- import{APPEND_RESOURCES as t,SET_RESOURCES as s}from"../actions/ActionTypes";const m=(r={items:[]},e)=>{switch(e.type){case s:return{items:[...e.payload]};case t:return{items:[...r.items,...e.payload]};default:return r}};var a=m;export{a as default};
1
+ import { APPEND_RESOURCES, SET_RESOURCES } from "../actions/ActionTypes";
2
+ const ResourcesReducer = (state = { items: [] }, action) => {
3
+ switch (action.type) {
4
+ case SET_RESOURCES:
5
+ return {
6
+ items: [...action.payload]
7
+ };
8
+ case APPEND_RESOURCES:
9
+ return {
10
+ items: [...state.items, ...action.payload]
11
+ };
12
+ default:
13
+ return state;
14
+ }
15
+ };
16
+ var Resources_default = ResourcesReducer;
17
+ export {
18
+ Resources_default as default
19
+ };
@@ -1 +1,79 @@
1
- import l from"../../DefaultThemeSettings";import{UPDATE_THEME_SETTINGS as T,SWITCH_LANGUAGE as t,SET_RESOURCES as u}from"../actions/ActionTypes";const o=(e={loading:!1,navStyle:void 0,layoutType:"",themeType:void 0,themeColor:"",isDirectionRTL:!1,locale:{languageId:"",locale:"",name:"",icon:""}},r)=>{switch(r.type){case u:return{...e,resources:r.payload};case l.THEME_TYPE:return{...e,themeType:r.themeType};case l.THEME_COLOR:return{...e,themeColor:r.themeColor};case l.UPDATE_RTL_STATUS:return{...e,isDirectionRTL:r.rtlStatus};case T:return{...e,...r.payload};case l.NAV_STYLE:return{...e,navStyle:r.navStyle};case l.LAYOUT_TYPE:return{...e,layoutType:r.layoutType};case t:return{...e,locale:r.payload};default:return e}};var E=o;export{E as default};
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import DefaultThemeSettings from "../../DefaultThemeSettings";
21
+ import {
22
+ UPDATE_THEME_SETTINGS,
23
+ SWITCH_LANGUAGE,
24
+ SET_RESOURCES
25
+ } from "../actions/ActionTypes";
26
+ const SettingsReducer = (state = {
27
+ loading: false,
28
+ navStyle: void 0,
29
+ layoutType: "",
30
+ themeType: void 0,
31
+ themeColor: "",
32
+ isDirectionRTL: false,
33
+ /* @ts-ignore */
34
+ locale: {
35
+ languageId: "",
36
+ locale: "",
37
+ name: "",
38
+ icon: ""
39
+ }
40
+ }, action) => {
41
+ switch (action.type) {
42
+ case SET_RESOURCES:
43
+ return __spreadProps(__spreadValues({}, state), {
44
+ resources: action.payload
45
+ });
46
+ case DefaultThemeSettings.THEME_TYPE:
47
+ return __spreadProps(__spreadValues({}, state), {
48
+ themeType: action.themeType
49
+ });
50
+ case DefaultThemeSettings.THEME_COLOR:
51
+ return __spreadProps(__spreadValues({}, state), {
52
+ themeColor: action.themeColor
53
+ });
54
+ case DefaultThemeSettings.UPDATE_RTL_STATUS:
55
+ return __spreadProps(__spreadValues({}, state), {
56
+ isDirectionRTL: action.rtlStatus
57
+ });
58
+ case UPDATE_THEME_SETTINGS:
59
+ return __spreadValues(__spreadValues({}, state), action.payload);
60
+ case DefaultThemeSettings.NAV_STYLE:
61
+ return __spreadProps(__spreadValues({}, state), {
62
+ navStyle: action.navStyle
63
+ });
64
+ case DefaultThemeSettings.LAYOUT_TYPE:
65
+ return __spreadProps(__spreadValues({}, state), {
66
+ layoutType: action.layoutType
67
+ });
68
+ case SWITCH_LANGUAGE:
69
+ return __spreadProps(__spreadValues({}, state), {
70
+ locale: action.payload
71
+ });
72
+ default:
73
+ return state;
74
+ }
75
+ };
76
+ var Settings_default = SettingsReducer;
77
+ export {
78
+ Settings_default as default
79
+ };
@@ -1 +1,25 @@
1
- import{combineReducers as e}from"redux";import o from"./Settings";import r from"./Auth";import m from"./Common";import t from"./Page";import c from"./Resources";import u from"./FormData";import p from"./Menu";import a from"./ComponentData";const i=()=>e({page:t,settings:o,auth:r,common:m,resources:c,formData:u,menu:p,componentData:a});var C=i;export{i as createRootReducer,C as default};
1
+ import { combineReducers } from "redux";
2
+ import SettingsReducer from "./Settings";
3
+ import AuthReducer from "./Auth";
4
+ import CommonReducer from "./Common";
5
+ import PageReducer from "./Page";
6
+ import ResourcesReducer from "./Resources";
7
+ import FormDataReducer from "./FormData";
8
+ import MenuReducer from "./Menu";
9
+ import ComponentDataReducer from "./ComponentData";
10
+ const createRootReducer = () => combineReducers({
11
+ //router: connectRouter(history),
12
+ page: PageReducer,
13
+ settings: SettingsReducer,
14
+ auth: AuthReducer,
15
+ common: CommonReducer,
16
+ resources: ResourcesReducer,
17
+ formData: FormDataReducer,
18
+ menu: MenuReducer,
19
+ componentData: ComponentDataReducer
20
+ });
21
+ var reducers_default = createRootReducer;
22
+ export {
23
+ createRootReducer,
24
+ reducers_default as default
25
+ };
@@ -1 +1,9 @@
1
- import{all as t}from"redux-saga/effects";function*o(a){yield t([])}export{o as default};
1
+ import { all } from "redux-saga/effects";
2
+ function* rootSaga(getState) {
3
+ yield all([
4
+ //authSagas(),
5
+ ]);
6
+ }
7
+ export {
8
+ rootSaga as default
9
+ };
@@ -1 +1,35 @@
1
- import m from"redux-saga";import{applyMiddleware as i,compose as c}from"redux";import{routerMiddleware as r}from"connected-react-router";import s from"../sagas/index";import d from"../reducers";import{createBrowserHistory as p}from"history";import{legacy_createStore as n}from"redux";import{thunk as f}from"redux-thunk";const o=p(),l=r(o),e=m(),u=[f,e,l],w=t=>{const a=n(d(),t,c(i(r(o),...u)));return e.run(s,{}),a};var B=w;export{w as configureStore,B as default,o as history};
1
+ import createSagaMiddleware from "redux-saga";
2
+ import { applyMiddleware, compose } from "redux";
3
+ import { routerMiddleware } from "connected-react-router";
4
+ import rootSaga from "../sagas/index";
5
+ import createRootReducer from "../reducers";
6
+ import { createBrowserHistory } from "history";
7
+ import { legacy_createStore as createStore } from "redux";
8
+ import { thunk } from "redux-thunk";
9
+ const history = createBrowserHistory();
10
+ const routeMiddleware = routerMiddleware(history);
11
+ const sagaMiddleware = createSagaMiddleware();
12
+ const middlewares = [thunk, sagaMiddleware, routeMiddleware];
13
+ const configureStore = (preloadedState) => {
14
+ const store = createStore(
15
+ createRootReducer(
16
+ /*history*/
17
+ ),
18
+ // root reducer with router state
19
+ preloadedState,
20
+ compose(
21
+ applyMiddleware(
22
+ routerMiddleware(history),
23
+ ...middlewares
24
+ )
25
+ )
26
+ );
27
+ sagaMiddleware.run(rootSaga, {});
28
+ return store;
29
+ };
30
+ var store_default = configureStore;
31
+ export {
32
+ configureStore,
33
+ store_default as default,
34
+ history
35
+ };
package/package.json CHANGED
@@ -1,58 +1,76 @@
1
1
  {
2
- "name": "@dashadmin/dash-admin-state",
3
- "version": "1.3.25",
4
- "private": false,
5
- "license": "MIT",
6
- "main": "dist/index.js",
7
- "devDependencies": {
8
- "@commitlint/cli": "latest",
9
- "@commitlint/config-conventional": "latest",
10
- "@types/jest": "latest",
11
- "@types/node": "latest",
12
- "@types/react": "latest",
13
- "@types/react-dom": "latest",
14
- "@typescript-eslint/eslint-plugin": "latest",
15
- "@typescript-eslint/parser": "latest",
16
- "eslint-config-airbnb-typescript": "latest",
17
- "eslint-config-prettier": "latest",
18
- "eslint-plugin-html": "latest",
19
- "eslint-plugin-import": "latest",
20
- "eslint-plugin-jsdoc": "latest",
21
- "eslint-plugin-json": "latest",
22
- "eslint-plugin-prettier": "latest",
23
- "ts-jest": "latest",
24
- "ts-loader": "latest",
25
- "tsconfig-paths": "latest",
26
- "typescript": "latest",
27
- "vite": "^5.2.0",
28
- "rollup": "^4.0.0"
29
- },
30
- "dependencies": {
31
- "connected-react-router": "latest",
32
- "history": "latest",
33
- "react-redux": "latest",
34
- "redux-saga": "latest",
35
- "redux-thunk": "^3.1.0",
36
- "@dashadmin/dash-auto-admin": "1.3.25",
37
- "@dashadmin/dash-constants": "1.3.25",
38
- "@dashadmin/dash-utils": "1.3.25"
39
- },
40
- "publishConfig": {
41
- "name": "@dashadmin/dash-admin-state",
42
- "access": "public"
43
- },
44
- "files": [
45
- "dist"
46
- ],
47
- "exports": {
48
- ".": {
49
- "import": "./dist/index.js"
50
- },
51
- "./src/*": {
52
- "import": "./dist/*.js"
53
- }
54
- },
55
- "scripts": {
56
- "build": "rm -rf dist && node ../dash-build/compile.mjs && vite build"
57
- }
58
- }
2
+ "name": "@dashadmin/dash-admin-state",
3
+ "version": "1.3.28",
4
+ "license": "MIT",
5
+ "main": "dist/index.js",
6
+ "devDependencies": {
7
+ "@commitlint/cli": "latest",
8
+ "@commitlint/config-conventional": "latest",
9
+ "@types/jest": "latest",
10
+ "@types/node": "latest",
11
+ "@types/react": "latest",
12
+ "@types/react-dom": "latest",
13
+ "@typescript-eslint/eslint-plugin": "latest",
14
+ "@typescript-eslint/parser": "latest",
15
+ "eslint-config-airbnb-typescript": "latest",
16
+ "eslint-config-prettier": "latest",
17
+ "eslint-plugin-html": "latest",
18
+ "eslint-plugin-import": "latest",
19
+ "eslint-plugin-jsdoc": "latest",
20
+ "eslint-plugin-json": "latest",
21
+ "eslint-plugin-prettier": "latest",
22
+ "ts-jest": "latest",
23
+ "ts-loader": "latest",
24
+ "tsconfig-paths": "latest",
25
+ "typescript": "latest"
26
+ },
27
+ "dependencies": {
28
+ "connected-react-router": "latest",
29
+ "@dashadmin/dash-auto-admin": "workspace:*",
30
+ "@dashadmin/dash-constants": "workspace:*",
31
+ "@dashadmin/dash-utils": "workspace:*",
32
+ "history": "latest",
33
+ "react-redux": "latest",
34
+ "redux-saga": "latest",
35
+ "redux-thunk": "^3.1.0"
36
+ },
37
+ "module": "dist/index.js",
38
+ "types": "./src/index.tsx",
39
+ "exports": {
40
+ ".": "./dist/index.js",
41
+ "./redux/actions": "./dist/redux/actions/index.js",
42
+ "./src/redux/actions": "./dist/redux/actions/index.js",
43
+ "./redux/reducers": "./dist/redux/reducers/index.js",
44
+ "./src/redux/reducers": "./dist/redux/reducers/index.js",
45
+ "./redux/sagas": "./dist/redux/sagas/index.js",
46
+ "./src/redux/sagas": "./dist/redux/sagas/index.js",
47
+ "./redux/store": "./dist/redux/store/index.js",
48
+ "./src/redux/store": "./dist/redux/store/index.js",
49
+ "./*": "./dist/*.js",
50
+ "./src/*": "./dist/*.js"
51
+ },
52
+ "publishConfig": {
53
+ "access": "public",
54
+ "registry": "https://registry.npmjs.org"
55
+ },
56
+ "scripts": {
57
+ "build": "tsup"
58
+ },
59
+ "type": "module",
60
+ "files": [
61
+ "dist",
62
+ "src"
63
+ ],
64
+ "typesVersions": {
65
+ "*": {
66
+ "src/*": [
67
+ "src/*",
68
+ "src/*/index"
69
+ ],
70
+ "*": [
71
+ "src/*",
72
+ "src/*/index"
73
+ ]
74
+ }
75
+ }
76
+ }
@@ -0,0 +1,33 @@
1
+ class DefaultThemeSettings {
2
+
3
+ static TAB_SIZE = 992;
4
+ static MOBILE_SIZE = 575;
5
+ static THEME_TYPE = 'THEME_TYPE';
6
+ static THEME_TYPE_LIGHT = 'light';
7
+ static THEME_TYPE_DARK = 'dark';
8
+ static THEME_TYPE_DASH_DEFAULT = 'light';
9
+ static THEME_TYPE_SEMI_DARK = 'THEME_TYPE_SEMI_DARK';
10
+ static THEME_COLOR = 'THEME_COLOR';
11
+ static LAYOUT_TYPE = 'LAYOUT_TYPE';
12
+ static LAYOUT_TYPE_FRAMED = 'framed-layout';
13
+ static LAYOUT_TYPE_BOXED = 'boxed-layout';
14
+ static LAYOUT_TYPE_FULL = 'full-layout';
15
+ static NAV_STYLE = 'NAV_STYLE';
16
+ static NAV_STYLE_FIXED = 'NAV_STYLE_FIXED';
17
+ static NAV_STYLE_MINI_SIDEBAR = 'NAV_STYLE_MINI_SIDEBAR';
18
+ static NAV_STYLE_DRAWER = 'NAV_STYLE_DRAWER';
19
+ static NAV_STYLE_NO_HEADER_MINI_SIDEBAR = 'NAV_STYLE_NO_HEADER_MINI_SIDEBAR';
20
+ static NAV_STYLE_NO_HEADER_EXPANDED_SIDEBAR =
21
+ 'NAV_STYLE_NO_HEADER_EXPANDED_SIDEBAR';
22
+ static NAV_STYLE_DEFAULT_HORIZONTAL = 'NAV_STYLE_DEFAULT_HORIZONTAL';
23
+ static NAV_STYLE_DARK_HORIZONTAL = 'NAV_STYLE_DARK_HORIZONTAL';
24
+ static NAV_STYLE_INSIDE_HEADER_HORIZONTAL =
25
+ 'NAV_STYLE_INSIDE_HEADER_HORIZONTAL';
26
+ static NAV_STYLE_BELOW_HEADER = 'NAV_STYLE_BELOW_HEADER';
27
+ static NAV_STYLE_ABOVE_HEADER = 'NAV_STYLE_ABOVE_HEADER';
28
+ static NAV_STYLE_COLLAPSABLE = 'NAV_STYLE_COLLAPSABLE';
29
+ static UPDATE_RTL_STATUS = 'UPDATE_RTL_STATUS';
30
+
31
+ }
32
+
33
+ export default DefaultThemeSettings;
@@ -0,0 +1,8 @@
1
+ import IAuthState from "../redux/interfaces/IAuthState";
2
+
3
+ const defaultAuth = {
4
+ authenticated: false,
5
+ user: null,
6
+ auth: null,
7
+ };
8
+ export default defaultAuth;
@@ -0,0 +1,55 @@
1
+ import ICommonState from "../redux/interfaces/ICommonState";
2
+
3
+ /**
4
+ * Default Common State
5
+ *
6
+ * Provides default values for common application state including
7
+ * layout, navigation, and panel settings. These can be overridden
8
+ * by the consuming application during store initialization.
9
+ */
10
+ const defaultCommon: ICommonState = {
11
+ appPath: '/',
12
+ error: '',
13
+ loading: false,
14
+ message: '',
15
+ navExpanded: true,
16
+ width: typeof window !== 'undefined' ? window.innerWidth : 1920,
17
+ height: typeof window !== 'undefined' ? window.innerHeight : 1080,
18
+ content_width: null,
19
+ content_height: null,
20
+ pathname: '/',
21
+ componentsState: {},
22
+ headerToolBar: null,
23
+ headerToolBarReplace: false,
24
+ navSize: "small",
25
+
26
+ // Panel settings with sidebar dimensions
27
+ // These values can be overridden by CSS variables at runtime
28
+ panelSettings: {
29
+ // Branding
30
+ appName: 'Dash App',
31
+ horizontalLogo: <>🖥</>,
32
+ squaredLogo: <>🖥</>,
33
+ loginBackground: undefined,
34
+
35
+ // Sidebar dimensions (can be overridden via CSS variables)
36
+ sidebarLargeWidth: 255,
37
+ sidebarSmallWidth: 64,
38
+ sidebarHorizontalHeight: 120,
39
+
40
+ // Logo dimensions
41
+ logoVerticalMaxWidth: 130,
42
+ logoVerticalMaxHeight: 130,
43
+ logoHorizontalMaxWidth: 200,
44
+ logoHorizontalMaxHeight: 60,
45
+
46
+ // Content padding (derived from sidebar)
47
+ paddingHorizontal: 255,
48
+ paddingVertical: 120,
49
+
50
+ // Position
51
+ sidebarPosition: 'left',
52
+ },
53
+ };
54
+
55
+ export default defaultCommon;
@@ -0,0 +1,4 @@
1
+
2
+ const defaultFormState = {};
3
+
4
+ export default defaultFormState
@@ -0,0 +1,9 @@
1
+ import IPageState from "../redux/interfaces/IPage";
2
+
3
+ const defaultPageSettings: IPageState = {
4
+ title: '',
5
+ icon: null,
6
+ subTitle: '',
7
+ };
8
+
9
+ export default defaultPageSettings;
@@ -0,0 +1,61 @@
1
+ import ISettingsState from "../redux/interfaces/ISettings";
2
+ import {DASHAdminSystemConstants} from 'dash-constants';
3
+
4
+ /**
5
+ * Default Settings State
6
+ *
7
+ * Provides default values for all settings. These can be overridden
8
+ * by the consuming application during store initialization.
9
+ */
10
+ const defaultSettings: ISettingsState = {
11
+ // Loading state
12
+ loading: false,
13
+
14
+ // Navigation and layout
15
+ navStyle: DASHAdminSystemConstants.panel.NAV_STYLE_FIXED,
16
+ layoutType: DASHAdminSystemConstants.panel.LAYOUT_TYPE_FULL,
17
+ themeType: DASHAdminSystemConstants.panel.THEME_TYPE_DARK,
18
+ themeColor: '',
19
+ isDirectionRTL: false,
20
+
21
+ // Layout settings (dimensions, breakpoints, etc.)
22
+ layoutSettings: {
23
+ // Sidebar dimensions
24
+ sidebarLargeWidth: 255,
25
+ sidebarSmallWidth: 64,
26
+ sidebarHorizontalHeight: 120,
27
+ // Logo dimensions
28
+ logoVerticalMaxWidth: 130,
29
+ logoVerticalMaxHeight: 130,
30
+ logoHorizontalMaxWidth: 200,
31
+ logoHorizontalMaxHeight: 60,
32
+ // Content padding (based on sidebar)
33
+ paddingHorizontal: 255,
34
+ paddingVertical: 120,
35
+ // Breakpoints
36
+ mobileBreakpoint: 768,
37
+ tabletBreakpoint: 1024,
38
+ },
39
+
40
+ // Localization
41
+ locale: 'es',
42
+ availableLocales: [
43
+ {
44
+ locale: 'es',
45
+ languageId: 'spanish',
46
+ name: 'Español',
47
+ icon: 'es',
48
+ },
49
+ {
50
+ locale: 'en',
51
+ languageId: 'english',
52
+ name: 'English',
53
+ icon: 'en',
54
+ },
55
+ ],
56
+
57
+ // Translations (populated by i18n provider)
58
+ translations: {},
59
+ };
60
+
61
+ export default defaultSettings;
@@ -0,0 +1,142 @@
1
+ import { useSelector } from 'react-redux';
2
+ import { useMemo } from 'react';
3
+ import { isEqual } from 'lodash';
4
+ import { IDASHAppState } from '../';
5
+ import { IDashAutoAdminResourceConfig } from 'dash-auto-admin';
6
+
7
+ // Custom hook for layout-related state
8
+ export const useLayoutState = <U, A>() => {
9
+ return useSelector(
10
+ (state: IDASHAppState<U, A, IDashAutoAdminResourceConfig>) => ({
11
+ navStyle: state.settings.navStyle,
12
+ layoutType: state.settings.layoutType,
13
+ themeType: state.settings.themeType,
14
+ layoutSettings: state.settings.layoutSettings,
15
+ navExpanded: state.common?.navExpanded ?? state.common?.navExpanded ?? true,
16
+ navSize: state.common.navSize,
17
+ panelSettings: state.common.panelSettings,
18
+ }),
19
+ isEqual
20
+ );
21
+ };
22
+
23
+ // Custom hook for authentication state
24
+ export const useAuthState = <U, A>() => {
25
+ return useSelector(
26
+ (state: IDASHAppState<U, A, IDashAutoAdminResourceConfig>) => ({
27
+ authenticated: state.auth.authenticated,
28
+ user: state.auth.user,
29
+ }),
30
+ isEqual
31
+ );
32
+ };
33
+
34
+ // Custom hook for app settings
35
+ export const useSettingsState = <U, A>() => {
36
+ return useSelector(
37
+ (state: IDASHAppState<U, A, IDashAutoAdminResourceConfig>) => ({
38
+ groupIcons: state.settings.groupIcons,
39
+ locale: state.settings.locale,
40
+ themeColor: state.settings.themeColor,
41
+ availableLocales: state.settings.availableLocales,
42
+ isDirectionRTL: state.settings.isDirectionRTL,
43
+ }),
44
+ isEqual
45
+ );
46
+ };
47
+
48
+ // Custom hook for common state
49
+ export const useCommonState = <U, A>() => {
50
+ return useSelector(
51
+ (state: IDASHAppState<U, A, IDashAutoAdminResourceConfig>) => ({
52
+ appPath: state.common.appPath,
53
+ width: state.common.width,
54
+ height: state.common.height,
55
+ headerToolBar: state.common.headerToolBar,
56
+ panelSettings: state.common.panelSettings,
57
+ }),
58
+ isEqual
59
+ );
60
+ };
61
+
62
+ // Custom hook for page state
63
+ export const usePageState = <U, A>() => {
64
+ return useSelector(
65
+ (state: IDASHAppState<U, A, IDashAutoAdminResourceConfig>) => ({
66
+ title: state.page.title,
67
+ icon: state.page.icon,
68
+ subTitle: state.page.subTitle,
69
+ }),
70
+ isEqual
71
+ );
72
+ };
73
+
74
+ // Custom hook for resources state
75
+ export const useResourcesState = <U, A>() => {
76
+ return useSelector(
77
+ (state: IDASHAppState<U, A, IDashAutoAdminResourceConfig>) => ({
78
+ items: state.resources.items,
79
+ }),
80
+ isEqual
81
+ );
82
+ };
83
+
84
+ // Memoized hook for logo settings specifically
85
+ export const useLogoSettings = <U, A>() => {
86
+ const { panelSettings } = useCommonState<U, A>();
87
+
88
+ return useMemo(() => ({
89
+ horizontalLogo: panelSettings?.horizontalLogo || <></>,
90
+ squaredLogo: panelSettings?.squaredLogo || <></>,
91
+ loginBackground: panelSettings?.loginBackground,
92
+ }), [panelSettings]);
93
+ };
94
+
95
+ // Memoized hook for sidebar/panel settings (dimensions, position, padding)
96
+ export const usePanelSettings = <U, A>() => {
97
+ const { panelSettings } = useCommonState<U, A>();
98
+
99
+ return useMemo(() => ({
100
+ // Sidebar position: 'left' | 'right' | 'top' | 'bottom'
101
+ sidebarPosition: panelSettings?.sidebarPosition || 'left',
102
+ // Sidebar dimensions
103
+ sidebarLargeWidth: panelSettings?.sidebarLargeWidth || 255,
104
+ sidebarSmallWidth: panelSettings?.sidebarSmallWidth || 60,
105
+ sidebarHorizontalHeight: panelSettings?.sidebarHorizontalHeight || 120,
106
+ // Logo dimensions for vertical sidebar (left/right)
107
+ logoVerticalMaxWidth: panelSettings?.logoVerticalMaxWidth || 130,
108
+ logoVerticalMaxHeight: panelSettings?.logoVerticalMaxHeight || 130,
109
+ // Logo dimensions for horizontal sidebar (top/bottom)
110
+ logoHorizontalMaxWidth: panelSettings?.logoHorizontalMaxWidth || 200,
111
+ logoHorizontalMaxHeight: panelSettings?.logoHorizontalMaxHeight || 60,
112
+ // Padding configuration
113
+ paddingHorizontal: panelSettings?.paddingHorizontal || 255,
114
+ paddingVertical: panelSettings?.paddingVertical || 120,
115
+ // App name
116
+ appName: panelSettings?.appName || 'DASH',
117
+ }), [panelSettings]);
118
+ };
119
+
120
+ // Combined hook for theme-related state (optimized for DomainTheme)
121
+ export const useThemeState = <U, A>() => {
122
+ const layoutState = useLayoutState<U, A>();
123
+ const logoSettings = useLogoSettings<U, A>();
124
+
125
+ return useMemo(() => ({
126
+ ...layoutState,
127
+ ...logoSettings,
128
+ }), [layoutState, logoSettings]);
129
+ };
130
+
131
+ // Hook for navigation state specifically
132
+ export const useNavigationState = <U, A>() => {
133
+ return useSelector(
134
+ (state: IDASHAppState<U, A, IDashAutoAdminResourceConfig>) => ({
135
+ navExpanded: state.common?.navExpanded ?? state.common?.navExpanded ?? true,
136
+ navSize: state.common.navSize,
137
+ navStyle: state.settings.navStyle,
138
+ layoutSettings: state.settings.layoutSettings,
139
+ }),
140
+ isEqual
141
+ );
142
+ };