@asaleh37/ui-base 25.9.6 → 25.9.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": "25.9.6",
3
+ "version": "25.9.16",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "Ahmed Saleh Mohamed",
@@ -123,7 +123,7 @@ const AttachmentConfigGrid: React.FC = () => {
123
123
  props: {
124
124
  fieldLabel: "Include App Code in attachment path",
125
125
  fieldName: "includeAppCodeInPath",
126
- required: false,
126
+ required: true,
127
127
  fieldType: "checkbox",
128
128
  },
129
129
  },
@@ -127,6 +127,7 @@ export type TemplateGridProps = {
127
127
  enableExport?: boolean;
128
128
  enableDensitySelector?: boolean;
129
129
  hideInfoBar?: boolean;
130
+ hideCreateBtn?: boolean;
130
131
  hideBackButton?: boolean;
131
132
  apiActions: ApiActions;
132
133
  rowSelectionModel?: GridRowSelectionModel;
@@ -58,6 +58,8 @@ const ComboBox: React.FC<ComboBoxProps> = (props) => {
58
58
  setComboboxData([]);
59
59
  },
60
60
  });
61
+ } else if (props?.options) {
62
+ setComboboxData(props.options);
61
63
  }
62
64
  };
63
65
  useEffect(() => {
@@ -11,6 +11,7 @@ const TemplateTextField: React.FC<Omit<TextFieldProps, "outlined">> = (
11
11
  hidden={true}
12
12
  slotProps={{ inputLabel: { shrink: true, sx: { fontWeight: "bold" } } }}
13
13
  label={<>{props?.label ? t(props.label) : ""}</>}
14
+ error={props?.error}
14
15
  helperText={props?.helperText ? t(props.helperText) : undefined}
15
16
  />
16
17
  );
@@ -33,14 +33,7 @@ const TemplateForm: React.FC<TemplateFormProps> = (
33
33
  minHeight: 500,
34
34
  minWidth: 400,
35
35
  });
36
- const { Window: WorkflowWindow, setWindowState: setWorkflowWindowState } =
37
- useWindow({
38
- windowTitle: "Approvals",
39
- windowIcon: "stamp",
40
- height: "fit-content",
41
- minHeight: 500,
42
- width: 800,
43
- });
36
+
44
37
  const [attachmentPanelEnabledForRecord, setAttachmentPanelEnabledForRecord] =
45
38
  useState<boolean>(true);
46
39
  const { t } = useTranslation();
@@ -142,6 +135,19 @@ const TemplateForm: React.FC<TemplateFormProps> = (
142
135
  }
143
136
  };
144
137
 
