@asaleh37/ui-base 26.1.24 → 26.2.2
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 +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/administration/dev/MailSenderConfigGrid.tsx +21 -15
- package/src/components/templates/report/ReportViewerRoute.tsx +9 -0
- package/src/layout/NavigationTree.tsx +57 -6
- package/src/redux/features/common/AppInfoSlice.ts +2 -0
- package/src/routes/administration/index.ts +2 -0
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@ type ReportValidationOptions = {
|
|
|
19
19
|
mailHost: ValidationCritria;
|
|
20
20
|
mailPort: ValidationCritria;
|
|
21
21
|
mailUsername: ValidationCritria;
|
|
22
|
-
mailPassword: ValidationCritria;
|
|
22
|
+
mailPassword: ValidationCritria;
|
|
23
23
|
mailProtocol: ValidationCritria;
|
|
24
24
|
isMailSmtpAuthEnabled: ValidationCritria;
|
|
25
25
|
isMailStarttlsEnabled: ValidationCritria;
|
|
@@ -40,7 +40,7 @@ const validationObject: validationObjectType = {
|
|
|
40
40
|
mailHost: { isMandatory: true, isVisible: true },
|
|
41
41
|
mailPort: { isMandatory: true, isVisible: true },
|
|
42
42
|
mailUsername: { isMandatory: true, isVisible: true },
|
|
43
|
-
mailPassword: { isMandatory: true, isVisible: true },
|
|
43
|
+
mailPassword: { isMandatory: true, isVisible: true },
|
|
44
44
|
mailProtocol: { isMandatory: true, isVisible: true },
|
|
45
45
|
isMailSmtpAuthEnabled: { isMandatory: true, isVisible: true },
|
|
46
46
|
isMailStarttlsEnabled: { isMandatory: true, isVisible: true },
|
|
@@ -55,7 +55,7 @@ const validationObject: validationObjectType = {
|
|
|
55
55
|
mailHost: { isMandatory: false, isVisible: false },
|
|
56
56
|
mailPort: { isMandatory: false, isVisible: false },
|
|
57
57
|
mailUsername: { isMandatory: false, isVisible: false },
|
|
58
|
-
mailPassword: { isMandatory: false, isVisible: false },
|
|
58
|
+
mailPassword: { isMandatory: false, isVisible: false },
|
|
59
59
|
mailProtocol: { isMandatory: false, isVisible: false },
|
|
60
60
|
isMailSmtpAuthEnabled: { isMandatory: false, isVisible: false },
|
|
61
61
|
isMailStarttlsEnabled: { isMandatory: false, isVisible: false },
|
|
@@ -71,8 +71,9 @@ const validationObject: validationObjectType = {
|
|
|
71
71
|
const adjustFormAccordingToEngineType = (
|
|
72
72
|
value: any,
|
|
73
73
|
formActions: FormActionProps,
|
|
74
|
-
formManager: UseFormReturn
|
|
74
|
+
formManager: UseFormReturn,
|
|
75
75
|
) => {
|
|
76
|
+
debugger;
|
|
76
77
|
if (value && validationObject[value]) {
|
|
77
78
|
const validationObjects: ReportValidationOptions = validationObject[value];
|
|
78
79
|
const fields = Object.keys(validationObjects);
|
|
@@ -93,7 +94,7 @@ const adjustFormAccordingToEngineType = (
|
|
|
93
94
|
formActions.hideField("mailUsername");
|
|
94
95
|
formManager.setValue("mailUsername", null);
|
|
95
96
|
formActions.hideField("mailPassword");
|
|
96
|
-
formManager.setValue("mailPassword", null);
|
|
97
|
+
formManager.setValue("mailPassword", null);
|
|
97
98
|
formActions.hideField("mailProtocol");
|
|
98
99
|
formManager.setValue("mailProtocol", null);
|
|
99
100
|
formActions.hideField("isMailSmtpAuthEnabled");
|
|
@@ -220,7 +221,7 @@ const MailSenderConfigGrid: React.FC = () => {
|
|
|
220
221
|
value,
|
|
221
222
|
formManager,
|
|
222
223
|
formActions,
|
|
223
|
-
selectedRecord
|
|
224
|
+
selectedRecord,
|
|
224
225
|
) {
|
|
225
226
|
adjustFormAccordingToEngineType(value, formActions, formManager);
|
|
226
227
|
},
|
|
@@ -462,16 +463,21 @@ const MailSenderConfigGrid: React.FC = () => {
|
|
|
462
463
|
girdIcon={{ iconName: "paper-plane", prefix: "fas" }}
|
|
463
464
|
editAction={{ isEnabled: true, authority: "MAIL_SENDER_CONFIG_EDIT" }}
|
|
464
465
|
deleteAction={{ isEnabled: true, authority: "MAIL_SENDER_CONFIG_DELETE" }}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
record: any
|
|
469
|
-
) => {
|
|
470
|
-
adjustFormAccordingToEngineType(
|
|
471
|
-
record.mailEngine,
|
|
466
|
+
formProps={{
|
|
467
|
+
formValuesChangeCallBk: (
|
|
468
|
+
formValues,
|
|
472
469
|
formActions,
|
|
473
|
-
formManager
|
|
474
|
-
|
|
470
|
+
formManager,
|
|
471
|
+
fieldName,
|
|
472
|
+
newValue,
|
|
473
|
+
selectedRecord,
|
|
474
|
+
) => {
|
|
475
|
+
adjustFormAccordingToEngineType(
|
|
476
|
+
formValues.mailEngine,
|
|
477
|
+
formActions,
|
|
478
|
+
formManager,
|
|
479
|
+
);
|
|
480
|
+
},
|
|
475
481
|
}}
|
|
476
482
|
/>
|
|
477
483
|
);
|
|
@@ -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;
|
|
@@ -178,12 +178,13 @@ const isExpandable = (reactChildren: React.ReactNode) => {
|
|
|
178
178
|
};
|
|
179
179
|
|
|
180
180
|
interface CustomTreeItemProps
|
|
181
|
-
extends
|
|
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 {
|
|
243
|
-
|
|
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,55 @@ 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
|
+
if (AppInfo?.showSystemReportsTreeNode) {
|
|
283
|
+
let sysReports = [];
|
|
284
|
+
let reportCategories = {};
|
|
285
|
+
let currentCategory = null;
|
|
286
|
+
let reportNodeId = 1;
|
|
287
|
+
|
|
288
|
+
for (const report of UserInfo?.systemReports || []) {
|
|
289
|
+
if (report?.reportCategory) {
|
|
290
|
+
currentCategory = report.reportCategory;
|
|
291
|
+
} else {
|
|
292
|
+
currentCategory = "NA";
|
|
293
|
+
}
|
|
294
|
+
if (!reportCategories[currentCategory]) {
|
|
295
|
+
reportCategories[currentCategory] = [];
|
|
296
|
+
}
|
|
297
|
+
reportCategories[currentCategory].push({
|
|
298
|
+
id: `system_report_${reportNodeId}`,
|
|
299
|
+
label: report.reportName,
|
|
300
|
+
icon: report.reportType === "Excel" ? "file-excel" : "file-pdf",
|
|
301
|
+
action: "NAVIGATION",
|
|
302
|
+
authority: report.reportAuthorityCode,
|
|
303
|
+
actionPayload: { path: "report-viewer/" + report.reportCode },
|
|
304
|
+
});
|
|
305
|
+
reportNodeId++;
|
|
306
|
+
}
|
|
307
|
+
for (const category of Object.keys(reportCategories)) {
|
|
308
|
+
if (category === "NA") {
|
|
309
|
+
for (const sysReport of reportCategories[category]) {
|
|
310
|
+
sysReports.push(sysReport);
|
|
311
|
+
}
|
|
312
|
+
} else {
|
|
313
|
+
sysReports.push({
|
|
314
|
+
id: `system_report_category_${category}`,
|
|
315
|
+
label: category,
|
|
316
|
+
icon: "folder",
|
|
317
|
+
children: reportCategories[category],
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
mergedNavigationItems.push({
|
|
322
|
+
id: "system_configured_reports",
|
|
323
|
+
label: "Reports",
|
|
324
|
+
icon: "folder",
|
|
325
|
+
children: sysReports,
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
|
|
278
329
|
const authoriedNavigationItems = filterData(mergedNavigationItems);
|
|
279
330
|
return (
|
|
280
331
|
<RichTreeView
|
|
@@ -282,7 +333,7 @@ export default function NavigationTree() {
|
|
|
282
333
|
onItemClick={(event, itemId) => {
|
|
283
334
|
const navigationItem = findNavigationItemById(
|
|
284
335
|
itemId,
|
|
285
|
-
mergedNavigationItems
|
|
336
|
+
mergedNavigationItems,
|
|
286
337
|
);
|
|
287
338
|
if (
|
|
288
339
|
navigationItem?.action === "NAVIGATION" &&
|
|
@@ -35,6 +35,7 @@ export type AppInfo = {
|
|
|
35
35
|
redirectURL: string;
|
|
36
36
|
scopes: Array<string>;
|
|
37
37
|
};
|
|
38
|
+
showSystemReportsTreeNode?: boolean;
|
|
38
39
|
businessRoutes?: Array<SystemRoute>;
|
|
39
40
|
businessNavigationItems?: Array<ExtendedTreeItemProps>;
|
|
40
41
|
businessReduxReducers?: { [key: string]: Reducer<any> };
|
|
@@ -63,6 +64,7 @@ const initialState: AppInfoProp = {
|
|
|
63
64
|
appName: null,
|
|
64
65
|
appVersion: null,
|
|
65
66
|
appLogo: null,
|
|
67
|
+
showSystemReportsTreeNode: false,
|
|
66
68
|
muiPremiumKey: null,
|
|
67
69
|
enableAdministrationModule: false,
|
|
68
70
|
enableUINotifications: false,
|
|
@@ -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
|
];
|