pict-section-recordset 1.0.20 → 1.0.21

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.
@@ -222,6 +222,8 @@ module.exports.default_configuration.pict_configuration = (
222
222
  "RecordSetType": "MeadowEndpoint", // Could be "Custom" which would require a provider to already be created for the record set.
223
223
  "RecordSetMeadowEntity": "Book", // This leverages the /Schema endpoint to get the record set columns.
224
224
 
225
+ "RecordSetListManifestOnly": true,
226
+
225
227
  "RecordSetDashboardManifests": [ "Bestsellers", "Underdogs", "NewReleases" ],
226
228
 
227
229
  "RecordDecorationConfiguration":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pict-section-recordset",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "description": "Pict dynamic record set management views",
5
5
  "main": "source/Pict-Section-RecordSet.js",
6
6
  "directories": {
@@ -117,6 +117,13 @@ class viewRecordSetSUBSETFilter extends libPictView
117
117
  filterExpr = searchFields.map((filterField) => `FBVOR~${filterField}~LK~${encodeURIComponent(`%${pFilterString}%`)}`).join('~');
118
118
  }
119
119
  let tmpURLTemplate = tmpProviderConfiguration[`RecordSetFilterURLTemplate-${pViewContext}`] || tmpProviderConfiguration[`RecordSetFilterURLTemplate-Default`];
120
+ if (!tmpURLTemplate)
121
+ {
122
+ if (pViewContext === 'Dashboard' || pViewContext === 'List')
123
+ {
124
+ tmpURLTemplate = `/PSRS/${pRecordSet}/${pViewContext}/FilteredTo/{~D:Record.FilterString~}`;
125
+ }
126
+ }
120
127
  let tmpURL;
121
128
  if (tmpURLTemplate)
122
129
  {
@@ -220,15 +220,15 @@ class viewRecordSetDashboard extends libPictRecordSetRecordView
220
220
  return;
221
221
  }
222
222
 
223
- let tmpManifest;
223
+ let tmpManifestDefinition;
224
224
  if (pDashboardHash)
225
225
  {
226
- tmpManifest = this.pict.PictSectionRecordSet.manifestDefinitions[pDashboardHash];
226
+ tmpManifestDefinition = this.pict.PictSectionRecordSet.manifestDefinitions[pDashboardHash];
227
227
  }
228
228
  let tmpTitle = pRecordSetConfiguration.Title || pRecordSetConfiguration.RecordSet;
229
- if (tmpManifest && tmpManifest.TitleTemplate)
229
+ if (tmpManifestDefinition && tmpManifestDefinition.TitleTemplate)
230
230
  {
231
- tmpTitle = this.pict.parseTemplate(tmpManifest.TitleTemplate, pRecordSetConfiguration);
231
+ tmpTitle = this.pict.parseTemplate(tmpManifestDefinition.TitleTemplate, pRecordSetConfiguration);
232
232
  }
233
233
 
234
234
  let tmpRecordDashboardData =
@@ -369,11 +369,10 @@ class viewRecordSetDashboard extends libPictRecordSetRecordView
369
369
 
370
370
  if (pDashboardHash)
371
371
  {
372
- tmpRecordDashboardData.TableCells = tmpManifest?.TableCells;
372
+ tmpRecordDashboardData.TableCells = tmpManifestDefinition?.TableCells;
373
373
  }
374
374
  if (!tmpRecordDashboardData.TableCells)
375
375
  {
376
- tmpRecordDashboardData.TableCells = [];
377
376
  // Put code here to preprocess columns into other data parts.
378
377
  /*
379
378
  "RecordSetListManifestOnly": false,
@@ -381,42 +380,58 @@ class viewRecordSetDashboard extends libPictRecordSetRecordView
381
380
  "RecordSetListManifests": [ "Bestsellers", "Underdogs", "NewReleases" ],
382
381
  "RecordSetDashboardManifests": [ "Bestsellers" ],
383
382
  */
384
- if (tmpRecordDashboardData.RecordSetConfiguration.hasOwnProperty('RecordSetListColumns'))
383
+ if (pRecordSetConfiguration.RecordSetListManifestOnly)
385
384
  {
386
- tmpRecordDashboardData.TableCells = tmpRecordDashboardData.RecordSetConfiguration.RecordSetListColumns.map((key) =>
387
- {
388
- if (typeof key === 'object')
385
+ const tmpManifestHash = pRecordSetConfiguration.RecordSetDashboardDefaultManifest || pRecordSetConfiguration.RecordSetDashboardManifests?.[0];
386
+ const tmpManifest = this.pict.PictSectionRecordSet.getManifest(tmpManifestHash);
387
+ if (!tmpManifest)
388
+ {
389
+ this.pict.log.error(`RecordSetDashboard: No manifest found for ${pRecordSetConfiguration.RecordSet}. List Render failed.`);
390
+ }
391
+ else
392
+ {
393
+ tmpRecordDashboardData.TableCells = tmpManifest.TableCells;
394
+ }
395
+ }
396
+ if (!tmpRecordDashboardData.TableCells)
397
+ {
398
+ if (tmpRecordDashboardData.RecordSetConfiguration.hasOwnProperty('RecordSetListColumns'))
399
+ {
400
+ tmpRecordDashboardData.TableCells = tmpRecordDashboardData.RecordSetConfiguration.RecordSetListColumns.map((key) =>
389
401
  {
390
- if (!key.DisplayName)
391
- {
392
- key.DisplayName = key.Key; //FIXME: use schema?
393
- }
394
- if (!key.ManifestHash)
402
+ if (typeof key === 'object')
395
403
  {
396
- key.ManifestHash = 'Default';
404
+ if (!key.DisplayName)
405
+ {
406
+ key.DisplayName = key.Key; //FIXME: use schema?
407
+ }
408
+ if (!key.ManifestHash)
409
+ {
410
+ key.ManifestHash = 'Default';
411
+ }
412
+ return key;
397
413
  }
398
- return key;
399
- }
400
- return {
401
- Key: key,
402
- DisplayName: key, //FIXME: use schema?
403
- ManifestHash: 'Default',
404
- PictDashboard:
405
- {
406
- ValueTemplate: '{~DVBK:Record.Payload:Record.Data.Key~}',
407
- },
408
- };
409
- });
410
- }
411
- else
412
- {
413
- this.dynamicallyGenerateColumns(tmpRecordDashboardData);
414
+ return {
415
+ Key: key,
416
+ DisplayName: key, //FIXME: use schema?
417
+ ManifestHash: 'Default',
418
+ PictDashboard:
419
+ {
420
+ ValueTemplate: '{~DVBK:Record.Payload:Record.Data.Key~}',
421
+ },
422
+ };
423
+ });
424
+ }
425
+ else
426
+ {
427
+ this.dynamicallyGenerateColumns(tmpRecordDashboardData);
428
+ }
414
429
  }
415
430
  }
