@asaleh37/ui-base 26.2.2 → 26.2.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asaleh37/ui-base",
3
- "version": "26.2.2",
3
+ "version": "26.2.16",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "Ahmed Saleh Mohamed",
@@ -12,7 +12,7 @@ import { DATE_FORMAT, DATE_TIME_FORMAT } from "../../../util";
12
12
  const EntityParameterGrid: React.FC = () => {
13
13
  const { t } = useTranslation();
14
14
  const SystemParameterTypes = useSelector(
15
- (state: any) => state.commonStores.stores.SystemParameterTypes.data
15
+ (state: any) => state.commonStores.stores.SystemParameterTypes.data,
16
16
  );
17
17
  const [data, setData] = useState([]);
18
18
  const apiActions = useApiActions({
@@ -24,7 +24,7 @@ const EntityParameterGrid: React.FC = () => {
24
24
  });
25
25
 
26
26
  const SystemDataQueries = useSelector(
27
- (state: any) => state.commonStores.stores.SystemDataQueries.data
27
+ (state: any) => state.commonStores.stores.SystemDataQueries.data,
28
28
  );
29
29
  const adjustFormAccordingFormValues: FormValueChangeCallBk = (
30
30
  formValues: any,
@@ -32,7 +32,7 @@ const EntityParameterGrid: React.FC = () => {
32
32
  formManager,
33
33
  fieldName,
34
34
  newValue,
35
- selectedRecord
35
+ selectedRecord,
36
36
  ) => {
37
37
  if (fieldName) {
38
38
  if (fieldName === "parameterType") {
@@ -41,6 +41,7 @@ const EntityParameterGrid: React.FC = () => {
41
41
  formActions.showField("parameterDataQueryId");
42
42
  formActions.showField("parameterDataset");
43
43
  formActions.showField("parameterDisplayField");
44
+ formActions.showField("comboboxValueDataType");
44
45
  formActions.showField("parameterValueField");
45
46
  formActions.hideField("parameterValueFormat");
46
47
  } else {
@@ -48,6 +49,7 @@ const EntityParameterGrid: React.FC = () => {
48
49
  formActions.hideField("parameterDataset");
49
50
  formActions.hideField("parameterDisplayField");
50
51
  formActions.hideField("parameterValueField");
52
+ formActions.hideField("comboboxValueDataType");
51
53
  }
52
54
  if (newValue === "date" || newValue === "datetime") {
53
55
  formActions.showField("parameterValueFormat");
@@ -75,14 +77,14 @@ const EntityParameterGrid: React.FC = () => {
75
77
  formActions.showField("parameterDataQueryId");
76
78
  }
77
79
  }
78
- } else {
80
+ } else {
79
81
  if (formValues?.parameterType === "combobox") {
80
82
  formManager.setValue("parameterValueFormat", null);
81
83
  formActions.showField("parameterDataQueryId");
82
84
  formActions.showField("parameterDataset");
83
85
  formActions.showField("parameterDisplayField");
84
86
  formActions.showField("parameterValueField");
85
- formActions.hideField("parameterValueFormat");
87
+ formActions.hideField("parameterValueFormat");
86
88
  } else if (formValues?.parameterType === "date") {
87
89
  formActions.hideField("parameterDataQueryId");
88
90
  formActions.hideField("parameterDataset");
@@ -257,6 +259,19 @@ const EntityParameterGrid: React.FC = () => {
257
259
  fieldType: "text",
258
260
  },
259
261
  },
262
+ {
263
+ type: "field",
264
+ mode: "props",
265
+ props: {
266
+ fieldLabel: "Value Type",
267
+ fieldName: "comboboxValueDataType",
268
+ fieldType: "combobox",
269
+ options: [{ value: "string" }, { value: "number" }],
270
+ comboboxValueDataType: "string",
271
+ optionDisplayField: "value",
272
+ optionValueField: "value",
273
+ },
274
+ },
260
275
  {
261
276
  type: "field",
262
277
  mode: "props",
@@ -12,7 +12,10 @@ type MailAttachmentGridProps = {
12
12
 
13
13
  const MailAttachmentGrid: React.FC<MailAttachmentGridProps> = (props) => {
14
14
  const SystemReports = useSelector(
15
- (state: any) => state.commonStores.stores.SystemReports.data
15
+ (state: any) => state.commonStores.stores.SystemReports.data,
16
+ );
17
+ const SystemDataQueries = useSelector(
18
+ (state: any) => state.commonStores.stores.SystemDataQueries.data,
16
19
  );
17
20
  const { t } = useTranslation();
18
21
  const [data, setData] = useState([]);
@@ -99,10 +102,24 @@ const MailAttachmentGrid: React.FC<MailAttachmentGridProps> = (props) => {
99
102
  optionDisplayField: "reportName",
100
103
  fieldLabel: "REPORT_REPORT_NAME",
101
104
  fieldName: "reportId",
102
- required: true,
105
+ required: false,
103
106
  fieldType: "combobox",
104
107
  },
105
108
  },
109
+ {
110
+ type: "field",
111
+ mode: "props",
112
+ props: {
113
+ fieldLabel:
114
+ "Attachment Query (List of Attachments Records) from XXCCAD.ATTACHMENT Table ",
115
+ fieldName: "attachmentQueryId",
116
+ required: false,
117
+ fieldType: "combobox",
118
+ options: SystemDataQueries,
119
+ optionDisplayField: "queryName",
120
+ optionValueField: "id",
121
+ },
122
+ },
106
123
  {
107
124
  type: "field",
108
125
  mode: "props",
@@ -33,7 +33,7 @@ const MailTemplateGrid: React.FC = () => {
33
33
  } = useWindow({
34
34
  windowTitle: "Mail Attachment",
35
35
  windowIcon: "paperclip",
36
- width: 500,
36
+ // width: 500,
37
37
  });
38
38
  const { t } = useTranslation();
39
39
  const [data, setData] = useState([]);
@@ -48,7 +48,7 @@ const StyledToolbarButton = styled(ToolbarButton)<{ ownerState: OwnerState }>(
48
48
  opacity: ownerState.expanded ? 0 : 1,
49
49
  pointerEvents: ownerState.expanded ? "none" : "auto",
50
50
  transition: theme.transitions.create(["opacity"]),
51
- })
51
+ }),
52
52
  );
53
53
 
54
54
  const StyledTextField = styled(TextField)<{
@@ -62,7 +62,7 @@ const StyledTextField = styled(TextField)<{
62
62
  }));
63
63
 
64
64
  const TemplateGridTopBar: React.FC<TemplateGridTopBarProps> = (
65
- props: TemplateGridTopBarProps
65
+ props: TemplateGridTopBarProps,
66
66
  ) => {
67
67
  const { t } = useTranslation();
68
68
  const session = useSession();
@@ -76,158 +76,175 @@ const TemplateGridTopBar: React.FC<TemplateGridTopBarProps> = (
76
76
  type: "include",
77
77
  },
78
78
  props?.templateProps?.data || [],
79
- props?.templateProps?.keyColumnName || "id"
79
+ props?.templateProps?.keyColumnName || "id",
80
80
  );
81
81
  return (
82
- <Toolbar>
83
- {isCreationEnabled &&
84
- isCreationAuthorized &&
85
- props?.templateProps?.editMode?.editMode != "none" ? (
86
- props?.templateProps?.hideCreateBtn === undefined ||
87
- props?.templateProps?.hideCreateBtn === false ? (
88
- <Button onClick={props?.handleCreateNewRecord}>
89
- <FontAwesomeIcon
90
- icon="add"
91
- style={{ marginRight: 5, marginLeft: 5 }}
92
- />
93
- {t("ADD_BTN_LABEL")}
94
- </Button>
82
+ <>
83
+ <Toolbar>
84
+ {isCreationEnabled &&
85
+ isCreationAuthorized &&
86
+ props?.templateProps?.editMode?.editMode != "none" ? (
87
+ props?.templateProps?.hideCreateBtn === undefined ||
88
+ props?.templateProps?.hideCreateBtn === false ? (
89
+ <Button onClick={props?.handleCreateNewRecord}>
90
+ <FontAwesomeIcon
91
+ icon="add"
92
+ style={{ marginRight: 5, marginLeft: 5 }}
93
+ />
94
+ {t("ADD_BTN_LABEL")}
95
+ </Button>
96
+ ) : (
97
+ <></>
98
+ )
95
99
  ) : (
96
100
  <></>
97
- )
98
- ) : (
99
- <></>
100
- )}
101
- {props?.templateProps?.rowActions ? (
102
- props.templateProps.rowActions.map((rowAction, index) =>
103
- rowAction?.gridActionProps?.multiRecord === true ? (
104
- <TemplateGridMultiRecordAction
105
- {...rowAction}
106
- key={index}
107
- reloadData={async () => {
108
- props.templateProps.apiActions.reloadData(
109
- props?.templateProps?.gridLoadParametersValues
110
- );
111
- }}
112
- recordIdsToProcessActionOn={gridSelection.selectedRecordIds}
113
- recordsToProcessActionOn={gridSelection.selectedRecords}
114
- />
115
- ) : null
116
- )
117
- ) : (
118
- <></>
119
- )}
120
- <Box sx={{ flex: 1, mx: 0.5, my: 0.5, padding: 1 }}>
121
- {props?.templateProps?.tBar}
122
- </Box>
123
-
124
- <Tooltip title="Columns">
125
- <ColumnsPanelTrigger render={<ToolbarButton />}>
126
- <GridViewColumnIcon fontSize="small" />
127
- </ColumnsPanelTrigger>
128
- </Tooltip>
101
+ )}
102
+ {props?.templateProps?.rowActions ? (
103
+ props.templateProps.rowActions.map((rowAction, index) =>
104
+ rowAction?.gridActionProps?.multiRecord === true ? (
105
+ <TemplateGridMultiRecordAction
106
+ {...rowAction}
107
+ key={index}
108
+ reloadData={async () => {
109
+ props.templateProps.apiActions.reloadData(
110
+ props?.templateProps?.gridLoadParametersValues,
111
+ );
112
+ }}
113
+ recordIdsToProcessActionOn={gridSelection.selectedRecordIds}
114
+ recordsToProcessActionOn={gridSelection.selectedRecords}
115
+ />
116
+ ) : null,
117
+ )
118
+ ) : (
119
+ <></>
120
+ )}
121
+ <Box
122
+ sx={{
123
+ flex: 1,
124
+ }}
125
+ ></Box>
129
126
 
130
- <Tooltip title="Filters">
131
- <FilterPanelTrigger
132
- render={(props, state) => (
133
- <ToolbarButton {...props} color="default">
134
- <Badge
135
- badgeContent={state.filterCount}
136
- color="primary"
137
- variant="dot"
138
- >
139
- <GridFilterListIcon fontSize="small" />
140
- </Badge>
141
- </ToolbarButton>
142
- )}
143
- />
144
- </Tooltip>
127
+ <Tooltip title="Columns">
128
+ <ColumnsPanelTrigger render={<ToolbarButton />}>
129
+ <GridViewColumnIcon fontSize="small" />
130
+ </ColumnsPanelTrigger>
131
+ </Tooltip>
145
132
 
146
- {props?.templateProps?.gridStateKey ? (
147
- <Tooltip title={t("RESET_GRID_STATE")}>
148
- <IconButton onClick={props?.clearGridState}>
149
- <FontAwesomeIcon icon="eraser" />
150
- </IconButton>
133
+ <Tooltip title="Filters">
134
+ <FilterPanelTrigger
135
+ render={(props, state) => (
136
+ <ToolbarButton {...props} color="default">
137
+ <Badge
138
+ badgeContent={state.filterCount}
139
+ color="primary"
140
+ variant="dot"
141
+ >
142
+ <GridFilterListIcon fontSize="small" />
143
+ </Badge>
144
+ </ToolbarButton>
145
+ )}
146
+ />
151
147
  </Tooltip>
152
- ) : (
153
- <></>
154
- )}
155
148
 
156
- <Divider
157
- orientation="vertical"
158
- variant="middle"
159
- flexItem
160
- sx={{ mx: 0.5 }}
161
- />
149
+ {props?.templateProps?.gridStateKey ? (
150
+ <Tooltip title={t("RESET_GRID_STATE")}>
151
+ <IconButton onClick={props?.clearGridState}>
152
+ <FontAwesomeIcon icon="eraser" />
153
+ </IconButton>
154
+ </Tooltip>
155
+ ) : (
156
+ <></>
157
+ )}
158
+
159
+ <Divider
160
+ orientation="vertical"
161
+ variant="middle"
162
+ flexItem
163
+ sx={{ mx: 0.5 }}
164
+ />
162
165
 
163
- <Tooltip title={t("EXPORT_EXECL_LABEL")}>
164
- <ExportExcel render={<MenuItem />}>
165
- <FontAwesomeIcon icon="file-excel" color="green" />
166
- </ExportExcel>
167
- </Tooltip>
166
+ <Tooltip title={t("EXPORT_EXECL_LABEL")}>
167
+ <ExportExcel render={<MenuItem />}>
168
+ <FontAwesomeIcon icon="file-excel" color="green" />
169
+ </ExportExcel>
170
+ </Tooltip>
168
171
 
169
- <StyledQuickFilter>
170
- <QuickFilterTrigger
171
- render={(triggerProps, state) => (
172
- <Tooltip title={t("SEARCH_BTN_LABEL")} enterDelay={0}>
173
- <StyledToolbarButton
174
- {...triggerProps}
172
+ <StyledQuickFilter>
173
+ <QuickFilterTrigger
174
+ render={(triggerProps, state) => (
175
+ <Tooltip title={t("SEARCH_BTN_LABEL")} enterDelay={0}>
176
+ <StyledToolbarButton
177
+ {...triggerProps}
178
+ ownerState={{ expanded: state.expanded }}
179
+ color="default"
180
+ aria-disabled={state.expanded}
181
+ >
182
+ <FontAwesomeIcon icon="search" />
183
+ </StyledToolbarButton>
184
+ </Tooltip>
185
+ )}
186
+ />
187
+ <QuickFilterControl
188
+ render={({ ref, ...controlProps }, state) => (
189
+ <StyledTextField
190
+ {...controlProps}
175
191
  ownerState={{ expanded: state.expanded }}
176
- color="default"
177
- aria-disabled={state.expanded}
178
- >
179
- <FontAwesomeIcon icon="search" />
180
- </StyledToolbarButton>
181
- </Tooltip>
182
- )}
183
- />
184
- <QuickFilterControl
185
- render={({ ref, ...controlProps }, state) => (
186
- <StyledTextField
187
- {...controlProps}
188
- ownerState={{ expanded: state.expanded }}
189
- inputRef={ref}
190
- aria-label="Search"
191
- placeholder={`${t("SEARCH_BTN_LABEL")}...`}
192
- size="small"
193
- slotProps={{
194
- input: {
195
- startAdornment: (
196
- <InputAdornment position="start">
197
- <FontAwesomeIcon icon="search" />
198
- </InputAdornment>
199
- ),
200
- endAdornment: state.value ? (
201
- <InputAdornment position="end">
202
- <QuickFilterClear
203
- edge="end"
204
- size="small"
205
- aria-label="Clear search"
206
- // material={{ sx: { marginRight: -0.75 } }}
207
- >
208
- <FontAwesomeIcon icon="xmark" />
209
- </QuickFilterClear>
210
- </InputAdornment>
211
- ) : null,
212
- ...controlProps.slotProps?.input,
213
- },
214
- ...controlProps.slotProps,
215
- }}
216
- />
217
- )}
218
- />
219
- </StyledQuickFilter>
192
+ inputRef={ref}
193
+ aria-label="Search"
194
+ placeholder={`${t("SEARCH_BTN_LABEL")}...`}
195
+ size="small"
196
+ slotProps={{
197
+ input: {
198
+ startAdornment: (
199
+ <InputAdornment position="start">
200
+ <FontAwesomeIcon icon="search" />
201
+ </InputAdornment>
202
+ ),
203
+ endAdornment: state.value ? (
204
+ <InputAdornment position="end">
205
+ <QuickFilterClear
206
+ edge="end"
207
+ size="small"
208
+ aria-label="Clear search"
209
+ // material={{ sx: { marginRight: -0.75 } }}
210
+ >
211
+ <FontAwesomeIcon icon="xmark" />
212
+ </QuickFilterClear>
213
+ </InputAdornment>
214
+ ) : null,
215
+ ...controlProps.slotProps?.input,
216
+ },
217
+ ...controlProps.slotProps,
218
+ }}
219
+ />
220
+ )}
221
+ />
222
+ </StyledQuickFilter>
223
+
224
+ <IconButton
225
+ onClick={() => {
226
+ props.templateProps.apiActions.reloadData(
227
+ props?.templateProps?.gridLoadParametersValues,
228
+ );
229
+ }}
230
+ >
231
+ <FontAwesomeIcon icon="refresh" />
232
+ </IconButton>
233
+ </Toolbar>
220
234
 
221
- <IconButton
222
- onClick={() => {
223
- props.templateProps.apiActions.reloadData(
224
- props?.templateProps?.gridLoadParametersValues
225
- );
226
- }}
227
- >
228
- <FontAwesomeIcon icon="refresh" />
229
- </IconButton>
230
- </Toolbar>
235
+ {props?.templateProps?.tBar ? (
236
+ <Box
237
+ sx={{
238
+ display: "flex",
239
+ padding: 2,
240
+ }}
241
+ >
242
+ {props?.templateProps?.tBar}
243
+ </Box>
244
+ ) : (
245
+ <></>
246
+ )}
247
+ </>
231
248
  );
232
249
  };
233
250
 
@@ -27,7 +27,7 @@ const ReportViewer: React.FC<ReportViewerProps> = (props) => {
27
27
  const [errorMessage, setErrorMessage] = useState(null);
28
28
  const [excelReportData, setExcelReportData] = useState<Array<any>>([]);
29
29
  const [reportViewerState, setReportViewerState] = useState<ReportViewerState>(
30
- "WAITING_REPORT_CODE"
30
+ "WAITING_REPORT_CODE",
31
31
  );
32
32
  const { handleGetRequest, handlePostRequest, HandleDownloadHTTPPostPDF } =
33
33
  useAxios();
@@ -52,7 +52,7 @@ const ReportViewer: React.FC<ReportViewerProps> = (props) => {
52
52
  },
53
53
  failureCallBkFn: (response) => {
54
54
  setErrorMessage(
55
- "Failed loading report metadata ... contact your administrator"
55
+ "Failed loading report metadata ... contact your administrator",
56
56
  );
57
57
  setReportViewerState("ERROR");
58
58
  },
@@ -136,7 +136,7 @@ const ReportViewer: React.FC<ReportViewerProps> = (props) => {
136
136
  },
137
137
  failureCallBkFn: (response) => {
138
138
  setErrorMessage(
139
- "Failed To run report ... contact your administrator"
139
+ "Failed To run report ... contact your administrator",
140
140
  );
141
141
  setReportViewerState("ERROR");
142
142
  },
@@ -160,9 +160,9 @@ const ReportViewer: React.FC<ReportViewerProps> = (props) => {
160
160
  <>
161
161
  <Box
162
162
  sx={{
163
- display: "flex",
164
- alignItems: "center",
165
- justifyContent: "center",
163
+ // display: "flex",
164
+ // alignItems: "center",
165
+ // justifyContent: "center",
166
166
  width: "100%",
167
167
  }}
168
168
  >
@@ -208,63 +208,52 @@ const ReportViewer: React.FC<ReportViewerProps> = (props) => {
208
208
  <></>
209
209
  )}
210
210
  </Box>
211
- <Box
212
- sx={{
213
- flexGrow: 1,
214
- width: "100%",
215
- display: "flex",
216
- flexDirection: "column",
217
- alignItems: "center",
218
- justifyContent: "flex-start",
219
- }}
220
- >
221
- {reportViewerState === "WAITING_PARAMETER_INPUT" &&
222
- reportInfo?.reportType != "Excel" ? (
223
- <ParameterPanel searchBtnClickCallBk={runReport} />
224
- ) : reportViewerState === "SHOWING_RESULT" ||
225
- ((reportViewerState === "WAITING_PARAMETER_INPUT" ||
226
- reportViewerState === "WAITING_RESULT") &&
227
- reportInfo?.reportType === "Excel") ? (
228
- reportInfo?.reportType === "Excel" ? (
229
- <ExcelReportViewer
230
- reportData={excelReportData}
231
- setReportData={setExcelReportData}
232
- reloadReport={async () => {
233
- runReport(parametersValues);
234
- }}
235
- gridLoadParameters={panelElements}
236
- gridLoadParametersValues={parametersValues}
237
- setGridLoadParametersValues={setParametersValues}
238
- />
239
- ) : (
240
- <iframe
241
- src={blobUrl}
242
- width="100%"
243
- height="100%"
244
- title="PDF Preview"
245
- style={{ border: "1px solid #ccc", marginTop: "20px" }}
246
- ></iframe>
247
- )
248
- ) : reportViewerState === "ERROR" ? (
249
- <Box
250
- sx={{
251
- display: "flex",
252
- flex: 1,
253
- alignItems: "center",
254
- justifyContent: "center",
211
+ {reportViewerState === "WAITING_PARAMETER_INPUT" &&
212
+ reportInfo?.reportType != "Excel" ? (
213
+ <ParameterPanel searchBtnClickCallBk={runReport} />
214
+ ) : reportViewerState === "SHOWING_RESULT" ||
215
+ ((reportViewerState === "WAITING_PARAMETER_INPUT" ||
216
+ reportViewerState === "WAITING_RESULT") &&
217
+ reportInfo?.reportType === "Excel") ? (
218
+ reportInfo?.reportType === "Excel" ? (
219
+ <ExcelReportViewer
220
+ reportData={excelReportData}
221
+ setReportData={setExcelReportData}
222
+ reloadReport={async () => {
223
+ runReport(parametersValues);
255
224
  }}
256
- >
257
- <FontAwesomeIcon
258
- icon="circle-exclamation"
259
- color="darkred"
260
- style={{ marginRight: 10, marginLeft: 10 }}
261
- />
262
- {errorMessage}
263
- </Box>
225
+ gridLoadParameters={panelElements}
226
+ gridLoadParametersValues={parametersValues}
227
+ setGridLoadParametersValues={setParametersValues}
228
+ />
264
229
  ) : (
265
- <></>
266
- )}
267
- </Box>
230
+ <iframe
231
+ src={blobUrl}
232
+ width="100%"
233
+ height="100%"
234
+ title="PDF Preview"
235
+ style={{ border: "1px solid #ccc", marginTop: "20px" }}
236
+ ></iframe>
237
+ )
238
+ ) : reportViewerState === "ERROR" ? (
239
+ <Box
240
+ sx={{
241
+ display: "flex",
242
+ flex: 1,
243
+ alignItems: "center",
244
+ justifyContent: "center",
245
+ }}
246
+ >
247
+ <FontAwesomeIcon
248
+ icon="circle-exclamation"
249
+ color="darkred"
250
+ style={{ marginRight: 10, marginLeft: 10 }}
251
+ />
252
+ {errorMessage}
253
+ </Box>
254
+ ) : (
255
+ <></>
256
+ )}
268
257
  </>
269
258
  );
270
259
  };
@@ -39,7 +39,7 @@ export const getFormElementsFromParameters = (
39
39
  ) => {
40
40
  const formElements: Array<FormElementProps> = [];
41
41
  for (const parameter of parameters) {
42
- debugger;
42
+
43
43
  const formElement: FormElementProps = {
44
44
  type: "field",
45
45
  mode: "props",
package/src/main.tsx CHANGED
@@ -14,7 +14,7 @@ createRoot(document.getElementById("root")!).render(
14
14
  }}
15
15
  appThemeMode="dark"
16
16
  allowThemeChange={true}
17
- appVersion="25.12.12"
17
+ appVersion="25.12.16"
18
18
  authenticationMethod="APP"
19
19
  azureConfiguration={{
20
20
  frontEndClientId: "c3bbbdbd-f392-4459-b3dd-2351cb07f924",