@asaleh37/ui-base 1.2.29 → 25.6.1

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.29",
3
+ "version": "25.6.1",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "Ahmed Saleh Mohamed",
@@ -10,7 +10,7 @@
10
10
  "types": "dist/index.d.ts",
11
11
  "scripts": {
12
12
  "build": "rollup -c --bundleConfigAsCjs",
13
- "dev": "vite"
13
+ "dev": "vite --host"
14
14
  },
15
15
  "devDependencies": {
16
16
  "@emotion/cache": "^11.14.0",
@@ -41,7 +41,7 @@
41
41
  "@types/react-dom": "^19.0.3",
42
42
  "@types/react-i18next": "^7.8.3",
43
43
  "@vitejs/plugin-react": "^4.3.4",
44
- "axios": "^1.8.1",
44
+ "axios": "^1.8.1",
45
45
  "eslint": "^9.19.0",
46
46
  "eslint-plugin-react-hooks": "^5.0.0",
47
47
  "eslint-plugin-react-refresh": "^0.4.18",
@@ -53,7 +53,7 @@
53
53
  "moment": "^2.30.1",
54
54
  "oidc-client-ts": "^3.1.0",
55
55
  "react": "^19.1.0",
56
- "react-dom": "^19.0.0",
56
+ "react-dom": "^19.0.0",
57
57
  "react-hook-form": "^7.54.2",
58
58
  "react-i18next": "^15.4.0",
59
59
  "react-redux": "^9.2.0",
@@ -92,7 +92,7 @@
92
92
  "@mui/x-tree-view": "^7.26.0",
93
93
  "@react-spring/web": "^9.7.5",
94
94
  "@reduxjs/toolkit": "^2.5.1",
95
- "axios": "^1.8.1",
95
+ "axios": "^1.8.1",
96
96
  "global": "^4.4.0",
97
97
  "i18next": "^24.2.2",
98
98
  "i18next-browser-languagedetector": "^8.0.3",
@@ -100,7 +100,7 @@
100
100
  "moment": "^2.30.1",
101
101
  "oidc-client-ts": "^3.1.0",
102
102
  "react": "^19.0.0",
103
- "react-dom": "^19.0.0",
103
+ "react-dom": "^19.0.0",
104
104
  "react-hook-form": "^7.54.2",
105
105
  "react-i18next": "^15.4.0",
106
106
  "react-redux": "^9.2.0",
@@ -113,7 +113,8 @@
113
113
  "stylis-plugin-rtl": "^2.1.1",
114
114
  "zod": "^3.24.2"
115
115
  },
116
- "dependencies": {
117
- "@rollup/plugin-json": "^6.1.0"
116
+ "dependencies": {
117
+ "@rollup/plugin-json": "^6.1.0",
118
+ "rollup-plugin-terser": "^7.0.2"
118
119
  }
119
120
  }
@@ -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;
@@ -4,7 +4,7 @@ import { FormElementProps } from "../../templates/DataEntryTemplates/DataEntryTy
4
4
  import { useTranslation } from "react-i18next";
5
5
  import { useApiActions } from "../../../hooks";
6
6
 
7
- const storageTypes = [{ value: "FILE_SYSTEM" }, { value: "SFTP" }];
7
+ export const storageTypes = [{ value: "FILE_SYSTEM" }, { value: "SFTP" }];
8
8
 
9
9
  const AttachmentConfigGrid: React.FC = () => {
10
10
  const { t } = useTranslation();
@@ -116,6 +116,16 @@ const AttachmentConfigGrid: React.FC = () => {
116
116
  optionValueField: "value",
117
117
  },
118
118
  },