416
431
 
417
432
  tmpRecordDashboardData = this.onBeforeRenderList(tmpRecordDashboardData);
418
433
 
419
- this.pict.providers.DynamicRecordsetSolver.solveDashboard(tmpManifest || { }, tmpRecordDashboardData.Records.Records);
434
+ this.pict.providers.DynamicRecordsetSolver.solveDashboard(tmpManifestDefinition, tmpRecordDashboardData.Records.Records);
420
435
 
421
436
  this.renderAsync('PRSP_Renderable_List', tmpRecordDashboardData.RenderDestination, tmpRecordDashboardData,
422
437
  function (pError)
@@ -460,6 +475,19 @@ class viewRecordSetDashboard extends libPictRecordSetRecordView
460
475
  this.pict.log.error(`RecordSetDashboard: No provider found for ${pProviderHash} in ${pRecordSetConfiguration.RecordSet}. List Render failed.`);
461
476
  return;
462
477
  }
478
+ if (pRecordSetConfiguration.RecordSetListManifestOnly)
479
+ {
480
+ const tmpManifestHash = pRecordSetConfiguration.RecordSetDashboardDefaultManifest || pRecordSetConfiguration.RecordSetDashboardManifests?.[0];
481
+ const tmpManifest = this.pict.PictSectionRecordSet.getManifest(tmpManifestHash);
482
+ if (!tmpManifest)
483
+ {
484
+ this.pict.log.error(`RecordSetDashboard: No manifest found for ${pRecordSetConfiguration.RecordSet}. List Render failed.`);
485
+ }
486
+ else
487
+ {
488
+ return this.renderSpecificDashboard(tmpManifestHash, pRecordSetConfiguration, pProviderHash, pFilterString, pOffset, pPageSize);
489
+ }
490
+ }
463
491
 
