@asaleh37/ui-base 1.2.27 → 1.2.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.
- package/dist/index.d.ts +12 -4
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/rollup.config-1748377725725.cjs +16 -16
- package/src/components/BaseApp.tsx +14 -2
- package/src/layout/NavigationTree.tsx +3 -4
- package/src/locales/i18n.ts +0 -7
- package/src/main.tsx +1 -1
- package/src/redux/features/common/AppInfoSlice.ts +8 -4
- package/src/locals/book/arabic/bookLocalsAr.json +0 -8
- package/src/locals/book/english/bookLocalsEn.json +0 -8
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var resolve = require('@rollup/plugin-node-resolve');
|
|
6
|
-
var commonjs = require('@rollup/plugin-commonjs');
|
|
7
|
-
var typescript = require('@rollup/plugin-typescript');
|
|
8
|
-
var dts = require('rollup-plugin-dts');
|
|
9
|
-
var terser = require('@rollup/plugin-terser');
|
|
10
|
-
var json = require('@rollup/plugin-json');
|
|
11
|
-
var peerDepsExternal = require('rollup-plugin-peer-deps-external');
|
|
12
|
-
var postcss = require('rollup-plugin-postcss');
|
|
13
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var resolve = require('@rollup/plugin-node-resolve');
|
|
6
|
+
var commonjs = require('@rollup/plugin-commonjs');
|
|
7
|
+
var typescript = require('@rollup/plugin-typescript');
|
|
8
|
+
var dts = require('rollup-plugin-dts');
|
|
9
|
+
var terser = require('@rollup/plugin-terser');
|
|
10
|
+
var json = require('@rollup/plugin-json');
|
|
11
|
+
var peerDepsExternal = require('rollup-plugin-peer-deps-external');
|
|
12
|
+
var postcss = require('rollup-plugin-postcss');
|
|
13
|
+
|
|
14
14
|
const packageJson = require("./package.json");
|
|
15
15
|
|
|
16
16
|
var rollup_config = [
|
|
@@ -45,6 +45,6 @@ var rollup_config = [
|
|
|
45
45
|
plugins: [dts.default()],
|
|
46
46
|
external: [/\.css$/],
|
|
47
47
|
},
|
|
48
|
-
];
|
|
49
|
-
|
|
50
|
-
exports.default = rollup_config;
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
exports.default = rollup_config;
|
|
@@ -14,6 +14,10 @@ import CommonStoreReducer from "../redux/features/common/CommonStoreSlice";
|
|
|
14
14
|
import AppInfoReducer from "../redux/features/common/AppInfoSlice";
|
|
15
15
|
import SideBarReducer from "../redux/features/common/SideBarSlice";
|
|
16
16
|
import { configureStore } from "@reduxjs/toolkit";
|
|
17
|
+
import i18n from "../locales/i18n";
|
|
18
|
+
import { initReactI18next } from "react-i18next";
|
|
19
|
+
import { ENGLISH_TRANS } from "../locales/english";
|
|
20
|
+
import { ARABIC_TRANS } from "../locales/arabic";
|
|
17
21
|
|
|
18
22
|
library.add(fab);
|
|
19
23
|
library.add(far);
|
|
@@ -27,12 +31,20 @@ export const BaseApp: React.FC<AppInfo> = (props) => {
|
|
|
27
31
|
commonStores: CommonStoreReducer,
|
|
28
32
|
SideBar: SideBarReducer,
|
|
29
33
|
AppInfo: AppInfoReducer,
|
|
30
|
-
...props
|
|
34
|
+
...props?.businessReduxReducers,
|
|
31
35
|
};
|
|
32
36
|
const store = configureStore({
|
|
33
37
|
reducer: systemReducers,
|
|
34
38
|
});
|
|
35
|
-
|
|
39
|
+
const resources = {
|
|
40
|
+
en: { translation: { ...ENGLISH_TRANS, ...props?.businessLocals?.en } },
|
|
41
|
+
ar: { translation: { ...ARABIC_TRANS, ...props?.businessLocals?.ar } },
|
|
42
|
+
};
|
|
43
|
+
i18n.use(initReactI18next).init({
|
|
44
|
+
resources: resources, // Where we're gonna put translations' files
|
|
45
|
+
lng: localStorage.getItem("language") || "en", // Set the initial language of the App
|
|
46
|
+
fallbackLng: "en",
|
|
47
|
+
});
|
|
36
48
|
return (
|
|
37
49
|
<Provider store={store}>
|
|
38
50
|
<App {...props} />
|
|
@@ -26,7 +26,6 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
|
26
26
|
import { useNavigate } from "react-router-dom";
|
|
27
27
|
import { useTranslation } from "react-i18next";
|
|
28
28
|
import { useDispatch, useSelector } from "react-redux";
|
|
29
|
-
import { RootState } from "../redux/store";
|
|
30
29
|
import { IconProp } from "@fortawesome/fontawesome-svg-core";
|
|
31
30
|
import { useIsMobile } from "../hooks/UseMobile";
|
|
32
31
|
import useSession from "../hooks/UseSession";
|
|
@@ -143,7 +142,7 @@ function CustomLabel({
|
|
|
143
142
|
...other
|
|
144
143
|
}: CustomLabelProps) {
|
|
145
144
|
const { t } = useTranslation();
|
|
146
|
-
const appLayoutState = useSelector((state:
|
|
145
|
+
const appLayoutState = useSelector((state: any) => state.AppLayout);
|
|
147
146
|
return (
|
|
148
147
|
<TreeItem2Label
|
|
149
148
|
{...other}
|
|
@@ -231,8 +230,8 @@ const CustomTreeItem = React.forwardRef(function CustomTreeItem(
|
|
|
231
230
|
|
|
232
231
|
export default function NavigationTree() {
|
|
233
232
|
const navigate = useNavigate();
|
|
234
|
-
const appLayoutState = useSelector((state:
|
|
235
|
-
const AppInfo = useSelector((state:
|
|
233
|
+
const appLayoutState = useSelector((state: any) => state.AppLayout);
|
|
234
|
+
const AppInfo = useSelector((state: any) => state.AppInfo.value);
|
|
236
235
|
const dispatch = useDispatch();
|
|
237
236
|
const isMobile = useIsMobile();
|
|
238
237
|
const { isUserAuthorized } = useSession();
|
package/src/locales/i18n.ts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import i18n from "i18next";
|
|
2
|
-
import { initReactI18next } from "react-i18next";
|
|
3
|
-
import resources from ".";
|
|
4
|
-
i18n.use(initReactI18next).init({
|
|
5
|
-
resources: resources, // Where we're gonna put translations' files
|
|
6
|
-
lng: localStorage.getItem("language") || "en", // Set the initial language of the App
|
|
7
|
-
fallbackLng: "en",
|
|
8
|
-
});
|
|
9
2
|
|
|
10
3
|
export const changeLanguage = (lng: string) => {
|
|
11
4
|
i18n.changeLanguage(lng);
|
package/src/main.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { BaseApp } from "./components";
|
|
|
4
4
|
|
|
5
5
|
createRoot(document.getElementById("root")!).render(
|
|
6
6
|
<BaseApp
|
|
7
|
-
apiBaseUrl="http://localhost:8080/
|
|
7
|
+
apiBaseUrl="http://localhost:8080/api-base"
|
|
8
8
|
appLogo={"/public/logo.png"}
|
|
9
9
|
appName="UI Base Library"
|
|
10
10
|
appVersion="0.0"
|
|
@@ -9,10 +9,14 @@ export type AppInfo = {
|
|
|
9
9
|
appName: string | null;
|
|
10
10
|
appVersion: string | null;
|
|
11
11
|
appLogo: any | null;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
businessLocals?: {
|
|
13
|
+
ar: { [key: string]: string };
|
|
14
|
+
en: { [key: string]: string };
|
|
15
|
+
};
|
|
16
|
+
businessRoutes?: Array<SystemRoute>;
|
|
17
|
+
businessNavigationItems?: Array<ExtendedTreeItemProps>;
|
|
18
|
+
businessReduxReducers?: { [key: string]: Reducer<any> };
|
|
19
|
+
businessCommonStoresMetaData?: { [key: string]: StoreMetaData };
|
|
16
20
|
muiPremiumKey: string;
|
|
17
21
|
enableAdministrationModule: boolean;
|
|
18
22
|
appTheme?: {
|