pict 1.0.170 → 1.0.171

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/source/Pict.js +43 -39
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pict",
3
- "version": "1.0.170",
3
+ "version": "1.0.171",
4
4
  "description": "Pict browser library.",
5
5
  "main": "source/Pict.js",
6
6
  "scripts": {
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "cachetrax": "^1.0.4",
49
- "fable": "^3.0.123",
49
+ "fable": "^3.0.124",
50
50
  "pict-application": "^1.0.15",
51
51
  "pict-provider": "^1.0.2",
52
52
  "pict-view": "^1.0.40"
package/source/Pict.js CHANGED
@@ -237,7 +237,7 @@ class Pict extends libFable
237
237
  else
238
238
  {
239
239
  // This is an address, so we need to get the value at the address
240
- tmpEntityID = this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpEntityID);
240
+ tmpEntityID = this.resolveStateFromAddress(tmpEntityID, tmpData);
241
241
  }
242
242
 
243
243
  // No Entity or EntityID
@@ -320,7 +320,7 @@ class Pict extends libFable
320
320
  }
321
321
  else
322
322
  {
323
- return this.parseTemplateByHash(tmpTemplateHash, this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpAddressOfData));
323
+ return this.parseTemplateByHash(tmpTemplateHash, this.resolveStateFromAddress(tmpAddressOfData, tmpData));
324
324
  }
325
325
  };
326
326
  let fTemplateRenderAsync = (pHash, pData, fCallback)=>
@@ -376,7 +376,7 @@ class Pict extends libFable
376
376
  }
377
377
  else
378
378
  {
379
- return this.parseTemplateByHash(tmpTemplateHash, this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpAddressOfData),
379
+ return this.parseTemplateByHash(tmpTemplateHash, this.resolveStateFromAddress(tmpAddressOfData, tmpData),
380
380
  (pError, pValue) =>
381
381
  {
382
382
  if (pError)
@@ -434,7 +434,7 @@ class Pict extends libFable
434
434
  }
435
435
  else
436
436
  {
437
- return this.parseTemplateSetByHash(tmpTemplateHash, this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpAddressOfData));
437
+ return this.parseTemplateSetByHash(tmpTemplateHash, this.resolveStateFromAddress(tmpAddressOfData, tmpData));
438
438
  }
439
439
  };
440
440
  let fTemplateSetRenderAsync = (pHash, pData, fCallback)=>
@@ -475,7 +475,7 @@ class Pict extends libFable
475
475
  }
476
476
 
477
477
  // Now resolve the data
478
- tmpData = this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpAddressOfData);
478
+ tmpData = this.resolveStateFromAddress(tmpAddressOfData, tmpData);
479
479
 
480
480
  if (!tmpData)
481
481
  {
@@ -611,7 +611,7 @@ class Pict extends libFable
611
611
  // Now look up the data at the comparison location
612
612
  try
613
613
  {
614
- let tmpComparisonResult = compareValues(this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpComparisonParts[0]), tmpComparisonParts[1], tmpComparisonParts[2]);
614
+ let tmpComparisonResult = compareValues(this.resolveStateFromAddress(tmpComparisonParts[0], tmpData), tmpComparisonParts[1], tmpComparisonParts[2]);
615
615
  if (!tmpComparisonResult)
616
616
  {
617
617
  return '';
@@ -625,7 +625,7 @@ class Pict extends libFable
625
625
  }
626
626
  else
627
627
  {
628
- return this.parseTemplateByHash(tmpTemplateHash, this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpAddressOfData));
628
+ return this.parseTemplateByHash(tmpTemplateHash, this.resolveStateFromAddress(tmpAddressOfData, tmpData));
629
629
  }
630
630
  }
631
631
  }
@@ -690,7 +690,7 @@ class Pict extends libFable
690
690
  // Now look up the data at the comparison location
691
691
  try
692
692
  {
693
- let tmpComparisonResult = compareValues(this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpComparisonParts[0]), tmpComparisonParts[1], tmpComparisonParts[2]);
693
+ let tmpComparisonResult = compareValues(this.resolveStateFromAddress(tmpComparisonParts[0], tmpData), tmpComparisonParts[1], tmpComparisonParts[2]);
694
694
  if (!tmpComparisonResult)
695
695
  {
696
696
  return tmpCallback(null, '');
@@ -711,7 +711,7 @@ class Pict extends libFable
711
711
  }
712
712
  else