464
492
  let tmpRecordDashboardData =
465
493
  {
@@ -482,7 +510,7 @@ class viewRecordSetDashboard extends libPictRecordSetRecordView
482
510
  // TODO: There are still problems with the way these have nested data. Discuss how we might move that around
483
511
  // Fetch the records
484
512
  const [ tmpRecords, tmpTotalRecordCount, tmpRecordSchema ] = await Promise.all([
485
- this.pict.providers[pProviderHash].getRecords(tmpRecordDashboardData),
513
+ this.pict.providers[pProviderHash].getDecoratedRecords(tmpRecordDashboardData),
486
514
  this.pict.providers[pProviderHash].getRecordSetCount(tmpRecordDashboardData),
487
515
  this.pict.providers[pProviderHash].getRecordSchema(),
488
516
  ]);
@@ -601,7 +629,6 @@ class viewRecordSetDashboard extends libPictRecordSetRecordView
601
629
  tmpRecordDashboardData.PageLinkBookmarks.NextLink = tmpRecordDashboardData.PageLinks[tmpRecordDashboardData.PageLinkBookmarks.Next];
602
630
  }
603
631
 
604
- tmpRecordDashboardData.TableCells = [];
605
632
  // Put code here to preprocess columns into other data parts.
606
633
  /*
607
634
  "RecordSetListManifestOnly": false,
@@ -611,23 +638,32 @@ class viewRecordSetDashboard extends libPictRecordSetRecordView
611
638
  */
612
639
  if (tmpRecordDashboardData.RecordSetConfiguration.hasOwnProperty('RecordSetListColumns'))
