@visns-studio/visns-components 2.1.1 → 2.1.2

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.
@@ -652,29 +652,27 @@ const Field = ({
652
652
  break;
653
653
  case 'richeditor':
654
654
  htmlContainer = (
655
- <React.Fragment style={{ height: '1000px' }}>
656
- <ReactQuill
657
- theme="snow"
658
- name={settings.id}
659
- onChange={(value) => {
660
- onChangeRicheditor(value, settings.id);
661
- }}
662
- value={inputValue || ''}
663
- modules={modules}
664
- formats={[
665
- 'header',
666
- 'bold',
667
- 'italic',
668
- 'underline',
669
- 'strike',
670
- 'blockquote',
671
- 'list',
672
- 'bullet',
673
- 'link',
674
- 'image',
675
- ]}
676
- />
677
- </React.Fragment>
655
+ <ReactQuill
656
+ theme="snow"
657
+ name={settings.id}
658
+ onChange={(value) => {
659
+ onChangeRicheditor(value, settings.id);
660
+ }}
661
+ value={inputValue || ''}
662
+ modules={modules}
663
+ formats={[
664
+ 'header',
665
+ 'bold',
666
+ 'italic',
667
+ 'underline',
668
+ 'strike',
669
+ 'blockquote',
670
+ 'list',
671
+ 'bullet',
672
+ 'link',
673
+ 'image',
674
+ ]}
675
+ />
678
676
  );
679
677
  break;
680
678
  case 'image':
@@ -420,15 +420,19 @@ function GenericDetail({ setting, urlParam, userProfile }) {
420
420
 
421
421
  const applyUrlParamsToData = (data) => {
422
422
  return data.map((item) => {
423
- return {
424
- ...item,
425
- value:
426
- item.hasOwnProperty('value') &&
427
- item.urlParam &&
428
- routeParams[item.urlParam]
429
- ? routeParams[item.urlParam]
430
- : item.value,
431
- };
423
+ if (item.hasOwnProperty('value') && item.urlParam) {
424
+ return {
425
+ ...item,
426
+ value:
427
+ item.hasOwnProperty('value') &&
428
+ item.urlParam &&
429
+ routeParams[item.urlParam]
430
+ ? routeParams[item.urlParam]
431
+ : item.value,
432
+ };
433
+ } else {
434
+ return item;
435
+ }
432
436
  });
433
437
  };
434
438
 
@@ -446,12 +450,54 @@ function GenericDetail({ setting, urlParam, userProfile }) {
446
450
  activeTabConfig.ajaxSetting.where
447
451
  ),
448
452
  };
453
+
449
454
  const updatedForm = {
450
455
  ...activeTabConfig.form,
451
- fields: applyUrlParamsToData(
452
- activeTabConfig.form.fields
456
+ fields: activeTabConfig.form.fields.map(
457
+ (field) => {
458
+ if (
459
+ field.hasOwnProperty('value') &&
460
+ field.urlParam &&
461
+ routeParams[field.urlParam]
462
+ ) {
463
+ if (
464
+ field.type &&
465
+ field.relationName &&
466
+ (field.type ===
467
+ 'multi-dropdown-ajax' ||
468
+ field.type ===
469
+ 'multi-dropdown')
470
+ ) {
471
+ field.value = {
472
+ value: routeParams[
473
+ field.urlParam
474
+ ],
475
+ label: data[
476
+ field.relationName
477
+ ],
478
+ };
479
+ } else {
480
+ field.value =
481
+ routeParams[
482
+ field.urlParam
483
+ ];
484
+ }
485
+ }
486
+
487
+ if (field.where) {
488
+ return {
489
+ ...field,
490
+ where: applyUrlParamsToData(
491
+ field.where
492
+ ),
493
+ };
494
+ } else {
495
+ return field;
496
+ }
497
+ }
453
498
  ),
454
499
  };
500
+
455
501
  setConfig({
456
502
  ajaxSetting: updatedAjaxSetting,
457
503
  form: updatedForm,
package/package.json CHANGED
@@ -40,7 +40,7 @@
40
40
  "react-dom": "^17.0.1"
41
41
  },
42
42
  "name": "@visns-studio/visns-components",
43
- "version": "2.1.1",
43
+ "version": "2.1.2",
44
44
  "description": "Various packages to assist in the development of our Custom Applications.",
45
45
  "main": "index.js",
46
46
  "scripts": {