pict 1.0.106 → 1.0.109
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/debug/examples/simpleApp/index.html +1 -3
- package/dist/pict.compatible.js +20 -14
- package/dist/pict.compatible.min.js +2 -2
- package/dist/pict.compatible.min.js.map +1 -1
- package/dist/pict.js +20 -14
- package/dist/pict.min.js +2 -2
- package/dist/pict.min.js.map +1 -1
- package/package.json +4 -4
- package/source/Pict-Content-Assignment.js +69 -0
package/dist/pict.compatible.js
CHANGED
|
@@ -791,7 +791,8 @@ if(tmpParameters.CurrentPath==libPath.sep){tmpParameters.CurrentPath=tmpParamete
|
|
|
791
791
|
tmpParameters.CurrentPathIndex++;}// Check if the path is fully complete
|
|
792
792
|
if(tmpParameters.CurrentPathIndex>=tmpParameters.ActualPathParts.length){fCallback(null);return true;}// Check if the path exists (and is a folder)
|
|
793
793
|
libFS.open(tmpParameters.CurrentPath+libPath.sep+tmpParameters.ActualPathParts[tmpParameters.CurrentPathIndex],'r',function(pError,pFileDescriptor){if(pFileDescriptor){libFS.closeSync(pFileDescriptor);}if(pError&&pError.code=='ENOENT'){/* Path doesn't exist, create it */libFS.mkdir(tmpParameters.CurrentPath+libPath.sep+tmpParameters.ActualPathParts[tmpParameters.CurrentPathIndex],tmpParameters.Mode,function(pCreateError){if(!pCreateError){// We have now created our folder and there was no error -- continue.
|
|
794
|
-
return _this19.makeFolderRecursive(tmpParameters,fCallback);}else
|
|
794
|
+
return _this19.makeFolderRecursive(tmpParameters,fCallback);}else if(pCreateError.code=='EEXIST'){// The folder exists -- our dev might be running this in parallel/async/whatnot.
|
|
795
|
+
return _this19.makeFolderRecursive(tmpParameters,fCallback);}else{console.log(pCreateError.code);fCallback(pCreateError);return false;}});}else{return _this19.makeFolderRecursive(tmpParameters,fCallback);}});}}]);return FableServiceFilePersistence;}(libFableServiceBase);module.exports=FableServiceFilePersistence;}).call(this);}).call(this,require('_process'));},{"../Fable-ServiceManager.js":39,"_process":77,"fs":18,"path":71}],48:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;/**
|
|
795
796
|
* Precedent Meta-Templating
|
|
796
797
|
* @author Steven Velozo <steven@velozo.com>
|
|
797
798
|
* @description Process text stream trie and postfix tree, parsing out meta-template expression functions.
|
|
@@ -1765,31 +1766,32 @@ var tmpView=typeof tmpViewIdentifier==='string'?this.servicesMap.PictView[tmpVie
|
|
|
1765
1766
|
// After the App initializes, initialize will be called as soon as it's added.
|
|
1766
1767
|
AutoInitialize:true,AutoInitializeOrdinal:0,// If this is set to true, when the App autorenders (on load) this will.
|
|
1767
1768
|
// After the App initializes, render will be called as soon as it's added.
|
|
1768
|
-
AutoRender:true,AutoRenderOrdinal:0,AutoSolveWithApp:true,AutoSolveOrdinal:0,Templates:[],DefaultTemplates:[],Renderables:[],Manifests:{}};var PictView=/*#__PURE__*/function(_libFableServiceBase11){_inherits(PictView,_libFableServiceBase11);var _super21=_createSuper(PictView);function PictView(pFable,pOptions,pServiceHash){var _this37;_classCallCheck2(this,PictView);// Intersect default options, parent constructor, service information
|
|
1769
|
+
AutoRender:true,AutoRenderOrdinal:0,AutoSolveWithApp:true,AutoSolveOrdinal:0,CSSHash:false,CSS:false,CSSProvider:false,CSSPriority:500,Templates:[],DefaultTemplates:[],Renderables:[],Manifests:{}};var PictView=/*#__PURE__*/function(_libFableServiceBase11){_inherits(PictView,_libFableServiceBase11);var _super21=_createSuper(PictView);function PictView(pFable,pOptions,pServiceHash){var _this37;_classCallCheck2(this,PictView);// Intersect default options, parent constructor, service information
|
|
1769
1770
|
var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictViewSettings)),pOptions);_this37=_super21.call(this,pFable,tmpOptions,pServiceHash);if(!_this37.options.ViewIdentifier){_this37.options.ViewIdentifier="AutoViewID-".concat(_this37.fable.getUUID());}_this37.serviceType='PictView';// Convenience and consistency naming
|
|
1770
1771
|
_this37.pict=_this37.fable;// Wire in the essential Pict application state
|
|
1771
|
-
_this37.AppData=_this37.
|
|
1772
|
+
_this37.AppData=_this37.pict.AppData;_this37.initializeTimestamp=false;_this37.lastSolvedTimestamp=false;_this37.lastRenderedTimestamp=false;// Load all templates from the array in the options
|
|
1772
1773
|
// Templates are in the form of {Hash:'Some-Template-Hash',Template:'Template content',Source:'TemplateSource'}
|
|
1773
|
-
for(var i=0;i<_this37.options.Templates.length;i++){var tmpTemplate=_this37.options.Templates[i];if(!tmpTemplate.hasOwnProperty('Hash')||!tmpTemplate.hasOwnProperty('Template')){_this37.log.error("PictView [".concat(_this37.UUID,"]::[").concat(_this37.Hash,"] ").concat(_this37.options.ViewIdentifier," could not load Template ").concat(i," in the options array."),tmpTemplate);}else{if(!tmpTemplate.Source){tmpTemplate.Source="PictView [".concat(_this37.UUID,"]::[").concat(_this37.Hash,"] ").concat(_this37.options.ViewIdentifier," options object.");}_this37.
|
|
1774
|
+
for(var i=0;i<_this37.options.Templates.length;i++){var tmpTemplate=_this37.options.Templates[i];if(!tmpTemplate.hasOwnProperty('Hash')||!tmpTemplate.hasOwnProperty('Template')){_this37.log.error("PictView [".concat(_this37.UUID,"]::[").concat(_this37.Hash,"] ").concat(_this37.options.ViewIdentifier," could not load Template ").concat(i," in the options array."),tmpTemplate);}else{if(!tmpTemplate.Source){tmpTemplate.Source="PictView [".concat(_this37.UUID,"]::[").concat(_this37.Hash,"] ").concat(_this37.options.ViewIdentifier," options object.");}_this37.pict.TemplateProvider.addTemplate(tmpTemplate.Hash,tmpTemplate.Template,tmpTemplate.Source);}}// Load all default templates from the array in the options
|
|
1774
1775
|
// Templates are in the form of {Prefix:'',Postfix:'-List-Row',Template:'Template content',Source:'TemplateSourceString'}
|
|
1775
|
-
for(var _i16=0;_i16<_this37.options.DefaultTemplates.length;_i16++){var tmpDefaultTemplate=_this37.options.DefaultTemplates[_i16];if(!tmpDefaultTemplate.hasOwnProperty('Postfix')||!tmpDefaultTemplate.hasOwnProperty('Template')){_this37.log.error("PictView [".concat(_this37.UUID,"]::[").concat(_this37.Hash,"] ").concat(_this37.options.ViewIdentifier," could not load Default Template ").concat(_i16," in the options array."),tmpDefaultTemplate);}else{if(!tmpDefaultTemplate.Source){tmpDefaultTemplate.Source="PictView [".concat(_this37.UUID,"]::[").concat(_this37.Hash,"] ").concat(_this37.options.ViewIdentifier," options object.");}_this37.
|
|
1776
|
+
for(var _i16=0;_i16<_this37.options.DefaultTemplates.length;_i16++){var tmpDefaultTemplate=_this37.options.DefaultTemplates[_i16];if(!tmpDefaultTemplate.hasOwnProperty('Postfix')||!tmpDefaultTemplate.hasOwnProperty('Template')){_this37.log.error("PictView [".concat(_this37.UUID,"]::[").concat(_this37.Hash,"] ").concat(_this37.options.ViewIdentifier," could not load Default Template ").concat(_i16," in the options array."),tmpDefaultTemplate);}else{if(!tmpDefaultTemplate.Source){tmpDefaultTemplate.Source="PictView [".concat(_this37.UUID,"]::[").concat(_this37.Hash,"] ").concat(_this37.options.ViewIdentifier," options object.");}_this37.pict.TemplateProvider.addDefaultTemplate(tmpDefaultTemplate.Prefix,tmpDefaultTemplate.Postfix,tmpDefaultTemplate.Template,tmpDefaultTemplate.Source);}}// Load the CSS if it's available
|
|
1777
|
+
if(_this37.options.CSS){var tmpCSSHash=_this37.options.CSSHash?_this37.options.CSSHash:"View-".concat(_this37.options.ViewIdentifier);var tmpCSSProvider=_this37.options.CSSProvider?_this37.options.CSSProvider:tmpCSSHash;_this37.pict.CSSMap.addCSS(tmpCSSHash,_this37.options.CSS,tmpCSSProvider,_this37.options.CSSPriority);}// Load all renderables
|
|
1776
1778
|
// Renderables are launchable renderable instructions with templates
|
|
1777
1779
|
// They look as such: {Identifier:'ContentEntry', TemplateHash:'Content-Entry-Section-Main', ContentDestinationAddress:'#ContentSection', RecordAddress:'AppData.Content.DefaultText', ManifestTransformation:'ManyfestHash', ManifestDestinationAddress:'AppData.Content.DataToTransformContent'}
|
|
1778
1780
|
// The only parts that are necessary are Identifier and Template
|
|
1779
1781
|
// A developer can then do render('ContentEntry') and it just kinda works. Or they can override the ContentDestinationAddress
|
|
1780
1782
|
_this37.renderables={};for(var _i17=0;_i17<_this37.options.Renderables.length;_i17++){var tmpRenderable=_this37.options.Renderables[_i17];_this37.addRenderable(_this37.options.Renderables[_i17]);}return _this37;}_createClass2(PictView,[{key:"addRenderable",value:function addRenderable(pRenderableHash,pTemplateHash,pDefaultTemplateDataAddress,pDefaultDestinationAddress){var tmpRenderable=false;if(_typeof(pRenderableHash)=='object'){// The developer passed in the renderable as an object.
|
|
1781
1783
|
// Use theirs instead!
|
|
1782
|
-
tmpRenderable=pRenderableHash;}else{tmpRenderable={RenderableHash:pRenderableHash,TemplateHash:pTemplateHash,DefaultTemplateDataAddress:pDefaultTemplateDataAddress,DefaultDestinationAddress:pDefaultDestinationAddress};}if(typeof tmpRenderable.RenderableHash!='string'||typeof tmpRenderable.TemplateHash!='string'){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not load Renderable; RenderableHash or TemplateHash are invalid."),tmpRenderable);}else{if(this.pict.LogNoisiness>0){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," adding renderable [").concat(tmpRenderable.RenderableHash,"] pointed to template ").concat(tmpRenderable.TemplateHash,"."));}this.renderables[tmpRenderable.RenderableHash]=tmpRenderable;}}},{key:"onBeforeSolve",value:function onBeforeSolve(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeSolve:"));}return true;}},{key:"onBeforeSolveAsync",value:function onBeforeSolveAsync(fCallback){this.onBeforeSolve();return fCallback();}},{key:"onSolve",value:function onSolve(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onSolve:"));}return true;}},{key:"onSolveAsync",value:function onSolveAsync(fCallback){this.onSolve();return fCallback();}},{key:"solve",value:function solve(){if(this.pict.LogNoisiness>2){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," executing solve() function..."));}this.onBeforeSolve();this.onSolve();this.onAfterSolve();this.lastSolvedTimestamp=this.
|
|
1784
|
+
tmpRenderable=pRenderableHash;}else{tmpRenderable={RenderableHash:pRenderableHash,TemplateHash:pTemplateHash,DefaultTemplateDataAddress:pDefaultTemplateDataAddress,DefaultDestinationAddress:pDefaultDestinationAddress};}if(typeof tmpRenderable.RenderableHash!='string'||typeof tmpRenderable.TemplateHash!='string'){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not load Renderable; RenderableHash or TemplateHash are invalid."),tmpRenderable);}else{if(this.pict.LogNoisiness>0){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," adding renderable [").concat(tmpRenderable.RenderableHash,"] pointed to template ").concat(tmpRenderable.TemplateHash,"."));}this.renderables[tmpRenderable.RenderableHash]=tmpRenderable;}}},{key:"onBeforeSolve",value:function onBeforeSolve(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeSolve:"));}return true;}},{key:"onBeforeSolveAsync",value:function onBeforeSolveAsync(fCallback){this.onBeforeSolve();return fCallback();}},{key:"onSolve",value:function onSolve(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onSolve:"));}return true;}},{key:"onSolveAsync",value:function onSolveAsync(fCallback){this.onSolve();return fCallback();}},{key:"solve",value:function solve(){if(this.pict.LogNoisiness>2){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," executing solve() function..."));}this.onBeforeSolve();this.onSolve();this.onAfterSolve();this.lastSolvedTimestamp=this.pict.log.getTimeStamp();return true;}},{key:"solveAsync",value:function solveAsync(fCallback){var _this38=this;var tmpAnticipate=this.pict.serviceManager.instantiateServiceProviderWithoutRegistration('Anticipate');tmpAnticipate.anticipate(this.onBeforeSolveAsync.bind(this));tmpAnticipate.anticipate(this.onSolveAsync.bind(this));tmpAnticipate.anticipate(this.onAfterSolveAsync.bind(this));tmpAnticipate.wait(function(pError){if(_this38.pict.LogNoisiness>2){_this38.log.trace("PictView [".concat(_this38.UUID,"]::[").concat(_this38.Hash,"] ").concat(_this38.options.ViewIdentifier," solveAsync() complete."));}_this38.lastSolvedTimestamp=_this38.pict.log.getTimeStamp();return fCallback(pError);});}},{key:"onAfterSolve",value:function onAfterSolve(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterSolve:"));}return true;}},{key:"onAfterSolveAsync",value:function onAfterSolveAsync(fCallback){this.onAfterSolve();return fCallback();}},{key:"onBeforeInitialize",value:function onBeforeInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeInitialize:"));}return true;}},{key:"onBeforeInitializeAsync",value:function onBeforeInitializeAsync(fCallback){this.onBeforeInitialize();return fCallback();}},{key:"onInitialize",value:function onInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onInitialize:"));}return true;}},{key:"onInitializeAsync",value:function onInitializeAsync(fCallback){this.onInitialize();return fCallback();}},{key:"initialize",value:function initialize(){if(!this.initializeTimestamp){this.onBeforeInitialize();this.onInitialize();this.onAfterInitialize();this.initializeTimestamp=this.pict.log.getTimeStamp();return true;}else{this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," initialize called but initialization is already completed. Aborting."));return false;}}},{key:"initializeAsync",value:function initializeAsync(fCallback){var _this39=this;if(!this.initializeTimestamp){var tmpAnticipate=this.pict.serviceManager.instantiateServiceProviderWithoutRegistration('Anticipate');if(this.pict.LogNoisiness>0){this.log.info("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," beginning initialization..."));}tmpAnticipate.anticipate(this.onBeforeInitializeAsync.bind(this));tmpAnticipate.anticipate(this.onInitializeAsync.bind(this));tmpAnticipate.anticipate(this.onAfterInitializeAsync.bind(this));tmpAnticipate.wait(function(pError){_this39.initializeTimestamp=_this39.pict.log.getTimeStamp();if(_this39.pict.LogNoisiness>0){_this39.log.info("PictView [".concat(_this39.UUID,"]::[").concat(_this39.Hash,"] ").concat(_this39.options.ViewIdentifier," initialization complete."));}return fCallback();});}else{this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," async initialize called but initialization is already completed. Aborting."));// TODO: Should this be an error?
|
|
1783
1785
|
return fCallback();}}},{key:"onAfterInitialize",value:function onAfterInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterInitialize:"));}return true;}},{key:"onAfterInitializeAsync",value:function onAfterInitializeAsync(fCallback){this.onAfterInitialize();return fCallback();}},{key:"onBeforeRender",value:function onBeforeRender(pRenderable,pRenderDestinationAddress,pData){// Overload this to mess with stuff before the content gets generated from the template
|
|
1784
|
-
if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeRender:"));}return true;}},{key:"onBeforeRenderAsync",value:function onBeforeRenderAsync(pRenderable,pRenderDestinationAddress,pData,fCallback){this.onBeforeRender(pRenderable,pRenderDestinationAddress,pData);return fCallback();}},{key:"render",value:function render(pRenderable,pRenderDestinationAddress,pTemplateDataAddress){var tmpRenderableHash=typeof pRenderable==='string'?pRenderable:typeof this.options.DefaultRenderable=='string'?this.options.DefaultRenderable:false;if(!tmpRenderableHash){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it is not a valid renderable."));return false;}var tmpRenderable=this.renderables[tmpRenderableHash];if(!tmpRenderable){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not exist."));return false;}var tmpRenderDestinationAddress=typeof pRenderDestinationAddress==='string'?pRenderDestinationAddress:typeof tmpRenderable.ContentDestinationAddress==='string'?tmpRenderable.ContentDestinationAddress:typeof this.options.DefaultDestinationAddress==='string'?this.options.DefaultDestinationAddress:false;if(!tmpRenderDestinationAddress){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not have a valid destination address."));return false;}var tmpDataAddress=typeof pTemplateDataAddress==='string'?pTemplateDataAddress:typeof tmpRenderable.DefaultTemplateRecordAddress==='string'?tmpRenderable.DefaultTemplateRecordAddress:typeof this.options.DefaultTemplateRecordAddress==='string'?this.options.DefaultTemplateRecordAddress:false;var tmpData=typeof tmpDataAddress==='string'?this.
|
|
1786
|
+
if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeRender:"));}return true;}},{key:"onBeforeRenderAsync",value:function onBeforeRenderAsync(pRenderable,pRenderDestinationAddress,pData,fCallback){this.onBeforeRender(pRenderable,pRenderDestinationAddress,pData);return fCallback();}},{key:"render",value:function render(pRenderable,pRenderDestinationAddress,pTemplateDataAddress){var tmpRenderableHash=typeof pRenderable==='string'?pRenderable:typeof this.options.DefaultRenderable=='string'?this.options.DefaultRenderable:false;if(!tmpRenderableHash){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it is not a valid renderable."));return false;}var tmpRenderable=this.renderables[tmpRenderableHash];if(!tmpRenderable){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not exist."));return false;}var tmpRenderDestinationAddress=typeof pRenderDestinationAddress==='string'?pRenderDestinationAddress:typeof tmpRenderable.ContentDestinationAddress==='string'?tmpRenderable.ContentDestinationAddress:typeof this.options.DefaultDestinationAddress==='string'?this.options.DefaultDestinationAddress:false;if(!tmpRenderDestinationAddress){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not have a valid destination address."));return false;}var tmpDataAddress=typeof pTemplateDataAddress==='string'?pTemplateDataAddress:typeof tmpRenderable.DefaultTemplateRecordAddress==='string'?tmpRenderable.DefaultTemplateRecordAddress:typeof this.options.DefaultTemplateRecordAddress==='string'?this.options.DefaultTemplateRecordAddress:false;var tmpData=typeof tmpDataAddress==='string'?this.pict.DataProvider.getDataByAddress(tmpDataAddress):undefined;// Execute the developer-overridable pre-render behavior
|
|
1785
1787
|
this.onBeforeRender(tmpRenderable,tmpRenderDestinationAddress,tmpData);// Generate the content output from the template and data
|
|
1786
|
-
var tmpContent=this.
|
|
1787
|
-
this.
|
|
1788
|
-
this.onAfterRender(tmpRenderable,tmpRenderDestinationAddress,tmpData,tmpContent);this.lastRenderedTimestamp=this.
|
|
1788
|
+
var tmpContent=this.pict.parseTemplateByHash(tmpRenderable.TemplateHash,tmpData);// Assign the content to the destination address
|
|
1789
|
+
this.pict.ContentAssignment.assignContent(tmpRenderDestinationAddress,tmpContent);// Execute the developer-overridable post-render behavior
|
|
1790
|
+
this.onAfterRender(tmpRenderable,tmpRenderDestinationAddress,tmpData,tmpContent);this.lastRenderedTimestamp=this.pict.log.getTimeStamp();}},{key:"renderAsync",value:function renderAsync(pRenderable,pRenderDestinationAddress,pTemplateDataAddress,fCallback){var _this40=this;var tmpRenderableHash=typeof pRenderable==='string'?pRenderable:false;if(!tmpRenderableHash){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not asynchronously render ").concat(tmpRenderableHash," (param ").concat(pRenderable,"because it is not a valid renderable."));return fCallback(Error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not asynchronously render ").concat(tmpRenderableHash," (param ").concat(pRenderable,"because it is not a valid renderable.")));}var tmpRenderable=this.renderables[tmpRenderableHash];if(!tmpRenderable){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not exist."));return fCallback(Error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not exist.")));}var tmpRenderDestinationAddress=typeof pRenderDestinationAddress==='string'?pRenderDestinationAddress:typeof tmpRenderable.ContentDestinationAddress==='string'?tmpRenderable.ContentDestinationAddress:typeof this.options.DefaultDestinationAddress==='string'?this.options.DefaultDestinationAddress:false;if(!tmpRenderDestinationAddress){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not have a valid destination address."));return fCallback(Error("Could not render ".concat(tmpRenderableHash)));}var tmpDataAddress=typeof pTemplateDataAddress==='string'?pTemplateDataAddress:typeof tmpRenderable.DefaultTemplateRecordAddress==='string'?tmpRenderable.DefaultTemplateRecordAddress:typeof this.options.DefaultTemplateRecordAddress==='string'?this.options.DefaultTemplateRecordAddress:false;var tmpData=typeof tmpDataAddress==='string'?this.pict.DataProvider.getDataByAddress(tmpDataAddress):undefined;// Execute the developer-overridable pre-render behavior
|
|
1789
1791
|
this.onBeforeRender(tmpRenderable,tmpRenderDestinationAddress,tmpData);// Render the template (asynchronously)
|
|
1790
|
-
this.
|
|
1791
|
-
_this40.
|
|
1792
|
-
_this40.onAfterRender(tmpRenderable,tmpRenderDestinationAddress,tmpData,pContent);_this40.lastRenderedTimestamp=_this40.
|
|
1792
|
+
this.pict.parseTemplateByHash(tmpRenderable.TemplateHash,tmpData,function(pError,pContent){if(pError){_this40.log.error("PictView [".concat(_this40.UUID,"]::[").concat(_this40.Hash,"] ").concat(_this40.options.ViewIdentifier," could not render (asynchronously) ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it did not parse the template."),pError);return fCallback(pError);}// Assign the content to the destination address
|
|
1793
|
+
_this40.pict.ContentAssignment.assignContent(tmpRenderDestinationAddress,pContent);// Execute the developer-overridable post-render behavior
|
|
1794
|
+
_this40.onAfterRender(tmpRenderable,tmpRenderDestinationAddress,tmpData,pContent);_this40.lastRenderedTimestamp=_this40.pict.log.getTimeStamp();return fCallback(null,pContent);});}},{key:"onAfterRender",value:function onAfterRender(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterRender:"));}return true;}},{key:"onAfterRenderAsync",value:function onAfterRenderAsync(fCallback){this.onAfterRender();return fCallback();}}]);return PictView;}(libFableServiceBase);module.exports=PictView;},{"fable-serviceproviderbase":33}],74:[function(require,module,exports){/**
|
|
1793
1795
|
* Precedent Meta-Templating
|
|
1794
1796
|
*
|
|
1795
1797
|
* @license MIT
|
|
@@ -3030,7 +3032,11 @@ tmpTargetElement.html(pContent);//}
|
|
|
3030
3032
|
this.log.trace("PICT Content ASSIGN to [".concat(pAddress,"]:"),pContent);}}},{key:"appendContent",value:function appendContent(pAddress,pContent){if(this.customAppendFunction){return this.customAppendFunction(pAddress,pContent);}else if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.append(pContent);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].insertAdjacentHTML("beforeend",pContent);}}else{// Just log it out for now -- nothing browser in our mix.
|
|
3031
3033
|
this.log.trace("PICT Content APPEND to [".concat(pAddress,"]:"),pContent);}}},{key:"prependContent",value:function prependContent(pAddress,pContent){if(this.customAppendFunction){return this.customPrependFunction(pAddress,pContent);}else if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.prepend(pContent);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].insertAdjacentHTML("afterbegin",pContent);}}else{// Just log it out for now -- nothing browser in our mix.
|
|
3032
3034
|
this.log.trace("PICT Content PREPEND in [".concat(pAddress,"]:"),pContent);}}},{key:"readContent",value:function readContent(pAddress){if(this.customReadFunction){return this.customReadFunction(pAddress);}else if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);return tmpTargetElement.html();}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);if(tmpTargetElementSet.length<1){return null;}else if(tmpTargetElementSet.length==1){if(tmpTargetElementSet[0].tagName=='INPUT'||tmpTargetElementSet[0].tagName=='TEXTAREA'){return tmpTargetElementSet[0].value;}else if(tmpTargetElementSet[0].tagName=='SCRIPT'){return tmpTargetElementSet[0].text;}else{return tmpTargetElementSet[0].innerHTML;}}}else{// Just log it out for now -- nothing browser in our mix.
|
|
3033
|
-
this.log.trace("PICT Content READ from [".concat(pAddress,"]..."));return'';}}}
|
|
3035
|
+
this.log.trace("PICT Content READ from [".concat(pAddress,"]..."));return'';}}},{key:"addClass",value:function addClass(pAddress,pClass){if(this.customAddClassFunction){return this.customAddClassFunction(pAddress,pClass);}else if(this.hasJquery){// Get the element
|
|
3036
|
+
var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.addClass(pClass);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].classList.add(pClass);}}else{this.log.trace("PICT Content ADDCLASS to [".concat(pAddress,"]:"),pClass);}}},{key:"removeClass",value:function removeClass(pAddress,pClass){if(this.customRemoveClassFunction){return this.customRemoveClassFunction(pAddress,pClass);}else if(this.hasJquery){// Get the element
|
|
3037
|
+
var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.removeClass(pClass);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].classList.remove(pClass);}}else{this.log.trace("PICT Content REMOVECLASS from [".concat(pAddress,"]:"),pClass);}}},{key:"toggleClass",value:function toggleClass(pAddress,pClass){// STUB
|
|
3038
|
+
}},{key:"hasClass",value:function hasClass(pAddress,pClass){// STUB
|
|
3039
|
+
}}]);return PictContentAssignment;}(libFableServiceBase);module.exports=PictContentAssignment;},{"fable":40}],113:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictDataProvider=/*#__PURE__*/function(_libFableServiceBase14){_inherits(PictDataProvider,_libFableServiceBase14);var _super24=_createSuper(PictDataProvider);function PictDataProvider(pFable,pOptions,pServiceHash){var _this44;_classCallCheck2(this,PictDataProvider);_this44=_super24.call(this,pFable,pOptions,pServiceHash);_this44.serviceType='PictDataProvider';return _this44;}_createClass2(PictDataProvider,[{key:"getDataByAddress",value:function getDataByAddress(pAddress,pData){var tmpData=typeof pData==='undefined'?{}:pData;return this.fable.manifest.getValueByHash({AppData:this.AppData,Bundle:this.Bundle,Record:tmpData},pAddress);}}]);return PictDataProvider;}(libFableServiceBase);module.exports=PictDataProvider;},{"fable":40}],114:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictMeadowEntityProvider=/*#__PURE__*/function(_libFableServiceBase15){_inherits(PictMeadowEntityProvider,_libFableServiceBase15);var _super25=_createSuper(PictMeadowEntityProvider);function PictMeadowEntityProvider(pFable,pOptions,pServiceHash){var _this45;_classCallCheck2(this,PictMeadowEntityProvider);_this45=_super25.call(this,pFable,pOptions,pServiceHash);_defineProperty2(_assertThisInitialized(_this45),"getEntitySet",function(pEntity,pMeadowFilterExpression,fCallback){var _this46=this;this.initializeCache(pEntity);// TODO: Should we test for too many record IDs here by string length?
|
|
3034
3040
|
// FBL~ID${pDestinationEntity}~INN~${tmpIDRecordsCommaSeparated}
|
|
3035
3041
|
// Discard anything from the cache that has expired or is over size.
|
|
3036
3042
|
this.cache[pEntity].prune(function(){var tmpCountOptions={url:"".concat(_this46.options.urlPrefix).concat(pEntity,"s/Count/FilteredTo/").concat(pMeadowFilterExpression)};tmpCountOptions=_this46.prepareRequestOptions(tmpCountOptions);return _this46.restClient.getJSON(tmpCountOptions,function(pError,pResponse,pBody){if(pError){_this46.log.error("Error getting bulk entity count of [".concat(pEntity,"] filtered to [").concat(pMeadowFilterExpression,"] from server [").concat(tmpCountOptions.url,"]: ").concat(pError));return fCallback(pError);}var tmpRecordCount=0;if(pBody.Count){tmpRecordCount=pBody.Count;}var tmpDownloadURIFragments=[];var tmpDownloadBatchSize=_this46.options.downloadBatchSize;for(var i=0;i<tmpRecordCount/tmpDownloadBatchSize;i++){// Generate each of the URI fragments to download
|