613
640
  {
614
- tmpRecordDashboardData.TableCells = tmpRecordDashboardData.RecordSetConfiguration.RecordSetListColumns.map((key) =>
641
+ tmpRecordDashboardData.TableCells = tmpRecordDashboardData.RecordSetConfiguration.RecordSetListColumns.map((pKey) =>
615
642
  {
616
- if (typeof key === 'object')
643
+ if (typeof pKey === 'object')
617
644
  {
618
- if (!key.DisplayName)
645
+ const tmpTableCell = pKey;
646
+ if (!tmpTableCell.DisplayName)
647
+ {
648
+ tmpTableCell.DisplayName = tmpTableCell.Key; //FIXME: use schema?
649
+ }
650
+ if (!tmpTableCell.ManifestHash)
651
+ {
652
+ tmpTableCell.ManifestHash = 'Default';
653
+ }
654
+ if (!tmpTableCell.PictDashboard)
619
655
  {
620
- key.DisplayName = key.Key; //FIXME: use schema?
656
+ tmpTableCell.PictDashboard = {};
621
657
  }
622
- if (!key.ManifestHash)
658
+ if (!tmpTableCell.PictDashboard.ValueTemplate)
623
659
  {
624
- key.ManifestHash = 'Default';
660
+ tmpTableCell.PictDashboard.ValueTemplate = '{~DVBK:Record.Payload:Record.Data.Key~}';
625
661
  }
626
- return key;
662
+ return tmpTableCell;
627
663
  }
628
664
  return {
629
- Key: key,
630
- DisplayName: key, //FIXME: use schema?
665
+ Key: pKey,
666
+ DisplayName: pKey, //FIXME: use schema?
631
667
  ManifestHash: 'Default',
632
668
  PictDashboard:
633
669
  {
@@ -1 +1 @@
1
- {"version":3,"file":"RecordSet-Filter.d.ts","sourceRoot":"","sources":["../../source/views/RecordSet-Filter.js"],"names":[],"mappings":";AA+EA;IAEC,2DAMC;IAFA,kHAAkH;IAClH,MADW,GAAe,GAAG,OAAO,MAAM,CAAC,GAAG;QAAE,oBAAoB,EAAE;;;;;;SAAsC,CAAA;KAAE,CACrG;IAGV;;;;OAIG;IACH,qBAJW,KAAK,cACL,MAAM,gBACN,MAAM,QAQhB;IAED;;;;OAIG;IACH,0BAJW,MAAM,gBACN,MAAM,kBACN,MAAM,QA4BhB;IAED;;;;OAIG;IACH,oBAJW,KAAK,cACL,MAAM,gBACN,MAAM,QAOhB;CACD;;;;;AAhJD,kCAAkC;AAClC,oDADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CA2E5B"}
1
+ {"version":3,"file":"RecordSet-Filter.d.ts","sourceRoot":"","sources":["../../source/views/RecordSet-Filter.js"],"names":[],"mappings":";AA+EA;IAEC,2DAMC;IAFA,kHAAkH;IAClH,MADW,GAAe,GAAG,OAAO,MAAM,CAAC,GAAG;QAAE,oBAAoB,EAAE;;;;;;SAAsC,CAAA;KAAE,CACrG;IAGV;;;;OAIG;IACH,qBAJW,KAAK,cACL,MAAM,gBACN,MAAM,QAQhB;IAED;;;;OAIG;IACH,0BAJW,MAAM,gBACN,MAAM,kBACN,MAAM,QAmChB;IAED;;;;OAIG;IACH,oBAJW,KAAK,cACL,MAAM,gBACN,MAAM,QAOhB;CACD;;;;;AAvJD,kCAAkC;AAClC,oDADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CA2E5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"RecordSet-Dashboard.d.ts","sourceRoot":"","sources":["../../../source/views/dashboard/RecordSet-Dashboard.js"],"names":[],"mappings":";AA0EA;IAOE;;;;;;;;MAQC;IAGF,iEAsCC;IAED;;OAEG;IACH,qCAeC;IAED,8CAGC;IAED,sDAuCC;IAnCA,iCAUC;IA2BF;;;;;;;;;OASG;IACH,wCATW,MAAM,2BACN,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,iBACnB,MAAM,iBACN,MAAM,WACN,MAAM,aACN,MAAM,GAEL,OAAO,CAAC,IAAI,CAAC,CAwOxB;IAED;;;;;;;;OAQG;IACH,yCARW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,iBACnB,MAAM,iBACN,MAAM,WACN,MAAM,aACN,MAAM,GAEL,OAAO,CAAC,IAAI,CAAC,CA+NxB;CAwBD;;;;;AA3qBD,kCAAkC;AAClC,iDADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CA6D1B"}
1
+ {"version":3,"file":"RecordSet-Dashboard.d.ts","sourceRoot":"","sources":["../../../source/views/dashboard/RecordSet-Dashboard.js"],"names":[],"mappings":";AA0EA;IAOE;;;;;;;;MAQC;IAGF,iEAsCC;IAED;;OAEG;IACH,qCAeC;IAED,8CAGC;IAED,sDAuCC;IAnCA,iCAUC;IA2BF;;;;;;;;;OASG;IACH,wCATW,MAAM,2BACN,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,iBACnB,MAAM,iBACN,MAAM,WACN,MAAM,aACN,MAAM,GAEL,OAAO,CAAC,IAAI,CAAC,CAuPxB;IAED;;;;;;;;OAQG;IACH,yCARW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,iBACnB,MAAM,iBACN,MAAM,WACN,MAAM,aACN,MAAM,GAEL,OAAO,CAAC,IAAI,CAAC,CAoPxB;CAwBD;;;;;AA/sBD,kCAAkC;AAClC,iDADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CA6D1B"}