138
+ const { Window: WorkflowWindow, setWindowState: setWorkflowWindowState } =
139
+ useWindow({
140
+ windowTitle: "Approvals",
141
+ windowIcon: "stamp",
142
+ height: "fit-content",
143
+ minHeight: 500,
144
+ width: "fit-content",
145
+ // width: 1100,
146
+ onCloseCallBack: async () => {
147
+ await loadRecord();
148
+ },
149
+ });
150
+
145
151
  const formActions = {
146
152
  setFieldValue: (fieldName: string, fieldValue: any) => {
147
153
  formManager.setValue(fieldName, fieldValue);
@@ -223,6 +229,7 @@ const TemplateForm: React.FC<TemplateFormProps> = (
223
229
  }}
224
230
  cancelActionCallBk={() => {
225
231
  setWorkflowWindowState(false);
232
+ loadRecord();
226
233
  }}
227
234
  />
228
235
  </WorkflowWindow>
@@ -104,7 +104,8 @@ const TemplateGrid: React.FC<TemplateGridProps> = (props) => {
104
104
  windowIcon: "stamp",
105
105
  height: "fit-content",
106
106
  minHeight: 500,
107
- width:800,
107
+ width: "fit-content",
108
+ // width:1100,
108
109
  onCloseCallBack: () => {
109
110
  props?.apiActions?.reloadData(props.gridLoadParametersValues);
110
111
  },
@@ -83,13 +83,18 @@ const TemplateGridTopBar: React.FC<TemplateGridTopBarProps> = (
83
83
  {isCreationEnabled &&
84
84
  isCreationAuthorized &&
85
85
  props?.templateProps?.editMode?.editMode != "none" ? (
86
- <Button onClick={props?.handleCreateNewRecord}>
87
- <FontAwesomeIcon
88
- icon="add"
89
- style={{ marginRight: 5, marginLeft: 5 }}
90
- />
91
- {t("ADD_BTN_LABEL")}
92
- </Button>
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>
95
+ ) : (
96
+ <></>
97
+ )
93
98
  ) : (
94
99
  <></>
95
100
  )}
@@ -30,8 +30,10 @@ const AttachmentImageViewer: React.FC<AttachmentImageViewerProps> = (props) => {
30
30
  setImgSrc(imagePath);
31
31
  };
32
32
  useEffect(() => {
33
- handleImageSrc();
34
- }, [props]);
33
+ if (props?.refKey) {
34
+ handleImageSrc();
35
+ }
36
+ }, [props.refKey]);
35
37
  {
36
38
  /* </Avatar>
37
39
  src={imgSrc}
@@ -93,8 +93,7 @@ const AttachmentPanel: React.FC<AttachmentPanelProps> = (props) => {
93
93
  if (!files) {
94
94
  toast.error("You must add files to upload");
95
95
  return;
96
- }
97
- debugger;
96
+ }
98
97
  for (const file of files) {
99
98
  if (file.type.startsWith("image/")) {
100
99
  const MAX_SIZE_KB = 600;
@@ -176,6 +175,7 @@ const AttachmentPanel: React.FC<AttachmentPanelProps> = (props) => {
176
175
  display: "flex",
177
176
  flexDirection: "column",
178
177
  width: "100%",
178
+ minHeight:400,
179
179
  alignItems: "center",
180
180
  justifyContent: "flex-start",
181
181
  overflow: "hidden",
@@ -123,7 +123,7 @@ const WorkflowDocumentPanel: React.FC<WorkflowDocumentPanelProps> = (props) => {
123
123
  refDocumentId: props.refDocumentId,
124
124
  },
125
125
  successCallBkFn: (response: any) => {
126
- setWorkflowDocumentInfo(response.data);
126
+ setWorkflowDocumentInfo(structuredClone(response.data));
127
127
  },
128
128
  failureCallBkFn: () => {
129
129
  setWorkflowDocumentInfo({
@@ -358,7 +358,7 @@ const WorkflowDocumentPanel: React.FC<WorkflowDocumentPanelProps> = (props) => {
358
358
  sx={{
359
359
  padding: 2,
360
360
  display: "flex",
361
- flex: 1,
361
+ // flex: 1,
362
362
  margin: 1,
363
363
  flexDirection: "column",
364
364
  alignItems: "center",
@@ -563,7 +563,7 @@ const WorkflowDocumentPanel: React.FC<WorkflowDocumentPanelProps> = (props) => {
563
563
  sx={{
564
564
  display: "flex",
565
565
  flexDirection: "column",
566
- flexGrow: 1,
566
+ width: 600,
567
567
  padding: 2,
568
568
  margin: 1,
569
569
  alignItems: "center",
@@ -20,7 +20,8 @@ const WorkflowDocumentTimeLine: React.FC<WorkflowDocumentTimeLineProp> = (
20
20
  sx={{
21
21
  display: "flex",
22
22
  flexDirection: "column",
23
- flexGrow: 1,
23
+ // flexGrow: 1,
24
+ width: 600,
24
25
  padding: 1,
25
26
  margin: 1,
26
27
  alignItems: "center",
@@ -96,7 +97,11 @@ const WorkflowDocumentTimeLine: React.FC<WorkflowDocumentTimeLineProp> = (
96
97
  <AttachmentImageViewer
97
98
  showAsAvatar={true}
98
99
  attachmentCode="EMPLOYEE_PHOTOS"
99
- refKey={actionHistoryRecord?.personId + "" || "0"}
100
+ refKey={
101
+ actionHistoryRecord?.personId
102
+ ? actionHistoryRecord?.personId + ""
103
+ : undefined
104
+ }
100
105
  style={{ m: 1, width: 70, height: 70 }}
101
106
  />
102
107
  {index !== props.actionHistory.length - 1 ? (