@visns-studio/visns-components 4.10.40 → 4.10.42

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.40",
80
+ "version": "4.10.42",
81
81
  "description": "Various packages to assist in the development of our Custom Applications.",
82
82
  "main": "src/index.js",
83
83
  "files": [
@@ -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;
@@ -967,37 +967,39 @@ function GenericDetail({
967
967
  )}
968
968
  </div>
969
969
 
970
- {activeTabConfig.form && (
970
+ {(activeTabConfig.form ||
971
+ activeTabConfig.export) && (
971
972
  <div className={styles.polActions}>
972
- <button
973
- className={styles.btn}
974
- onClick={() =>
975
- modalOpen(
976
- 'update',
977
- routeParams[urlParam]
978
- )
979
- }
980
- >
981
- Edit
982
- </button>
983
- </div>
984
- )}
985
-
986
- {activeTabConfig.export && (
987
- <div className={styles.polActions}>
988
- <button
989
- className={styles.btn}
990
- onClick={() =>
991
- window.open
992
- ? window.open(
993
- `${activeTabConfig.export.url}/${routeParams[urlParam]}`,
994
- '_blank'
995
- )
996
- : (window.location.href = `${activeTabConfig.export.url}/${routeParams[urlParam]}`)
997
- }
998
- >
999
- Export
1000
- </button>
973
+ {activeTabConfig.form && (
974
+ <button
975
+ className={styles.btn}
976
+ onClick={() =>
977
+ modalOpen(
978
+ 'update',
979
+ routeParams[
980
+ urlParam
981
+ ]
982
+ )
983
+ }
984
+ >
985
+ Edit
986
+ </button>
987
+ )}
988
+ {activeTabConfig.export && (
989
+ <button
990
+ className={styles.btn}
991
+ onClick={() =>
992
+ window.open
993
+ ? window.open(
994
+ `${activeTabConfig.export.url}/${routeParams[urlParam]}`,
995
+ '_blank'
996
+ )
997
+ : (window.location.href = `${activeTabConfig.export.url}/${routeParams[urlParam]}`)
998
+ }
999
+ >
1000
+ Export
1001
+ </button>
1002
+ )}
1001
1003
  </div>
1002
1004
  )}
1003
1005
  </>