pict-section-form 1.0.156 → 1.0.157
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
|
@@ -378,7 +378,7 @@ class PictFormMetacontroller extends libPictViewClass
|
|
|
378
378
|
{
|
|
379
379
|
continue;
|
|
380
380
|
}
|
|
381
|
-
const tmpTranslatedAddress = tmpAddressTranslation[tmpIterAddress].replace(new RegExp(
|
|
381
|
+
const tmpTranslatedAddress = tmpAddressTranslation[tmpIterAddress].replace(new RegExp(`^${tmpOriginalAddress}\\b`, 'g'), tmpUpdatedAddress);
|
|
382
382
|
if (tmpTranslatedAddress !== tmpAddressTranslation[tmpIterAddress])
|
|
383
383
|
{
|
|
384
384
|
//this.pict.log.info(`DocumentDynamicSectionManager._addTestSections: Updated address translation for "${tmpIterAddress}" from "${tmpAddressTranslation[tmpIterAddress]}" to "${tmpTranslatedAddress}".`);
|
|
@@ -416,6 +416,7 @@ class PictFormMetacontroller extends libPictViewClass
|
|
|
416
416
|
continue;
|
|
417
417
|
}
|
|
418
418
|
let tmpUpdatedSolver = tmpSolverExpression;
|
|
419
|
+
//FIXME: what if there is a collision in a suffix-part and we replace too much?
|
|
419
420
|
for (const tmpMapping of tmpAddressMappings)
|
|
420
421
|
{
|
|
421
422
|
tmpUpdatedSolver = tmpUpdatedSolver.replace(new RegExp(`\\b${escapeRegExp(tmpMapping.From)}\\b`, 'g'), tmpMapping.To);
|
|
@@ -440,6 +441,43 @@ class PictFormMetacontroller extends libPictViewClass
|
|
|
440
441
|
}
|
|
441
442
|
for (const tmpGroup of tmpSection.Groups || [])
|
|
442
443
|
{
|
|
444
|
+
if (tmpGroup.RecordSetAddress)
|
|
445
|
+
{
|
|
446
|
+
let tmpRecordSetAddress = tmpGroup.RecordSetAddress;
|
|
447
|
+
for (const tmpMapping of tmpAddressMappings)
|
|
448
|
+
{
|
|
449
|
+
tmpRecordSetAddress = tmpRecordSetAddress.replace(new RegExp(`^${escapeRegExp(tmpMapping.From)}\\b`, 'g'), tmpMapping.To);
|
|
450
|
+
}
|
|
451
|
+
if (tmpRecordSetAddress !== tmpGroup.RecordSetAddress)
|
|
452
|
+
{
|
|
453
|
+
//this.pict.log.info(`DocumentDynamicSectionManager._addTestSections: Updated group record set address from "${tmpGroup.RecordSetAddress}" to "${tmpRecordSetAddress}".`);
|
|
454
|
+
}
|
|
455
|
+
else
|
|
456
|
+
{
|
|
457
|
+
let tmpArrayIndex = tmpRecordSetAddress.indexOf('[');
|
|
458
|
+
let tmpDotIndex = tmpRecordSetAddress.indexOf('.');
|
|
459
|
+
if (tmpDotIndex >= 0 && (tmpDotIndex < tmpArrayIndex || tmpArrayIndex < 0))
|
|
460
|
+
{
|
|
461
|
+
const tmpPrefixPart = tmpRecordSetAddress.substring(0, tmpDotIndex);
|
|
462
|
+
const tmpPostfixPart = tmpRecordSetAddress.substring(tmpDotIndex);
|
|
463
|
+
tmpRecordSetAddress = `${tmpPrefixPart}_${tmpUUID}${tmpPostfixPart}`;
|
|
464
|
+
}
|
|
465
|
+
else if (tmpArrayIndex >= 0 && (tmpArrayIndex < tmpDotIndex || tmpDotIndex < 0))
|
|
466
|
+
{
|
|
467
|
+
const tmpArrayPart = tmpRecordSetAddress.substring(0, tmpArrayIndex);
|
|
468
|
+
const tmpPostfixPart = tmpRecordSetAddress.substring(tmpArrayIndex);
|
|
469
|
+
tmpRecordSetAddress = `${tmpArrayPart}_${tmpUUID}${tmpPostfixPart}`;
|
|
470
|
+
}
|
|
471
|
+
else
|
|
472
|
+
{
|
|
473
|
+
//FIXME: do we want to allow prefixing the data address? (ex. nesting it under a parent object) - caller can still do this themselves.
|
|
474
|
+
tmpRecordSetAddress = `${tmpGroup.RecordSetAddress}_${tmpUUID}`;
|
|
475
|
+
}
|
|
476
|
+
//TODO: does this need to go into the mappings?
|
|
477
|
+
tmpGroup.RecordSetAddress = tmpRecordSetAddress;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
}
|
|
443
481
|
if (Array.isArray(tmpGroup.RecordSetSolvers) && tmpGroup.RecordSetSolvers.length > 0)
|
|
444
482
|
{
|
|
445
483
|
for (let i = 0; i < tmpGroup.RecordSetSolvers.length; i++)
|
|
@@ -451,6 +489,7 @@ class PictFormMetacontroller extends libPictViewClass
|
|
|
451
489
|
continue;
|
|
452
490
|
}
|
|
453
491
|
let tmpUpdatedSolver = tmpSolverExpression;
|
|
492
|
+
//FIXME: what if there is a collision in a suffix-part and we replace too much?
|
|
454
493
|
for (const tmpMapping of tmpAddressMappings)
|
|
455
494
|
{
|
|
456
495
|
tmpUpdatedSolver = tmpUpdatedSolver.replace(new RegExp(`\\b${escapeRegExp(tmpMapping.From)}\\b`, 'g'), tmpMapping.To);
|
|
@@ -557,6 +557,15 @@ suite
|
|
|
557
557
|
Scope: 'OrderedSolverApplicationForm',
|
|
558
558
|
Descriptors:
|
|
559
559
|
{
|
|
560
|
+
'LevelOfIndirection.AggregateValueAddress':
|
|
561
|
+
{
|
|
562
|
+
Hash: 'IndirectAggregateValue',
|
|
563
|
+
Name: 'Indirect Aggregate Value',
|
|
564
|
+
DataAddress: 'LevelOfIndirection.AggregateValueAddress',
|
|
565
|
+
DataType: 'PreciseNumber',
|
|
566
|
+
FormGroup: 'DataTableGroup',
|
|
567
|
+
FormSection: 'DataTableSection',
|
|
568
|
+
},
|
|
560
569
|
'LevelOfIndirection.DataTableAddress[].ValueAddress':
|
|
561
570
|
{
|
|
562
571
|
Hash: 'ValueArray',
|
|
@@ -590,10 +599,19 @@ suite
|
|
|
590
599
|
{
|
|
591
600
|
Name: 'Ordered Solver Section',
|
|
592
601
|
Hash: 'OrderedSolverSection',
|
|
602
|
+
Groups:
|
|
603
|
+
[
|
|
604
|
+
{
|
|
605
|
+
Name: 'Group Name',
|
|
606
|
+
Hash: 'GroupHash',
|
|
607
|
+
RecordSetAddress: 'LevelOfIndirection.DataTableAddress',
|
|
608
|
+
},
|
|
609
|
+
],
|
|
593
610
|
Solvers:
|
|
594
611
|
[
|
|
595
612
|
{ Ordinal: 5, Expression: 'AggregateValue = SUM(ValueArray)' },
|
|
596
613
|
{ Ordinal: 40, Expression: 'AggregateValue2 = SUM(LevelOfIndirection.DataTableAddress[].ValueAddress)' },
|
|
614
|
+
{ Ordinal: 60, Expression: 'IndirectAggregateValue = AggregateValue' },
|
|
597
615
|
],
|
|
598
616
|
},
|
|
599
617
|
],
|
|
@@ -601,6 +619,7 @@ suite
|
|
|
601
619
|
|
|
602
620
|
let tmpHashedAggregateValue = null;
|
|
603
621
|
let tmpHashedAggregateValue2 = null;
|
|
622
|
+
let tmpHashedAggregateValue3 = null;
|
|
604
623
|
_Pict.PictApplication.initializeAsync(
|
|
605
624
|
function (pError)
|
|
606
625
|
{
|
|
@@ -612,10 +631,13 @@ suite
|
|
|
612
631
|
try
|
|
613
632
|
{
|
|
614
633
|
_Pict.log.info('Loading the Application and associated views.');
|
|
615
|
-
const
|
|
634
|
+
const tmpUUID = _Pict.getUUID().substring(0, 8);
|
|
635
|
+
const tmpDistinctManifest = _Pict.views.PictFormMetacontroller.createDistinctManifest(tmpManifest, tmpUUID);
|
|
616
636
|
_Pict.log.info('Distinct Manifest:', tmpDistinctManifest);
|
|
637
|
+
Expect(tmpDistinctManifest.Sections[0].Groups[0].RecordSetAddress).to.equal(`LevelOfIndirection_${tmpUUID}.DataTableAddress`, 'Group RecordSetAddress should be preserved in distinct manifest.');
|
|
617
638
|
tmpHashedAggregateValue = Object.entries(tmpDistinctManifest.Descriptors).find(([pKey, pValue]) => pValue.OriginalHash == 'AggregateValue')[0];
|
|
618
639
|
tmpHashedAggregateValue2 = Object.entries(tmpDistinctManifest.Descriptors).find(([pKey, pValue]) => pValue.OriginalHash == 'AggregateValue2')[0];
|
|
640
|
+
tmpHashedAggregateValue3 = Object.entries(tmpDistinctManifest.Descriptors).find(([pKey, pValue]) => pValue.OriginalHash == 'IndirectAggregateValue')[0];
|
|
619
641
|
const tmpInjectedSecionViews = _Pict.views.PictFormMetacontroller.injectManifest(tmpDistinctManifest);
|
|
620
642
|
_Pict.log.info('Injected Section Views:', tmpInjectedSecionViews.length);
|
|
621
643
|
_Pict.views.PictFormMetacontroller.updateMetatemplateInDOM();
|
|
@@ -635,9 +657,10 @@ suite
|
|
|
635
657
|
{
|
|
636
658
|
try
|
|
637
659
|
{
|
|
638
|
-
_Pict.log.info(`AppData after`, { AppData: _Pict.AppData, tmpHashedAggregateValue, tmpHashedAggregateValue2 });
|
|
660
|
+
_Pict.log.info(`AppData after`, { AppData: _Pict.AppData, tmpHashedAggregateValue, tmpHashedAggregateValue2, tmpHashedAggregateValue3 });
|
|
639
661
|
Expect(_Pict.AppData[tmpHashedAggregateValue]).to.equal('15', 'AggregateValue should equal 15 (SUM of ValueArray via hash)');
|
|
640
662
|
Expect(_Pict.AppData[tmpHashedAggregateValue2]).to.equal('15', 'AggregateValue should equal 15 (SUM of ValueArray via address)');
|
|
663
|
+
Expect(_Pict.manifest.getValueByHash(_Pict.AppData, tmpHashedAggregateValue3)).to.equal('15', 'IndirectAggregateValue should equal 15 (via indirection) using manifest method');
|
|
641
664
|
}
|
|
642
665
|
catch (pError)
|
|
643
666
|
{
|