@asaleh37/ui-base 25.9.5 → 25.9.6
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 +9 -1
- package/dist/index.js +32 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -39
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/administration/dev/WorkflowDocumentGrid.tsx +1 -1
- package/src/components/templates/DataEntryTemplates/DataEntryTypes.ts +4 -1
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormElementField.tsx +18 -60
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/ComboBox.tsx +57 -2
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/TemplateTextField.tsx +1 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/TemplateForm.tsx +19 -12
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/DataGridColumnsUtil.tsx +7 -3
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid.tsx +3 -4
- package/src/redux/features/administration/AdministrationStoresMetaData.ts +5 -0
package/package.json
CHANGED
|
@@ -35,7 +35,7 @@ const WorkflowDocumentGrid: React.FC = () => {
|
|
|
35
35
|
const { t } = useTranslation();
|
|
36
36
|
const [data, setData] = useState([]);
|
|
37
37
|
const apiActions = useApiActions({
|
|
38
|
-
|
|
38
|
+
commonStoreKey:'SystemWorkflows',
|
|
39
39
|
deleteById: "api/v1/dev/workflowdocument",
|
|
40
40
|
save: "api/v1/dev/workflowdocument",
|
|
41
41
|
findById: "api/v1/dev/workflowdocument",
|
|
@@ -202,6 +202,10 @@ export type RecordFieldProps = {
|
|
|
202
202
|
| "custom";
|
|
203
203
|
lookupType?: string;
|
|
204
204
|
comboboxValueDataType?: "number" | "string";
|
|
205
|
+
commonStoreKey?: string;
|
|
206
|
+
dataQueryId?: number;
|
|
207
|
+
storeUrl?: string;
|
|
208
|
+
storeLoadParam?: any;
|
|
205
209
|
required?: boolean;
|
|
206
210
|
disabled?: boolean;
|
|
207
211
|
hidden?: boolean;
|
|
@@ -252,7 +256,6 @@ export type FormElementFieldProps = {
|
|
|
252
256
|
hiddenFields?: string[];
|
|
253
257
|
disabledFields?: string[];
|
|
254
258
|
formValuesChangeCallBk?: FormValueChangeCallBk;
|
|
255
|
-
|
|
256
259
|
};
|
|
257
260
|
|
|
258
261
|
export type FormElementNodeProps = {
|
|
@@ -49,16 +49,7 @@ const FormElementField: React.FC<FormElementFieldProps> = (
|
|
|
49
49
|
{...props.muiTextFieldProps}
|
|
50
50
|
fullWidth
|
|
51
51
|
type={fieldType}
|
|
52
|
-
disabled={
|
|
53
|
-
props?.disabled || element.disabledFields.includes(fieldName)
|
|
54
|
-
? true
|
|
55
|
-
: false
|
|
56
|
-
}
|
|
57
|
-
// hidden={
|
|
58
|
-
// props?.hidden || element.hiddenFields.includes(fieldName)
|
|
59
|
-
// ? true
|
|
60
|
-
// : false
|
|
61
|
-
// }
|
|
52
|
+
disabled={element.disabledFields.includes(fieldName)}
|
|
62
53
|
label={getFieldLabel()}
|
|
63
54
|
value={formValues[fieldName]}
|
|
64
55
|
onChange={(event) => {
|
|
@@ -89,6 +80,9 @@ const FormElementField: React.FC<FormElementFieldProps> = (
|
|
|
89
80
|
height: "100% !important", // forces full height usage
|
|
90
81
|
},
|
|
91
82
|
...props?.formProps?.style,
|
|
83
|
+
display: element.hiddenFields.includes(fieldName)
|
|
84
|
+
? "none"
|
|
85
|
+
: undefined,
|
|
92
86
|
}}
|
|
93
87
|
error={formManager.formState.errors[fieldName] != undefined}
|
|
94
88
|
helperText={formManager?.formState?.errors[
|
|
@@ -99,16 +93,8 @@ const FormElementField: React.FC<FormElementFieldProps> = (
|
|
|
99
93
|
<Datefield
|
|
100
94
|
format={props?.dateFormat || DATE_FORMAT}
|
|
101
95
|
sx={props?.formProps?.style || { width: "100%" }}
|
|
102
|
-
disabled={
|
|
103
|
-
|
|
104
|
-
? true
|
|
105
|
-
: false
|
|
106
|
-
}
|
|
107
|
-
// hidden={
|
|
108
|
-
// props?.hidden || element.hiddenFields.includes(fieldName)
|
|
109
|
-
// ? true
|
|
110
|
-
// : false
|
|
111
|
-
// }
|
|
96
|
+
disabled={element.disabledFields.includes(fieldName)}
|
|
97
|
+
hidden={element.hiddenFields.includes(fieldName)}
|
|
112
98
|
label={getFieldLabel()}
|
|
113
99
|
onChangeCallBack={(v: any) => {
|
|
114
100
|
formManager.setValue(fieldName, v);
|
|
@@ -132,11 +118,8 @@ const FormElementField: React.FC<FormElementFieldProps> = (
|
|
|
132
118
|
<DatetimeField
|
|
133
119
|
format={props?.dateFormat || DATE_TIME_FORMAT}
|
|
134
120
|
sx={props?.formProps?.style || { width: "100%" }}
|
|
135
|
-
disabled={
|
|
136
|
-
|
|
137
|
-
? true
|
|
138
|
-
: false
|
|
139
|
-
}
|
|
121
|
+
disabled={element.disabledFields.includes(fieldName)}
|
|
122
|
+
hidden={element.hiddenFields.includes(fieldName)}
|
|
140
123
|
label={getFieldLabel()}
|
|
141
124
|
onChangeCallBack={(v: any) => {
|
|
142
125
|
formManager.setValue(fieldName, v);
|
|
@@ -150,11 +133,6 @@ const FormElementField: React.FC<FormElementFieldProps> = (
|
|
|
150
133
|
);
|
|
151
134
|
}
|
|
152
135
|
}}
|
|
153
|
-
// hidden={
|
|
154
|
-
// props?.hidden || element.hiddenFields.includes(fieldName)
|
|
155
|
-
// ? true
|
|
156
|
-
// : false
|
|
157
|
-
// }
|
|
158
136
|
value={formValues[fieldName]}
|
|
159
137
|
error={formManager.formState.errors[fieldName] != undefined}
|
|
160
138
|
errorMessage={formManager?.formState?.errors[
|
|
@@ -176,35 +154,23 @@ const FormElementField: React.FC<FormElementFieldProps> = (
|
|
|
176
154
|
);
|
|
177
155
|
}
|
|
178
156
|
}}
|
|
179
|
-
// hidden={
|
|
180
|
-
// props?.hidden || element.hiddenFields.includes(fieldName)
|
|
181
|
-
// ? true
|
|
182
|
-
// : false
|
|
183
|
-
// }
|
|
184
157
|
value={formValues[fieldName]}
|
|
185
158
|
checkedValue={props?.checkedValue || true}
|
|
186
159
|
unCheckedValue={props?.unCheckedValue || false}
|
|
187
|
-
disabled={
|
|
188
|
-
|
|
189
|
-
? true
|
|
190
|
-
: false
|
|
191
|
-
}
|
|
160
|
+
disabled={element.disabledFields.includes(fieldName)}
|
|
161
|
+
hidden={element.hiddenFields.includes(fieldName)}
|
|
192
162
|
sx={props?.formProps?.style}
|
|
193
163
|
/>
|
|
194
164
|
) : props?.fieldType === "combobox" ? (
|
|
195
165
|
<ComboBox
|
|
196
166
|
sx={props?.formProps?.style || { width: "100%" }}
|
|
197
167
|
label={getFieldLabel()}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// props?.hidden || element.hiddenFields.includes(fieldName)
|
|
205
|
-
// ? true
|
|
206
|
-
// : false
|
|
207
|
-
// }
|
|
168
|
+
commonStoreKey={props?.commonStoreKey}
|
|
169
|
+
dataQueryId={props?.dataQueryId}
|
|
170
|
+
storeUrl={props?.storeUrl}
|
|
171
|
+
storeLoadParam={props?.storeLoadParam}
|
|
172
|
+
disabled={element.disabledFields.includes(fieldName)}
|
|
173
|
+
hidden={element.hiddenFields.includes(fieldName)}
|
|
208
174
|
onChangeCallBack={(v: any, selectedRecord: any) => {
|
|
209
175
|
let newValue = null;
|
|
210
176
|
if (v) {
|
|
@@ -234,16 +200,8 @@ const FormElementField: React.FC<FormElementFieldProps> = (
|
|
|
234
200
|
<SystemLookupCombobox
|
|
235
201
|
sx={props?.formProps?.style || { width: "100%" }}
|
|
236
202
|
label={getFieldLabel()}
|
|
237
|
-
disabled={
|
|
238
|
-
|
|
239
|
-
? true
|
|
240
|
-
: false
|
|
241
|
-
}
|
|
242
|
-
// hidden={
|
|
243
|
-
// props?.hidden || element.hiddenFields.includes(fieldName)
|
|
244
|
-
// ? true
|
|
245
|
-
// : false
|
|
246
|
-
// }
|
|
203
|
+
disabled={element.disabledFields.includes(fieldName)}
|
|
204
|
+
hidden={element.hiddenFields.includes(fieldName)}
|
|
247
205
|
onChangeCallBack={(v: any, selectedRecord: any) => {
|
|
248
206
|
let newValue = null;
|
|
249
207
|
if (v) {
|
package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/ComboBox.tsx
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { useSelector } from "react-redux";
|
|
2
2
|
import { Autocomplete, Popper, TextField } from "@mui/material";
|
|
3
3
|
import { useTranslation } from "react-i18next";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
import { useAxios } from "../../../../../hooks";
|
|
4
6
|
|
|
5
7
|
interface ComboBoxProps {
|
|
6
8
|
value: any;
|
|
@@ -8,7 +10,13 @@ interface ComboBoxProps {
|
|
|
8
10
|
label: string;
|
|
9
11
|
disabled?: boolean;
|
|
10
12
|
required?: boolean;
|
|
11
|
-
|
|
13
|
+
|
|
14
|
+
commonStoreKey?: string;
|
|
15
|
+
dataQueryId?: number;
|
|
16
|
+
storeUrl?: string;
|
|
17
|
+
storeLoadParam?: any;
|
|
18
|
+
|
|
19
|
+
options?: Array<any>;
|
|
12
20
|
errorMessage?: any;
|
|
13
21
|
hidden?: boolean;
|
|
14
22
|
displayField: string;
|
|
@@ -18,6 +26,53 @@ interface ComboBoxProps {
|
|
|
18
26
|
|
|
19
27
|
const ComboBox: React.FC<ComboBoxProps> = (props) => {
|
|
20
28
|
const AppLayoutState = useSelector((state: any) => state.AppLayout);
|
|
29
|
+
const [comboboxData, setComboboxData] = useState<Array<any>>(
|
|
30
|
+
props?.options || []
|
|
31
|
+
);
|
|
32
|
+
const commonStoreData = useSelector(
|
|
33
|
+
(state: any) => state?.commonStores?.stores[props?.commonStoreKey]?.data
|
|
34
|
+
);
|
|
35
|
+
const { handleGetRequest } = useAxios();
|
|
36
|
+
const loadComboboxData = async () => {
|
|
37
|
+
if (props?.storeUrl) {
|
|
38
|
+
await handleGetRequest({
|
|
39
|
+
endPointURI: props.storeUrl,
|
|
40
|
+
showMask: false,
|
|
41
|
+
parameters: props?.storeLoadParam,
|
|
42
|
+
successCallBkFn: (response) => {
|
|
43
|
+
setComboboxData(response.data);
|
|
44
|
+
},
|
|
45
|
+
failureCallBkFn: () => {
|
|
46
|
+
setComboboxData([]);
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
} else if (props?.dataQueryId) {
|
|
50
|
+
await handleGetRequest({
|
|
51
|
+
endPointURI: "api/v1/dev/query/result",
|
|
52
|
+
showMask: false,
|
|
53
|
+
parameters: { queryId: props.dataQueryId, ...props?.storeLoadParam },
|
|
54
|
+
successCallBkFn: (response) => {
|
|
55
|
+
setComboboxData(response.data);
|
|
56
|
+
},
|
|
57
|
+
failureCallBkFn: () => {
|
|
58
|
+
setComboboxData([]);
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (props?.commonStoreKey) {
|
|
65
|
+
setComboboxData(commonStoreData);
|
|
66
|
+
} else {
|
|
67
|
+
loadComboboxData();
|
|
68
|
+
}
|
|
69
|
+
}, [
|
|
70
|
+
props?.storeUrl,
|
|
71
|
+
props?.storeLoadParam,
|
|
72
|
+
props?.dataQueryId,
|
|
73
|
+
props?.commonStoreKey,
|
|
74
|
+
]);
|
|
75
|
+
|
|
21
76
|
const { t } = useTranslation();
|
|
22
77
|
const getValue = (v: string) => {
|
|
23
78
|
for (let option of props.options) {
|
|
@@ -31,7 +86,7 @@ const ComboBox: React.FC<ComboBoxProps> = (props) => {
|
|
|
31
86
|
<Autocomplete
|
|
32
87
|
sx={props.sx}
|
|
33
88
|
value={getValue(props.value)}
|
|
34
|
-
options={
|
|
89
|
+
options={comboboxData}
|
|
35
90
|
disabled={props.disabled}
|
|
36
91
|
hidden={props?.hidden || false}
|
|
37
92
|
onChange={(event, newValue) => {
|
|
@@ -8,6 +8,7 @@ const TemplateTextField: React.FC<Omit<TextFieldProps, "outlined">> = (
|
|
|
8
8
|
return (
|
|
9
9
|
<TextField
|
|
10
10
|
{...props}
|
|
11
|
+
hidden={true}
|
|
11
12
|
slotProps={{ inputLabel: { shrink: true, sx: { fontWeight: "bold" } } }}
|
|
12
13
|
label={<>{props?.label ? t(props.label) : ""}</>}
|
|
13
14
|
helperText={props?.helperText ? t(props.helperText) : undefined}
|
|
@@ -37,24 +37,17 @@ const TemplateForm: React.FC<TemplateFormProps> = (
|
|
|
37
37
|
useWindow({
|
|
38
38
|
windowTitle: "Approvals",
|
|
39
39
|
windowIcon: "stamp",
|
|
40
|
-
width: "fit-content",
|
|
41
40
|
height: "fit-content",
|
|
42
41
|
minHeight: 500,
|
|
43
|
-
|
|
42
|
+
width: 800,
|
|
44
43
|
});
|
|
45
44
|
const [attachmentPanelEnabledForRecord, setAttachmentPanelEnabledForRecord] =
|
|
46
45
|
useState<boolean>(true);
|
|
47
46
|
const { t } = useTranslation();
|
|
48
47
|
const fields = getAllFields(props.elements);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
initiallyHiddenFields.push(field.fieldName);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
const [hiddenFields, setHiddenFields] = useState<string[]>(
|
|
56
|
-
initiallyHiddenFields
|
|
57
|
-
);
|
|
48
|
+
|
|
49
|
+
const [disabledFields, setDisabledFields] = useState<string[]>([]);
|
|
50
|
+
const [hiddenFields, setHiddenFields] = useState<string[]>([]);
|
|
58
51
|
const initialValues: any = {};
|
|
59
52
|
for (const element of props.elements) {
|
|
60
53
|
if (
|
|
@@ -65,7 +58,7 @@ const TemplateForm: React.FC<TemplateFormProps> = (
|
|
|
65
58
|
initialValues[element.props.fieldName] = element.props.defaultValue;
|
|
66
59
|
}
|
|
67
60
|
}
|
|
68
|
-
|
|
61
|
+
|
|
69
62
|
let formSchema = null;
|
|
70
63
|
if (props?.validationSchema) {
|
|
71
64
|
formSchema = props.validationSchema;
|
|
@@ -179,6 +172,20 @@ const TemplateForm: React.FC<TemplateFormProps> = (
|
|
|
179
172
|
},
|
|
180
173
|
};
|
|
181
174
|
|
|
175
|
+
useEffect(() => {
|
|
176
|
+
const initiallyHiddenFields = [];
|
|
177
|
+
const initiallyDisabledFields = [];
|
|
178
|
+
for (const field of fields) {
|
|
179
|
+
if (field?.hidden) {
|
|
180
|
+
initiallyHiddenFields.push(field.fieldName);
|
|
181
|
+
}
|
|
182
|
+
if (field?.disabled) {
|
|
183
|
+
initiallyDisabledFields.push(field.fieldName);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
setHiddenFields(initiallyHiddenFields);
|
|
187
|
+
setDisabledFields(initiallyDisabledFields);
|
|
188
|
+
}, [props.elements]);
|
|
182
189
|
useEffect(() => {
|
|
183
190
|
loadRecord();
|
|
184
191
|
}, [props?.recordIdToEdit]);
|
package/src/components/templates/DataEntryTemplates/TemplateDataGrid/DataGridColumnsUtil.tsx
CHANGED
|
@@ -114,9 +114,13 @@ export const generateComboColumn: (
|
|
|
114
114
|
<ComboBox
|
|
115
115
|
{...params}
|
|
116
116
|
sx={{ width: "100%" }}
|
|
117
|
-
options={params
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
options={params?.colDef?.options}
|
|
118
|
+
commonStoreKey={params?.colDef?.commonStoreKey}
|
|
119
|
+
dataQueryId={params?.colDef?.dataQueryId}
|
|
120
|
+
storeUrl={params?.colDef?.storeUrl}
|
|
121
|
+
storeLoadParam={params?.colDef?.storeLoadParam}
|
|
122
|
+
valueField={params?.colDef?.valueField}
|
|
123
|
+
displayField={params?.colDef?.displayField}
|
|
120
124
|
onChangeCallBack={(v: any, selectedRecord: any) => {
|
|
121
125
|
if (v === null) {
|
|
122
126
|
params.api.setEditCellValue({
|
|
@@ -101,11 +101,10 @@ const TemplateGrid: React.FC<TemplateGridProps> = (props) => {
|
|
|
101
101
|
const { Window: WorkFlowWindow, setWindowState: setWorkFlowWindowState } =
|
|
102
102
|
useWindow({
|
|
103
103
|
windowTitle: t(props.gridTitle) + " Approvals",
|
|
104
|
-
windowIcon: "stamp",
|
|
105
|
-
width: "fit-content",
|
|
104
|
+
windowIcon: "stamp",
|
|
106
105
|
height: "fit-content",
|
|
107
106
|
minHeight: 500,
|
|
108
|
-
|
|
107
|
+
width:800,
|
|
109
108
|
onCloseCallBack: () => {
|
|
110
109
|
props?.apiActions?.reloadData(props.gridLoadParametersValues);
|
|
111
110
|
},
|
|
@@ -929,7 +928,7 @@ const TemplateGrid: React.FC<TemplateGridProps> = (props) => {
|
|
|
929
928
|
<></>
|
|
930
929
|
)}
|
|
931
930
|
{props?.workFlowDocumentCode ? (
|
|
932
|
-
<WorkFlowWindow>
|
|
931
|
+
<WorkFlowWindow >
|
|
933
932
|
<WorkflowDocumentPanel
|
|
934
933
|
workFlowDocumentCode={props.workFlowDocumentCode}
|
|
935
934
|
refDocumentId={selectedRecord[props?.keyColumnName || "id"]}
|
|
@@ -25,6 +25,11 @@ export const ADMINISTRATION_STORES: CommonStores = {
|
|
|
25
25
|
url: "",
|
|
26
26
|
data: [{ value: "Excel" }, { value: "Jasper" }, { value: "Blueprint" }],
|
|
27
27
|
},
|
|
28
|
+
SystemWorkflows: {
|
|
29
|
+
autoLoad: true,
|
|
30
|
+
url: "api/v1/dev/workflowdocument/all",
|
|
31
|
+
data: [],
|
|
32
|
+
},
|
|
28
33
|
SystemWidgetTypes: {
|
|
29
34
|
autoLoad: false,
|
|
30
35
|
url: "",
|