@asaleh37/ui-base 25.8.26-1 → 25.8.30
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 +6 -6
- 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/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/locales/arabic/devLocalsAr.json +2 -2
- package/src/locales/english/devLocalsEn.json +2 -2
- package/src/navigationItems/index.tsx +7 -0
- package/src/routes/index.ts +5 -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
|
+
};
|
|
@@ -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",
|
|
@@ -32,4 +32,11 @@ export const findNavigationItemById = (
|
|
|
32
32
|
|
|
33
33
|
export const NavigationItems: TreeViewBaseItem<ExtendedTreeItemProps>[] = [
|
|
34
34
|
...AdministrationItems,
|
|
35
|
+
{
|
|
36
|
+
icon: "user",
|
|
37
|
+
label: "Example Grid",
|
|
38
|
+
id: "example",
|
|
39
|
+
action: "NAVIGATION",
|
|
40
|
+
actionPayload: { path: "example" },
|
|
41
|
+
},
|
|
35
42
|
];
|
package/src/routes/index.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import Home from "../components/common/Home";
|
|
2
|
+
import ExampleGrid from "../examples/ExampleGrid";
|
|
2
3
|
import { ADMINISTRATION_ROUTES } from "./administration";
|
|
3
4
|
import { SystemRoute } from "./types";
|
|
4
5
|
|
|
5
|
-
export const SYSTEM_ROUTES: Array<SystemRoute> = [
|
|
6
|
+
export const SYSTEM_ROUTES: Array<SystemRoute> = [
|
|
7
|
+
...ADMINISTRATION_ROUTES,
|
|
8
|
+
{ path: "example", component: ExampleGrid },
|
|
9
|
+
];
|