@visns-studio/visns-components 4.10.39 → 4.10.41

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
@@ -77,7 +77,7 @@
77
77
  "react-dom": "^17.0.0 || ^18.0.0"
78
78
  },
79
79
  "name": "@visns-studio/visns-components",
80
- "version": "4.10.39",
80
+ "version": "4.10.41",
81
81
  "description": "Various packages to assist in the development of our Custom Applications.",
82
82
  "main": "src/index.js",
83
83
  "files": [
@@ -571,18 +571,28 @@ const DataGrid = forwardRef(
571
571
  break;
572
572
  case 'form':
573
573
  if (s.key) {
574
- let fsd = formSettingData;
574
+ console.info('Form Setting Data:', formSettingData);
575
+ let fsd = s.form;
575
576
 
576
577
  if (fsd.fields && fsd.fields.length > 0) {
578
+ console.info(
579
+ 'Form Setting Data Fields:',
580
+ fsd.fields.length
581
+ );
577
582
  fsd.fields.forEach((fItem, fKey) => {
578
583
  if (fItem.id === s.key) {
584
+ console.info(
585
+ 'Form Setting Data Fields ID:',
586
+ fItem.id
587
+ );
579
588
  fsd.fields[fKey].value = d.id;
580
589
  }
581
590
  });
582
591
 
583
- console.info(fsd);
584
-
585
- setFormSettingData(fsd);
592
+ setFormSettingData((prevState) => ({
593
+ ...prevState,
594
+ ...fsd,
595
+ }));
586
596
  }
587
597
  }
588
598
  modalSettingOpen('create', 0);
@@ -790,7 +800,13 @@ const DataGrid = forwardRef(
790
800
  }
791
801
  }
792
802
  } else {
793
- navigate(`${linkUrl}${rowData}`);
803
+ if (rowData) {
804
+ navigate(`${linkUrl}${rowData}`);
805
+ } else {
806
+ toast.warn(
807
+ 'No data available for this link.'
808
+ );
809
+ }
794
810
  }
795
811
  } else {
796
812
  if (rowProps.data[column.id]) {
@@ -1199,10 +1215,6 @@ const DataGrid = forwardRef(
1199
1215
  }
1200
1216
  }
1201
1217
 
1202
- if (s.form) {
1203
- setFormSettingData(s.form);
1204
- }
1205
-
1206
1218
  if (allow) {
1207
1219
  switch (s.id) {
1208
1220
  case 'activate':
@@ -269,12 +269,28 @@ function Form({
269
269
  let contentValue = inputValue[field.trigger.key];
270
270
 
271
271
  if (field.trigger.url && field.trigger.payload) {
272
- const res = await CustomFetch(field.trigger.url, 'POST', {
273
- [field.trigger.payload.key.id]:
274
- inputValue[field.trigger.payload.value.id],
275
- [field.trigger.payload.key.content]:
276
- inputValue[field.trigger.payload.value.content],
277
- });
272
+ let setContentPayload;
273
+
274
+ if (field.trigger?.payload?.key?.id) {
275
+ setContentPayload = {
276
+ [field.trigger.payload.key.id]:
277
+ inputValue[field.trigger.payload.value.id],
278
+ [field.trigger.payload.key.content]:
279
+ inputValue[field.trigger.payload.value.content],
280
+ };
281
+ } else {
282
+ setContentPayload = {
283
+ formData: formData,
284
+ [field.trigger.payload.key.content]:
285
+ inputValue[field.trigger.payload.value.content],
286
+ };
287
+ }
288
+
289
+ const res = await CustomFetch(
290
+ field.trigger.url,
291
+ 'POST',
292
+ setContentPayload
293
+ );
278
294
 
279
295
  if (res.data.content) {
280
296
  contentValue = res.data.content;