pict-section-recordset 1.0.62 → 1.0.63

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.
@@ -51,6 +51,35 @@ const _DEFAULT_CONFIGURATION__Dashboard = (
51
51
  {~V:PRSP-Dashboard-PaginationBottom~}
52
52
  </section>
53
53
  <!-- DefaultPackage end view template: [PRSP-Dashboard-Template] -->
54
+ `
55
+ },
56
+ {
57
+ Hash: 'PRSP-Dashboard-Template-Form-With-Recordset-Data',
58
+ Template: /*html*/`
59
+ <!-- DefaultPackage pict view template: [PRSP-Dashboard-Template-Form-With-Recordset-Data] -->
60
+ <section id="PRSP_List_Container">
61
+ {~V:PRSP-Dashboard-Title~}
62
+ {~V:PRSP-Dashboard-HeaderDashboard~}
63
+ <section id="PRSP_Filters_Container">
64
+ {~FV:PRSP-Filters:Dashboard~}
65
+ </section>
66
+ {~V:PRSP-Dashboard-PaginationTop~}
67
+ {~T:PRSP-Dashboard-RecordDashboard-Template~}
68
+ {~V:PRSP-Dashboard-PaginationBottom~}
69
+ </section>
70
+ <!-- DefaultPackage end view template: [PRSP-Dashboard-Template-Form-With-Recordset-Data] -->
71
+ `
72
+ },
73
+ {
74
+ Hash: 'PRSP-Dashboard-Template-Form',
75
+ Template: /*html*/`
76
+ <!-- DefaultPackage pict view template: [PRSP-Dashboard-Template-Form] -->
77
+ <section id="PRSP_List_Container">
78
+ {~V:PRSP-Dashboard-Title~}
79
+ {~V:PRSP-Dashboard-HeaderDashboard~}
80
+ {~T:PRSP-Dashboard-RecordDashboard-Template~}
81
+ </section>
82
+ <!-- DefaultPackage end view template: [PRSP-Dashboard-Template-Form] -->
54
83
  `
55
84
  },
56
85
  {
@@ -68,6 +97,18 @@ const _DEFAULT_CONFIGURATION__Dashboard = (
68
97
  TemplateHash: 'PRSP-Dashboard-Template',
69
98
  DestinationAddress: '#PRSP_Container',
70
99
  RenderMethod: 'replace'
100
+ },
101
+ {
102
+ RenderableHash: 'PRSP_Renderable_Form_With_Recordset_Data',
103
+ TemplateHash: 'PRSP-Dashboard-Template-Form-With-Recordset-Data',
104
+ DestinationAddress: '#PRSP_Container',
105
+ RenderMethod: 'replace'
106
+ },
107
+ {
108
+ RenderableHash: 'PRSP_Renderable_Form',
109
+ TemplateHash: 'PRSP-Dashboard-Template-Form',
110
+ DestinationAddress: '#PRSP_Container',
111
+ RenderMethod: 'replace'
71
112
  }
72
113
  ],
73
114
 
@@ -400,11 +441,11 @@ class viewRecordSetDashboard extends libPictRecordSetRecordView
400
441
  tmpRecordDashboardData.PageLinkBookmarks.NextLink = tmpRecordDashboardData.PageLinks[tmpRecordDashboardData.PageLinkBookmarks.Next];
401
442
  }
402
443
 
403
- if (pDashboardHash)
444
+ if (pDashboardHash && !tmpManifestDefinition.Form)
404
445
  {
405
446
  tmpRecordDashboardData.TableCells = tmpManifestDefinition?.TableCells;
406
447
  }
407
- if (!tmpRecordDashboardData.TableCells)
448
+ if (!tmpRecordDashboardData.TableCells && !tmpManifestDefinition.Form)
408
449
  {
409
450
  // Put code here to preprocess columns into other data parts.
410
451
  /*
@@ -469,9 +510,21 @@ class viewRecordSetDashboard extends libPictRecordSetRecordView
469
510
 
470
511
  tmpRecordDashboardData = this.onBeforeRenderList(tmpRecordDashboardData);
471
512
 
472
- this.pict.providers.DynamicRecordsetSolver.solveDashboard(tmpManifestDefinition, tmpRecordDashboardData.Records.Records);
513
+ if (!tmpManifestDefinition.Form)
514
+ {
515
+ this.pict.providers.DynamicRecordsetSolver.solveDashboard(tmpManifestDefinition, tmpRecordDashboardData.Records.Records);
516
+ }
517
+ else
518
+ {
519
+ this.pict.AppData['PSRS-Dashboard-Data'] = tmpRecordDashboardData.Records.Records;
520
+ this.pict.TemplateProvider.addTemplate('PRSP-Dashboard-RecordDashboard-Template', /*html*/`
521
+ <!-- Manifest dynamic pict template: [PRSP-Dashboard-RecordDashboard-Template] -->
522
+ <div>${ this._generateFormManifestTemplate(tmpManifestDefinition, 'RecordDashboard') }</div>
523
+ <!-- Manifest dynamic pict end template: [PRSP-Dashboard-RecordDashboard-Template] -->
524
+ `);
525
+ }
473
526
 
474
- this.renderAsync('PRSP_Renderable_List', tmpRecordDashboardData.RenderDestination, tmpRecordDashboardData,
527
+ this.renderAsync(tmpManifestDefinition.Form ? (tmpManifestDefinition.WithRecordsetData ? 'PRSP_Renderable_Form_With_Recordset_Data' : 'PRSP_Renderable_Form') : 'PRSP_Renderable_List', tmpRecordDashboardData.RenderDestination, tmpRecordDashboardData,
475
528
  function (pError)
476
529
  {
477
530
  if (pError)
@@ -488,9 +541,52 @@ class viewRecordSetDashboard extends libPictRecordSetRecordView
488
541
  {
489
542
  this.pict.log.info(`RecordSetDashboard: Rendered list ${tmpRecordDashboardData.RecordSet} with ${tmpRecordDashboardData.Records.Records.length} records.`);
490
543
  }
544
+ for (const s of tmpManifestDefinition?.Sections || [])
545
+ {
546
+ this.pict.views[`PictSectionForm-${ s.Hash }`].render();
547
+ this.pict.views[`PictSectionForm-${ s.Hash }`].marshalToView();
548
+ }
491
549
  }.bind(this));
492
550
  }
493
551
 
552
+ _generateFormManifestTemplate(tmpManifest, section)
553
+ {
554
+ if (!tmpManifest)
555
+ {
556
+ this.pict.log.error(`RecordSetDashboard: No manifest found for dashboard. Render failed.`);
557
+ return '';
558
+ }
559
+ if (!tmpManifest.Descriptors)
560
+ {
561
+ this.pict.log.error(`RecordSetDashboard: No manifest descriptors found for manifest. Render failed.`);
562
+ return '';
563
+ }
564
+
565
+ this.manifest = tmpManifest;
566
+ let sectionsTemplate = '';
567
+ for (const s of tmpManifest?.Sections || [])
568
+ {
569
+ delete this.pict.views[`PictSectionForm-${ s.Hash }`]
570
+ }
571
+ this.pict.views.PictFormMetacontroller.clearManifestDescription();
572
+ this.pict.views.PictFormMetacontroller.bootstrapPictFormViewsFromManifest(tmpManifest);
573
+
574
+ for (const pickList of tmpManifest?.PickLists || [])
575
+ {
576
+ this.pict.providers.DynamicMetaLists.rebuildListByHash(pickList.Hash);
577
+ }
578
+
579
+ for (const s of tmpManifest?.Sections || [])
580
+ {
581
+ const viewSectionID = `PSRS-Dashboard-${ section }-Section-${ s.Hash }`;
582
+ sectionsTemplate += /*html*/`<div id="${ viewSectionID }"></div>`;
583
+ this.pict.views[`PictSectionForm-${ s.Hash }`].viewMarshalDestination = 'AppData';
584
+ this.pict.views[`PictSectionForm-${ s.Hash }`].options.DefaultDestinationAddress = `#${ viewSectionID }`;
585
+ this.pict.views[`PictSectionForm-${ s.Hash }`].rebuildCustomTemplate();
586
+ }
587
+ return sectionsTemplate
588
+ }
589
+
494
590
  /**
495
591
  * @param {Record<string, any>} pRecordSetConfiguration
496
592
  * @param {string} pProviderHash