@asaleh37/ui-base 25.12.181 → 26.1.2-4.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": "25.12.181",
3
+ "version": "26.1.24.1",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "Ahmed Saleh Mohamed",
package/public/bg.jpg CHANGED
Binary file
Binary file
package/public/logo.png CHANGED
Binary file
@@ -103,14 +103,27 @@ const App: React.FC<AppInfo> = (props: AppInfo) => {
103
103
  };
104
104
 
105
105
  const AppLayoutState = useSelector((state: any) => state.AppLayout);
106
- let themeOptions = { ...LightThemeOptions };
107
- if (AppLayoutState.themeMode === "dark") {
108
- themeOptions = { ...DarkThemeOptions };
106
+ let themeOptions;
107
+ if (props?.allowThemeChange) {
108
+ themeOptions = { ...LightThemeOptions };
109
+ if (AppLayoutState.themeMode === "dark") {
110
+ themeOptions = { ...DarkThemeOptions };
111
+ }
112
+ } else {
113
+ if (props?.appThemeMode) {
114
+ themeOptions =
115
+ props?.appThemeMode === "light"
116
+ ? { ...LightThemeOptions }
117
+ : { ...DarkThemeOptions };
118
+ } else {
119
+ themeOptions = { ...LightThemeOptions };
120
+ }
109
121
  }
110
122
  const theme = createTheme({
111
123
  direction: AppLayoutState.appDirection,
112
124
  ...themeOptions,
113
125
  });
126
+
114
127
  useEffect(() => {
115
128
  document.title = props.documentTitle;
116
129
  dispatch(AppInfoActions.setAppInfo(props));
@@ -12,6 +12,7 @@ import { toast } from "react-toastify";
12
12
  import ReportParameterGrid from "./ReportParameterGrid";
13
13
  import ReportViewer from "../../templates/report/ReportViewer";
14
14
  import { storageTypes } from "./AttachmentConfigGrid";
15
+ import { ContinuousColorLegend } from "@mui/x-charts";
15
16
 
16
17
  export type ReportType = "Jasper" | "Excel" | "Blueprint";
17
18
 
@@ -66,8 +67,11 @@ const adjustFormAfterValueChange: FormValueChangeCallBk = (
66
67
  }
67
68
  }
68
69
  } else {
70
+ console.log("FORM VALUES", formValues);
69
71
  if (formValues?.useSysCon) {
70
72
  formActions.hideField("datasourceConId");
73
+ } else {
74
+ formActions.showField("datasourceConId");
71
75
  }
72
76
  if (formValues?.reportType) {
73
77
  if (formValues?.reportType === "Blueprint") {
@@ -376,16 +380,16 @@ const ReportGrid: React.FC = () => {
376
380
  fieldType: "text",
377
381
  },
378
382
  },
379
- {
380
- type: "field",
381
- mode: "props",
382
- props: {
383
- fieldLabel: "Include App Code in attachment path",
384
- fieldName: "includeAppCodeInPath",
385
- required: false,
386
- fieldType: "checkbox",
387
- },
388
- },
383
+ // {
384
+ // type: "field",
385
+ // mode: "props",
386
+ // props: {
387
+ // fieldLabel: "Include App Code in attachment path",
388
+ // fieldName: "includeAppCodeInPath",
389
+ // required: false,
390
+ // fieldType: "checkbox",
391
+ // },
392
+ // },
389
393
  {
390
394
  type: "field",
391
395
  mode: "props",
@@ -105,7 +105,11 @@ const TemplateForm: React.FC<TemplateFormProps> = (
105
105
  }
106
106
  }
107
107
  if (props?.formValuesChangeCallBk) {
108
- props?.formValuesChangeCallBk(formValues, formActions, formManager);
108
+ props?.formValuesChangeCallBk(
109
+ retrievedRecord,
110
+ formActions,
111
+ formManager
112
+ );
109
113
  }
110
114
  }
111
115
  } else {
@@ -84,7 +84,6 @@ type ComboBoxColumnProps = TemplateGridColDef & {
84
84
  export const generateComboColumn: (
85
85
  props: ComboBoxColumnProps
86
86
  ) => TemplateGridColDef = (colDef: ComboBoxColumnProps) => {
87
- debugger;
88
87
  const column: TemplateGridColDef = {
89
88
  ...colDef,
90
89
  type: "custom",
@@ -233,7 +233,6 @@ const TemplateGrid: React.FC<TemplateGridProps> = (props) => {
233
233
  gridColumn.valueField = "lookupValue";
234
234
  }
235
235
  if (gridColumn.type === "custom") {
236
- debugger;
237
236
  if (gridColumn?.options) {
238
237
  continue;
239
238
  } else if (gridColumn?.commonStoreKey) {
@@ -27,8 +27,7 @@ const getGridColumnsFromRecord = (data: Array<any>) => {
27
27
  },
28
28
  };
29
29
  formElements.push(formElement);
30
- }
31
- debugger;
30
+ }
32
31
  return formElements;
33
32
  };
34
33
 
@@ -0,0 +1,9 @@
1
+ import { useParams } from "react-router-dom";
2
+ import ReportViewer from "./ReportViewer";
3
+
4
+ const ReportViewerRoute = () => {
5
+ const { reportCode } = useParams();
6
+ return <ReportViewer reportCode={reportCode} resultMode="App" />;
7
+ };
8
+
9
+ export default ReportViewerRoute;
@@ -28,8 +28,8 @@ export const useConfirmationWindow = (props: ConfirmationWindowProps) => {
28
28
  <DialogActions>
29
29
  <Button
30
30
  variant="contained"
31
- sx={{marginRight:2,marginLeft:2}}
32
- color="primary"
31
+ sx={{ marginRight: 2, marginLeft: 2 }}
32
+ color="secondary"
33
33
  onClick={() => {
34
34
  setOpen(false);
35
35
  }}
@@ -38,7 +38,7 @@ export const useConfirmationWindow = (props: ConfirmationWindowProps) => {
38
38
  </Button>
39
39
  <Button
40
40
  variant="contained"
41
- sx={{marginRight:2,marginLeft:2}}
41
+ sx={{ marginRight: 2, marginLeft: 2 }}
42
42
  color="error"
43
43
  onClick={() => {
44
44
  props.onConfirmationCallBk();
@@ -84,7 +84,7 @@ export const useWindow = (props: TemplateWindowProp) => {
84
84
  }}
85
85
  color="secondary"
86
86
  >
87
- <FontAwesomeIcon icon="xmark-square" />
87
+ <FontAwesomeIcon icon="xmark-square" color="white" />
88
88
  </IconButton>
89
89
  </Toolbar>
90
90
  </AppBar>
@@ -35,10 +35,11 @@ export type EntityParameter = {
35
35
 
36
36
  export const getFormElementsFromParameters = (
37
37
  parameters: Array<EntityParameter>,
38
- parameterValues: any
38
+ parameterValues: any,
39
39
  ) => {
40
40
  const formElements: Array<FormElementProps> = [];
41
41
  for (const parameter of parameters) {
42
+ debugger;
42
43
  const formElement: FormElementProps = {
43
44
  type: "field",
44
45
  mode: "props",
@@ -47,6 +48,17 @@ export const getFormElementsFromParameters = (
47
48
  fieldName: parameter?.parameterCode,
48
49
  fieldType: parameter?.parameterType,
49
50
  hidden: parameter?.hidden,
51
+ options: parameter?.parameterDataset
52
+ ? JSON.parse(parameter.parameterDataset)
53
+ : undefined,
54
+ optionDisplayField: parameter?.parameterDisplayField,
55
+ optionValueField: parameter?.parameterValueField,
56
+ commonStoreKey: parameter?.commonStoreKey,
57
+ comboboxGroupField: parameter?.groupField,
58
+ comboboxValueDataType: parameter?.comboboxValueDataType,
59
+ lookupType: parameter?.lookupType,
60
+ storeUrl: parameter?.comboboxStoreURl,
61
+ dataQueryId: parameter?.parameterDataQueryId,
50
62
  formProps: { fieldSize: { lg: 4, md: 6, sm: 12 } },
51
63
  required: parameter?.mandatory,
52
64
  defaultValue:
@@ -69,7 +81,7 @@ export const useParameterPanel = (props: UseParameterPanelProps) => {
69
81
  });
70
82
  const panelElements = getFormElementsFromParameters(
71
83
  props.parameters,
72
- parametersValues
84
+ parametersValues,
73
85
  );
74
86
 
75
87
  const ParameterPanel: React.FC<{
@@ -178,12 +178,13 @@ const isExpandable = (reactChildren: React.ReactNode) => {
178
178
  };
179
179
 
180
180
  interface CustomTreeItemProps
181
- extends Omit<UseTreeItem2Parameters, "rootRef">,
181
+ extends
182
+ Omit<UseTreeItem2Parameters, "rootRef">,
182
183
  Omit<React.HTMLAttributes<HTMLLIElement>, "onFocus"> {}
183
184
 
184
185
  const CustomTreeItem = React.forwardRef(function CustomTreeItem(
185
186
  props: CustomTreeItemProps,
186
- ref: React.Ref<HTMLLIElement>
187
+ ref: React.Ref<HTMLLIElement>,
187
188
  ) {
188
189
  const { id, itemId, label, disabled, children, ...other } = props;
189
190
  const {
@@ -239,8 +240,11 @@ export default function NavigationTree() {
239
240
  const toggleSideBar = () => {
240
241
  dispatch(toggleSideBarState());
241
242
  };
242
- const { isUserAuthorized, isCurrentOrganizationAuthorizedToModule } =
243
- useSession();
243
+ const {
244
+ isUserAuthorized,
245
+ isCurrentOrganizationAuthorizedToModule,
246
+ UserInfo,
247
+ } = useSession();
244
248
  const filterData = (data) => {
245
249
  const parentItems = [];
246
250
  for (let parentItem of data) {
@@ -273,8 +277,51 @@ export default function NavigationTree() {
273
277
  mergedNavigationItems.push(...structuredClone(NavigationItems));
274
278
  }
275
279
  mergedNavigationItems.push(
276
- ...structuredClone(AppInfo.businessNavigationItems)
280
+ ...structuredClone(AppInfo.businessNavigationItems),
277
281
  );
282
+ let sysReports = [];
283
+ let reportCategories = {};
284
+ let currentCategory = null;
285
+ let reportNodeId = 1;
286
+ for (const report of UserInfo.systemReports) {
287
+ if (report?.reportCategory) {
288
+ currentCategory = report.reportCategory;
289
+ } else {
290
+ currentCategory = "NA";
291
+ }
292
+ if (!reportCategories[currentCategory]) {
293
+ reportCategories[currentCategory] = [];
294
+ }
295
+ reportCategories[currentCategory].push({
296
+ id: `system_report_${reportNodeId}`,
297
+ label: report.reportName,
298
+ icon: report.reportType === "Excel" ? "file-excel" : "file-pdf",
299
+ action: "NAVIGATION",
300
+ authority: report.reportAuthorityCode,
301
+ actionPayload: { path: "report-viewer/" + report.reportCode },
302
+ });
303
+ reportNodeId++;
304
+ }
305
+ for (const category of Object.keys(reportCategories)) {
306
+ if (category === "NA") {
307
+ for (const sysReport of reportCategories[category]) {
308
+ sysReports.push(sysReport);
309
+ }
310
+ } else {
311
+ sysReports.push({
312
+ id: `system_report_category_${category}`,
313
+ label: category,
314
+ icon: "folder",
315
+ children: reportCategories[category],
316
+ });
317
+ }
318
+ }
319
+ mergedNavigationItems.push({
320
+ id: "system_configured_reports",
321
+ label: "Reports",
322
+ icon: "folder",
323
+ children: sysReports,
324
+ });
278
325
  const authoriedNavigationItems = filterData(mergedNavigationItems);
279
326
  return (
280
327
  <RichTreeView
@@ -282,7 +329,7 @@ export default function NavigationTree() {
282
329
  onItemClick={(event, itemId) => {
283
330
  const navigationItem = findNavigationItemById(
284
331
  itemId,
285
- mergedNavigationItems
332
+ mergedNavigationItems,
286
333
  );
287
334
  if (
288
335
  navigationItem?.action === "NAVIGATION" &&
package/src/main.tsx CHANGED
@@ -7,11 +7,13 @@ createRoot(document.getElementById("root")!).render(
7
7
  enableUINotifications={false}
8
8
  appLogo={"/logo.png"}
9
9
  appName="UI Base Library"
10
- isUserProfileManaged={false}
10
+ isUserProfileManaged={true}
11
11
  loginScreenStyle={{
12
12
  themeMode: "dark",
13
13
  backgroundImageNameInPublicFolder: "bg.jpg",
14
14
  }}
15
+ appThemeMode="dark"
16
+ allowThemeChange={true}
15
17
  appVersion="25.12.12"
16
18
  authenticationMethod="APP"
17
19
  azureConfiguration={{
@@ -26,9 +28,13 @@ createRoot(document.getElementById("root")!).render(
26
28
  businessRoutes={[]}
27
29
  documentTitle="UI Base"
28
30
  enableAdministrationModule={true}
31
+ // appTheme={{
32
+ // dark: { primaryColor: "#b3a10c", secondaryColor: "#2b3c46" },
33
+ // light: { primaryColor: "#2b3c46", secondaryColor: "#b3a10c" },
34
+ // }}
29
35
  appTheme={{
30
- dark: { primaryColor: "#b3a10c", secondaryColor: "#2b3c46" },
31
- light: { primaryColor: "#2b3c46", secondaryColor: "#b3a10c" },
36
+ dark: { primaryColor: "#b50031", secondaryColor: "#b3a10c" },
37
+ light: { primaryColor: "#080745", secondaryColor: "#b50031" },
32
38
  }}
33
39
  muiPremiumKey="c2bd611fa642666253500ab9c8e4f78fTz0xMTE4MjEsRT0xNzc2OTg4Nzk5MDAwLFM9cHJlbWl1bSxMTT1zdWJzY3JpcHRpb24sUFY9aW5pdGlhbCxLVj0y"
34
40
  />
@@ -1,3 +1,4 @@
1
+ import ReportViewerRoute from "../../components/templates/report/ReportViewerRoute";
1
2
  import { SystemRoute } from "../types";
2
3
  import { adminRoutes } from "./adminRoutes";
3
4
  import { devRoutes } from "./devRoutes";
@@ -5,4 +6,5 @@ import { devRoutes } from "./devRoutes";
5
6
  export const ADMINISTRATION_ROUTES: Array<SystemRoute> = [
6
7
  ...adminRoutes,
7
8
  ...devRoutes,
9
+ { component: ReportViewerRoute, path: "report-viewer/:reportCode" },
8
10
  ];