713
713
  {
714
- return this.parseTemplateByHash(tmpTemplateHash, this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpAddressOfData),
714
+ return this.parseTemplateByHash(tmpTemplateHash, this.resolveStateFromAddress(tmpAddressOfData, tmpData),
715
715
  (pError, pValue) =>
716
716
  {
717
717
  if (pError)
@@ -789,9 +789,9 @@ class Pict extends libFable
789
789
  try
790
790
  {
791
791
  let tmpComparisonResult = compareValues(
792
- this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpComparisonParts[0]),
792
+ this.resolveStateFromAddress(tmpComparisonParts[0], tmpData),
793
793
  tmpComparisonParts[1],
794
- this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpComparisonParts[2]));
794
+ this.resolveStateFromAddress(tmpComparisonParts[2], tmpData));
795
795
 
796
796
  if (!tmpComparisonResult)
797
797
  {
@@ -806,7 +806,7 @@ class Pict extends libFable
806
806
  }
807
807
  else
808
808
  {
809
- return this.parseTemplateByHash(tmpTemplateHash, this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpAddressOfData));
809
+ return this.parseTemplateByHash(tmpTemplateHash, this.resolveStateFromAddress(tmpAddressOfData, tmpData));
810
810
  }
811
811
  }
812
812
  }
@@ -873,9 +873,9 @@ class Pict extends libFable
873
873
  {
874
874
  // This is the only thing that's different from the absolute value function above. Collapse these.
875
875
  let tmpComparisonResult = compareValues(
876
- this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpComparisonParts[0]),
876
+ this.resolveStateFromAddress(tmpComparisonParts[0], tmpData),
877
877
  tmpComparisonParts[1],
878
- this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpComparisonParts[2]));
878
+ this.resolveStateFromAddress(tmpComparisonParts[2], tmpData));
879
879
 
880
880
  if (!tmpComparisonResult)
881
881
  {
@@ -897,7 +897,7 @@ class Pict extends libFable
897
897
  }
898
898
  else
899
899
  {
900
- return this.parseTemplateByHash(tmpTemplateHash, this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpAddressOfData),
900
+ return this.parseTemplateByHash(tmpTemplateHash, this.resolveStateFromAddress(tmpAddressOfData, tmpData),
901
901
  (pError, pValue) =>
902
902
  {
903
903
  if (pError)
@@ -958,7 +958,7 @@ class Pict extends libFable
958
958
  return `Pict: Template Render: TemplateHash not resolved for [${tmpHash}]`;
959
959
  }
960
960
 
961
- tmpData = this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpAddressOfData);
961
+ tmpData = this.resolveStateFromAddress(tmpAddressOfData, tmpData);
962
962
 
963
963
  let tmpDataValueSet = [];
964
964
  if (Array.isArray(tmpData))
@@ -1030,7 +1030,7 @@ class Pict extends libFable
1030
1030
  }
1031
1031
 
1032
1032
  // Now resolve the data
1033
- tmpData = this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpAddressOfData);
1033
+ tmpData = this.resolveStateFromAddress(tmpAddressOfData, tmpData);
1034
1034
 
1035
1035
  let tmpDataValueSet = [];
1036
1036
  if (Array.isArray(tmpData))
@@ -1124,8 +1124,8 @@ class Pict extends libFable
1124
1124
  }
1125
1125
 
1126
1126
  // Now resolve the data
1127
- let tmpMap = this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpAddressOfMap);
1128
- let tmpKey = this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpAddressOfKey);
1127
+ let tmpMap = this.resolveStateFromAddress(tmpAddressOfMap, tmpData);
1128
+ let tmpKey = this.resolveStateFromAddress(tmpAddressOfKey, tmpData);
1129
1129
 
1130
1130
  if (!tmpMap)
1131
1131
  {
@@ -1185,8 +1185,8 @@ class Pict extends libFable
1185
1185
  }
1186
1186
 
1187
1187
  // Now resolve the data
1188
- let tmpMap = this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpAddressOfMap);
1189
- let tmpKey = this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpAddressOfKey);
1188
+ let tmpMap = this.resolveStateFromAddress(tmpAddressOfMap, tmpData);
1189
+ let tmpKey = this.resolveStateFromAddress(tmpAddressOfKey, tmpData);
1190
1190
 
1191
1191
  if (!tmpMap)
1192
1192
  {
@@ -1266,8 +1266,8 @@ class Pict extends libFable
1266
1266
  }
1267
1267
 
