@asaleh37/ui-base 26.2.16 → 27.5.26
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/.env.development +1 -1
- package/.github/workflows/publish-npm.yml +49 -49
- package/README.md +51 -51
- package/__ODockerfile +14 -14
- 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/eslint.config.js +29 -29
- package/index.html +20 -20
- package/package.json +122 -122
- package/public/manifest.json +21 -21
- package/rollup.config-1748377725725.cjs +50 -50
- package/rollup.config.js +45 -45
- package/src/components/App.tsx +155 -155
- package/src/components/BaseApp.tsx +75 -75
- package/src/components/ExampleTrial.tsx +24 -24
- package/src/components/administration/admin/ChangePasswordPanel.tsx +128 -128
- package/src/components/administration/admin/CustomPersonGrid.tsx +361 -361
- package/src/components/administration/admin/OrgMemberRoleForm.tsx +83 -83
- package/src/components/administration/admin/OrgProvidedPersonGrid.tsx +347 -347
- package/src/components/administration/admin/OrganizationApplicationModuleGrid.tsx +107 -107
- package/src/components/administration/admin/OrganizationGrid.tsx +118 -118
- package/src/components/administration/admin/OrganizationMemberGrid.tsx +190 -190
- package/src/components/administration/admin/OrganizationMemberRoleGrid.tsx +87 -87
- package/src/components/administration/admin/OrganizationRankGrid.tsx +133 -133
- package/src/components/administration/admin/OrganizationUnitGrid.tsx +143 -143
- package/src/components/administration/admin/OrganizationUnitTypeGrid.tsx +108 -108
- package/src/components/administration/admin/PersonGrid.tsx +27 -27
- package/src/components/administration/admin/RoleAuthoritiesForm.tsx +82 -82
- package/src/components/administration/admin/SystemApplicationAuthorityGrid.tsx +117 -117
- package/src/components/administration/admin/SystemApplicationGrid.tsx +83 -83
- package/src/components/administration/admin/SystemApplicationModuleGrid.tsx +96 -96
- package/src/components/administration/admin/SystemApplicationRoleAuthorityGrid.tsx +75 -75
- package/src/components/administration/admin/SystemApplicationRoleGrid.tsx +116 -116
- package/src/components/administration/dev/AttachmentConfigGrid.tsx +224 -224
- package/src/components/administration/dev/AttachmentGrid.tsx +172 -172
- package/src/components/administration/dev/BluePrintGrid.tsx +129 -129
- package/src/components/administration/dev/DashboardGrid.tsx +173 -173
- package/src/components/administration/dev/DashboardWidgetGrid.tsx +164 -164
- package/src/components/administration/dev/DataQueryGrid.tsx +216 -216
- package/src/components/administration/dev/DataQueryParameterGrid.tsx +191 -191
- package/src/components/administration/dev/DataQueryParametersForm.tsx +84 -84
- package/src/components/administration/dev/DatasourceConnectionGrid.tsx +151 -151
- package/src/components/administration/dev/EntityParameterGrid.tsx +322 -322
- package/src/components/administration/dev/LookupGrid.tsx +120 -120
- package/src/components/administration/dev/MailAttachmentGrid.tsx +172 -172
- package/src/components/administration/dev/MailBodyGrid.tsx +216 -216
- package/src/components/administration/dev/MailNotificationQueueGrid.tsx +245 -245
- package/src/components/administration/dev/MailRecipientGrid.tsx +170 -170
- package/src/components/administration/dev/MailSenderConfigGrid.tsx +486 -486
- package/src/components/administration/dev/MailTemplateGrid.tsx +385 -385
- package/src/components/administration/dev/NotificationGrid.tsx +435 -435
- package/src/components/administration/dev/NotificationQueueGrid.tsx +222 -222
- package/src/components/administration/dev/ReportGrid.tsx +503 -503
- package/src/components/administration/dev/ReportParameterGrid.tsx +186 -186
- package/src/components/administration/dev/ReportParametersForm.tsx +84 -84
- package/src/components/administration/dev/WidgetGrid.tsx +380 -380
- package/src/components/administration/dev/WorkflowDocumentActionGrid.tsx +264 -264
- package/src/components/administration/dev/WorkflowDocumentActionHistoryGrid.tsx +172 -172
- package/src/components/administration/dev/WorkflowDocumentActionMailGrid.tsx +161 -161
- package/src/components/administration/dev/WorkflowDocumentGrid.tsx +357 -357
- package/src/components/administration/dev/WorkflowDocumentMailLogGrid.tsx +218 -218
- package/src/components/administration/dev/WorkflowDocumentStatusGrid.tsx +243 -243
- package/src/components/common/AzureLogin.tsx +222 -222
- package/src/components/common/ChangeOrgForm.tsx +85 -85
- package/src/components/common/Home.tsx +43 -43
- package/src/components/common/LanguageSwitcher.tsx +25 -25
- package/src/components/common/LayoutHandlers.tsx +11 -11
- package/src/components/common/LoadingMask.tsx +24 -24
- package/src/components/common/Login.tsx +268 -268
- package/src/components/common/MobileLogin.tsx +229 -229
- package/src/components/common/MyNotificationsPanel.tsx +109 -109
- package/src/components/common/NoLicenseComponent.tsx +79 -79
- package/src/components/common/NotificationItem.tsx +138 -138
- package/src/components/index.ts +10 -10
- package/src/components/msalConfig.ts +11 -11
- package/src/components/templates/DataEntryTemplates/DataEntryTypes.ts +361 -361
- package/src/components/templates/DataEntryTemplates/DataEntryUtil.ts +297 -297
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormAction.tsx +60 -60
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormElementField.tsx +238 -238
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormElementGroup.tsx +108 -108
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/CheckBox.tsx +66 -66
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/ComboBox.tsx +164 -164
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/Datefield.tsx +70 -70
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/DatetimeField.tsx +71 -71
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/FiltersPanel.tsx +237 -237
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/SystemLookupCombobox.tsx +56 -56
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/TemplateTextField.tsx +20 -20
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/TemplateForm.tsx +431 -431
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/DataGridColumnsUtil.tsx +197 -197
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid.tsx +1044 -1044
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGridMultiRecordAction.tsx +89 -89
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGridRecordAction.tsx +95 -95
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGridTopBar.tsx +251 -251
- package/src/components/templates/TransferList.tsx +256 -256
- package/src/components/templates/Window/ConfirmationWindow.tsx +55 -55
- package/src/components/templates/attachment/AttachmentCard.tsx +141 -141
- package/src/components/templates/attachment/AttachmentImageViewer.tsx +85 -85
- package/src/components/templates/attachment/AttachmentPanel.tsx +285 -285
- package/src/components/templates/index.ts +35 -35
- package/src/components/templates/report/ExcelReportViewer.tsx +71 -71
- package/src/components/templates/report/ReportViewer.tsx +261 -261
- package/src/components/templates/report/ReportViewerRoute.tsx +9 -9
- package/src/components/templates/visuals/DashboardRouteView.tsx +9 -9
- package/src/components/templates/visuals/DashboardViewer.tsx +192 -192
- package/src/components/templates/visuals/WidgetViewer.tsx +208 -208
- package/src/components/templates/visuals/charts/TemplateBarChart.tsx +23 -23
- package/src/components/templates/visuals/charts/TemplateDataCard.tsx +35 -35
- package/src/components/templates/visuals/charts/TemplateGauge.tsx +21 -21
- package/src/components/templates/visuals/charts/TemplateLineChart.tsx +22 -22
- package/src/components/templates/visuals/charts/TemplateLineProgress.tsx +42 -42
- package/src/components/templates/visuals/charts/TemplatePieChart.tsx +24 -24
- package/src/components/templates/workflow/WorkflowDocumentPanel.tsx +611 -611
- package/src/components/templates/workflow/WorkflowDocumentTimeLine.tsx +145 -145
- package/src/components/templates/workflow/WorkflowRouteComponent.tsx +14 -14
- package/src/examples/ExampleGrid.tsx +134 -134
- package/src/hooks/UseConfirmationWindow.tsx +56 -56
- package/src/hooks/UseMobile.tsx +13 -13
- package/src/hooks/UseSession.tsx +59 -59
- package/src/hooks/UseWindow.tsx +111 -111
- package/src/hooks/index.ts +22 -22
- package/src/hooks/useApiActions.ts +124 -124
- package/src/hooks/useAxios.tsx +340 -340
- package/src/hooks/useCommonStore.tsx +29 -29
- package/src/hooks/useInterval.tsx +23 -23
- package/src/hooks/useLoadingMask.tsx +16 -16
- package/src/hooks/useLookupGridColumn.tsx +35 -35
- package/src/hooks/useParameterPanel.tsx +171 -171
- package/src/index.ts +4 -4
- package/src/layout/DrawerHeader.tsx +10 -10
- package/src/layout/Layout.tsx +102 -102
- package/src/layout/MainContent.tsx +115 -115
- package/src/layout/MobileDrawer.tsx +103 -103
- package/src/layout/NavigationTree.tsx +360 -360
- package/src/layout/NotificationButton.tsx +207 -207
- package/src/layout/RouteWrapper.tsx +63 -63
- package/src/layout/SideBar.tsx +85 -85
- package/src/layout/TopBar.tsx +317 -317
- package/src/locales/arabic/adminLocalsAr.json +94 -94
- package/src/locales/arabic/common.json +44 -44
- package/src/locales/arabic/devLocalsAr.json +317 -317
- package/src/locales/arabic/index.ts +9 -9
- package/src/locales/english/adminLocalsEn.json +97 -97
- package/src/locales/english/common.json +43 -43
- package/src/locales/english/devLocalsEn.json +318 -318
- package/src/locales/english/index.ts +9 -9
- package/src/locales/i18n.ts +8 -8
- package/src/locales/index.ts +9 -9
- package/src/main.tsx +41 -41
- package/src/navigationItems/Administration/adminNavigationItems.tsx +231 -231
- package/src/navigationItems/Administration/index.tsx +16 -16
- package/src/navigationItems/common/CommonNavigationItems.tsx +12 -12
- package/src/navigationItems/common/index.tsx +7 -7
- package/src/navigationItems/index.tsx +35 -35
- package/src/redux/features/administration/AdministrationStoresMetaData.ts +164 -164
- package/src/redux/features/common/AppInfoSlice.ts +95 -95
- package/src/redux/features/common/AppLayoutSlice.ts +29 -29
- package/src/redux/features/common/CommonStoreSlice.ts +44 -44
- package/src/redux/features/common/LoadingMaskSlice.ts +30 -30
- package/src/redux/features/common/SideBarSlice.ts +27 -27
- package/src/redux/features/common/UserSessionSlice.ts +54 -54
- package/src/redux/store.ts +29 -29
- package/src/routes/administration/adminRoutes.tsx +99 -99
- package/src/routes/administration/devRoutes.tsx +129 -129
- package/src/routes/administration/index.ts +10 -10
- package/src/routes/index.ts +5 -5
- package/src/routes/types/index.ts +6 -6
- package/src/styles/index.css +19 -19
- package/src/types/index.ts +8 -8
- package/src/util/AppUtils.ts +73 -73
- package/src/util/constants.ts +6 -6
- package/src/util/index.ts +5 -5
- package/tsconfig.json +135 -135
- package/vite.config.ts +24 -24
- package/package-lock.json/342/200/216 +0 -9040
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { useDispatch, useSelector } from "react-redux";
|
|
2
|
-
import { StoreMetaData } from "../types";
|
|
3
|
-
import useAxios from "./useAxios";
|
|
4
|
-
import { setStoreData } from "../redux/features/common/CommonStoreSlice";
|
|
5
|
-
|
|
6
|
-
const useCommonStore = (storeKey: string) => {
|
|
7
|
-
const dispatch = useDispatch();
|
|
8
|
-
const { handleGetRequest } = useAxios();
|
|
9
|
-
const store: StoreMetaData = useSelector(
|
|
10
|
-
(state: any) => state?.commonStores?.stores[storeKey]
|
|
11
|
-
);
|
|
12
|
-
const reload = async () => {
|
|
13
|
-
if (store && store?.url) {
|
|
14
|
-
await handleGetRequest({
|
|
15
|
-
endPointURI: store.url,
|
|
16
|
-
showMask: true,
|
|
17
|
-
successCallBkFn: (response: any) => {
|
|
18
|
-
dispatch(setStoreData({ storeKey, data: response.data }));
|
|
19
|
-
},
|
|
20
|
-
failureCallBkFn: () => {
|
|
21
|
-
dispatch(setStoreData({ storeKey, data: [] }));
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
return { reload, data: store?.data, store };
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default useCommonStore;
|
|
1
|
+
import { useDispatch, useSelector } from "react-redux";
|
|
2
|
+
import { StoreMetaData } from "../types";
|
|
3
|
+
import useAxios from "./useAxios";
|
|
4
|
+
import { setStoreData } from "../redux/features/common/CommonStoreSlice";
|
|
5
|
+
|
|
6
|
+
const useCommonStore = (storeKey: string) => {
|
|
7
|
+
const dispatch = useDispatch();
|
|
8
|
+
const { handleGetRequest } = useAxios();
|
|
9
|
+
const store: StoreMetaData = useSelector(
|
|
10
|
+
(state: any) => state?.commonStores?.stores[storeKey]
|
|
11
|
+
);
|
|
12
|
+
const reload = async () => {
|
|
13
|
+
if (store && store?.url) {
|
|
14
|
+
await handleGetRequest({
|
|
15
|
+
endPointURI: store.url,
|
|
16
|
+
showMask: true,
|
|
17
|
+
successCallBkFn: (response: any) => {
|
|
18
|
+
dispatch(setStoreData({ storeKey, data: response.data }));
|
|
19
|
+
},
|
|
20
|
+
failureCallBkFn: () => {
|
|
21
|
+
dispatch(setStoreData({ storeKey, data: [] }));
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return { reload, data: store?.data, store };
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default useCommonStore;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { useEffect, useRef } from "react";
|
|
2
|
-
|
|
3
|
-
export default function useInterval(
|
|
4
|
-
callback: () => void,
|
|
5
|
-
delay: number | null
|
|
6
|
-
) {
|
|
7
|
-
const savedCallback = useRef<() => void>(callback);
|
|
8
|
-
|
|
9
|
-
// Remember the latest callback
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
savedCallback.current = callback;
|
|
12
|
-
}, [callback]);
|
|
13
|
-
|
|
14
|
-
// Set up the interval
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
if (delay === null) return;
|
|
17
|
-
|
|
18
|
-
const tick = () => savedCallback.current?.();
|
|
19
|
-
|
|
20
|
-
const id = setInterval(tick, delay);
|
|
21
|
-
return () => clearInterval(id);
|
|
22
|
-
}, [delay]);
|
|
23
|
-
}
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
|
|
3
|
+
export default function useInterval(
|
|
4
|
+
callback: () => void,
|
|
5
|
+
delay: number | null
|
|
6
|
+
) {
|
|
7
|
+
const savedCallback = useRef<() => void>(callback);
|
|
8
|
+
|
|
9
|
+
// Remember the latest callback
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
savedCallback.current = callback;
|
|
12
|
+
}, [callback]);
|
|
13
|
+
|
|
14
|
+
// Set up the interval
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (delay === null) return;
|
|
17
|
+
|
|
18
|
+
const tick = () => savedCallback.current?.();
|
|
19
|
+
|
|
20
|
+
const id = setInterval(tick, delay);
|
|
21
|
+
return () => clearInterval(id);
|
|
22
|
+
}, [delay]);
|
|
23
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { useDispatch } from "react-redux";
|
|
2
|
-
import { hideLoadingMask, showLoadingMask } from "../redux/features/common/LoadingMaskSlice";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const useLoadingMask = () => {
|
|
6
|
-
const dispatch = useDispatch();
|
|
7
|
-
const show = (message?: string) => {
|
|
8
|
-
dispatch(showLoadingMask(message));
|
|
9
|
-
};
|
|
10
|
-
const hide = () => {
|
|
11
|
-
dispatch(hideLoadingMask());
|
|
12
|
-
};
|
|
13
|
-
return { show, hide };
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export default useLoadingMask;
|
|
1
|
+
import { useDispatch } from "react-redux";
|
|
2
|
+
import { hideLoadingMask, showLoadingMask } from "../redux/features/common/LoadingMaskSlice";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const useLoadingMask = () => {
|
|
6
|
+
const dispatch = useDispatch();
|
|
7
|
+
const show = (message?: string) => {
|
|
8
|
+
dispatch(showLoadingMask(message));
|
|
9
|
+
};
|
|
10
|
+
const hide = () => {
|
|
11
|
+
dispatch(hideLoadingMask());
|
|
12
|
+
};
|
|
13
|
+
return { show, hide };
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default useLoadingMask;
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { useSelector } from "react-redux";
|
|
2
|
-
import { TemplateGridColDef } from "../components";
|
|
3
|
-
import useAxios from "./useAxios";
|
|
4
|
-
|
|
5
|
-
const useLookupGridColumn = () => {
|
|
6
|
-
const { handleGetRequest } = useAxios();
|
|
7
|
-
const AppLayout = useSelector((state: any) => state.AppLayout);
|
|
8
|
-
const getLookupOptions = async (lookupType: string) => {
|
|
9
|
-
let options = [];
|
|
10
|
-
await handleGetRequest({
|
|
11
|
-
endPointURI: "api/v1/public/system/lookup",
|
|
12
|
-
showMask: true,
|
|
13
|
-
parameters: { lookupType },
|
|
14
|
-
successCallBkFn: (response: any) => {
|
|
15
|
-
options = response.data;
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
return options;
|
|
19
|
-
};
|
|
20
|
-
const generateLookupGridColumn = async (props: TemplateGridColDef) => {
|
|
21
|
-
let options = await getLookupOptions(props.lookupType);
|
|
22
|
-
return {
|
|
23
|
-
...props,
|
|
24
|
-
options,
|
|
25
|
-
displayField:
|
|
26
|
-
AppLayout.appDirection === "ltr"
|
|
27
|
-
? "lookupEnDisplay"
|
|
28
|
-
: "lookupArDisplay",
|
|
29
|
-
valueField: "lookupValue",
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
return { generateLookupGridColumn, getLookupOptions };
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export default useLookupGridColumn;
|
|
1
|
+
import { useSelector } from "react-redux";
|
|
2
|
+
import { TemplateGridColDef } from "../components";
|
|
3
|
+
import useAxios from "./useAxios";
|
|
4
|
+
|
|
5
|
+
const useLookupGridColumn = () => {
|
|
6
|
+
const { handleGetRequest } = useAxios();
|
|
7
|
+
const AppLayout = useSelector((state: any) => state.AppLayout);
|
|
8
|
+
const getLookupOptions = async (lookupType: string) => {
|
|
9
|
+
let options = [];
|
|
10
|
+
await handleGetRequest({
|
|
11
|
+
endPointURI: "api/v1/public/system/lookup",
|
|
12
|
+
showMask: true,
|
|
13
|
+
parameters: { lookupType },
|
|
14
|
+
successCallBkFn: (response: any) => {
|
|
15
|
+
options = response.data;
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
return options;
|
|
19
|
+
};
|
|
20
|
+
const generateLookupGridColumn = async (props: TemplateGridColDef) => {
|
|
21
|
+
let options = await getLookupOptions(props.lookupType);
|
|
22
|
+
return {
|
|
23
|
+
...props,
|
|
24
|
+
options,
|
|
25
|
+
displayField:
|
|
26
|
+
AppLayout.appDirection === "ltr"
|
|
27
|
+
? "lookupEnDisplay"
|
|
28
|
+
: "lookupArDisplay",
|
|
29
|
+
valueField: "lookupValue",
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
return { generateLookupGridColumn, getLookupOptions };
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default useLookupGridColumn;
|
|
@@ -1,171 +1,171 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
import {
|
|
3
|
-
Accordion,
|
|
4
|
-
AccordionDetails,
|
|
5
|
-
AccordionSummary,
|
|
6
|
-
Box,
|
|
7
|
-
FontAwesomeIcon,
|
|
8
|
-
FormElementProps,
|
|
9
|
-
TemplateForm,
|
|
10
|
-
Typography,
|
|
11
|
-
} from "../components";
|
|
12
|
-
import { useTranslation } from "react-i18next";
|
|
13
|
-
|
|
14
|
-
export type EntityParameter = {
|
|
15
|
-
parameterCode: string;
|
|
16
|
-
parameterLabel: string;
|
|
17
|
-
parameterValueFormat?: string;
|
|
18
|
-
parameterValueField?: string;
|
|
19
|
-
parameterDisplayField?: string;
|
|
20
|
-
parameterDataset?: Array<any>;
|
|
21
|
-
parameterDataQueryId?: number;
|
|
22
|
-
hidden?: boolean;
|
|
23
|
-
mandatory?: boolean;
|
|
24
|
-
defaultValue?: any;
|
|
25
|
-
parameterType:
|
|
26
|
-
| "text"
|
|
27
|
-
| "number"
|
|
28
|
-
| "date"
|
|
29
|
-
| "datetime"
|
|
30
|
-
| "combobox"
|
|
31
|
-
| "checkbox"
|
|
32
|
-
| "html"
|
|
33
|
-
| "lookup";
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const getFormElementsFromParameters = (
|
|
37
|
-
parameters: Array<EntityParameter>,
|
|
38
|
-
parameterValues: any,
|
|
39
|
-
) => {
|
|
40
|
-
const formElements: Array<FormElementProps> = [];
|
|
41
|
-
for (const parameter of parameters) {
|
|
42
|
-
|
|
43
|
-
const formElement: FormElementProps = {
|
|
44
|
-
type: "field",
|
|
45
|
-
mode: "props",
|
|
46
|
-
props: {
|
|
47
|
-
fieldLabel: parameter?.parameterLabel,
|
|
48
|
-
fieldName: parameter?.parameterCode,
|
|
49
|
-
fieldType: parameter?.parameterType,
|
|
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,
|
|
62
|
-
formProps: { fieldSize: { lg: 4, md: 6, sm: 12 } },
|
|
63
|
-
required: parameter?.mandatory,
|
|
64
|
-
defaultValue:
|
|
65
|
-
parameterValues[parameter?.parameterCode] || parameter?.defaultValue,
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
formElements.push(formElement);
|
|
69
|
-
}
|
|
70
|
-
return formElements;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
interface UseParameterPanelProps {
|
|
74
|
-
parameters: Array<EntityParameter>;
|
|
75
|
-
initialParameterValues?: any;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export const useParameterPanel = (props: UseParameterPanelProps) => {
|
|
79
|
-
const [parametersValues, setParametersValues] = useState<any>({
|
|
80
|
-
...props?.initialParameterValues,
|
|
81
|
-
});
|
|
82
|
-
const panelElements = getFormElementsFromParameters(
|
|
83
|
-
props.parameters,
|
|
84
|
-
parametersValues,
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
const ParameterPanel: React.FC<{
|
|
88
|
-
searchBtnClickCallBk: (params: any) => Promise<void>;
|
|
89
|
-
}> = ({ searchBtnClickCallBk }) => {
|
|
90
|
-
const { t } = useTranslation();
|
|
91
|
-
return (
|
|
92
|
-
<Accordion defaultExpanded sx={{ width: "100%" }}>
|
|
93
|
-
<AccordionSummary
|
|
94
|
-
expandIcon={
|
|
95
|
-
<FontAwesomeIcon
|
|
96
|
-
icon={{ prefix: "far", iconName: "square-caret-down" }}
|
|
97
|
-
/>
|
|
98
|
-
}
|
|
99
|
-
>
|
|
100
|
-
<Box
|
|
101
|
-
sx={{
|
|
102
|
-
display: "flex",
|
|
103
|
-
alignItems: "center",
|
|
104
|
-
justifyContent: "center",
|
|
105
|
-
}}
|
|
106
|
-
>
|
|
107
|
-
<FontAwesomeIcon
|
|
108
|
-
style={{ marginLeft: 5, marginRight: 5 }}
|
|
109
|
-
icon="search"
|
|
110
|
-
/>
|
|
111
|
-
<Typography component="span">Filters</Typography>
|
|
112
|
-
</Box>
|
|
113
|
-
</AccordionSummary>
|
|
114
|
-
<AccordionDetails>
|
|
115
|
-
<Box>
|
|
116
|
-
<TemplateForm
|
|
117
|
-
saveButtonSpecs={{
|
|
118
|
-
label: t("Filter"),
|
|
119
|
-
icon: "search",
|
|
120
|
-
actionButtonVariant: "outlined",
|
|
121
|
-
actionButtonColor: "success",
|
|
122
|
-
}}
|
|
123
|
-
cancelButtonSpecs={{
|
|
124
|
-
label: t("RESET_BTN_LABEL"),
|
|
125
|
-
icon: "eraser",
|
|
126
|
-
hidden: true,
|
|
127
|
-
actionButtonVariant: "outlined",
|
|
128
|
-
actionButtonColor: "error",
|
|
129
|
-
}}
|
|
130
|
-
actions={[
|
|
131
|
-
{
|
|
132
|
-
label: t("RESET_BTN_LABEL"),
|
|
133
|
-
icon: "eraser",
|
|
134
|
-
isIdRequired: false,
|
|
135
|
-
formActionProps: { enabled: true },
|
|
136
|
-
actionFn: async (data, recordIdsToProcessActionOn) => {
|
|
137
|
-
setParametersValues({});
|
|
138
|
-
},
|
|
139
|
-
},
|
|
140
|
-
]}
|
|
141
|
-
apiActions={{
|
|
142
|
-
deleteRecordById: async () => {
|
|
143
|
-
return true;
|
|
144
|
-
},
|
|
145
|
-
saveRecord: async (params) => {
|
|
146
|
-
if (params != undefined) {
|
|
147
|
-
setParametersValues(params);
|
|
148
|
-
} else {
|
|
149
|
-
setParametersValues({});
|
|
150
|
-
}
|
|
151
|
-
if (searchBtnClickCallBk) {
|
|
152
|
-
await searchBtnClickCallBk(params);
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
reloadData: async () => {},
|
|
156
|
-
loadRecordById: async () => {},
|
|
157
|
-
}}
|
|
158
|
-
elements={panelElements}
|
|
159
|
-
/>
|
|
160
|
-
</Box>
|
|
161
|
-
</AccordionDetails>
|
|
162
|
-
</Accordion>
|
|
163
|
-
);
|
|
164
|
-
};
|
|
165
|
-
return {
|
|
166
|
-
ParameterPanel,
|
|
167
|
-
parametersValues,
|
|
168
|
-
setParametersValues,
|
|
169
|
-
panelElements,
|
|
170
|
-
};
|
|
171
|
-
};
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Accordion,
|
|
4
|
+
AccordionDetails,
|
|
5
|
+
AccordionSummary,
|
|
6
|
+
Box,
|
|
7
|
+
FontAwesomeIcon,
|
|
8
|
+
FormElementProps,
|
|
9
|
+
TemplateForm,
|
|
10
|
+
Typography,
|
|
11
|
+
} from "../components";
|
|
12
|
+
import { useTranslation } from "react-i18next";
|
|
13
|
+
|
|
14
|
+
export type EntityParameter = {
|
|
15
|
+
parameterCode: string;
|
|
16
|
+
parameterLabel: string;
|
|
17
|
+
parameterValueFormat?: string;
|
|
18
|
+
parameterValueField?: string;
|
|
19
|
+
parameterDisplayField?: string;
|
|
20
|
+
parameterDataset?: Array<any>;
|
|
21
|
+
parameterDataQueryId?: number;
|
|
22
|
+
hidden?: boolean;
|
|
23
|
+
mandatory?: boolean;
|
|
24
|
+
defaultValue?: any;
|
|
25
|
+
parameterType:
|
|
26
|
+
| "text"
|
|
27
|
+
| "number"
|
|
28
|
+
| "date"
|
|
29
|
+
| "datetime"
|
|
30
|
+
| "combobox"
|
|
31
|
+
| "checkbox"
|
|
32
|
+
| "html"
|
|
33
|
+
| "lookup";
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const getFormElementsFromParameters = (
|
|
37
|
+
parameters: Array<EntityParameter>,
|
|
38
|
+
parameterValues: any,
|
|
39
|
+
) => {
|
|
40
|
+
const formElements: Array<FormElementProps> = [];
|
|
41
|
+
for (const parameter of parameters) {
|
|
42
|
+
|
|
43
|
+
const formElement: FormElementProps = {
|
|
44
|
+
type: "field",
|
|
45
|
+
mode: "props",
|
|
46
|
+
props: {
|
|
47
|
+
fieldLabel: parameter?.parameterLabel,
|
|
48
|
+
fieldName: parameter?.parameterCode,
|
|
49
|
+
fieldType: parameter?.parameterType,
|
|
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,
|
|
62
|
+
formProps: { fieldSize: { lg: 4, md: 6, sm: 12 } },
|
|
63
|
+
required: parameter?.mandatory,
|
|
64
|
+
defaultValue:
|
|
65
|
+
parameterValues[parameter?.parameterCode] || parameter?.defaultValue,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
formElements.push(formElement);
|
|
69
|
+
}
|
|
70
|
+
return formElements;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
interface UseParameterPanelProps {
|
|
74
|
+
parameters: Array<EntityParameter>;
|
|
75
|
+
initialParameterValues?: any;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const useParameterPanel = (props: UseParameterPanelProps) => {
|
|
79
|
+
const [parametersValues, setParametersValues] = useState<any>({
|
|
80
|
+
...props?.initialParameterValues,
|
|
81
|
+
});
|
|
82
|
+
const panelElements = getFormElementsFromParameters(
|
|
83
|
+
props.parameters,
|
|
84
|
+
parametersValues,
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
const ParameterPanel: React.FC<{
|
|
88
|
+
searchBtnClickCallBk: (params: any) => Promise<void>;
|
|
89
|
+
}> = ({ searchBtnClickCallBk }) => {
|
|
90
|
+
const { t } = useTranslation();
|
|
91
|
+
return (
|
|
92
|
+
<Accordion defaultExpanded sx={{ width: "100%" }}>
|
|
93
|
+
<AccordionSummary
|
|
94
|
+
expandIcon={
|
|
95
|
+
<FontAwesomeIcon
|
|
96
|
+
icon={{ prefix: "far", iconName: "square-caret-down" }}
|
|
97
|
+
/>
|
|
98
|
+
}
|
|
99
|
+
>
|
|
100
|
+
<Box
|
|
101
|
+
sx={{
|
|
102
|
+
display: "flex",
|
|
103
|
+
alignItems: "center",
|
|
104
|
+
justifyContent: "center",
|
|
105
|
+
}}
|
|
106
|
+
>
|
|
107
|
+
<FontAwesomeIcon
|
|
108
|
+
style={{ marginLeft: 5, marginRight: 5 }}
|
|
109
|
+
icon="search"
|
|
110
|
+
/>
|
|
111
|
+
<Typography component="span">Filters</Typography>
|
|
112
|
+
</Box>
|
|
113
|
+
</AccordionSummary>
|
|
114
|
+
<AccordionDetails>
|
|
115
|
+
<Box>
|
|
116
|
+
<TemplateForm
|
|
117
|
+
saveButtonSpecs={{
|
|
118
|
+
label: t("Filter"),
|
|
119
|
+
icon: "search",
|
|
120
|
+
actionButtonVariant: "outlined",
|
|
121
|
+
actionButtonColor: "success",
|
|
122
|
+
}}
|
|
123
|
+
cancelButtonSpecs={{
|
|
124
|
+
label: t("RESET_BTN_LABEL"),
|
|
125
|
+
icon: "eraser",
|
|
126
|
+
hidden: true,
|
|
127
|
+
actionButtonVariant: "outlined",
|
|
128
|
+
actionButtonColor: "error",
|
|
129
|
+
}}
|
|
130
|
+
actions={[
|
|
131
|
+
{
|
|
132
|
+
label: t("RESET_BTN_LABEL"),
|
|
133
|
+
icon: "eraser",
|
|
134
|
+
isIdRequired: false,
|
|
135
|
+
formActionProps: { enabled: true },
|
|
136
|
+
actionFn: async (data, recordIdsToProcessActionOn) => {
|
|
137
|
+
setParametersValues({});
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
]}
|
|
141
|
+
apiActions={{
|
|
142
|
+
deleteRecordById: async () => {
|
|
143
|
+
return true;
|
|
144
|
+
},
|
|
145
|
+
saveRecord: async (params) => {
|
|
146
|
+
if (params != undefined) {
|
|
147
|
+
setParametersValues(params);
|
|
148
|
+
} else {
|
|
149
|
+
setParametersValues({});
|
|
150
|
+
}
|
|
151
|
+
if (searchBtnClickCallBk) {
|
|
152
|
+
await searchBtnClickCallBk(params);
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
reloadData: async () => {},
|
|
156
|
+
loadRecordById: async () => {},
|
|
157
|
+
}}
|
|
158
|
+
elements={panelElements}
|
|
159
|
+
/>
|
|
160
|
+
</Box>
|
|
161
|
+
</AccordionDetails>
|
|
162
|
+
</Accordion>
|
|
163
|
+
);
|
|
164
|
+
};
|
|
165
|
+
return {
|
|
166
|
+
ParameterPanel,
|
|
167
|
+
parametersValues,
|
|
168
|
+
setParametersValues,
|
|
169
|
+
panelElements,
|
|
170
|
+
};
|
|
171
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./components";
|
|
2
|
-
export * from "./hooks";
|
|
3
|
-
export * from "./util";
|
|
4
|
-
export * from "./types";
|
|
1
|
+
export * from "./components";
|
|
2
|
+
export * from "./hooks";
|
|
3
|
+
export * from "./util";
|
|
4
|
+
export * from "./types";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { styled } from "@mui/material";
|
|
2
|
-
|
|
3
|
-
export const DrawerHeader = styled("div")(({ theme }) => ({
|
|
4
|
-
display: "flex",
|
|
5
|
-
alignItems: "center",
|
|
6
|
-
// padding: theme.spacing(0, 1),
|
|
7
|
-
// necessary for content to be below app bar
|
|
8
|
-
...theme.mixins.toolbar,
|
|
9
|
-
justifyContent: "flex-end",
|
|
10
|
-
}));
|
|
1
|
+
import { styled } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
export const DrawerHeader = styled("div")(({ theme }) => ({
|
|
4
|
+
display: "flex",
|
|
5
|
+
alignItems: "center",
|
|
6
|
+
// padding: theme.spacing(0, 1),
|
|
7
|
+
// necessary for content to be below app bar
|
|
8
|
+
...theme.mixins.toolbar,
|
|
9
|
+
justifyContent: "flex-end",
|
|
10
|
+
}));
|