@asaleh37/ui-base 1.2.26 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asaleh37/ui-base",
3
- "version": "1.2.26",
3
+ "version": "1.2.28",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "Ahmed Saleh Mohamed",
@@ -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.businessReduxReducers,
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} />
@@ -33,10 +33,16 @@ const getGridColumnsFromRecord = (data: Array<any>) => {
33
33
  };
34
34
 
35
35
  const ExcelReportViewer: React.FC<ExcelReportViewerProps> = (props) => {
36
- console.log("reportdata", props.reportData);
36
+ const [data, setData] = useState([]);
37
+ useEffect(() => {
38
+ const newData = props.reportData.map((record, index) => {
39
+ return { ...record, report_record_data_key: index };
40
+ });
41
+ setData(newData);
42
+ }, [props.reportData]);
37
43
  return (
38
44
  <TemplateGrid
39
- data={props.reportData}
45
+ data={data}
40
46
  disableDefaultAction={true}
41
47
  setData={props.setReportData}
42
48
  formElements={getGridColumnsFromRecord(props.reportData)}
@@ -47,6 +53,7 @@ const ExcelReportViewer: React.FC<ExcelReportViewerProps> = (props) => {
47
53
  girdIcon={"file-excel"}
48
54
  gridTitle="Report"
49
55
  autoLoad={true}
56
+ keyColumnName={"report_record_data_key"}
50
57
  hideInfoBar={true}
51
58
  apiActions={{
52
59
  deleteRecordById: async () => {
@@ -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: RootState) => state.AppLayout);
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: RootState) => state.AppLayout);
235
- const AppInfo = useSelector((state: RootState) => state.AppInfo.value);
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();
@@ -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
@@ -1,7 +1,6 @@
1
- import { StrictMode } from "react";
2
1
  import { createRoot } from "react-dom/client";
3
2
  import { BaseApp } from "./components";
4
- // import logo from "./assets/logo.png";
3
+
5
4
 
6
5
  createRoot(document.getElementById("root")!).render(
7
6
  <BaseApp
@@ -9,10 +9,14 @@ export type AppInfo = {
9
9
  appName: string | null;
10
10
  appVersion: string | null;
11
11
  appLogo: any | null;
12
- businessRoutes: Array<SystemRoute>;
13
- businessNavigationItems: Array<ExtendedTreeItemProps>;
14
- businessReduxReducers: { [key: string]: Reducer<any> };
15
- businessCommonStoresMetaData: { [key: string]: StoreMetaData };
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?: {
@@ -1,8 +0,0 @@
1
- {
2
- "book":"book",
3
- "WF_DOC_SINGULAR":"wfdoc",
4
- "WF_DOC_PLURAL":"wfdocs",
5
- "WF_DOC_DOC_NUM":"Doc num",
6
- "WF_DOC_DOC_STATUS":"Doc status",
7
- "WF_DOC_DOC_TYPE":"Doc type",
8
- }
@@ -1,8 +0,0 @@
1
- {
2
- "book":"book",
3
- "WF_DOC_SINGULAR":"wfdoc",
4
- "WF_DOC_PLURAL":"wfdocs",
5
- "WF_DOC_DOC_NUM":"Doc num",
6
- "WF_DOC_DOC_STATUS":"Doc status",
7
- "WF_DOC_DOC_TYPE":"Doc type",
8
- }