1268
1268
  // Now resolve the data
1269
- let tmpMap = this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpAddressOfMap);
1270
- let tmpKey = this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpAddressOfKey);
1269
+ let tmpMap = this.resolveStateFromAddress(tmpAddressOfMap, tmpData);
1270
+ let tmpKey = this.resolveStateFromAddress(tmpAddressOfKey, tmpData);
1271
1271
 
1272
1272
  if (!tmpMap)
1273
1273
  {
@@ -1327,8 +1327,8 @@ class Pict extends libFable
1327
1327
  }
1328
1328
 
1329
1329
  // Now resolve the data
1330
- let tmpMap = this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpAddressOfMap);
1331
- let tmpKey = this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpAddressOfKey);
1330
+ let tmpMap = this.resolveStateFromAddress(tmpAddressOfMap, tmpData);
1331
+ let tmpKey = this.resolveStateFromAddress(tmpAddressOfKey, tmpData);
1332
1332
 
1333
1333
  if (!tmpMap)
1334
1334
  {
@@ -1379,10 +1379,9 @@ class Pict extends libFable
1379
1379
  {
1380
1380
  return '';
1381
1381
  }
1382
- tmpData.ResolvedValue = this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpData.ValueTreeParameters[0]);
1382
+ tmpData.ResolvedValue = this.resolveStateFromAddress(tmpData.ValueTreeParameters[0], tmpData);
1383
1383
  tmpData.ResolvedValueType = typeof(tmpData.ResolvedValue);
1384
1384
 
1385
-
1386
1385
  try
1387
1386
  {
1388
1387
  tmpData.TreeMaxDepth = (tmpData.ValueTreeParameters.length < 2) ? 1 : parseInt(tmpData.ValueTreeParameters[1]);
@@ -1499,7 +1498,7 @@ class Pict extends libFable
1499
1498
  let tmpValue = '';
1500
1499
  if (tmpHash != null)
1501
1500
  {
1502
- tmpValue = this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpHash);
1501
+ tmpValue = this.resolveStateFromAddress(tmpHash, tmpData);
1503
1502
  }
1504
1503
  if ((tmpValue == null) || (tmpValue == 'undefined') || (typeof(tmpValue) == 'undefined'))
1505
1504
  {
@@ -1537,7 +1536,7 @@ class Pict extends libFable
1537
1536
  let tmpValueList = [];
1538
1537
  for (let i = 0; i < tmpDataAddresses.length; i++)
1539
1538
  {
1540
- let tmpValueSet = this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpDataAddresses[i]);
1539
+ let tmpValueSet = this.resolveStateFromAddress(tmpDataAddresses[i], tmpData);
1541
1540
  if (tmpValueSet && Array.isArray(tmpValueSet))
1542
1541
  {
1543
1542
  for (let j = 0; j < tmpValueSet.length; j++)
@@ -1582,7 +1581,7 @@ class Pict extends libFable
1582
1581
  let tmpValueMap = {};
1583
1582
  for (let i = 0; i < tmpDataAddresses.length; i++)
1584
1583
  {
1585
- let tmpValue = this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpDataAddresses[i]);
1584
+ let tmpValue = this.resolveStateFromAddress(tmpDataAddresses[i], tmpData);
1586
1585
  if (tmpValue)
1587
1586
  {
1588
1587
  if (!tmpValueMap.hasOwnProperty(tmpValue))
@@ -1613,7 +1612,7 @@ class Pict extends libFable
1613
1612
  this.log.trace(`PICT Template [fDollars]::[${tmpHash}]`);
1614
1613
  }
1615
1614
 
1616
- let tmpColumnData = this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpHash);
1615
+ let tmpColumnData = this.resolveStateFromAddress(tmpHash, tmpData);
1617
1616
  return this.DataFormat.formatterDollars(tmpColumnData);
1618
1617
  });
1619
1618
  this.MetaTemplate.addPattern('{~Digits:', '~}',
@@ -1631,7 +1630,7 @@ class Pict extends libFable
1631
1630
  this.log.trace(`PICT Template [fDigits]::[${tmpHash}]`);
1632
1631
  }
1633
1632
 
1634
- let tmpColumnData = this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpHash);
1633
+ let tmpColumnData = this.resolveStateFromAddress(tmpHash, tmpData);
1635
1634
  return this.DataFormat.formatterAddCommasToNumber(this.DataFormat.formatterRoundNumber(tmpColumnData, 2));
