@asaleh37/ui-base 25.10.19 → 25.10.22-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 +3 -0
- package/dist/index.js +91 -91
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -38
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/templates/DataEntryTemplates/DataEntryTypes.ts +2 -0
- package/src/components/templates/DataEntryTemplates/DataEntryUtil.ts +6 -2
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/ComboBox.tsx +8 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/DataGridColumnsUtil.tsx +26 -21
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid.tsx +46 -3
- package/src/main.tsx +2 -2
package/package.json
CHANGED
|
@@ -101,6 +101,7 @@ export type TemplateGridColDef = GridColDef & {
|
|
|
101
101
|
dataQueryId?: number;
|
|
102
102
|
storeUrl?: string;
|
|
103
103
|
storeLoadParam?: any;
|
|
104
|
+
comboboxGroupField?: string;
|
|
104
105
|
};
|
|
105
106
|
|
|
106
107
|
export type TemplateGridAttachmentProps = {
|
|
@@ -207,6 +208,7 @@ export type RecordFieldProps = {
|
|
|
207
208
|
| "custom";
|
|
208
209
|
lookupType?: string;
|
|
209
210
|
comboboxValueDataType?: "number" | "string";
|
|
211
|
+
comboboxGroupField?: string;
|
|
210
212
|
commonStoreKey?: string;
|
|
211
213
|
dataQueryId?: number;
|
|
212
214
|
storeUrl?: string;
|
|
@@ -132,6 +132,7 @@ export const constructGridColumnsFromFields: (
|
|
|
132
132
|
} else if (tableField?.fieldType === "combobox") {
|
|
133
133
|
const column: TemplateGridColDef = generateComboColumn({
|
|
134
134
|
...tableField?.gridProps?.muiProps,
|
|
135
|
+
comboboxGroupField: tableField?.comboboxGroupField,
|
|
135
136
|
editable:
|
|
136
137
|
tableField?.gridProps?.muiProps?.editable != undefined
|
|
137
138
|
? tableField?.gridProps?.muiProps?.editable
|
|
@@ -144,8 +145,11 @@ export const constructGridColumnsFromFields: (
|
|
|
144
145
|
searchable: tableField?.gridProps?.searchable,
|
|
145
146
|
valueField: tableField?.optionValueField || "value",
|
|
146
147
|
displayField: tableField?.optionDisplayField || "display",
|
|
147
|
-
options: tableField?.options
|
|
148
|
-
|
|
148
|
+
options: tableField?.options,
|
|
149
|
+
commonStoreKey: tableField?.commonStoreKey,
|
|
150
|
+
dataQueryId: tableField?.dataQueryId,
|
|
151
|
+
storeUrl: tableField?.storeUrl,
|
|
152
|
+
storeLoadParam: tableField?.storeLoadParam,
|
|
149
153
|
flex: tableField?.gridProps?.muiProps?.flex || 1,
|
|
150
154
|
minWidth: tableField?.gridProps?.muiProps?.width
|
|
151
155
|
? tableField?.gridProps?.muiProps?.width
|
package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/ComboBox.tsx
CHANGED
|
@@ -10,6 +10,7 @@ interface ComboBoxProps {
|
|
|
10
10
|
label: string;
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
required?: boolean;
|
|
13
|
+
groupField?: string;
|
|
13
14
|
|
|
14
15
|
commonStoreKey?: string;
|
|
15
16
|
dataQueryId?: number;
|
|
@@ -126,6 +127,13 @@ const ComboBox: React.FC<ComboBoxProps> = (props) => {
|
|
|
126
127
|
/>
|
|
127
128
|
),
|
|
128
129
|
}}
|
|
130
|
+
groupBy={
|
|
131
|
+
props?.groupField
|
|
132
|
+
? (option: any) => {
|
|
133
|
+
return option[props.groupField] ? option[props.groupField] : "";
|
|
134
|
+
}
|
|
135
|
+
: undefined
|
|
136
|
+
}
|
|
129
137
|
renderInput={(params) => {
|
|
130
138
|
return (
|
|
131
139
|
<TextField
|
package/src/components/templates/DataEntryTemplates/TemplateDataGrid/DataGridColumnsUtil.tsx
CHANGED
|
@@ -77,13 +77,14 @@ export const generateDateTimeColumn: any = (colDef: TemplateGridColDef) => {
|
|
|
77
77
|
|
|
78
78
|
type ComboBoxColumnProps = TemplateGridColDef & {
|
|
79
79
|
lookupType?: string;
|
|
80
|
-
options
|
|
80
|
+
options?: Array<any>;
|
|
81
81
|
displayField: string;
|
|
82
82
|
valueField: string;
|
|
83
83
|
};
|
|
84
84
|
export const generateComboColumn: (
|
|
85
85
|
props: ComboBoxColumnProps
|
|
86
86
|
) => TemplateGridColDef = (colDef: ComboBoxColumnProps) => {
|
|
87
|
+
debugger;
|
|
87
88
|
const column: TemplateGridColDef = {
|
|
88
89
|
...colDef,
|
|
89
90
|
type: "custom",
|
|
@@ -93,34 +94,38 @@ export const generateComboColumn: (
|
|
|
93
94
|
}
|
|
94
95
|
return value;
|
|
95
96
|
},
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
97
|
+
renderCell: (parameters: any) => {
|
|
98
|
+
let record = null;
|
|
99
|
+
try {
|
|
100
|
+
record = parameters.colDef.options.find(
|
|
101
|
+
(item: any) => item[parameters.colDef.valueField] == parameters.value
|
|
102
|
+
);
|
|
103
|
+
} catch (e) {}
|
|
104
|
+
return (
|
|
105
|
+
<div>
|
|
106
|
+
{record != null
|
|
107
|
+
? record[parameters.colDef.displayField]
|
|
108
|
+
: parameters.value}
|
|
109
|
+
</div>
|
|
110
|
+
);
|
|
111
|
+
},
|
|
112
|
+
commonStoreKey: colDef?.commonStoreKey,
|
|
113
|
+
dataQueryId: colDef?.dataQueryId,
|
|
114
|
+
storeUrl: colDef?.storeUrl,
|
|
115
|
+
storeLoadParam: colDef?.storeLoadParam,
|
|
112
116
|
renderEditCell: (params: any) => {
|
|
113
117
|
return (
|
|
114
118
|
<ComboBox
|
|
115
119
|
{...params}
|
|
116
120
|
sx={{ width: "100%" }}
|
|
117
121
|
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
|
+
// commonStoreKey={params?.colDef?.commonStoreKey}
|
|
123
|
+
// dataQueryId={params?.colDef?.dataQueryId}
|
|
124
|
+
// storeUrl={params?.colDef?.storeUrl}
|
|
125
|
+
// storeLoadParam={params?.colDef?.storeLoadParam}
|
|
122
126
|
valueField={params?.colDef?.valueField}
|
|
123
127
|
displayField={params?.colDef?.displayField}
|
|
128
|
+
groupField={params?.colDef?.comboboxGroupField}
|
|
124
129
|
onChangeCallBack={(v: any, selectedRecord: any) => {
|
|
125
130
|
if (v === null) {
|
|
126
131
|
params.api.setEditCellValue({
|
|
@@ -81,6 +81,8 @@ const PIN_FIXED_COLUMNS = ["__check__", "actions"];
|
|
|
81
81
|
|
|
82
82
|
const TemplateGrid: React.FC<TemplateGridProps> = (props) => {
|
|
83
83
|
const { t } = useTranslation();
|
|
84
|
+
const { handleGetRequest } = useAxios();
|
|
85
|
+
const stores = useSelector((state: any) => state.commonStores.stores);
|
|
84
86
|
const AppLayout = useSelector((state: any) => state.AppLayout);
|
|
85
87
|
const [selectedRecord, setSelectedRecord] = useState<any>({});
|
|
86
88
|
const [attachmentPanelEnabledForRecord, setAttachmentPanelEnabledForRecord] =
|
|
@@ -101,11 +103,11 @@ const TemplateGrid: React.FC<TemplateGridProps> = (props) => {
|
|
|
101
103
|
const { Window: WorkFlowWindow, setWindowState: setWorkFlowWindowState } =
|
|
102
104
|
useWindow({
|
|
103
105
|
windowTitle: t(props.gridTitle) + " Approvals",
|
|
104
|
-
windowIcon: "stamp",
|
|
106
|
+
windowIcon: "stamp",
|
|
105
107
|
height: "fit-content",
|
|
106
108
|
minHeight: 500,
|
|
107
109
|
width: "fit-content",
|
|
108
|
-
// width:1100,
|
|
110
|
+
// width:1100,
|
|
109
111
|
onCloseCallBack: () => {
|
|
110
112
|
props?.apiActions?.reloadData(props.gridLoadParametersValues);
|
|
111
113
|
},
|
|
@@ -188,6 +190,33 @@ const TemplateGrid: React.FC<TemplateGridProps> = (props) => {
|
|
|
188
190
|
const [recordToDelete, setRecordToDelete] = useState<any>(null);
|
|
189
191
|
const [recordToEdit, setRecordToEdit] = useState<any>(null);
|
|
190
192
|
const [rowModesModel, setRowModesModel] = useState<GridRowModesModel>({});
|
|
193
|
+
const loadComboboxData: (
|
|
194
|
+
storeUrl: any,
|
|
195
|
+
storeLoadParam: any,
|
|
196
|
+
dataQueryId: any
|
|
197
|
+
) => Promise<Array<any>> = async (storeUrl, storeLoadParam, dataQueryId) => {
|
|
198
|
+
let comboboxData: Array<any> = [];
|
|
199
|
+
if (storeUrl) {
|
|
200
|
+
await handleGetRequest({
|
|
201
|
+
endPointURI: storeUrl,
|
|
202
|
+
showMask: false,
|
|
203
|
+
parameters: storeLoadParam,
|
|
204
|
+
successCallBkFn: (response) => {
|
|
205
|
+
comboboxData = response.data;
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
} else if (dataQueryId) {
|
|
209
|
+
await handleGetRequest({
|
|
210
|
+
endPointURI: "api/v1/dev/query/result",
|
|
211
|
+
showMask: false,
|
|
212
|
+
parameters: { queryId: dataQueryId, ...storeLoadParam },
|
|
213
|
+
successCallBkFn: (response) => {
|
|
214
|
+
comboboxData = response.data;
|
|
215
|
+
},
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
return comboboxData;
|
|
219
|
+
};
|
|
191
220
|
const adjustGridColumns = async () => {
|
|
192
221
|
let gridColumns = constructGridColumnsFromFields(
|
|
193
222
|
fields,
|
|
@@ -203,6 +232,20 @@ const TemplateGrid: React.FC<TemplateGridProps> = (props) => {
|
|
|
203
232
|
gridColumn.options = await getLookupOptions(gridColumn.lookupType);
|
|
204
233
|
gridColumn.valueField = "lookupValue";
|
|
205
234
|
}
|
|
235
|
+
if (gridColumn.type === "custom") {
|
|
236
|
+
debugger;
|
|
237
|
+
if (gridColumn?.options) {
|
|
238
|
+
continue;
|
|
239
|
+
} else if (gridColumn?.commonStoreKey) {
|
|
240
|
+
gridColumn.options = stores[gridColumn.commonStoreKey]?.data || [];
|
|
241
|
+
} else {
|
|
242
|
+
gridColumn.options = await loadComboboxData(
|
|
243
|
+
gridColumn?.storeUrl,
|
|
244
|
+
gridColumn?.storeLoadParam,
|
|
245
|
+
gridColumn?.dataQueryId
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
206
249
|
}
|
|
207
250
|
setGeneratedColumns(gridColumns);
|
|
208
251
|
};
|
|
@@ -929,7 +972,7 @@ const TemplateGrid: React.FC<TemplateGridProps> = (props) => {
|
|
|
929
972
|
<></>
|
|
930
973
|
)}
|
|
931
974
|
{props?.workFlowDocumentCode ? (
|
|
932
|
-
<WorkFlowWindow
|
|
975
|
+
<WorkFlowWindow>
|
|
933
976
|
<WorkflowDocumentPanel
|
|
934
977
|
workFlowDocumentCode={props.workFlowDocumentCode}
|
|
935
978
|
refDocumentId={selectedRecord[props?.keyColumnName || "id"]}
|
package/src/main.tsx
CHANGED
|
@@ -11,8 +11,8 @@ createRoot(document.getElementById("root")!).render(
|
|
|
11
11
|
themeMode: "dark",
|
|
12
12
|
backgroundImageNameInPublicFolder: "bg.jpg",
|
|
13
13
|
}}
|
|
14
|
-
appVersion="25.10.
|
|
15
|
-
authenticationMethod="
|
|
14
|
+
appVersion="25.10.22"
|
|
15
|
+
authenticationMethod="APP"
|
|
16
16
|
azureConfiguration={{
|
|
17
17
|
frontEndClientId: "c3bbbdbd-f392-4459-b3dd-2351cb07f924",
|
|
18
18
|
tenantId: "9f136fef-4529-475f-98e6-d271eb04eb00",
|