@asaleh37/ui-base 25.8.26 → 25.8.31-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/dist/index.d.ts +22 -6
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/administration/dev/AttachmentConfigGrid.tsx +1 -0
- package/src/components/administration/dev/DataQueryGrid.tsx +26 -16
- package/src/components/administration/dev/DatasourceConnectionGrid.tsx +1 -0
- package/src/components/administration/dev/EntityParameterGrid.tsx +94 -67
- package/src/components/administration/dev/MailSenderConfigGrid.tsx +1 -0
- package/src/components/administration/dev/MailTemplateGrid.tsx +1 -0
- package/src/components/administration/dev/NotificationGrid.tsx +5 -2
- package/src/components/administration/dev/ReportGrid.tsx +102 -111
- package/src/components/administration/dev/WidgetGrid.tsx +96 -147
- package/src/components/administration/dev/WorkflowDocumentGrid.tsx +2 -23
- package/src/components/templates/DataEntryTemplates/DataEntryTypes.ts +41 -16
- package/src/components/templates/DataEntryTemplates/DataEntryUtil.ts +20 -10
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormElementField.tsx +80 -60
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/Datefield.tsx +1 -1
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/DatetimeField.tsx +1 -1
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/TemplateForm.tsx +83 -65
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid.tsx +8 -5
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGridTopBar.tsx +3 -1
- package/src/components/templates/report/ReportViewer.tsx +24 -138
- package/src/components/templates/visuals/DashboardViewer.tsx +49 -5
- package/src/components/templates/visuals/WidgetViewer.tsx +24 -14
- package/src/examples/ExampleGrid.tsx +134 -0
- package/src/hooks/useParameterPanel.tsx +168 -0
- package/src/layout/MainContent.tsx +47 -50
- package/src/locales/arabic/devLocalsAr.json +2 -2
- package/src/locales/english/devLocalsEn.json +2 -2
- package/src/navigationItems/index.tsx +1 -1
- package/src/routes/index.ts +1 -1
- package/src/util/AppUtils.ts +2 -0
|
@@ -0,0 +1,168 @@
|
|
|
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
|
+
const formElement: FormElementProps = {
|
|
43
|
+
type: "field",
|
|
44
|
+
mode: "props",
|
|
45
|
+
props: {
|
|
46
|
+
fieldLabel: parameter?.parameterLabel,
|
|
47
|
+
fieldName: parameter?.parameterCode,
|
|
48
|
+
fieldType: parameter?.parameterType,
|
|
49
|
+
hidden: parameter?.hidden,
|
|
50
|
+
formProps: { fieldSize: { lg: 4, md: 6, sm: 12 } },
|
|
51
|
+
required: parameter?.mandatory,
|
|
52
|
+
defaultValue:
|
|
53
|
+
parameterValues[parameter?.parameterCode] || parameter?.defaultValue,
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
formElements.push(formElement);
|
|
57
|
+
}
|
|
58
|
+
return formElements;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
interface UseParameterPanelProps {
|
|
62
|
+
parameters: Array<EntityParameter>;
|
|
63
|
+
initialParameterValues?: any;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const useParameterPanel = (props: UseParameterPanelProps) => {
|
|
67
|
+
console.log("useParameterPanel", "useParameterPanel called");
|
|
68
|
+
const [parametersValues, setParametersValues] = useState<any>({
|
|
69
|
+
...props?.initialParameterValues,
|
|
70
|
+
});
|
|
71
|
+
// const [panelElements, setPanelElements] = useState<Array<FormElementProps>>(
|
|
72
|
+
// []
|
|
73
|
+
// );
|
|
74
|
+
const panelElements = getFormElementsFromParameters(
|
|
75
|
+
props.parameters,
|
|
76
|
+
parametersValues
|
|
77
|
+
);
|
|
78
|
+
// useEffect(() => {
|
|
79
|
+
// setPanelElements(
|
|
80
|
+
// getFormElementsFromParameters(props.parameters, parametersValues)
|
|
81
|
+
// );
|
|
82
|
+
// }, [props.parameters]);
|
|
83
|
+
|
|
84
|
+
const ParameterPanel: React.FC<{
|
|
85
|
+
searchBtnClickCallBk: (params: any) => Promise<void>;
|
|
86
|
+
}> = ({ searchBtnClickCallBk }) => {
|
|
87
|
+
const { t } = useTranslation();
|
|
88
|
+
return (
|
|
89
|
+
<Accordion defaultExpanded sx={{ width: "100%" }}>
|
|
90
|
+
<AccordionSummary
|
|
91
|
+
expandIcon={
|
|
92
|
+
<FontAwesomeIcon
|
|
93
|
+
icon={{ prefix: "far", iconName: "square-caret-down" }}
|
|
94
|
+
/>
|
|
95
|
+
}
|
|
96
|
+
>
|
|
97
|
+
<Box
|
|
98
|
+
sx={{
|
|
99
|
+
display: "flex",
|
|
100
|
+
alignItems: "center",
|
|
101
|
+
justifyContent: "center",
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
104
|
+
<FontAwesomeIcon
|
|
105
|
+
style={{ marginLeft: 5, marginRight: 5 }}
|
|
106
|
+
icon="search"
|
|
107
|
+
/>
|
|
108
|
+
<Typography component="span">Filters</Typography>
|
|
109
|
+
</Box>
|
|
110
|
+
</AccordionSummary>
|
|
111
|
+
<AccordionDetails>
|
|
112
|
+
<Box>
|
|
113
|
+
<TemplateForm
|
|
114
|
+
saveButtonSpecs={{
|
|
115
|
+
label: t("Filter"),
|
|
116
|
+
icon: "search",
|
|
117
|
+
actionButtonVariant: "outlined",
|
|
118
|
+
actionButtonColor: "success",
|
|
119
|
+
}}
|
|
120
|
+
cancelButtonSpecs={{
|
|
121
|
+
label: t("RESET_BTN_LABEL"),
|
|
122
|
+
icon: "eraser",
|
|
123
|
+
hidden: true,
|
|
124
|
+
actionButtonVariant: "outlined",
|
|
125
|
+
actionButtonColor: "error",
|
|
126
|
+
}}
|
|
127
|
+
actions={[
|
|
128
|
+
{
|
|
129
|
+
label: t("RESET_BTN_LABEL"),
|
|
130
|
+
icon: "eraser",
|
|
131
|
+
isIdRequired: false,
|
|
132
|
+
formActionProps: { enabled: true },
|
|
133
|
+
actionFn: async (data, recordIdsToProcessActionOn) => {
|
|
134
|
+
setParametersValues({});
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
]}
|
|
138
|
+
apiActions={{
|
|
139
|
+
deleteRecordById: async () => {
|
|
140
|
+
return true;
|
|
141
|
+
},
|
|
142
|
+
saveRecord: async (params) => {
|
|
143
|
+
if (params != undefined) {
|
|
144
|
+
setParametersValues(params);
|
|
145
|
+
} else {
|
|
146
|
+
setParametersValues({});
|
|
147
|
+
}
|
|
148
|
+
if (searchBtnClickCallBk) {
|
|
149
|
+
await searchBtnClickCallBk(parametersValues);
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
reloadData: async () => {},
|
|
153
|
+
loadRecordById: async () => {},
|
|
154
|
+
}}
|
|
155
|
+
elements={panelElements}
|
|
156
|
+
/>
|
|
157
|
+
</Box>
|
|
158
|
+
</AccordionDetails>
|
|
159
|
+
</Accordion>
|
|
160
|
+
);
|
|
161
|
+
};
|
|
162
|
+
return {
|
|
163
|
+
ParameterPanel,
|
|
164
|
+
parametersValues,
|
|
165
|
+
setParametersValues,
|
|
166
|
+
panelElements,
|
|
167
|
+
};
|
|
168
|
+
};
|
|
@@ -36,7 +36,7 @@ const MainContent: React.FC = () => {
|
|
|
36
36
|
stores[storeKey]?.url != "" &&
|
|
37
37
|
stores[storeKey].autoLoad === true
|
|
38
38
|
) {
|
|
39
|
-
|
|
39
|
+
handleGetRequest({
|
|
40
40
|
endPointURI: stores[storeKey].url,
|
|
41
41
|
showMask: false,
|
|
42
42
|
successCallBkFn: (response) => {
|
|
@@ -61,55 +61,52 @@ const MainContent: React.FC = () => {
|
|
|
61
61
|
<CacheProvider
|
|
62
62
|
value={AppLayoutState.appDirection === "ltr" ? cacheLtr : cacheRtl}
|
|
63
63
|
>
|
|
64
|
-
{isAutoLoadLoaded ? (
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
) : (
|
|
111
|
-
<></>
|
|
112
|
-
)}
|
|
64
|
+
{/* {isAutoLoadLoaded ? ( */}
|
|
65
|
+
<Box
|
|
66
|
+
sx={{
|
|
67
|
+
display: "flex",
|
|
68
|
+
flexDirection: "column",
|
|
69
|
+
// alignItems: "center",
|
|
70
|
+
justifyContent: "flex-start",
|
|
71
|
+
flex: 1,
|
|
72
|
+
overflow: "hidden",
|
|
73
|
+
padding: 3,
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
<Routes>
|
|
77
|
+
{AppInfo.enableAdministrationModule
|
|
78
|
+
? SYSTEM_ROUTES.map((route: SystemRoute, index) => {
|
|
79
|
+
return (
|
|
80
|
+
<Route
|
|
81
|
+
key={"adm" + index}
|
|
82
|
+
path={route.path}
|
|
83
|
+
element={
|
|
84
|
+
<RouteWrapper
|
|
85
|
+
authority={route.authority}
|
|
86
|
+
applicationModule={route.applicationModule}
|
|
87
|
+
>
|
|
88
|
+
<route.component />
|
|
89
|
+
</RouteWrapper>
|
|
90
|
+
}
|
|
91
|
+
/>
|
|
92
|
+
);
|
|
93
|
+
})
|
|
94
|
+
: null}
|
|
95
|
+
{businessRoutes.map((route: SystemRoute, index) => {
|
|
96
|
+
return (
|
|
97
|
+
<Route
|
|
98
|
+
key={"bs" + index}
|
|
99
|
+
path={route.path}
|
|
100
|
+
element={
|
|
101
|
+
<RouteWrapper authority={route.authority}>
|
|
102
|
+
<route.component />
|
|
103
|
+
</RouteWrapper>
|
|
104
|
+
}
|
|
105
|
+
/>
|
|
106
|
+
);
|
|
107
|
+
})}
|
|
108
|
+
</Routes>
|
|
109
|
+
</Box>
|
|
113
110
|
</CacheProvider>
|
|
114
111
|
);
|
|
115
112
|
};
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"BLUE_PRINT_POINT_POINT_CODE": "Point code",
|
|
31
31
|
"BLUE_PRINT_POINT_X": "X",
|
|
32
32
|
"BLUE_PRINT_POINT_Y": "Y",
|
|
33
|
-
"DASHBOARD_SINGULAR": "
|
|
34
|
-
"DASHBOARD_PLURAL": "
|
|
33
|
+
"DASHBOARD_SINGULAR": "Dashboard",
|
|
34
|
+
"DASHBOARD_PLURAL": "Dashboards",
|
|
35
35
|
"DASHBOARD_DASHBOARD_CODE": "Dashboard code",
|
|
36
36
|
"DASHBOARD_DASHBOARD_NAME": "Dashboard name",
|
|
37
37
|
"DASHBOARD_DASHBOARD_TITLE": "Dashboard title",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"BLUE_PRINT_POINT_POINT_CODE": "Point code",
|
|
31
31
|
"BLUE_PRINT_POINT_X": "X",
|
|
32
32
|
"BLUE_PRINT_POINT_Y": "Y",
|
|
33
|
-
"DASHBOARD_SINGULAR": "
|
|
34
|
-
"DASHBOARD_PLURAL": "
|
|
33
|
+
"DASHBOARD_SINGULAR": "Dashboard",
|
|
34
|
+
"DASHBOARD_PLURAL": "Dashboards",
|
|
35
35
|
"DASHBOARD_DASHBOARD_CODE": "Dashboard code",
|
|
36
36
|
"DASHBOARD_DASHBOARD_NAME": "Dashboard name",
|
|
37
37
|
"DASHBOARD_DASHBOARD_TITLE": "Dashboard title",
|
package/src/routes/index.ts
CHANGED