119
+ {
120
+ type: "field",
121
+ mode: "props",
122
+ props: {
123
+ fieldLabel: "Include App Code in attachment path",
124
+ fieldName: "includeAppCodeInPath",
125
+ required: false,
126
+ fieldType: "checkbox",
127
+ },
128
+ },
119
129
  {
120
130
  type: "field",
121
131
  mode: "props",
@@ -12,6 +12,7 @@ import { toast } from "react-toastify";
12
12
  import ReportParametersForm from "./ReportParametersForm";
13
13
  import ReportParameterGrid from "./ReportParameterGrid";
14
14
  import ReportViewer from "../../templates/report/ReportViewer";
15
+ import { storageTypes } from "./AttachmentConfigGrid";
15
16
 
16
17
  type ValidationCritria = {
17
18
  isVisible: boolean;
@@ -26,7 +27,6 @@ type ReportValidationOptions = {
26
27
  reportBluePrintId: ValidationCritria;
27
28
  reportExcelDataQueryId: ValidationCritria;
28
29
  reportJasperName: ValidationCritria;
29
- reportJasperPath: ValidationCritria;
30
30
  };
31
31
 
32
32
  type validationObjectType = {
@@ -40,7 +40,6 @@ const validationObject: validationObjectType = {
40
40
  reportBluePrintId: { isMandatory: true, isVisible: true },
41
41
  reportExcelDataQueryId: { isMandatory: false, isVisible: false },
42
42
  reportJasperName: { isMandatory: false, isVisible: false },
43
- reportJasperPath: { isMandatory: false, isVisible: false },
44
43
  },
45
44
  Jasper: {
46
45
  useSysDatasource: { isMandatory: false, isVisible: true },
@@ -48,7 +47,6 @@ const validationObject: validationObjectType = {
48
47
  reportBluePrintId: { isMandatory: false, isVisible: false },
49
48
  reportExcelDataQueryId: { isMandatory: false, isVisible: false },
50
49
  reportJasperName: { isMandatory: true, isVisible: true },
51
- reportJasperPath: { isMandatory: true, isVisible: true },
52
50
  },
53
51
  Excel: {
54
52
  useSysDatasource: { isMandatory: false, isVisible: false },
@@ -56,7 +54,6 @@ const validationObject: validationObjectType = {
56
54
  reportBluePrintId: { isMandatory: false, isVisible: false },
57
55
  reportExcelDataQueryId: { isMandatory: true, isVisible: true },
58
56
  reportJasperName: { isMandatory: false, isVisible: false },
59
- reportJasperPath: { isMandatory: false, isVisible: false },
60
57
  },
61
58
  };
62
59
 
@@ -83,13 +80,11 @@ const adjustFormAccordingToReportType = (
83
80
  formActions.hideField("reportBluePrintId");
84
81
  formActions.hideField("reportExcelDataQueryId");
85
82
  formActions.hideField("reportJasperName");
86
- formActions.hideField("reportJasperPath");
87
83
  formManager.setValue("useSysDatasource", null);
88
84
  formManager.setValue("datasourceConId", null);
89
85
  formManager.setValue("reportBluePrintId", null);
90
86
  formManager.setValue("reportExcelDataQueryId", null);
91
87
  formManager.setValue("reportJasperName", null);
92
- formManager.setValue("reportJasperPath", null);
93
88
  }
94
89
  };
95
90
 
@@ -245,6 +240,19 @@ const ReportGrid: React.FC = () => {
245
240
  fieldType: "text",
246
241
  },
247
242
  },
243
+ {
244
+ type: "field",
245
+ mode: "props",
246
+ props: {
247
+ fieldLabel: "ATTACHMENT_CONFIG_STORAGE_TYPE",
248
+ fieldName: "storageType",
249
+ required: true,
250
+ fieldType: "combobox",
251
+ options: storageTypes,
252
+ optionDisplayField: "value",
253
+ optionValueField: "value",
254
+ },
255
+ },
248
256
  {
249
257
  type: "field",
250
258
  mode: "props",
@@ -375,14 +383,10 @@ const ReportGrid: React.FC = () => {
375
383
  type: "field",
376
384
  mode: "props",
377
385
  props: {
378
- fieldLabel: "REPORT_REPORT_JASPER_PATH",
379
- fieldName: "reportJasperPath",
380
- hidden: true,
381
- gridProps: {
382
- hidden: true,
383
- },
386
+ fieldLabel: "Include App Code in attachment path",
387
+ fieldName: "includeAppCodeInPath",
384
388
  required: false,
385
- fieldType: "text",
389
+ fieldType: "checkbox",
386
390
  },
387
391
  },
388
392
  {
@@ -408,6 +412,7 @@ const ReportGrid: React.FC = () => {
408
412
  <ReportParameterGrid selectedRecord={selectedRecord} />
409
413
  </ReportParameterWindow>
410
414
  <TemplateGrid
415
+ attachment={{ attachmentCode: "JASPER_REPORTS" }}
411
416
  apiActions={apiActions}
412
417
  data={data}
413
418
  setData={setData}
@@ -474,10 +479,7 @@ const ReportGrid: React.FC = () => {
474
479
  toast.error("You must enter the jasper report name");
475
480
  return false;
476
481
  }
477
- if (record?.reportType === "Jasper" && !record?.reportJasperPath) {
478
- toast.error("You must enter the jasper report path");
479
- return false;
480
- }
482
+
481
483
  if (
482
484
  record?.reportType === "Blueprint" &&
483
485
  !record?.reportBluePrintId
@@ -8,8 +8,7 @@ import AttachmentPanel from "../templates/attachment/AttachmentPanel";
8
8
  import { useSelector } from "react-redux";
9
9
 
10
10
  const Home: React.FC = () => {
11
- const AppInfo = useSelector((state: any) => state.AppInfo.value);
12
- console.log("AppInfo", AppInfo);
11
+ const AppInfo = useSelector((state: any) => state.AppInfo.value);
13
12
  return (
14
13
  <Box
15
14
  sx={{
@@ -34,7 +34,6 @@ const MyNotificationsPanel: React.FC = () => {
34
34
  showMask: false,
35
35
  successCallBkFn: (response: any) => {
36
36
  setNotifications(response.data);
37
- console.log(response.data);
38
37
  },
39
38
  });
40
39
  }
@@ -341,7 +341,6 @@ const TemplateForm: React.FC<TemplateFormProps> = (
341
341
  }
342
342
  onClick={formManager.handleSubmit(
343
343
  (values) => {
344
- console.log("form values", values);
345
344
  saveRecord(values);
346
345
  },
347
346
  (errors) => {
@@ -27,8 +27,7 @@ const getGridColumnsFromRecord = (data: Array<any>) => {
27
27
  },
28
28
  };
29
29
  formElements.push(formElement);
30
- }
31
- console.log("formElements", formElements);
30
+ }
32
31
  return formElements;
33
32
  };
34
33
 
@@ -186,8 +186,7 @@ const ReportViewer: React.FC<ReportViewerProps> = (props) => {
186
186
  // Clean up
187
187
  document.body.removeChild(link);
188
188
  window.URL.revokeObjectURL(url);
189
- }
190
- console.log(response);
189
+ }
191
190
  },
192
191
  failureCallBkFn: (response) => {
193
192
  setErrorMessage(
@@ -236,28 +236,32 @@ export default function NavigationTree() {
236
236
  const isMobile = useIsMobile();
237
237
  const { isUserAuthorized } = useSession();
238
238
  const filterData = (data) => {
239
- return data
240
- .filter(
241
- (item: any) =>
242
- item.authority === undefined ||
243
- item.authority == null ||
244
- isUserAuthorized(item.authority)
245
- )
246
- .map((item: any) => {
247
- if (item.children) {
248
- item.children = filterData(item.children);
239
+ const parentItems = [];
240
+ for (let parentItem of data) {
241
+ if (
242
+ parentItem.authority === undefined ||
243
+ parentItem.authority == null ||
244
+ isUserAuthorized(parentItem.authority)
245
+ ) {
246
+ let newParentItem = structuredClone(parentItem);
247
+ if (parentItem?.children) {
248
+ newParentItem.children = filterData(parentItem.children);
249
249
  }
250
- return item;
251
- });
250
+ parentItems.push(newParentItem);
251
+ }
252
+ }
253
+ return parentItems;
252
254
  };
253
255
 
254
256
  const mergedNavigationItems = [];
255
257
  if (AppInfo.enableAdministrationModule) {
256
- mergedNavigationItems.push(...NavigationItems);
258
+ mergedNavigationItems.push(...structuredClone(NavigationItems));
257
259
  }
258
- mergedNavigationItems.push(...AppInfo.businessNavigationItems);
260
+ mergedNavigationItems.push(
261
+ ...structuredClone(AppInfo.businessNavigationItems)
262
+ );
259
263
  const authoriedNavigationItems = filterData(mergedNavigationItems);
260
-
264
+ console.log("authoriedNavigationItems", authoriedNavigationItems);
261
265
  return (
262
266
  <RichTreeView
263
267
  items={authoriedNavigationItems}
@@ -80,9 +80,7 @@ const TopBar: React.FC = () => {
80
80
  const handleLogout = async () => {
81
81
  try {
82
82
  await handleGetRequest({ endPointURI: "api/auth/logout" });
83
- } catch (error) {
84
- console.log("logout error", error);
85
- }
83
+ } catch (error) {}
86
84
  dispatch(UserSessionActions.setUnAuthenticated());
87
85
  };
88
86
  const toggleSideBar = () => {
package/src/main.tsx CHANGED
@@ -4,8 +4,8 @@ import { BaseApp } from "./components";
4
4
 
5
5
  createRoot(document.getElementById("root")!).render(
6
6
  <BaseApp
7
- apiBaseUrl="http://localhost:8080/api-base"
8
- appLogo={"/public/logo.png"}
7
+ apiBaseUrl="http://192.168.1.2:8081/api-base"
8
+ appLogo={"/logo.png"}
9
9
  appName="UI Base Library"
10
10
  appVersion="0.0"
11
11
  businessCommonStoresMetaData={{}}
@@ -4,22 +4,22 @@ export type CommonStores = {
4
4
  [key: string]: StoreMetaData;
5
5
  };
6
6
 
7
- export interface CommonStoresInterface {
7
+ export type CommonStoresInterface = {
8
8
  stores: { [key: string]: StoreMetaData };
9
9
  storeKeys: Array<String>;
10
- }
10
+ };
11
11
 
12
12
  interface setStoreDataProps {
13
13
  storeKey: string;
14
14
  data: Array<any>;
15
15
  }
16
16
 
17
- export interface StoreMetaData {
17
+ export type StoreMetaData = {
18
18
  url: string;
19
19
  data: Array<any>;
20
20
  autoLoad: boolean;
21
21
  authority?: string;
22
- }
22
+ };
23
23
 
24
24
  export const commonStoresInitialState: CommonStoresInterface = {
25
25
  stores: {},
@@ -27,7 +27,7 @@ export const commonStoresInitialState: CommonStoresInterface = {
27
27
  };
28
28
 
29
29
  const commonStoreSlice = createSlice({
30
- name: "loadingMask",
30
+ name: "commonStores",
31
31
  initialState: commonStoresInitialState,
32
32
  reducers: {
33
33
  setStoresMetaData: (state, action) => {
@@ -1,2 +1,8 @@
1
1
  export type { ExtendedTreeItemProps } from "../navigationItems/index";
2
2
  export type * from "../routes/types/index";
3
+
4
+ export {
5
+ type CommonStores,
6
+ type CommonStoresInterface,
7
+ type StoreMetaData,
8
+ } from "../redux/features/common/CommonStoreSlice";
package/vite.config.ts CHANGED
@@ -2,6 +2,7 @@ import { defineConfig } from "vite";
2
2
  import react from "@vitejs/plugin-react";
3
3
  import rollupNodePolyFill from "rollup-plugin-polyfill-node";
4
4
  import inject from "@rollup/plugin-inject";
5
+ import { terser } from "rollup-plugin-terser";
5
6
 
6
7
  // https://vite.dev/config/
7
8
  export default defineConfig({
@@ -13,8 +14,20 @@ export default defineConfig({
13
14
  include: ["fbjs"],
14
15
  },
15
16
  build: {
17
+ minify: false,
16
18
  rollupOptions: {
17
- plugins: [rollupNodePolyFill()],
19
+ plugins: [
20
+ rollupNodePolyFill(),
21
+ terser({
22
+ compress: {
23
+ drop_debugger: false,
24
+ drop_console: false,
25
+ },
26
+ format: {
27
+ comments: false,
28
+ },
29
+ }),
30
+ ],
18
31
  },
19
32
  },
20
33
  server: {