1636
1635
  });
1637
1636
 
@@ -1641,7 +1640,7 @@ class Pict extends libFable
1641
1640
  {
1642
1641
  let tmpHash = pHash.trim();
1643
1642
  let tmpData = (typeof(pData) === 'object') ? pData : {};
1644
- let tmpDateValue = this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpHash);
1643
+ let tmpDateValue = this.resolveStateFromAddress(tmpHash, tmpData);
1645
1644
 
1646
1645
 
1647
1646
  if (this.LogNoisiness > 4)
@@ -1706,7 +1705,7 @@ class Pict extends libFable
1706
1705
  return '';
1707
1706
  }
1708
1707
 
1709
- let tmpDateValue = this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpDateValueSet[0]);
1708
+ let tmpDateValue = this.resolveStateFromAddress(tmpDateValueSet[0], tmpData);
1710
1709
 
1711
1710
  if (this.LogNoisiness > 4)
1712
1711
  {
@@ -1773,7 +1772,7 @@ class Pict extends libFable
1773
1772
  let tmpHashParts = tmpHash.split('|');
1774
1773
 
1775
1774
  // For now just check truthiness
1776
- if (this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpHashParts[0]))
1775
+ if (this.resolveStateFromAddress(tmpHashParts[0], tmpData))
1777
1776
  {
1778
1777
  return tmpHashParts[1];
1779
1778
  }
@@ -1888,7 +1887,7 @@ class Pict extends libFable
1888
1887
  this.log.trace(`PICT Template [fPascalCaseIdentifier]::[${tmpHash}]`);
1889
1888
  }
1890
1889
 
1891
- let tmpValue = this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpHash);
1890
+ let tmpValue = this.resolveStateFromAddress(tmpHash, tmpData);
1892
1891
  if ((tmpValue == null) || (tmpValue == 'undefined') || (typeof(tmpValue) == 'undefined'))
1893
1892
  {
1894
1893
  return '';
@@ -1902,7 +1901,7 @@ class Pict extends libFable
1902
1901
  let tmpHash = pHash.trim();
1903
1902
  let tmpData = (typeof(pData) === 'object') ? pData : {};
1904
1903
 
1905
- let tmpValue = this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpHash);
1904
+ let tmpValue = this.resolveStateFromAddress(tmpHash, tmpData);
1906
1905
  let tmpValueType = typeof(tmpValue);
1907
1906
  if ((tmpValue == null) || (tmpValueType == 'undefined'))
1908
1907
  {
@@ -1932,7 +1931,7 @@ class Pict extends libFable
1932
1931
  {
1933
1932
  return '';
1934
1933
  }
1935
- tmpData.ResolvedValue = this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpData.ValueTreeParameters[0]);
1934
+ tmpData.ResolvedValue = this.resolveStateFromAddress(tmpData.ValueTreeParameters[0], tmpData);
1936
1935
  tmpData.ResolvedValueType = typeof(tmpData.ResolvedValue);
1937
1936
 
1938
1937
 
@@ -2022,6 +2021,11 @@ class Pict extends libFable
2022
2021
  }
2023
2022
  }
2024
2023
 
2024
+ resolveStateFromAddress(pAddress, pRecord)
2025
+ {
2026
+ return this.manifest.getValueByHash({Pict:this, AppData:this.AppData, Bundle:this.Bundle, Record:pRecord}, pAddress);
2027
+ }
2028
+
2025
2029
  parseTemplate (pTemplateString, pData, fCallback)
2026
2030
  {
2027
2031
  let tmpData = (typeof(pData) === 'object') ? pData : {};
@@ -2038,7 +2042,7 @@ class Pict extends libFable
2038
2042
  {
2039
2043
  for (let i = 0; i < this.LogControlFlowWatchAddressList.length; i++)
2040
2044
  {
2041
- this.log.info(`PICT-ControlFlow parseTemplate ${tmpParseUUID} Watch Value: [${this.LogControlFlowWatchAddressList[i]}]=>[${this.manifest.getValueByHash({Pict: this, AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, this.LogControlFlowWatchAddressList[i])}]`);
2045
+ this.log.info(`PICT-ControlFlow parseTemplate ${tmpParseUUID} Watch Value: [${this.LogControlFlowWatchAddressList[i]}]=>[${this.resolveStateFromAddress(this.LogControlFlowWatchAddressList[i], tmpData)}]`);
2042
2046
  }
2043
2047
  }
2044
2048
  }