pict-section-formeditor 1.0.3 → 1.0.4
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/example_applications/form_editor/html/form_editor_example.js +1492 -220
- package/package.json +2 -1
- package/source/Pict-Section-FormEditor-DefaultConfiguration.js +95 -0
- package/source/Pict-Section-FormEditor.js +3 -0
- package/source/providers/Pict-Provider-FormEditorUtilities.js +20 -2
- package/source/views/PictView-FormEditor-PropertiesPanel.js +76 -4
- package/source/views/PictView-FormEditor.js +264 -0
- package/test/Pict-Section-FormEditor_tests.js +267 -0
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
const _ManifestList=[{Name:'New Form',File:false},{Name:'Simple Form',File:'manifests/Simple-Form.json'},{Name:'Simple Table',File:'manifests/Simple-Table.json'},{Name:'Complex Table',File:'manifests/Complex-Table.json'},{Name:'Manyfest Editor',File:'manifests/Manyfest-Editor.json'},{Name:'Gradebook - Student',File:'manifests/Gradebook-Student.json'},{Name:'Gradebook - Assignment',File:'manifests/Gradebook-Assignment.json'},{Name:'Distill (Entity Bundles)',File:'manifests/Distill-Example.json'}];class FormEditorExampleApplication extends libPictApplication{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this._ManifestList=_ManifestList;this._FormEditorView=null;this._DragDropEnabled=false;this._ShowHashes=false;}onAfterInitializeAsync(fCallback){// Start with an empty manifest; the first sample will be loaded after render
|
|
3
3
|
this.pict.AppData.FormConfig={Scope:'NewForm',Sections:[],Descriptors:{}};// Store the manifest list for the selector template
|
|
4
4
|
this.pict.AppData.ManifestList=this._ManifestList;// Add the FormEditor view
|
|
5
|
-
this._FormEditorView=this.pict.addView('FormEditor',{ViewIdentifier:'FormEditor',ManifestDataAddress:'AppData.FormConfig',DefaultDestinationAddress:'#FormEditor-Container',ActiveTab:'visual',Renderables:[{RenderableHash:'FormEditor-Container',TemplateHash:'FormEditor-Container-Template',DestinationAddress:'#FormEditor-Container',RenderMethod:'replace'}]},libPictSectionFormEditor);this._FormEditorView.initialize();this._FormEditorView.render();// Wire up the
|
|
6
|
-
let tmpSelf=this;this._FormEditorView.
|
|
5
|
+
this._FormEditorView=this.pict.addView('FormEditor',{ViewIdentifier:'FormEditor',ManifestDataAddress:'AppData.FormConfig',DefaultDestinationAddress:'#FormEditor-Container',ActiveTab:'visual',Renderables:[{RenderableHash:'FormEditor-Container',TemplateHash:'FormEditor-Container-Template',DestinationAddress:'#FormEditor-Container',RenderMethod:'replace'}]},libPictSectionFormEditor);this._FormEditorView.initialize();this._FormEditorView.render();// Wire up the import event to add extra manifests to the selector
|
|
6
|
+
let tmpSelf=this;this._FormEditorView.onImport=function(pManifests,pFileName){tmpSelf._handleImportedManifests(pManifests,pFileName);};// Render the selector bar
|
|
7
7
|
this.renderSelector();// Load the first file-based sample by default
|
|
8
8
|
let tmpDefaultIndex=1;let tmpSelect=document.getElementById('FormEditor-ManifestSelect');if(tmpSelect){tmpSelect.value=String(tmpDefaultIndex);}this.loadManifest(tmpDefaultIndex);return super.onAfterInitializeAsync(fCallback);}renderSelector(){let tmpHTML='';tmpHTML+='<div class="pict-fe-selector-bar">';tmpHTML+='<label class="pict-fe-selector-label" for="FormEditor-ManifestSelect">Load Configuration:</label>';tmpHTML+='<select class="pict-fe-selector-select" id="FormEditor-ManifestSelect">';for(let i=0;i<this._ManifestList.length;i++){tmpHTML+=`<option value="${i}">${this._escapeHTML(this._ManifestList[i].Name)}</option>`;}tmpHTML+='</select>';tmpHTML+=`<button class="pict-fe-selector-btn" onclick="${this.pict.browserAddress}.PictApplication.loadSelectedManifest()">Load</button>`;tmpHTML+=`<button class="pict-fe-selector-btn" id="FormEditor-DragDropToggle" onclick="${this.pict.browserAddress}.PictApplication.toggleDragAndDrop()" style="margin-left:auto; background:#8A7F72;">Enable Drag & Drop</button>`;tmpHTML+=`<button class="pict-fe-selector-btn" id="FormEditor-DisplayModeToggle" onclick="${this.pict.browserAddress}.PictApplication.toggleDisplayMode()" style="background:#8A7F72;">Show Hashes</button>`;tmpHTML+='</div>';this.pict.ContentAssignment.assignContent('#FormEditor-Selector',tmpHTML);}toggleDragAndDrop(){this._DragDropEnabled=!this._DragDropEnabled;if(this._FormEditorView){this._FormEditorView._DragDropProvider.setDragAndDropEnabled(this._DragDropEnabled);}let tmpToggleBtn=document.getElementById('FormEditor-DragDropToggle');if(tmpToggleBtn){tmpToggleBtn.textContent=this._DragDropEnabled?'Disable Drag & Drop':'Enable Drag & Drop';tmpToggleBtn.style.background=this._DragDropEnabled?'#E76F51':'#8A7F72';}}toggleDisplayMode(){this._ShowHashes=!this._ShowHashes;if(this._FormEditorView){this._FormEditorView._UtilitiesProvider.setInputDisplayMode(this._ShowHashes?'hash':'name');}let tmpToggleBtn=document.getElementById('FormEditor-DisplayModeToggle');if(tmpToggleBtn){tmpToggleBtn.textContent=this._ShowHashes?'Show Names':'Show Hashes';tmpToggleBtn.style.background=this._ShowHashes?'#5B6E5D':'#8A7F72';}}loadSelectedManifest(){let tmpSelect=document.getElementById('FormEditor-ManifestSelect');if(tmpSelect){this.loadManifest(parseInt(tmpSelect.value,10));}}loadManifest(pIndex){if(pIndex<0||pIndex>=this._ManifestList.length){return;}let tmpEntry=this._ManifestList[pIndex];if(tmpEntry.ManifestData){// Directly loaded manifest (e.g. from CSV import)
|
|
9
9
|
this.pict.AppData.FormConfig=tmpEntry.ManifestData;this._refreshEditor();return;}if(!tmpEntry.File){// "New Form" — empty manifest
|
|
10
10
|
this.pict.AppData.FormConfig={Scope:'NewForm',Sections:[],Descriptors:{}};this._refreshEditor();return;}// Fetch the manifest JSON
|
|
11
|
-
let tmpXHR=new XMLHttpRequest();tmpXHR.open('GET',tmpEntry.File,true);tmpXHR.onreadystatechange=()=>{if(tmpXHR.readyState===4){if(tmpXHR.status===200){try{this.pict.AppData.FormConfig=JSON.parse(tmpXHR.responseText);this._refreshEditor();}catch(pError){this.log.error(`Error parsing manifest JSON from ${tmpEntry.File}: ${pError.message}`);}}else{this.log.error(`Error loading manifest from ${tmpEntry.File}: HTTP ${tmpXHR.status}`);}}};tmpXHR.send();}
|
|
12
|
-
let
|
|
13
|
-
|
|
11
|
+
let tmpXHR=new XMLHttpRequest();tmpXHR.open('GET',tmpEntry.File,true);tmpXHR.onreadystatechange=()=>{if(tmpXHR.readyState===4){if(tmpXHR.status===200){try{this.pict.AppData.FormConfig=JSON.parse(tmpXHR.responseText);this._refreshEditor();}catch(pError){this.log.error(`Error parsing manifest JSON from ${tmpEntry.File}: ${pError.message}`);}}else{this.log.error(`Error loading manifest from ${tmpEntry.File}: HTTP ${tmpXHR.status}`);}}};tmpXHR.send();}_handleImportedManifests(pManifests,pFileName){let tmpManifestKeys=Object.keys(pManifests);if(tmpManifestKeys.length<=1){return;}// Determine the source label from the file extension
|
|
12
|
+
let tmpSourceLabel=pFileName.toLowerCase().endsWith('.json')?'JSON':'CSV';// Add additional manifests (beyond the first which was auto-loaded) to the selector
|
|
13
|
+
for(let i=1;i<tmpManifestKeys.length;i++){let tmpKey=tmpManifestKeys[i];let tmpFormName=pManifests[tmpKey].FormName||tmpKey;let tmpEntry={Name:`${tmpSourceLabel}: ${tmpFormName}`,File:false,ManifestData:pManifests[tmpKey]};this._ManifestList.push(tmpEntry);}// Re-render the selector to show new entries
|
|
14
|
+
this.renderSelector();}loadManifestDirect(pManifestData){this.pict.AppData.FormConfig=pManifestData;this._refreshEditor();}_refreshEditor(){if(this._FormEditorView){this._FormEditorView.render();}}_escapeHTML(pString){if(typeof pString!=='string'){return'';}return pString.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"');}}module.exports=FormEditorExampleApplication;module.exports.default_configuration={Name:'FormEditorExample',Hash:'FormEditorExample',MainViewportViewIdentifier:'FormEditor',AutoSolveAfterInitialize:false,AutoRenderMainViewportViewAfterInitialize:false,pict_configuration:{Product:'FormEditorExample'}};},{"../../source/Pict-Section-FormEditor.js":355,"pict":254,"pict-application":142}],2:[function(require,module,exports){'use strict';var eachOfLimit=require('async.util.eachoflimit');var withoutIndex=require('async.util.withoutindex');module.exports=function eachLimit(arr,limit,iterator,cb){return eachOfLimit(limit)(arr,withoutIndex(iterator),cb);};},{"async.util.eachoflimit":4,"async.util.withoutindex":15}],3:[function(require,module,exports){'use strict';module.exports=function(tasks){function makeCallback(index){function fn(){if(tasks.length){tasks[index].apply(null,arguments);}return fn.next();}fn.next=function(){return index<tasks.length-1?makeCallback(index+1):null;};return fn;}return makeCallback(0);};},{}],4:[function(require,module,exports){var once=require('async.util.once');var noop=require('async.util.noop');var onlyOnce=require('async.util.onlyonce');var keyIterator=require('async.util.keyiterator');module.exports=function eachOfLimit(limit){return function(obj,iterator,cb){cb=once(cb||noop);obj=obj||[];var nextKey=keyIterator(obj);if(limit<=0){return cb(null);}var done=false;var running=0;var errored=false;(function replenish(){if(done&&running<=0){return cb(null);}while(running<limit&&!errored){var key=nextKey();if(key===null){done=true;if(running<=0){cb(null);}return;}running+=1;iterator(obj[key],key,onlyOnce(function(err){running-=1;if(err){cb(err);errored=true;}else{replenish();}}));}})();};};},{"async.util.keyiterator":8,"async.util.noop":10,"async.util.once":11,"async.util.onlyonce":12}],5:[function(require,module,exports){'use strict';var setImmediate=require('async.util.setimmediate');var restParam=require('async.util.restparam');module.exports=function(fn){return restParam(function(args){var callback=args.pop();args.push(function(){var innerArgs=arguments;if(sync){setImmediate(function(){callback.apply(null,innerArgs);});}else{callback.apply(null,innerArgs);}});var sync=true;fn.apply(this,args);sync=false;});};},{"async.util.restparam":13,"async.util.setimmediate":14}],6:[function(require,module,exports){'use strict';module.exports=Array.isArray||function isArray(obj){return Object.prototype.toString.call(obj)==='[object Array]';};},{}],7:[function(require,module,exports){'use strict';var isArray=require('async.util.isarray');module.exports=function isArrayLike(arr){return isArray(arr)||// has a positive integer length property
|
|
14
15
|
typeof arr.length==='number'&&arr.length>=0&&arr.length%1===0;};},{"async.util.isarray":6}],8:[function(require,module,exports){'use strict';var _keys=require('async.util.keys');var isArrayLike=require('async.util.isarraylike');module.exports=function keyIterator(coll){var i=-1;var len;var keys;if(isArrayLike(coll)){len=coll.length;return function next(){i++;return i<len?i:null;};}else{keys=_keys(coll);len=keys.length;return function next(){i++;return i<len?keys[i]:null;};}};},{"async.util.isarraylike":7,"async.util.keys":9}],9:[function(require,module,exports){'use strict';module.exports=Object.keys||function keys(obj){var _keys=[];for(var k in obj){if(obj.hasOwnProperty(k)){_keys.push(k);}}return _keys;};},{}],10:[function(require,module,exports){'use strict';module.exports=function noop(){};},{}],11:[function(require,module,exports){'use strict';module.exports=function once(fn){return function(){if(fn===null)return;fn.apply(this,arguments);fn=null;};};},{}],12:[function(require,module,exports){'use strict';module.exports=function only_once(fn){return function(){if(fn===null)throw new Error('Callback was already called.');fn.apply(this,arguments);fn=null;};};},{}],13:[function(require,module,exports){'use strict';module.exports=function restParam(func,startIndex){startIndex=startIndex==null?func.length-1:+startIndex;return function(){var length=Math.max(arguments.length-startIndex,0);var rest=new Array(length);for(var index=0;index<length;index++){rest[index]=arguments[index+startIndex];}switch(startIndex){case 0:return func.call(this,rest);case 1:return func.call(this,arguments[0],rest);}};};},{}],14:[function(require,module,exports){(function(setImmediate){(function(){'use strict';var _setImmediate=typeof setImmediate==='function'&&setImmediate;var fallback=function(fn){setTimeout(fn,0);};module.exports=function setImmediate(fn){// not a direct alias for IE10 compatibility
|
|
15
|
-
return(_setImmediate||fallback)(fn);};}).call(this);}).call(this,require("timers").setImmediate);},{"timers":
|
|
16
|
+
return(_setImmediate||fallback)(fn);};}).call(this);}).call(this,require("timers").setImmediate);},{"timers":349}],15:[function(require,module,exports){'use strict';module.exports=function withoutIndex(iterator){return function(value,index,callback){return iterator(value,callback);};};},{}],16:[function(require,module,exports){'use strict';var once=require('async.util.once');var noop=require('async.util.noop');var isArray=require('async.util.isarray');var restParam=require('async.util.restparam');var ensureAsync=require('async.util.ensureasync');var iterator=require('async.iterator');module.exports=function(tasks,cb){cb=once(cb||noop);if(!isArray(tasks))return cb(new Error('First argument to waterfall must be an array of functions'));if(!tasks.length)return cb();function wrapIterator(iterator){return restParam(function(err,args){if(err){cb.apply(null,[err].concat(args));}else{var next=iterator.next();if(next){args.push(wrapIterator(next));}else{args.push(cb);}ensureAsync(iterator).apply(null,args);}});}wrapIterator(iterator(tasks))();};},{"async.iterator":3,"async.util.ensureasync":5,"async.util.isarray":6,"async.util.noop":10,"async.util.once":11,"async.util.restparam":13}],17:[function(require,module,exports){'use strict';exports.byteLength=byteLength;exports.toByteArray=toByteArray;exports.fromByteArray=fromByteArray;var lookup=[];var revLookup=[];var Arr=typeof Uint8Array!=='undefined'?Uint8Array:Array;var code='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';for(var i=0,len=code.length;i<len;++i){lookup[i]=code[i];revLookup[code.charCodeAt(i)]=i;}// Support decoding URL-safe base64 strings, as Node.js does.
|
|
16
17
|
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
|
|
17
18
|
revLookup['-'.charCodeAt(0)]=62;revLookup['_'.charCodeAt(0)]=63;function getLens(b64){var len=b64.length;if(len%4>0){throw new Error('Invalid string. Length must be a multiple of 4');}// Trim off extra bytes after placeholder bytes are found
|
|
18
19
|
// See: https://github.com/beatgammit/base64-js/issues/42
|
|
@@ -716,7 +717,7 @@ module.exports.CoreServiceProviderBase=FableServiceProviderBase;},{"../package.j
|
|
|
716
717
|
* @module Fable Settings
|
|
717
718
|
*/const libPrecedent=require('precedent');class FableSettingsTemplateProcessor{constructor(pDependencies){// Use a no-dependencies templating engine to parse out environment variables
|
|
718
719
|
this.templateProcessor=new libPrecedent();// TODO: Make the environment variable wrap expression demarcation characters configurable?
|
|
719
|
-
this.templateProcessor.addPattern('${','}',pTemplateValue=>{let tmpTemplateValue=pTemplateValue.trim();let tmpSeparatorIndex=tmpTemplateValue.indexOf('|');const tmpDefaultValue=tmpSeparatorIndex>=0?tmpTemplateValue.substring(tmpSeparatorIndex+1):'';let tmpEnvironmentVariableName=tmpSeparatorIndex>-1?tmpTemplateValue.substring(0,tmpSeparatorIndex):tmpTemplateValue;if(tmpEnvironmentVariableName in process.env){return process.env[tmpEnvironmentVariableName];}else{return tmpDefaultValue;}});}parseSetting(pString){return this.templateProcessor.parseString(pString);}}module.exports=FableSettingsTemplateProcessor;}).call(this);}).call(this,require('_process'));},{"_process":
|
|
720
|
+
this.templateProcessor.addPattern('${','}',pTemplateValue=>{let tmpTemplateValue=pTemplateValue.trim();let tmpSeparatorIndex=tmpTemplateValue.indexOf('|');const tmpDefaultValue=tmpSeparatorIndex>=0?tmpTemplateValue.substring(tmpSeparatorIndex+1):'';let tmpEnvironmentVariableName=tmpSeparatorIndex>-1?tmpTemplateValue.substring(0,tmpSeparatorIndex):tmpTemplateValue;if(tmpEnvironmentVariableName in process.env){return process.env[tmpEnvironmentVariableName];}else{return tmpDefaultValue;}});}parseSetting(pString){return this.templateProcessor.parseString(pString);}}module.exports=FableSettingsTemplateProcessor;}).call(this);}).call(this,require('_process'));},{"_process":312,"precedent":309}],64:[function(require,module,exports){/**
|
|
720
721
|
* Fable Settings Add-on
|
|
721
722
|
*
|
|
722
723
|
*
|
|
@@ -1758,7 +1759,7 @@ tmpParameters.CurrentPathIndex++;}// Check if the path is fully complete
|
|
|
1758
1759
|
if(tmpParameters.CurrentPathIndex>=tmpParameters.ActualPathParts.length){return fCallback(null);}// Check if the path exists (and is a folder)
|
|
1759
1760
|
libFS.open(tmpParameters.CurrentPath+libPath.sep+tmpParameters.ActualPathParts[tmpParameters.CurrentPathIndex],'r',(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,pCreateError=>{if(!pCreateError){// We have now created our folder and there was no error -- continue.
|
|
1760
1761
|
return this.makeFolderRecursive(tmpParameters,fCallback);}else if(pCreateError.code=='EEXIST'){// The folder exists -- our dev might be running this in parallel/async/whatnot.
|
|
1761
|
-
return this.makeFolderRecursive(tmpParameters,fCallback);}else{console.log(pCreateError.code);return fCallback(pCreateError);}});}else{return this.makeFolderRecursive(tmpParameters,fCallback);}});}}module.exports=FableServiceFilePersistence;}).call(this);}).call(this,require('_process'));},{"_process":
|
|
1762
|
+
return this.makeFolderRecursive(tmpParameters,fCallback);}else{console.log(pCreateError.code);return fCallback(pCreateError);}});}else{return this.makeFolderRecursive(tmpParameters,fCallback);}});}}module.exports=FableServiceFilePersistence;}).call(this);}).call(this,require('_process'));},{"_process":312,"fable-serviceproviderbase":60,"fs":20,"path":140,"readline":20}],89:[function(require,module,exports){const libFableServiceBase=require('fable-serviceproviderbase');class FableServiceLogic extends libFableServiceBase{/**
|
|
1762
1763
|
* @param {import('../Fable.js')} pFable - The fable object
|
|
1763
1764
|
* @param {Record<string, any>} [pOptions] - The options object
|
|
1764
1765
|
* @param {string} [pServiceHash] - The hash of the service
|
|
@@ -2535,7 +2536,7 @@ if(!tmpDataBuffer){tmpDataBuffer=Buffer.from(pChunk);}else{tmpDataBuffer=Buffer.
|
|
|
2535
2536
|
{
|
|
2536
2537
|
tmpOptions.headers['Content-Type'] = 'application/json';
|
|
2537
2538
|
}
|
|
2538
|
-
*/tmpOptions.RequestStartTime=this.fable.log.getTimeStamp();if(this.TraceLog){this.fable.log.debug(`Beginning ${tmpOptions.method} JSON request to ${tmpOptions.url} at ${tmpOptions.RequestStartTime}`);}return libSimpleGet(tmpOptions,(pError,pResponse)=>{if(pError){return fCallback(pError,pResponse);}if(this.TraceLog){let tmpConnectTime=this.fable.log.getTimeStamp();this.fable.log.debug(`--> JSON ${tmpOptions.method} connected in ${this.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpConnectTime)}ms code ${pResponse.statusCode}`);}let tmpJSONData='';pResponse.on('data',pChunk=>{if(this.TraceLog){let tmpChunkTime=this.fable.log.getTimeStamp();this.fable.log.debug(`--> JSON ${tmpOptions.method} data chunk size ${pChunk.length}b received in ${this.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpChunkTime)}ms`);}tmpJSONData+=pChunk;});pResponse.on('end',()=>{if(this.TraceLog){let tmpCompletionTime=this.fable.log.getTimeStamp();this.fable.log.debug(`==> JSON ${tmpOptions.method} completed - received in ${this.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime)}ms`);}return fCallback(pError,pResponse,JSON.parse(tmpJSONData));});});}getJSON(pOptionsOrURL,fCallback){let tmpRequestOptions=typeof pOptionsOrURL=='object'?pOptionsOrURL:{};if(typeof pOptionsOrURL=='string'){tmpRequestOptions.url=pOptionsOrURL;}tmpRequestOptions.method='GET';return this.executeJSONRequest(tmpRequestOptions,fCallback);}putJSON(pOptions,fCallback){if(typeof pOptions.body!='object'){return fCallback(new Error(`PUT JSON Error Invalid options object`));}pOptions.method='PUT';return this.executeJSONRequest(pOptions,fCallback);}postJSON(pOptions,fCallback){if(typeof pOptions.body!='object'){return fCallback(new Error(`POST JSON Error Invalid options object`));}pOptions.method='POST';return this.executeJSONRequest(pOptions,fCallback);}patchJSON(pOptions,fCallback){if(typeof pOptions.body!='object'){return fCallback(new Error(`PATCH JSON Error Invalid options object`));}pOptions.method='PATCH';return this.executeJSONRequest(pOptions,fCallback);}headJSON(pOptions,fCallback){if(typeof pOptions.body!='object'){return fCallback(new Error(`HEAD JSON Error Invalid options object`));}pOptions.method='HEAD';return this.executeJSONRequest(pOptions,fCallback);}delJSON(pOptions,fCallback){pOptions.method='DELETE';return this.executeJSONRequest(pOptions,fCallback);}getRawText(pOptionsOrURL,fCallback){let tmpRequestOptions=typeof pOptionsOrURL=='object'?pOptionsOrURL:{};if(typeof pOptionsOrURL=='string'){tmpRequestOptions.url=pOptionsOrURL;}tmpRequestOptions.method='GET';return this.executeChunkedRequest(tmpRequestOptions,fCallback);}}module.exports=FableServiceRestClient;}).call(this);}).call(this,require("buffer").Buffer);},{"buffer":21,"cookie":32,"fable-serviceproviderbase":60,"simple-get":
|
|
2539
|
+
*/tmpOptions.RequestStartTime=this.fable.log.getTimeStamp();if(this.TraceLog){this.fable.log.debug(`Beginning ${tmpOptions.method} JSON request to ${tmpOptions.url} at ${tmpOptions.RequestStartTime}`);}return libSimpleGet(tmpOptions,(pError,pResponse)=>{if(pError){return fCallback(pError,pResponse);}if(this.TraceLog){let tmpConnectTime=this.fable.log.getTimeStamp();this.fable.log.debug(`--> JSON ${tmpOptions.method} connected in ${this.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpConnectTime)}ms code ${pResponse.statusCode}`);}let tmpJSONData='';pResponse.on('data',pChunk=>{if(this.TraceLog){let tmpChunkTime=this.fable.log.getTimeStamp();this.fable.log.debug(`--> JSON ${tmpOptions.method} data chunk size ${pChunk.length}b received in ${this.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpChunkTime)}ms`);}tmpJSONData+=pChunk;});pResponse.on('end',()=>{if(this.TraceLog){let tmpCompletionTime=this.fable.log.getTimeStamp();this.fable.log.debug(`==> JSON ${tmpOptions.method} completed - received in ${this.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime)}ms`);}return fCallback(pError,pResponse,JSON.parse(tmpJSONData));});});}getJSON(pOptionsOrURL,fCallback){let tmpRequestOptions=typeof pOptionsOrURL=='object'?pOptionsOrURL:{};if(typeof pOptionsOrURL=='string'){tmpRequestOptions.url=pOptionsOrURL;}tmpRequestOptions.method='GET';return this.executeJSONRequest(tmpRequestOptions,fCallback);}putJSON(pOptions,fCallback){if(typeof pOptions.body!='object'){return fCallback(new Error(`PUT JSON Error Invalid options object`));}pOptions.method='PUT';return this.executeJSONRequest(pOptions,fCallback);}postJSON(pOptions,fCallback){if(typeof pOptions.body!='object'){return fCallback(new Error(`POST JSON Error Invalid options object`));}pOptions.method='POST';return this.executeJSONRequest(pOptions,fCallback);}patchJSON(pOptions,fCallback){if(typeof pOptions.body!='object'){return fCallback(new Error(`PATCH JSON Error Invalid options object`));}pOptions.method='PATCH';return this.executeJSONRequest(pOptions,fCallback);}headJSON(pOptions,fCallback){if(typeof pOptions.body!='object'){return fCallback(new Error(`HEAD JSON Error Invalid options object`));}pOptions.method='HEAD';return this.executeJSONRequest(pOptions,fCallback);}delJSON(pOptions,fCallback){pOptions.method='DELETE';return this.executeJSONRequest(pOptions,fCallback);}getRawText(pOptionsOrURL,fCallback){let tmpRequestOptions=typeof pOptionsOrURL=='object'?pOptionsOrURL:{};if(typeof pOptionsOrURL=='string'){tmpRequestOptions.url=pOptionsOrURL;}tmpRequestOptions.method='GET';return this.executeChunkedRequest(tmpRequestOptions,fCallback);}}module.exports=FableServiceRestClient;}).call(this);}).call(this,require("buffer").Buffer);},{"buffer":21,"cookie":32,"fable-serviceproviderbase":60,"simple-get":328}],100:[function(require,module,exports){const libFableServiceBase=require('fable-serviceproviderbase');class FableServiceTemplate extends libFableServiceBase{// Underscore and lodash have a behavior, _.template, which compiles a
|
|
2539
2540
|
// string-based template with code snippets into simple executable pieces,
|
|
2540
2541
|
// with the added twist of returning a precompiled function ready to go.
|
|
2541
2542
|
//
|
|
@@ -2745,7 +2746,7 @@ $gOPD=null;}}module.exports=$gOPD;},{"./gOPD":109}],111:[function(require,module
|
|
|
2745
2746
|
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
|
|
2746
2747
|
var symVal=42;obj[sym]=symVal;for(var _ in obj){return false;}// eslint-disable-line no-restricted-syntax, no-unreachable-loop
|
|
2747
2748
|
if(typeof Object.keys==='function'&&Object.keys(obj).length!==0){return false;}if(typeof Object.getOwnPropertyNames==='function'&&Object.getOwnPropertyNames(obj).length!==0){return false;}var syms=Object.getOwnPropertySymbols(obj);if(syms.length!==1||syms[0]!==sym){return false;}if(!Object.prototype.propertyIsEnumerable.call(obj,sym)){return false;}if(typeof Object.getOwnPropertyDescriptor==='function'){// eslint-disable-next-line no-extra-parens
|
|
2748
|
-
var descriptor=/** @type {PropertyDescriptor} */Object.getOwnPropertyDescriptor(obj,sym);if(descriptor.value!==symVal||descriptor.enumerable!==true){return false;}}return true;};},{}],113:[function(require,module,exports){'use strict';var call=Function.prototype.call;var $hasOwn=Object.prototype.hasOwnProperty;var bind=require('function-bind');/** @type {import('.')} */module.exports=bind.call(call,$hasOwn);},{"function-bind":104}],114:[function(require,module,exports){var http=require('http');var url=require('url');var https=module.exports;for(var key in http){if(http.hasOwnProperty(key))https[key]=http[key];}https.request=function(params,cb){params=validateParams(params);return http.request.call(this,params,cb);};https.get=function(params,cb){params=validateParams(params);return http.get.call(this,params,cb);};function validateParams(params){if(typeof params==='string'){params=url.parse(params);}if(!params.protocol){params.protocol='https:';}if(params.protocol!=='https:'){throw new Error('Protocol "'+params.protocol+'" not supported. Expected "https:"');}return params;}},{"http":
|
|
2749
|
+
var descriptor=/** @type {PropertyDescriptor} */Object.getOwnPropertyDescriptor(obj,sym);if(descriptor.value!==symVal||descriptor.enumerable!==true){return false;}}return true;};},{}],113:[function(require,module,exports){'use strict';var call=Function.prototype.call;var $hasOwn=Object.prototype.hasOwnProperty;var bind=require('function-bind');/** @type {import('.')} */module.exports=bind.call(call,$hasOwn);},{"function-bind":104}],114:[function(require,module,exports){var http=require('http');var url=require('url');var https=module.exports;for(var key in http){if(http.hasOwnProperty(key))https[key]=http[key];}https.request=function(params,cb){params=validateParams(params);return http.request.call(this,params,cb);};https.get=function(params,cb){params=validateParams(params);return http.get.call(this,params,cb);};function validateParams(params){if(typeof params==='string'){params=url.parse(params);}if(!params.protocol){params.protocol='https:';}if(params.protocol!=='https:'){throw new Error('Protocol "'+params.protocol+'" not supported. Expected "https:"');}return params;}},{"http":329,"url":350}],115:[function(require,module,exports){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var nBits=-7;var i=isLE?nBytes-1:0;var d=isLE?-1:1;var s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias;}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity;}else{m=m+Math.pow(2,mLen);e=e-eBias;}return(s?-1:1)*m*Math.pow(2,e-mLen);};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;var i=isLE?0:nBytes-1;var d=isLE?1:-1;var s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax;}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2;}if(e+eBias>=1){value+=rt/c;}else{value+=rt*Math.pow(2,1-eBias);}if(value*c>=2){e++;c/=2;}if(e+eBias>=eMax){m=0;e=eMax;}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias;}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0;}}for(;mLen>=8;buffer[offset+i]=m&0xff,i+=d,m/=256,mLen-=8){}e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&0xff,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128;};},{}],116:[function(require,module,exports){if(typeof Object.create==='function'){// implementation from standard node.js 'util' module
|
|
2749
2750
|
module.exports=function inherits(ctor,superCtor){if(superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}});}};}else{// old school shim for old browsers
|
|
2750
2751
|
module.exports=function inherits(ctor,superCtor){if(superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor();ctor.prototype.constructor=ctor;}};}},{}],117:[function(require,module,exports){// When a boxed property is passed in, it should have quotes of some
|
|
2751
2752
|
// kind around it.
|
|
@@ -3827,7 +3828,7 @@ if(!has(obj,key)){continue;}// eslint-disable-line no-restricted-syntax, no-cont
|
|
|
3827
3828
|
if(isArr&&String(Number(key))===key&&key<obj.length){continue;}// eslint-disable-line no-restricted-syntax, no-continue
|
|
3828
3829
|
if(hasShammedSymbols&&symMap['$'+key]instanceof Symbol){// this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
|
|
3829
3830
|
continue;// eslint-disable-line no-restricted-syntax, no-continue
|
|
3830
|
-
}else if($test.call(/[^\w$]/,key)){xs.push(inspect(key,obj)+': '+inspect(obj[key],obj));}else{xs.push(key+': '+inspect(obj[key],obj));}}if(typeof gOPS==='function'){for(var j=0;j<syms.length;j++){if(isEnumerable.call(obj,syms[j])){xs.push('['+inspect(syms[j])+']: '+inspect(obj[syms[j]],obj));}}}return xs;}}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"./util.inspect":19}],139:[function(require,module,exports){var wrappy=require('wrappy');module.exports=wrappy(once);module.exports.strict=wrappy(onceStrict);once.proto=once(function(){Object.defineProperty(Function.prototype,'once',{value:function(){return once(this);},configurable:true});Object.defineProperty(Function.prototype,'onceStrict',{value:function(){return onceStrict(this);},configurable:true});});function once(fn){var f=function(){if(f.called)return f.value;f.called=true;return f.value=fn.apply(this,arguments);};f.called=false;return f;}function onceStrict(fn){var f=function(){if(f.called)throw new Error(f.onceError);f.called=true;return f.value=fn.apply(this,arguments);};var name=fn.name||'Function wrapped with `once`';f.onceError=name+" shouldn't be called more than once";f.called=false;return f;}},{"wrappy":
|
|
3831
|
+
}else if($test.call(/[^\w$]/,key)){xs.push(inspect(key,obj)+': '+inspect(obj[key],obj));}else{xs.push(key+': '+inspect(obj[key],obj));}}if(typeof gOPS==='function'){for(var j=0;j<syms.length;j++){if(isEnumerable.call(obj,syms[j])){xs.push('['+inspect(syms[j])+']: '+inspect(obj[syms[j]],obj));}}}return xs;}}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"./util.inspect":19}],139:[function(require,module,exports){var wrappy=require('wrappy');module.exports=wrappy(once);module.exports.strict=wrappy(onceStrict);once.proto=once(function(){Object.defineProperty(Function.prototype,'once',{value:function(){return once(this);},configurable:true});Object.defineProperty(Function.prototype,'onceStrict',{value:function(){return onceStrict(this);},configurable:true});});function once(fn){var f=function(){if(f.called)return f.value;f.called=true;return f.value=fn.apply(this,arguments);};f.called=false;return f;}function onceStrict(fn){var f=function(){if(f.called)throw new Error(f.onceError);f.called=true;return f.value=fn.apply(this,arguments);};var name=fn.name||'Function wrapped with `once`';f.onceError=name+" shouldn't be called more than once";f.called=false;return f;}},{"wrappy":352}],140:[function(require,module,exports){(function(process){(function(){// 'path' module extracted from Node.js v8.11.1 (only the posix part)
|
|
3831
3832
|
// transplited with Babel
|
|
3832
3833
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
3833
3834
|
//
|
|
@@ -3909,7 +3910,7 @@ if(startDot===-1)startDot=i;else if(preDotState!==1)preDotState=1;}else if(start
|
|
|
3909
3910
|
// have a good chance at having a non-empty extension
|
|
3910
3911
|
preDotState=-1;}}if(startDot===-1||end===-1||// We saw a non-dot character immediately before the dot
|
|
3911
3912
|
preDotState===0||// The (right-most) trimmed path component is exactly '..'
|
|
3912
|
-
preDotState===1&&startDot===end-1&&startDot===startPart+1){if(end!==-1){if(startPart===0&&isAbsolute)ret.base=ret.name=path.slice(1,end);else ret.base=ret.name=path.slice(startPart,end);}}else{if(startPart===0&&isAbsolute){ret.name=path.slice(1,startDot);ret.base=path.slice(1,end);}else{ret.name=path.slice(startPart,startDot);ret.base=path.slice(startPart,end);}ret.ext=path.slice(startDot,end);}if(startPart>0)ret.dir=path.slice(0,startPart-1);else if(isAbsolute)ret.dir='/';return ret;},sep:'/',delimiter:':',win32:null,posix:null};posix.posix=posix;module.exports=posix;}).call(this);}).call(this,require('_process'));},{"_process":
|
|
3913
|
+
preDotState===1&&startDot===end-1&&startDot===startPart+1){if(end!==-1){if(startPart===0&&isAbsolute)ret.base=ret.name=path.slice(1,end);else ret.base=ret.name=path.slice(startPart,end);}}else{if(startPart===0&&isAbsolute){ret.name=path.slice(1,startDot);ret.base=path.slice(1,end);}else{ret.name=path.slice(startPart,startDot);ret.base=path.slice(startPart,end);}ret.ext=path.slice(startDot,end);}if(startPart>0)ret.dir=path.slice(0,startPart-1);else if(isAbsolute)ret.dir='/';return ret;},sep:'/',delimiter:':',win32:null,posix:null};posix.posix=posix;module.exports=posix;}).call(this);}).call(this,require('_process'));},{"_process":312}],141:[function(require,module,exports){module.exports={"name":"pict-application","version":"1.0.32","description":"Application base class for a pict view-based application","main":"source/Pict-Application.js","scripts":{"test":"npx mocha -u tdd -R spec","start":"node source/Pict-Application.js","coverage":"npx nyc --reporter=lcov --reporter=text-lcov npx mocha -- -u tdd -R spec","build":"npx quack build","docker-dev-build":"docker build ./ -f Dockerfile_LUXURYCode -t pict-application-image:local","docker-dev-run":"docker run -it -d --name pict-application-dev -p 30001:8080 -p 38086:8086 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/pict-application\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" pict-application-image:local","docker-dev-shell":"docker exec -it pict-application-dev /bin/bash","tests":"npx mocha -u tdd --exit -R spec --grep","lint":"eslint source/**","types":"tsc -p ."},"types":"types/source/Pict-Application.d.ts","repository":{"type":"git","url":"git+https://github.com/stevenvelozo/pict-application.git"},"author":"steven velozo <steven@velozo.com>","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/pict-application/issues"},"homepage":"https://github.com/stevenvelozo/pict-application#readme","devDependencies":{"@eslint/js":"^9.28.0","browser-env":"^3.3.0","eslint":"^9.28.0","pict":"^1.0.348","pict-provider":"^1.0.10","pict-view":"^1.0.66","quackage":"^1.0.51","typescript":"^5.9.3"},"mocha":{"diff":true,"extension":["js"],"package":"./package.json","reporter":"spec","slow":"75","timeout":"5000","ui":"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]},"dependencies":{"fable-serviceproviderbase":"^3.0.18"}};},{}],142:[function(require,module,exports){const libFableServiceBase=require('fable-serviceproviderbase');const libPackage=require('../package.json');const defaultPictSettings={Name:'DefaultPictApplication',// The main "viewport" is the view that is used to host our application
|
|
3913
3914
|
MainViewportViewIdentifier:'Default-View',MainViewportRenderableHash:false,MainViewportDestinationAddress:false,MainViewportDefaultDataAddress:false,// Whether or not we should automatically render the main viewport and other autorender views after we initialize the pict application
|
|
3914
3915
|
AutoSolveAfterInitialize:true,AutoRenderMainViewportViewAfterInitialize:true,AutoRenderViewsAfterInitialize:false,AutoLoginAfterInitialize:false,AutoLoadDataAfterLogin:false,ConfigurationOnlyViews:[],Manifests:{},// The prefix to prepend on all template destination hashes
|
|
3915
3916
|
IdentifierAddressPrefix:'PICT-'};/**
|
|
@@ -4404,7 +4405,7 @@ let tmpCode=this.codeJar.toString();this.codeJar.destroy();this.codeJar=this._co
|
|
|
4404
4405
|
* Marshal code content from the data address into the view.
|
|
4405
4406
|
*/marshalToView(){super.marshalToView();if(this.codeJar&&this.options.CodeDataAddress){let tmpCode=this._resolveCodeContent();if(typeof tmpCode==='string'){this.codeJar.updateCode(tmpCode);this._updateLineNumbers();}}}/**
|
|
4406
4407
|
* Marshal the current code content back to the data address.
|
|
4407
|
-
*/marshalFromView(){super.marshalFromView();if(this.codeJar&&this.options.CodeDataAddress){this.onCodeChange(this.codeJar.toString());}}}module.exports=PictSectionCode;module.exports.default_configuration=_DefaultConfiguration;module.exports.createHighlighter=libCreateHighlighter;},{"./Pict-Code-Highlighter.js":145,"./Pict-Section-Code-DefaultConfiguration.js":146,"pict-view":
|
|
4408
|
+
*/marshalFromView(){super.marshalFromView();if(this.codeJar&&this.options.CodeDataAddress){this.onCodeChange(this.codeJar.toString());}}}module.exports=PictSectionCode;module.exports.default_configuration=_DefaultConfiguration;module.exports.createHighlighter=libCreateHighlighter;},{"./Pict-Code-Highlighter.js":145,"./Pict-Section-Code-DefaultConfiguration.js":146,"pict-view":244}],148:[function(require,module,exports){arguments[4][145][0].apply(exports,arguments);},{"dup":145}],149:[function(require,module,exports){module.exports={"RenderOnLoad":true,"DefaultRenderable":"CodeEditor-Wrap","DefaultDestinationAddress":"#CodeEditor-Container-Div","Templates":[{"Hash":"CodeEditor-Container","Template":"<!-- CodeEditor-Container Rendering Soon -->"}],"Renderables":[{"RenderableHash":"CodeEditor-Wrap","TemplateHash":"CodeEditor-Container","DestinationAddress":"#CodeEditor-Container-Div"}],"TargetElementAddress":"#CodeEditor-Container-Div",// Address in AppData or other Pict address space to read/write code content
|
|
4408
4409
|
"CodeDataAddress":false,// The language for syntax highlighting (e.g. "javascript", "html", "css", "json")
|
|
4409
4410
|
"Language":"javascript",// Whether the editor is read-only
|
|
4410
4411
|
"ReadOnly":false,// Tab character: use tab or spaces
|
|
@@ -4551,7 +4552,7 @@ let tmpCode=this.codeJar.toString();this.codeJar.destroy();this.codeJar=this._co
|
|
|
4551
4552
|
* Marshal code content from the data address into the view.
|
|
4552
4553
|
*/marshalToView(){super.marshalToView();if(this.codeJar&&this.options.CodeDataAddress){let tmpCode=this._resolveCodeContent();if(typeof tmpCode==='string'){this.codeJar.updateCode(tmpCode);this._updateLineNumbers();}}}/**
|
|
4553
4554
|
* Marshal the current code content back to the data address.
|
|
4554
|
-
*/marshalFromView(){super.marshalFromView();if(this.codeJar&&this.options.CodeDataAddress){this.onCodeChange(this.codeJar.toString());}}}module.exports=PictSectionCode;module.exports.default_configuration=_DefaultConfiguration;module.exports.createHighlighter=libCreateHighlighter;},{"./Pict-Code-Highlighter.js":148,"./Pict-Section-Code-DefaultConfiguration.js":149,"pict-view":
|
|
4555
|
+
*/marshalFromView(){super.marshalFromView();if(this.codeJar&&this.options.CodeDataAddress){this.onCodeChange(this.codeJar.toString());}}}module.exports=PictSectionCode;module.exports.default_configuration=_DefaultConfiguration;module.exports.createHighlighter=libCreateHighlighter;},{"./Pict-Code-Highlighter.js":148,"./Pict-Section-Code-DefaultConfiguration.js":149,"pict-view":244}],151:[function(require,module,exports){// The container for all the Pict-Section-Content related code.
|
|
4555
4556
|
// The main content view class
|
|
4556
4557
|
module.exports=require('./views/Pict-View-Content.js');// The content provider (markdown parsing, HTML escaping)
|
|
4557
4558
|
module.exports.PictContentProvider=require('./providers/Pict-Provider-Content.js');},{"./providers/Pict-Provider-Content.js":152,"./views/Pict-View-Content.js":153}],152:[function(require,module,exports){const libPictProvider=require('pict-provider');const libCreateHighlighter=require('pict-section-code').createHighlighter;/**
|
|
@@ -4861,7 +4862,7 @@ let tmpDisplayElements=tmpContentBody.querySelectorAll('.pict-content-katex-disp
|
|
|
4861
4862
|
*
|
|
4862
4863
|
* @param {string} [pMessage] - Loading message (defaults to 'Loading content...')
|
|
4863
4864
|
* @param {string} [pContainerID] - The container element ID (defaults to 'Pict-Content-Body')
|
|
4864
|
-
*/showLoading(pMessage,pContainerID){let tmpContainerID=pContainerID||'Pict-Content-Body';let tmpMessage=pMessage||'Loading content...';this.pict.ContentAssignment.assignContent('#'+tmpContainerID,'<div class="pict-content-loading">'+tmpMessage+'</div>');}}module.exports=PictContentView;module.exports.default_configuration=_ViewConfiguration;},{"pict-view":
|
|
4865
|
+
*/showLoading(pMessage,pContainerID){let tmpContainerID=pContainerID||'Pict-Content-Body';let tmpMessage=pMessage||'Loading content...';this.pict.ContentAssignment.assignContent('#'+tmpContainerID,'<div class="pict-content-loading">'+tmpMessage+'</div>');}}module.exports=PictContentView;module.exports.default_configuration=_ViewConfiguration;},{"pict-view":244}],154:[function(require,module,exports){module.exports={"name":"pict-section-form","version":"1.0.189","description":"Pict dynamic form sections","main":"source/Pict-Section-Form.js","directories":{"test":"test"},"repository":{"type":"git","url":"git+https://github.com/stevenvelozo/pict-section-form.git"},"bugs":{"url":"https://github.com/stevenvelozo/pict-section-form/issues"},"homepage":"https://github.com/stevenvelozo/pict-section-form#readme","scripts":{"start":"node source/Pict-Section-Form.js","tests":"npx mocha -u tdd --exit -R spec --grep","coverage":"npx nyc --reporter=lcov --reporter=text-lcov npx mocha -- -u tdd -R spec","build":"npx quack build","test":"npx mocha -u tdd -R spec","lint":"eslint source/**","types":"tsc -p .","docker-dev-build":"docker build ./ -f Dockerfile_LUXURYCode -t pict-section-form-image:local","docker-dev-run":"docker run -it -d --name pict-section-form-dev -p 48888:8080 -p 49999:9999 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/pict-section-form\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" pict-section-form-image:local","docker-dev-shell":"docker exec -it pict-section-form-dev /bin/bash"},"types":"types/source/Pict-Section-Form.d.ts","author":"steven velozo <steven@velozo.com>","license":"MIT","devDependencies":{"@eslint/js":"^9.39.2","browser-env":"^3.3.0","eslint":"^9.39.2","jquery":"^4.0.0","pict":"^1.0.348","pict-application":"^1.0.32","pict-service-commandlineutility":"^1.0.18","quackage":"^1.0.51","tui-grid":"^4.21.22","typescript":"^5.9.3"},"dependencies":{"chart.js":"^4.5.1","fable-serviceproviderbase":"^3.0.18","marked":"^17.0.1","pict-provider":"^1.0.10","pict-section-tuigrid":"^1.0.27","pict-template":"^1.0.14","pict-view":"^1.0.66"},"mocha":{"diff":true,"extension":["js"],"package":"./package.json","reporter":"spec","slow":"75","timeout":"5000","ui":"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]}};},{}],155:[function(require,module,exports){// The container for all the Pict-Section-Form related code.
|
|
4865
4866
|
// The main dynamic view class
|
|
4866
4867
|
module.exports=require('./views/Pict-View-DynamicForm.js');//module.exports.default_configuration = require('./views/Pict-View-DynamicForm-DefaultConfiguration.json');
|
|
4867
4868
|
// The dynamic application dependencies
|
|
@@ -7901,7 +7902,7 @@ this.gridSettings.data=this.cachedGridData;return super.customConfigureGridSetti
|
|
|
7901
7902
|
* @returns {any} - The result of the super changeHandler method.
|
|
7902
7903
|
*/changeHandler(pChangeData){// Update the state in our model based on the grid
|
|
7903
7904
|
for(let i=0;i<pChangeData.changes.length;i++){let tmpChange=pChangeData.changes[i];let tmpRowIndex=pChangeData.instance.getValue(tmpChange.rowKey,'RecordIndex');// TODO: Right now each of these calls runs a solve() on the entire form. This is not ideal.
|
|
7904
|
-
pChangeData.instance.View.setDataTabularByHash(pChangeData.instance.Group.GroupIndex,tmpChange.columnName,tmpRowIndex,tmpChange.value);}return super.changeHandler(pChangeData);}}module.exports=TuiGridLayout;},{"pict-section-tuigrid":
|
|
7905
|
+
pChangeData.instance.View.setDataTabularByHash(pChangeData.instance.Group.GroupIndex,tmpChange.columnName,tmpRowIndex,tmpChange.value);}return super.changeHandler(pChangeData);}}module.exports=TuiGridLayout;},{"pict-section-tuigrid":236}],193:[function(require,module,exports){const libPictSectionGroupLayout=require('../Pict-Provider-DynamicLayout.js');class VerticalRecordLayout extends libPictSectionGroupLayout{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);/** @type {import('pict')} */this.pict;/** @type {import('pict')} */this.fable;/** @type {any} */this.log;}/**
|
|
7905
7906
|
* Generate a group layout template for a single-record dynamically generated group view.
|
|
7906
7907
|
*
|
|
7907
7908
|
* This is the standard name / field entry form that you're used to filling out for addresses
|
|
@@ -8188,7 +8189,7 @@ super(pFable,pOptions,pServiceHash);/** @type {import('pict') & { addAndInstanti
|
|
|
8188
8189
|
* @returns {string | undefined} - The rendered template or undefined if callback is provided.
|
|
8189
8190
|
*/renderAsync(pTemplateHash,pRecord,fCallback,pContextArray,pScope,pState){const tmpMetatemplateGenerator=this.pict.providers.MetatemplateGenerator;const tmpHash=pTemplateHash.trim();/** @type{import('../views/Pict-View-Form-Metacontroller.js')} */const metacontroller=this.pict.views.PictFormMetacontroller;/** @type {Manyfest} */const manifest=metacontroller?metacontroller.manifest:this.pict.manifest;const descriptor=manifest.getDescriptor(tmpHash);if(!descriptor){this.log.error(`PictTemplateControlFromDynamicManifest: Cannot find descriptor for address [${tmpHash}]`);if(typeof fCallback==='function'){return fCallback(null,'');}return'';}const tmpView=this.pict.views[descriptor.PictForm.ViewHash];const tmpScope=tmpView||pScope;const tmpContextArray=tmpScope?[tmpScope]:pContextArray||[this.pict];this.pict.providers.MetatemplateMacros.buildInputMacros(tmpView,descriptor);// Now generate the metatemplate
|
|
8190
8191
|
const tmpTemplate=tmpMetatemplateGenerator.getInputMetatemplateTemplateReference(tmpView,descriptor.DataType,descriptor.PictForm.InputType,`getInput("${descriptor.PictForm.GroupIndex}","${descriptor.PictForm.RowIndex}","${descriptor.PictForm.InputIndex}")`);// Now parse it and return it.
|
|
8191
|
-
return this.pict.parseTemplate(tmpTemplate,descriptor,fCallback,tmpContextArray,tmpScope,pState);}}module.exports=PictTemplateControlFromDynamicManifest;},{"pict-template":
|
|
8192
|
+
return this.pict.parseTemplate(tmpTemplate,descriptor,fCallback,tmpContextArray,tmpScope,pState);}}module.exports=PictTemplateControlFromDynamicManifest;},{"pict-template":242}],198:[function(require,module,exports){const libPictTemplate=require('pict-template');/**
|
|
8192
8193
|
* This is a template that will generate a Metatemplate input, for manual use of metatemplates.
|
|
8193
8194
|
*/class PictTemplateControlFromDynamicManifest extends libPictTemplate{/**
|
|
8194
8195
|
* @param {Object} pFable - The Fable Framework instance
|
|
@@ -8215,7 +8216,7 @@ return this.pict.parseTemplate(tmpTemplate,descriptor,fCallback,tmpContextArray,
|
|
|
8215
8216
|
* @returns {string | undefined} - The rendered template or undefined if callback is provided.
|
|
8216
8217
|
*/renderAsync(pTemplateHash,pRecord,fCallback,pContextArray,pScope,pState){const tmpMetatemplateGenerator=this.pict.providers.MetatemplateGenerator;const tmpHash=pTemplateHash.trim();/** @type{import('../views/Pict-View-Form-Metacontroller.js')} */const metacontroller=this.pict.views.PictFormMetacontroller;/** @type {import('./Pict-Template-ControlFromDynamicManifest.js').Manyfest} */const manifest=metacontroller?metacontroller.manifest:this.pict.manifest;const descriptor=manifest.getDescriptorByHash(tmpHash);if(!descriptor){this.log.error(`PictTemplateControlFromDynamicManifest: Cannot find descriptor for hash [${tmpHash}]`);if(typeof fCallback==='function'){return fCallback(null,'');}return'';}const tmpView=this.pict.views[descriptor.PictForm.ViewHash];const tmpScope=tmpView||pScope;const tmpContextArray=tmpScope?[tmpScope]:pContextArray||[this.pict];this.pict.providers.MetatemplateMacros.buildInputMacros(tmpView,descriptor);// Now generate the metatemplate
|
|
8217
8218
|
const tmpTemplate=tmpMetatemplateGenerator.getInputMetatemplateTemplateReference(tmpView,descriptor.DataType,descriptor.PictForm.InputType,`getInput("${descriptor.PictForm.GroupIndex}","${descriptor.PictForm.RowIndex}","${descriptor.PictForm.InputIndex}")`);// Now parse it and return it.
|
|
8218
|
-
return this.pict.parseTemplate(tmpTemplate,descriptor,fCallback,tmpContextArray,tmpScope,pState);}}module.exports=PictTemplateControlFromDynamicManifest;},{"pict-template":
|
|
8219
|
+
return this.pict.parseTemplate(tmpTemplate,descriptor,fCallback,tmpContextArray,tmpScope,pState);}}module.exports=PictTemplateControlFromDynamicManifest;},{"pict-template":242}],199:[function(require,module,exports){const libPictTemplate=require('pict-template');/**
|
|
8219
8220
|
* This is a template that will generate a Metatemplate input, for manual use of metatemplates.
|
|
8220
8221
|
*/class PictTemplateGetViewSchemaValue extends libPictTemplate{/**
|
|
8221
8222
|
* @param {Object} pFable - The Fable Framework instance
|
|
@@ -8240,7 +8241,7 @@ return this.pict.parseTemplate(tmpTemplate,descriptor,fCallback,tmpContextArray,
|
|
|
8240
8241
|
* @param {any} [pScope] - A sticky scope that can be used to carry state and simplify template
|
|
8241
8242
|
* @param {any} [pState] - A catchall state object for plumbing data through template processing.
|
|
8242
8243
|
* @returns {string | undefined} - The rendered template or undefined if callback is provided.
|
|
8243
|
-
*/renderAsync(pTemplateHash,pRecord,fCallback,pContextArray,pScope,pState){const[tmpSchemaAddress,tmpTemplateHash]=pTemplateHash.trim().split('^');/** @type{import('../views/Pict-View-Form-Metacontroller.js')} */const metacontroller=this.pict.views.PictFormMetacontroller;/** @type {import('./Pict-Template-ControlFromDynamicManifest.js').Manyfest} */const manifest=metacontroller?metacontroller.manifest:this.pict.manifest;const descriptor=manifest.getDescriptor(tmpSchemaAddress);if(!descriptor){this.log.error(`PictTemplateGetViewSchemaValue: Cannot find descriptor for address [${tmpSchemaAddress}]`);if(typeof fCallback==='function'){return fCallback(null,'');}return'';}/** @type {import('../views/Pict-View-DynamicForm.js')} */const tmpView=this.pict.views[descriptor.PictForm.ViewHash];const value=tmpView.getValueByHash(tmpSchemaAddress);if(tmpTemplateHash){const tmpRecord={Value:value,ParentRecord:pRecord,View:tmpView,Descriptor:descriptor};if(typeof fCallback!=='function'){return this.pict.parseTemplateByHash(tmpTemplateHash,tmpRecord,null,pContextArray,pScope,pState);}return this.pict.parseTemplateByHash(tmpTemplateHash,tmpRecord,(pError,pValue)=>{if(pError){return fCallback(pError,'');}return fCallback(null,pValue);},pContextArray,pScope,pState);}if(typeof fCallback==='function'){fCallback(null,value?String(value):'');}else{return value?String(value):'';}}}module.exports=PictTemplateGetViewSchemaValue;},{"pict-template":
|
|
8244
|
+
*/renderAsync(pTemplateHash,pRecord,fCallback,pContextArray,pScope,pState){const[tmpSchemaAddress,tmpTemplateHash]=pTemplateHash.trim().split('^');/** @type{import('../views/Pict-View-Form-Metacontroller.js')} */const metacontroller=this.pict.views.PictFormMetacontroller;/** @type {import('./Pict-Template-ControlFromDynamicManifest.js').Manyfest} */const manifest=metacontroller?metacontroller.manifest:this.pict.manifest;const descriptor=manifest.getDescriptor(tmpSchemaAddress);if(!descriptor){this.log.error(`PictTemplateGetViewSchemaValue: Cannot find descriptor for address [${tmpSchemaAddress}]`);if(typeof fCallback==='function'){return fCallback(null,'');}return'';}/** @type {import('../views/Pict-View-DynamicForm.js')} */const tmpView=this.pict.views[descriptor.PictForm.ViewHash];const value=tmpView.getValueByHash(tmpSchemaAddress);if(tmpTemplateHash){const tmpRecord={Value:value,ParentRecord:pRecord,View:tmpView,Descriptor:descriptor};if(typeof fCallback!=='function'){return this.pict.parseTemplateByHash(tmpTemplateHash,tmpRecord,null,pContextArray,pScope,pState);}return this.pict.parseTemplateByHash(tmpTemplateHash,tmpRecord,(pError,pValue)=>{if(pError){return fCallback(pError,'');}return fCallback(null,pValue);},pContextArray,pScope,pState);}if(typeof fCallback==='function'){fCallback(null,value?String(value):'');}else{return value?String(value):'';}}}module.exports=PictTemplateGetViewSchemaValue;},{"pict-template":242}],200:[function(require,module,exports){const libPictTemplate=require('pict-template');/**
|
|
8244
8245
|
* This is a template that will generate a Metatemplate input, for manual use of metatemplates.
|
|
8245
8246
|
*/class PictTemplateGetViewSchemaValueByHash extends libPictTemplate{/**
|
|
8246
8247
|
* @param {Object} pFable - The Fable Framework instance
|
|
@@ -8265,7 +8266,7 @@ return this.pict.parseTemplate(tmpTemplate,descriptor,fCallback,tmpContextArray,
|
|
|
8265
8266
|
* @param {any} [pScope] - A sticky scope that can be used to carry state and simplify template
|
|
8266
8267
|
* @param {any} [pState] - A catchall state object for plumbing data through template processing.
|
|
8267
8268
|
* @returns {string | undefined} - The rendered template or undefined if callback is provided.
|
|
8268
|
-
*/renderAsync(pTemplateHash,pRecord,fCallback,pContextArray,pScope,pState){const[tmpSchemaHash,tmpTemplateHash]=pTemplateHash.trim().split('^');/** @type{import('../views/Pict-View-Form-Metacontroller.js')} */const metacontroller=this.pict.views.PictFormMetacontroller;/** @type {import('./Pict-Template-ControlFromDynamicManifest.js').Manyfest} */const manifest=metacontroller?metacontroller.manifest:this.pict.manifest;const descriptor=manifest.getDescriptorByHash(tmpSchemaHash);if(!descriptor){this.log.error(`PictTemplateGetViewSchemaValueByHash: Cannot find descriptor for address [${tmpSchemaHash}]`);if(typeof fCallback==='function'){return fCallback(null,'');}return'';}/** @type {import('../views/Pict-View-DynamicForm.js')} */const tmpView=this.pict.views[descriptor.PictForm.ViewHash];const value=tmpView.getValueByHash(tmpSchemaHash);if(tmpTemplateHash){const tmpRecord={Value:value,ParentRecord:pRecord,View:tmpView,Descriptor:descriptor};if(typeof fCallback!=='function'){return this.pict.parseTemplateByHash(tmpTemplateHash,tmpRecord,null,pContextArray,pScope,pState);}return this.pict.parseTemplateByHash(tmpTemplateHash,tmpRecord,(pError,pValue)=>{if(pError){return fCallback(pError,'');}return fCallback(null,pValue);},pContextArray,pScope,pState);}if(typeof fCallback==='function'){fCallback(null,value?String(value):'');}else{return value?String(value):'';}}}module.exports=PictTemplateGetViewSchemaValueByHash;},{"pict-template":
|
|
8269
|
+
*/renderAsync(pTemplateHash,pRecord,fCallback,pContextArray,pScope,pState){const[tmpSchemaHash,tmpTemplateHash]=pTemplateHash.trim().split('^');/** @type{import('../views/Pict-View-Form-Metacontroller.js')} */const metacontroller=this.pict.views.PictFormMetacontroller;/** @type {import('./Pict-Template-ControlFromDynamicManifest.js').Manyfest} */const manifest=metacontroller?metacontroller.manifest:this.pict.manifest;const descriptor=manifest.getDescriptorByHash(tmpSchemaHash);if(!descriptor){this.log.error(`PictTemplateGetViewSchemaValueByHash: Cannot find descriptor for address [${tmpSchemaHash}]`);if(typeof fCallback==='function'){return fCallback(null,'');}return'';}/** @type {import('../views/Pict-View-DynamicForm.js')} */const tmpView=this.pict.views[descriptor.PictForm.ViewHash];const value=tmpView.getValueByHash(tmpSchemaHash);if(tmpTemplateHash){const tmpRecord={Value:value,ParentRecord:pRecord,View:tmpView,Descriptor:descriptor};if(typeof fCallback!=='function'){return this.pict.parseTemplateByHash(tmpTemplateHash,tmpRecord,null,pContextArray,pScope,pState);}return this.pict.parseTemplateByHash(tmpTemplateHash,tmpRecord,(pError,pValue)=>{if(pError){return fCallback(pError,'');}return fCallback(null,pValue);},pContextArray,pScope,pState);}if(typeof fCallback==='function'){fCallback(null,value?String(value):'');}else{return value?String(value):'';}}}module.exports=PictTemplateGetViewSchemaValueByHash;},{"pict-template":242}],201:[function(require,module,exports){const libPictTemplate=require('pict-template');/**
|
|
8269
8270
|
* This is a template that will take a value set and render a template for each value in the set.
|
|
8270
8271
|
*
|
|
8271
8272
|
* It passes along additional context (the metacontroller group) for dynamic programming tables.
|
|
@@ -8300,7 +8301,7 @@ let tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<2){this
|
|
|
8300
8301
|
if(!tmpTemplateFromMapHash){this.log.warn(`Pict: TemplateFromMap Render Async: TemplateFromMapHash not resolved for [${tmpHash}]`);return fCallback(null,'');}// Now resolve the data
|
|
8301
8302
|
tmpData=this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray,null,pScope);let tmpDataValueSet=[];if(Array.isArray(tmpData)){for(let i=0;i<tmpData.length;i++){tmpDataValueSet.push({Value:tmpData[i],Key:i});}}else if(typeof tmpData==='object'){let tmpValueKeys=Object.keys(tmpData);for(let i=0;i<tmpValueKeys.length;i++){tmpDataValueSet.push({Value:tmpData[tmpValueKeys[i]],Key:tmpValueKeys[i]});}}else{tmpDataValueSet.push({Value:tmpData});}tmpData=tmpDataValueSet;if(!tmpData){// No address was provided, just render the template with what this template has.
|
|
8302
8303
|
// The async portion of this is a mind bender because of how entry can happen dynamically from templates
|
|
8303
|
-
this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,pRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);return;}else{this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);return;}}}module.exports=PictTemplateMetacontrollerValueSet;},{"pict-template":
|
|
8304
|
+
this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,pRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);return;}else{this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);return;}}}module.exports=PictTemplateMetacontrollerValueSet;},{"pict-template":242}],202:[function(require,module,exports){const libPictTemplate=require('pict-template');/**
|
|
8304
8305
|
* This is a template that will generate a Metatemplate input, for manual use of metatemplates.
|
|
8305
8306
|
*/class PictTemplateMetatemplateInputTemplate extends libPictTemplate{/**
|
|
8306
8307
|
* @param {Object} pFable - The Fable Framework instance
|
|
@@ -8337,7 +8338,7 @@ let tmpHashTemplateSeparator=tmpHash.split(':');if(tmpHashTemplateSeparator.leng
|
|
|
8337
8338
|
let tmpInput={Address:tmpInputAddress,DataAddress:tmpInputAddress,Name:tmpInputName,Hash:this.fable.ManifestFactory.sanitizeObjectKey(tmpInputAddress),DataType:tmpDataType,PictForm:{InformaryDataAddress:tmpInputAddress,GroupIndex:0,Row:0}};this.currentInputIndex++;if(tmpInputType){tmpInput.PictForm.InputType=tmpInputType;}// Check to see if the input is already in the manifest
|
|
8338
8339
|
let tmpRow=tmpMetatemplateGenerator.dynamicInputView.getRow(0,0);for(let i=0;i<tmpRow.Inputs.length;i++){if(tmpRow.Inputs[i].Hash===tmpInput.Hash){let tmpInput=tmpRow.Inputs[i];let tmpTemplate=tmpMetatemplateGenerator.getInputMetatemplateTemplateReference(tmpMetatemplateGenerator.dynamicInputView,tmpInput.DataType,tmpInput.PictForm.InputType,`getInput("0","0","${tmpInput.PictForm.InputIndex}")`);this.pict.parseTemplate(tmpTemplate,tmpInput,fCallback,[tmpMetatemplateGenerator.dynamicInputView],tmpMetatemplateGenerator.dynamicInputView,pState);return;}}// It isn't already in the manifest, so add it.
|
|
8339
8340
|
tmpInput.PictForm.InputIndex=tmpRow.Inputs.length;tmpMetatemplateGenerator.dynamicInputView.sectionManifest.addDescriptor(tmpInput.Address,tmpInput);tmpRow.Inputs.push(tmpInput);this.pict.providers.MetatemplateMacros.buildInputMacros(tmpMetatemplateGenerator.dynamicInputView,tmpInput);// Now generate the metatemplate
|
|
8340
|
-
let tmpTemplate=tmpMetatemplateGenerator.getInputMetatemplateTemplateReference(tmpMetatemplateGenerator.dynamicInputView,tmpInput.DataType,tmpInput.PictForm.InputType,`getInput("0","0","${tmpInput.PictForm.InputIndex}")`);this.pict.parseTemplate(tmpTemplate,tmpInput,fCallback,[tmpMetatemplateGenerator.dynamicInputView],tmpMetatemplateGenerator.dynamicInputView,pState);return;}}module.exports=PictTemplateMetatemplateInputTemplate;},{"pict-template":
|
|
8341
|
+
let tmpTemplate=tmpMetatemplateGenerator.getInputMetatemplateTemplateReference(tmpMetatemplateGenerator.dynamicInputView,tmpInput.DataType,tmpInput.PictForm.InputType,`getInput("0","0","${tmpInput.PictForm.InputIndex}")`);this.pict.parseTemplate(tmpTemplate,tmpInput,fCallback,[tmpMetatemplateGenerator.dynamicInputView],tmpMetatemplateGenerator.dynamicInputView,pState);return;}}module.exports=PictTemplateMetatemplateInputTemplate;},{"pict-template":242}],203:[function(require,module,exports){const libPictTemplate=require('pict-template');/**
|
|
8341
8342
|
* This is a template that will generate a Metatemplate input, for manual use of metatemplates.
|
|
8342
8343
|
*/class PictTemplateMetatemplateInputTemplate extends libPictTemplate{/**
|
|
8343
8344
|
* @param {Object} pFable - The Fable Framework instance
|
|
@@ -8378,7 +8379,7 @@ tmpInputAddress=this.resolveStateFromAddress(tmpHashTemplateSeparator[1],pRecord
|
|
|
8378
8379
|
let tmpInput={Address:tmpInputAddress,DataAddress:tmpInputAddress,Name:tmpInputName,Hash:this.fable.ManifestFactory.sanitizeObjectKey(tmpInputAddress),DataType:tmpDataType,PictForm:{InformaryDataAddress:tmpInputAddress,GroupIndex:0,Row:0}};this.currentInputIndex++;if(tmpInputType){tmpInput.PictForm.InputType=tmpInputType;}// Check to see if the input is already in the manifest
|
|
8379
8380
|
let tmpRow=tmpMetatemplateGenerator.dynamicInputView.getRow(0,0);for(let i=0;i<tmpRow.Inputs.length;i++){if(tmpRow.Inputs[i].Hash===tmpInput.Hash){let tmpInput=tmpRow.Inputs[i];let tmpTemplate=tmpMetatemplateGenerator.getInputMetatemplateTemplateReference(tmpMetatemplateGenerator.dynamicInputView,tmpInput.DataType,tmpInput.PictForm.InputType,`getInput("0","0","${tmpInput.PictForm.InputIndex}")`);this.pict.parseTemplate(tmpTemplate,tmpInput,fCallback,[tmpMetatemplateGenerator.dynamicInputView],tmpMetatemplateGenerator.dynamicInputView,pState);return;}}// It isn't already in the manifest, so add it.
|
|
8380
8381
|
tmpInput.PictForm.InputIndex=tmpRow.Inputs.length;tmpMetatemplateGenerator.dynamicInputView.sectionManifest.addDescriptor(tmpInput.Address,tmpInput);tmpRow.Inputs.push(tmpInput);this.pict.providers.MetatemplateMacros.buildInputMacros(tmpMetatemplateGenerator.dynamicInputView,tmpInput);// Now generate the metatemplate
|
|
8381
|
-
const tmpTemplate=tmpMetatemplateGenerator.getInputMetatemplateTemplateReference(tmpMetatemplateGenerator.dynamicInputView,tmpInput.DataType,tmpInput.PictForm.InputType,`getInput("0","0","${tmpInput.PictForm.InputIndex}")`);this.pict.parseTemplate(tmpTemplate,tmpInput,fCallback,[tmpMetatemplateGenerator.dynamicInputView],tmpMetatemplateGenerator.dynamicInputView,pState);return;}}module.exports=PictTemplateMetatemplateInputTemplate;},{"pict-template":
|
|
8382
|
+
const tmpTemplate=tmpMetatemplateGenerator.getInputMetatemplateTemplateReference(tmpMetatemplateGenerator.dynamicInputView,tmpInput.DataType,tmpInput.PictForm.InputType,`getInput("0","0","${tmpInput.PictForm.InputIndex}")`);this.pict.parseTemplate(tmpTemplate,tmpInput,fCallback,[tmpMetatemplateGenerator.dynamicInputView],tmpMetatemplateGenerator.dynamicInputView,pState);return;}}module.exports=PictTemplateMetatemplateInputTemplate;},{"pict-template":242}],204:[function(require,module,exports){const libPictTemplate=require('pict-template');/**
|
|
8382
8383
|
* This is a template that will generate a dynamic input using a provided dynamic view (by hash)
|
|
8383
8384
|
*/class PictTemplateInputWithViewTemplate extends libPictTemplate{/**
|
|
8384
8385
|
* @param {Object} pFable - The Fable Framework instance
|
|
@@ -8414,7 +8415,7 @@ let tmpHashTemplateSeparator=tmpHash.split(':');if(tmpHashTemplateSeparator.leng
|
|
|
8414
8415
|
let tmpInput={Address:tmpInputAddress,DataAddress:tmpInputAddress,Name:tmpInputName,Hash:this.fable.ManifestFactory.sanitizeObjectKey(tmpInputAddress),DataType:tmpDataType,PictForm:{InformaryDataAddress:tmpInputAddress,GroupIndex:0,Row:0}};this.currentInputIndex++;if(tmpInputType){tmpInput.PictForm.InputType=tmpInputType;}const tmpInputView=this.pict.views[tmpViewHash];if(!tmpInputView||!tmpInputView.sectionManifest||typeof tmpInputView.getRow!=='function'){this.log.warn(`InputWithView template requires a valid dynamic View hash [${tmpHash}]`);return fCallback(null,'');}// Check to see if the input is already in the manifest
|
|
8415
8416
|
let tmpRow=tmpInputView.getRow(0,0);for(let i=0;i<tmpRow.Inputs.length;i++){if(tmpRow.Inputs[i].Hash===tmpInput.Hash){let tmpInput=tmpRow.Inputs[i];let tmpTemplate=tmpMetatemplateGenerator.getInputMetatemplateTemplateReference(tmpInputView,tmpInput.DataType,tmpInput.PictForm.InputType,`getInput("0","0","${tmpInput.PictForm.InputIndex}")`);this.pict.parseTemplate(tmpTemplate,tmpInput,fCallback,[tmpInputView],tmpInputView,pState);return;}}// It isn't already in the manifest, so add it.
|
|
8416
8417
|
tmpInput.PictForm.InputIndex=tmpRow.Inputs.length;tmpInputView.sectionManifest.addDescriptor(tmpInput.Address,tmpInput);tmpRow.Inputs.push(tmpInput);this.pict.providers.MetatemplateMacros.buildInputMacros(tmpInputView,tmpInput);// Now generate the metatemplate
|
|
8417
|
-
let tmpTemplate=tmpMetatemplateGenerator.getInputMetatemplateTemplateReference(tmpInputView,tmpInput.DataType,tmpInput.PictForm.InputType,`getInput("0","0","${tmpInput.PictForm.InputIndex}")`);this.pict.parseTemplate(tmpTemplate,tmpInput,fCallback,[tmpInputView],tmpInputView,pState);return;}}module.exports=PictTemplateInputWithViewTemplate;},{"pict-template":
|
|
8418
|
+
let tmpTemplate=tmpMetatemplateGenerator.getInputMetatemplateTemplateReference(tmpInputView,tmpInput.DataType,tmpInput.PictForm.InputType,`getInput("0","0","${tmpInput.PictForm.InputIndex}")`);this.pict.parseTemplate(tmpTemplate,tmpInput,fCallback,[tmpInputView],tmpInputView,pState);return;}}module.exports=PictTemplateInputWithViewTemplate;},{"pict-template":242}],205:[function(require,module,exports){const libPictTemplate=require('pict-template');/**
|
|
8418
8419
|
* This is a template that will generate a dynamic input using a provided dynamic view (by hash)
|
|
8419
8420
|
*/class PictTemplateInputWithViewAndDescriptorAddressTemplate extends libPictTemplate{/**
|
|
8420
8421
|
* @param {Object} pFable - The Fable Framework instance
|
|
@@ -8449,7 +8450,7 @@ return this.pict.parseTemplate(tmpTemplate,tmpInput,null,[tmpInputView],tmpInput
|
|
|
8449
8450
|
let tmpHashTemplateSeparator=tmpHash.split(':');if(tmpHashTemplateSeparator.length<2){this.log.warn(`InputWithViewAndDescriptorAddress template requires two parameters (ViewHash and DescriptorAddress) [${tmpHash}]`);return fCallback(null,'');}tmpViewHash=tmpHashTemplateSeparator[0];tmpDescriptorAddress=tmpHashTemplateSeparator[1];const tmpInput=this.resolveStateFromAddress(tmpDescriptorAddress,pRecord,pContextArray,null,pScope,pState);this._shoreUpDescriptor(tmpInput);this.currentInputIndex++;const tmpInputView=this.pict.views[tmpViewHash];if(!tmpInputView||!tmpInputView.sectionManifest||typeof tmpInputView.getRow!=='function'){this.log.warn(`InputWithViewAndDescriptorAddress template requires a valid dynamic View hash [${tmpHash}]`);return fCallback(null,'');}// Check to see if the input is already in the manifest
|
|
8450
8451
|
let tmpRow=tmpInputView.getRow(0,0);for(let i=0;i<tmpRow.Inputs.length;i++){if(tmpRow.Inputs[i].Hash===tmpInput.Hash){let tmpInput=tmpRow.Inputs[i];let tmpTemplate=tmpMetatemplateGenerator.getInputMetatemplateTemplateReference(tmpInputView,tmpInput.DataType,tmpInput.PictForm.InputType,`getInput("0","0","${tmpInput.PictForm.InputIndex}")`);this.pict.parseTemplate(tmpTemplate,tmpInput,fCallback,[tmpInputView],tmpInputView,pState);return;}}// It isn't already in the manifest, so add it.
|
|
8451
8452
|
tmpInput.PictForm.InputIndex=tmpRow.Inputs.length;tmpInputView.sectionManifest.addDescriptor(tmpInput.Address,tmpInput);tmpRow.Inputs.push(tmpInput);this.pict.providers.MetatemplateMacros.buildInputMacros(tmpInputView,tmpInput);// Now generate the metatemplate
|
|
8452
|
-
let tmpTemplate=tmpMetatemplateGenerator.getInputMetatemplateTemplateReference(tmpInputView,tmpInput.DataType,tmpInput.PictForm.InputType,`getInput("0","0","${tmpInput.PictForm.InputIndex}")`);this.pict.parseTemplate(tmpTemplate,tmpInput,fCallback,[tmpInputView],tmpInputView,pState);return;}_shoreUpDescriptor(pDescriptor){if(!pDescriptor||typeof pDescriptor!=='object'||Array.isArray(pDescriptor)){throw new Error('Invalid descriptor object provided to shoreUpDescriptor');}if(!pDescriptor.DataAddress){pDescriptor.DataAddress=pDescriptor.Address;}if(!pDescriptor.Hash){pDescriptor.Hash=this.fable.DataFormat.sanitizeObjectKey(pDescriptor.Address);}if(!pDescriptor.Name){pDescriptor.Name=pDescriptor.Hash;}if(!pDescriptor.DataType){pDescriptor.DataType='String';}if(!pDescriptor.PictForm){pDescriptor.PictForm={};}if(!pDescriptor.PictForm.InformaryDataAddress){pDescriptor.PictForm.InformaryDataAddress=pDescriptor.DataAddress;}if(pDescriptor.PictForm.GroupIndex==null){pDescriptor.PictForm.GroupIndex=0;}if(pDescriptor.PictForm.Row==null){pDescriptor.PictForm.Row=0;}}}module.exports=PictTemplateInputWithViewAndDescriptorAddressTemplate;},{"pict-template":
|
|
8453
|
+
let tmpTemplate=tmpMetatemplateGenerator.getInputMetatemplateTemplateReference(tmpInputView,tmpInput.DataType,tmpInput.PictForm.InputType,`getInput("0","0","${tmpInput.PictForm.InputIndex}")`);this.pict.parseTemplate(tmpTemplate,tmpInput,fCallback,[tmpInputView],tmpInputView,pState);return;}_shoreUpDescriptor(pDescriptor){if(!pDescriptor||typeof pDescriptor!=='object'||Array.isArray(pDescriptor)){throw new Error('Invalid descriptor object provided to shoreUpDescriptor');}if(!pDescriptor.DataAddress){pDescriptor.DataAddress=pDescriptor.Address;}if(!pDescriptor.Hash){pDescriptor.Hash=this.fable.DataFormat.sanitizeObjectKey(pDescriptor.Address);}if(!pDescriptor.Name){pDescriptor.Name=pDescriptor.Hash;}if(!pDescriptor.DataType){pDescriptor.DataType='String';}if(!pDescriptor.PictForm){pDescriptor.PictForm={};}if(!pDescriptor.PictForm.InformaryDataAddress){pDescriptor.PictForm.InformaryDataAddress=pDescriptor.DataAddress;}if(pDescriptor.PictForm.GroupIndex==null){pDescriptor.PictForm.GroupIndex=0;}if(pDescriptor.PictForm.Row==null){pDescriptor.PictForm.Row=0;}}}module.exports=PictTemplateInputWithViewAndDescriptorAddressTemplate;},{"pict-template":242}],206:[function(require,module,exports){const libPictTemplate=require('pict-template');/**
|
|
8453
8454
|
* This is a template that will generate a dynamic input using a provided dynamic view (by hash) and a hash address.
|
|
8454
8455
|
*/class PictTemplateInputWithViewAndHashAddressTemplate extends libPictTemplate{/**
|
|
8455
8456
|
* @param {Object} pFable - The Fable Framework instance
|
|
@@ -8491,7 +8492,7 @@ let tmpInput={Address:tmpInputAddress,DataAddress:tmpInputAddress,Name:tmpInputN
|
|
|
8491
8492
|
if(!tmpInputView||!tmpInputView.sectionManifest||typeof tmpInputView.getRow!=='function'){this.log.warn(`InputWithViewAndHashAddress template requires a valid View hash as the first parameter [${tmpHash}]`);return fCallback(null,'');}// Check to see if the input is already in the manifest
|
|
8492
8493
|
let tmpRow=tmpInputView.getRow(0,0);for(let i=0;i<tmpRow.Inputs.length;i++){if(tmpRow.Inputs[i].Hash===tmpInput.Hash){let tmpInput=tmpRow.Inputs[i];let tmpTemplate=tmpMetatemplateGenerator.getInputMetatemplateTemplateReference(tmpInputView,tmpInput.DataType,tmpInput.PictForm.InputType,`getInput("0","0","${tmpInput.PictForm.InputIndex}")`);this.pict.parseTemplate(tmpTemplate,tmpInput,fCallback,[tmpInputView],tmpInputView,pState);return;}}// It isn't already in the manifest, so add it.
|
|
8493
8494
|
tmpInput.PictForm.InputIndex=tmpRow.Inputs.length;tmpInputView.sectionManifest.addDescriptor(tmpInput.Address,tmpInput);tmpRow.Inputs.push(tmpInput);this.pict.providers.MetatemplateMacros.buildInputMacros(tmpInputView,tmpInput);// Now generate the metatemplate
|
|
8494
|
-
const tmpTemplate=tmpMetatemplateGenerator.getInputMetatemplateTemplateReference(tmpInputView,tmpInput.DataType,tmpInput.PictForm.InputType,`getInput("0","0","${tmpInput.PictForm.InputIndex}")`);this.pict.parseTemplate(tmpTemplate,tmpInput,fCallback,[tmpInputView],tmpInputView,pState);return;}}module.exports=PictTemplateInputWithViewAndHashAddressTemplate;},{"pict-template":
|
|
8495
|
+
const tmpTemplate=tmpMetatemplateGenerator.getInputMetatemplateTemplateReference(tmpInputView,tmpInput.DataType,tmpInput.PictForm.InputType,`getInput("0","0","${tmpInput.PictForm.InputIndex}")`);this.pict.parseTemplate(tmpTemplate,tmpInput,fCallback,[tmpInputView],tmpInputView,pState);return;}}module.exports=PictTemplateInputWithViewAndHashAddressTemplate;},{"pict-template":242}],207:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderPluckJoinUnique extends libPictTemplate{/**
|
|
8495
8496
|
* @param {Object} pFable - The Fable Framework instance
|
|
8496
8497
|
* @param {Object} pOptions - The options for the service
|
|
8497
8498
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -8506,7 +8507,7 @@ const tmpTemplate=tmpMetatemplateGenerator.getInputMetatemplateTemplateReference
|
|
|
8506
8507
|
* @returns {string} - The rendered template.
|
|
8507
8508
|
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash;let tmpData=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT Pluck Join Unique [fDataRender]::[${tmpHash}] with tmpData:`,tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace(`PICT Pluck Join Unique [fDataRender]::[${tmpHash}]`);}let tmpDataAddresses=tmpHash.split('^');if(tmpDataAddresses.length<3){return'';}// Get the separator string
|
|
8508
8509
|
let tmpSeparator=tmpDataAddresses.shift();let tmpAddress=tmpDataAddresses.shift();let tmpValueList=[];let tmpValueMap={};for(let i=0;i<tmpDataAddresses.length;i++){let tmpValueSet=this.resolveStateFromAddress(tmpDataAddresses[i],tmpData,pContextArray,null,pScope);if(tmpValueSet&&Array.isArray(tmpValueSet)){// This one only works on arrays of objects.
|
|
8509
|
-
for(let j=0;j<tmpValueSet.length;j++){if(tmpValueSet[j]===null||typeof tmpValueSet!=='object'){continue;}let tmpValue=this.pict.manifest.getValueByHash(tmpValueSet[j],tmpAddress);if(!(tmpValue in tmpValueMap)){tmpValueMap[tmpValue]=true;tmpValueList.push(tmpValue);}}}else if(tmpValueSet){if(!(tmpValueSet in tmpValueMap)){tmpValueMap[tmpValueSet]=true;tmpValueList.push(tmpValueSet);}}}return tmpValueList.join(tmpSeparator);}}module.exports=PictTemplateProviderPluckJoinUnique;},{"pict-template":
|
|
8510
|
+
for(let j=0;j<tmpValueSet.length;j++){if(tmpValueSet[j]===null||typeof tmpValueSet!=='object'){continue;}let tmpValue=this.pict.manifest.getValueByHash(tmpValueSet[j],tmpAddress);if(!(tmpValue in tmpValueMap)){tmpValueMap[tmpValue]=true;tmpValueList.push(tmpValue);}}}else if(tmpValueSet){if(!(tmpValueSet in tmpValueMap)){tmpValueMap[tmpValueSet]=true;tmpValueList.push(tmpValueSet);}}}return tmpValueList.join(tmpSeparator);}}module.exports=PictTemplateProviderPluckJoinUnique;},{"pict-template":242}],208:[function(require,module,exports){module.exports={"AutoRender":false,"AutoSolveWithApp":false,"ExecuteSolversWithoutMetacontroller":false,"IncludeInMetatemplateSectionGeneration":true,"IncludeInDefaultDynamicRender":true,"DefaultRenderable":"Form-Main","DefaultDestinationAddress":"#Pict-Form-Container","Renderables":[],"Templates":[],"MacroTemplates":{"Section":{"HTMLID":" id=\"Section-{~D:Context[0].UUID~}\" "},"Group":{"HTMLID":" id=\"Group-{~D:Context[0].UUID~}\" ","PictFormLayout":" data-i-pictdynamiclayout=\"true\" data-i-pictgroupindex=\"{~D:Record.GroupIndex~}\" data-i-pictlayout=\"{~D:Record.Layout~}\" ","TabularCreateRowFunctionCall":"{~P~}.views['{~D:Context[0].Hash~}'].createDynamicTableRow({~D:Record.GroupIndex~})"},"Input":{"Informary":" data-i-form=\"{~D:Context[0].formID~}\" data-i-datum=\"{~D:Record.PictForm.InformaryDataAddress~}\" ","InformaryTabular":" data-i-form=\"{~D:Context[0].formID~}\" data-i-datum=\"{~D:Record.PictForm.InformaryDataAddress~}\" data-i-container=\"{~D:Record.PictForm.InformaryContainerAddress~}\" ","ControlAttr":" data-control=\"{~D:Context[0].UUID~}-FormInput-{~D:Record.Hash~}\" ","HTMLSelector":"[data-i-form=\"{~D:Context[0].formID~}\"][data-i-datum=\"{~D:Record.PictForm.InformaryDataAddress~}\"]","HTMLSelectorTabular":"[data-i-form=\"{~D:Context[0].formID~}\"][data-i-datum=\"{~D:Record.PictForm.InformaryDataAddress~}\"][data-i-container=\"{~D:Record.PictForm.InformaryContainerAddress~}\"]","HTMLSelectorControl":"[data-control=\"{~D:Context[0].UUID~}-FormInput-{~D:Record.Hash~}\"]","HTMLSelectorControlTabular":"[data-control=\"{~D:Context[0].UUID~}-FormInput-{~D:Record.Hash~}\"]","RawHTMLID":"{~D:Context[0].UUID~}-FormInput-{~D:Record.Hash~}","HTMLName":" name=\"{~D:Record.Name~}\" ","HTMLIDAddress":"#{~D:Context[0].UUID~}-FormInput-{~D:Record.Hash~}","HTMLID":" id=\"{~D:Context[0].UUID~}-FormInput-{~D:Record.Hash~}\" ","HTMLForID":" for=\"{~D:Context[0].UUID~}-FormInput-{~D:Record.Hash~}\" ","InputFullProperties":" data-i-form=\"{~D:Context[0].formID~}\" data-i-datum=\"{~D:Record.PictForm.InformaryDataAddress~}\" name=\"{~D:Record.Name~}\" ","InputChangeHandler":" onchange=\"{~P~}.views['{~D:Context[0].Hash~}'].dataChanged('{~D:Record.Hash~}')\" ","DataRequestFunction":" {~P~}.views['{~D:Context[0].Hash~}'].inputDataRequest('{~D:Record.Hash~}'); "}},"TargetElementAddress":"#Form-Container-Div"};},{}],209:[function(require,module,exports){const libPictViewClass=require('pict-view');/** @type {Record<string, any>} */const libPackage=require('../../package.json');/** @type {Record<string, any>} */const _DefaultConfiguration=require('./Pict-View-DynamicForm-DefaultConfiguration.json');const PENDING_ASYNC_OPERATION_TYPE='PendingAsyncOperation';const TRANSACTION_COMPLETE_CALLBACK_TYPE='onTransactionComplete';const READY_TO_FINALIZE_TYPE='ReadyToFinalize';/**
|
|
8510
8511
|
* Represents a dynamic form view for the Pict application.
|
|
8511
8512
|
*
|
|
8512
8513
|
* This is the code that maintains the lifecycle with the Pict application and
|
|
@@ -8875,7 +8876,7 @@ this.finalizeTransaction(tmpTransactionGUID);}}/**
|
|
|
8875
8876
|
*/deleteDynamicTableRow(pGroupIndex,pRowIndex){return this.pict.providers.DynamicTabularData.deleteDynamicTableRow(this,pGroupIndex,pRowIndex);}/**
|
|
8876
8877
|
* Returns whether the current form is a Pict Section form.
|
|
8877
8878
|
* @returns {boolean} True if the form is a Pict Section form, false otherwise.
|
|
8878
|
-
*/get isPictSectionForm(){return true;}}module.exports=PictViewDynamicForm;module.exports.default_configuration=_DefaultConfiguration;},{"../../package.json":154,"./Pict-View-DynamicForm-DefaultConfiguration.json":208,"pict-view":
|
|
8879
|
+
*/get isPictSectionForm(){return true;}}module.exports=PictViewDynamicForm;module.exports.default_configuration=_DefaultConfiguration;},{"../../package.json":154,"./Pict-View-DynamicForm-DefaultConfiguration.json":208,"pict-view":244}],210:[function(require,module,exports){const libPictViewClass=require('pict-view');const libPictDynamicFormDependencyManager=require(`../services/Pict-Service-DynamicFormDependencyManager.js`);const libPictViewDynamicForm=require('./Pict-View-DynamicForm.js');// TODO: Potentially create an internalized list of views for this to manage, separate from the pict.views object
|
|
8879
8880
|
// TODO: Manage view lifecycle internally, including destruction of views if they are flagged to not be needed.
|
|
8880
8881
|
// Why? This allows us to dynamically add and remove sections without having to reload the application.
|
|
8881
8882
|
const PENDING_ASYNC_OPERATION_TYPE='PendingAsyncOperation';const TRANSACTION_COMPLETE_CALLBACK_TYPE='onTransactionComplete';const READY_TO_FINALIZE_TYPE='ReadyToFinalize';/**
|
|
@@ -9113,7 +9114,7 @@ this.pict.views["Pict-Form-DebugViewer"].render();}/**
|
|
|
9113
9114
|
* Returns whether the object is a Pict Metacontroller.
|
|
9114
9115
|
*
|
|
9115
9116
|
* @returns {boolean} True if the object is a Pict Metacontroller, false otherwise.
|
|
9116
|
-
*/get isPictMetacontroller(){return true;}}module.exports=PictFormMetacontroller;/** @type {Record<string, any>} */module.exports.default_configuration={"AutoRender":true,"AutoPopulateDefaultObject":true,"AutoSolveBeforeRender":true,"AutoPopulateAfterRender":true,"DefaultRenderable":"Pict-Forms-Metacontainer","DefaultDestinationAddress":"#Pict-Form-Container","OnlyRenderDynamicSections":true,"MetaTemplateHash":"Pict-Forms-Metatemplate","Templates":[{"Hash":"Pict-Forms-Metatemplate","Template":"<!-- Pict-Forms-Metatemplate HAS NOT BEEN GENERATED; call pict.views.PictFormsMetatemplate.generateMetatemplate() to build the containers -->"}],"Renderables":[{"RenderableHash":"Pict-Forms-Metacontainer","TemplateHash":"Pict-Forms-Metatemplate","DestinationAddress":"#Pict-Form-Container"}]};},{"../services/Pict-Service-DynamicFormDependencyManager.js":196,"./Pict-View-DynamicForm.js":209,"./support/Pict-View-PSF-AppData-Visualization.js":212,"./support/Pict-View-PSF-DebugViewer.js":213,"./support/Pict-View-PSF-LifeCycle-Visualization.js":214,"./support/Pict-View-PSF-Solver-Visualization.js":215,"./support/Pict-View-PSF-SpecificSolve-Visualization.js":216,"pict-view":
|
|
9117
|
+
*/get isPictMetacontroller(){return true;}}module.exports=PictFormMetacontroller;/** @type {Record<string, any>} */module.exports.default_configuration={"AutoRender":true,"AutoPopulateDefaultObject":true,"AutoSolveBeforeRender":true,"AutoPopulateAfterRender":true,"DefaultRenderable":"Pict-Forms-Metacontainer","DefaultDestinationAddress":"#Pict-Form-Container","OnlyRenderDynamicSections":true,"MetaTemplateHash":"Pict-Forms-Metatemplate","Templates":[{"Hash":"Pict-Forms-Metatemplate","Template":"<!-- Pict-Forms-Metatemplate HAS NOT BEEN GENERATED; call pict.views.PictFormsMetatemplate.generateMetatemplate() to build the containers -->"}],"Renderables":[{"RenderableHash":"Pict-Forms-Metacontainer","TemplateHash":"Pict-Forms-Metatemplate","DestinationAddress":"#Pict-Form-Container"}]};},{"../services/Pict-Service-DynamicFormDependencyManager.js":196,"./Pict-View-DynamicForm.js":209,"./support/Pict-View-PSF-AppData-Visualization.js":212,"./support/Pict-View-PSF-DebugViewer.js":213,"./support/Pict-View-PSF-LifeCycle-Visualization.js":214,"./support/Pict-View-PSF-Solver-Visualization.js":215,"./support/Pict-View-PSF-SpecificSolve-Visualization.js":216,"pict-view":244}],211:[function(require,module,exports){const libPictProvider=require('pict-provider');/** @type {Record<string, any>} */const _DefaultProviderConfiguration={"ProviderIdentifier":"Pict-Form-SupportExtensions","AutoInitialize":true,"AutoInitializeOrdinal":0,"AutoSolveWithApp":false};/**
|
|
9117
9118
|
* Represents a class that provides dynamic templates for the Pict form section provider.
|
|
9118
9119
|
* @extends libPictProvider
|
|
9119
9120
|
*/class PictSupportExtension extends libPictProvider{/**
|
|
@@ -9684,7 +9685,1056 @@ if(tmpResizableElement&&tmpResizableControl){tmpResizableControl.addEventListene
|
|
|
9684
9685
|
let tmpComputedStyle=getComputedStyle(tmpResizableElement);let tmpMinWidth=parseInt(tmpComputedStyle.minWidth,10);let tmpMinHeight=parseInt(tmpComputedStyle.minHeight,10);if(tmpNewWidth<tmpMinWidth){tmpNewWidth=tmpMinWidth;}if(tmpNewHeight<tmpMinHeight){tmpNewHeight=tmpMinHeight;}tmpResizableElement.style.width=tmpNewWidth+'px';tmpResizableElement.style.height=tmpNewHeight+'px';}function dragResizeStop(pEvent){window.removeEventListener('pointermove',dragResizeHandler);window.removeEventListener('pointerup',dragResizeStop);}window.addEventListener('pointermove',dragResizeHandler);window.addEventListener('pointerup',dragResizeStop);// Prevent janky selection behaviors in the browser
|
|
9685
9686
|
pEvent.preventDefault();});/*
|
|
9686
9687
|
* END of browser event code block
|
|
9687
|
-
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */}}}module.exports=PictFormsSupportBase;module.exports.default_configuration=defaultViewConfiguration;},{"./Pict-Provider-PSF-Support.js":211,"pict-view":
|
|
9688
|
+
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */}}}module.exports=PictFormsSupportBase;module.exports.default_configuration=defaultViewConfiguration;},{"./Pict-Provider-PSF-Support.js":211,"pict-view":244}],218:[function(require,module,exports){/**
|
|
9689
|
+
* Pict-MDE-CodeMirror: Helper module for PictSectionMarkdownEditor
|
|
9690
|
+
*
|
|
9691
|
+
* Handles CodeMirror editor instance creation, extension configuration,
|
|
9692
|
+
* keyboard shortcuts, paste handling, and the data URI collapse extension.
|
|
9693
|
+
*//**
|
|
9694
|
+
* Attach CodeMirror editor creation methods to the view instance.
|
|
9695
|
+
*
|
|
9696
|
+
* @param {object} pView - The PictSectionMarkdownEditor instance
|
|
9697
|
+
*/module.exports.attach=function attach(pView){/**
|
|
9698
|
+
* Create a CodeMirror editor instance inside a container element.
|
|
9699
|
+
*
|
|
9700
|
+
* @param {HTMLElement} pContainer - The DOM element to mount the editor in
|
|
9701
|
+
* @param {number} pSegmentIndex - The segment index
|
|
9702
|
+
* @param {string} pContent - The initial content
|
|
9703
|
+
*/pView._createEditorInContainer=function _createEditorInContainer(pContainer,pSegmentIndex,pContent){let tmpCM=pView._codeMirrorModules;// Build the extensions array
|
|
9704
|
+
let tmpExtensions=[];// Add consumer-provided extensions (e.g. basicSetup, markdown())
|
|
9705
|
+
if(tmpCM.extensions&&Array.isArray(tmpCM.extensions)){tmpExtensions=tmpExtensions.concat(tmpCM.extensions);}// Update listener for content changes, focus, and cursor tracking
|
|
9706
|
+
tmpExtensions.push(tmpCM.EditorView.updateListener.of(pUpdate=>{if(pUpdate.docChanged){pView._onSegmentContentChange(pSegmentIndex,pUpdate.state.doc.toString());}// Track focus changes to toggle the active class
|
|
9707
|
+
if(pUpdate.focusChanged){if(pUpdate.view.hasFocus){pView._setActiveSegment(pSegmentIndex);// Position sidebar at cursor on focus
|
|
9708
|
+
pView._updateSidebarPosition(pSegmentIndex);}else{// Small delay so clicking a sidebar button doesn't immediately deactivate
|
|
9709
|
+
setTimeout(()=>{if(pView._activeSegmentIndex===pSegmentIndex){// Check if focus moved to another segment or truly left
|
|
9710
|
+
let tmpSegEl=document.getElementById(`PictMDE-Segment-${pSegmentIndex}`);if(tmpSegEl&&!tmpSegEl.contains(document.activeElement)){pView._clearActiveSegment(pSegmentIndex);pView._resetSidebarPosition(pSegmentIndex);}}},100);}}// Track cursor/selection changes to move the sidebar
|
|
9711
|
+
if(pUpdate.selectionSet&&pUpdate.view.hasFocus){pView._updateSidebarPosition(pSegmentIndex);}}));// Keyboard shortcuts for formatting and image paste handling
|
|
9712
|
+
tmpExtensions.push(tmpCM.EditorView.domEventHandlers({keydown:(pEvent,pEditorView)=>{// Ctrl/Cmd + B = bold
|
|
9713
|
+
if((pEvent.ctrlKey||pEvent.metaKey)&&pEvent.key==='b'){pEvent.preventDefault();pView.applyFormatting(pSegmentIndex,'bold');return true;}// Ctrl/Cmd + I = italic
|
|
9714
|
+
if((pEvent.ctrlKey||pEvent.metaKey)&&pEvent.key==='i'){pEvent.preventDefault();pView.applyFormatting(pSegmentIndex,'italic');return true;}// Ctrl/Cmd + E = inline code
|
|
9715
|
+
if((pEvent.ctrlKey||pEvent.metaKey)&&pEvent.key==='e'){pEvent.preventDefault();pView.applyFormatting(pSegmentIndex,'code');return true;}},paste:(pEvent,pEditorView)=>{// Check clipboard for image data
|
|
9716
|
+
let tmpItems=pEvent.clipboardData&&pEvent.clipboardData.items;if(!tmpItems){return false;}for(let i=0;i<tmpItems.length;i++){if(tmpItems[i].type.startsWith('image/')){pEvent.preventDefault();let tmpFile=tmpItems[i].getAsFile();if(tmpFile){pView._processImageFile(tmpFile,pSegmentIndex);}return true;}}return false;}}));// Collapse long data URIs in image markdown so the editor is readable
|
|
9717
|
+
let tmpCollapseExtension=pView._buildDataURICollapseExtension();if(tmpCollapseExtension){tmpExtensions.push(tmpCollapseExtension);}// Make read-only if configured
|
|
9718
|
+
if(pView.options.ReadOnly){tmpExtensions.push(tmpCM.EditorState.readOnly.of(true));tmpExtensions.push(tmpCM.EditorView.editable.of(false));}// Allow consumer to customize extensions
|
|
9719
|
+
tmpExtensions=pView.customConfigureExtensions(tmpExtensions,pSegmentIndex);let tmpState=tmpCM.EditorState.create({doc:pContent||'',extensions:tmpExtensions});let tmpEditorView=new tmpCM.EditorView({state:tmpState,parent:pContainer});pView._segmentEditors[pSegmentIndex]=tmpEditorView;};/**
|
|
9720
|
+
* Build a CodeMirror extension that visually collapses long data URIs
|
|
9721
|
+
* inside markdown image syntax.
|
|
9722
|
+
*
|
|
9723
|
+
* The extension uses Decoration.replace() to hide the long base64 portion
|
|
9724
|
+
* and show a compact widget instead, e.g. "data:image/jpeg;base64...28KB".
|
|
9725
|
+
* The actual document content is unchanged -- only the visual display
|
|
9726
|
+
* is affected.
|
|
9727
|
+
*
|
|
9728
|
+
* Returns null if the required CodeMirror modules (Decoration, ViewPlugin,
|
|
9729
|
+
* WidgetType) are not available.
|
|
9730
|
+
*
|
|
9731
|
+
* @returns {object|null} A CodeMirror ViewPlugin extension, or null
|
|
9732
|
+
*/pView._buildDataURICollapseExtension=function _buildDataURICollapseExtension(){let tmpCM=pView._codeMirrorModules;// All three classes are required -- degrade gracefully if not available
|
|
9733
|
+
if(!tmpCM||!tmpCM.Decoration||!tmpCM.ViewPlugin||!tmpCM.WidgetType){return null;}let tmpDecoration=tmpCM.Decoration;let tmpViewPlugin=tmpCM.ViewPlugin;let tmpWidgetType=tmpCM.WidgetType;// Minimum data URI length before collapsing (short URIs are left alone)
|
|
9734
|
+
let tmpMinLength=200;// Widget class: renders the collapsed placeholder inline
|
|
9735
|
+
class DataURIWidget extends tmpWidgetType{constructor(pLabel){super();this.label=pLabel;}toDOM(){let tmpSpan=document.createElement('span');tmpSpan.className='pict-mde-data-uri-collapsed';tmpSpan.textContent=this.label;tmpSpan.title='Data URI (click to expand in image preview below)';return tmpSpan;}eq(pOther){return this.label===pOther.label;}}/**
|
|
9736
|
+
* Scan the visible ranges of the document for data URIs inside image
|
|
9737
|
+
* markdown and build a DecorationSet that replaces the long portion.
|
|
9738
|
+
*
|
|
9739
|
+
* Pattern: 
|
|
9740
|
+
*
|
|
9741
|
+
* We keep "" with a compact widget.
|
|
9743
|
+
*/function buildDecorations(pEditorView){let tmpDecorations=[];let tmpDoc=pEditorView.state.doc;for(let tmpVisRange of pEditorView.visibleRanges){let tmpFrom=tmpVisRange.from;let tmpTo=tmpVisRange.to;let tmpText=tmpDoc.sliceString(tmpFrom,tmpTo);// Match:  -- we need positions of the base64 payload
|
|
9744
|
+
let tmpRegex=/!\[[^\]]*\]\(data:([^;]+);base64,/g;let tmpMatch;while((tmpMatch=tmpRegex.exec(tmpText))!==null){// tmpMatch[0] is "'
|
|
9748
|
+
// We need to handle this carefully since the payload could be huge
|
|
9749
|
+
// and span beyond the visible range.
|
|
9750
|
+
// Search up to 5MB worth of characters (way more than any realistic image).
|
|
9751
|
+
let tmpMaxScan=Math.min(tmpDocLength,tmpSearchFrom+5*1024*1024);let tmpChunkSize=4096;for(let tmpPos=tmpSearchFrom;tmpPos<tmpMaxScan;tmpPos+=tmpChunkSize){let tmpEnd=Math.min(tmpPos+tmpChunkSize,tmpMaxScan);let tmpChunk=tmpDoc.sliceString(tmpPos,tmpEnd);let tmpParenIdx=tmpChunk.indexOf(')');if(tmpParenIdx>=0){tmpPayloadEnd=tmpPos+tmpParenIdx;break;}}if(tmpPayloadEnd<0){// No closing paren found -- skip this match
|
|
9752
|
+
continue;}// Calculate the payload length (base64 data between comma and closing paren)
|
|
9753
|
+
let tmpPayloadLength=tmpPayloadEnd-tmpPayloadStart;if(tmpPayloadLength<tmpMinLength){// Too short to bother collapsing
|
|
9754
|
+
continue;}// Build a human-readable size label
|
|
9755
|
+
let tmpSizeBytes=Math.round(tmpPayloadLength*0.75);// base64 to bytes approx
|
|
9756
|
+
let tmpSizeLabel;if(tmpSizeBytes>=1024*1024){tmpSizeLabel=(tmpSizeBytes/(1024*1024)).toFixed(1)+'MB';}else if(tmpSizeBytes>=1024){tmpSizeLabel=Math.round(tmpSizeBytes/1024)+'KB';}else{tmpSizeLabel=tmpSizeBytes+'B';}let tmpMimeType=tmpMatch[1]||'image';let tmpWidgetLabel=`\u2026${tmpSizeLabel})`;// Replace from the start of the base64 payload to after the closing paren
|
|
9757
|
+
let tmpWidget=tmpDecoration.replace({widget:new DataURIWidget(tmpWidgetLabel)});tmpDecorations.push(tmpWidget.range(tmpPayloadStart,tmpPayloadEnd+1));}}return tmpDecoration.set(tmpDecorations,true);}// Create the ViewPlugin
|
|
9758
|
+
let tmpPlugin=tmpViewPlugin.fromClass(class{constructor(pEditorView){this.decorations=buildDecorations(pEditorView);}update(pUpdate){if(pUpdate.docChanged||pUpdate.viewportChanged){this.decorations=buildDecorations(pUpdate.view);}}},{decorations:pPlugin=>pPlugin.decorations});return tmpPlugin;};};},{}],219:[function(require,module,exports){/**
|
|
9759
|
+
* Pict-MDE-DragAndReorder: Helper module for PictSectionMarkdownEditor
|
|
9760
|
+
*
|
|
9761
|
+
* Handles segment drag-and-drop reordering, active segment management,
|
|
9762
|
+
* sidebar cursor-tracking positioning, and hidden-preview state maintenance
|
|
9763
|
+
* across reorder operations.
|
|
9764
|
+
*//**
|
|
9765
|
+
* Attach drag/reorder and active-segment methods to the view instance.
|
|
9766
|
+
*
|
|
9767
|
+
* @param {object} pView - The PictSectionMarkdownEditor instance
|
|
9768
|
+
*/module.exports.attach=function attach(pView){/**
|
|
9769
|
+
* Wire drag-and-drop events on a segment element for reorder via the drag handle.
|
|
9770
|
+
*
|
|
9771
|
+
* @param {HTMLElement} pSegmentElement - The .pict-mde-segment element
|
|
9772
|
+
* @param {number} pSegmentIndex - The internal segment index
|
|
9773
|
+
*/pView._wireSegmentDragEvents=function _wireSegmentDragEvents(pSegmentElement,pSegmentIndex){let tmpHandle=pSegmentElement.querySelector('.pict-mde-drag-handle');if(!tmpHandle){return;}// The drag handle is the draggable element
|
|
9774
|
+
tmpHandle.addEventListener('dragstart',pEvent=>{pView._dragSourceIndex=pSegmentIndex;pEvent.dataTransfer.effectAllowed='move';pEvent.dataTransfer.setData('text/plain',String(pSegmentIndex));// Add a dragging class to the container so CSS can disable pointer-events
|
|
9775
|
+
// on CodeMirror editors (preventing them from intercepting the drop event)
|
|
9776
|
+
let tmpContainerEl=pView._getContainerElement();if(tmpContainerEl){tmpContainerEl.classList.add('pict-mde-dragging');}setTimeout(()=>{pSegmentElement.style.opacity='0.4';},0);});tmpHandle.addEventListener('dragend',()=>{pSegmentElement.style.opacity='';pView._dragSourceIndex=-1;pView._clearAllDropIndicators();// Remove the dragging class from the container
|
|
9777
|
+
let tmpContainerEl=pView._getContainerElement();if(tmpContainerEl){tmpContainerEl.classList.remove('pict-mde-dragging');}});// Drop target: the whole segment row. We determine above/below from mouse Y.
|
|
9778
|
+
pSegmentElement.addEventListener('dragover',pEvent=>{pEvent.preventDefault();pEvent.dataTransfer.dropEffect='move';// Clear all indicators first, then set the correct one
|
|
9779
|
+
pView._clearAllDropIndicators();// Determine if cursor is in the top or bottom half of this segment
|
|
9780
|
+
let tmpRect=pSegmentElement.getBoundingClientRect();let tmpMidY=tmpRect.top+tmpRect.height/2;if(pEvent.clientY<tmpMidY){pSegmentElement.classList.add('pict-mde-drag-over-top');}else{pSegmentElement.classList.add('pict-mde-drag-over-bottom');}});pSegmentElement.addEventListener('dragleave',pEvent=>{// Only clear if we're actually leaving the element (not entering a child)
|
|
9781
|
+
if(!pSegmentElement.contains(pEvent.relatedTarget)){pSegmentElement.classList.remove('pict-mde-drag-over-top');pSegmentElement.classList.remove('pict-mde-drag-over-bottom');}});pSegmentElement.addEventListener('drop',pEvent=>{pEvent.preventDefault();let tmpDropBelow=pSegmentElement.classList.contains('pict-mde-drag-over-bottom');pView._clearAllDropIndicators();let tmpSourceIndex=pView._dragSourceIndex;if(tmpSourceIndex<0||tmpSourceIndex===pSegmentIndex){return;}pView._reorderSegment(tmpSourceIndex,pSegmentIndex,tmpDropBelow);});};/**
|
|
9782
|
+
* Clear all drop indicator classes from all segments.
|
|
9783
|
+
*/pView._clearAllDropIndicators=function _clearAllDropIndicators(){let tmpContainer=pView._getContainerElement();if(!tmpContainer){return;}let tmpAllSegments=tmpContainer.querySelectorAll('.pict-mde-segment');for(let i=0;i<tmpAllSegments.length;i++){tmpAllSegments[i].classList.remove('pict-mde-drag-over-top');tmpAllSegments[i].classList.remove('pict-mde-drag-over-bottom');}};/**
|
|
9784
|
+
* Reorder a segment from one position to another via drag.
|
|
9785
|
+
*
|
|
9786
|
+
* @param {number} pFromInternalIndex - The internal index of the dragged segment
|
|
9787
|
+
* @param {number} pToInternalIndex - The internal index of the drop target
|
|
9788
|
+
* @param {boolean} pDropBelow - Whether the drop was on the bottom half of the target
|
|
9789
|
+
*/pView._reorderSegment=function _reorderSegment(pFromInternalIndex,pToInternalIndex,pDropBelow){let tmpFromLogical=pView._getLogicalIndex(pFromInternalIndex);let tmpToLogical=pView._getLogicalIndex(pToInternalIndex);if(tmpFromLogical<0||tmpToLogical<0){pView.log.warn(`PICT-MarkdownEditor _reorderSegment: could not resolve logical indices (from=${tmpFromLogical}, to=${tmpToLogical}).`);return;}if(tmpFromLogical===tmpToLogical){return;}// Marshal all editor content back to data before manipulating the array
|
|
9790
|
+
pView._marshalAllEditorsToData();let tmpSegments=pView._getSegmentsFromData();if(!tmpSegments||tmpSegments.length<2){return;}// Calculate the target insertion index
|
|
9791
|
+
let tmpInsertAt=pDropBelow?tmpToLogical+1:tmpToLogical;// Adjust for the removal shifting indices down
|
|
9792
|
+
if(tmpFromLogical<tmpInsertAt){tmpInsertAt--;}// If the insert position equals the source, no move needed
|
|
9793
|
+
if(tmpInsertAt===tmpFromLogical){return;}// Perform the reorder: remove from old position, insert at new
|
|
9794
|
+
let tmpMoved=tmpSegments.splice(tmpFromLogical,1)[0];tmpSegments.splice(tmpInsertAt,0,tmpMoved);// Explicitly write the reordered array back to the data address
|
|
9795
|
+
pView._setSegmentsToData(tmpSegments);// Reorder per-segment hidden preview state to follow the moved segment
|
|
9796
|
+
pView._reorderHiddenPreviewState(tmpFromLogical,tmpInsertAt);pView._buildEditorUI();};/**
|
|
9797
|
+
* Reorder the hidden preview state after a splice-based move
|
|
9798
|
+
* (remove from pFrom, insert at pTo).
|
|
9799
|
+
*
|
|
9800
|
+
* @param {number} pFrom - The logical index the segment was removed from
|
|
9801
|
+
* @param {number} pTo - The logical index the segment was inserted at
|
|
9802
|
+
*/pView._reorderHiddenPreviewState=function _reorderHiddenPreviewState(pFrom,pTo){if(pFrom===pTo){return;}// Build an ordered array of hidden-state booleans
|
|
9803
|
+
let tmpKeys=Object.keys(pView._hiddenPreviewSegments).map(k=>parseInt(k,10));if(tmpKeys.length===0){return;}let tmpMaxIndex=Math.max(...tmpKeys,pFrom,pTo);let tmpStates=[];for(let i=0;i<=tmpMaxIndex;i++){tmpStates.push(!!pView._hiddenPreviewSegments[i]);}// Perform the same splice on the states array
|
|
9804
|
+
let tmpMovedState=tmpStates.splice(pFrom,1)[0];tmpStates.splice(pTo,0,tmpMovedState);// Rebuild the hidden map
|
|
9805
|
+
pView._hiddenPreviewSegments={};for(let i=0;i<tmpStates.length;i++){if(tmpStates[i]){pView._hiddenPreviewSegments[i]=true;}}};/**
|
|
9806
|
+
* Swap the hidden preview state of two logical indices.
|
|
9807
|
+
* Used when moveSegmentUp/Down swaps adjacent segments.
|
|
9808
|
+
*
|
|
9809
|
+
* @param {number} pIndexA - First logical index
|
|
9810
|
+
* @param {number} pIndexB - Second logical index
|
|
9811
|
+
*/pView._swapHiddenPreviewState=function _swapHiddenPreviewState(pIndexA,pIndexB){let tmpAHidden=!!pView._hiddenPreviewSegments[pIndexA];let tmpBHidden=!!pView._hiddenPreviewSegments[pIndexB];if(tmpBHidden){pView._hiddenPreviewSegments[pIndexA]=true;}else{delete pView._hiddenPreviewSegments[pIndexA];}if(tmpAHidden){pView._hiddenPreviewSegments[pIndexB]=true;}else{delete pView._hiddenPreviewSegments[pIndexB];}};// -- Active Segment Management --
|
|
9812
|
+
/**
|
|
9813
|
+
* Set a segment as the active (focused) segment.
|
|
9814
|
+
*
|
|
9815
|
+
* @param {number} pSegmentIndex - The internal segment index
|
|
9816
|
+
*/pView._setActiveSegment=function _setActiveSegment(pSegmentIndex){// Clear previous active
|
|
9817
|
+
if(pView._activeSegmentIndex>=0&&pView._activeSegmentIndex!==pSegmentIndex){let tmpPrevEl=document.getElementById(`PictMDE-Segment-${pView._activeSegmentIndex}`);if(tmpPrevEl){tmpPrevEl.classList.remove('pict-mde-active');}}pView._activeSegmentIndex=pSegmentIndex;let tmpSegEl=document.getElementById(`PictMDE-Segment-${pSegmentIndex}`);if(tmpSegEl){tmpSegEl.classList.add('pict-mde-active');}};/**
|
|
9818
|
+
* Clear the active state from a segment (on blur).
|
|
9819
|
+
*
|
|
9820
|
+
* @param {number} pSegmentIndex - The internal segment index
|
|
9821
|
+
*/pView._clearActiveSegment=function _clearActiveSegment(pSegmentIndex){if(pView._activeSegmentIndex===pSegmentIndex){pView._activeSegmentIndex=-1;}let tmpSegEl=document.getElementById(`PictMDE-Segment-${pSegmentIndex}`);if(tmpSegEl){tmpSegEl.classList.remove('pict-mde-active');}// Reset sidebar back to sticky when segment is no longer active
|
|
9822
|
+
pView._resetSidebarPosition(pSegmentIndex);};// -- Sidebar Cursor Tracking --
|
|
9823
|
+
/**
|
|
9824
|
+
* Update the sidebar formatting-buttons position so they float next to the
|
|
9825
|
+
* cursor / selection in the active segment.
|
|
9826
|
+
*
|
|
9827
|
+
* When a segment is active and has a cursor, we switch the sidebar-actions
|
|
9828
|
+
* from sticky positioning to absolute, offset to align with the cursor line.
|
|
9829
|
+
*
|
|
9830
|
+
* @param {number} pSegmentIndex - The internal segment index
|
|
9831
|
+
*/pView._updateSidebarPosition=function _updateSidebarPosition(pSegmentIndex){let tmpSegmentEl=document.getElementById(`PictMDE-Segment-${pSegmentIndex}`);if(!tmpSegmentEl){return;}let tmpQuadrantTR=tmpSegmentEl.querySelector('.pict-mde-quadrant-tr');if(!tmpQuadrantTR){return;}let tmpEditor=pView._segmentEditors[pSegmentIndex];if(!tmpEditor){return;}// Get the cursor position in the editor
|
|
9832
|
+
let tmpCursorPos=tmpEditor.state.selection.main.head;let tmpCursorCoords=tmpEditor.coordsAtPos(tmpCursorPos);if(!tmpCursorCoords){// If we can't get coords, revert to sticky
|
|
9833
|
+
pView._resetSidebarPosition(pSegmentIndex);return;}// Calculate the offset relative to the segment element
|
|
9834
|
+
let tmpSegmentRect=tmpSegmentEl.getBoundingClientRect();let tmpOffsetTop=tmpCursorCoords.top-tmpSegmentRect.top;// Clamp so the sidebar buttons don't go above the segment or below it
|
|
9835
|
+
let tmpSidebarHeight=tmpQuadrantTR.offsetHeight||0;let tmpSegmentHeight=tmpSegmentEl.offsetHeight||0;let tmpMaxOffset=Math.max(0,tmpSegmentHeight-tmpSidebarHeight);tmpOffsetTop=Math.max(0,Math.min(tmpOffsetTop,tmpMaxOffset));// Apply the cursor-relative positioning
|
|
9836
|
+
tmpQuadrantTR.classList.add('pict-mde-sidebar-at-cursor');tmpQuadrantTR.style.setProperty('--pict-mde-sidebar-top',`${tmpOffsetTop}px`);};/**
|
|
9837
|
+
* Reset the sidebar back to default sticky positioning (no cursor tracking).
|
|
9838
|
+
*
|
|
9839
|
+
* @param {number} pSegmentIndex - The internal segment index
|
|
9840
|
+
*/pView._resetSidebarPosition=function _resetSidebarPosition(pSegmentIndex){let tmpSegmentEl=document.getElementById(`PictMDE-Segment-${pSegmentIndex}`);if(!tmpSegmentEl){return;}let tmpQuadrantTR=tmpSegmentEl.querySelector('.pict-mde-quadrant-tr');if(!tmpQuadrantTR){return;}tmpQuadrantTR.classList.remove('pict-mde-sidebar-at-cursor');tmpQuadrantTR.style.removeProperty('--pict-mde-sidebar-top');};};},{}],220:[function(require,module,exports){/**
|
|
9841
|
+
* Pict-MDE-Formatting: Helper module for PictSectionMarkdownEditor
|
|
9842
|
+
*
|
|
9843
|
+
* Handles markdown formatting operations (bold, italic, code, heading, link)
|
|
9844
|
+
* applied to selections or at the cursor position in CodeMirror editors.
|
|
9845
|
+
*/// Markdown formatting definitions: wrapper characters for toggle-style formatting
|
|
9846
|
+
const _FormattingMap={bold:{wrap:'**'},italic:{wrap:'*'},code:{wrap:'`'},heading:{prefix:'# '},link:{before:'[',after:'](url)'}};/**
|
|
9847
|
+
* Attach formatting methods to the view instance.
|
|
9848
|
+
*
|
|
9849
|
+
* @param {object} pView - The PictSectionMarkdownEditor instance
|
|
9850
|
+
*/module.exports.attach=function attach(pView){/**
|
|
9851
|
+
* Apply markdown formatting to the selection (or insert formatting at cursor)
|
|
9852
|
+
* in a specific segment.
|
|
9853
|
+
*
|
|
9854
|
+
* If text is selected, wraps it. If no selection, inserts the formatting
|
|
9855
|
+
* markers and places the cursor between them.
|
|
9856
|
+
*
|
|
9857
|
+
* @param {number} pSegmentIndex - The internal segment index
|
|
9858
|
+
* @param {string} pFormatType - One of: 'bold', 'italic', 'code', 'heading', 'link'
|
|
9859
|
+
*/pView.applyFormatting=function applyFormatting(pSegmentIndex,pFormatType){let tmpEditor=pView._segmentEditors[pSegmentIndex];if(!tmpEditor){pView.log.warn(`PICT-MarkdownEditor applyFormatting: no editor for segment ${pSegmentIndex}.`);return;}let tmpFormat=_FormattingMap[pFormatType];if(!tmpFormat){pView.log.warn(`PICT-MarkdownEditor applyFormatting: unknown format type "${pFormatType}".`);return;}let tmpState=tmpEditor.state;let tmpSelection=tmpState.selection.main;let tmpFrom=tmpSelection.from;let tmpTo=tmpSelection.to;let tmpHasSelection=tmpFrom!==tmpTo;let tmpSelectedText=tmpHasSelection?tmpState.sliceDoc(tmpFrom,tmpTo):'';let tmpChanges;let tmpCursorPos;if(tmpFormat.wrap){// Toggle-style: wrap selection or insert empty wrapper
|
|
9860
|
+
let tmpWrap=tmpFormat.wrap;if(tmpHasSelection){// Check if already wrapped — if so, unwrap
|
|
9861
|
+
let tmpBefore=tmpState.sliceDoc(Math.max(0,tmpFrom-tmpWrap.length),tmpFrom);let tmpAfter=tmpState.sliceDoc(tmpTo,Math.min(tmpState.doc.length,tmpTo+tmpWrap.length));if(tmpBefore===tmpWrap&&tmpAfter===tmpWrap){// Unwrap
|
|
9862
|
+
tmpChanges=[{from:tmpFrom-tmpWrap.length,to:tmpFrom,insert:''},{from:tmpTo,to:tmpTo+tmpWrap.length,insert:''}];tmpCursorPos=tmpFrom-tmpWrap.length;tmpEditor.dispatch({changes:tmpChanges,selection:{anchor:tmpCursorPos,head:tmpCursorPos+tmpSelectedText.length}});return;}// Wrap the selection
|
|
9863
|
+
let tmpInsert=tmpWrap+tmpSelectedText+tmpWrap;tmpChanges={from:tmpFrom,to:tmpTo,insert:tmpInsert};tmpCursorPos=tmpFrom+tmpWrap.length;tmpEditor.dispatch({changes:tmpChanges,selection:{anchor:tmpCursorPos,head:tmpCursorPos+tmpSelectedText.length}});}else{// No selection: insert empty wrapper and place cursor inside
|
|
9864
|
+
let tmpInsert=tmpWrap+tmpWrap;tmpChanges={from:tmpFrom,insert:tmpInsert};tmpCursorPos=tmpFrom+tmpWrap.length;tmpEditor.dispatch({changes:tmpChanges,selection:{anchor:tmpCursorPos}});}}else if(tmpFormat.prefix){// Line-prefix style (headings)
|
|
9865
|
+
let tmpLine=tmpState.doc.lineAt(tmpFrom);let tmpLineText=tmpLine.text;// Toggle: if line already starts with the prefix, remove it; otherwise add
|
|
9866
|
+
if(tmpLineText.startsWith(tmpFormat.prefix)){tmpChanges={from:tmpLine.from,to:tmpLine.from+tmpFormat.prefix.length,insert:''};}else{tmpChanges={from:tmpLine.from,insert:tmpFormat.prefix};}tmpEditor.dispatch({changes:tmpChanges});}else if(tmpFormat.before&&tmpFormat.after){// Surround style (links)
|
|
9867
|
+
if(tmpHasSelection){let tmpInsert=tmpFormat.before+tmpSelectedText+tmpFormat.after;tmpChanges={from:tmpFrom,to:tmpTo,insert:tmpInsert};// Place cursor on the "url" part
|
|
9868
|
+
tmpCursorPos=tmpFrom+tmpFormat.before.length+tmpSelectedText.length+2;tmpEditor.dispatch({changes:tmpChanges,selection:{anchor:tmpCursorPos,head:tmpCursorPos+3}});}else{let tmpInsert=tmpFormat.before+tmpFormat.after;tmpChanges={from:tmpFrom,insert:tmpInsert};tmpCursorPos=tmpFrom+tmpFormat.before.length;tmpEditor.dispatch({changes:tmpChanges,selection:{anchor:tmpCursorPos}});}}// Re-focus the editor after clicking a sidebar button
|
|
9869
|
+
tmpEditor.focus();};};},{}],221:[function(require,module,exports){/**
|
|
9870
|
+
* Pict-MDE-ImageHandling: Helper module for PictSectionMarkdownEditor
|
|
9871
|
+
*
|
|
9872
|
+
* Handles image operations: file picker, file processing (hook or base64
|
|
9873
|
+
* fallback), markdown insertion, preview thumbnail rendering, and
|
|
9874
|
+
* drag-and-drop for image files onto the editor.
|
|
9875
|
+
*//**
|
|
9876
|
+
* Attach image handling methods to the view instance.
|
|
9877
|
+
*
|
|
9878
|
+
* @param {object} pView - The PictSectionMarkdownEditor instance
|
|
9879
|
+
*/module.exports.attach=function attach(pView){/**
|
|
9880
|
+
* Open a file picker to select an image for insertion into a segment.
|
|
9881
|
+
* Called by the sidebar image button onclick handler.
|
|
9882
|
+
*
|
|
9883
|
+
* @param {number} pSegmentIndex - The internal segment index
|
|
9884
|
+
*/pView.openImagePicker=function openImagePicker(pSegmentIndex){let tmpFileInput=document.getElementById(`PictMDE-ImageInput-${pSegmentIndex}`);if(!tmpFileInput){pView.log.warn(`PICT-MarkdownEditor openImagePicker: file input not found for segment ${pSegmentIndex}.`);return;}// Wire the change handler fresh each time (in case it was already used)
|
|
9885
|
+
tmpFileInput.onchange=()=>{if(tmpFileInput.files&&tmpFileInput.files.length>0){pView._processImageFile(tmpFileInput.files[0],pSegmentIndex);}// Reset the input so the same file can be re-selected
|
|
9886
|
+
tmpFileInput.value='';};tmpFileInput.click();};/**
|
|
9887
|
+
* Process an image File object from any input method (picker, drag, paste).
|
|
9888
|
+
*
|
|
9889
|
+
* If the consumer has overridden onImageUpload and it returns true, the
|
|
9890
|
+
* consumer handles the upload and calls the callback with a URL.
|
|
9891
|
+
* Otherwise, the image is converted to a base64 data URI inline.
|
|
9892
|
+
*
|
|
9893
|
+
* @param {File} pFile - The image File object
|
|
9894
|
+
* @param {number} pSegmentIndex - The internal segment index
|
|
9895
|
+
*/pView._processImageFile=function _processImageFile(pFile,pSegmentIndex){if(!pFile||!pFile.type||!pFile.type.startsWith('image/')){pView.log.warn(`PICT-MarkdownEditor _processImageFile: not an image file (type: ${pFile?pFile.type:'null'}).`);return;}let tmpAltText=pFile.name?pFile.name.replace(/\.[^.]+$/,''):'image';// Check if the consumer wants to handle the upload
|
|
9896
|
+
let tmpCallback=(pError,pURL)=>{if(pError){pView.log.error(`PICT-MarkdownEditor image upload error: ${pError}`);return;}if(pURL){pView._insertImageMarkdown(pSegmentIndex,pURL,tmpAltText);}};let tmpHandled=pView.onImageUpload(pFile,pSegmentIndex,tmpCallback);if(tmpHandled){// Consumer is handling the upload asynchronously
|
|
9897
|
+
return;}// Default: convert to base64 data URI
|
|
9898
|
+
if(typeof FileReader==='undefined'){pView.log.error(`PICT-MarkdownEditor _processImageFile: FileReader not available in this environment.`);return;}let tmpReader=new FileReader();tmpReader.onload=()=>{pView._insertImageMarkdown(pSegmentIndex,tmpReader.result,tmpAltText);};tmpReader.onerror=()=>{pView.log.error(`PICT-MarkdownEditor _processImageFile: FileReader error.`);};tmpReader.readAsDataURL(pFile);};/**
|
|
9899
|
+
* Insert markdown image syntax at the cursor position in a segment editor.
|
|
9900
|
+
*
|
|
9901
|
+
* @param {number} pSegmentIndex - The internal segment index
|
|
9902
|
+
* @param {string} pURL - The image URL (data URI or remote URL)
|
|
9903
|
+
* @param {string} [pAltText] - The alt text (default: 'image')
|
|
9904
|
+
*/pView._insertImageMarkdown=function _insertImageMarkdown(pSegmentIndex,pURL,pAltText){let tmpEditor=pView._segmentEditors[pSegmentIndex];if(!tmpEditor){pView.log.warn(`PICT-MarkdownEditor _insertImageMarkdown: no editor for segment ${pSegmentIndex}.`);return;}let tmpAlt=pAltText||'image';let tmpInsert=``;let tmpState=tmpEditor.state;let tmpCursorPos=tmpState.selection.main.head;tmpEditor.dispatch({changes:{from:tmpCursorPos,insert:tmpInsert},selection:{anchor:tmpCursorPos+tmpInsert.length}});tmpEditor.focus();// Update the image preview area for this segment
|
|
9905
|
+
pView._updateImagePreviews(pSegmentIndex);};/**
|
|
9906
|
+
* Scan the content of a segment for markdown image references and render
|
|
9907
|
+
* preview thumbnails in the preview area below the editor.
|
|
9908
|
+
*
|
|
9909
|
+
* Matches the pattern  and creates <img> elements for each.
|
|
9910
|
+
* The preview area is hidden when there are no images.
|
|
9911
|
+
*
|
|
9912
|
+
* @param {number} pSegmentIndex - The internal segment index
|
|
9913
|
+
*/pView._updateImagePreviews=function _updateImagePreviews(pSegmentIndex){let tmpPreviewEl=document.getElementById(`PictMDE-ImagePreview-${pSegmentIndex}`);if(!tmpPreviewEl){return;}let tmpEditor=pView._segmentEditors[pSegmentIndex];if(!tmpEditor){tmpPreviewEl.innerHTML='';tmpPreviewEl.classList.remove('pict-mde-has-images');return;}let tmpContent=tmpEditor.state.doc.toString();// Match markdown image syntax: 
|
|
9914
|
+
let tmpImageRegex=/!\[([^\]]*)\]\(([^)]+)\)/g;let tmpMatches=[];let tmpMatch;while((tmpMatch=tmpImageRegex.exec(tmpContent))!==null){tmpMatches.push({alt:tmpMatch[1]||'image',url:tmpMatch[2]});}if(tmpMatches.length===0){tmpPreviewEl.innerHTML='';tmpPreviewEl.classList.remove('pict-mde-has-images');return;}// Build preview HTML
|
|
9915
|
+
let tmpHTML='';for(let i=0;i<tmpMatches.length;i++){let tmpAlt=tmpMatches[i].alt.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"');let tmpURL=tmpMatches[i].url.replace(/&/g,'&').replace(/"/g,'"');tmpHTML+=`<div class="pict-mde-image-preview-item"><img src="${tmpURL}" alt="${tmpAlt}" /><span class="pict-mde-image-preview-label">${tmpAlt}</span></div>`;}tmpPreviewEl.innerHTML=tmpHTML;tmpPreviewEl.classList.add('pict-mde-has-images');};/**
|
|
9916
|
+
* Wire drag-and-drop events for image files on a segment editor container.
|
|
9917
|
+
*
|
|
9918
|
+
* These events are separate from the segment-reorder drag events.
|
|
9919
|
+
* File drags are distinguished from segment reorder drags by checking
|
|
9920
|
+
* dataTransfer.types for 'Files' and ensuring _dragSourceIndex is -1.
|
|
9921
|
+
*
|
|
9922
|
+
* @param {HTMLElement} pEditorContainer - The .pict-mde-segment-editor element
|
|
9923
|
+
* @param {number} pSegmentIndex - The internal segment index
|
|
9924
|
+
*/pView._wireImageDragEvents=function _wireImageDragEvents(pEditorContainer,pSegmentIndex){pEditorContainer.addEventListener('dragover',pEvent=>{// Only handle file drags, not segment-reorder drags
|
|
9925
|
+
if(pView._dragSourceIndex>=0){return;}if(!pEvent.dataTransfer||!pEvent.dataTransfer.types||pEvent.dataTransfer.types.indexOf('Files')<0){return;}pEvent.preventDefault();pEvent.dataTransfer.dropEffect='copy';pEditorContainer.classList.add('pict-mde-image-dragover');});pEditorContainer.addEventListener('dragleave',pEvent=>{// Only clear if actually leaving the element
|
|
9926
|
+
if(!pEditorContainer.contains(pEvent.relatedTarget)){pEditorContainer.classList.remove('pict-mde-image-dragover');}});pEditorContainer.addEventListener('drop',pEvent=>{pEditorContainer.classList.remove('pict-mde-image-dragover');// Only handle file drops, not segment-reorder drops
|
|
9927
|
+
if(pView._dragSourceIndex>=0){return;}if(!pEvent.dataTransfer||!pEvent.dataTransfer.files||pEvent.dataTransfer.files.length<1){return;}let tmpFile=pEvent.dataTransfer.files[0];if(tmpFile.type&&tmpFile.type.startsWith('image/')){pEvent.preventDefault();pEvent.stopPropagation();pView._processImageFile(tmpFile,pSegmentIndex);}});};};},{}],222:[function(require,module,exports){/**
|
|
9928
|
+
* Pict-MDE-RichPreview: Helper module for PictSectionMarkdownEditor
|
|
9929
|
+
*
|
|
9930
|
+
* Handles rich content preview rendering via pict-section-content:
|
|
9931
|
+
* markdown-to-HTML parsing, mermaid diagram rendering, KaTeX math
|
|
9932
|
+
* rendering, and the full rendered-view toggle.
|
|
9933
|
+
*/const libPictSectionContent=require('pict-section-content');const libPictContentProvider=libPictSectionContent.PictContentProvider;/**
|
|
9934
|
+
* Attach rich preview methods to the view instance.
|
|
9935
|
+
*
|
|
9936
|
+
* @param {object} pView - The PictSectionMarkdownEditor instance
|
|
9937
|
+
*/module.exports.attach=function attach(pView){/**
|
|
9938
|
+
* Get the pict-section-content provider instance for markdown parsing.
|
|
9939
|
+
* Lazily instantiated on first use.
|
|
9940
|
+
*
|
|
9941
|
+
* @returns {object} The PictContentProvider instance
|
|
9942
|
+
*/pView._getContentProvider=function _getContentProvider(){if(!pView._contentProvider){pView._contentProvider=new libPictContentProvider(pView.fable,{},'Pict-Content-Provider-MDE');}return pView._contentProvider;};/**
|
|
9943
|
+
* Render the raw markdown content of a segment into the rich preview area
|
|
9944
|
+
* using pict-section-content's parseMarkdown() provider method.
|
|
9945
|
+
*
|
|
9946
|
+
* The rendered HTML includes syntax-highlighted code blocks, mermaid diagram
|
|
9947
|
+
* placeholders, KaTeX math placeholders, headings, lists, tables, etc.
|
|
9948
|
+
*
|
|
9949
|
+
* After setting innerHTML, post-render hooks call mermaid.run() and
|
|
9950
|
+
* katex.render() to activate diagrams and equations (if those libraries
|
|
9951
|
+
* are available on window -- loaded by the consumer via CDN).
|
|
9952
|
+
*
|
|
9953
|
+
* @param {number} pSegmentIndex - The internal segment index
|
|
9954
|
+
*/pView._updateRichPreviews=function _updateRichPreviews(pSegmentIndex){if(!pView.options.EnableRichPreview){return;}let tmpPreviewEl=document.getElementById(`PictMDE-RichPreview-${pSegmentIndex}`);if(!tmpPreviewEl){return;}let tmpEditor=pView._segmentEditors[pSegmentIndex];if(!tmpEditor){tmpPreviewEl.innerHTML='';tmpPreviewEl.classList.remove('pict-mde-has-rich-preview');return;}let tmpContent=tmpEditor.state.doc.toString();if(!tmpContent||tmpContent.trim().length===0){tmpPreviewEl.innerHTML='';tmpPreviewEl.classList.remove('pict-mde-has-rich-preview');return;}// Use pict-section-content's provider to parse the raw markdown into HTML
|
|
9955
|
+
let tmpProvider=pView._getContentProvider();let tmpRenderedHTML=tmpProvider.parseMarkdown(tmpContent);if(!tmpRenderedHTML||tmpRenderedHTML.trim().length===0){tmpPreviewEl.innerHTML='';tmpPreviewEl.classList.remove('pict-mde-has-rich-preview');return;}// Wrap the rendered HTML in a pict-content container so that
|
|
9956
|
+
// pict-section-content's CSS classes take effect
|
|
9957
|
+
let tmpPreviewID=`PictMDE-RichPreviewBody-${pSegmentIndex}`;tmpPreviewEl.innerHTML=`<div class="pict-content" id="${tmpPreviewID}">${tmpRenderedHTML}</div>`;tmpPreviewEl.classList.add('pict-mde-has-rich-preview');// Bump generation counter for stale-render protection (mermaid is async)
|
|
9958
|
+
let tmpGeneration=(pView._richPreviewGenerations[pSegmentIndex]||0)+1;pView._richPreviewGenerations[pSegmentIndex]=tmpGeneration;// Post-render: call mermaid.run() for mermaid diagram elements
|
|
9959
|
+
pView._postRenderMermaid(tmpPreviewID,pSegmentIndex,tmpGeneration);// Post-render: call katex.render() for KaTeX math elements
|
|
9960
|
+
pView._postRenderKaTeX(tmpPreviewID);};/**
|
|
9961
|
+
* Post-render hook: render Mermaid diagrams in the preview container.
|
|
9962
|
+
* Uses the same approach as pict-section-content's renderMermaidDiagrams().
|
|
9963
|
+
*
|
|
9964
|
+
* @param {string} pContainerID - The container element ID
|
|
9965
|
+
* @param {number} pSegmentIndex - The segment index (for stale-render protection)
|
|
9966
|
+
* @param {number} pGeneration - The generation counter value
|
|
9967
|
+
*/pView._postRenderMermaid=function _postRenderMermaid(pContainerID,pSegmentIndex,pGeneration){if(typeof mermaid==='undefined'){return;}let tmpContainer=document.getElementById(pContainerID);if(!tmpContainer){return;}let tmpMermaidElements=tmpContainer.querySelectorAll('pre.mermaid');if(tmpMermaidElements.length<1){return;}try{let tmpPromise=mermaid.run({nodes:tmpMermaidElements});if(tmpPromise&&typeof tmpPromise.catch==='function'){tmpPromise.catch(pError=>{// Check stale-render: rendered view uses _renderedViewGeneration,
|
|
9968
|
+
// per-segment previews use _richPreviewGenerations
|
|
9969
|
+
let tmpCurrentGen=pSegmentIndex===-1?pView._renderedViewGeneration:pView._richPreviewGenerations[pSegmentIndex];if(tmpCurrentGen!==pGeneration){return;// stale render -- a newer update has replaced us
|
|
9970
|
+
}pView.log.warn(`PICT-MarkdownEditor mermaid render error: ${pError.message||pError}`);});}}catch(pError){pView.log.warn(`PICT-MarkdownEditor mermaid render error: ${pError.message||pError}`);}};/**
|
|
9971
|
+
* Post-render hook: render KaTeX inline and display math in the preview container.
|
|
9972
|
+
* Uses the same approach as pict-section-content's renderKaTeXEquations().
|
|
9973
|
+
*
|
|
9974
|
+
* @param {string} pContainerID - The container element ID
|
|
9975
|
+
*/pView._postRenderKaTeX=function _postRenderKaTeX(pContainerID){if(typeof katex==='undefined'){return;}let tmpContainer=document.getElementById(pContainerID);if(!tmpContainer){return;}// Render inline math: <span class="pict-content-katex-inline">
|
|
9976
|
+
let tmpInlineElements=tmpContainer.querySelectorAll('.pict-content-katex-inline');for(let i=0;i<tmpInlineElements.length;i++){try{katex.render(tmpInlineElements[i].textContent,tmpInlineElements[i],{throwOnError:false,displayMode:false});}catch(pError){pView.log.warn(`PICT-MarkdownEditor KaTeX inline error: ${pError.message||pError}`);}}// Render display math: <div class="pict-content-katex-display">
|
|
9977
|
+
let tmpDisplayElements=tmpContainer.querySelectorAll('.pict-content-katex-display');for(let i=0;i<tmpDisplayElements.length;i++){try{katex.render(tmpDisplayElements[i].textContent,tmpDisplayElements[i],{throwOnError:false,displayMode:true});}catch(pError){pView.log.warn(`PICT-MarkdownEditor KaTeX display error: ${pError.message||pError}`);}}};/**
|
|
9978
|
+
* Simple HTML escape for error messages in the rich preview.
|
|
9979
|
+
*
|
|
9980
|
+
* @param {string} pText - The text to escape
|
|
9981
|
+
* @returns {string}
|
|
9982
|
+
*/pView._escapeHTMLForPreview=function _escapeHTMLForPreview(pText){return pText.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"');};// -- Rendered View (full document preview) --
|
|
9983
|
+
/**
|
|
9984
|
+
* Toggle between the editing view (CodeMirror segments) and a fully rendered
|
|
9985
|
+
* view of the combined markdown output using pict-section-content.
|
|
9986
|
+
*
|
|
9987
|
+
* @param {boolean} [pRendered] - If provided, set to this value; otherwise toggle
|
|
9988
|
+
*/pView.toggleRenderedView=function toggleRenderedView(pRendered){if(typeof pRendered==='boolean'){pView._renderedViewActive=pRendered;}else{pView._renderedViewActive=!pView._renderedViewActive;}if(pView._renderedViewActive){pView._renderRenderedView();}else{pView._restoreEditingView();}};/**
|
|
9989
|
+
* Switch to the rendered view: marshal all editors, combine all segment
|
|
9990
|
+
* content, render to HTML via pict-section-content, and replace the
|
|
9991
|
+
* container contents with the rendered output.
|
|
9992
|
+
*/pView._renderRenderedView=function _renderRenderedView(){let tmpContainer=pView._getContainerElement();if(!tmpContainer){return;}// Marshal current editor content back to data before switching
|
|
9993
|
+
pView._marshalAllEditorsToData();// Combine all segments into a single markdown document
|
|
9994
|
+
let tmpSegments=pView._getSegmentsFromData();let tmpCombinedContent='';if(tmpSegments&&tmpSegments.length>0){let tmpParts=[];for(let i=0;i<tmpSegments.length;i++){tmpParts.push(tmpSegments[i].Content||'');}tmpCombinedContent=tmpParts.join('\n\n');}// Destroy existing CodeMirror editors
|
|
9995
|
+
for(let tmpIdx in pView._segmentEditors){if(pView._segmentEditors[tmpIdx]){pView._segmentEditors[tmpIdx].destroy();}}pView._segmentEditors={};// Render the combined markdown via pict-section-content
|
|
9996
|
+
let tmpProvider=pView._getContentProvider();let tmpRenderedHTML=tmpProvider.parseMarkdown(tmpCombinedContent);// Build the rendered view container
|
|
9997
|
+
let tmpRenderedViewID='PictMDE-RenderedView';tmpContainer.innerHTML=`<div class="pict-mde-rendered-view" id="${tmpRenderedViewID}"><div class="pict-content">${tmpRenderedHTML||''}</div></div>`;tmpContainer.classList.add('pict-mde-rendered-mode');// Bump generation for stale-render protection
|
|
9998
|
+
pView._renderedViewGeneration++;let tmpGeneration=pView._renderedViewGeneration;// Post-render hooks for mermaid diagrams and KaTeX equations
|
|
9999
|
+
let tmpContentContainer=tmpContainer.querySelector(`#${tmpRenderedViewID} .pict-content`);if(tmpContentContainer){let tmpContentID='PictMDE-RenderedViewContent';tmpContentContainer.id=tmpContentID;pView._postRenderMermaid(tmpContentID,-1,tmpGeneration);pView._postRenderKaTeX(tmpContentID);}};/**
|
|
10000
|
+
* Switch back from rendered view to the editing view: rebuild the
|
|
10001
|
+
* full editor UI from the data.
|
|
10002
|
+
*/pView._restoreEditingView=function _restoreEditingView(){let tmpContainer=pView._getContainerElement();if(!tmpContainer){return;}tmpContainer.classList.remove('pict-mde-rendered-mode');pView._buildEditorUI();};};},{"pict-section-content":151}],223:[function(require,module,exports){module.exports={"DefaultRenderable":"MarkdownEditor-Wrap","DefaultDestinationAddress":"#MarkdownEditor-Container-Div","Templates":[{"Hash":"MarkdownEditor-Container","Template":/*html*/`<div class="pict-mde" id="PictMDE-Container"></div>`},{"Hash":"MarkdownEditor-Segment","Template":/*html*/`<div class="pict-mde-segment" id="PictMDE-Segment-{~D:Record.SegmentIndex~}" data-segment-index="{~D:Record.SegmentIndex~}">
|
|
10003
|
+
<div class="pict-mde-left-controls">
|
|
10004
|
+
<div class="pict-mde-quadrant-tl"></div>
|
|
10005
|
+
<div class="pict-mde-quadrant-bl"></div>
|
|
10006
|
+
</div>
|
|
10007
|
+
<div class="pict-mde-drag-handle" draggable="true" title="Drag to reorder"></div>
|
|
10008
|
+
<div class="pict-mde-segment-body">
|
|
10009
|
+
<div class="pict-mde-segment-editor" id="PictMDE-SegmentEditor-{~D:Record.SegmentIndex~}"></div>
|
|
10010
|
+
<div class="pict-mde-image-preview" id="PictMDE-ImagePreview-{~D:Record.SegmentIndex~}"></div>
|
|
10011
|
+
<div class="pict-mde-rich-preview" id="PictMDE-RichPreview-{~D:Record.SegmentIndex~}"></div>
|
|
10012
|
+
</div>
|
|
10013
|
+
<div class="pict-mde-sidebar" id="PictMDE-Sidebar-{~D:Record.SegmentIndex~}">
|
|
10014
|
+
<div class="pict-mde-quadrant-tr"></div>
|
|
10015
|
+
<div class="pict-mde-quadrant-br"></div>
|
|
10016
|
+
<input type="file" accept="image/*" class="pict-mde-image-input" id="PictMDE-ImageInput-{~D:Record.SegmentIndex~}" style="display:none" />
|
|
10017
|
+
</div>
|
|
10018
|
+
</div>`},{"Hash":"MarkdownEditor-AddSegment","Template":/*html*/`<div class="pict-mde-add-segment">
|
|
10019
|
+
<button type="button" class="pict-mde-btn-add" onclick="{~D:Record.ViewIdentifier~}.addSegment()">+ Add Segment</button>
|
|
10020
|
+
</div>`}],"Renderables":[{"RenderableHash":"MarkdownEditor-Wrap","TemplateHash":"MarkdownEditor-Container","DestinationAddress":"#MarkdownEditor-Container-Div"}],"TargetElementAddress":"#MarkdownEditor-Container-Div",// Address in AppData to read/write the segments array
|
|
10021
|
+
// The data at this address should be an array of objects, each with a "Content" property
|
|
10022
|
+
// e.g. AppData.Document.Segments = [ { Content: "# Hello" }, { Content: "Some text" } ]
|
|
10023
|
+
"ContentDataAddress":false,// Whether the editor should be read-only
|
|
10024
|
+
"ReadOnly":false,// Whether to show rich content previews (rendered markdown with syntax-highlighted
|
|
10025
|
+
// code, mermaid diagrams, KaTeX equations, tables, etc. via pict-section-content).
|
|
10026
|
+
// Requires the consumer to load the mermaid and/or katex libraries via CDN
|
|
10027
|
+
// for diagram/equation rendering; code highlighting works without CDN scripts.
|
|
10028
|
+
"EnableRichPreview":true,// ---- Quadrant button definitions ----
|
|
10029
|
+
// Each quadrant is an array of button objects:
|
|
10030
|
+
// HTML — innerHTML for the button
|
|
10031
|
+
// Action — method name, optionally "method:arg" (receives segment index as first param)
|
|
10032
|
+
// Class — additional CSS class(es) appended to the base class
|
|
10033
|
+
// Title — tooltip text
|
|
10034
|
+
//
|
|
10035
|
+
// Consumers can override any quadrant to add, remove, or reorder buttons.
|
|
10036
|
+
// Left quadrant buttons (TL, BL) get the "pict-mde-left-btn" base class.
|
|
10037
|
+
// Right quadrant buttons (TR, BR) get the "pict-mde-sidebar-btn" base class.
|
|
10038
|
+
"ButtonsTL":[{"HTML":"×","Action":"removeSegment","Class":"pict-mde-btn-remove","Title":"Remove Segment"}],"ButtonsBL":[{"HTML":"↑","Action":"moveSegmentUp","Class":"pict-mde-btn-move","Title":"Move Up"},{"HTML":"↓","Action":"moveSegmentDown","Class":"pict-mde-btn-move","Title":"Move Down"},{"HTML":"⊞","Action":"toggleControls","Class":"pict-mde-btn-linenums","Title":"Toggle Controls"},{"HTML":"◎","Action":"toggleSegmentPreview","Class":"pict-mde-btn-preview","Title":"Toggle Preview"}],"ButtonsTR":[{"HTML":"<b>B</b>","Action":"applyFormatting:bold","Class":"","Title":"Bold (Ctrl+B)"},{"HTML":"<i>I</i>","Action":"applyFormatting:italic","Class":"","Title":"Italic (Ctrl+I)"},{"HTML":"<code><></code>","Action":"applyFormatting:code","Class":"","Title":"Inline Code (Ctrl+E)"},{"HTML":"#","Action":"applyFormatting:heading","Class":"","Title":"Heading"},{"HTML":"[ ]","Action":"applyFormatting:link","Class":"","Title":"Link"},{"HTML":"▣","Action":"openImagePicker","Class":"pict-mde-sidebar-btn-image","Title":"Insert Image"}],"ButtonsBR":[],// CSS for the markdown editor
|
|
10039
|
+
"CSS":/*css*/`
|
|
10040
|
+
/* ---- Container ---- */
|
|
10041
|
+
.pict-mde
|
|
10042
|
+
{
|
|
10043
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
10044
|
+
font-size: 14px;
|
|
10045
|
+
}
|
|
10046
|
+
|
|
10047
|
+
/* ---- Segment row: left-controls | drag-handle | editor body | sidebar ---- */
|
|
10048
|
+
.pict-mde-segment
|
|
10049
|
+
{
|
|
10050
|
+
position: relative;
|
|
10051
|
+
display: flex;
|
|
10052
|
+
flex-direction: row;
|
|
10053
|
+
align-items: stretch;
|
|
10054
|
+
margin-bottom: 6px;
|
|
10055
|
+
min-height: 48px;
|
|
10056
|
+
transition: background-color 0.15s ease;
|
|
10057
|
+
}
|
|
10058
|
+
|
|
10059
|
+
/* ---- Left controls column ---- */
|
|
10060
|
+
.pict-mde-left-controls
|
|
10061
|
+
{
|
|
10062
|
+
flex: 0 0 22px;
|
|
10063
|
+
display: flex;
|
|
10064
|
+
flex-direction: column;
|
|
10065
|
+
align-items: center;
|
|
10066
|
+
justify-content: space-between;
|
|
10067
|
+
padding: 2px 0;
|
|
10068
|
+
}
|
|
10069
|
+
|
|
10070
|
+
/* ---- Left-side quadrants ---- */
|
|
10071
|
+
.pict-mde-quadrant-tl
|
|
10072
|
+
{
|
|
10073
|
+
display: flex;
|
|
10074
|
+
flex-direction: column;
|
|
10075
|
+
align-items: center;
|
|
10076
|
+
position: sticky;
|
|
10077
|
+
top: 2px;
|
|
10078
|
+
z-index: 2;
|
|
10079
|
+
}
|
|
10080
|
+
.pict-mde-quadrant-bl
|
|
10081
|
+
{
|
|
10082
|
+
display: flex;
|
|
10083
|
+
flex-direction: column;
|
|
10084
|
+
align-items: center;
|
|
10085
|
+
gap: 1px;
|
|
10086
|
+
position: sticky;
|
|
10087
|
+
bottom: 2px;
|
|
10088
|
+
z-index: 2;
|
|
10089
|
+
}
|
|
10090
|
+
|
|
10091
|
+
/* ---- Left-side buttons (shared base) ---- */
|
|
10092
|
+
.pict-mde-left-btn
|
|
10093
|
+
{
|
|
10094
|
+
display: flex;
|
|
10095
|
+
align-items: center;
|
|
10096
|
+
justify-content: center;
|
|
10097
|
+
width: 20px;
|
|
10098
|
+
height: 20px;
|
|
10099
|
+
border: none;
|
|
10100
|
+
background: transparent;
|
|
10101
|
+
cursor: pointer;
|
|
10102
|
+
font-size: 12px;
|
|
10103
|
+
padding: 0;
|
|
10104
|
+
color: #888;
|
|
10105
|
+
line-height: 1;
|
|
10106
|
+
font-family: inherit;
|
|
10107
|
+
opacity: 0;
|
|
10108
|
+
transition: opacity 0.15s ease;
|
|
10109
|
+
}
|
|
10110
|
+
.pict-mde-segment:hover .pict-mde-left-btn,
|
|
10111
|
+
.pict-mde-segment.pict-mde-active .pict-mde-left-btn
|
|
10112
|
+
{
|
|
10113
|
+
opacity: 1;
|
|
10114
|
+
}
|
|
10115
|
+
.pict-mde-left-btn:hover
|
|
10116
|
+
{
|
|
10117
|
+
color: #222;
|
|
10118
|
+
}
|
|
10119
|
+
.pict-mde-btn-remove:hover
|
|
10120
|
+
{
|
|
10121
|
+
color: #CC3333;
|
|
10122
|
+
}
|
|
10123
|
+
.pict-mde-btn-linenums
|
|
10124
|
+
{
|
|
10125
|
+
font-size: 11px;
|
|
10126
|
+
font-weight: 600;
|
|
10127
|
+
font-family: 'SFMono-Regular', 'SF Mono', 'Menlo', monospace;
|
|
10128
|
+
}
|
|
10129
|
+
/* Highlight when controls are active */
|
|
10130
|
+
.pict-mde.pict-mde-controls-on .pict-mde-btn-linenums
|
|
10131
|
+
{
|
|
10132
|
+
color: #4A90D9;
|
|
10133
|
+
}
|
|
10134
|
+
.pict-mde-btn-preview
|
|
10135
|
+
{
|
|
10136
|
+
font-size: 11px;
|
|
10137
|
+
}
|
|
10138
|
+
/* Highlight the preview button when preview is visible (not hidden) */
|
|
10139
|
+
.pict-mde-segment:not(.pict-mde-preview-hidden) .pict-mde-btn-preview
|
|
10140
|
+
{
|
|
10141
|
+
color: #4A90D9;
|
|
10142
|
+
}
|
|
10143
|
+
/* Dim preview button when this segment's preview is individually hidden */
|
|
10144
|
+
.pict-mde-segment.pict-mde-preview-hidden .pict-mde-btn-preview
|
|
10145
|
+
{
|
|
10146
|
+
color: #CCC;
|
|
10147
|
+
}
|
|
10148
|
+
|
|
10149
|
+
/* ---- Drag handle (simple grey bar) ---- */
|
|
10150
|
+
.pict-mde-drag-handle
|
|
10151
|
+
{
|
|
10152
|
+
flex: 0 0 8px;
|
|
10153
|
+
cursor: grab;
|
|
10154
|
+
background: #EDEDED;
|
|
10155
|
+
transition: background-color 0.15s ease;
|
|
10156
|
+
user-select: none;
|
|
10157
|
+
}
|
|
10158
|
+
.pict-mde-drag-handle:active
|
|
10159
|
+
{
|
|
10160
|
+
cursor: grabbing;
|
|
10161
|
+
}
|
|
10162
|
+
.pict-mde-drag-handle:hover
|
|
10163
|
+
{
|
|
10164
|
+
background: #C8C8C8;
|
|
10165
|
+
}
|
|
10166
|
+
|
|
10167
|
+
/* ---- Editor body (middle column) ---- */
|
|
10168
|
+
.pict-mde-segment-body
|
|
10169
|
+
{
|
|
10170
|
+
flex: 1 1 auto;
|
|
10171
|
+
min-width: 0;
|
|
10172
|
+
background: #FFFFFF;
|
|
10173
|
+
transition: background-color 0.15s ease;
|
|
10174
|
+
}
|
|
10175
|
+
.pict-mde-segment-editor
|
|
10176
|
+
{
|
|
10177
|
+
min-height: 48px;
|
|
10178
|
+
}
|
|
10179
|
+
|
|
10180
|
+
/* ---- Image preview area below the editor ---- */
|
|
10181
|
+
.pict-mde-image-preview
|
|
10182
|
+
{
|
|
10183
|
+
display: none;
|
|
10184
|
+
}
|
|
10185
|
+
.pict-mde-image-preview.pict-mde-has-images
|
|
10186
|
+
{
|
|
10187
|
+
display: flex;
|
|
10188
|
+
flex-wrap: wrap;
|
|
10189
|
+
gap: 8px;
|
|
10190
|
+
padding: 8px 12px;
|
|
10191
|
+
border-top: 1px solid #EDEDED;
|
|
10192
|
+
}
|
|
10193
|
+
.pict-mde-image-preview img
|
|
10194
|
+
{
|
|
10195
|
+
max-width: 200px;
|
|
10196
|
+
max-height: 150px;
|
|
10197
|
+
border-radius: 3px;
|
|
10198
|
+
border: 1px solid #E0E0E0;
|
|
10199
|
+
object-fit: contain;
|
|
10200
|
+
background: #F8F8F8;
|
|
10201
|
+
}
|
|
10202
|
+
.pict-mde-image-preview-item
|
|
10203
|
+
{
|
|
10204
|
+
position: relative;
|
|
10205
|
+
display: inline-block;
|
|
10206
|
+
}
|
|
10207
|
+
.pict-mde-image-preview-label
|
|
10208
|
+
{
|
|
10209
|
+
display: block;
|
|
10210
|
+
font-size: 10px;
|
|
10211
|
+
color: #999;
|
|
10212
|
+
margin-top: 2px;
|
|
10213
|
+
max-width: 200px;
|
|
10214
|
+
overflow: hidden;
|
|
10215
|
+
text-overflow: ellipsis;
|
|
10216
|
+
white-space: nowrap;
|
|
10217
|
+
}
|
|
10218
|
+
|
|
10219
|
+
/* ---- Rich content preview area (rendered via pict-section-content) ---- */
|
|
10220
|
+
.pict-mde-rich-preview
|
|
10221
|
+
{
|
|
10222
|
+
display: none;
|
|
10223
|
+
}
|
|
10224
|
+
.pict-mde-rich-preview.pict-mde-has-rich-preview
|
|
10225
|
+
{
|
|
10226
|
+
display: block;
|
|
10227
|
+
border-top: 1px solid #EDEDED;
|
|
10228
|
+
background: #FCFCFC;
|
|
10229
|
+
}
|
|
10230
|
+
/* Global preview toggle: hide all previews when container has class */
|
|
10231
|
+
.pict-mde.pict-mde-previews-hidden .pict-mde-rich-preview.pict-mde-has-rich-preview,
|
|
10232
|
+
.pict-mde.pict-mde-previews-hidden .pict-mde-image-preview.pict-mde-has-images
|
|
10233
|
+
{
|
|
10234
|
+
display: none;
|
|
10235
|
+
}
|
|
10236
|
+
/* Per-segment preview toggle: hide previews for a specific segment */
|
|
10237
|
+
.pict-mde-segment.pict-mde-preview-hidden .pict-mde-rich-preview.pict-mde-has-rich-preview,
|
|
10238
|
+
.pict-mde-segment.pict-mde-preview-hidden .pict-mde-image-preview.pict-mde-has-images
|
|
10239
|
+
{
|
|
10240
|
+
display: none;
|
|
10241
|
+
}
|
|
10242
|
+
/* Constrain the pict-content inside the preview to fit the segment */
|
|
10243
|
+
.pict-mde-rich-preview .pict-content
|
|
10244
|
+
{
|
|
10245
|
+
padding: 12px;
|
|
10246
|
+
max-width: none;
|
|
10247
|
+
margin: 0;
|
|
10248
|
+
font-size: 13px;
|
|
10249
|
+
}
|
|
10250
|
+
/* Reduce heading sizes in the preview to be proportional */
|
|
10251
|
+
.pict-mde-rich-preview .pict-content h1
|
|
10252
|
+
{
|
|
10253
|
+
font-size: 1.4em;
|
|
10254
|
+
margin-top: 0;
|
|
10255
|
+
}
|
|
10256
|
+
.pict-mde-rich-preview .pict-content h2
|
|
10257
|
+
{
|
|
10258
|
+
font-size: 1.2em;
|
|
10259
|
+
margin-top: 0.75em;
|
|
10260
|
+
}
|
|
10261
|
+
.pict-mde-rich-preview .pict-content h3
|
|
10262
|
+
{
|
|
10263
|
+
font-size: 1.1em;
|
|
10264
|
+
margin-top: 0.6em;
|
|
10265
|
+
}
|
|
10266
|
+
|
|
10267
|
+
/* ---- Rendered view (full document preview mode) ---- */
|
|
10268
|
+
.pict-mde-rendered-view
|
|
10269
|
+
{
|
|
10270
|
+
padding: 16px 20px;
|
|
10271
|
+
background: #FFFFFF;
|
|
10272
|
+
min-height: 120px;
|
|
10273
|
+
}
|
|
10274
|
+
.pict-mde-rendered-view .pict-content
|
|
10275
|
+
{
|
|
10276
|
+
max-width: none;
|
|
10277
|
+
margin: 0;
|
|
10278
|
+
}
|
|
10279
|
+
/* Hide the add-segment button in rendered mode */
|
|
10280
|
+
.pict-mde.pict-mde-rendered-mode .pict-mde-add-segment
|
|
10281
|
+
{
|
|
10282
|
+
display: none;
|
|
10283
|
+
}
|
|
10284
|
+
|
|
10285
|
+
/* Focused / active editor gets subtle warm background */
|
|
10286
|
+
.pict-mde-segment.pict-mde-active .pict-mde-segment-body
|
|
10287
|
+
{
|
|
10288
|
+
background: #FAFAF5;
|
|
10289
|
+
}
|
|
10290
|
+
.pict-mde-segment.pict-mde-active .pict-mde-drag-handle
|
|
10291
|
+
{
|
|
10292
|
+
background: #9CB4C8;
|
|
10293
|
+
}
|
|
10294
|
+
|
|
10295
|
+
/* ---- Right sidebar column ---- */
|
|
10296
|
+
.pict-mde-sidebar
|
|
10297
|
+
{
|
|
10298
|
+
flex: 0 0 30px;
|
|
10299
|
+
display: flex;
|
|
10300
|
+
flex-direction: column;
|
|
10301
|
+
align-items: flex-start;
|
|
10302
|
+
justify-content: space-between;
|
|
10303
|
+
position: relative;
|
|
10304
|
+
}
|
|
10305
|
+
|
|
10306
|
+
/* ---- Right-side quadrants ---- */
|
|
10307
|
+
.pict-mde-quadrant-tr
|
|
10308
|
+
{
|
|
10309
|
+
display: flex;
|
|
10310
|
+
flex-direction: column;
|
|
10311
|
+
align-items: center;
|
|
10312
|
+
gap: 1px;
|
|
10313
|
+
padding: 4px 0;
|
|
10314
|
+
width: 100%;
|
|
10315
|
+
opacity: 0;
|
|
10316
|
+
transition: opacity 0.15s ease, top 0.1s ease;
|
|
10317
|
+
position: sticky;
|
|
10318
|
+
top: 0;
|
|
10319
|
+
}
|
|
10320
|
+
.pict-mde-quadrant-br
|
|
10321
|
+
{
|
|
10322
|
+
display: flex;
|
|
10323
|
+
flex-direction: column;
|
|
10324
|
+
align-items: center;
|
|
10325
|
+
gap: 1px;
|
|
10326
|
+
padding: 4px 0;
|
|
10327
|
+
width: 100%;
|
|
10328
|
+
opacity: 0;
|
|
10329
|
+
transition: opacity 0.15s ease;
|
|
10330
|
+
position: sticky;
|
|
10331
|
+
bottom: 0;
|
|
10332
|
+
}
|
|
10333
|
+
|
|
10334
|
+
/* Active segment always shows its right-side quadrants */
|
|
10335
|
+
.pict-mde-segment.pict-mde-active .pict-mde-quadrant-tr,
|
|
10336
|
+
.pict-mde-segment.pict-mde-active .pict-mde-quadrant-br
|
|
10337
|
+
{
|
|
10338
|
+
opacity: 1;
|
|
10339
|
+
}
|
|
10340
|
+
/* When no segment is active, hovering shows both left + right controls */
|
|
10341
|
+
.pict-mde:not(:has(.pict-mde-active)) .pict-mde-segment:hover .pict-mde-quadrant-tr,
|
|
10342
|
+
.pict-mde:not(:has(.pict-mde-active)) .pict-mde-segment:hover .pict-mde-quadrant-br
|
|
10343
|
+
{
|
|
10344
|
+
opacity: 1;
|
|
10345
|
+
}
|
|
10346
|
+
|
|
10347
|
+
/* ---- Controls-hidden mode: right quadrants show faintly on hover ---- */
|
|
10348
|
+
.pict-mde.pict-mde-controls-hidden .pict-mde-quadrant-tr,
|
|
10349
|
+
.pict-mde.pict-mde-controls-hidden .pict-mde-quadrant-br
|
|
10350
|
+
{
|
|
10351
|
+
opacity: 0;
|
|
10352
|
+
}
|
|
10353
|
+
.pict-mde.pict-mde-controls-hidden .pict-mde-segment:hover .pict-mde-quadrant-tr,
|
|
10354
|
+
.pict-mde.pict-mde-controls-hidden .pict-mde-segment:hover .pict-mde-quadrant-br
|
|
10355
|
+
{
|
|
10356
|
+
opacity: 0.3;
|
|
10357
|
+
}
|
|
10358
|
+
.pict-mde.pict-mde-controls-hidden .pict-mde-segment.pict-mde-active .pict-mde-quadrant-tr,
|
|
10359
|
+
.pict-mde.pict-mde-controls-hidden .pict-mde-segment.pict-mde-active .pict-mde-quadrant-br
|
|
10360
|
+
{
|
|
10361
|
+
opacity: 0.3;
|
|
10362
|
+
}
|
|
10363
|
+
|
|
10364
|
+
/* When JS sets a cursor-relative offset, switch TR from sticky to absolute positioning */
|
|
10365
|
+
.pict-mde-quadrant-tr.pict-mde-sidebar-at-cursor
|
|
10366
|
+
{
|
|
10367
|
+
position: absolute;
|
|
10368
|
+
top: var(--pict-mde-sidebar-top, 0px);
|
|
10369
|
+
}
|
|
10370
|
+
|
|
10371
|
+
/* ---- Right-side buttons (shared base) ---- */
|
|
10372
|
+
.pict-mde-sidebar-btn
|
|
10373
|
+
{
|
|
10374
|
+
display: flex;
|
|
10375
|
+
align-items: center;
|
|
10376
|
+
justify-content: center;
|
|
10377
|
+
width: 24px;
|
|
10378
|
+
height: 22px;
|
|
10379
|
+
border: none;
|
|
10380
|
+
background: transparent;
|
|
10381
|
+
cursor: pointer;
|
|
10382
|
+
font-size: 12px;
|
|
10383
|
+
padding: 0;
|
|
10384
|
+
border-radius: 3px;
|
|
10385
|
+
color: #666;
|
|
10386
|
+
line-height: 1;
|
|
10387
|
+
font-family: inherit;
|
|
10388
|
+
}
|
|
10389
|
+
.pict-mde-sidebar-btn:hover
|
|
10390
|
+
{
|
|
10391
|
+
color: #222;
|
|
10392
|
+
}
|
|
10393
|
+
.pict-mde-sidebar-btn b
|
|
10394
|
+
{
|
|
10395
|
+
font-size: 13px;
|
|
10396
|
+
font-weight: 700;
|
|
10397
|
+
}
|
|
10398
|
+
.pict-mde-sidebar-btn i
|
|
10399
|
+
{
|
|
10400
|
+
font-size: 13px;
|
|
10401
|
+
font-style: italic;
|
|
10402
|
+
}
|
|
10403
|
+
.pict-mde-sidebar-btn code
|
|
10404
|
+
{
|
|
10405
|
+
font-size: 10px;
|
|
10406
|
+
font-family: 'SFMono-Regular', 'SF Mono', 'Menlo', monospace;
|
|
10407
|
+
}
|
|
10408
|
+
|
|
10409
|
+
/* ---- Add segment button ---- */
|
|
10410
|
+
.pict-mde-add-segment
|
|
10411
|
+
{
|
|
10412
|
+
margin-top: 6px;
|
|
10413
|
+
padding-left: 30px;
|
|
10414
|
+
}
|
|
10415
|
+
.pict-mde-btn-add
|
|
10416
|
+
{
|
|
10417
|
+
display: block;
|
|
10418
|
+
width: 100%;
|
|
10419
|
+
padding: 7px;
|
|
10420
|
+
border: 2px dashed #D0D0D0;
|
|
10421
|
+
border-radius: 4px;
|
|
10422
|
+
background: transparent;
|
|
10423
|
+
color: #999;
|
|
10424
|
+
font-size: 12px;
|
|
10425
|
+
font-weight: 600;
|
|
10426
|
+
cursor: pointer;
|
|
10427
|
+
transition: all 0.15s ease;
|
|
10428
|
+
}
|
|
10429
|
+
.pict-mde-btn-add:hover
|
|
10430
|
+
{
|
|
10431
|
+
border-color: #4A90D9;
|
|
10432
|
+
color: #4A90D9;
|
|
10433
|
+
background: rgba(74, 144, 217, 0.04);
|
|
10434
|
+
}
|
|
10435
|
+
|
|
10436
|
+
/* ---- Image drag-over indicator ---- */
|
|
10437
|
+
.pict-mde-segment-editor.pict-mde-image-dragover
|
|
10438
|
+
{
|
|
10439
|
+
outline: 2px dashed #4A90D9;
|
|
10440
|
+
outline-offset: -2px;
|
|
10441
|
+
}
|
|
10442
|
+
|
|
10443
|
+
/* ---- Drag-in-progress: prevent CodeMirror from intercepting drop events ---- */
|
|
10444
|
+
.pict-mde.pict-mde-dragging .pict-mde-segment-editor
|
|
10445
|
+
{
|
|
10446
|
+
pointer-events: none;
|
|
10447
|
+
}
|
|
10448
|
+
|
|
10449
|
+
/* ---- Drop target indicators for drag reorder ---- */
|
|
10450
|
+
.pict-mde-segment.pict-mde-drag-over-top
|
|
10451
|
+
{
|
|
10452
|
+
box-shadow: 0 -2px 0 0 #4A90D9;
|
|
10453
|
+
}
|
|
10454
|
+
.pict-mde-segment.pict-mde-drag-over-bottom
|
|
10455
|
+
{
|
|
10456
|
+
box-shadow: 0 2px 0 0 #4A90D9;
|
|
10457
|
+
}
|
|
10458
|
+
|
|
10459
|
+
/* ---- CodeMirror overrides inside segments ---- */
|
|
10460
|
+
.pict-mde-segment-editor .cm-editor
|
|
10461
|
+
{
|
|
10462
|
+
border: none;
|
|
10463
|
+
}
|
|
10464
|
+
.pict-mde-segment-editor .cm-editor .cm-scroller
|
|
10465
|
+
{
|
|
10466
|
+
font-family: 'SFMono-Regular', 'SF Mono', 'Menlo', 'Consolas', 'Liberation Mono', 'Courier New', monospace;
|
|
10467
|
+
font-size: 14px;
|
|
10468
|
+
line-height: 1.6;
|
|
10469
|
+
}
|
|
10470
|
+
.pict-mde-segment-editor .cm-editor.cm-focused
|
|
10471
|
+
{
|
|
10472
|
+
outline: none;
|
|
10473
|
+
}
|
|
10474
|
+
.pict-mde-segment-editor .cm-editor .cm-content
|
|
10475
|
+
{
|
|
10476
|
+
padding: 8px 12px;
|
|
10477
|
+
min-height: 36px;
|
|
10478
|
+
}
|
|
10479
|
+
.pict-mde-segment-editor .cm-editor .cm-gutters
|
|
10480
|
+
{
|
|
10481
|
+
background: #F8F8F8;
|
|
10482
|
+
border-right: 1px solid #E8E8E8;
|
|
10483
|
+
color: #BBB;
|
|
10484
|
+
}
|
|
10485
|
+
|
|
10486
|
+
/* ---- Collapsed data URI widget ---- */
|
|
10487
|
+
.pict-mde-data-uri-collapsed
|
|
10488
|
+
{
|
|
10489
|
+
display: inline;
|
|
10490
|
+
background: #F0F0F0;
|
|
10491
|
+
color: #888;
|
|
10492
|
+
font-size: 11px;
|
|
10493
|
+
padding: 1px 4px;
|
|
10494
|
+
border-radius: 3px;
|
|
10495
|
+
border: 1px solid #E0E0E0;
|
|
10496
|
+
font-family: 'SFMono-Regular', 'SF Mono', 'Menlo', monospace;
|
|
10497
|
+
cursor: default;
|
|
10498
|
+
white-space: nowrap;
|
|
10499
|
+
}
|
|
10500
|
+
|
|
10501
|
+
/* ---- Line number / controls toggle: gutters hidden by default ---- */
|
|
10502
|
+
.pict-mde .cm-editor .cm-gutters
|
|
10503
|
+
{
|
|
10504
|
+
display: none;
|
|
10505
|
+
}
|
|
10506
|
+
.pict-mde.pict-mde-controls-on .cm-editor .cm-gutters
|
|
10507
|
+
{
|
|
10508
|
+
display: flex;
|
|
10509
|
+
}
|
|
10510
|
+
`};},{}],224:[function(require,module,exports){const libPictViewClass=require('pict-view');const libPictSectionContent=require('pict-section-content');const _DefaultConfiguration=require('./Pict-Section-MarkdownEditor-DefaultConfiguration.js');// Helper modules
|
|
10511
|
+
const libFormatting=require('./Pict-MDE-Formatting.js');const libImageHandling=require('./Pict-MDE-ImageHandling.js');const libDragAndReorder=require('./Pict-MDE-DragAndReorder.js');const libRichPreview=require('./Pict-MDE-RichPreview.js');const libCodeMirror=require('./Pict-MDE-CodeMirror.js');class PictSectionMarkdownEditor extends libPictViewClass{constructor(pFable,pOptions,pServiceHash){let tmpOptions=Object.assign({},_DefaultConfiguration,pOptions);super(pFable,tmpOptions,pServiceHash);this.initialRenderComplete=false;// CodeMirror prototype references (injected by consumer or found on window)
|
|
10512
|
+
this._codeMirrorModules=null;// Map of segment index to CodeMirror EditorView instance
|
|
10513
|
+
this._segmentEditors={};// Internal segment counter (monotonically increasing for unique IDs)
|
|
10514
|
+
this._segmentCounter=0;// The view identifier used for onclick handlers in templates
|
|
10515
|
+
this._viewCallIdentifier=false;// Currently active (focused) segment index, or -1
|
|
10516
|
+
this._activeSegmentIndex=-1;// Drag state for reorder
|
|
10517
|
+
this._dragSourceIndex=-1;// Whether controls (line numbers + right sidebar) are currently visible
|
|
10518
|
+
this._controlsVisible=true;// Whether rich previews are globally visible
|
|
10519
|
+
this._previewsVisible=true;// Set of logical segment indices where preview has been individually hidden
|
|
10520
|
+
this._hiddenPreviewSegments={};// Debounce timers for image preview updates (keyed by segment index)
|
|
10521
|
+
this._imagePreviewTimers={};// Debounce timers for rich content preview updates (keyed by segment index)
|
|
10522
|
+
this._richPreviewTimers={};// Generation counters for mermaid async rendering (keyed by segment index)
|
|
10523
|
+
this._richPreviewGenerations={};// Content provider for markdown-to-HTML rendering in rich previews
|
|
10524
|
+
// (pict-section-content provides parseMarkdown, code highlighting, etc.)
|
|
10525
|
+
this._contentProvider=null;// Whether the rendered (read-mode) view is currently active
|
|
10526
|
+
this._renderedViewActive=false;// Generation counter for rendered view mermaid async rendering
|
|
10527
|
+
this._renderedViewGeneration=0;// Attach helper modules
|
|
10528
|
+
libFormatting.attach(this);libImageHandling.attach(this);libDragAndReorder.attach(this);libRichPreview.attach(this);libCodeMirror.attach(this);}onBeforeInitialize(){super.onBeforeInitialize();this.targetElement=false;return super.onBeforeInitialize();}/**
|
|
10529
|
+
* Connect the CodeMirror modules. The consumer must pass an object with:
|
|
10530
|
+
* - EditorView: the EditorView class
|
|
10531
|
+
* - EditorState: the EditorState class
|
|
10532
|
+
* - extensions: an array of extensions to use (e.g. basicSetup, markdown(), etc.)
|
|
10533
|
+
*
|
|
10534
|
+
* If not called explicitly, the view will attempt to find them on window.CodeMirrorModules.
|
|
10535
|
+
*
|
|
10536
|
+
* @param {object} [pCodeMirrorModules] - The CodeMirror modules object
|
|
10537
|
+
* @returns {boolean|void}
|
|
10538
|
+
*/connectCodeMirrorModules(pCodeMirrorModules){if(pCodeMirrorModules&&typeof pCodeMirrorModules==='object'){if(typeof pCodeMirrorModules.EditorView==='function'&&typeof pCodeMirrorModules.EditorState==='function'){this._codeMirrorModules=pCodeMirrorModules;return;}}// Try to find CodeMirror modules in global scope
|
|
10539
|
+
if(typeof window!=='undefined'){if(window.CodeMirrorModules&&typeof window.CodeMirrorModules.EditorView==='function'){this.log.trace(`PICT-MarkdownEditor Found CodeMirror modules on window.CodeMirrorModules.`);this._codeMirrorModules=window.CodeMirrorModules;return;}}this.log.error(`PICT-MarkdownEditor No CodeMirror modules found. Provide them via connectCodeMirrorModules() or set window.CodeMirrorModules.`);return false;}onAfterRender(pRenderable){// Inject CSS from all registered views
|
|
10540
|
+
this.pict.CSSMap.injectCSS();if(!this.initialRenderComplete){this.onAfterInitialRender();this.initialRenderComplete=true;}return super.onAfterRender(pRenderable);}onAfterInitialRender(){// Resolve CodeMirror modules if not already set
|
|
10541
|
+
if(!this._codeMirrorModules){this.connectCodeMirrorModules();}if(!this._codeMirrorModules){this.log.error(`PICT-MarkdownEditor Cannot initialize; no CodeMirror modules available.`);return false;}// Register pict-section-content's CSS for rich preview rendering.
|
|
10542
|
+
// This ensures the rendered markdown (headings, code blocks, tables, etc.)
|
|
10543
|
+
// is styled correctly inside the preview area.
|
|
10544
|
+
if(this.options.EnableRichPreview){let tmpContentViewConfig=libPictSectionContent.default_configuration;if(tmpContentViewConfig&&tmpContentViewConfig.CSS){this.pict.CSSMap.addCSS('Pict-Content-View',tmpContentViewConfig.CSS);}}// Find the target element
|
|
10545
|
+
let tmpTargetElementSet=this.services.ContentAssignment.getElement(this.options.TargetElementAddress);if(!tmpTargetElementSet||tmpTargetElementSet.length<1){this.log.error(`PICT-MarkdownEditor Could not find target element [${this.options.TargetElementAddress}]!`);this.targetElement=false;return false;}this.targetElement=tmpTargetElementSet[0];// Determine the view call identifier for onclick handlers
|
|
10546
|
+
this._viewCallIdentifier=this._resolveViewCallIdentifier();// Build the editor UI
|
|
10547
|
+
this._buildEditorUI();}/**
|
|
10548
|
+
* Resolve how the view can be referenced from global onclick handlers.
|
|
10549
|
+
* Returns a string like "_Pict.views.MyViewHash"
|
|
10550
|
+
*
|
|
10551
|
+
* @returns {string}
|
|
10552
|
+
*/_resolveViewCallIdentifier(){let tmpViews=this.pict.views;for(let tmpViewHash in tmpViews){if(tmpViews[tmpViewHash]===this){return`_Pict.views.${tmpViewHash}`;}}return`_Pict.servicesMap.PictView['${this.Hash}']`;}/**
|
|
10553
|
+
* Get the .pict-mde container element. Always does a fresh DOM lookup
|
|
10554
|
+
* because pict's async render pipeline can replace the element between calls.
|
|
10555
|
+
*
|
|
10556
|
+
* @returns {HTMLElement|null}
|
|
10557
|
+
*/_getContainerElement(){if(this.targetElement){let tmpContainer=this.targetElement.querySelector('.pict-mde');if(tmpContainer){return tmpContainer;}}return this.targetElement||null;}/**
|
|
10558
|
+
* Build the full editor UI: render existing segments from data and the add-segment button.
|
|
10559
|
+
*/_buildEditorUI(){let tmpContainer=this._getContainerElement();// Ensure the container has the pict-mde class (the template's wrapper
|
|
10560
|
+
// may have been replaced by pict's async render pipeline)
|
|
10561
|
+
if(tmpContainer&&!tmpContainer.classList.contains('pict-mde')){tmpContainer.classList.add('pict-mde');}// Destroy existing editors before clearing
|
|
10562
|
+
for(let tmpIdx in this._segmentEditors){if(this._segmentEditors[tmpIdx]){this._segmentEditors[tmpIdx].destroy();}}tmpContainer.innerHTML='';// Restore toggle states on the container after clearing
|
|
10563
|
+
if(!this._previewsVisible){tmpContainer.classList.add('pict-mde-previews-hidden');}if(this._controlsVisible){tmpContainer.classList.add('pict-mde-controls-on');}else{tmpContainer.classList.add('pict-mde-controls-hidden');}// Load existing segments from data address, or start with one empty segment
|
|
10564
|
+
let tmpSegments=this._getSegmentsFromData();if(!tmpSegments||tmpSegments.length===0){tmpSegments=[{Content:''}];this._setSegmentsToData(tmpSegments);}this._segmentCounter=0;this._segmentEditors={};for(let i=0;i<tmpSegments.length;i++){this._renderSegment(tmpContainer,i,tmpSegments[i].Content||'');}this._renderAddButton(tmpContainer);}/**
|
|
10565
|
+
* Render a single segment into the container.
|
|
10566
|
+
*
|
|
10567
|
+
* @param {HTMLElement} pContainer - The container element
|
|
10568
|
+
* @param {number} pIndex - The segment index
|
|
10569
|
+
* @param {string} pContent - The initial content
|
|
10570
|
+
*/_renderSegment(pContainer,pIndex,pContent){let tmpSegmentIndex=this._segmentCounter++;let tmpRecord={SegmentIndex:tmpSegmentIndex,SegmentDisplayIndex:pIndex+1,ViewIdentifier:this._viewCallIdentifier};let tmpHTML=this.pict.parseTemplateByHash('MarkdownEditor-Segment',tmpRecord);let tmpTempDiv=document.createElement('div');tmpTempDiv.innerHTML=tmpHTML;let tmpSegmentElement=tmpTempDiv.firstElementChild;pContainer.appendChild(tmpSegmentElement);// Build quadrant buttons from configuration arrays
|
|
10571
|
+
this._buildQuadrantButtons(tmpSegmentElement,tmpSegmentIndex);// Restore per-segment preview hidden state (tracked by logical index)
|
|
10572
|
+
if(this._hiddenPreviewSegments[pIndex]){tmpSegmentElement.classList.add('pict-mde-preview-hidden');}// Wire up drag-and-drop on the drag handle
|
|
10573
|
+
this._wireSegmentDragEvents(tmpSegmentElement,tmpSegmentIndex);// Create the CodeMirror editor in the segment editor container
|
|
10574
|
+
let tmpEditorContainer=document.getElementById(`PictMDE-SegmentEditor-${tmpSegmentIndex}`);if(tmpEditorContainer){this._createEditorInContainer(tmpEditorContainer,tmpSegmentIndex,pContent);// Wire image drag-and-drop on the editor container
|
|
10575
|
+
this._wireImageDragEvents(tmpEditorContainer,tmpSegmentIndex);// Render image previews for existing content
|
|
10576
|
+
if(pContent){this._updateImagePreviews(tmpSegmentIndex);this._updateRichPreviews(tmpSegmentIndex);}}}/**
|
|
10577
|
+
* Build buttons in all four quadrants (TL, BL, TR, BR) from the
|
|
10578
|
+
* configuration arrays. Each button config has:
|
|
10579
|
+
* HTML — innerHTML
|
|
10580
|
+
* Action — "methodName" or "methodName:arg"
|
|
10581
|
+
* Class — additional CSS class(es)
|
|
10582
|
+
* Title — tooltip text
|
|
10583
|
+
*
|
|
10584
|
+
* Left quadrant buttons (TL, BL) get the "pict-mde-left-btn" base class.
|
|
10585
|
+
* Right quadrant buttons (TR, BR) get the "pict-mde-sidebar-btn" base class.
|
|
10586
|
+
*
|
|
10587
|
+
* @param {HTMLElement} pSegmentElement - The .pict-mde-segment element
|
|
10588
|
+
* @param {number} pSegmentIndex - The internal segment index
|
|
10589
|
+
*/_buildQuadrantButtons(pSegmentElement,pSegmentIndex){let tmpQuadrants=[{key:'ButtonsTL',selector:'.pict-mde-quadrant-tl',baseClass:'pict-mde-left-btn'},{key:'ButtonsBL',selector:'.pict-mde-quadrant-bl',baseClass:'pict-mde-left-btn'},{key:'ButtonsTR',selector:'.pict-mde-quadrant-tr',baseClass:'pict-mde-sidebar-btn'},{key:'ButtonsBR',selector:'.pict-mde-quadrant-br',baseClass:'pict-mde-sidebar-btn'}];let tmpSelf=this;for(let q=0;q<tmpQuadrants.length;q++){let tmpQuadrant=tmpQuadrants[q];let tmpContainer=pSegmentElement.querySelector(tmpQuadrant.selector);if(!tmpContainer){continue;}let tmpButtons=this.options[tmpQuadrant.key];if(!Array.isArray(tmpButtons)){continue;}for(let b=0;b<tmpButtons.length;b++){let tmpBtnConfig=tmpButtons[b];let tmpButton=document.createElement('button');tmpButton.type='button';tmpButton.className=tmpQuadrant.baseClass;if(tmpBtnConfig.Class){tmpButton.className+=' '+tmpBtnConfig.Class;}tmpButton.innerHTML=tmpBtnConfig.HTML||'';tmpButton.title=tmpBtnConfig.Title||'';// Parse the action string: "methodName" or "methodName:arg"
|
|
10590
|
+
let tmpAction=tmpBtnConfig.Action||'';let tmpMethod=tmpAction;let tmpArg=null;let tmpColonIndex=tmpAction.indexOf(':');if(tmpColonIndex>=0){tmpMethod=tmpAction.substring(0,tmpColonIndex);tmpArg=tmpAction.substring(tmpColonIndex+1);}// Build the click handler
|
|
10591
|
+
(function(pMethod,pArg,pSegIdx){tmpButton.addEventListener('click',()=>{if(typeof tmpSelf[pMethod]==='function'){if(pArg!==null){tmpSelf[pMethod](pSegIdx,pArg);}else{tmpSelf[pMethod](pSegIdx);}}else{tmpSelf.log.warn(`PICT-MarkdownEditor _buildQuadrantButtons: method "${pMethod}" not found.`);}});})(tmpMethod,tmpArg,pSegmentIndex);tmpContainer.appendChild(tmpButton);}}}/**
|
|
10592
|
+
* Hook for subclasses to customize the CodeMirror extensions before editor creation.
|
|
10593
|
+
*
|
|
10594
|
+
* @param {Array} pExtensions - The extensions array to modify
|
|
10595
|
+
* @param {number} pSegmentIndex - The segment index
|
|
10596
|
+
* @returns {Array} The modified extensions array
|
|
10597
|
+
*/customConfigureExtensions(pExtensions,pSegmentIndex){return pExtensions;}/**
|
|
10598
|
+
* Render the "Add Segment" button at the bottom of the container.
|
|
10599
|
+
*
|
|
10600
|
+
* @param {HTMLElement} pContainer - The container element
|
|
10601
|
+
*/_renderAddButton(pContainer){let tmpRecord={ViewIdentifier:this._viewCallIdentifier};let tmpHTML=this.pict.parseTemplateByHash('MarkdownEditor-AddSegment',tmpRecord);let tmpTempDiv=document.createElement('div');tmpTempDiv.innerHTML=tmpHTML;let tmpButtonElement=tmpTempDiv.firstElementChild;pContainer.appendChild(tmpButtonElement);}/**
|
|
10602
|
+
* Hook for consumers to handle image uploads.
|
|
10603
|
+
*
|
|
10604
|
+
* Override this in a subclass or consumer to upload images to a server/CDN.
|
|
10605
|
+
* Return true to indicate you are handling the upload asynchronously.
|
|
10606
|
+
* Call fCallback(null, url) on success, or fCallback(error) on failure.
|
|
10607
|
+
* Return false/undefined to fall back to base64 data URI inline.
|
|
10608
|
+
*
|
|
10609
|
+
* @param {File} pFile - The image File object
|
|
10610
|
+
* @param {number} pSegmentIndex - The logical segment index
|
|
10611
|
+
* @param {function} fCallback - Callback: fCallback(pError, pURL)
|
|
10612
|
+
* @returns {boolean} true if handling the upload, false to use base64 default
|
|
10613
|
+
*/onImageUpload(pFile,pSegmentIndex,fCallback){// Override in subclass or consumer
|
|
10614
|
+
return false;}// -- Controls Toggle (line numbers + right sidebar) --
|
|
10615
|
+
/**
|
|
10616
|
+
* Toggle controls (line number gutters and right sidebar formatting
|
|
10617
|
+
* buttons) on or off for all segments.
|
|
10618
|
+
*
|
|
10619
|
+
* When controls are hidden the right-side quadrants (TR, BR) appear
|
|
10620
|
+
* faintly on hover but are otherwise invisible, and CodeMirror line
|
|
10621
|
+
* number gutters are hidden.
|
|
10622
|
+
*
|
|
10623
|
+
* This method is called by the quadrant button system with the segment
|
|
10624
|
+
* index as the first argument — it ignores that argument and uses only
|
|
10625
|
+
* the optional boolean.
|
|
10626
|
+
*
|
|
10627
|
+
* @param {number|boolean} [pSegmentIndexOrVisible] - Segment index (ignored) or boolean
|
|
10628
|
+
* @param {boolean} [pVisible] - If provided, set to this value; otherwise toggle
|
|
10629
|
+
*/toggleControls(pSegmentIndexOrVisible,pVisible){// When called from a quadrant button, first arg is segment index (number).
|
|
10630
|
+
// When called programmatically, first arg may be a boolean.
|
|
10631
|
+
let tmpVisible=pVisible;if(typeof pSegmentIndexOrVisible==='boolean'){tmpVisible=pSegmentIndexOrVisible;}if(typeof tmpVisible==='boolean'){this._controlsVisible=tmpVisible;}else{this._controlsVisible=!this._controlsVisible;}let tmpContainer=this._getContainerElement();if(tmpContainer){if(this._controlsVisible){tmpContainer.classList.add('pict-mde-controls-on');tmpContainer.classList.remove('pict-mde-controls-hidden');}else{tmpContainer.classList.remove('pict-mde-controls-on');tmpContainer.classList.add('pict-mde-controls-hidden');}}}/**
|
|
10632
|
+
* Toggle line numbers on or off for all segments.
|
|
10633
|
+
* Backward-compatible alias for toggleControls().
|
|
10634
|
+
*
|
|
10635
|
+
* @param {boolean} [pVisible] - If provided, set to this value; otherwise toggle
|
|
10636
|
+
*/toggleLineNumbers(pVisible){this.toggleControls(pVisible);}// -- Preview Toggle --
|
|
10637
|
+
/**
|
|
10638
|
+
* Toggle rich previews on or off for all segments globally.
|
|
10639
|
+
*
|
|
10640
|
+
* When hidden globally, individual segment overrides are preserved
|
|
10641
|
+
* so that restoring global visibility returns to the per-segment state.
|
|
10642
|
+
*
|
|
10643
|
+
* @param {boolean} [pVisible] - If provided, set to this value; otherwise toggle
|
|
10644
|
+
*/togglePreview(pVisible){if(typeof pVisible==='boolean'){this._previewsVisible=pVisible;}else{this._previewsVisible=!this._previewsVisible;}let tmpContainer=this._getContainerElement();if(tmpContainer){if(this._previewsVisible){tmpContainer.classList.remove('pict-mde-previews-hidden');}else{tmpContainer.classList.add('pict-mde-previews-hidden');}}}/**
|
|
10645
|
+
* Toggle the rich preview for a single segment.
|
|
10646
|
+
*
|
|
10647
|
+
* This adds/removes the .pict-mde-preview-hidden class on the
|
|
10648
|
+
* individual segment element, independent of the global toggle.
|
|
10649
|
+
*
|
|
10650
|
+
* @param {number} pSegmentIndex - The internal segment index
|
|
10651
|
+
* @param {boolean} [pVisible] - If provided, set to this value; otherwise toggle
|
|
10652
|
+
*/toggleSegmentPreview(pSegmentIndex,pVisible){// Convert internal index to logical index for persistent tracking
|
|
10653
|
+
let tmpLogicalIndex=this._getLogicalIndex(pSegmentIndex);if(tmpLogicalIndex<0){return;}let tmpCurrentlyHidden=!!this._hiddenPreviewSegments[tmpLogicalIndex];if(typeof pVisible==='boolean'){tmpCurrentlyHidden=!pVisible;}else{tmpCurrentlyHidden=!tmpCurrentlyHidden;}if(tmpCurrentlyHidden){this._hiddenPreviewSegments[tmpLogicalIndex]=true;}else{delete this._hiddenPreviewSegments[tmpLogicalIndex];}let tmpSegmentEl=document.getElementById(`PictMDE-Segment-${pSegmentIndex}`);if(tmpSegmentEl){if(tmpCurrentlyHidden){tmpSegmentEl.classList.add('pict-mde-preview-hidden');}else{tmpSegmentEl.classList.remove('pict-mde-preview-hidden');}}}// -- Segment Data Management --
|
|
10654
|
+
/**
|
|
10655
|
+
* Get the segments array from the configured data address.
|
|
10656
|
+
*
|
|
10657
|
+
* @returns {Array|null}
|
|
10658
|
+
*/_getSegmentsFromData(){if(!this.options.ContentDataAddress){return null;}const tmpAddressSpace={Fable:this.fable,Pict:this.fable,AppData:this.AppData,Bundle:this.Bundle,Options:this.options};let tmpData=this.fable.manifest.getValueByHash(tmpAddressSpace,this.options.ContentDataAddress);if(Array.isArray(tmpData)){return tmpData;}return null;}/**
|
|
10659
|
+
* Write the segments array to the configured data address.
|
|
10660
|
+
*
|
|
10661
|
+
* @param {Array} pSegments - The segments array
|
|
10662
|
+
*/_setSegmentsToData(pSegments){if(!this.options.ContentDataAddress){return;}const tmpAddressSpace={Fable:this.fable,Pict:this.fable,AppData:this.AppData,Bundle:this.Bundle,Options:this.options};this.fable.manifest.setValueByHash(tmpAddressSpace,this.options.ContentDataAddress,pSegments);}/**
|
|
10663
|
+
* Called when a segment's content changes in the CodeMirror editor.
|
|
10664
|
+
*
|
|
10665
|
+
* @param {number} pSegmentIndex - The internal segment index
|
|
10666
|
+
* @param {string} pContent - The new content
|
|
10667
|
+
*/_onSegmentContentChange(pSegmentIndex,pContent){let tmpLogicalIndex=this._getLogicalIndex(pSegmentIndex);if(tmpLogicalIndex<0){return;}let tmpSegments=this._getSegmentsFromData();if(!tmpSegments){return;}if(tmpLogicalIndex<tmpSegments.length){tmpSegments[tmpLogicalIndex].Content=pContent;}this.onContentChange(tmpLogicalIndex,pContent);// Debounce image preview updates (500ms) to avoid thrashing on every keystroke
|
|
10668
|
+
let tmpSelf=this;if(this._imagePreviewTimers[pSegmentIndex]){clearTimeout(this._imagePreviewTimers[pSegmentIndex]);}this._imagePreviewTimers[pSegmentIndex]=setTimeout(()=>{tmpSelf._updateImagePreviews(pSegmentIndex);delete tmpSelf._imagePreviewTimers[pSegmentIndex];},500);// Debounce rich content preview updates (mermaid / KaTeX) at 500ms
|
|
10669
|
+
if(this._richPreviewTimers[pSegmentIndex]){clearTimeout(this._richPreviewTimers[pSegmentIndex]);}this._richPreviewTimers[pSegmentIndex]=setTimeout(()=>{tmpSelf._updateRichPreviews(pSegmentIndex);delete tmpSelf._richPreviewTimers[pSegmentIndex];},500);}/**
|
|
10670
|
+
* Hook for subclasses to respond to content changes.
|
|
10671
|
+
*
|
|
10672
|
+
* @param {number} pSegmentIndex - The logical segment index
|
|
10673
|
+
* @param {string} pContent - The new content
|
|
10674
|
+
*/onContentChange(pSegmentIndex,pContent){// Override in subclass
|
|
10675
|
+
}/**
|
|
10676
|
+
* Get the logical (ordered) index for an internal segment index.
|
|
10677
|
+
*
|
|
10678
|
+
* @param {number} pInternalIndex - The internal segment index
|
|
10679
|
+
* @returns {number} The logical index, or -1 if not found
|
|
10680
|
+
*/_getLogicalIndex(pInternalIndex){let tmpContainer=this._getContainerElement();if(!tmpContainer){return-1;}let tmpSegmentElements=tmpContainer.querySelectorAll('.pict-mde-segment');for(let i=0;i<tmpSegmentElements.length;i++){let tmpIndex=parseInt(tmpSegmentElements[i].getAttribute('data-segment-index'),10);if(tmpIndex===pInternalIndex){return i;}}return-1;}/**
|
|
10681
|
+
* Get the ordered list of internal segment indices from the DOM.
|
|
10682
|
+
*
|
|
10683
|
+
* @returns {Array<number>}
|
|
10684
|
+
*/_getOrderedSegmentIndices(){let tmpContainer=this._getContainerElement();if(!tmpContainer){return[];}let tmpSegmentElements=tmpContainer.querySelectorAll('.pict-mde-segment');let tmpIndices=[];for(let i=0;i<tmpSegmentElements.length;i++){tmpIndices.push(parseInt(tmpSegmentElements[i].getAttribute('data-segment-index'),10));}return tmpIndices;}// -- Public API --
|
|
10685
|
+
/**
|
|
10686
|
+
* Add a new empty segment at the end.
|
|
10687
|
+
*
|
|
10688
|
+
* @param {string} [pContent] - Optional initial content for the new segment
|
|
10689
|
+
*/addSegment(pContent){let tmpContent=typeof pContent==='string'?pContent:'';let tmpSegments=this._getSegmentsFromData();if(!tmpSegments){tmpSegments=[];}tmpSegments.push({Content:tmpContent});this._setSegmentsToData(tmpSegments);this._buildEditorUI();}/**
|
|
10690
|
+
* Remove a segment by its internal index.
|
|
10691
|
+
*
|
|
10692
|
+
* @param {number} pSegmentIndex - The internal segment index
|
|
10693
|
+
*/removeSegment(pSegmentIndex){let tmpLogicalIndex=this._getLogicalIndex(pSegmentIndex);if(tmpLogicalIndex<0){this.log.warn(`PICT-MarkdownEditor removeSegment: segment index ${pSegmentIndex} not found.`);return;}let tmpSegments=this._getSegmentsFromData();if(!tmpSegments||tmpSegments.length<=1){this.log.warn(`PICT-MarkdownEditor removeSegment: cannot remove the last segment.`);return;}if(this._segmentEditors[pSegmentIndex]){this._segmentEditors[pSegmentIndex].destroy();delete this._segmentEditors[pSegmentIndex];}tmpSegments.splice(tmpLogicalIndex,1);this._setSegmentsToData(tmpSegments);// Update per-segment hidden preview state after removal
|
|
10694
|
+
let tmpNewHidden={};for(let tmpKey in this._hiddenPreviewSegments){let tmpIdx=parseInt(tmpKey,10);if(tmpIdx<tmpLogicalIndex){tmpNewHidden[tmpIdx]=true;}else if(tmpIdx>tmpLogicalIndex){tmpNewHidden[tmpIdx-1]=true;}// tmpIdx === tmpLogicalIndex is the removed segment; skip it
|
|
10695
|
+
}this._hiddenPreviewSegments=tmpNewHidden;this._buildEditorUI();}/**
|
|
10696
|
+
* Move a segment up by its internal index.
|
|
10697
|
+
*
|
|
10698
|
+
* @param {number} pSegmentIndex - The internal segment index
|
|
10699
|
+
*/moveSegmentUp(pSegmentIndex){let tmpLogicalIndex=this._getLogicalIndex(pSegmentIndex);if(tmpLogicalIndex<=0){return;}this._marshalAllEditorsToData();let tmpSegments=this._getSegmentsFromData();if(!tmpSegments){return;}let tmpTemp=tmpSegments[tmpLogicalIndex];tmpSegments[tmpLogicalIndex]=tmpSegments[tmpLogicalIndex-1];tmpSegments[tmpLogicalIndex-1]=tmpTemp;// Swap per-segment hidden preview state to follow the moved segment
|
|
10700
|
+
this._swapHiddenPreviewState(tmpLogicalIndex,tmpLogicalIndex-1);this._buildEditorUI();}/**
|
|
10701
|
+
* Move a segment down by its internal index.
|
|
10702
|
+
*
|
|
10703
|
+
* @param {number} pSegmentIndex - The internal segment index
|
|
10704
|
+
*/moveSegmentDown(pSegmentIndex){let tmpLogicalIndex=this._getLogicalIndex(pSegmentIndex);let tmpSegments=this._getSegmentsFromData();if(!tmpSegments||tmpLogicalIndex<0||tmpLogicalIndex>=tmpSegments.length-1){return;}this._marshalAllEditorsToData();let tmpTemp=tmpSegments[tmpLogicalIndex];tmpSegments[tmpLogicalIndex]=tmpSegments[tmpLogicalIndex+1];tmpSegments[tmpLogicalIndex+1]=tmpTemp;// Swap per-segment hidden preview state to follow the moved segment
|
|
10705
|
+
this._swapHiddenPreviewState(tmpLogicalIndex,tmpLogicalIndex+1);this._buildEditorUI();}/**
|
|
10706
|
+
* Get the content of a specific segment by logical index.
|
|
10707
|
+
*
|
|
10708
|
+
* @param {number} pLogicalIndex - The logical (0-based) index
|
|
10709
|
+
* @returns {string} The segment content
|
|
10710
|
+
*/getSegmentContent(pLogicalIndex){let tmpOrderedIndices=this._getOrderedSegmentIndices();if(pLogicalIndex<0||pLogicalIndex>=tmpOrderedIndices.length){return'';}let tmpInternalIndex=tmpOrderedIndices[pLogicalIndex];let tmpEditor=this._segmentEditors[tmpInternalIndex];if(tmpEditor){return tmpEditor.state.doc.toString();}return'';}/**
|
|
10711
|
+
* Set the content of a specific segment by logical index.
|
|
10712
|
+
*
|
|
10713
|
+
* @param {number} pLogicalIndex - The logical (0-based) index
|
|
10714
|
+
* @param {string} pContent - The content to set
|
|
10715
|
+
*/setSegmentContent(pLogicalIndex,pContent){let tmpOrderedIndices=this._getOrderedSegmentIndices();if(pLogicalIndex<0||pLogicalIndex>=tmpOrderedIndices.length){this.log.warn(`PICT-MarkdownEditor setSegmentContent: index ${pLogicalIndex} out of range.`);return;}let tmpInternalIndex=tmpOrderedIndices[pLogicalIndex];let tmpEditor=this._segmentEditors[tmpInternalIndex];if(tmpEditor){tmpEditor.dispatch({changes:{from:0,to:tmpEditor.state.doc.length,insert:pContent}});}}/**
|
|
10716
|
+
* Get the total number of segments.
|
|
10717
|
+
*
|
|
10718
|
+
* @returns {number}
|
|
10719
|
+
*/getSegmentCount(){return this._getOrderedSegmentIndices().length;}/**
|
|
10720
|
+
* Get all content from all segments joined together.
|
|
10721
|
+
*
|
|
10722
|
+
* @param {string} [pSeparator] - The separator between segments (default: "\n\n")
|
|
10723
|
+
* @returns {string}
|
|
10724
|
+
*/getAllContent(pSeparator){let tmpSeparator=typeof pSeparator==='string'?pSeparator:'\n\n';let tmpOrderedIndices=this._getOrderedSegmentIndices();let tmpParts=[];for(let i=0;i<tmpOrderedIndices.length;i++){let tmpEditor=this._segmentEditors[tmpOrderedIndices[i]];if(tmpEditor){tmpParts.push(tmpEditor.state.doc.toString());}}return tmpParts.join(tmpSeparator);}/**
|
|
10725
|
+
* Marshal all editor contents back into the data address.
|
|
10726
|
+
*/_marshalAllEditorsToData(){let tmpSegments=this._getSegmentsFromData();if(!tmpSegments){return;}let tmpOrderedIndices=this._getOrderedSegmentIndices();for(let i=0;i<tmpOrderedIndices.length;i++){let tmpEditor=this._segmentEditors[tmpOrderedIndices[i]];if(tmpEditor&&i<tmpSegments.length){tmpSegments[i].Content=tmpEditor.state.doc.toString();}}}/**
|
|
10727
|
+
* Set the read-only state of all editors.
|
|
10728
|
+
*
|
|
10729
|
+
* @param {boolean} pReadOnly - Whether editors should be read-only
|
|
10730
|
+
*/setReadOnly(pReadOnly){this.options.ReadOnly=pReadOnly;if(this.initialRenderComplete){this._marshalAllEditorsToData();this._buildEditorUI();}}/**
|
|
10731
|
+
* Marshal content from the data address into the view.
|
|
10732
|
+
*/marshalToView(){super.marshalToView();if(this.initialRenderComplete&&this.options.ContentDataAddress){this._buildEditorUI();}}/**
|
|
10733
|
+
* Marshal the current editor content back to the data address.
|
|
10734
|
+
*/marshalFromView(){super.marshalFromView();this._marshalAllEditorsToData();}/**
|
|
10735
|
+
* Destroy all editors and clean up.
|
|
10736
|
+
*/destroy(){for(let tmpIndex in this._segmentEditors){if(this._segmentEditors[tmpIndex]){this._segmentEditors[tmpIndex].destroy();}}this._segmentEditors={};// Clear rich preview debounce timers
|
|
10737
|
+
for(let tmpIndex in this._richPreviewTimers){clearTimeout(this._richPreviewTimers[tmpIndex]);}this._richPreviewTimers={};this._richPreviewGenerations={};}}module.exports=PictSectionMarkdownEditor;module.exports.default_configuration=_DefaultConfiguration;},{"./Pict-MDE-CodeMirror.js":218,"./Pict-MDE-DragAndReorder.js":219,"./Pict-MDE-Formatting.js":220,"./Pict-MDE-ImageHandling.js":221,"./Pict-MDE-RichPreview.js":222,"./Pict-Section-MarkdownEditor-DefaultConfiguration.js":223,"pict-section-content":151,"pict-view":244}],225:[function(require,module,exports){module.exports={ViewIdentifier:'Pict-ObjectEditor',DefaultRenderable:'ObjectEditor-Container',DefaultDestinationAddress:'#ObjectEditor-Container',AutoRender:false,// Address in AppData where the JSON object lives
|
|
9688
10738
|
ObjectDataAddress:false,// Maximum depth to auto-expand on initial load
|
|
9689
10739
|
InitialExpandDepth:1,// Whether editing is enabled (vs read-only inspector mode)
|
|
9690
10740
|
Editable:true,// Whether to show type indicator badges
|
|
@@ -9956,12 +11006,12 @@ IndentPixels:20,CSS:/*css*/`
|
|
|
9956
11006
|
white-space: nowrap;
|
|
9957
11007
|
padding: 0 8px;
|
|
9958
11008
|
}
|
|
9959
|
-
`,MacroTemplates:{Node:{RowOpen:'<div class="pict-oe-row" style="padding-left:{~D:Record.PaddingLeft~}px" data-path="{~D:Record.EscapedPath~}">',RowClose:'</div>',Toggle:'<span class="pict-oe-toggle" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].toggleNode(\'{~D:Record.EscapedPath~}\')">{~D:Record.ToggleArrow~}</span>',Spacer:'<span class="pict-oe-spacer"></span>',KeyName:'<span class="pict-oe-key">{~D:Record.EscapedKey~}</span>',KeyIndex:'<span class="pict-oe-key"><span class="pict-oe-array-index">{~D:Record.ArrayIndex~}</span></span>',Separator:'<span class="pict-oe-separator">:</span>',TypeBadge:'<span class="pict-oe-type-badge">{~D:Record.TypeLabel~}</span>',Summary:'<span class="pict-oe-summary">{~D:Record.SummaryText~}</span>',ValueStringEditable:'<span class="pict-oe-value pict-oe-value-string" ondblclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].beginEdit(\'{~D:Record.EscapedPath~}\', \'string\')" title="{~D:Record.EscapedTitle~}">{~D:Record.EscapedValue~}</span>',ValueStringReadOnly:'<span class="pict-oe-value pict-oe-value-string" title="{~D:Record.EscapedTitle~}">{~D:Record.EscapedValue~}</span>',ValueNumberEditable:'<span class="pict-oe-value pict-oe-value-number" ondblclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].beginEdit(\'{~D:Record.EscapedPath~}\', \'number\')">{~D:Record.EscapedValue~}</span>',ValueNumberReadOnly:'<span class="pict-oe-value pict-oe-value-number">{~D:Record.EscapedValue~}</span>',ValueBooleanEditable:'<span class="pict-oe-value pict-oe-value-boolean" style="cursor:pointer" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].toggleBoolean(\'{~D:Record.EscapedPath~}\')">{~D:Record.DisplayValue~}</span>',ValueBooleanReadOnly:'<span class="pict-oe-value pict-oe-value-boolean">{~D:Record.DisplayValue~}</span>',ValueNull:'<span class="pict-oe-value pict-oe-value-null">null</span>',ActionsOpen:'<span class="pict-oe-actions">',ActionsClose:'</span>',ButtonRemove:'<span class="pict-oe-action-btn pict-oe-action-remove" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].removeNode(\'{~D:Record.EscapedPath~}\')" title="Remove">\u00D7</span>',ButtonAddObject:'<span class="pict-oe-action-btn pict-oe-action-add" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].beginAddToObject(\'{~D:Record.EscapedPath~}\')" title="Add">+</span>',ButtonAddArray:'<span class="pict-oe-action-btn pict-oe-action-add" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].beginAddToArray(\'{~D:Record.EscapedPath~}\')" title="Add">+</span>',ButtonMoveUp:'<span class="pict-oe-action-btn pict-oe-action-move" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].moveArrayElementUp(\'{~D:Record.EscapedArrayPath~}\', {~D:Record.ArrayIndex~})" title="Move up">\u25B2</span>',ButtonMoveDown:'<span class="pict-oe-action-btn pict-oe-action-move" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].moveArrayElementDown(\'{~D:Record.EscapedArrayPath~}\', {~D:Record.ArrayIndex~})" title="Move down">\u25BC</span>',RootAddObject:'<div class="pict-oe-root-add" data-path=""><span class="pict-oe-action-btn pict-oe-action-add" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].beginAddToObject(\'\')" title="Add property">+ add property</span></div>',RootAddArray:'<div class="pict-oe-root-add" data-path=""><span class="pict-oe-action-btn pict-oe-action-add" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].beginAddToArray(\'\')" title="Add element">+ add element</span></div>'}},Templates:[{Hash:'ObjectEditor-Container-Template',Template:'<div class="pict-objecteditor" id="ObjectEditor-Tree-{~D:Context[0].Hash~}"></div>'},{Hash:'ObjectEditor-Node-String',Template:'{~D:Record.Macro.RowOpen~}{~D:Record.Macro.Spacer~}{~D:Record.Macro.Key~}{~D:Record.Macro.Separator~}{~D:Record.Macro.Value~}{~D:Record.Macro.Actions~}{~D:Record.Macro.RowClose~}'},{Hash:'ObjectEditor-Node-Number',Template:'{~D:Record.Macro.RowOpen~}{~D:Record.Macro.Spacer~}{~D:Record.Macro.Key~}{~D:Record.Macro.Separator~}{~D:Record.Macro.Value~}{~D:Record.Macro.Actions~}{~D:Record.Macro.RowClose~}'},{Hash:'ObjectEditor-Node-Boolean',Template:'{~D:Record.Macro.RowOpen~}{~D:Record.Macro.Spacer~}{~D:Record.Macro.Key~}{~D:Record.Macro.Separator~}{~D:Record.Macro.Value~}{~D:Record.Macro.Actions~}{~D:Record.Macro.RowClose~}'},{Hash:'ObjectEditor-Node-Null',Template:'{~D:Record.Macro.RowOpen~}{~D:Record.Macro.Spacer~}{~D:Record.Macro.Key~}{~D:Record.Macro.Separator~}{~D:Record.Macro.Value~}{~D:Record.Macro.Actions~}{~D:Record.Macro.RowClose~}'},{Hash:'ObjectEditor-Node-Object',Template:'{~D:Record.Macro.RowOpen~}{~D:Record.Macro.Toggle~}{~D:Record.Macro.Key~}{~D:Record.Macro.TypeBadge~}{~D:Record.Macro.Summary~}{~D:Record.Macro.Actions~}{~D:Record.Macro.RowClose~}'},{Hash:'ObjectEditor-Node-Array',Template:'{~D:Record.Macro.RowOpen~}{~D:Record.Macro.Toggle~}{~D:Record.Macro.Key~}{~D:Record.Macro.TypeBadge~}{~D:Record.Macro.Summary~}{~D:Record.Macro.Actions~}{~D:Record.Macro.RowClose~}'}],Renderables:[{RenderableHash:'ObjectEditor-Container',TemplateHash:'ObjectEditor-Container-Template',DestinationAddress:'#ObjectEditor-Container',RenderMethod:'replace'}]};},{}],
|
|
11009
|
+
`,MacroTemplates:{Node:{RowOpen:'<div class="pict-oe-row" style="padding-left:{~D:Record.PaddingLeft~}px" data-path="{~D:Record.EscapedPath~}">',RowClose:'</div>',Toggle:'<span class="pict-oe-toggle" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].toggleNode(\'{~D:Record.EscapedPath~}\')">{~D:Record.ToggleArrow~}</span>',Spacer:'<span class="pict-oe-spacer"></span>',KeyName:'<span class="pict-oe-key">{~D:Record.EscapedKey~}</span>',KeyIndex:'<span class="pict-oe-key"><span class="pict-oe-array-index">{~D:Record.ArrayIndex~}</span></span>',Separator:'<span class="pict-oe-separator">:</span>',TypeBadge:'<span class="pict-oe-type-badge">{~D:Record.TypeLabel~}</span>',Summary:'<span class="pict-oe-summary">{~D:Record.SummaryText~}</span>',ValueStringEditable:'<span class="pict-oe-value pict-oe-value-string" ondblclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].beginEdit(\'{~D:Record.EscapedPath~}\', \'string\')" title="{~D:Record.EscapedTitle~}">{~D:Record.EscapedValue~}</span>',ValueStringReadOnly:'<span class="pict-oe-value pict-oe-value-string" title="{~D:Record.EscapedTitle~}">{~D:Record.EscapedValue~}</span>',ValueNumberEditable:'<span class="pict-oe-value pict-oe-value-number" ondblclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].beginEdit(\'{~D:Record.EscapedPath~}\', \'number\')">{~D:Record.EscapedValue~}</span>',ValueNumberReadOnly:'<span class="pict-oe-value pict-oe-value-number">{~D:Record.EscapedValue~}</span>',ValueBooleanEditable:'<span class="pict-oe-value pict-oe-value-boolean" style="cursor:pointer" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].toggleBoolean(\'{~D:Record.EscapedPath~}\')">{~D:Record.DisplayValue~}</span>',ValueBooleanReadOnly:'<span class="pict-oe-value pict-oe-value-boolean">{~D:Record.DisplayValue~}</span>',ValueNull:'<span class="pict-oe-value pict-oe-value-null">null</span>',ActionsOpen:'<span class="pict-oe-actions">',ActionsClose:'</span>',ButtonRemove:'<span class="pict-oe-action-btn pict-oe-action-remove" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].removeNode(\'{~D:Record.EscapedPath~}\')" title="Remove">\u00D7</span>',ButtonAddObject:'<span class="pict-oe-action-btn pict-oe-action-add" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].beginAddToObject(\'{~D:Record.EscapedPath~}\')" title="Add">+</span>',ButtonAddArray:'<span class="pict-oe-action-btn pict-oe-action-add" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].beginAddToArray(\'{~D:Record.EscapedPath~}\')" title="Add">+</span>',ButtonMoveUp:'<span class="pict-oe-action-btn pict-oe-action-move" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].moveArrayElementUp(\'{~D:Record.EscapedArrayPath~}\', {~D:Record.ArrayIndex~})" title="Move up">\u25B2</span>',ButtonMoveDown:'<span class="pict-oe-action-btn pict-oe-action-move" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].moveArrayElementDown(\'{~D:Record.EscapedArrayPath~}\', {~D:Record.ArrayIndex~})" title="Move down">\u25BC</span>',RootAddObject:'<div class="pict-oe-root-add" data-path=""><span class="pict-oe-action-btn pict-oe-action-add" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].beginAddToObject(\'\')" title="Add property">+ add property</span></div>',RootAddArray:'<div class="pict-oe-root-add" data-path=""><span class="pict-oe-action-btn pict-oe-action-add" onclick="{~P~}.views[\'{~D:Context[0].Hash~}\'].beginAddToArray(\'\')" title="Add element">+ add element</span></div>'}},Templates:[{Hash:'ObjectEditor-Container-Template',Template:'<div class="pict-objecteditor" id="ObjectEditor-Tree-{~D:Context[0].Hash~}"></div>'},{Hash:'ObjectEditor-Node-String',Template:'{~D:Record.Macro.RowOpen~}{~D:Record.Macro.Spacer~}{~D:Record.Macro.Key~}{~D:Record.Macro.Separator~}{~D:Record.Macro.Value~}{~D:Record.Macro.Actions~}{~D:Record.Macro.RowClose~}'},{Hash:'ObjectEditor-Node-Number',Template:'{~D:Record.Macro.RowOpen~}{~D:Record.Macro.Spacer~}{~D:Record.Macro.Key~}{~D:Record.Macro.Separator~}{~D:Record.Macro.Value~}{~D:Record.Macro.Actions~}{~D:Record.Macro.RowClose~}'},{Hash:'ObjectEditor-Node-Boolean',Template:'{~D:Record.Macro.RowOpen~}{~D:Record.Macro.Spacer~}{~D:Record.Macro.Key~}{~D:Record.Macro.Separator~}{~D:Record.Macro.Value~}{~D:Record.Macro.Actions~}{~D:Record.Macro.RowClose~}'},{Hash:'ObjectEditor-Node-Null',Template:'{~D:Record.Macro.RowOpen~}{~D:Record.Macro.Spacer~}{~D:Record.Macro.Key~}{~D:Record.Macro.Separator~}{~D:Record.Macro.Value~}{~D:Record.Macro.Actions~}{~D:Record.Macro.RowClose~}'},{Hash:'ObjectEditor-Node-Object',Template:'{~D:Record.Macro.RowOpen~}{~D:Record.Macro.Toggle~}{~D:Record.Macro.Key~}{~D:Record.Macro.TypeBadge~}{~D:Record.Macro.Summary~}{~D:Record.Macro.Actions~}{~D:Record.Macro.RowClose~}'},{Hash:'ObjectEditor-Node-Array',Template:'{~D:Record.Macro.RowOpen~}{~D:Record.Macro.Toggle~}{~D:Record.Macro.Key~}{~D:Record.Macro.TypeBadge~}{~D:Record.Macro.Summary~}{~D:Record.Macro.Actions~}{~D:Record.Macro.RowClose~}'}],Renderables:[{RenderableHash:'ObjectEditor-Container',TemplateHash:'ObjectEditor-Container-Template',DestinationAddress:'#ObjectEditor-Container',RenderMethod:'replace'}]};},{}],226:[function(require,module,exports){// Pict Section: Object Editor
|
|
9960
11010
|
// A tree-based JSON object viewer and editor for Pict applications.
|
|
9961
11011
|
// The main object editor view class
|
|
9962
11012
|
module.exports=require('./views/PictView-ObjectEditor.js');// Node type views
|
|
9963
11013
|
module.exports.PictViewObjectEditorNode=require('./views/PictView-ObjectEditor-Node.js');module.exports.PictViewObjectEditorNodeString=require('./views/PictView-ObjectEditor-NodeString.js');module.exports.PictViewObjectEditorNodeNumber=require('./views/PictView-ObjectEditor-NodeNumber.js');module.exports.PictViewObjectEditorNodeBoolean=require('./views/PictView-ObjectEditor-NodeBoolean.js');module.exports.PictViewObjectEditorNodeNull=require('./views/PictView-ObjectEditor-NodeNull.js');module.exports.PictViewObjectEditorNodeObject=require('./views/PictView-ObjectEditor-NodeObject.js');module.exports.PictViewObjectEditorNodeArray=require('./views/PictView-ObjectEditor-NodeArray.js');// Default configuration
|
|
9964
|
-
module.exports.default_configuration=require('./Pict-Section-ObjectEditor-DefaultConfiguration.js');},{"./Pict-Section-ObjectEditor-DefaultConfiguration.js":
|
|
11014
|
+
module.exports.default_configuration=require('./Pict-Section-ObjectEditor-DefaultConfiguration.js');},{"./Pict-Section-ObjectEditor-DefaultConfiguration.js":225,"./views/PictView-ObjectEditor-Node.js":227,"./views/PictView-ObjectEditor-NodeArray.js":228,"./views/PictView-ObjectEditor-NodeBoolean.js":229,"./views/PictView-ObjectEditor-NodeNull.js":230,"./views/PictView-ObjectEditor-NodeNumber.js":231,"./views/PictView-ObjectEditor-NodeObject.js":232,"./views/PictView-ObjectEditor-NodeString.js":233,"./views/PictView-ObjectEditor.js":234}],227:[function(require,module,exports){const libPictView=require('pict-view');/**
|
|
9965
11015
|
* Base class for all object editor node type renderers.
|
|
9966
11016
|
*
|
|
9967
11017
|
* Each subclass implements renderNodeHTML() to return an HTML string
|
|
@@ -10007,35 +11057,35 @@ if(!pOptions.ShowTypeIndicators){pNode.Macro.TypeBadge='';}}/**
|
|
|
10007
11057
|
* Escape a string for safe use in HTML attributes.
|
|
10008
11058
|
*/escapeAttribute(pString){if(typeof pString!=='string'){return'';}return pString.replace(/&/g,'&').replace(/"/g,'"').replace(/'/g,''').replace(/</g,'<').replace(/>/g,'>');}/**
|
|
10009
11059
|
* Escape a string for safe use in HTML content.
|
|
10010
|
-
*/escapeHTML(pString){if(typeof pString!=='string'){return'';}return pString.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/'/g,''');}}module.exports=PictViewObjectEditorNode;},{"pict-view":
|
|
11060
|
+
*/escapeHTML(pString){if(typeof pString!=='string'){return'';}return pString.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/'/g,''');}}module.exports=PictViewObjectEditorNode;},{"pict-view":244}],228:[function(require,module,exports){const libPictViewObjectEditorNode=require('./PictView-ObjectEditor-Node.js');class PictViewObjectEditorNodeArray extends libPictViewObjectEditorNode{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='PictViewObjectEditorNodeArray';}renderNodeHTML(pNode,pValue,pOptions){// Set type-specific display properties on the node descriptor
|
|
10011
11061
|
let tmpLength=Array.isArray(pValue)?pValue.length:0;pNode.TypeLabel='Array';let tmpNoun=tmpLength===1?'item':'items';pNode.SummaryText='['+tmpLength+' '+tmpNoun+']';// Compile all MacroTemplates onto pNode.Macro
|
|
10012
11062
|
this.compileMacros(pNode,pValue,pOptions);// Compose container actions (includes add button)
|
|
10013
11063
|
pNode.Macro.Actions=this.compileContainerActions(pNode,pOptions,'array');// Render via per-type template
|
|
10014
|
-
return this.pict.parseTemplate(this.pict.TemplateProvider.getTemplate('ObjectEditor-Node-Array'),pNode,null,[this._ObjectEditorView]);}}module.exports=PictViewObjectEditorNodeArray;},{"./PictView-ObjectEditor-Node.js":
|
|
11064
|
+
return this.pict.parseTemplate(this.pict.TemplateProvider.getTemplate('ObjectEditor-Node-Array'),pNode,null,[this._ObjectEditorView]);}}module.exports=PictViewObjectEditorNodeArray;},{"./PictView-ObjectEditor-Node.js":227}],229:[function(require,module,exports){const libPictViewObjectEditorNode=require('./PictView-ObjectEditor-Node.js');class PictViewObjectEditorNodeBoolean extends libPictViewObjectEditorNode{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='PictViewObjectEditorNodeBoolean';}renderNodeHTML(pNode,pValue,pOptions){// Set type-specific display properties on the node descriptor
|
|
10015
11065
|
pNode.DisplayValue=pValue?'true':'false';// Compile all MacroTemplates onto pNode.Macro
|
|
10016
11066
|
this.compileMacros(pNode,pValue,pOptions);// Select editable or read-only value macro
|
|
10017
11067
|
pNode.Macro.Value=pOptions.Editable?pNode.Macro.ValueBooleanEditable:pNode.Macro.ValueBooleanReadOnly;// Compose actions
|
|
10018
11068
|
pNode.Macro.Actions=this.compileActions(pNode,pOptions);// Render via per-type template
|
|
10019
|
-
return this.pict.parseTemplate(this.pict.TemplateProvider.getTemplate('ObjectEditor-Node-Boolean'),pNode,null,[this._ObjectEditorView]);}}module.exports=PictViewObjectEditorNodeBoolean;},{"./PictView-ObjectEditor-Node.js":
|
|
11069
|
+
return this.pict.parseTemplate(this.pict.TemplateProvider.getTemplate('ObjectEditor-Node-Boolean'),pNode,null,[this._ObjectEditorView]);}}module.exports=PictViewObjectEditorNodeBoolean;},{"./PictView-ObjectEditor-Node.js":227}],230:[function(require,module,exports){const libPictViewObjectEditorNode=require('./PictView-ObjectEditor-Node.js');class PictViewObjectEditorNodeNull extends libPictViewObjectEditorNode{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='PictViewObjectEditorNodeNull';}renderNodeHTML(pNode,pValue,pOptions){// Compile all MacroTemplates onto pNode.Macro
|
|
10020
11070
|
this.compileMacros(pNode,pValue,pOptions);// Null always uses the static ValueNull macro
|
|
10021
11071
|
pNode.Macro.Value=pNode.Macro.ValueNull;// Compose actions
|
|
10022
11072
|
pNode.Macro.Actions=this.compileActions(pNode,pOptions);// Render via per-type template
|
|
10023
|
-
return this.pict.parseTemplate(this.pict.TemplateProvider.getTemplate('ObjectEditor-Node-Null'),pNode,null,[this._ObjectEditorView]);}}module.exports=PictViewObjectEditorNodeNull;},{"./PictView-ObjectEditor-Node.js":
|
|
11073
|
+
return this.pict.parseTemplate(this.pict.TemplateProvider.getTemplate('ObjectEditor-Node-Null'),pNode,null,[this._ObjectEditorView]);}}module.exports=PictViewObjectEditorNodeNull;},{"./PictView-ObjectEditor-Node.js":227}],231:[function(require,module,exports){const libPictViewObjectEditorNode=require('./PictView-ObjectEditor-Node.js');class PictViewObjectEditorNodeNumber extends libPictViewObjectEditorNode{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='PictViewObjectEditorNodeNumber';}renderNodeHTML(pNode,pValue,pOptions){// Set type-specific display properties on the node descriptor
|
|
10024
11074
|
pNode.EscapedValue=this.escapeHTML(String(pValue));// Compile all MacroTemplates onto pNode.Macro
|
|
10025
11075
|
this.compileMacros(pNode,pValue,pOptions);// Select editable or read-only value macro
|
|
10026
11076
|
pNode.Macro.Value=pOptions.Editable?pNode.Macro.ValueNumberEditable:pNode.Macro.ValueNumberReadOnly;// Compose actions
|
|
10027
11077
|
pNode.Macro.Actions=this.compileActions(pNode,pOptions);// Render via per-type template
|
|
10028
|
-
return this.pict.parseTemplate(this.pict.TemplateProvider.getTemplate('ObjectEditor-Node-Number'),pNode,null,[this._ObjectEditorView]);}}module.exports=PictViewObjectEditorNodeNumber;},{"./PictView-ObjectEditor-Node.js":
|
|
11078
|
+
return this.pict.parseTemplate(this.pict.TemplateProvider.getTemplate('ObjectEditor-Node-Number'),pNode,null,[this._ObjectEditorView]);}}module.exports=PictViewObjectEditorNodeNumber;},{"./PictView-ObjectEditor-Node.js":227}],232:[function(require,module,exports){const libPictViewObjectEditorNode=require('./PictView-ObjectEditor-Node.js');class PictViewObjectEditorNodeObject extends libPictViewObjectEditorNode{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='PictViewObjectEditorNodeObject';}renderNodeHTML(pNode,pValue,pOptions){// Set type-specific display properties on the node descriptor
|
|
10029
11079
|
let tmpKeyCount=0;if(pValue&&typeof pValue==='object'&&!Array.isArray(pValue)){tmpKeyCount=Object.keys(pValue).length;}pNode.TypeLabel='Object';let tmpNoun=tmpKeyCount===1?'key':'keys';pNode.SummaryText='{'+tmpKeyCount+' '+tmpNoun+'}';// Compile all MacroTemplates onto pNode.Macro
|
|
10030
11080
|
this.compileMacros(pNode,pValue,pOptions);// Compose container actions (includes add button)
|
|
10031
11081
|
pNode.Macro.Actions=this.compileContainerActions(pNode,pOptions,'object');// Render via per-type template
|
|
10032
|
-
return this.pict.parseTemplate(this.pict.TemplateProvider.getTemplate('ObjectEditor-Node-Object'),pNode,null,[this._ObjectEditorView]);}}module.exports=PictViewObjectEditorNodeObject;},{"./PictView-ObjectEditor-Node.js":
|
|
11082
|
+
return this.pict.parseTemplate(this.pict.TemplateProvider.getTemplate('ObjectEditor-Node-Object'),pNode,null,[this._ObjectEditorView]);}}module.exports=PictViewObjectEditorNodeObject;},{"./PictView-ObjectEditor-Node.js":227}],233:[function(require,module,exports){const libPictViewObjectEditorNode=require('./PictView-ObjectEditor-Node.js');class PictViewObjectEditorNodeString extends libPictViewObjectEditorNode{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='PictViewObjectEditorNodeString';}renderNodeHTML(pNode,pValue,pOptions){// Set type-specific display properties on the node descriptor
|
|
10033
11083
|
let tmpDisplayValue=typeof pValue==='string'?pValue:'';// Truncate long strings for display
|
|
10034
11084
|
let tmpTruncated=tmpDisplayValue.length>120?tmpDisplayValue.substring(0,120)+'\u2026':tmpDisplayValue;pNode.EscapedValue=this.escapeHTML(tmpTruncated);pNode.EscapedTitle=this.escapeAttribute(tmpDisplayValue);// Compile all MacroTemplates onto pNode.Macro
|
|
10035
11085
|
this.compileMacros(pNode,pValue,pOptions);// Select editable or read-only value macro
|
|
10036
11086
|
pNode.Macro.Value=pOptions.Editable?pNode.Macro.ValueStringEditable:pNode.Macro.ValueStringReadOnly;// Compose actions
|
|
10037
11087
|
pNode.Macro.Actions=this.compileActions(pNode,pOptions);// Render via per-type template
|
|
10038
|
-
return this.pict.parseTemplate(this.pict.TemplateProvider.getTemplate('ObjectEditor-Node-String'),pNode,null,[this._ObjectEditorView]);}}module.exports=PictViewObjectEditorNodeString;},{"./PictView-ObjectEditor-Node.js":
|
|
11088
|
+
return this.pict.parseTemplate(this.pict.TemplateProvider.getTemplate('ObjectEditor-Node-String'),pNode,null,[this._ObjectEditorView]);}}module.exports=PictViewObjectEditorNodeString;},{"./PictView-ObjectEditor-Node.js":227}],234:[function(require,module,exports){const libPictView=require('pict-view');const libNodeString=require('./PictView-ObjectEditor-NodeString.js');const libNodeNumber=require('./PictView-ObjectEditor-NodeNumber.js');const libNodeBoolean=require('./PictView-ObjectEditor-NodeBoolean.js');const libNodeNull=require('./PictView-ObjectEditor-NodeNull.js');const libNodeObject=require('./PictView-ObjectEditor-NodeObject.js');const libNodeArray=require('./PictView-ObjectEditor-NodeArray.js');const _DefaultConfiguration=require('../Pict-Section-ObjectEditor-DefaultConfiguration.js');class PictViewObjectEditor extends libPictView{constructor(pFable,pOptions,pServiceHash){let tmpOptions=Object.assign({},_DefaultConfiguration,pOptions);super(pFable,tmpOptions,pServiceHash);this.initialRenderComplete=false;// Set of expanded path strings
|
|
10039
11089
|
this._ExpandedPaths=new Set();// Map of data type -> node renderer instance
|
|
10040
11090
|
this._NodeRenderers={};}onBeforeInitialize(){super.onBeforeInitialize();// Register node type service types if they aren't already present
|
|
10041
11091
|
let tmpNodeTypes={'PictViewObjectEditorNodeString':libNodeString,'PictViewObjectEditorNodeNumber':libNodeNumber,'PictViewObjectEditorNodeBoolean':libNodeBoolean,'PictViewObjectEditorNodeNull':libNodeNull,'PictViewObjectEditorNodeObject':libNodeObject,'PictViewObjectEditorNodeArray':libNodeArray};let tmpNodeTypeKeys=Object.keys(tmpNodeTypes);for(let i=0;i<tmpNodeTypeKeys.length;i++){let tmpKey=tmpNodeTypeKeys[i];if(!this.fable.servicesMap.hasOwnProperty(tmpKey)){this.fable.addServiceType(tmpKey,tmpNodeTypes[tmpKey]);}}// Instantiate one renderer per data type
|
|
@@ -10148,7 +11198,7 @@ let tmpOldIndices=Object.keys(tmpPathsByIndex);for(let i=0;i<tmpOldIndices.lengt
|
|
|
10148
11198
|
* Recursively expand paths up to a given depth.
|
|
10149
11199
|
*/_expandToDepth(pValue,pBasePath,pCurrentDepth,pMaxDepth){if(pValue===null||pValue===undefined||typeof pValue!=='object'){return;}if(Array.isArray(pValue)){for(let i=0;i<pValue.length;i++){let tmpChildPath=pBasePath?pBasePath+'['+i+']':'['+i+']';if(typeof pValue[i]==='object'&&pValue[i]!==null){// Mark this child as expanded (it's an object or array that can be toggled)
|
|
10150
11200
|
this._ExpandedPaths.add(tmpChildPath);if(pCurrentDepth+1<pMaxDepth){this._expandToDepth(pValue[i],tmpChildPath,pCurrentDepth+1,pMaxDepth);}}}}else{let tmpKeys=Object.keys(pValue);for(let i=0;i<tmpKeys.length;i++){let tmpKey=tmpKeys[i];let tmpChildPath=pBasePath?pBasePath+'.'+tmpKey:tmpKey;let tmpChildValue=pValue[tmpKey];if(typeof tmpChildValue==='object'&&tmpChildValue!==null){// Mark this child as expanded (it's an object or array that can be toggled)
|
|
10151
|
-
this._ExpandedPaths.add(tmpChildPath);if(pCurrentDepth+1<pMaxDepth){this._expandToDepth(tmpChildValue,tmpChildPath,pCurrentDepth+1,pMaxDepth);}}}}}}module.exports=PictViewObjectEditor;module.exports.default_configuration=_DefaultConfiguration;},{"../Pict-Section-ObjectEditor-DefaultConfiguration.js":
|
|
11201
|
+
this._ExpandedPaths.add(tmpChildPath);if(pCurrentDepth+1<pMaxDepth){this._expandToDepth(tmpChildValue,tmpChildPath,pCurrentDepth+1,pMaxDepth);}}}}}}module.exports=PictViewObjectEditor;module.exports.default_configuration=_DefaultConfiguration;},{"../Pict-Section-ObjectEditor-DefaultConfiguration.js":225,"./PictView-ObjectEditor-NodeArray.js":228,"./PictView-ObjectEditor-NodeBoolean.js":229,"./PictView-ObjectEditor-NodeNull.js":230,"./PictView-ObjectEditor-NodeNumber.js":231,"./PictView-ObjectEditor-NodeObject.js":232,"./PictView-ObjectEditor-NodeString.js":233,"pict-view":244}],235:[function(require,module,exports){module.exports={"RenderOnLoad":true,"GridWidth":"auto","GridRowHeight":40,"GridBodyHeight":"auto","GridBodyMinHeight":130,"GridColumnMinWidth":50,"GridColumnWidthResizable":true,"GridColumnHeightResizable":false,"GridColumnFrozenCount":0,"GridColumnFrozenBorderWidth":3,"GridScrollX":true,"GridScrollY":true,"GridShowDummyRows":false,"GridDraggableRows":false,"GridSelectionUnit":"cell","DefaultRenderable":"TuiGrid-Wrap","DefaultDestinationAddress":"#TuiGrid-Container-Div","Templates":[{"Hash":"TuiGrid-Container","Template":"<!-- TuiGrid-Container Rendering Soon -->"}],"Renderables":[{"RenderableHash":"TuiGrid-Wrap","TemplateHash":"TuiGrid-Container","DestinationAddress":"#TuiGrid-Container-Div"}],"TargetElementAddress":"#TuiGrid-Container-Div","GridDataAddress":false,"GridData":[{"idrecord":1,"entity":"SampleEntity","name":"Record name 1","description":"description 1"},{"idrecord":2,"entity":"SampleEntity","name":"Record name 2","description":"description 2"},{"idrecord":3,"entity":"SampleEntity","name":"Record name 3","description":"description 3"},{"idrecord":4,"entity":"SampleEntity","name":"Record name 4","description":"description 4"},{"idrecord":5,"entity":"SampleEntity","name":"Record name 5","description":"description 5"},{"idrecord":6,"entity":"SampleEntity","name":"Record name 6","description":"description 6"},{"idrecord":7,"entity":"SampleEntity","name":"Record name 7","description":"description 7"},{"idrecord":8,"entity":"SampleEntity","name":"Record name 8","description":"description 8"},{"idrecord":9,"entity":"SampleEntity","name":"Record name 9","description":"description 9"}],"ColumnsToSolveOnChange":{},"TuiColumnSchema":[{"header":"IDRecord","name":"idrecord","PictTriggerSolveOnChange":true},{"header":"Entity","name":"entity","PictTriggerSolveOnChange":true},{"header":"Name","name":"name","editor":"text"},{"header":"Description","name":"description","editor":"text"}]};},{}],236:[function(require,module,exports){const libPictViewClass=require('pict-view');/**
|
|
10152
11202
|
* @typedef {typeof import('tui-grid').default} TuiGridClass
|
|
10153
11203
|
* @typedef {import('tui-grid').default} TuiGrid
|
|
10154
11204
|
*/class PictSectionTuiGrid extends libPictViewClass{constructor(pFable,pOptions,pServiceHash){let tmpOptions=Object.assign({},require('./Pict-Section-TuiGrid-DefaultConfiguration.json'),pOptions);super(pFable,tmpOptions,pServiceHash);/** @type {{ [key: string]: any }} */this.services;this.dateFormatter=this.fable.instantiateServiceProviderWithoutRegistration('Dates');this.initialRenderComplete=false;this.customFormatters={};}onBeforeInitialize(){super.onBeforeInitialize();/** @type {TuiGridClass} */this._tuiGridPrototype=null;/** @type {TuiGrid} */this.tuiGrid=null;this.customHeaders=require('./Pict-TuiGrid-Headers.js');this.customEditors=require('./Pict-TuiGrid-Editors.js');this.initializeCustomFormatters();this.columnSchema=false;this.targetElementAddress=false;/** @type {Array<any>} */this.gridData=null;return super.onBeforeInitialize();}initializeCustomFormatters(){this.customFormatters.FormatterTwoDigitNumber=pCell=>{let tmpCellValue=Number.parseFloat(pCell.value);let tmpPrecision=pCell?.decimalPrecision??2;if(isNaN(tmpCellValue)){return'';}else{return this.fable.Math.roundPrecise(pCell.value,tmpPrecision);}};this.customFormatters.FormatterCurrencyNumber=pCell=>{let tmpPrecision=pCell?.decimalPrecision??2;let tmpCellValue=this.fable.DataFormat.formatterDollars(pCell.value,tmpPrecision);return tmpCellValue;};this.customFormatters.FormatterRoundedNumber=pCell=>{let tmpCellValue=Number.parseFloat(pCell.value);let tmpPrecision=pCell?.decimalPrecision??2;if(isNaN(tmpCellValue)){return'';}else{return this.fable.Math.roundPrecise(pCell.value,tmpPrecision);}};this.customFormatters.FormatterDate=pCell=>{let tmpDate=this.fable.Dates.dayJS.utc(pCell.value);if(pCell.dateformat){return tmpDate.format(pCell.dateformat);}else{return tmpDate.format();}};}/**
|
|
@@ -10236,11 +11286,11 @@ usageStatistics:false,scrollY:this.options.GridScrollY,columnOptions:{resizable:
|
|
|
10236
11286
|
* @param {string} pCellValueToSet - Value to be set
|
|
10237
11287
|
* @param {string} pRowKey - the key of the row to be set
|
|
10238
11288
|
* @return {boolean}
|
|
10239
|
-
*/SetGridValueByRowKey(pCellColumnToBeSet,pCellValueToSet,pRowKey){if(typeof pRowKey=='undefined'){this.log.error(`Could not set grid value [${pCellColumnToBeSet}] = [${pCellValueToSet}] looked up by row key [${pRowKey}]. No valid row key!`);return false;}if(!this.tuiGrid){this.log.warn(`Could not set grid value [${pCellColumnToBeSet}] = [${pCellValueToSet}] looked up by row key [${pRowKey}]. No valid grid!`);return false;}this.tuiGrid.setValue(pRowKey,pCellColumnToBeSet,pCellValueToSet);return true;}}module.exports=PictSectionTuiGrid;/** @type {Record<string, any>} */module.exports.default_configuration=require('./Pict-Section-TuiGrid-DefaultConfiguration.json');},{"./Pict-Section-TuiGrid-DefaultConfiguration.json":
|
|
10240
|
-
class tuiCustomEditorNumber{constructor(pProperties){const tmpElement=document.createElement('input');const decimalPrecision=pProperties.columnInfo.editor.options.decimalPrecision?pProperties.columnInfo.editor.options.decimalPrecision:3;tmpElement.type='number';tmpElement.value=String(pProperties.value);tmpElement.oninput=pElement=>{if(pElement.target instanceof HTMLInputElement){const tmpCastNumber=parseFloat(pElement.target.value).toFixed(decimalPrecision).toString();if(tmpCastNumber.length<parseFloat(pElement.target.value).toString().length){pElement.target.value=tmpCastNumber;}}};this.Element=tmpElement;}getElement(){return this.Element;}getValue(){return this.Element.value;}mounted(){this.Element.select();}}module.exports=tuiCustomEditorNumber;},{}],
|
|
10241
|
-
class tuiCustomEditorText{constructor(pProperties){const tmpElement=document.createElement('input');tmpElement.type='text';tmpElement.value=String(pProperties.value);tmpElement.placeholder=pProperties.columnInfo.editor.options.placeholder||'';tmpElement.pattern=pProperties.columnInfo.editor.options.pattern||'';tmpElement.minLength=pProperties.columnInfo.editor.options.minLength||'';tmpElement.maxLength=pProperties.columnInfo.editor.options.maxLength||'';tmpElement.required=pProperties.columnInfo.editor.options.required||'';this.Element=tmpElement;}getElement(){return this.Element;}getValue(){return this.Element.value;}mounted(){this.Element.select();}}module.exports=tuiCustomEditorText;},{}],
|
|
11289
|
+
*/SetGridValueByRowKey(pCellColumnToBeSet,pCellValueToSet,pRowKey){if(typeof pRowKey=='undefined'){this.log.error(`Could not set grid value [${pCellColumnToBeSet}] = [${pCellValueToSet}] looked up by row key [${pRowKey}]. No valid row key!`);return false;}if(!this.tuiGrid){this.log.warn(`Could not set grid value [${pCellColumnToBeSet}] = [${pCellValueToSet}] looked up by row key [${pRowKey}]. No valid grid!`);return false;}this.tuiGrid.setValue(pRowKey,pCellColumnToBeSet,pCellValueToSet);return true;}}module.exports=PictSectionTuiGrid;/** @type {Record<string, any>} */module.exports.default_configuration=require('./Pict-Section-TuiGrid-DefaultConfiguration.json');},{"./Pict-Section-TuiGrid-DefaultConfiguration.json":235,"./Pict-TuiGrid-Editors.js":239,"./Pict-TuiGrid-Headers.js":240,"pict-view":244}],237:[function(require,module,exports){// Custom number editor class with an option for precision
|
|
11290
|
+
class tuiCustomEditorNumber{constructor(pProperties){const tmpElement=document.createElement('input');const decimalPrecision=pProperties.columnInfo.editor.options.decimalPrecision?pProperties.columnInfo.editor.options.decimalPrecision:3;tmpElement.type='number';tmpElement.value=String(pProperties.value);tmpElement.oninput=pElement=>{if(pElement.target instanceof HTMLInputElement){const tmpCastNumber=parseFloat(pElement.target.value).toFixed(decimalPrecision).toString();if(tmpCastNumber.length<parseFloat(pElement.target.value).toString().length){pElement.target.value=tmpCastNumber;}}};this.Element=tmpElement;}getElement(){return this.Element;}getValue(){return this.Element.value;}mounted(){this.Element.select();}}module.exports=tuiCustomEditorNumber;},{}],238:[function(require,module,exports){// Custom number editor class with an option for precision
|
|
11291
|
+
class tuiCustomEditorText{constructor(pProperties){const tmpElement=document.createElement('input');tmpElement.type='text';tmpElement.value=String(pProperties.value);tmpElement.placeholder=pProperties.columnInfo.editor.options.placeholder||'';tmpElement.pattern=pProperties.columnInfo.editor.options.pattern||'';tmpElement.minLength=pProperties.columnInfo.editor.options.minLength||'';tmpElement.maxLength=pProperties.columnInfo.editor.options.maxLength||'';tmpElement.required=pProperties.columnInfo.editor.options.required||'';this.Element=tmpElement;}getElement(){return this.Element;}getValue(){return this.Element.value;}mounted(){this.Element.select();}}module.exports=tuiCustomEditorText;},{}],239:[function(require,module,exports){module.exports={EditorNumber:require('./Pict-TuiGrid-Editor-Number.js'),EditorText:require('./Pict-TuiGrid-Editor-Text.js')};},{"./Pict-TuiGrid-Editor-Number.js":237,"./Pict-TuiGrid-Editor-Text.js":238}],240:[function(require,module,exports){// Custom column header where the header is hidden
|
|
10242
11292
|
class tuiCustomColumnHeaderNone{constructor(){let tmpElement=document.createElement('input');tmpElement.type='hidden';tmpElement.value='';this.Element=tmpElement;}getElement(){return this.Element;}render(){// Noop!
|
|
10243
|
-
}}module.exports={CustomColumnHeaderNone:tuiCustomColumnHeaderNone};},{}],
|
|
11293
|
+
}}module.exports={CustomColumnHeaderNone:tuiCustomColumnHeaderNone};},{}],241:[function(require,module,exports){module.exports={"name":"pict-template","version":"1.0.14","description":"Pict Template Base Class","main":"source/Pict-Template.js","scripts":{"start":"node source/Pict-Template.js","test":"npx mocha -u tdd -R spec","tests":"npx mocha -u tdd --exit -R spec --grep","coverage":"npx nyc --reporter=lcov --reporter=text-lcov npx mocha -- -u tdd -R spec","build":"npx quack build","types":"tsc -p ."},"types":"types/source/Pict-Template.d.ts","repository":{"type":"git","url":"git+https://github.com/stevenvelozo/pict-view.git"},"author":"steven velozo <steven@velozo.com>","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/pict-view/issues"},"homepage":"https://github.com/stevenvelozo/pict-view#readme","devDependencies":{"pict":"^1.0.348","quackage":"^1.0.51","typescript":"^5.9.3"},"mocha":{"diff":true,"extension":["js"],"package":"./package.json","reporter":"spec","slow":"75","timeout":"5000","ui":"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]},"dependencies":{"fable-serviceproviderbase":"^3.0.18"}};},{}],242:[function(require,module,exports){const libFableServiceBase=require('fable-serviceproviderbase');const libPackage=require('../package.json');/** @typedef {import('pict') & {
|
|
10244
11294
|
* [key: string]: any, // represent services for now as a workaround
|
|
10245
11295
|
* }} Pict *//**
|
|
10246
11296
|
* @class PictTemplateExpression
|
|
@@ -10288,7 +11338,7 @@ class tuiCustomColumnHeaderNone{constructor(){let tmpElement=document.createElem
|
|
|
10288
11338
|
* @param {any} [pState] - A catchall state object for plumbing data through template processing.
|
|
10289
11339
|
*
|
|
10290
11340
|
* @return {any} The value at the given address, or undefined
|
|
10291
|
-
*/resolveStateFromAddress(pAddress,pRecord,pContextArray,pRootDataObject,pScope,pState){return this.pict.resolveStateFromAddress(pAddress,pRecord,pContextArray,pRootDataObject,pScope,pState);}}module.exports=PictTemplateExpression;module.exports.template_hash='Default';},{"../package.json":
|
|
11341
|
+
*/resolveStateFromAddress(pAddress,pRecord,pContextArray,pRootDataObject,pScope,pState){return this.pict.resolveStateFromAddress(pAddress,pRecord,pContextArray,pRootDataObject,pScope,pState);}}module.exports=PictTemplateExpression;module.exports.template_hash='Default';},{"../package.json":241,"fable-serviceproviderbase":60}],243:[function(require,module,exports){module.exports={"name":"pict-view","version":"1.0.66","description":"Pict View Base Class","main":"source/Pict-View.js","scripts":{"test":"mocha -u tdd -R spec","tests":"mocha -u tdd -R spec -g","start":"node source/Pict-View.js","coverage":"nyc --reporter=lcov --reporter=text-lcov npm test","build":"npx quack build","docker-dev-build":"docker build ./ -f Dockerfile_LUXURYCode -t pict-view-image:local","docker-dev-run":"docker run -it -d --name pict-view-dev -p 30001:8080 -p 38086:8086 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/pict-view\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" pict-view-image:local","docker-dev-shell":"docker exec -it pict-view-dev /bin/bash","types":"tsc -p .","lint":"eslint source/**"},"types":"types/source/Pict-View.d.ts","repository":{"type":"git","url":"git+https://github.com/stevenvelozo/pict-view.git"},"author":"steven velozo <steven@velozo.com>","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/pict-view/issues"},"homepage":"https://github.com/stevenvelozo/pict-view#readme","devDependencies":{"@eslint/js":"^9.39.1","browser-env":"^3.3.0","eslint":"^9.39.1","pict":"^1.0.348","quackage":"^1.0.51","typescript":"^5.9.3"},"mocha":{"diff":true,"extension":["js"],"package":"./package.json","reporter":"spec","slow":"75","timeout":"5000","ui":"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]},"dependencies":{"fable":"^3.1.57","fable-serviceproviderbase":"^3.0.18"}};},{}],244:[function(require,module,exports){const libFableServiceBase=require('fable-serviceproviderbase');const libPackage=require('../package.json');const defaultPictViewSettings={DefaultRenderable:false,DefaultDestinationAddress:false,DefaultTemplateRecordAddress:false,ViewIdentifier:false,// If this is set to true, when the App initializes this will.
|
|
10292
11342
|
// After the App initializes, initialize will be called as soon as it's added.
|
|
10293
11343
|
AutoInitialize:true,AutoInitializeOrdinal:0,// If this is set to true, when the App autorenders (on load) this will.
|
|
10294
11344
|
// After the App initializes, render will be called as soon as it's added.
|
|
@@ -10579,21 +11629,21 @@ tmpView.onAfterRender(tmpEvent.Data.Renderable);}}return true;}/**
|
|
|
10579
11629
|
* Lifecycle hook that triggers after data is marshaled into the view (async flow).
|
|
10580
11630
|
*
|
|
10581
11631
|
* @param {ErrorCallback} fCallback - The callback to call when the async operation is complete.
|
|
10582
|
-
*/onAfterMarshalToViewAsync(fCallback){this.onAfterMarshalToView();return fCallback();}/** @return {boolean} - True if the object is a PictView. */get isPictView(){return true;}}module.exports=PictView;},{"../package.json":
|
|
11632
|
+
*/onAfterMarshalToViewAsync(fCallback){this.onAfterMarshalToView();return fCallback();}/** @return {boolean} - True if the object is a PictView. */get isPictView(){return true;}}module.exports=PictView;},{"../package.json":243,"fable-serviceproviderbase":60}],245:[function(require,module,exports){module.exports={"name":"pict","version":"1.0.350","description":"Pict browser library.","main":"source/Pict.js","scripts":{"start":"node source/Pict.js","test":"npx mocha -u tdd -R spec","tests":"npx mocha -u tdd --exit -R spec --grep","coverage":"npx nyc --reporter=lcov --reporter=text-lcov npx mocha -- -u tdd -R spec","build":"npx quack build","docker-dev-build":"docker build ./ -f Dockerfile_LUXURYCode -t pict-image:local","docker-dev-run":"docker run -it -d --name pict-dev -p 37447:8080 -p 19506:8086 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/pict\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" pict-image:local","docker-dev-shell":"docker exec -it pict-dev /bin/bash","lint":"eslint source/**/*.js test/**/*.js","types":"tsc -p ."},"types":"types/source/Pict.d.ts","mocha":{"diff":true,"extension":["js"],"package":"./package.json","reporter":"spec","slow":"75","timeout":"5000","ui":"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]},"repository":{"type":"git","url":"git+https://stevenvelozo@github.com/stevenvelozo/pict.git"},"author":"steven velozo <steven@velozo.com>","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/pict/issues"},"homepage":"https://github.com/stevenvelozo/pict#readme","devDependencies":{"@eslint/js":"^9.39.1","@types/jquery":"^3.5.33","@types/sinon":"^17.0.4","eslint":"^9.39.1","globals":"^16.5.0","quackage":"^1.0.51","sinon":"^20.0.0","typescript":"^5.9.3"},"dependencies":{"cachetrax":"^1.0.5","fable":"^3.1.58","pict-application":"^1.0.32","pict-provider":"^1.0.10","pict-template":"^1.0.14","pict-view":"^1.0.66"}};},{}],246:[function(require,module,exports){// This assumes Pict has been required in the browser. Delcare these as globals so linter can do its job.
|
|
10583
11633
|
/* global Pict, _Pict: writeable *//**
|
|
10584
11634
|
* Simple function to load a pict Application
|
|
10585
11635
|
*
|
|
10586
11636
|
* @param {import('pict-application')} [pPictApplication] - The pict application to load.
|
|
10587
11637
|
* @param {number} [pLogNoisiness] - The log noisiness level.
|
|
10588
11638
|
*/module.exports=function(pPictApplication,pLogNoisiness){let tmpLogNoisiness=typeof pLogNoisiness=='undefined'?0:pLogNoisiness;// Set up a basal pict on the window object
|
|
10589
|
-
if(pPictApplication&&typeof pPictApplication['default_configuration']==='object'&&'pict_configuration'in pPictApplication['default_configuration']){window._Pict=new Pict(pPictApplication['default_configuration'].pict_configuration);}else{window._Pict=new Pict();}window._Pict.LogNoisiness=tmpLogNoisiness;let tmpApplicationHash='DefaultApplication';let tmpDefaultConfiguration={};if('default_configuration'in pPictApplication){tmpDefaultConfiguration=pPictApplication.default_configuration;if('Hash'in tmpDefaultConfiguration&&typeof tmpDefaultConfiguration.Hash==='string'){tmpApplicationHash=tmpDefaultConfiguration.Hash;}}_Pict.log.info(`Loading the pict application [${tmpApplicationHash}] and associated views.`);_Pict.addApplication(tmpApplicationHash,tmpDefaultConfiguration,pPictApplication);_Pict.PictApplication.initializeAsync(function(pError){if(pError){console.log('Error initializing the pict application: '+pError);}_Pict.log.info('Loading the Application and associated views.');});};},{}],
|
|
11639
|
+
if(pPictApplication&&typeof pPictApplication['default_configuration']==='object'&&'pict_configuration'in pPictApplication['default_configuration']){window._Pict=new Pict(pPictApplication['default_configuration'].pict_configuration);}else{window._Pict=new Pict();}window._Pict.LogNoisiness=tmpLogNoisiness;let tmpApplicationHash='DefaultApplication';let tmpDefaultConfiguration={};if('default_configuration'in pPictApplication){tmpDefaultConfiguration=pPictApplication.default_configuration;if('Hash'in tmpDefaultConfiguration&&typeof tmpDefaultConfiguration.Hash==='string'){tmpApplicationHash=tmpDefaultConfiguration.Hash;}}_Pict.log.info(`Loading the pict application [${tmpApplicationHash}] and associated views.`);_Pict.addApplication(tmpApplicationHash,tmpDefaultConfiguration,pPictApplication);_Pict.PictApplication.initializeAsync(function(pError){if(pError){console.log('Error initializing the pict application: '+pError);}_Pict.log.info('Loading the Application and associated views.');});};},{}],247:[function(require,module,exports){/**
|
|
10590
11640
|
* Provide a safe on document ready function (without needing a framework like jquery)
|
|
10591
11641
|
*
|
|
10592
11642
|
* @param {function} fCallback - The function to call when the document is ready
|
|
10593
11643
|
*/module.exports=function(fCallback){if(!document){console.log('No document object found; no initialization happening.');return;}// In case the document is already rendered
|
|
10594
11644
|
if(document.readyState!='loading')fCallback();// Modern browsers have event listener capabilities
|
|
10595
11645
|
else if(document.addEventListener)document.addEventListener('DOMContentLoaded',function(){fCallback();});//@ts-ignore IE <= 8 and ... other abominations
|
|
10596
|
-
else document.attachEvent('onreadystatechange',function(){if(document.readyState=='complete')fCallback();});};},{}],
|
|
11646
|
+
else document.attachEvent('onreadystatechange',function(){if(document.readyState=='complete')fCallback();});};},{}],248:[function(require,module,exports){const libFableServiceBase=require('fable').ServiceProviderBase;const defaultConfiguration={// This is the address for the <script /> tag that contains the CSS.
|
|
10597
11647
|
CSSElementAddress:'#PICT-CSS'};class PictCSS extends libFableServiceBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);/** @type {any} */this.options;/** @type {{ ContentAssignment: import('./Pict-Content-Assignment') }} */this.services;/** @type {import('fable')} */this.fable;// No merging of options necessary
|
|
10598
11648
|
if(typeof this.options.CSSElementAddress==='undefined'){this.options.CSSElementAddress=defaultConfiguration.CSSElementAddress;}this.inlineCSSMap={};this.fable.addSolverFunction(this.fable.expressionParser,'createcsscolorrgbfromnumeric',this.createCssColorRGBFromNumeric.bind(this),'Create a CSS color from RGB components');}// Add a CSS fragment to the CSS map (each view can have its own CSS fragment)
|
|
10599
11649
|
// Hash is shared across all views, so if 10 views all load the "My-Table-View" fragment, it will only be loaded once.
|
|
@@ -10605,7 +11655,7 @@ let tmpRed=parseFloat(pRed);let tmpGreen=parseFloat(pGreen);let tmpBlue=parseFlo
|
|
|
10605
11655
|
else if(tmpRed<=255&&tmpGreen<=255&&tmpBlue<=255){tmpRed=Math.round(tmpRed);tmpGreen=Math.round(tmpGreen);tmpBlue=Math.round(tmpBlue);}// Otherwise get the maximum of the three and quantize them to 255
|
|
10606
11656
|
else{let tmpMax=Math.max(Math.max(tmpRed,tmpGreen),tmpBlue);tmpRed=Math.round(tmpRed/tmpMax*255);tmpGreen=Math.round(tmpGreen/tmpMax*255);tmpBlue=Math.round(tmpBlue/tmpMax*255);}tmpRed=Math.abs(tmpRed);tmpGreen=Math.abs(tmpGreen);tmpBlue=Math.abs(tmpBlue);let tmpRedHex=tmpRed.toString(16).padStart(2,'0');let tmpGreenHex=tmpGreen.toString(16).padStart(2,'0');let tmpBlueHex=tmpBlue.toString(16).padStart(2,'0');return`#${tmpRedHex}${tmpGreenHex}${tmpBlueHex}`;}generateCSS(){let tmpCSS='';let tmpCSSHashes=Object.keys(this.inlineCSSMap);// Sort the hashes by Priority
|
|
10607
11657
|
tmpCSSHashes.sort((a,b)=>{return this.inlineCSSMap[a].Priority-this.inlineCSSMap[b].Priority;});for(let i=0;i<tmpCSSHashes.length;i++){let tmpCSSFragment=this.inlineCSSMap[tmpCSSHashes[i]];let tmpCSSComment=tmpCSSFragment.Hash;if(tmpCSSFragment.Hash!=tmpCSSFragment.Provider){tmpCSSComment=`${tmpCSSComment} from ${tmpCSSFragment.Provider}`;}tmpCSS+=`/* ${tmpCSSComment} */\n${tmpCSSFragment.Content}\n`;}return tmpCSS;}// Inject the CSS into the magic DOM element for it
|
|
10608
|
-
injectCSS(){this.services.ContentAssignment.assignContent(this.options.CSSElementAddress,this.generateCSS());}}module.exports=PictCSS;},{"fable":69}],
|
|
11658
|
+
injectCSS(){this.services.ContentAssignment.assignContent(this.options.CSSElementAddress,this.generateCSS());}}module.exports=PictCSS;},{"fable":69}],249:[function(require,module,exports){const libFableServiceBase=require('fable').ServiceProviderBase;/**
|
|
10609
11659
|
* Class for moving content around in the DOM.
|
|
10610
11660
|
*/class PictContentAssignment extends libFableServiceBase{/**
|
|
10611
11661
|
* @param {import('fable')} pFable - The Fable library instance.
|
|
@@ -10775,10 +11825,10 @@ const tmpTargetElement=typeof pAddress==='string'?window.jQuery(pAddress):window
|
|
|
10775
11825
|
*
|
|
10776
11826
|
* @param {string|HTMLElement} pAddress - The address of the element (a CSS selector), or the element itself.
|
|
10777
11827
|
* @param {string} pClass - The class to check for.
|
|
10778
|
-
*/toggleClass(pAddress,pClass){if(this.hasClass(pAddress,pClass)){this.removeClass(pAddress,pClass);}else{this.addClass(pAddress,pClass);}}}module.exports=PictContentAssignment;},{"fable":69}],
|
|
11828
|
+
*/toggleClass(pAddress,pClass){if(this.hasClass(pAddress,pClass)){this.removeClass(pAddress,pClass);}else{this.addClass(pAddress,pClass);}}}module.exports=PictContentAssignment;},{"fable":69}],250:[function(require,module,exports){const libFableServiceBase=require('fable').ServiceProviderBase;class PictDataProvider extends libFableServiceBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);/** @type {import('fable') & import('./Pict')} */this.fable;this.serviceType='PictDataProvider';}/**
|
|
10779
11829
|
* @param {string} pAddress - The address of the data to retrieve
|
|
10780
11830
|
* @param {object} [pData] - (optional) The record to provide to the address resolver
|
|
10781
|
-
*/getDataByAddress(pAddress,pData){let tmpData=typeof pData==='undefined'?{}:pData;const tmpAddressSpace={Fable:this.fable,Pict:this.fable,AppData:this.fable.AppData,Bundle:this.fable.Bundle,Record:tmpData};return this.fable.manifest.getValueByHash(tmpAddressSpace,pAddress);}}module.exports=PictDataProvider;},{"fable":69}],
|
|
11831
|
+
*/getDataByAddress(pAddress,pData){let tmpData=typeof pData==='undefined'?{}:pData;const tmpAddressSpace={Fable:this.fable,Pict:this.fable,AppData:this.fable.AppData,Bundle:this.fable.Bundle,Record:tmpData};return this.fable.manifest.getValueByHash(tmpAddressSpace,pAddress);}}module.exports=PictDataProvider;},{"fable":69}],251:[function(require,module,exports){const libFableServiceBase=require('fable').ServiceProviderBase;class PictMeadowEntityProvider extends libFableServiceBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);/** @type {any} */this.options;/** @type {import('./Pict') & { settings: any } & { newAnticipate: any }} */this.fable;/** @type {any} */this.log;this.serviceType='PictMeadowProvider';if(this.fable.settings.PictDefaultURLPrefix){this.options.urlPrefix=this.fable.settings.PictDefaultURLPrefix;}else if(!this.options.urlPrefix){this.options.urlPrefix='/1.0/';}if(!this.options.downloadBatchSize){if(typeof this.fable.settings.PictDefaultDownloadBatchSize==='number'){this.options.downloadBatchSize=this.fable.settings.PictDefaultDownloadBatchSize;}else{this.options.downloadBatchSize=100;}}//@ts-ignore - FIXME - remove once we have fable types
|
|
10782
11832
|
this.restClient=this.fable.RestClient??this.fable.instantiateServiceProviderWithoutRegistration('RestClient');/** @type {Record<string, import('cachetrax')>} */this.recordCache={};/** @type {Record<string, import('cachetrax')>} */this.recordSetCache={};this.entityColumnTranslations={CreatingIDUser:'User',UpdatingIDUser:'User',DeletingIDUser:'User'};this.prepareRequestOptions=pOptions=>{return pOptions;};}initializeCache(pEntity){// This should not be happening as often as it's happening.
|
|
10783
11833
|
if(!(pEntity in this.recordCache)){//@ts-ignore - FIXME - remove once we have fable types
|
|
10784
11834
|
this.recordCache[pEntity]=this.fable.instantiateServiceProviderWithoutRegistration('ObjectCache');// TODO: Make this a configuration?
|
|
@@ -10945,7 +11995,7 @@ formatUrl(pEntityType){return`${this.options.urlPrefix}${pEntityType}`;}/**
|
|
|
10945
11995
|
* @param {Function} fCallback - The callback to call when the request is complete.
|
|
10946
11996
|
*
|
|
10947
11997
|
* @return {void}
|
|
10948
|
-
*/deleteEntity(pEntityType,pIDRecord,fCallback){let tmpRequestOptions={url:this.formatUrl(`${pEntityType}/${pIDRecord}`)};this.restClient.delJSON(tmpRequestOptions,(pError,pResponse,pBody)=>{if(pError){this.log.error(`Error deleting ${pEntityType} record ID ${pIDRecord}: ${pError.message}`);}else{this.log.info(`Deleted ${pEntityType} record ID ${pIDRecord}`);}return fCallback(pError,pBody);});}}module.exports=PictMeadowEntityProvider;},{"fable":69}],
|
|
11998
|
+
*/deleteEntity(pEntityType,pIDRecord,fCallback){let tmpRequestOptions={url:this.formatUrl(`${pEntityType}/${pIDRecord}`)};this.restClient.delJSON(tmpRequestOptions,(pError,pResponse,pBody)=>{if(pError){this.log.error(`Error deleting ${pEntityType} record ID ${pIDRecord}: ${pError.message}`);}else{this.log.info(`Deleted ${pEntityType} record ID ${pIDRecord}`);}return fCallback(pError,pBody);});}}module.exports=PictMeadowEntityProvider;},{"fable":69}],252:[function(require,module,exports){const libFableServiceBase=require('fable').ServiceProviderBase;class PictTemplateAudit extends libFableServiceBase{/**
|
|
10949
11999
|
* @param {Object} pFable - The Fable Framework instance
|
|
10950
12000
|
* @param {Object} pOptions - The options for the service
|
|
10951
12001
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -11000,7 +12050,7 @@ this.auditLog.push(tmpAuditNode);}let tmpPreviousParent=pState&&pState._Template
|
|
|
11000
12050
|
* Get a summary of the audit log.
|
|
11001
12051
|
*
|
|
11002
12052
|
* @return {object} Summary statistics
|
|
11003
|
-
*/getSummary(){let tmpTotalCalls=0;let tmpTotalDuration=0;let tmpMaxDepth=0;let fWalkNode=(pNode,pDepth)=>{tmpTotalCalls++;tmpTotalDuration+=pNode.Duration||0;if(pDepth>tmpMaxDepth){tmpMaxDepth=pDepth;}for(let i=0;i<pNode.ChildTemplates.length;i++){fWalkNode(pNode.ChildTemplates[i],pDepth+1);}};for(let i=0;i<this.auditLog.length;i++){fWalkNode(this.auditLog[i],0);}return{RootCalls:this.auditLog.length,TotalCalls:tmpTotalCalls,TotalDuration:tmpTotalDuration,MaxDepth:tmpMaxDepth};}}module.exports=PictTemplateAudit;/** @type {Record<string, any>} */PictTemplateAudit.default_configuration={};},{"fable":69}],
|
|
12053
|
+
*/getSummary(){let tmpTotalCalls=0;let tmpTotalDuration=0;let tmpMaxDepth=0;let fWalkNode=(pNode,pDepth)=>{tmpTotalCalls++;tmpTotalDuration+=pNode.Duration||0;if(pDepth>tmpMaxDepth){tmpMaxDepth=pDepth;}for(let i=0;i<pNode.ChildTemplates.length;i++){fWalkNode(pNode.ChildTemplates[i],pDepth+1);}};for(let i=0;i<this.auditLog.length;i++){fWalkNode(this.auditLog[i],0);}return{RootCalls:this.auditLog.length,TotalCalls:tmpTotalCalls,TotalDuration:tmpTotalDuration,MaxDepth:tmpMaxDepth};}}module.exports=PictTemplateAudit;/** @type {Record<string, any>} */PictTemplateAudit.default_configuration={};},{"fable":69}],253:[function(require,module,exports){const libFableServiceBase=require('fable').ServiceProviderBase;class PictTemplateProvider extends libFableServiceBase{/**
|
|
11004
12054
|
* @param {Object} pFable - The Fable Framework instance
|
|
11005
12055
|
* @param {Object} pOptions - The options for the service
|
|
11006
12056
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -11048,7 +12098,7 @@ if(!(pTemplateHash in this.templates)){this.checkDefaultTemplateHash(pTemplateHa
|
|
|
11048
12098
|
* Load a template by hash.
|
|
11049
12099
|
*
|
|
11050
12100
|
* @param {String} pTemplateHash - The hash of the template
|
|
11051
|
-
*/loadTemplate(pTemplateHash){let tmpTemplate=this.loadTemplateFunction(pTemplateHash);if(tmpTemplate){this.templates[pTemplateHash]=tmpTemplate.template;this.templateSources[pTemplateHash]=`Loaded in loadTemplate('${pTemplateHash}') function by PictTemplateProvider [${this.UUID}]::[${this.Hash}] from [${tmpTemplate.source}]`;}return tmpTemplate;}}module.exports=PictTemplateProvider;},{"fable":69}],
|
|
12101
|
+
*/loadTemplate(pTemplateHash){let tmpTemplate=this.loadTemplateFunction(pTemplateHash);if(tmpTemplate){this.templates[pTemplateHash]=tmpTemplate.template;this.templateSources[pTemplateHash]=`Loaded in loadTemplate('${pTemplateHash}') function by PictTemplateProvider [${this.UUID}]::[${this.Hash}] from [${tmpTemplate.source}]`;}return tmpTemplate;}}module.exports=PictTemplateProvider;},{"fable":69}],254:[function(require,module,exports){/**
|
|
11052
12102
|
* @author <steven@velozo.com>
|
|
11053
12103
|
*/const libFableServiceTransactionTracking=require(`./services/Fable-Service-TransactionTracking.js`);/**
|
|
11054
12104
|
* @typedef {{
|
|
@@ -11325,7 +12375,7 @@ let tmpValue="";if(typeof fCallback=="function"){if(Array.isArray(pDataSet)||typ
|
|
|
11325
12375
|
* @return {String?} The parsed template string, or undefined if a callback was provided
|
|
11326
12376
|
*/parseTemplateSetWithPayloadByHash(pTemplateHash,pDataSet,pPayload,fCallback,pContextArray,pScope,pState){let tmpTemplateString=this.TemplateProvider.getTemplate(pTemplateHash);// TODO: Unsure if returning empty is always the right behavior -- if it isn't we will use config to set the behavior
|
|
11327
12377
|
if(!tmpTemplateString){tmpTemplateString="";}return this.parseTemplateSetWithPayload(tmpTemplateString,pDataSet,pPayload,fCallback,pContextArray,pScope,pState);}}module.exports=Pict;module.exports.ServiceProviderBase=require('fable-serviceproviderbase');module.exports.PictApplicationClass=require("pict-application");module.exports.PictViewClass=require("pict-view");module.exports.PictProviderClass=require("pict-provider");module.exports.PictTemplateClass=require("pict-template");module.exports.EnvironmentLog=require("./environments/Pict-Environment-Log.js");module.exports.EnvironmentObject=require("./environments/Pict-Environment-Object.js");module.exports.FilterClauseBase=require('./filters/FilterClauseBase.js');module.exports.FilterClauseLocal=require('./filters/FilterClauseLocal.js');module.exports.FilterClauseInternalJoin=require('./filters/FilterClauseInternalJoin.js');module.exports.FilterClauseExternalJoin=require('./filters/FilterClauseExternalJoin.js');// This is to help understand the type of enivironement we're executing in
|
|
11328
|
-
module.exports.isBrowser=new Function("try {return (this===window);} catch(pError) {return false;}");module.exports.safeOnDocumentReady=require(`./Pict-Browser-SafeOnDocumentReady.js`);module.exports.safeLoadPictApplication=require(`./Pict-Browser-SafeLoad.js`);},{"../package.json":
|
|
12378
|
+
module.exports.isBrowser=new Function("try {return (this===window);} catch(pError) {return false;}");module.exports.safeOnDocumentReady=require(`./Pict-Browser-SafeOnDocumentReady.js`);module.exports.safeLoadPictApplication=require(`./Pict-Browser-SafeLoad.js`);},{"../package.json":245,"./Pict-Browser-SafeLoad.js":246,"./Pict-Browser-SafeOnDocumentReady.js":247,"./Pict-CSS.js":248,"./Pict-Content-Assignment.js":249,"./Pict-DataProvider.js":250,"./Pict-Meadow-EntityProvider.js":251,"./Pict-Template-Audit.js":252,"./Pict-Template-Provider.js":253,"./environments/Pict-Environment-Log.js":255,"./environments/Pict-Environment-Object.js":256,"./filters/FilterClauseBase.js":258,"./filters/FilterClauseExternalJoin.js":259,"./filters/FilterClauseInternalJoin.js":260,"./filters/FilterClauseLocal.js":261,"./providers/Provider-DataBroker.js":262,"./providers/Provider-Filter-Manager.js":263,"./services/Fable-Service-TransactionTracking.js":264,"./templates/Pict-Template-Data.js":265,"./templates/Pict-Template-DataValueByKey.js":266,"./templates/Pict-Template-DataWithAbsoluteFallback.js":267,"./templates/Pict-Template-DataWithTemplateFallback.js":268,"./templates/Pict-Template-Entity.js":269,"./templates/Pict-Template-Self.js":270,"./templates/Pict-Template-Solve.js":271,"./templates/Pict-Template-SolveByReference.js":272,"./templates/Pict-Template-Template.js":273,"./templates/Pict-Template-TemplateByDataAddress.js":274,"./templates/Pict-Template-TemplateByReference.js":275,"./templates/Pict-Template-TemplateByTypes.js":276,"./templates/Pict-Template-TemplateFromAddress.js":277,"./templates/Pict-Template-TemplateFromMap.js":278,"./templates/Pict-Template-TemplateSet.js":279,"./templates/Pict-Template-TemplateSetFromMap.js":280,"./templates/Pict-Template-TemplateSetWithPayload.js":281,"./templates/Pict-Template-TemplateValueSet.js":282,"./templates/Pict-Template-View.js":283,"./templates/data-generation/Pict-Template-RandomNumber.js":284,"./templates/data-generation/Pict-Template-RandomNumberString.js":285,"./templates/data/Pict-Template-DataEncodeJavascriptString.js":286,"./templates/data/Pict-Template-DataJson.js":287,"./templates/data/Pict-Template-DateOnlyFormat.js":288,"./templates/data/Pict-Template-DateOnlyYMD.js":289,"./templates/data/Pict-Template-DateTimeFormat.js":290,"./templates/data/Pict-Template-DateTimeYMD.js":291,"./templates/data/Pict-Template-Digits.js":292,"./templates/data/Pict-Template-Dollars.js":293,"./templates/data/Pict-Template-HtmlCommentEnd.js":294,"./templates/data/Pict-Template-HtmlCommentStart.js":295,"./templates/data/Pict-Template-Join.js":296,"./templates/data/Pict-Template-JoinUnique.js":297,"./templates/data/Pict-Template-PascalCaseIdentifier.js":298,"./templates/data/Pict-Template-PluckJoinUnique.js":299,"./templates/debugging/Pict-Template-Breakpoint.js":300,"./templates/debugging/Pict-Template-DataValueTree.js":301,"./templates/debugging/Pict-Template-LogStatement.js":302,"./templates/debugging/Pict-Template-LogValue.js":303,"./templates/debugging/Pict-Template-LogValueTree.js":304,"./templates/logic/Pict-Template-NotEmpty.js":305,"./templates/logic/Pict-Template-TemplateIf.js":307,"./templates/logic/Pict-Template-TemplateIfAbsolute.js":308,"fable":69,"fable-serviceproviderbase":60,"pict-application":142,"pict-provider":144,"pict-template":242,"pict-view":244}],255:[function(require,module,exports){/**
|
|
11329
12379
|
* Pict browser shim loader
|
|
11330
12380
|
* @author <steven@velozo.com>
|
|
11331
12381
|
*
|
|
@@ -11393,7 +12443,7 @@ return this.contentMap[pAddress];}this.pict.log.warn(`Mock read from Address ${p
|
|
|
11393
12443
|
*
|
|
11394
12444
|
* @param {string} pAddress - The address of the element.
|
|
11395
12445
|
* @param {string} pAttribute - The attribute to set.
|
|
11396
|
-
*/customSetAttributeFunction(pAddress,pAttribute,pContent){if(pContent.length>this.truncateContentLength){this.pict.log.info(`Mocking an SET ATTRIBUTE to Address -> [${pAddress}] (log truncated to first ${this.truncateContentLength} characters)`,{Attribute:pAttribute,Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info(`Mocking an SET ATTRIBUTE to Address -> [${pAddress}]`,{Attribute:pAttribute,Content:pContent});}return'';}}module.exports=PictEnvironmentLog;},{}],
|
|
12446
|
+
*/customSetAttributeFunction(pAddress,pAttribute,pContent){if(pContent.length>this.truncateContentLength){this.pict.log.info(`Mocking an SET ATTRIBUTE to Address -> [${pAddress}] (log truncated to first ${this.truncateContentLength} characters)`,{Attribute:pAttribute,Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info(`Mocking an SET ATTRIBUTE to Address -> [${pAddress}]`,{Attribute:pAttribute,Content:pContent});}return'';}}module.exports=PictEnvironmentLog;},{}],256:[function(require,module,exports){/**
|
|
11397
12447
|
* Pict browser shim loader with Object statefulness for the environement
|
|
11398
12448
|
* @author <steven@velozo.com>
|
|
11399
12449
|
*
|
|
@@ -11423,7 +12473,7 @@ return this.contentMap[pAddress];}this.pict.log.warn(`Mock read from Address ${p
|
|
|
11423
12473
|
*/constructor(pPict,pContentMap){this.contentMap=typeof pContentMap=='object'?pContentMap:{};this.contentMap._ATTRIBUTE_MAP={};this.contentMap._CLASS_MAP={};this.pict=pPict;// If this is set to false, we won't keep an array-based log of every read, assignment, append or get.
|
|
11424
12474
|
this.truncateContentLength=256;this.storeEventLog=true;// Where to store each event type
|
|
11425
12475
|
this.eventLog={};this.eventLog.GetElement=[];this.eventLog.Read=[];this.eventLog.Prepend=[];this.eventLog.Append=[];this.eventLog.Assign=[];this.eventLog.ReadAttribute=[];this.eventLog.SetAttribute=[];this.eventLog.RemoveAttribute=[];this.eventLog.ReadClass=[];this.eventLog.SetClass=[];this.eventLog.RemoveClass=[];this.pict.ContentAssignment.customGetElementFunction=this.customGetElementFunction.bind(this);this.pict.ContentAssignment.customReadFunction=this.customReadFunction.bind(this);this.pict.ContentAssignment.customAppendFunction=this.customAppendFunction.bind(this);this.pict.ContentAssignment.customPrependFunction=this.customPrependFunction.bind(this);this.pict.ContentAssignment.customAssignFunction=this.customAssignFunction.bind(this);this.pict.ContentAssignment.customReadAttributeFunction=this.customReadAttributeFunction.bind(this);this.pict.ContentAssignment.customSetAttributeFunction=this.customSetAttributeFunction.bind(this);this.pict.ContentAssignment.customRemoveAttributeFunction=this.customRemoveAttributeFunction.bind(this);this.pict.ContentAssignment.customReadClassFunction=this.customReadClassFunction.bind(this);this.pict.ContentAssignment.customSetClassFunction=this.customSetClassFunction.bind(this);this.pict.ContentAssignment.customRemoveClassFunction=this.customRemoveClassFunction.bind(this);}createEventLogEntry(pAddress,pContent){let tmpContent=typeof pContent=='undefined'?'':pContent;return{TimeStamp:this.pict.log.getTimeStamp(),Hash:pAddress,Content:tmpContent};}customGetElementFunction(pAddress){if(this.storeEventLog){this.eventLog.GetElement.push(this.createEventLogEntry(pAddress));}this.pict.log.info(`Mocking an GET of Address -> [${pAddress}]`);return'';}customReadFunction(pAddress){if(this.storeEventLog){this.eventLog.Read.push(this.createEventLogEntry(pAddress));}this.pict.log.info(`Mocking an READ from Address -> [${pAddress}]`);if(pAddress in this.contentMap){// The data is in the content map!
|
|
11426
|
-
return this.contentMap[pAddress];}this.pict.log.warn(`Mock read from Address ${pAddress} did not find a value in the content map.`);return'';}customAppendFunction(pAddress,pContent){this.contentMap[pAddress]=typeof this.contentMap[pAddress]=='undefined'?pContent:this.contentMap[pAddress]+pContent;if(this.storeEventLog){this.eventLog.Append.push(this.createEventLogEntry(pAddress,pContent));}if(pContent.length>this.truncateContentLength){this.pict.log.info(`Mocking an APPEND to Address -> [${pAddress}] (log truncated to first ${this.truncateContentLength} characters)`,{Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info(`Mocking an APPEND to Address -> [${pAddress}]`,{Content:pContent});}return'';}customPrependFunction(pAddress,pContent){this.contentMap[pAddress]=typeof this.contentMap[pAddress]=='undefined'?pContent:pContent+this.contentMap[pAddress];if(this.storeEventLog){this.eventLog.Prepend.push(this.createEventLogEntry(pAddress,pContent));}if(pContent.length>this.truncateContentLength){this.pict.log.info(`Mocking an PREPEND to Address -> [${pAddress}] (log truncated to first ${this.truncateContentLength} characters)`,{Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info(`Mocking an PREPEND to Address -> [${pAddress}]`,{Content:pContent});}return'';}customAssignFunction(pAddress,pContent){this.contentMap[pAddress]=pContent;if(this.storeEventLog){this.eventLog.Prepend.push(this.createEventLogEntry(pAddress,pContent));}if(pContent.length>this.truncateContentLength){this.pict.log.info(`Mocking an ASSIGN to Address -> [${pAddress}] (log truncated to first ${this.truncateContentLength} characters)`,{Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info(`Mocking an ASSIGN to Address -> [${pAddress}]`,{Content:pContent});}return'';}initializeAttributeMapLocation(pAddress,pAttribute){if(!(pAddress in this.contentMap._ATTRIBUTE_MAP)){this.contentMap._ATTRIBUTE_MAP[pAddress]={};}if(!(pAttribute in this.contentMap._ATTRIBUTE_MAP[pAddress])){this.contentMap._ATTRIBUTE_MAP[pAddress][pAttribute]=false;}}initializeClassMapLocation(pAddress){if(!(pAddress in this.contentMap._CLASS_MAP)){this.contentMap._CLASS_MAP[pAddress]=[];}}customReadAttributeFunction(pAddress,pAttribute){this.initializeAttributeMapLocation(pAddress,pAttribute);let tmpContent=this.contentMap._ATTRIBUTE_MAP[pAddress][pAttribute];if(this.storeEventLog){this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pAttribute));}if(tmpContent.length>this.truncateContentLength){this.pict.log.info(`Mocking an ATTRIBUTE READ for Address -> [${pAddress}] (log truncated to first ${this.truncateContentLength} characters)`,{Content:tmpContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info(`Mocking an ATTRIBUTE READ for Address -> [${pAddress}]::[${pAttribute}]`,{Content:tmpContent});}return tmpContent;}customSetAttributeFunction(pAddress,pAttribute,pValue){this.initializeAttributeMapLocation(pAddress,pAttribute);this.contentMap._ATTRIBUTE_MAP[pAddress][pAttribute]=pValue;if(this.storeEventLog){this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pAttribute));}if(pValue.length>this.truncateContentLength){this.pict.log.info(`Mocking an ATTRIBUTE SET for Address -> [${pAddress}] (log truncated to first ${this.truncateContentLength} characters)`,{Content:pValue.substring(0,this.truncateContentLength)});}else{this.pict.log.info(`Mocking an ATTRIBUTE SET for Address -> [${pAddress}]::[${pAttribute}]`,{Content:pValue});}return pValue;}customRemoveAttributeFunction(pAddress,pAttribute){this.initializeAttributeMapLocation(pAddress,pAttribute);let tmpContent=this.contentMap._ATTRIBUTE_MAP[pAddress][pAttribute];if(this.storeEventLog){this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pAttribute));}if(tmpContent.length>this.truncateContentLength){this.pict.log.info(`Mocking an ATTRIBUTE REMOVE for Address -> [${pAddress}] (log truncated to first ${this.truncateContentLength} characters)`,{Content:tmpContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info(`Mocking an ATTRIBUTE REMOVE for Address -> [${pAddress}]::[${pAttribute}]`,{Content:tmpContent});}delete this.contentMap._ATTRIBUTE_MAP[pAddress][pAttribute];return true;}customReadClassFunction(pAddress,pClass){this.initializeClassMapLocation(pAddress);const tmpContent=this.contentMap._CLASS_MAP[pAddress].indexOf(pClass)>-1;if(this.storeEventLog){this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pClass));}this.pict.log.info(`Mocking an CLASS READ for Address -> [${pAddress}]::[${pClass}]`,{Content:tmpContent});return tmpContent;}customSetClassFunction(pAddress,pClass){this.initializeClassMapLocation(pAddress);let tmpContent=this.contentMap._CLASS_MAP[pAddress];if(this.contentMap._CLASS_MAP[pAddress].indexOf(pClass)==-1){this.contentMap._CLASS_MAP[pAddress].push(pClass);}if(this.storeEventLog){this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pClass));}this.pict.log.info(`Mocking an CLASS SET for Address -> [${pAddress}]::[${pClass}]`,{Content:tmpContent.join(' ')});return tmpContent;}customRemoveClassFunction(pAddress,pClass){this.initializeClassMapLocation(pAddress);let tmpContent=this.contentMap._CLASS_MAP[pAddress];this.contentMap._CLASS_MAP[pAddress].splice(pClass);if(this.storeEventLog){this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pClass));}this.pict.log.info(`Mocking an CLASS REMOVE for Address -> [${pAddress}]::[${pClass}]`,{Content:tmpContent.join(' ')});return tmpContent;}}module.exports=PictEnvironmentObject;},{}],
|
|
12476
|
+
return this.contentMap[pAddress];}this.pict.log.warn(`Mock read from Address ${pAddress} did not find a value in the content map.`);return'';}customAppendFunction(pAddress,pContent){this.contentMap[pAddress]=typeof this.contentMap[pAddress]=='undefined'?pContent:this.contentMap[pAddress]+pContent;if(this.storeEventLog){this.eventLog.Append.push(this.createEventLogEntry(pAddress,pContent));}if(pContent.length>this.truncateContentLength){this.pict.log.info(`Mocking an APPEND to Address -> [${pAddress}] (log truncated to first ${this.truncateContentLength} characters)`,{Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info(`Mocking an APPEND to Address -> [${pAddress}]`,{Content:pContent});}return'';}customPrependFunction(pAddress,pContent){this.contentMap[pAddress]=typeof this.contentMap[pAddress]=='undefined'?pContent:pContent+this.contentMap[pAddress];if(this.storeEventLog){this.eventLog.Prepend.push(this.createEventLogEntry(pAddress,pContent));}if(pContent.length>this.truncateContentLength){this.pict.log.info(`Mocking an PREPEND to Address -> [${pAddress}] (log truncated to first ${this.truncateContentLength} characters)`,{Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info(`Mocking an PREPEND to Address -> [${pAddress}]`,{Content:pContent});}return'';}customAssignFunction(pAddress,pContent){this.contentMap[pAddress]=pContent;if(this.storeEventLog){this.eventLog.Prepend.push(this.createEventLogEntry(pAddress,pContent));}if(pContent.length>this.truncateContentLength){this.pict.log.info(`Mocking an ASSIGN to Address -> [${pAddress}] (log truncated to first ${this.truncateContentLength} characters)`,{Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info(`Mocking an ASSIGN to Address -> [${pAddress}]`,{Content:pContent});}return'';}initializeAttributeMapLocation(pAddress,pAttribute){if(!(pAddress in this.contentMap._ATTRIBUTE_MAP)){this.contentMap._ATTRIBUTE_MAP[pAddress]={};}if(!(pAttribute in this.contentMap._ATTRIBUTE_MAP[pAddress])){this.contentMap._ATTRIBUTE_MAP[pAddress][pAttribute]=false;}}initializeClassMapLocation(pAddress){if(!(pAddress in this.contentMap._CLASS_MAP)){this.contentMap._CLASS_MAP[pAddress]=[];}}customReadAttributeFunction(pAddress,pAttribute){this.initializeAttributeMapLocation(pAddress,pAttribute);let tmpContent=this.contentMap._ATTRIBUTE_MAP[pAddress][pAttribute];if(this.storeEventLog){this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pAttribute));}if(tmpContent.length>this.truncateContentLength){this.pict.log.info(`Mocking an ATTRIBUTE READ for Address -> [${pAddress}] (log truncated to first ${this.truncateContentLength} characters)`,{Content:tmpContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info(`Mocking an ATTRIBUTE READ for Address -> [${pAddress}]::[${pAttribute}]`,{Content:tmpContent});}return tmpContent;}customSetAttributeFunction(pAddress,pAttribute,pValue){this.initializeAttributeMapLocation(pAddress,pAttribute);this.contentMap._ATTRIBUTE_MAP[pAddress][pAttribute]=pValue;if(this.storeEventLog){this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pAttribute));}if(pValue.length>this.truncateContentLength){this.pict.log.info(`Mocking an ATTRIBUTE SET for Address -> [${pAddress}] (log truncated to first ${this.truncateContentLength} characters)`,{Content:pValue.substring(0,this.truncateContentLength)});}else{this.pict.log.info(`Mocking an ATTRIBUTE SET for Address -> [${pAddress}]::[${pAttribute}]`,{Content:pValue});}return pValue;}customRemoveAttributeFunction(pAddress,pAttribute){this.initializeAttributeMapLocation(pAddress,pAttribute);let tmpContent=this.contentMap._ATTRIBUTE_MAP[pAddress][pAttribute];if(this.storeEventLog){this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pAttribute));}if(tmpContent.length>this.truncateContentLength){this.pict.log.info(`Mocking an ATTRIBUTE REMOVE for Address -> [${pAddress}] (log truncated to first ${this.truncateContentLength} characters)`,{Content:tmpContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info(`Mocking an ATTRIBUTE REMOVE for Address -> [${pAddress}]::[${pAttribute}]`,{Content:tmpContent});}delete this.contentMap._ATTRIBUTE_MAP[pAddress][pAttribute];return true;}customReadClassFunction(pAddress,pClass){this.initializeClassMapLocation(pAddress);const tmpContent=this.contentMap._CLASS_MAP[pAddress].indexOf(pClass)>-1;if(this.storeEventLog){this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pClass));}this.pict.log.info(`Mocking an CLASS READ for Address -> [${pAddress}]::[${pClass}]`,{Content:tmpContent});return tmpContent;}customSetClassFunction(pAddress,pClass){this.initializeClassMapLocation(pAddress);let tmpContent=this.contentMap._CLASS_MAP[pAddress];if(this.contentMap._CLASS_MAP[pAddress].indexOf(pClass)==-1){this.contentMap._CLASS_MAP[pAddress].push(pClass);}if(this.storeEventLog){this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pClass));}this.pict.log.info(`Mocking an CLASS SET for Address -> [${pAddress}]::[${pClass}]`,{Content:tmpContent.join(' ')});return tmpContent;}customRemoveClassFunction(pAddress,pClass){this.initializeClassMapLocation(pAddress);let tmpContent=this.contentMap._CLASS_MAP[pAddress];this.contentMap._CLASS_MAP[pAddress].splice(pClass);if(this.storeEventLog){this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pClass));}this.pict.log.info(`Mocking an CLASS REMOVE for Address -> [${pAddress}]::[${pClass}]`,{Content:tmpContent.join(' ')});return tmpContent;}}module.exports=PictEnvironmentObject;},{}],257:[function(require,module,exports){/**
|
|
11427
12477
|
* @typedef {{
|
|
11428
12478
|
* ValueTemplate?: string,
|
|
11429
12479
|
* Value?: string,
|
|
@@ -11524,7 +12574,7 @@ if(!pFilterState.Filter){pFilterState.Filter=`${pFilterState.Entity||'Unknown'}-
|
|
|
11524
12574
|
*
|
|
11525
12575
|
* @return {Array<string>}
|
|
11526
12576
|
*/_extractSortsFromFilter(pFilter){if(!pFilter||typeof pFilter!=='string'){return[pFilter,''];}let tmpSortStanzas=[];let tmpMicroStanzas=pFilter.split('~');for(let i=0;i<tmpMicroStanzas.length;i+=4){if(tmpMicroStanzas[i]==='FSF'){tmpSortStanzas.push(tmpMicroStanzas.slice(i,i+4).join('~'));tmpMicroStanzas=tmpMicroStanzas.slice(0,i).concat(tmpMicroStanzas.slice(i+4));i-=4;// adjust for removed elements
|
|
11527
|
-
}}return[tmpMicroStanzas.join('~'),tmpSortStanzas.join('~')];}_compileSimpleFilterToString(pFilter){let tmpFilterString=`${pFilter.Instruction}`;tmpFilterString+=`~${pFilter.Field}`;tmpFilterString+=`~${pFilter.Operator}`;if(pFilter.ValueTemplate){tmpFilterString+=`~${pFilter.ValueTemplate}`;}else{tmpFilterString+=`~${pFilter.Value||''}`;}if(pFilter.OpenParen){tmpFilterString=`${pFilter.OpenParenOr?'FOPOR':'FOP'}~0~(~0~${tmpFilterString}`;}if(pFilter.CloseParen){tmpFilterString=`${tmpFilterString}~FCP~0~)~0`;}return tmpFilterString;}}module.exports=FilterMeadowStanzaTokenGenerator;},{}],
|
|
12577
|
+
}}return[tmpMicroStanzas.join('~'),tmpSortStanzas.join('~')];}_compileSimpleFilterToString(pFilter){let tmpFilterString=`${pFilter.Instruction}`;tmpFilterString+=`~${pFilter.Field}`;tmpFilterString+=`~${pFilter.Operator}`;if(pFilter.ValueTemplate){tmpFilterString+=`~${pFilter.ValueTemplate}`;}else{tmpFilterString+=`~${pFilter.Value||''}`;}if(pFilter.OpenParen){tmpFilterString=`${pFilter.OpenParenOr?'FOPOR':'FOP'}~0~(~0~${tmpFilterString}`;}if(pFilter.CloseParen){tmpFilterString=`${tmpFilterString}~FCP~0~)~0`;}return tmpFilterString;}}module.exports=FilterMeadowStanzaTokenGenerator;},{}],258:[function(require,module,exports){/**
|
|
11528
12578
|
* @typedef {{
|
|
11529
12579
|
* Type: 'None'
|
|
11530
12580
|
* } | {
|
|
@@ -11621,25 +12671,25 @@ if(!pFilterState.Filter){pFilterState.Filter=`${pFilterState.Entity||'Unknown'}-
|
|
|
11621
12671
|
* @return {import('./Filter.js').FilterType}
|
|
11622
12672
|
*/get type(){return this._type;}/**
|
|
11623
12673
|
* @return {FilterClauseConfig}
|
|
11624
|
-
*/generateFilterClauseConfig(){return{Type:'None'};}}module.exports=FilterClauseBase;},{}],
|
|
12674
|
+
*/generateFilterClauseConfig(){return{Type:'None'};}}module.exports=FilterClauseBase;},{}],259:[function(require,module,exports){const libFilterClauseBase=require('./FilterClauseBase.js');/**
|
|
11625
12675
|
* Manage filter state for a filter that works on a one level of indirect direct join.
|
|
11626
12676
|
*/class FilterClauseExternalJoin extends libFilterClauseBase{/**
|
|
11627
12677
|
* @param {import('../Pict.js')} pFable
|
|
11628
12678
|
*/constructor(pFable){super(pFable);/** @type {import('./Filter.js').FilterType} */this.type='ExternalJoinMatch';/** @type {string[] | number[] | { Start?: string | number, End?: string | number }} */this.values=[];/** @type {boolean?} */this.exactMatch;/** @type {boolean?} */this.startExclusive;/** @type {boolean?} */this.endExclusive;/** @type {string?} */this.externalFilterByColumn;/** @type {string[]?} */this.externalFilterByColumns;/** @type {string} */this.coreConnectionColumn='';/** @type {string} */this.joinTable='';/** @type {string} */this.joinTableExternalConnectionColumn='';/** @type {string} */this.joinTableCoreConnectionColumn='';/** @type {string} */this.externalFilterByTable='';/** @type {string} */this.externalFilterTableLookupColumn='';/** @type {string} */this.externalFilterByTableConnectionColumn='';/** @type {string} */this.polyJoinRemoteType='';/** @type {string} */this.polyJoinRemoteColumn='';}/**
|
|
11629
12679
|
* @return {import('./FilterClauseBase.js').FilterClauseConfig}
|
|
11630
|
-
*/generateFilterClauseConfig(){switch(this.type){case'ExternalJoinMatch':case'ExternalJoinStringMatch':case'ExternalJoinDateMatch':case'ExternalJoinNumericMatch':return{Type:this.type,Values:Array.isArray(this.values)?this.values:[],ExactMatch:this.exactMatch,ExternalFilterByColumn:this.externalFilterByColumn,ExternalFilterByColumns:this.externalFilterByColumns,CoreConnectionColumn:this.coreConnectionColumn,JoinTable:this.joinTable,JoinTableExternalConnectionColumn:this.joinTableExternalConnectionColumn,JoinTableCoreConnectionColumn:this.joinTableCoreConnectionColumn,ExternalFilterByTable:this.externalFilterByTable,ExternalFilterByTableConnectionColumn:this.externalFilterByTableConnectionColumn,PolyJoinRemoteType:this.polyJoinRemoteType,PolyJoinRemoteColumn:this.polyJoinRemoteColumn};case'ExternalJoinRange':case'ExternalJoinStringRange':case'ExternalJoinDateRange':case'ExternalJoinNumericRange':return{Type:this.type,Values:Array.isArray(this.values)?{Start:undefined,End:undefined}:Object.assign({},this.values),StartExclusive:this.startExclusive,EndExclusive:this.endExclusive,ExternalFilterByColumn:this.externalFilterByColumn,ExternalFilterByColumns:this.externalFilterByColumns,CoreConnectionColumn:this.coreConnectionColumn,JoinTable:this.joinTable,JoinTableExternalConnectionColumn:this.joinTableExternalConnectionColumn,JoinTableCoreConnectionColumn:this.joinTableCoreConnectionColumn,ExternalFilterByTable:this.externalFilterByTable,ExternalFilterByTableConnectionColumn:this.externalFilterByTableConnectionColumn,PolyJoinRemoteType:this.polyJoinRemoteType,PolyJoinRemoteColumn:this.polyJoinRemoteColumn};case'ExternalJoinSelectedValue':case'ExternalJoinSelectedValueList':return{Type:this.type,Values:Array.isArray(this.values)?{Start:undefined,End:undefined}:Object.assign({},this.values),StartExclusive:this.startExclusive,EndExclusive:this.endExclusive,ExternalFilterByColumn:this.externalFilterByColumn,ExternalFilterByColumns:this.externalFilterByColumns,CoreConnectionColumn:this.coreConnectionColumn,JoinTable:this.joinTable,JoinTableExternalConnectionColumn:this.joinTableExternalConnectionColumn,JoinTableCoreConnectionColumn:this.joinTableCoreConnectionColumn,ExternalFilterByTable:this.externalFilterByTable,ExternalFilterTableLookupColumn:this.externalFilterTableLookupColumn,ExternalFilterByTableConnectionColumn:this.externalFilterByTableConnectionColumn,PolyJoinRemoteType:this.polyJoinRemoteType,PolyJoinRemoteColumn:this.polyJoinRemoteColumn};default:throw new Error(`Unsupported filter type: ${this.type}`);}}}module.exports=FilterClauseExternalJoin;},{"./FilterClauseBase.js":
|
|
12680
|
+
*/generateFilterClauseConfig(){switch(this.type){case'ExternalJoinMatch':case'ExternalJoinStringMatch':case'ExternalJoinDateMatch':case'ExternalJoinNumericMatch':return{Type:this.type,Values:Array.isArray(this.values)?this.values:[],ExactMatch:this.exactMatch,ExternalFilterByColumn:this.externalFilterByColumn,ExternalFilterByColumns:this.externalFilterByColumns,CoreConnectionColumn:this.coreConnectionColumn,JoinTable:this.joinTable,JoinTableExternalConnectionColumn:this.joinTableExternalConnectionColumn,JoinTableCoreConnectionColumn:this.joinTableCoreConnectionColumn,ExternalFilterByTable:this.externalFilterByTable,ExternalFilterByTableConnectionColumn:this.externalFilterByTableConnectionColumn,PolyJoinRemoteType:this.polyJoinRemoteType,PolyJoinRemoteColumn:this.polyJoinRemoteColumn};case'ExternalJoinRange':case'ExternalJoinStringRange':case'ExternalJoinDateRange':case'ExternalJoinNumericRange':return{Type:this.type,Values:Array.isArray(this.values)?{Start:undefined,End:undefined}:Object.assign({},this.values),StartExclusive:this.startExclusive,EndExclusive:this.endExclusive,ExternalFilterByColumn:this.externalFilterByColumn,ExternalFilterByColumns:this.externalFilterByColumns,CoreConnectionColumn:this.coreConnectionColumn,JoinTable:this.joinTable,JoinTableExternalConnectionColumn:this.joinTableExternalConnectionColumn,JoinTableCoreConnectionColumn:this.joinTableCoreConnectionColumn,ExternalFilterByTable:this.externalFilterByTable,ExternalFilterByTableConnectionColumn:this.externalFilterByTableConnectionColumn,PolyJoinRemoteType:this.polyJoinRemoteType,PolyJoinRemoteColumn:this.polyJoinRemoteColumn};case'ExternalJoinSelectedValue':case'ExternalJoinSelectedValueList':return{Type:this.type,Values:Array.isArray(this.values)?{Start:undefined,End:undefined}:Object.assign({},this.values),StartExclusive:this.startExclusive,EndExclusive:this.endExclusive,ExternalFilterByColumn:this.externalFilterByColumn,ExternalFilterByColumns:this.externalFilterByColumns,CoreConnectionColumn:this.coreConnectionColumn,JoinTable:this.joinTable,JoinTableExternalConnectionColumn:this.joinTableExternalConnectionColumn,JoinTableCoreConnectionColumn:this.joinTableCoreConnectionColumn,ExternalFilterByTable:this.externalFilterByTable,ExternalFilterTableLookupColumn:this.externalFilterTableLookupColumn,ExternalFilterByTableConnectionColumn:this.externalFilterByTableConnectionColumn,PolyJoinRemoteType:this.polyJoinRemoteType,PolyJoinRemoteColumn:this.polyJoinRemoteColumn};default:throw new Error(`Unsupported filter type: ${this.type}`);}}}module.exports=FilterClauseExternalJoin;},{"./FilterClauseBase.js":258}],260:[function(require,module,exports){const libFilterClauseBase=require('./FilterClauseBase.js');/**
|
|
11631
12681
|
* Manage filter state for a filter that works on a one level of indirect direct join.
|
|
11632
12682
|
*/class FilterClauseInternalJoin extends libFilterClauseBase{/**
|
|
11633
12683
|
* @param {import('../Pict.js')} pFable
|
|
11634
12684
|
*/constructor(pFable){super(pFable);/** @type {import('./Filter.js').FilterType} */this.type='None';/** @type {string[] | number[] | { Start?: string | number, End?: string | number }} */this.values=[];/** @type {boolean?} */this.exactMatch;/** @type {boolean?} */this.startExclusive;/** @type {boolean?} */this.endExclusive;/** @type {string} */this.remoteTable='';/** @type {string?} */this.externalFilterByColumn;/** @type {string[]?} */this.externalFilterByColumns;/** @type {string?} */this.externalFilterTableLookupColumn;/** @type {string} */this.joinExternalConnectionColumn='';/** @type {string} */this.joinInternalConnectionColumn='';}/**
|
|
11635
12685
|
* @return {import('./FilterClauseBase.js').FilterClauseConfig}
|
|
11636
|
-
*/generateFilterClauseConfig(){switch(this._type){case'InternalJoinMatch':case'InternalJoinStringMatch':case'InternalJoinDateMatch':case'InternalJoinNumericMatch':return{Type:this._type,Values:Array.isArray(this.values)?this.values:[],ExactMatch:this.exactMatch,RemoteTable:this.remoteTable,ExternalFilterByColumn:this.externalFilterByColumn,ExternalFilterByColumns:this.externalFilterByColumns,JoinExternalConnectionColumn:this.joinExternalConnectionColumn,JoinInternalConnectionColumn:this.joinInternalConnectionColumn};case'InternalJoinSelectedValue':case'InternalJoinSelectedValueList':return{Type:this._type,Values:Array.isArray(this.values)?this.values:[],ExactMatch:this.exactMatch,RemoteTable:this.remoteTable,ExternalFilterByColumn:this.externalFilterByColumn,ExternalFilterByColumns:this.externalFilterByColumns,ExternalFilterTableLookupColumn:this.externalFilterTableLookupColumn,JoinExternalConnectionColumn:this.joinExternalConnectionColumn,JoinInternalConnectionColumn:this.joinInternalConnectionColumn};case'InternalJoinRange':case'InternalJoinStringRange':case'InternalJoinDateRange':case'InternalJoinNumericRange':return{Type:this._type,Values:Array.isArray(this.values)?{Start:undefined,End:undefined}:Object.assign({},this.values),StartExclusive:this.startExclusive,EndExclusive:this.endExclusive,RemoteTable:this.remoteTable,ExternalFilterByColumn:this.externalFilterByColumn,ExternalFilterByColumns:this.externalFilterByColumns,JoinExternalConnectionColumn:this.joinExternalConnectionColumn,JoinInternalConnectionColumn:this.joinInternalConnectionColumn};default:throw new Error(`Unsupported filter type: ${this.type}`);}}}module.exports=FilterClauseInternalJoin;},{"./FilterClauseBase.js":
|
|
12686
|
+
*/generateFilterClauseConfig(){switch(this._type){case'InternalJoinMatch':case'InternalJoinStringMatch':case'InternalJoinDateMatch':case'InternalJoinNumericMatch':return{Type:this._type,Values:Array.isArray(this.values)?this.values:[],ExactMatch:this.exactMatch,RemoteTable:this.remoteTable,ExternalFilterByColumn:this.externalFilterByColumn,ExternalFilterByColumns:this.externalFilterByColumns,JoinExternalConnectionColumn:this.joinExternalConnectionColumn,JoinInternalConnectionColumn:this.joinInternalConnectionColumn};case'InternalJoinSelectedValue':case'InternalJoinSelectedValueList':return{Type:this._type,Values:Array.isArray(this.values)?this.values:[],ExactMatch:this.exactMatch,RemoteTable:this.remoteTable,ExternalFilterByColumn:this.externalFilterByColumn,ExternalFilterByColumns:this.externalFilterByColumns,ExternalFilterTableLookupColumn:this.externalFilterTableLookupColumn,JoinExternalConnectionColumn:this.joinExternalConnectionColumn,JoinInternalConnectionColumn:this.joinInternalConnectionColumn};case'InternalJoinRange':case'InternalJoinStringRange':case'InternalJoinDateRange':case'InternalJoinNumericRange':return{Type:this._type,Values:Array.isArray(this.values)?{Start:undefined,End:undefined}:Object.assign({},this.values),StartExclusive:this.startExclusive,EndExclusive:this.endExclusive,RemoteTable:this.remoteTable,ExternalFilterByColumn:this.externalFilterByColumn,ExternalFilterByColumns:this.externalFilterByColumns,JoinExternalConnectionColumn:this.joinExternalConnectionColumn,JoinInternalConnectionColumn:this.joinInternalConnectionColumn};default:throw new Error(`Unsupported filter type: ${this.type}`);}}}module.exports=FilterClauseInternalJoin;},{"./FilterClauseBase.js":258}],261:[function(require,module,exports){const libFilterClauseBase=require('./FilterClauseBase.js');/**
|
|
11637
12687
|
* Manage filter state for a filter that only works on fields local to the table.
|
|
11638
12688
|
*/class FilterClauseLocal extends libFilterClauseBase{/**
|
|
11639
12689
|
* @param {import('../Pict.js')} pFable
|
|
11640
12690
|
*/constructor(pFable){super(pFable);/** @type {import('./Filter.js').FilterType} */this._type='Match';/** @type {string} */this.filterByColumn;/** @type {boolean?} */this.exactMatch;/** @type {boolean?} */this.startExclusive;/** @type {boolean?} */this.endExclusive;}/**
|
|
11641
12691
|
* @return {import('./FilterClauseBase.js').FilterClauseConfig}
|
|
11642
|
-
*/generateFilterClauseConfig(){switch(this._type){case'Match':case'StringMatch':case'DateMatch':case'NumericMatch':return{Type:this._type,Values:Array.isArray(this.values)?this.values:[],ExactMatch:this.exactMatch,FilterByColumn:this.filterByColumn};case'Range':case'StringRange':case'DateRange':case'NumericRange':return{Type:this._type,Values:Array.isArray(this.values)?{Start:undefined,End:undefined}:Object.assign({},this.values),StartExclusive:this.startExclusive,EndExclusive:this.endExclusive,FilterByColumn:this.filterByColumn};default:throw new Error(`Unsupported filter type: ${this.type}`);}}}module.exports=FilterClauseLocal;},{"./FilterClauseBase.js":
|
|
12692
|
+
*/generateFilterClauseConfig(){switch(this._type){case'Match':case'StringMatch':case'DateMatch':case'NumericMatch':return{Type:this._type,Values:Array.isArray(this.values)?this.values:[],ExactMatch:this.exactMatch,FilterByColumn:this.filterByColumn};case'Range':case'StringRange':case'DateRange':case'NumericRange':return{Type:this._type,Values:Array.isArray(this.values)?{Start:undefined,End:undefined}:Object.assign({},this.values),StartExclusive:this.startExclusive,EndExclusive:this.endExclusive,FilterByColumn:this.filterByColumn};default:throw new Error(`Unsupported filter type: ${this.type}`);}}}module.exports=FilterClauseLocal;},{"./FilterClauseBase.js":258}],262:[function(require,module,exports){const libPictProvider=require('pict-provider');/** @type {Record<string, any>} */const _DEFAULT_PROVIDER_CONFIGURATION={ProviderIdentifier:'Pict-Provider-DataBroker',AutoInitialize:true,AutoInitializeOrdinal:0};class PictDataBrokerProvider extends libPictProvider{constructor(pFable,pOptions,pServiceHash){let tmpOptions=Object.assign({},_DEFAULT_PROVIDER_CONFIGURATION,pOptions);super(pFable,tmpOptions,pServiceHash);/** @type {Record<string, any>} */this.options;/** @type {import('../Pict.js')} */this.pict;this.marshalDestination='AppData';}/**
|
|
11643
12693
|
* @param {string} pHash - The hash of the value to retrieve.
|
|
11644
12694
|
*/getValue(pHash){return this.getValueByHash(pHash);}/**
|
|
11645
12695
|
* @param {string} pHash - The hash of the value to retrieve.
|
|
@@ -11658,7 +12708,7 @@ if(!pFilterState.Filter){pFilterState.Filter=`${pFilterState.Entity||'Unknown'}-
|
|
|
11658
12708
|
*/get marshalDestinationObject(){const tmpMarshalDestinationAddress=this.marshalDestination;if(!tmpMarshalDestinationAddress){throw new Error(`Attempt to access marshal destination object with no marshal destination set.`);}//TODO: figure out a clean way to cache this object that sanely invalidates if the destination changes
|
|
11659
12709
|
let tmpMarshalDestinationObject=this.pict.resolveStateFromAddress(tmpMarshalDestinationAddress);if(!tmpMarshalDestinationObject){this.log.error(`Data Broker bootstrapping missing object at marshal destination address: ${tmpMarshalDestinationAddress}`);this.pict.setStateValueAtAddress(tmpMarshalDestinationAddress,null,{});tmpMarshalDestinationObject=this.pict.resolveStateFromAddress(tmpMarshalDestinationAddress);if(!tmpMarshalDestinationObject){throw new Error(`Attempt to access marshal destination object with no marshal destination set.`);}}return tmpMarshalDestinationObject;}getMarshalDestinationObject(){return this.marshalDestinationObject;}/**
|
|
11660
12710
|
* @param {string} [pOverrideMarshalDestination] - Optional override for the marshal destination address.
|
|
11661
|
-
*/resolveMarshalDestinationObject(pOverrideMarshalDestination){const tmpMarshalDestinationAddress=pOverrideMarshalDestination||this.marshalDestination;if(!tmpMarshalDestinationAddress){throw new Error(`Attempt to resolve marshal destination object with no marshal destination set.`);}let tmpMarshalDestinationObject;if(pOverrideMarshalDestination){tmpMarshalDestinationObject=this.pict.resolveStateFromAddress(pOverrideMarshalDestination);if(!tmpMarshalDestinationObject){this.log.error(`Data Broker bootstrapping missing object at marshal destination address: ${tmpMarshalDestinationAddress}`);this.pict.setStateValueAtAddress(tmpMarshalDestinationAddress,null,{});}}else{tmpMarshalDestinationObject=this.getMarshalDestinationObject();}return tmpMarshalDestinationObject;}}module.exports=PictDataBrokerProvider;module.exports.default_configuration=_DEFAULT_PROVIDER_CONFIGURATION;},{"pict-provider":144}],
|
|
12711
|
+
*/resolveMarshalDestinationObject(pOverrideMarshalDestination){const tmpMarshalDestinationAddress=pOverrideMarshalDestination||this.marshalDestination;if(!tmpMarshalDestinationAddress){throw new Error(`Attempt to resolve marshal destination object with no marshal destination set.`);}let tmpMarshalDestinationObject;if(pOverrideMarshalDestination){tmpMarshalDestinationObject=this.pict.resolveStateFromAddress(pOverrideMarshalDestination);if(!tmpMarshalDestinationObject){this.log.error(`Data Broker bootstrapping missing object at marshal destination address: ${tmpMarshalDestinationAddress}`);this.pict.setStateValueAtAddress(tmpMarshalDestinationAddress,null,{});}}else{tmpMarshalDestinationObject=this.getMarshalDestinationObject();}return tmpMarshalDestinationObject;}}module.exports=PictDataBrokerProvider;module.exports.default_configuration=_DEFAULT_PROVIDER_CONFIGURATION;},{"pict-provider":144}],263:[function(require,module,exports){const libPictProvider=require('pict-provider');const libFilter=require('../filters/Filter.js');/** @type {Record<string, any>} */const _DEFAULT_PROVIDER_CONFIGURATION={ProviderIdentifier:'Pict-RecordSet-FilterManager',AutoInitialize:true,AutoInitializeOrdinal:0};class PictRecordSetFilterManager extends libPictProvider{constructor(pFable,pOptions,pServiceHash){let tmpOptions=Object.assign({},_DEFAULT_PROVIDER_CONFIGURATION,pOptions);super(pFable,tmpOptions,pServiceHash);/** @type {Record<string, any>} */this.options;/** @type {import('../Pict.js')} */this.pict;this.filters={};this.filterCriteria={};}/**
|
|
11662
12712
|
* @param {string} pFilterHash
|
|
11663
12713
|
* @param {Record<string, any>} pFilterConfig
|
|
11664
12714
|
*
|
|
@@ -11761,7 +12811,7 @@ tmpPageSize=10000;}/** @type {import('../filters/Filter.js').FilterState} */cons
|
|
|
11761
12811
|
* @param {(pError?: Error) => void} fCallback
|
|
11762
12812
|
*
|
|
11763
12813
|
* @return {void}
|
|
11764
|
-
*/executeFilterCountUsingProvider(pEntityProvider,pFilterConfigurationAddress,pFilterExperienceAddress,fCallback){const tmpFilterConfiguration=this.pict.resolveStateFromAddress(pFilterConfigurationAddress);if(!Array.isArray(tmpFilterConfiguration)){return fCallback(new Error(`Filter configuration at address ${pFilterConfigurationAddress} is not an array.`));}const tmpFilterExperience=this.pict.resolveStateFromAddress(pFilterExperienceAddress);if(!tmpFilterExperience||typeof tmpFilterExperience!=='object'){return fCallback(new Error(`Filter experience at address ${pFilterExperienceAddress} is not an object.`));}return this.countRecordsByFilterUsingProivider(pEntityProvider,tmpFilterConfiguration,tmpFilterExperience,fCallback);}}module.exports=PictRecordSetFilterManager;module.exports.default_configuration=_DEFAULT_PROVIDER_CONFIGURATION;},{"../filters/Filter.js":
|
|
12814
|
+
*/executeFilterCountUsingProvider(pEntityProvider,pFilterConfigurationAddress,pFilterExperienceAddress,fCallback){const tmpFilterConfiguration=this.pict.resolveStateFromAddress(pFilterConfigurationAddress);if(!Array.isArray(tmpFilterConfiguration)){return fCallback(new Error(`Filter configuration at address ${pFilterConfigurationAddress} is not an array.`));}const tmpFilterExperience=this.pict.resolveStateFromAddress(pFilterExperienceAddress);if(!tmpFilterExperience||typeof tmpFilterExperience!=='object'){return fCallback(new Error(`Filter experience at address ${pFilterExperienceAddress} is not an object.`));}return this.countRecordsByFilterUsingProivider(pEntityProvider,tmpFilterConfiguration,tmpFilterExperience,fCallback);}}module.exports=PictRecordSetFilterManager;module.exports.default_configuration=_DEFAULT_PROVIDER_CONFIGURATION;},{"../filters/Filter.js":257,"pict-provider":144}],264:[function(require,module,exports){const libFableServiceProviderBase=require('fable-serviceproviderbase');/** @typedef {{ TimeStamp: Date, Category: string, Message: string }} TransactionLogEntry *//** @typedef {{ Timestamp: number, Data: any, Type: string }} TransactionQueueItem *//** @typedef {{ TransactionKey: string, Events: Record<string, Record<string, boolean>>, Log: Array<TransactionLogEntry>, TransactionQueue: Array<TransactionQueueItem> }} TransactionInfo *//*
|
|
11765
12815
|
* Provides transaction tracking with keys and events, allowing us to block repeat attempts.
|
|
11766
12816
|
* Once the shape is solidified, will move it back to the fable codebase
|
|
11767
12817
|
*/class TransactionTracking extends libFableServiceProviderBase{constructor(pFable,pOptions,pServiceHash){// Intersect default options, parent constructor, service information
|
|
@@ -11809,7 +12859,7 @@ return this.transactionMap[pKey];}this.transactionMap[pKey]={TransactionKey:pKey
|
|
|
11809
12859
|
* @return {boolean} true if the event is new, false if it has already been registered
|
|
11810
12860
|
*/checkEvent(pKey,pEvent,pHash){let tmpHash=typeof pHash==='string'?pHash:'';let tmpTransaction=this.transactionMap[pKey];if(tmpTransaction==null){this.log.warn(`TransactionTracking checkTransactionEvent event [${pEvent}]->[${tmpHash}] key [${pKey}] does not exist; auto creating...`);tmpTransaction=this.registerTransaction(pKey);}if(tmpTransaction.Events[pEvent]==null){tmpTransaction.Events[pEvent]={};}if(tmpHash in tmpTransaction.Events[pEvent]){//this.log.warn(`TransactionTracking checkTransactionEvent event [${pEvent}]->[${tmpHash}] key [${pKey}] firing a second time...`);
|
|
11811
12861
|
this.logToTransaction(pKey,`Event [${pEvent}]->[${tmpHash}] already exists in transaction [${pKey}]`,'Event');return false;}else{//this.log.warn(`TransactionTracking checkTransactionEvent event [${pEvent}]->[${tmpHash}] key [${pKey}] firing a first time...`);
|
|
11812
|
-
this.logToTransaction(pKey,`Event [${pEvent}]->[${tmpHash}] registered in transaction [${pKey}]`,'Event');tmpTransaction.Events[pEvent][tmpHash]=true;return true;}}}module.exports=TransactionTracking;/** @type {Record<string, any>} */TransactionTracking.default_configuration={};},{"fable-serviceproviderbase":60}],
|
|
12862
|
+
this.logToTransaction(pKey,`Event [${pEvent}]->[${tmpHash}] registered in transaction [${pKey}]`,'Event');tmpTransaction.Events[pEvent][tmpHash]=true;return true;}}}module.exports=TransactionTracking;/** @type {Record<string, any>} */TransactionTracking.default_configuration={};},{"fable-serviceproviderbase":60}],265:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderData extends libPictTemplate{/**
|
|
11813
12863
|
* @param {Object} pFable - The Fable Framework instance
|
|
11814
12864
|
* @param {Object} pOptions - The options for the service
|
|
11815
12865
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -11823,7 +12873,7 @@ this.logToTransaction(pKey,`Event [${pEvent}]->[${tmpHash}] registered in transa
|
|
|
11823
12873
|
* @param {any} [pState] - A catchall state object for plumbing data through template processing.
|
|
11824
12874
|
*
|
|
11825
12875
|
* @return {string} The rendered template
|
|
11826
|
-
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpRecord=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT Template [fDataRender]::[${tmpHash}] with tmpData:`,tmpRecord);}else if(this.pict.LogNoisiness>3){this.log.trace(`PICT Template [fDataRender]::[${tmpHash}]`);}let tmpDefaultValue='';if(tmpHash.indexOf(':')>-1){tmpDefaultValue=tmpHash.split(':')[1];tmpHash=tmpHash.split(':')[0];}let tmpValue='';if(tmpHash!=null){tmpValue=this.resolveStateFromAddress(tmpHash,tmpRecord,pContextArray,null,pScope,pState);}if(tmpValue==null||tmpValue=='undefined'||typeof tmpValue=='undefined'||tmpValue===''){return tmpDefaultValue;}return tmpValue;}}module.exports=PictTemplateProviderData;},{"pict-template":
|
|
12876
|
+
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpRecord=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT Template [fDataRender]::[${tmpHash}] with tmpData:`,tmpRecord);}else if(this.pict.LogNoisiness>3){this.log.trace(`PICT Template [fDataRender]::[${tmpHash}]`);}let tmpDefaultValue='';if(tmpHash.indexOf(':')>-1){tmpDefaultValue=tmpHash.split(':')[1];tmpHash=tmpHash.split(':')[0];}let tmpValue='';if(tmpHash!=null){tmpValue=this.resolveStateFromAddress(tmpHash,tmpRecord,pContextArray,null,pScope,pState);}if(tmpValue==null||tmpValue=='undefined'||typeof tmpValue=='undefined'||tmpValue===''){return tmpDefaultValue;}return tmpValue;}}module.exports=PictTemplateProviderData;},{"pict-template":242}],266:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderDataValueByKey extends libPictTemplate{/**
|
|
11827
12877
|
* @param {Object} pFable - The Fable Framework instance
|
|
11828
12878
|
* @param {Object} pOptions - The options for the service
|
|
11829
12879
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -11837,7 +12887,7 @@ this.logToTransaction(pKey,`Event [${pEvent}]->[${tmpHash}] registered in transa
|
|
|
11837
12887
|
* @param {any} [pState] - A catchall state object for plumbing data through template processing.
|
|
11838
12888
|
*
|
|
11839
12889
|
* @return {string} The rendered template
|
|
11840
|
-
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpRecord=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT Template [fDataRender]::[${tmpHash}] with tmpData:`,tmpRecord);}else if(this.pict.LogNoisiness>3){this.log.trace(`PICT Template [fDataRender]::[${tmpHash}]`);}let tmpHashArray=tmpHash.split(':');if(tmpHashArray.length<2){this.log.trace(`PICT Template [fDataRender]::[${tmpHash}] failed because there were not two stanzas in the expression [${pTemplateHash}]`);return'';}let tmpDefaultValue='';if(tmpHashArray.length>2){tmpDefaultValue=tmpHashArray[2];}let tmpValueObject=this.resolveStateFromAddress(tmpHashArray[0],tmpRecord,pContextArray,null,pScope,pState);let tmpValueAddress=this.resolveStateFromAddress(tmpHashArray[1],tmpRecord,pContextArray,null,pScope,pState);let tmpValue=this.pict.manifest.getValueByHash(tmpValueObject,tmpValueAddress);if(tmpValue==null||tmpValue=='undefined'||typeof tmpValue=='undefined'){return tmpDefaultValue;}return tmpValue;}}module.exports=PictTemplateProviderDataValueByKey;},{"pict-template":
|
|
12890
|
+
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpRecord=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT Template [fDataRender]::[${tmpHash}] with tmpData:`,tmpRecord);}else if(this.pict.LogNoisiness>3){this.log.trace(`PICT Template [fDataRender]::[${tmpHash}]`);}let tmpHashArray=tmpHash.split(':');if(tmpHashArray.length<2){this.log.trace(`PICT Template [fDataRender]::[${tmpHash}] failed because there were not two stanzas in the expression [${pTemplateHash}]`);return'';}let tmpDefaultValue='';if(tmpHashArray.length>2){tmpDefaultValue=tmpHashArray[2];}let tmpValueObject=this.resolveStateFromAddress(tmpHashArray[0],tmpRecord,pContextArray,null,pScope,pState);let tmpValueAddress=this.resolveStateFromAddress(tmpHashArray[1],tmpRecord,pContextArray,null,pScope,pState);let tmpValue=this.pict.manifest.getValueByHash(tmpValueObject,tmpValueAddress);if(tmpValue==null||tmpValue=='undefined'||typeof tmpValue=='undefined'){return tmpDefaultValue;}return tmpValue;}}module.exports=PictTemplateProviderDataValueByKey;},{"pict-template":242}],267:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderData extends libPictTemplate{/**
|
|
11841
12891
|
* @param {Object} pFable - The Fable Framework instance
|
|
11842
12892
|
* @param {Object} pOptions - The options for the service
|
|
11843
12893
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -11865,7 +12915,7 @@ return tmpAbsoluteFallbackValue;}/**
|
|
|
11865
12915
|
*
|
|
11866
12916
|
* @return {void} The result is passed to the callback function
|
|
11867
12917
|
*/renderAsync(pTemplateHash,pRecord,fCallback,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpRecord=typeof pRecord==='object'?pRecord:{};let tmpCallback=typeof fCallback==='function'?fCallback:()=>{return'';};if(this.pict.LogNoisiness>4){this.log.trace(`PICT DataWithAbsoluteFallback [fDataRender]::[${tmpHash}] with tmpRecord:`,tmpRecord);}else if(this.pict.LogNoisiness>3){this.log.trace(`PICT DataWithAbsoluteFallback [fDataRender]::[${tmpHash}]`);}let tmpAbsoluteFallbackValue='';if(tmpHash.indexOf(':')>-1){tmpAbsoluteFallbackValue=tmpHash.split(':')[1];tmpHash=tmpHash.split(':')[0];}let tmpValue='';if(tmpHash!=null){tmpValue=this.resolveStateFromAddress(tmpHash,tmpRecord,pContextArray,null,pScope,pState);if(tmpValue&&tmpValue!=='undefined'){if(this.pict.LogNoisiness>3){this.log.trace(`PICT DataWithAbsoluteFallback [fDataRender]::[${tmpHash}] - Found value: ${tmpValue}`);}return tmpCallback(null,tmpValue);}}// If the value is not found or is undefined, use the fallback value
|
|
11868
|
-
return tmpCallback(null,tmpAbsoluteFallbackValue);}}module.exports=PictTemplateProviderData;},{"pict-template":
|
|
12918
|
+
return tmpCallback(null,tmpAbsoluteFallbackValue);}}module.exports=PictTemplateProviderData;},{"pict-template":242}],268:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderData extends libPictTemplate{/**
|
|
11869
12919
|
* @param {Object} pFable - The Fable Framework instance
|
|
11870
12920
|
* @param {Object} pOptions - The options for the service
|
|
11871
12921
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -11895,7 +12945,7 @@ return'';}if(this.pict.LogNoisiness>3){this.log.trace(`PICT DataWithTemplateFall
|
|
|
11895
12945
|
* @return {void} The result is passed to the callback function
|
|
11896
12946
|
*/renderAsync(pTemplateHash,pRecord,fCallback,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpRecord=typeof pRecord==='object'?pRecord:{};let tmpCallback=typeof fCallback==='function'?fCallback:()=>{return'';};if(this.pict.LogNoisiness>4){this.log.trace(`PICT DataWithTemplateFallback [fDataRender]::[${tmpHash}] with tmpRecord:`,tmpRecord);}else if(this.pict.LogNoisiness>3){this.log.trace(`PICT DataWithTemplateFallback [fDataRender]::[${tmpHash}]`);}let tmpTemplateFallbackAddress='';if(tmpHash.indexOf(':')>-1){tmpTemplateFallbackAddress=tmpHash.split(':')[1];tmpHash=tmpHash.split(':')[0];}let tmpValue='';if(tmpHash!=null){tmpValue=this.resolveStateFromAddress(tmpHash,tmpRecord,pContextArray,null,pScope,pState);if(tmpValue&&tmpValue!=='undefined'){if(this.pict.LogNoisiness>3){this.log.trace(`PICT DataWithTemplateFallback [fDataRender]::[${tmpHash}] - Found value: ${tmpValue}`);}return tmpCallback(null,tmpValue);}}// If the value is not found or is undefined, try to use the fallback template
|
|
11897
12947
|
this.pict.parseTemplateByHash(tmpTemplateFallbackAddress,tmpRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}if(pValue==null||pValue===''){this.log.warn(`PICT DataWithTemplateFallback [fDataRender]::[${tmpHash}] - No fallback template found at address: ${tmpTemplateFallbackAddress}`);// If no fallback template is found, return an empty string
|
|
11898
|
-
return tmpCallback(null,'');}if(this.pict.LogNoisiness>3){this.log.trace(`PICT DataWithTemplateFallback [fDataRender]::[${tmpHash}] - Using fallback template from address: ${tmpTemplateFallbackAddress}`);}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}module.exports=PictTemplateProviderData;},{"pict-template":
|
|
12948
|
+
return tmpCallback(null,'');}if(this.pict.LogNoisiness>3){this.log.trace(`PICT DataWithTemplateFallback [fDataRender]::[${tmpHash}] - Using fallback template from address: ${tmpTemplateFallbackAddress}`);}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}module.exports=PictTemplateProviderData;},{"pict-template":242}],269:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderEntity extends libPictTemplate{/**
|
|
11899
12949
|
* @param {Object} pFable - The Fable Framework instance
|
|
11900
12950
|
* @param {Object} pOptions - The options for the service
|
|
11901
12951
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -11926,7 +12976,7 @@ let tmpAddressParts=tmpHash.split('^');if(tmpAddressParts.length<2){this.log.war
|
|
|
11926
12976
|
tmpEntityID=this.resolveStateFromAddress(String(tmpEntityID),tmpData,pContextArray,null,pScope,pState);}// No Entity or EntityID
|
|
11927
12977
|
if(!tmpEntity||!tmpEntityID){this.log.warn(`Pict: Entity Render: Entity or entity ID not resolved for [${tmpHash}] Entity: ${tmpEntity} ID: ${tmpEntityID}`);return tmpCallback(null,'');}if(this.pict.LogNoisiness>3){this.log.trace(`Pict: Entity Render: Entity [${tmpEntity}] with ID [${tmpEntityID}] as template [${tmpEntityTemplate}] from [${tmpHash}]`);}// Now try to get the entity
|
|
11928
12978
|
this.pict.EntityProvider.getEntity(tmpEntity,tmpEntityID,function(pError,pRecord){if(pError){this.log.error(`Pict: Entity Render: Error getting entity [${tmpEntity}] with ID [${tmpEntityID}] for [${tmpHash}]: ${pError}`,pError);return tmpCallback(pError,'');}// Now render the template
|
|
11929
|
-
if(tmpEntityTemplate){this.pict.parseTemplateByHash(tmpEntityTemplate,pRecord,tmpCallback,pContextArray,pScope,pState);}else{tmpCallback(null,'');}}.bind(this));}}module.exports=PictTemplateProviderEntity;},{"pict-template":
|
|
12979
|
+
if(tmpEntityTemplate){this.pict.parseTemplateByHash(tmpEntityTemplate,pRecord,tmpCallback,pContextArray,pScope,pState);}else{tmpCallback(null,'');}}.bind(this));}}module.exports=PictTemplateProviderEntity;},{"pict-template":242}],270:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderSelf extends libPictTemplate{/**
|
|
11930
12980
|
* @param {Object} pFable - The Fable Framework instance
|
|
11931
12981
|
* @param {Object} pOptions - The options for the service
|
|
11932
12982
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -11940,7 +12990,7 @@ if(tmpEntityTemplate){this.pict.parseTemplateByHash(tmpEntityTemplate,pRecord,tm
|
|
|
11940
12990
|
* @param {any} [pState] - A catchall state object for plumbing data through template processing.
|
|
11941
12991
|
*
|
|
11942
12992
|
* @return {string} The rendered template
|
|
11943
|
-
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){return this.pict.browserAddress;}}module.exports=PictTemplateProviderSelf;},{"pict-template":
|
|
12993
|
+
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){return this.pict.browserAddress;}}module.exports=PictTemplateProviderSelf;},{"pict-template":242}],271:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderSolve extends libPictTemplate{/**
|
|
11944
12994
|
* @param {Object} pFable - The Fable Framework instance
|
|
11945
12995
|
* @param {Object} pOptions - The options for the service
|
|
11946
12996
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -11955,7 +13005,7 @@ if(tmpEntityTemplate){this.pict.parseTemplateByHash(tmpEntityTemplate,pRecord,tm
|
|
|
11955
13005
|
*
|
|
11956
13006
|
* @return {string} The rendered template
|
|
11957
13007
|
*/render(pSolveParams,pRecord,pContextArray,pScope,pState){// {~S:ROUND(250*0.4129+Width,3):AppData.HomeworkRectangleSize:AppData.HomeworkManifest~}
|
|
11958
|
-
const[tmpEquation,tmpRecordAddress,tmpManifestAddress]=pSolveParams.trim().split(':',3);const tmpContextualRecord=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT Solve [fTemplateRender]::[${pSolveParams}] with tmpData:`,tmpContextualRecord);}else if(this.pict.LogNoisiness>0){this.log.trace(`PICT Solve [fTemplateRender]::[${pSolveParams}]`);}if(!tmpEquation){if(this.pict.LogNoisiness>2){this.log.warn(`Pict: Solve: Equation not found for [${tmpEquation}]`);}return'';}const tmpRecord=tmpRecordAddress&&this.pict.resolveStateFromAddress(tmpRecordAddress,tmpContextualRecord,pContextArray,null,pScope,pState)||tmpContextualRecord;const tmpManifest=tmpManifestAddress&&this.pict.resolveStateFromAddress(tmpManifestAddress,tmpContextualRecord,pContextArray,null,pScope,pState)||this.pict.manifest;const expressionParser=this.fable.instantiateServiceProviderIfNotExists('ExpressionParser');const tmpResultObject={};return expressionParser.solve(tmpEquation,tmpRecord,tmpResultObject,tmpManifest,tmpRecord);}}module.exports=PictTemplateProviderSolve;},{"pict-template":
|
|
13008
|
+
const[tmpEquation,tmpRecordAddress,tmpManifestAddress]=pSolveParams.trim().split(':',3);const tmpContextualRecord=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT Solve [fTemplateRender]::[${pSolveParams}] with tmpData:`,tmpContextualRecord);}else if(this.pict.LogNoisiness>0){this.log.trace(`PICT Solve [fTemplateRender]::[${pSolveParams}]`);}if(!tmpEquation){if(this.pict.LogNoisiness>2){this.log.warn(`Pict: Solve: Equation not found for [${tmpEquation}]`);}return'';}const tmpRecord=tmpRecordAddress&&this.pict.resolveStateFromAddress(tmpRecordAddress,tmpContextualRecord,pContextArray,null,pScope,pState)||tmpContextualRecord;const tmpManifest=tmpManifestAddress&&this.pict.resolveStateFromAddress(tmpManifestAddress,tmpContextualRecord,pContextArray,null,pScope,pState)||this.pict.manifest;const expressionParser=this.fable.instantiateServiceProviderIfNotExists('ExpressionParser');const tmpResultObject={};return expressionParser.solve(tmpEquation,tmpRecord,tmpResultObject,tmpManifest,tmpRecord);}}module.exports=PictTemplateProviderSolve;},{"pict-template":242}],272:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderSolveByReference extends libPictTemplate{/**
|
|
11959
13009
|
* @param {Object} pFable - The Fable Framework instance
|
|
11960
13010
|
* @param {Object} pOptions - The options for the service
|
|
11961
13011
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -11970,7 +13020,7 @@ const[tmpEquation,tmpRecordAddress,tmpManifestAddress]=pSolveParams.trim().split
|
|
|
11970
13020
|
*
|
|
11971
13021
|
* @return {string} The rendered template
|
|
11972
13022
|
*/render(pSolveParams,pRecord,pContextArray,pScope,pState){// {~SBR:AppData.Equation:AppData.HomeworkRectangleSize:AppData.HomeworkManifest~}
|
|
11973
|
-
const[tmpEquationAddress,tmpRecordAddress,tmpManifestAddress]=pSolveParams.trim().split(':',3);const tmpContextualRecord=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT SolveByReference [fTemplateRender]::[${pSolveParams}] with tmpData:`,tmpContextualRecord);}else if(this.pict.LogNoisiness>0){this.log.trace(`PICT SolveByReference [fTemplateRender]::[${pSolveParams}]`);}const tmpEquation=this.pict.resolveStateFromAddress(tmpEquationAddress,tmpContextualRecord,pContextArray,null,pScope,pState);if(!tmpEquation){if(this.pict.LogNoisiness>2){this.log.warn(`Pict: SolveByReference: Equation not found for [${tmpEquationAddress}]`);}return'';}const tmpRecord=tmpRecordAddress&&this.pict.resolveStateFromAddress(tmpRecordAddress,tmpContextualRecord,pContextArray,null,pScope,pState)||tmpContextualRecord;const tmpManifest=tmpManifestAddress&&this.pict.resolveStateFromAddress(tmpManifestAddress,tmpContextualRecord,pContextArray,null,pScope,pState)||this.pict.manifest;const expressionParser=this.fable.instantiateServiceProviderIfNotExists('ExpressionParser');const tmpResultObject={};return expressionParser.solve(tmpEquation,tmpRecord,tmpResultObject,tmpManifest,tmpRecord);}}module.exports=PictTemplateProviderSolveByReference;},{"pict-template":
|
|
13023
|
+
const[tmpEquationAddress,tmpRecordAddress,tmpManifestAddress]=pSolveParams.trim().split(':',3);const tmpContextualRecord=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT SolveByReference [fTemplateRender]::[${pSolveParams}] with tmpData:`,tmpContextualRecord);}else if(this.pict.LogNoisiness>0){this.log.trace(`PICT SolveByReference [fTemplateRender]::[${pSolveParams}]`);}const tmpEquation=this.pict.resolveStateFromAddress(tmpEquationAddress,tmpContextualRecord,pContextArray,null,pScope,pState);if(!tmpEquation){if(this.pict.LogNoisiness>2){this.log.warn(`Pict: SolveByReference: Equation not found for [${tmpEquationAddress}]`);}return'';}const tmpRecord=tmpRecordAddress&&this.pict.resolveStateFromAddress(tmpRecordAddress,tmpContextualRecord,pContextArray,null,pScope,pState)||tmpContextualRecord;const tmpManifest=tmpManifestAddress&&this.pict.resolveStateFromAddress(tmpManifestAddress,tmpContextualRecord,pContextArray,null,pScope,pState)||this.pict.manifest;const expressionParser=this.fable.instantiateServiceProviderIfNotExists('ExpressionParser');const tmpResultObject={};return expressionParser.solve(tmpEquation,tmpRecord,tmpResultObject,tmpManifest,tmpRecord);}}module.exports=PictTemplateProviderSolveByReference;},{"pict-template":242}],273:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderTemplate extends libPictTemplate{/**
|
|
11974
13024
|
* @param {Object} pFable - The Fable Framework instance
|
|
11975
13025
|
* @param {Object} pOptions - The options for the service
|
|
11976
13026
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12002,7 +13052,7 @@ return this.pict.parseTemplateByHash(tmpTemplateHash,pRecord,null,pContextArray,
|
|
|
12002
13052
|
let tmpHashTemplateSeparator=tmpHash.indexOf(':');tmpTemplateHash=tmpHash.substring(0,tmpHashTemplateSeparator);if(tmpHashTemplateSeparator>-1){tmpAddressOfData=tmpHash.substring(tmpHashTemplateSeparator+1);}else{tmpTemplateHash=tmpHash;}// No template hash
|
|
12003
13053
|
if(!tmpTemplateHash){this.log.warn(`Pict: Template Render Async: TemplateHash not resolved for [${tmpHash}]`);return fCallback(null,'');}if(!tmpAddressOfData){// No address was provided, just render the template with what this template has.
|
|
12004
13054
|
// The async portion of this is a mind bender because of how entry can happen dynamically from templates
|
|
12005
|
-
this.pict.parseTemplateByHash(tmpTemplateHash,pRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}else{this.pict.parseTemplateByHash(tmpTemplateHash,this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray,null,pScope,pState),(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}}module.exports=PictTemplateProviderTemplate;},{"pict-template":
|
|
13055
|
+
this.pict.parseTemplateByHash(tmpTemplateHash,pRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}else{this.pict.parseTemplateByHash(tmpTemplateHash,this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray,null,pScope,pState),(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}}module.exports=PictTemplateProviderTemplate;},{"pict-template":242}],274:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderTemplateByDataAddress extends libPictTemplate{/**
|
|
12006
13056
|
* @param {Object} pFable - The Fable Framework instance
|
|
12007
13057
|
* @param {Object} pOptions - The options for the service
|
|
12008
13058
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12034,7 +13084,7 @@ return this.pict.parseTemplate(tmpTemplate,pRecord,null,pContextArray,pScope,pSt
|
|
|
12034
13084
|
let tmpHashTemplateSeparator=tmpDataAddress.indexOf(':');tmpTemplateDataAddress=tmpDataAddress.substring(0,tmpHashTemplateSeparator);if(tmpHashTemplateSeparator>-1){tmpAddressOfData=tmpDataAddress.substring(tmpHashTemplateSeparator+1);}else{tmpTemplateDataAddress=tmpDataAddress;}// No template hash
|
|
12035
13085
|
if(!tmpTemplateDataAddress){this.log.warn(`Pict: Template Render Async: TemplateHash not resolved for [${tmpDataAddress}]`);return tmpCallback(null,'');}let tmpTemplate=this.pict.resolveStateFromAddress(tmpTemplateDataAddress,pRecord,pContextArray,null,pScope,pState)||'';if(!tmpTemplate){if(this.pict.LogNoisiness>2){this.log.warn(`Pict: Template Render: Template not found for [${tmpTemplateDataAddress}]`);}tmpTemplate='';}if(!tmpAddressOfData){// No address was provided, just render the template with what this template has.
|
|
12036
13086
|
// The async portion of this is a mind bender because of how entry can happen dynamically from templates
|
|
12037
|
-
this.pict.parseTemplate(tmpTemplate,pRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}else{this.pict.parseTemplate(tmpTemplate,this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray,null,pScope,pState),(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}}module.exports=PictTemplateProviderTemplateByDataAddress;},{"pict-template":
|
|
13087
|
+
this.pict.parseTemplate(tmpTemplate,pRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}else{this.pict.parseTemplate(tmpTemplate,this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray,null,pScope,pState),(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}}module.exports=PictTemplateProviderTemplateByDataAddress;},{"pict-template":242}],275:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderTemplate extends libPictTemplate{/**
|
|
12038
13088
|
* @param {Object} pFable - The Fable Framework instance
|
|
12039
13089
|
* @param {Object} pOptions - The options for the service
|
|
12040
13090
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12070,7 +13120,7 @@ if(!tmpTemplateHashReferenceLocation){this.log.warn(`Pict: Template Render Async
|
|
|
12070
13120
|
let tmpTemplateHash=this.resolveStateFromAddress(tmpTemplateHashReferenceLocation,pRecord,pContextArray,null,pScope,pState);// No template hash
|
|
12071
13121
|
if(!tmpTemplateHash){this.log.warn(`Pict: Template Render Async: TemplateHash not resolved for [${tmpHash}]`);return fCallback(null,'');}if(!tmpAddressOfData){// No address was provided, just render the template with what this template has.
|
|
12072
13122
|
// The async portion of this is a mind bender because of how entry can happen dynamically from templates
|
|
12073
|
-
this.pict.parseTemplateByHash(tmpTemplateHash,pRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}else{this.pict.parseTemplateByHash(tmpTemplateHash,this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray,null,pScope,pState),(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}}module.exports=PictTemplateProviderTemplate;},{"pict-template":
|
|
13123
|
+
this.pict.parseTemplateByHash(tmpTemplateHash,pRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}else{this.pict.parseTemplateByHash(tmpTemplateHash,this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray,null,pScope,pState),(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}}module.exports=PictTemplateProviderTemplate;},{"pict-template":242}],276:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderTemplateByTypes extends libPictTemplate{/**
|
|
12074
13124
|
* @param {Object} pFable - The Fable Framework instance
|
|
12075
13125
|
* @param {Object} pOptions - The options for the service
|
|
12076
13126
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12103,7 +13153,7 @@ return this.pict.parseTemplateByHash(tmpTemplateHash,tmpRecord,null,pContextArra
|
|
|
12103
13153
|
let tmpTemplateHashes=tmpHash.trim().split(':');if(tmpTemplateHashes.length<3){return fCallback(null,'');}tmpAddressToTest=tmpTemplateHashes[0];tmpDataTypesToTest=tmpTemplateHashes[1].split(',');tmpTemplateHash=tmpTemplateHashes[2];if(tmpTemplateHashes.length>3){tmpAddressOfData=tmpTemplateHashes[3];}if(tmpTemplateHashes.length>4){tmpFallbackTemplate=tmpTemplateHashes[4];}// No template hash
|
|
12104
13154
|
if(!tmpTemplateHash){return fCallback(null,'');}let tmpRecord=pRecord;if(tmpAddressOfData){tmpRecord=this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray,null,pScope,pState);}const tmpValueAtAddress=this.resolveStateFromAddress(tmpAddressToTest,tmpData,pContextArray,null,pScope,pState);/** @type {string} */let tmpTypeOfDataAtAddress=typeof tmpValueAtAddress;if(tmpTypeOfDataAtAddress=='object'&&Array.isArray(tmpValueAtAddress)){tmpTypeOfDataAtAddress='array';}if(tmpDataTypesToTest.indexOf(tmpTypeOfDataAtAddress)===-1){// Type not found, use the fallback template if we have one.
|
|
12105
13155
|
if(tmpFallbackTemplate){tmpTemplateHash=tmpFallbackTemplate;}else{return fCallback(null,'');}}// No address was provided, just render the template with what this template has.
|
|
12106
|
-
this.pict.parseTemplateByHash(tmpTemplateHash,tmpRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}module.exports=PictTemplateProviderTemplateByTypes;},{"pict-template":
|
|
13156
|
+
this.pict.parseTemplateByHash(tmpTemplateHash,tmpRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}module.exports=PictTemplateProviderTemplateByTypes;},{"pict-template":242}],277:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderTemplateFromAddress extends libPictTemplate{/**
|
|
12107
13157
|
* @param {Object} pFable - The Fable Framework instance
|
|
12108
13158
|
* @param {Object} pOptions - The options for the service
|
|
12109
13159
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12139,7 +13189,7 @@ if(!tmpTemplateContentAddress){this.log.warn(`Pict: Template Render Async: Templ
|
|
|
12139
13189
|
let tmpTemplateContent=this.resolveStateFromAddress(tmpTemplateContentAddress,pRecord,pContextArray,null,pScope,pState);// No template hash
|
|
12140
13190
|
if(!tmpTemplateContent){this.log.warn(`Pict: Template Render Async: TemplateHash not resolved for [${tmpHash}]`);return fCallback(null,'');}if(!tmpAddressOfData){// No address was provided, just render the template with what this template has.
|
|
12141
13191
|
// The async portion of this is a mind bender because of how entry can happen dynamically from templates
|
|
12142
|
-
this.pict.parseTemplate(tmpTemplateContent,pRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}else{this.pict.parseTemplate(tmpTemplateContent,this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray,null,pScope,pState),(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}}module.exports=PictTemplateProviderTemplateFromAddress;},{"pict-template":
|
|
13192
|
+
this.pict.parseTemplate(tmpTemplateContent,pRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}else{this.pict.parseTemplate(tmpTemplateContent,this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray,null,pScope,pState),(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}}module.exports=PictTemplateProviderTemplateFromAddress;},{"pict-template":242}],278:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderTemplateFromMap extends libPictTemplate{/**
|
|
12143
13193
|
* @param {Object} pFable - The Fable Framework instance
|
|
12144
13194
|
* @param {Object} pOptions - The options for the service
|
|
12145
13195
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12173,7 +13223,7 @@ let tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<3){this
|
|
|
12173
13223
|
if(!tmpTemplateFromMapHash){this.log.warn(`Pict: TemplateFromMap Render Async: TemplateFromMapHash not resolved for [${tmpHash}]`);return fCallback(null,'');}// Now resolve the data
|
|
12174
13224
|
let tmpMap=this.resolveStateFromAddress(tmpAddressOfMap,tmpData,pContextArray,null,pScope,pState);let tmpKey=this.resolveStateFromAddress(tmpAddressOfKey,tmpData,pContextArray,null,pScope,pState);if(!tmpMap){this.log.warn(`Pict: TemplateFromMap Render: Map not resolved for [${tmpHash}]`);return fCallback(null,'');}tmpData=tmpMap[tmpKey];if(!tmpData){// No address was provided, just render the TemplateFromMap with what this TemplateFromMap has.
|
|
12175
13225
|
// The async portion of this is a mind bender because of how entry can happen dynamically from TemplateFromMaps
|
|
12176
|
-
this.pict.parseTemplateByHash(tmpTemplateFromMapHash,pRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}else{this.pict.parseTemplateByHash(tmpTemplateFromMapHash,tmpData,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}}module.exports=PictTemplateProviderTemplateFromMap;},{"pict-template":
|
|
13226
|
+
this.pict.parseTemplateByHash(tmpTemplateFromMapHash,pRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}else{this.pict.parseTemplateByHash(tmpTemplateFromMapHash,tmpData,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}}module.exports=PictTemplateProviderTemplateFromMap;},{"pict-template":242}],279:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderTemplateSet extends libPictTemplate{/**
|
|
12177
13227
|
* @param {Object} pFable - The Fable Framework instance
|
|
12178
13228
|
* @param {Object} pOptions - The options for the service
|
|
12179
13229
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12206,7 +13256,7 @@ let tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<2){this
|
|
|
12206
13256
|
if(!tmpTemplateFromMapHash){this.log.warn(`Pict: TemplateFromMap Render Async: TemplateFromMapHash not resolved for [${tmpHash}]`);return fCallback(null,'');}// Now resolve the data
|
|
12207
13257
|
tmpData=this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray,null,pScope,pState);if(!tmpData){// No address was provided, just render the template with what this template has.
|
|
12208
13258
|
// The async portion of this is a mind bender because of how entry can happen dynamically from templates
|
|
12209
|
-
this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,pRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}else{this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}}module.exports=PictTemplateProviderTemplateSet;},{"pict-template":
|
|
13259
|
+
this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,pRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}else{this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}}module.exports=PictTemplateProviderTemplateSet;},{"pict-template":242}],280:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderTemplateSetFromMap extends libPictTemplate{/**
|
|
12210
13260
|
* @param {Object} pFable - The Fable Framework instance
|
|
12211
13261
|
* @param {Object} pOptions - The options for the service
|
|
12212
13262
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12240,7 +13290,7 @@ let tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<3){this
|
|
|
12240
13290
|
if(!tmpTemplateFromMapHash){this.log.warn(`Pict: TemplateFromMapSet Render Async: TemplateFromMapHash not resolved for [${tmpHash}]`);return fCallback(null,'');}// Now resolve the data
|
|
12241
13291
|
let tmpMap=this.resolveStateFromAddress(tmpAddressOfMap,tmpData,pContextArray,null,pScope,pState);let tmpKey=this.resolveStateFromAddress(tmpAddressOfKey,tmpData,pContextArray,null,pScope,pState);if(!tmpMap){this.log.warn(`Pict: TemplateFromMapSet Render: Map not resolved for [${tmpHash}]`);return fCallback(null,'');}tmpData=tmpMap[tmpKey];if(!tmpData){// No address was provided, just render the TemplateFromMap with what this TemplateFromMap has.
|
|
12242
13292
|
// The async portion of this is a mind bender because of how entry can happen dynamically from TemplateFromMaps
|
|
12243
|
-
this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,pRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}else{this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}}module.exports=PictTemplateProviderTemplateSetFromMap;},{"pict-template":
|
|
13293
|
+
this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,pRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}else{this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}}module.exports=PictTemplateProviderTemplateSetFromMap;},{"pict-template":242}],281:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderTemplateSetWithPayload extends libPictTemplate{/**
|
|
12244
13294
|
* @param {Object} pFable - The Fable Framework instance
|
|
12245
13295
|
* @param {Object} pOptions - The options for the service
|
|
12246
13296
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12267,7 +13317,7 @@ let tmpTemplateHashes=tmpHash.trim().split(':');if(tmpTemplateHashes.length<3){t
|
|
|
12267
13317
|
*
|
|
12268
13318
|
* @return {void}
|
|
12269
13319
|
*/renderAsync(pTemplateHash,pRecord,fCallback,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpCallback=typeof fCallback==='function'?fCallback:()=>{return'';};if(this.pict.LogNoisiness>4){this.log.trace(`PICT Template [fTemplateSetWithPayloadRenderAsync]::[${tmpHash}]`);}else if(this.pict.LogNoisiness>0){this.log.trace(`PICT Template [fTemplateSetWithPayloadRenderAsync]::[${tmpHash}]`);}let tmpTemplateHash;let tmpAddressOfData;let tmpAddressOfPayload;// This is just a simple 3 part hash (template, address of set, address of payload)
|
|
12270
|
-
let tmpTemplateHashes=tmpHash.trim().split(':');if(tmpTemplateHashes.length<3){this.log.trace(`PICT Template [fTemplateSetWithPayloadRender]::[${tmpHash}] failed because there were not three stanzas in the expression [${pTemplateHash}]`);return fCallback(null,'');}tmpTemplateHash=tmpTemplateHashes[0];tmpAddressOfData=tmpTemplateHashes[1];tmpAddressOfPayload=tmpTemplateHashes[2];let tmpData=this.resolveStateFromAddress(tmpAddressOfData,pRecord,pContextArray,null,pScope,pState);if(!tmpData){tmpData=pRecord;}if(!tmpData){tmpData={};}let tmpPayloadData=this.resolveStateFromAddress(tmpAddressOfPayload,pRecord,pContextArray,null,pScope,pState);if(!tmpPayloadData){tmpPayloadData=pRecord;}if(!tmpPayloadData){tmpPayloadData={};}this.pict.parseTemplateSetWithPayloadByHash(tmpTemplateHash,tmpData,tmpPayloadData,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}module.exports=PictTemplateProviderTemplateSetWithPayload;},{"pict-template":
|
|
13320
|
+
let tmpTemplateHashes=tmpHash.trim().split(':');if(tmpTemplateHashes.length<3){this.log.trace(`PICT Template [fTemplateSetWithPayloadRender]::[${tmpHash}] failed because there were not three stanzas in the expression [${pTemplateHash}]`);return fCallback(null,'');}tmpTemplateHash=tmpTemplateHashes[0];tmpAddressOfData=tmpTemplateHashes[1];tmpAddressOfPayload=tmpTemplateHashes[2];let tmpData=this.resolveStateFromAddress(tmpAddressOfData,pRecord,pContextArray,null,pScope,pState);if(!tmpData){tmpData=pRecord;}if(!tmpData){tmpData={};}let tmpPayloadData=this.resolveStateFromAddress(tmpAddressOfPayload,pRecord,pContextArray,null,pScope,pState);if(!tmpPayloadData){tmpPayloadData=pRecord;}if(!tmpPayloadData){tmpPayloadData={};}this.pict.parseTemplateSetWithPayloadByHash(tmpTemplateHash,tmpData,tmpPayloadData,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}module.exports=PictTemplateProviderTemplateSetWithPayload;},{"pict-template":242}],282:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderTemplateValueSet extends libPictTemplate{/**
|
|
12271
13321
|
* @param {Object} pFable - The Fable Framework instance
|
|
12272
13322
|
* @param {Object} pOptions - The options for the service
|
|
12273
13323
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12300,7 +13350,7 @@ let tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<2){this
|
|
|
12300
13350
|
if(!tmpTemplateFromMapHash){this.log.warn(`Pict: TemplateFromMap Render Async: TemplateFromMapHash not resolved for [${tmpHash}]`);return fCallback(null,'');}// Now resolve the data
|
|
12301
13351
|
tmpData=this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray,null,pScope,pState);let tmpDataValueSet=[];if(Array.isArray(tmpData)){for(let i=0;i<tmpData.length;i++){tmpDataValueSet.push({Value:tmpData[i],Key:i});}}else if(typeof tmpData==='object'){let tmpValueKeys=Object.keys(tmpData);for(let i=0;i<tmpValueKeys.length;i++){tmpDataValueSet.push({Value:tmpData[tmpValueKeys[i]],Key:tmpData[tmpValueKeys[i]]});}}else{tmpDataValueSet.push({Value:tmpData});}tmpData=tmpDataValueSet;if(!tmpData){// No address was provided, just render the template with what this template has.
|
|
12302
13352
|
// The async portion of this is a mind bender because of how entry can happen dynamically from templates
|
|
12303
|
-
this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,pRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}else{this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}}module.exports=PictTemplateProviderTemplateValueSet;},{"pict-template":
|
|
13353
|
+
this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,pRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}else{this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}}module.exports=PictTemplateProviderTemplateValueSet;},{"pict-template":242}],283:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderView extends libPictTemplate{/**
|
|
12304
13354
|
* @param {Object} pFable - The Fable Framework instance
|
|
12305
13355
|
* @param {Object} pOptions - The options for the service
|
|
12306
13356
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12327,7 +13377,7 @@ return tmpResult;}/**
|
|
|
12327
13377
|
* @return {void}
|
|
12328
13378
|
*/renderAsync(pTemplateHash,pRecord,fCallback,pContextArray,pScope,pState){const tmpViewHash=pTemplateHash.trim();if(!(tmpViewHash in this.pict.views)){this.log.warn(`Pict: View Template Render: View not found for [${tmpViewHash}]`);return fCallback(null,'');}let tmpRenderGUID=this.pict.getUUID();const tmpView=this.pict.views[tmpViewHash];return tmpView.renderAsync('__Virtual',`__TemplateOutputCache.${tmpRenderGUID}`,pRecord,pState?pState.RootRenderable:undefined,(pError,pResult)=>{if(pError){this.log.warn(`Pict: View Template Render: Error rendering view [${tmpViewHash}]`,pError);return fCallback(pError,'');}let tmpResult=this.pict.__TemplateOutputCache[tmpRenderGUID];// TODO: Uncomment this when we like how it's working
|
|
12329
13379
|
//delete this.pict.__TemplateOutputCache[tmpRenderGUID];
|
|
12330
|
-
return fCallback(null,tmpResult);});}}module.exports=PictTemplateProviderView;},{"pict-template":
|
|
13380
|
+
return fCallback(null,tmpResult);});}}module.exports=PictTemplateProviderView;},{"pict-template":242}],284:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderRandomNumber extends libPictTemplate{/**
|
|
12331
13381
|
* @param {Object} pFable - The Fable Framework instance
|
|
12332
13382
|
* @param {Object} pOptions - The options for the service
|
|
12333
13383
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12341,7 +13391,7 @@ return fCallback(null,tmpResult);});}}module.exports=PictTemplateProviderView;},
|
|
|
12341
13391
|
* @param {any} [pState] - A catchall state object for plumbing data through template processing.
|
|
12342
13392
|
*
|
|
12343
13393
|
* @return {string} The rendered template
|
|
12344
|
-
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();if(this.pict.LogNoisiness>3){this.log.trace(`PICT Template [fRandomNumber]::[${tmpHash}]`);}let tmpMinimumNumber=0;let tmpMaxNumber=9999999;if(tmpHash.length>0){let tmpHashParts=tmpHash.split(',');if(tmpHashParts.length>0){try{tmpMinimumNumber=parseInt(tmpHashParts[0]);}catch{tmpMinimumNumber=0;}}if(tmpHashParts.length>1){try{tmpMaxNumber=parseInt(tmpHashParts[1]);}catch{tmpMaxNumber=9999999;}}}return this.fable.DataGeneration.randomIntegerBetween(tmpMinimumNumber,tmpMaxNumber);}}module.exports=PictTemplateProviderRandomNumber;},{"pict-template":
|
|
13394
|
+
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();if(this.pict.LogNoisiness>3){this.log.trace(`PICT Template [fRandomNumber]::[${tmpHash}]`);}let tmpMinimumNumber=0;let tmpMaxNumber=9999999;if(tmpHash.length>0){let tmpHashParts=tmpHash.split(',');if(tmpHashParts.length>0){try{tmpMinimumNumber=parseInt(tmpHashParts[0]);}catch{tmpMinimumNumber=0;}}if(tmpHashParts.length>1){try{tmpMaxNumber=parseInt(tmpHashParts[1]);}catch{tmpMaxNumber=9999999;}}}return this.fable.DataGeneration.randomIntegerBetween(tmpMinimumNumber,tmpMaxNumber);}}module.exports=PictTemplateProviderRandomNumber;},{"pict-template":242}],285:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderRandomNumberString extends libPictTemplate{/**
|
|
12345
13395
|
* @param {Object} pFable - The Fable Framework instance
|
|
12346
13396
|
* @param {Object} pOptions - The options for the service
|
|
12347
13397
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12355,7 +13405,7 @@ return fCallback(null,tmpResult);});}}module.exports=PictTemplateProviderView;},
|
|
|
12355
13405
|
* @param {any} [pState] - A catchall state object for plumbing data through template processing.
|
|
12356
13406
|
*
|
|
12357
13407
|
* @return {string} The rendered template
|
|
12358
|
-
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();if(this.pict.LogNoisiness>3){this.log.trace(`PICT Template [fRandomNumberString]::[${tmpHash}]`);}let tmpStringLength=4;let tmpMaxNumber=9999;if(tmpHash.length>0){let tmpHashParts=tmpHash.split(',');if(tmpHashParts.length>0){try{tmpStringLength=parseInt(tmpHashParts[0]);}catch{tmpStringLength=4;}}if(tmpHashParts.length>1){try{tmpMaxNumber=parseInt(tmpHashParts[1]);}catch{tmpMaxNumber=9999;}}}return this.fable.DataGeneration.randomNumericString(tmpStringLength,tmpMaxNumber);}}module.exports=PictTemplateProviderRandomNumberString;},{"pict-template":
|
|
13408
|
+
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();if(this.pict.LogNoisiness>3){this.log.trace(`PICT Template [fRandomNumberString]::[${tmpHash}]`);}let tmpStringLength=4;let tmpMaxNumber=9999;if(tmpHash.length>0){let tmpHashParts=tmpHash.split(',');if(tmpHashParts.length>0){try{tmpStringLength=parseInt(tmpHashParts[0]);}catch{tmpStringLength=4;}}if(tmpHashParts.length>1){try{tmpMaxNumber=parseInt(tmpHashParts[1]);}catch{tmpMaxNumber=9999;}}}return this.fable.DataGeneration.randomNumericString(tmpStringLength,tmpMaxNumber);}}module.exports=PictTemplateProviderRandomNumberString;},{"pict-template":242}],286:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderDataEncodeJavascriptString extends libPictTemplate{/**
|
|
12359
13409
|
* @param {Object} pFable - The Fable Framework instance
|
|
12360
13410
|
* @param {Object} pOptions - The options for the service
|
|
12361
13411
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12369,7 +13419,7 @@ return fCallback(null,tmpResult);});}}module.exports=PictTemplateProviderView;},
|
|
|
12369
13419
|
* @param {any} [pState] - A catchall state object for plumbing data through template processing.
|
|
12370
13420
|
*
|
|
12371
13421
|
* @return {string} The rendered template
|
|
12372
|
-
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpData=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT Template [fDataJson]::[${tmpHash}] with tmpData:`,tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace(`PICT Template [fDataJson]::[${tmpHash}]`);}let tmpDataToEncode=this.resolveStateFromAddress(tmpHash,tmpData,pContextArray,null,pScope,pState);return this.pict.DataFormat.stringEncodeForJavascript(tmpDataToEncode);}}module.exports=PictTemplateProviderDataEncodeJavascriptString;},{"pict-template":
|
|
13422
|
+
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpData=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT Template [fDataJson]::[${tmpHash}] with tmpData:`,tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace(`PICT Template [fDataJson]::[${tmpHash}]`);}let tmpDataToEncode=this.resolveStateFromAddress(tmpHash,tmpData,pContextArray,null,pScope,pState);return this.pict.DataFormat.stringEncodeForJavascript(tmpDataToEncode);}}module.exports=PictTemplateProviderDataEncodeJavascriptString;},{"pict-template":242}],287:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderJSONOutput extends libPictTemplate{/**
|
|
12373
13423
|
* @param {Object} pFable - The Fable Framework instance
|
|
12374
13424
|
* @param {Object} pOptions - The options for the service
|
|
12375
13425
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12383,7 +13433,7 @@ return fCallback(null,tmpResult);});}}module.exports=PictTemplateProviderView;},
|
|
|
12383
13433
|
* @param {any} [pState] - A catchall state object for plumbing data through template processing.
|
|
12384
13434
|
*
|
|
12385
13435
|
* @return {string} The rendered template
|
|
12386
|
-
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpData=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT Template [fDataJson]::[${tmpHash}] with tmpData:`,tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace(`PICT Template [fDataJson]::[${tmpHash}]`);}let tmpDataToStringify=this.resolveStateFromAddress(tmpHash,tmpData,pContextArray,null,pScope,pState);if(!tmpDataToStringify){tmpDataToStringify=pRecord;}return JSON.stringify(tmpDataToStringify);}}module.exports=PictTemplateProviderJSONOutput;},{"pict-template":
|
|
13436
|
+
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpData=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT Template [fDataJson]::[${tmpHash}] with tmpData:`,tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace(`PICT Template [fDataJson]::[${tmpHash}]`);}let tmpDataToStringify=this.resolveStateFromAddress(tmpHash,tmpData,pContextArray,null,pScope,pState);if(!tmpDataToStringify){tmpDataToStringify=pRecord;}return JSON.stringify(tmpDataToStringify);}}module.exports=PictTemplateProviderJSONOutput;},{"pict-template":242}],288:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderDateOnlyFormat extends libPictTemplate{/**
|
|
12387
13437
|
* @param {import('fable')} pFable - The Fable Framework instance
|
|
12388
13438
|
* @param {any} pOptions - The options for the service
|
|
12389
13439
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12404,7 +13454,7 @@ let tmpDayJS=this.fable.Dates.dayJS.utc(tmpDateValue);return tmpDayJS.format(tmp
|
|
|
12404
13454
|
```javascript
|
|
12405
13455
|
|
|
12406
13456
|
```
|
|
12407
|
-
*/},{"pict-template":
|
|
13457
|
+
*/},{"pict-template":242}],289:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderDateOnlyYMD extends libPictTemplate{/**
|
|
12408
13458
|
* @param {Object} pFable - The Fable Framework instance
|
|
12409
13459
|
* @param {Object} pOptions - The options for the service
|
|
12410
13460
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12422,7 +13472,7 @@ let tmpDayJS=this.fable.Dates.dayJS.utc(tmpDateValue);return tmpDayJS.format(tmp
|
|
|
12422
13472
|
let tmpDayJS=this.fable.Dates.dayJS.utc(tmpDateValue);//FIXME: this is kind of wacked out; -62167219200000 is the unix ms timestamp for 0000-01-01 00:00:00 UTC
|
|
12423
13473
|
// not even sure showing negative is right; showing the era is probably better (BCE vs CE)
|
|
12424
13474
|
//const prefix = tmpDayJS.valueOf() < -62167219200000 ? '-' : '';
|
|
12425
|
-
const tmpPrefix='';return tmpPrefix+tmpDayJS.format('YYYY-MM-DD');}}module.exports=PictTemplateProviderDateOnlyYMD;},{"pict-template":
|
|
13475
|
+
const tmpPrefix='';return tmpPrefix+tmpDayJS.format('YYYY-MM-DD');}}module.exports=PictTemplateProviderDateOnlyYMD;},{"pict-template":242}],290:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderDateTimeFormat extends libPictTemplate{/**
|
|
12426
13476
|
* @param {Object} pFable - The Fable Framework instance
|
|
12427
13477
|
* @param {Object} pOptions - The options for the service
|
|
12428
13478
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12447,7 +13497,7 @@ try{tmpDayJS=tmpDayJS.tz(this.fable.Dates.dayJS.tz.guess());}catch(pError){this.
|
|
|
12447
13497
|
```javascript
|
|
12448
13498
|
|
|
12449
13499
|
```
|
|
12450
|
-
*/},{"pict-template":
|
|
13500
|
+
*/},{"pict-template":242}],291:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderDateTimeYMD extends libPictTemplate{/**
|
|
12451
13501
|
* @param {Object} pFable - The Fable Framework instance
|
|
12452
13502
|
* @param {Object} pOptions - The options for the service
|
|
12453
13503
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12466,7 +13516,7 @@ try{tmpDayJS=tmpDayJS.tz(this.fable.Dates.dayJS.tz.guess());}catch(pError){this.
|
|
|
12466
13516
|
let tmpDayJS=this.fable.Dates.dayJS.utc(tmpDateValue);try{// Try to cast the day to be a specific timezone if one is set for the app
|
|
12467
13517
|
if(this.pict.options.Timezone){tmpDayJS=tmpDayJS.tz(this.pict.options.Timezone);}else{try{tmpDayJS=tmpDayJS.tz(this.fable.Dates.dayJS.tz.guess());}catch(pError){this.log.error(`Error guessing dayJS guess() function; dates may be formatted to GMT by default. (${pError.message||pError})`);}}}catch{//this.log.error(`Error casting timezone using tz .. casting to the browser guess which is [${this.fable.Dates.dayJS.tz.guess()}].`);
|
|
12468
13518
|
// Day.js will try to guess the user's timezone for us
|
|
12469
|
-
try{tmpDayJS=tmpDayJS.tz(this.fable.Dates.dayJS.tz.guess());}catch(pError){this.log.error(`Error guessing dayJS guess() function; dates may be formatted to GMT by default. (${pError.message||pError})`);}}return tmpDayJS.format('YYYY-MM-DD');}}module.exports=PictTemplateProviderDateTimeYMD;},{"pict-template":
|
|
13519
|
+
try{tmpDayJS=tmpDayJS.tz(this.fable.Dates.dayJS.tz.guess());}catch(pError){this.log.error(`Error guessing dayJS guess() function; dates may be formatted to GMT by default. (${pError.message||pError})`);}}return tmpDayJS.format('YYYY-MM-DD');}}module.exports=PictTemplateProviderDateTimeYMD;},{"pict-template":242}],292:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderDigits extends libPictTemplate{/**
|
|
12470
13520
|
* @param {Object} pFable - The Fable Framework instance
|
|
12471
13521
|
* @param {Object} pOptions - The options for the service
|
|
12472
13522
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12480,7 +13530,7 @@ try{tmpDayJS=tmpDayJS.tz(this.fable.Dates.dayJS.tz.guess());}catch(pError){this.
|
|
|
12480
13530
|
* @param {any} [pState] - A catchall state object for plumbing data through template processing.
|
|
12481
13531
|
*
|
|
12482
13532
|
* @return {string} The rendered template
|
|
12483
|
-
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpData=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT Template [fDigits]::[${tmpHash}] with tmpData:`,tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace(`PICT Template [fDigits]::[${tmpHash}]`);}let tmpColumnData=this.resolveStateFromAddress(tmpHash,tmpData,pContextArray,null,pScope,pState);return this.fable.DataFormat.formatterAddCommasToNumber(this.fable.DataFormat.formatterRoundNumber(tmpColumnData,2));}}module.exports=PictTemplateProviderDigits;},{"pict-template":
|
|
13533
|
+
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpData=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT Template [fDigits]::[${tmpHash}] with tmpData:`,tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace(`PICT Template [fDigits]::[${tmpHash}]`);}let tmpColumnData=this.resolveStateFromAddress(tmpHash,tmpData,pContextArray,null,pScope,pState);return this.fable.DataFormat.formatterAddCommasToNumber(this.fable.DataFormat.formatterRoundNumber(tmpColumnData,2));}}module.exports=PictTemplateProviderDigits;},{"pict-template":242}],293:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderDollars extends libPictTemplate{/**
|
|
12484
13534
|
* @param {Object} pFable - The Fable Framework instance
|
|
12485
13535
|
* @param {Object} pOptions - The options for the service
|
|
12486
13536
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12494,7 +13544,7 @@ try{tmpDayJS=tmpDayJS.tz(this.fable.Dates.dayJS.tz.guess());}catch(pError){this.
|
|
|
12494
13544
|
* @param {any} [pState] - A catchall state object for plumbing data through template processing.
|
|
12495
13545
|
*
|
|
12496
13546
|
* @return {string} The rendered template
|
|
12497
|
-
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpData=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT Template [fDollars]::[${tmpHash}] with tmpData:`,tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace(`PICT Template [fDollars]::[${tmpHash}]`);}let tmpColumnData=this.resolveStateFromAddress(tmpHash,tmpData,pContextArray,null,pScope,pState);return this.fable.DataFormat.formatterDollars(tmpColumnData);}}module.exports=PictTemplateProviderDollars;},{"pict-template":
|
|
13547
|
+
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpData=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT Template [fDollars]::[${tmpHash}] with tmpData:`,tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace(`PICT Template [fDollars]::[${tmpHash}]`);}let tmpColumnData=this.resolveStateFromAddress(tmpHash,tmpData,pContextArray,null,pScope,pState);return this.fable.DataFormat.formatterDollars(tmpColumnData);}}module.exports=PictTemplateProviderDollars;},{"pict-template":242}],294:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderHTMLCommandEnd extends libPictTemplate{/**
|
|
12498
13548
|
* @param {Object} pFable - The Fable Framework instance
|
|
12499
13549
|
* @param {Object} pOptions - The options for the service
|
|
12500
13550
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12508,7 +13558,7 @@ try{tmpDayJS=tmpDayJS.tz(this.fable.Dates.dayJS.tz.guess());}catch(pError){this.
|
|
|
12508
13558
|
* @param {any} [pState] - A catchall state object for plumbing data through template processing.
|
|
12509
13559
|
*
|
|
12510
13560
|
* @return {string} The rendered template
|
|
12511
|
-
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpRecord=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT Template [fDataRender]::[${tmpHash}] with tmpData:`,tmpRecord);}else if(this.pict.LogNoisiness>3){this.log.trace(`PICT Template [fDataRender]::[${tmpHash}]`);}let tmpValue=false;const[tmpValueAddress,tmpPolarityStr]=tmpHash.split(':');if(tmpValueAddress!=null){tmpValue=this.resolveStateFromAddress(tmpValueAddress,tmpRecord,pContextArray,null,pScope,pState);}const tmpPolarity=tmpPolarityStr!=null?tmpPolarityStr==='1'||tmpPolarityStr.toLowerCase()==='true'||tmpPolarityStr.toLowerCase()==='t':false;if(Boolean(tmpValue)==tmpPolarity){return' -->';}return'';}}module.exports=PictTemplateProviderHTMLCommandEnd;},{"pict-template":
|
|
13561
|
+
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpRecord=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT Template [fDataRender]::[${tmpHash}] with tmpData:`,tmpRecord);}else if(this.pict.LogNoisiness>3){this.log.trace(`PICT Template [fDataRender]::[${tmpHash}]`);}let tmpValue=false;const[tmpValueAddress,tmpPolarityStr]=tmpHash.split(':');if(tmpValueAddress!=null){tmpValue=this.resolveStateFromAddress(tmpValueAddress,tmpRecord,pContextArray,null,pScope,pState);}const tmpPolarity=tmpPolarityStr!=null?tmpPolarityStr==='1'||tmpPolarityStr.toLowerCase()==='true'||tmpPolarityStr.toLowerCase()==='t':false;if(Boolean(tmpValue)==tmpPolarity){return' -->';}return'';}}module.exports=PictTemplateProviderHTMLCommandEnd;},{"pict-template":242}],295:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderHTMLCommandStart extends libPictTemplate{/**
|
|
12512
13562
|
* @param {Object} pFable - The Fable Framework instance
|
|
12513
13563
|
* @param {Object} pOptions - The options for the service
|
|
12514
13564
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12522,7 +13572,7 @@ try{tmpDayJS=tmpDayJS.tz(this.fable.Dates.dayJS.tz.guess());}catch(pError){this.
|
|
|
12522
13572
|
* @param {any} [pState] - A catchall state object for plumbing data through template processing.
|
|
12523
13573
|
*
|
|
12524
13574
|
* @return {string} The rendered template
|
|
12525
|
-
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpRecord=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT Template [fDataRender]::[${tmpHash}] with tmpData:`,tmpRecord);}else if(this.pict.LogNoisiness>3){this.log.trace(`PICT Template [fDataRender]::[${tmpHash}]`);}let tmpValue=false;const[tmpValueAddress,tmpPolarityStr]=tmpHash.split(':');if(tmpValueAddress!=null){tmpValue=this.resolveStateFromAddress(tmpValueAddress,tmpRecord,pContextArray,null,pScope,pState);}const tmpPolarity=tmpPolarityStr!=null?tmpPolarityStr==='1'||tmpPolarityStr.toLowerCase()==='true'||tmpPolarityStr.toLowerCase()==='t':false;if(Boolean(tmpValue)==tmpPolarity){return'<!-- ';}return'';}}module.exports=PictTemplateProviderHTMLCommandStart;},{"pict-template":
|
|
13575
|
+
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpRecord=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT Template [fDataRender]::[${tmpHash}] with tmpData:`,tmpRecord);}else if(this.pict.LogNoisiness>3){this.log.trace(`PICT Template [fDataRender]::[${tmpHash}]`);}let tmpValue=false;const[tmpValueAddress,tmpPolarityStr]=tmpHash.split(':');if(tmpValueAddress!=null){tmpValue=this.resolveStateFromAddress(tmpValueAddress,tmpRecord,pContextArray,null,pScope,pState);}const tmpPolarity=tmpPolarityStr!=null?tmpPolarityStr==='1'||tmpPolarityStr.toLowerCase()==='true'||tmpPolarityStr.toLowerCase()==='t':false;if(Boolean(tmpValue)==tmpPolarity){return'<!-- ';}return'';}}module.exports=PictTemplateProviderHTMLCommandStart;},{"pict-template":242}],296:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderJoin extends libPictTemplate{/**
|
|
12526
13576
|
* @param {Object} pFable - The Fable Framework instance
|
|
12527
13577
|
* @param {Object} pOptions - The options for the service
|
|
12528
13578
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12537,7 +13587,7 @@ try{tmpDayJS=tmpDayJS.tz(this.fable.Dates.dayJS.tz.guess());}catch(pError){this.
|
|
|
12537
13587
|
*
|
|
12538
13588
|
* @return {string} The rendered template
|
|
12539
13589
|
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash;let tmpData=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT Join [fDataRender]::[${tmpHash}] with tmpData:`,tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace(`PICT Join [fDataRender]::[${tmpHash}]`);}let tmpDataAddresses=tmpHash.split('^');if(tmpDataAddresses.length<2){return'';}// Get the separator string
|
|
12540
|
-
let tmpSeparator=tmpDataAddresses.shift();let tmpValueList=[];for(let i=0;i<tmpDataAddresses.length;i++){let tmpValueSet=this.resolveStateFromAddress(tmpDataAddresses[i],tmpData,pContextArray,null,pScope,pState);if(tmpValueSet&&Array.isArray(tmpValueSet)){for(let j=0;j<tmpValueSet.length;j++){tmpValueList.push(tmpValueSet[j]);}}else if(tmpValueSet){tmpValueList.push(tmpValueSet);}}return tmpValueList.join(tmpSeparator);}}module.exports=PictTemplateProviderJoin;},{"pict-template":
|
|
13590
|
+
let tmpSeparator=tmpDataAddresses.shift();let tmpValueList=[];for(let i=0;i<tmpDataAddresses.length;i++){let tmpValueSet=this.resolveStateFromAddress(tmpDataAddresses[i],tmpData,pContextArray,null,pScope,pState);if(tmpValueSet&&Array.isArray(tmpValueSet)){for(let j=0;j<tmpValueSet.length;j++){tmpValueList.push(tmpValueSet[j]);}}else if(tmpValueSet){tmpValueList.push(tmpValueSet);}}return tmpValueList.join(tmpSeparator);}}module.exports=PictTemplateProviderJoin;},{"pict-template":242}],297:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderJoinUnique extends libPictTemplate{/**
|
|
12541
13591
|
* @param {Object} pFable - The Fable Framework instance
|
|
12542
13592
|
* @param {Object} pOptions - The options for the service
|
|
12543
13593
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12552,7 +13602,7 @@ let tmpSeparator=tmpDataAddresses.shift();let tmpValueList=[];for(let i=0;i<tmpD
|
|
|
12552
13602
|
*
|
|
12553
13603
|
* @return {string} The rendered template
|
|
12554
13604
|
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash;let tmpData=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT Join Unique [fDataRender]::[${tmpHash}] with tmpData:`,tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace(`PICT Join Unique [fDataRender]::[${tmpHash}]`);}let tmpDataAddresses=tmpHash.split('^');if(tmpDataAddresses.length<2){return'';}// Get the separator string
|
|
12555
|
-
let tmpSeparator=tmpDataAddresses.shift();let tmpValueList=[];let tmpValueMap={};for(let i=0;i<tmpDataAddresses.length;i++){let tmpValueSet=this.resolveStateFromAddress(tmpDataAddresses[i],tmpData,pContextArray,null,pScope,pState);if(tmpValueSet&&Array.isArray(tmpValueSet)){for(let j=0;j<tmpValueSet.length;j++){if(!(tmpValueSet[j]in tmpValueMap)){tmpValueMap[tmpValueSet[j]]=true;tmpValueList.push(tmpValueSet[j]);}}}else if(tmpValueSet){if(!(tmpValueSet in tmpValueMap)){tmpValueMap[tmpValueSet]=true;tmpValueList.push(tmpValueSet);}}}return tmpValueList.join(tmpSeparator);}}module.exports=PictTemplateProviderJoinUnique;},{"pict-template":
|
|
13605
|
+
let tmpSeparator=tmpDataAddresses.shift();let tmpValueList=[];let tmpValueMap={};for(let i=0;i<tmpDataAddresses.length;i++){let tmpValueSet=this.resolveStateFromAddress(tmpDataAddresses[i],tmpData,pContextArray,null,pScope,pState);if(tmpValueSet&&Array.isArray(tmpValueSet)){for(let j=0;j<tmpValueSet.length;j++){if(!(tmpValueSet[j]in tmpValueMap)){tmpValueMap[tmpValueSet[j]]=true;tmpValueList.push(tmpValueSet[j]);}}}else if(tmpValueSet){if(!(tmpValueSet in tmpValueMap)){tmpValueMap[tmpValueSet]=true;tmpValueList.push(tmpValueSet);}}}return tmpValueList.join(tmpSeparator);}}module.exports=PictTemplateProviderJoinUnique;},{"pict-template":242}],298:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderPascalCaseIdentifier extends libPictTemplate{/**
|
|
12556
13606
|
* @param {Object} pFable - The Fable Framework instance
|
|
12557
13607
|
* @param {Object} pOptions - The options for the service
|
|
12558
13608
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12572,7 +13622,7 @@ let tmpSeparator=tmpDataAddresses.shift();let tmpValueList=[];let tmpValueMap={}
|
|
|
12572
13622
|
```javascript
|
|
12573
13623
|
|
|
12574
13624
|
```
|
|
12575
|
-
*/},{"pict-template":
|
|
13625
|
+
*/},{"pict-template":242}],299:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderPluckJoinUnique extends libPictTemplate{/**
|
|
12576
13626
|
* @param {Object} pFable - The Fable Framework instance
|
|
12577
13627
|
* @param {Object} pOptions - The options for the service
|
|
12578
13628
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12588,7 +13638,7 @@ let tmpSeparator=tmpDataAddresses.shift();let tmpValueList=[];let tmpValueMap={}
|
|
|
12588
13638
|
* @return {string} The rendered template
|
|
12589
13639
|
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash;let tmpData=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT Pluck Join Unique [fDataRender]::[${tmpHash}] with tmpData:`,tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace(`PICT Pluck Join Unique [fDataRender]::[${tmpHash}]`);}let tmpDataAddresses=tmpHash.split('^');if(tmpDataAddresses.length<3){return'';}// Get the separator string
|
|
12590
13640
|
let tmpSeparator=tmpDataAddresses.shift();let tmpAddress=tmpDataAddresses.shift();let tmpValueList=[];let tmpValueMap={};for(let i=0;i<tmpDataAddresses.length;i++){let tmpValueSet=this.resolveStateFromAddress(tmpDataAddresses[i],tmpData,pContextArray,null,pScope,pState);if(tmpValueSet&&Array.isArray(tmpValueSet)){// This one only works on arrays of objects.
|
|
12591
|
-
for(let j=0;j<tmpValueSet.length;j++){if(tmpValueSet[j]===null||typeof tmpValueSet!=='object'){continue;}let tmpValue=this.pict.manifest.getValueByHash(tmpValueSet[j],tmpAddress);if(!(tmpValue in tmpValueMap)){tmpValueMap[tmpValue]=true;tmpValueList.push(tmpValue);}}}else if(tmpValueSet){if(!(tmpValueSet in tmpValueMap)){tmpValueMap[tmpValueSet]=true;tmpValueList.push(tmpValueSet);}}}return tmpValueList.join(tmpSeparator);}}module.exports=PictTemplateProviderPluckJoinUnique;},{"pict-template":
|
|
13641
|
+
for(let j=0;j<tmpValueSet.length;j++){if(tmpValueSet[j]===null||typeof tmpValueSet!=='object'){continue;}let tmpValue=this.pict.manifest.getValueByHash(tmpValueSet[j],tmpAddress);if(!(tmpValue in tmpValueMap)){tmpValueMap[tmpValue]=true;tmpValueList.push(tmpValue);}}}else if(tmpValueSet){if(!(tmpValueSet in tmpValueMap)){tmpValueMap[tmpValueSet]=true;tmpValueList.push(tmpValueSet);}}}return tmpValueList.join(tmpSeparator);}}module.exports=PictTemplateProviderPluckJoinUnique;},{"pict-template":242}],300:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderBreakpoint extends libPictTemplate{/**
|
|
12592
13642
|
* @param {Object} pFable - The Fable Framework instance
|
|
12593
13643
|
* @param {Object} pOptions - The options for the service
|
|
12594
13644
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12604,7 +13654,7 @@ for(let j=0;j<tmpValueSet.length;j++){if(tmpValueSet[j]===null||typeof tmpValueS
|
|
|
12604
13654
|
* @return {string} The rendered template
|
|
12605
13655
|
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpError=new Error(`PICT Template Breakpoint: ${tmpHash}`);this.log.trace(`PICT Template Breakpoint: ${tmpHash}`,tmpError.stack);//throw tmpError;
|
|
12606
13656
|
debugger;// eslint-disable-line no-debugger
|
|
12607
|
-
return'';}}module.exports=PictTemplateProviderBreakpoint;},{"pict-template":
|
|
13657
|
+
return'';}}module.exports=PictTemplateProviderBreakpoint;},{"pict-template":242}],301:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderDataValueTree extends libPictTemplate{/**
|
|
12608
13658
|
* @param {Object} pFable - The Fable Framework instance
|
|
12609
13659
|
* @param {Object} pOptions - The options for the service
|
|
12610
13660
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12634,7 +13684,7 @@ tmpPictObjectWrapTemplate=`<div class="PICT PICTObjectSet">{~D:Record.ObjectValu
|
|
|
12634
13684
|
*/dataValueTreeObjectSet(pObject,pRootObject,pCurrentDepth,pMaxDepth,pContextArray,pScope,pState){let tmpTemplateResult='';if(typeof pObject!=='object'){return tmpTemplateResult;}let tmpObjectValueKeys=Object.keys(pObject);let tmpPictObjectBranchTemplate=this.pict.TemplateProvider.getTemplate('PICT-Object-Branch');if(!tmpPictObjectBranchTemplate){// This template is here because it is a default template. Users can override this template by providing their own as PICT-Object-Branch
|
|
12635
13685
|
tmpPictObjectBranchTemplate=`
|
|
12636
13686
|
<div class="PICTObjectBranchDepth_{~D:Record.CurrentDepth~}"><div class="PICTObjectBranch">{~D:Record.BranchKey~}</div><div class="PICTObjectBranchValue">{~D:Record.BranchValue~}</div></div>
|
|
12637
|
-
`;}for(let i=0;i<tmpObjectValueKeys.length;i++){let tmpBranchType=typeof pObject[tmpObjectValueKeys[i]];let tmpBranchValue='';switch(tmpBranchType){case'object':if(pCurrentDepth+1>pMaxDepth){tmpBranchValue='...';}else{tmpBranchValue=this.dataValueTreeObjectSet(pObject[tmpObjectValueKeys[i]],pRootObject,pCurrentDepth+1,pMaxDepth,pContextArray,pScope);}break;default:tmpBranchValue=pObject[tmpObjectValueKeys[i]];break;}let tmpDataValue={AppData:this.pict.AppData,Bundle:this.pict.Bundle,RootContainer:pRootObject,Container:pObject,BranchEntryCount:tmpObjectValueKeys.length,BranchIndex:i,BranchKey:tmpObjectValueKeys[i],BranchValue:tmpBranchValue,BranchDataType:tmpBranchType,CurrentDepth:pCurrentDepth,MaxDepth:pMaxDepth};tmpTemplateResult+=this.pict.parseTemplate(tmpPictObjectBranchTemplate,tmpDataValue,null,pContextArray,pScope,pState);}return tmpTemplateResult;}}module.exports=PictTemplateProviderDataValueTree;},{"pict-template":
|
|
13687
|
+
`;}for(let i=0;i<tmpObjectValueKeys.length;i++){let tmpBranchType=typeof pObject[tmpObjectValueKeys[i]];let tmpBranchValue='';switch(tmpBranchType){case'object':if(pCurrentDepth+1>pMaxDepth){tmpBranchValue='...';}else{tmpBranchValue=this.dataValueTreeObjectSet(pObject[tmpObjectValueKeys[i]],pRootObject,pCurrentDepth+1,pMaxDepth,pContextArray,pScope);}break;default:tmpBranchValue=pObject[tmpObjectValueKeys[i]];break;}let tmpDataValue={AppData:this.pict.AppData,Bundle:this.pict.Bundle,RootContainer:pRootObject,Container:pObject,BranchEntryCount:tmpObjectValueKeys.length,BranchIndex:i,BranchKey:tmpObjectValueKeys[i],BranchValue:tmpBranchValue,BranchDataType:tmpBranchType,CurrentDepth:pCurrentDepth,MaxDepth:pMaxDepth};tmpTemplateResult+=this.pict.parseTemplate(tmpPictObjectBranchTemplate,tmpDataValue,null,pContextArray,pScope,pState);}return tmpTemplateResult;}}module.exports=PictTemplateProviderDataValueTree;},{"pict-template":242}],302:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderLogStatement extends libPictTemplate{/**
|
|
12638
13688
|
* @param {Object} pFable - The Fable Framework instance
|
|
12639
13689
|
* @param {Object} pOptions - The options for the service
|
|
12640
13690
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12648,7 +13698,7 @@ tmpPictObjectBranchTemplate=`
|
|
|
12648
13698
|
* @param {any} [pState] - A catchall state object for plumbing data through template processing.
|
|
12649
13699
|
*
|
|
12650
13700
|
* @return {string} The rendered template
|
|
12651
|
-
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();this.log.trace(`PICT Template Log Message: ${tmpHash}`);return'';}}module.exports=PictTemplateProviderLogStatement;},{"pict-template":
|
|
13701
|
+
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();this.log.trace(`PICT Template Log Message: ${tmpHash}`);return'';}}module.exports=PictTemplateProviderLogStatement;},{"pict-template":242}],303:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderLogValue extends libPictTemplate{/**
|
|
12652
13702
|
* @param {Object} pFable - The Fable Framework instance
|
|
12653
13703
|
* @param {Object} pOptions - The options for the service
|
|
12654
13704
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12662,7 +13712,7 @@ tmpPictObjectBranchTemplate=`
|
|
|
12662
13712
|
* @param {any} [pState] - A catchall state object for plumbing data through template processing.
|
|
12663
13713
|
*
|
|
12664
13714
|
* @return {string} The rendered template
|
|
12665
|
-
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpData=typeof pRecord==='object'?pRecord:{};let tmpValue=this.resolveStateFromAddress(tmpHash,tmpData,pContextArray,null,pScope,pState);let tmpValueType=typeof tmpValue;if(tmpValue==null||tmpValueType=='undefined'){this.log.trace(`PICT Template Log Value: [${tmpHash}] is ${tmpValueType}.`);}else if(tmpValueType=='object'){this.log.trace(`PICT Template Log Value: [${tmpHash}] is an object.`,tmpValue);}else{this.log.trace(`PICT Template Log Value: [${tmpHash}] is a ${tmpValueType} = [${tmpValue}]`);}return'';}}module.exports=PictTemplateProviderLogValue;},{"pict-template":
|
|
13715
|
+
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpData=typeof pRecord==='object'?pRecord:{};let tmpValue=this.resolveStateFromAddress(tmpHash,tmpData,pContextArray,null,pScope,pState);let tmpValueType=typeof tmpValue;if(tmpValue==null||tmpValueType=='undefined'){this.log.trace(`PICT Template Log Value: [${tmpHash}] is ${tmpValueType}.`);}else if(tmpValueType=='object'){this.log.trace(`PICT Template Log Value: [${tmpHash}] is an object.`,tmpValue);}else{this.log.trace(`PICT Template Log Value: [${tmpHash}] is a ${tmpValueType} = [${tmpValue}]`);}return'';}}module.exports=PictTemplateProviderLogValue;},{"pict-template":242}],304:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderLogValueTree extends libPictTemplate{/**
|
|
12666
13716
|
* @param {Object} pFable - The Fable Framework instance
|
|
12667
13717
|
* @param {Object} pOptions - The options for the service
|
|
12668
13718
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12676,7 +13726,7 @@ tmpPictObjectBranchTemplate=`
|
|
|
12676
13726
|
* @param {any} [pState] - A catchall state object for plumbing data through template processing.
|
|
12677
13727
|
*
|
|
12678
13728
|
* @return {string} The rendered template
|
|
12679
|
-
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpData=typeof pRecord==='object'?pRecord:{};tmpData.TemplateHash=pTemplateHash.trim();tmpData.ValueTreeParameters=tmpData.TemplateHash.split('^');if(tmpData.ValueTreeParameters.length<1){return'';}tmpData.ResolvedValue=this.resolveStateFromAddress(tmpData.ValueTreeParameters[0],tmpData,pContextArray,null,pScope,pState);tmpData.ResolvedValueType=typeof tmpData.ResolvedValue;try{tmpData.TreeMaxDepth=tmpData.ValueTreeParameters.length<2?1:parseInt(tmpData.ValueTreeParameters[1]);}catch{tmpData.TreeMaxDepth=1;}if(tmpData.ResolvedValueType=='object'){this.logValueTreeObjectSet(tmpData.ResolvedValue,tmpData.ValueTreeParameters[0],tmpData.ResolvedValue,0,tmpData.TreeMaxDepth);}else{this.log.trace(`PICT Template Log Value Tree: [${tmpData.TemplateHash}] resolved data is not an object.`,tmpData.ResolvedValue);}return'';}logValueTreeObjectSet=(pObject,pBaseAddress,pRootObject,pCurrentDepth,pMaxDepth)=>{let tmpTemplateResult='';if(typeof pObject!=='object'){return tmpTemplateResult;}let tmpObjectValueKeys=Object.keys(pObject);for(let i=0;i<tmpObjectValueKeys.length;i++){let tmpBranchType=typeof pObject[tmpObjectValueKeys[i]];let tmpBranchValue='';switch(tmpBranchType){case'object':tmpBranchValue='...';break;default:tmpBranchValue=pObject[tmpObjectValueKeys[i]];break;}this.log.trace(`[${pBaseAddress}.${tmpObjectValueKeys[i]}] (${tmpBranchType}): ${tmpBranchValue}`);if(pCurrentDepth+1>pMaxDepth){return'';}else if(tmpBranchType=='object'){tmpBranchValue=this.logValueTreeObjectSet(pObject[tmpObjectValueKeys[i]],`${pBaseAddress}.${tmpObjectValueKeys[i]}`,pRootObject,pCurrentDepth+1,pMaxDepth);}}return'';};}module.exports=PictTemplateProviderLogValueTree;},{"pict-template":
|
|
13729
|
+
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpData=typeof pRecord==='object'?pRecord:{};tmpData.TemplateHash=pTemplateHash.trim();tmpData.ValueTreeParameters=tmpData.TemplateHash.split('^');if(tmpData.ValueTreeParameters.length<1){return'';}tmpData.ResolvedValue=this.resolveStateFromAddress(tmpData.ValueTreeParameters[0],tmpData,pContextArray,null,pScope,pState);tmpData.ResolvedValueType=typeof tmpData.ResolvedValue;try{tmpData.TreeMaxDepth=tmpData.ValueTreeParameters.length<2?1:parseInt(tmpData.ValueTreeParameters[1]);}catch{tmpData.TreeMaxDepth=1;}if(tmpData.ResolvedValueType=='object'){this.logValueTreeObjectSet(tmpData.ResolvedValue,tmpData.ValueTreeParameters[0],tmpData.ResolvedValue,0,tmpData.TreeMaxDepth);}else{this.log.trace(`PICT Template Log Value Tree: [${tmpData.TemplateHash}] resolved data is not an object.`,tmpData.ResolvedValue);}return'';}logValueTreeObjectSet=(pObject,pBaseAddress,pRootObject,pCurrentDepth,pMaxDepth)=>{let tmpTemplateResult='';if(typeof pObject!=='object'){return tmpTemplateResult;}let tmpObjectValueKeys=Object.keys(pObject);for(let i=0;i<tmpObjectValueKeys.length;i++){let tmpBranchType=typeof pObject[tmpObjectValueKeys[i]];let tmpBranchValue='';switch(tmpBranchType){case'object':tmpBranchValue='...';break;default:tmpBranchValue=pObject[tmpObjectValueKeys[i]];break;}this.log.trace(`[${pBaseAddress}.${tmpObjectValueKeys[i]}] (${tmpBranchType}): ${tmpBranchValue}`);if(pCurrentDepth+1>pMaxDepth){return'';}else if(tmpBranchType=='object'){tmpBranchValue=this.logValueTreeObjectSet(pObject[tmpObjectValueKeys[i]],`${pBaseAddress}.${tmpObjectValueKeys[i]}`,pRootObject,pCurrentDepth+1,pMaxDepth);}}return'';};}module.exports=PictTemplateProviderLogValueTree;},{"pict-template":242}],305:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderNotEmpty extends libPictTemplate{/**
|
|
12680
13730
|
* @param {Object} pFable - The Fable Framework instance
|
|
12681
13731
|
* @param {Object} pOptions - The options for the service
|
|
12682
13732
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12691,11 +13741,11 @@ tmpPictObjectBranchTemplate=`
|
|
|
12691
13741
|
*
|
|
12692
13742
|
* @return {string} The rendered template
|
|
12693
13743
|
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpData=typeof pRecord==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace(`PICT Template [fNotEmptyRender]::[${tmpHash}] with tmpData:`,tmpData);}else if(this.pict.LogNoisiness>2){this.log.trace(`PICT Template [fNotEmptyRender]::[${tmpHash}]`);}let tmpHashParts=tmpHash.split('^');// For now just check truthiness. Not sure if this is grand.
|
|
12694
|
-
if(this.resolveStateFromAddress(tmpHashParts[0],tmpData,pContextArray,null,pScope,pState)){return tmpHashParts[1];}return'';}}module.exports=PictTemplateProviderNotEmpty;},{"pict-template":
|
|
13744
|
+
if(this.resolveStateFromAddress(tmpHashParts[0],tmpData,pContextArray,null,pScope,pState)){return tmpHashParts[1];}return'';}}module.exports=PictTemplateProviderNotEmpty;},{"pict-template":242}],306:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderTemplateIfBase extends libPictTemplate{/**
|
|
12695
13745
|
* @param {Object} pFable - The Fable Framework instance
|
|
12696
13746
|
* @param {Object} pOptions - The options for the service
|
|
12697
13747
|
* @param {String} pServiceHash - The hash of the service
|
|
12698
|
-
*/constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);}compareValues(pValueLeft,pOperator,pValueRight){switch(pOperator){case'TRUE':return pValueLeft===true;case'FALSE':return pValueLeft===false;case'LNGT':case'LENGTH_GREATER_THAN':switch(typeof pValueLeft){case'string':return pValueLeft.length>pValueRight;case'object':return pValueLeft.length>pValueRight;default:return false;}case'LNLT':case'LENGTH_LESS_THAN':switch(typeof pValueLeft){case'string':return pValueLeft.length<pValueRight;case'object':return pValueLeft.length<pValueRight;default:return false;}case'!==':return pValueLeft!==pValueRight;case'!=':return pValueLeft!=pValueRight;case'<':return pValueLeft<pValueRight;case'>':return pValueLeft>pValueRight;case'<=':return pValueLeft<=pValueRight;case'>=':return pValueLeft>=pValueRight;case'===':return pValueLeft===pValueRight;case'==':return pValueLeft==pValueRight;default:return false;}}}module.exports=PictTemplateProviderTemplateIfBase;},{"pict-template":
|
|
13748
|
+
*/constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);}compareValues(pValueLeft,pOperator,pValueRight){switch(pOperator){case'TRUE':return pValueLeft===true;case'FALSE':return pValueLeft===false;case'LNGT':case'LENGTH_GREATER_THAN':switch(typeof pValueLeft){case'string':return pValueLeft.length>pValueRight;case'object':return pValueLeft.length>pValueRight;default:return false;}case'LNLT':case'LENGTH_LESS_THAN':switch(typeof pValueLeft){case'string':return pValueLeft.length<pValueRight;case'object':return pValueLeft.length<pValueRight;default:return false;}case'!==':return pValueLeft!==pValueRight;case'!=':return pValueLeft!=pValueRight;case'<':return pValueLeft<pValueRight;case'>':return pValueLeft>pValueRight;case'<=':return pValueLeft<=pValueRight;case'>=':return pValueLeft>=pValueRight;case'===':return pValueLeft===pValueRight;case'==':return pValueLeft==pValueRight;default:return false;}}}module.exports=PictTemplateProviderTemplateIfBase;},{"pict-template":242}],307:[function(require,module,exports){const libPictTemplateIf=require('./Pict-Template-TemplateIf-Base.js');class PictTemplateProviderTemplateIf extends libPictTemplateIf{/**
|
|
12699
13749
|
* @param {Object} pFable - The Fable Framework instance
|
|
12700
13750
|
* @param {Object} pOptions - The options for the service
|
|
12701
13751
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12730,7 +13780,7 @@ if(!tmpTemplateHash){this.log.warn(`Pict: Template Render: TemplateHash not reso
|
|
|
12730
13780
|
if(!tmpComparisonOperation){this.log.warn(`Pict: Template Render: Comparison Operation not resolved for [${tmpHash}]`);return tmpCallback(null,'');}// Now try to break the comparison into three parts...
|
|
12731
13781
|
let tmpComparisonParts=tmpComparisonOperation.split('^');if(tmpComparisonParts.length<3){this.log.warn(`Pict: Template Render: Comparison Operation not complete (three parts expected) for [${tmpHash}]`);return tmpCallback(null,'');}// Now look up the data at the comparison location
|
|
12732
13782
|
try{// This is the only thing that's different from the absolute value function above. Collapse these.
|
|
12733
|
-
let tmpComparisonResult=this.compareValues(this.resolveStateFromAddress(tmpComparisonParts[0],tmpData,pContextArray,null,pScope,pState),tmpComparisonParts[1],this.resolveStateFromAddress(tmpComparisonParts[2],tmpData,pContextArray,null,pScope,pState));if(!tmpComparisonResult){return tmpCallback(null,'');}if(!tmpAddressOfData){this.pict.parseTemplateByHash(tmpTemplateHash,pRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}else{this.pict.parseTemplateByHash(tmpTemplateHash,this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray,null,pScope,pState),(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}catch(pError){this.log.error(`Pict: Template Render: Error looking up comparison data for [${tmpHash}]: ${pError}`,pError);return tmpCallback(pError,'');}}}module.exports=PictTemplateProviderTemplateIf;},{"./Pict-Template-TemplateIf-Base.js":
|
|
13783
|
+
let tmpComparisonResult=this.compareValues(this.resolveStateFromAddress(tmpComparisonParts[0],tmpData,pContextArray,null,pScope,pState),tmpComparisonParts[1],this.resolveStateFromAddress(tmpComparisonParts[2],tmpData,pContextArray,null,pScope,pState));if(!tmpComparisonResult){return tmpCallback(null,'');}if(!tmpAddressOfData){this.pict.parseTemplateByHash(tmpTemplateHash,pRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}else{this.pict.parseTemplateByHash(tmpTemplateHash,this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray,null,pScope,pState),(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}catch(pError){this.log.error(`Pict: Template Render: Error looking up comparison data for [${tmpHash}]: ${pError}`,pError);return tmpCallback(pError,'');}}}module.exports=PictTemplateProviderTemplateIf;},{"./Pict-Template-TemplateIf-Base.js":306}],308:[function(require,module,exports){const libPictTemplateIf=require('./Pict-Template-TemplateIf-Base.js');class PictTemplateProviderTemplateIfAbsolute extends libPictTemplateIf{/**
|
|
12734
13784
|
* @param {Object} pFable - The Fable Framework instance
|
|
12735
13785
|
* @param {Object} pOptions - The options for the service
|
|
12736
13786
|
* @param {String} pServiceHash - The hash of the service
|
|
@@ -12764,7 +13814,7 @@ return this.pict.parseTemplateByHash(tmpTemplateHash,pRecord,null,pContextArray,
|
|
|
12764
13814
|
if(!tmpTemplateHash){this.log.warn(`Pict: Template Render: TemplateHash not resolved for [${tmpHash}]`);return tmpCallback(null,'');}// No comparison operation
|
|
12765
13815
|
if(!tmpComparisonOperation){this.log.warn(`Pict: Template Render: Comparison Operation not resolved for [${tmpHash}]`);return tmpCallback(null,'');}// Now try to break the comparison into three parts...
|
|
12766
13816
|
let tmpComparisonParts=tmpComparisonOperation.split('^');if(tmpComparisonParts.length<3){this.log.warn(`Pict: Template Render: Comparison Operation not complete (three parts expected) for [${tmpHash}]`);return tmpCallback(null,'');}// Now look up the data at the comparison location
|
|
12767
|
-
try{let tmpComparisonResult=this.compareValues(this.resolveStateFromAddress(tmpComparisonParts[0],tmpData,pContextArray,null,pScope,pState),tmpComparisonParts[1],tmpComparisonParts[2]);if(!tmpComparisonResult){return tmpCallback(null,'');}if(!tmpAddressOfData){this.pict.parseTemplateByHash(tmpTemplateHash,pRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}else{this.pict.parseTemplateByHash(tmpTemplateHash,this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray,null,pScope,pState),(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}catch(pError){this.log.error(`Pict: Template Render: Error looking up comparison data for [${tmpHash}]: ${pError}`,pError);return tmpCallback(pError,'');}}}module.exports=PictTemplateProviderTemplateIfAbsolute;},{"./Pict-Template-TemplateIf-Base.js":
|
|
13817
|
+
try{let tmpComparisonResult=this.compareValues(this.resolveStateFromAddress(tmpComparisonParts[0],tmpData,pContextArray,null,pScope,pState),tmpComparisonParts[1],tmpComparisonParts[2]);if(!tmpComparisonResult){return tmpCallback(null,'');}if(!tmpAddressOfData){this.pict.parseTemplateByHash(tmpTemplateHash,pRecord,(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}else{this.pict.parseTemplateByHash(tmpTemplateHash,this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray,null,pScope,pState),(pError,pValue)=>{if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray,pScope,pState);}}catch(pError){this.log.error(`Pict: Template Render: Error looking up comparison data for [${tmpHash}]: ${pError}`,pError);return tmpCallback(pError,'');}}}module.exports=PictTemplateProviderTemplateIfAbsolute;},{"./Pict-Template-TemplateIf-Base.js":306}],309:[function(require,module,exports){/**
|
|
12768
13818
|
* Precedent Meta-Templating
|
|
12769
13819
|
*
|
|
12770
13820
|
* @license MIT
|
|
@@ -12787,7 +13837,7 @@ try{let tmpComparisonResult=this.compareValues(this.resolveStateFromAddress(tmpC
|
|
|
12787
13837
|
* @param {string} pString - The string to parse
|
|
12788
13838
|
* @param {object} pData - Data to pass in as the second argument
|
|
12789
13839
|
* @return {string} The result from the parser
|
|
12790
|
-
*/parseString(pString,pData){return this.StringParser.parseString(pString,this.ParseTree,pData);}}module.exports=Precedent;},{"./StringParser.js":
|
|
13840
|
+
*/parseString(pString,pData){return this.StringParser.parseString(pString,this.ParseTree,pData);}}module.exports=Precedent;},{"./StringParser.js":310,"./WordTree.js":311}],310:[function(require,module,exports){/**
|
|
12791
13841
|
* String Parser
|
|
12792
13842
|
* @author Steven Velozo <steven@velozo.com>
|
|
12793
13843
|
* @description Parse a string, properly processing each matched token in the word tree.
|
|
@@ -12840,7 +13890,7 @@ this.resetOutputBuffer(pParserState);this.appendOutputBuffer(pCharacter,pParserS
|
|
|
12840
13890
|
* @param {string} pString - The string to parse.
|
|
12841
13891
|
* @param {Object} pParseTree - The parse tree to begin parsing from (usually root)
|
|
12842
13892
|
* @param {Object} pData - The data to pass to the function as a second parameter
|
|
12843
|
-
*/parseString(pString,pParseTree,pData){let tmpParserState=this.newParserState(pParseTree);for(var i=0;i<pString.length;i++){this.parseCharacter(pString[i],tmpParserState,pData);}this.flushOutputBuffer(tmpParserState);return tmpParserState.Output;}}module.exports=StringParser;},{}],
|
|
13893
|
+
*/parseString(pString,pParseTree,pData){let tmpParserState=this.newParserState(pParseTree);for(var i=0;i<pString.length;i++){this.parseCharacter(pString[i],tmpParserState,pData);}this.flushOutputBuffer(tmpParserState);return tmpParserState.Output;}}module.exports=StringParser;},{}],311:[function(require,module,exports){/**
|
|
12844
13894
|
* Word Tree
|
|
12845
13895
|
* @author Steven Velozo <steven@velozo.com>
|
|
12846
13896
|
* @description Create a tree (directed graph) of Javascript objects, one character per object.
|
|
@@ -12867,7 +13917,7 @@ this.resetOutputBuffer(pParserState);this.appendOutputBuffer(pCharacter,pParserS
|
|
|
12867
13917
|
* @param {function} fParser - The function to parse if this is the matched pattern, once the Pattern End is met. If this is a string, a simple replacement occurs.
|
|
12868
13918
|
* @return {bool} True if adding the pattern was successful
|
|
12869
13919
|
*/addPattern(pPatternStart,pPatternEnd,fParser){if(pPatternStart.length<1){return false;}if(typeof pPatternEnd==='string'&&pPatternEnd.length<1){return false;}let tmpLeaf=this.ParseTree;// Add the tree of leaves iteratively
|
|
12870
|
-
for(var i=0;i<pPatternStart.length;i++){tmpLeaf=this.addChild(tmpLeaf,pPatternStart[i],i);}if(!tmpLeaf.hasOwnProperty('PatternEnd')){tmpLeaf.PatternEnd={};}let tmpPatternEnd=typeof pPatternEnd==='string'?pPatternEnd:pPatternStart;for(let i=0;i<tmpPatternEnd.length;i++){tmpLeaf=this.addEndChild(tmpLeaf,tmpPatternEnd[i],i);}tmpLeaf.PatternStartString=pPatternStart;tmpLeaf.PatternEndString=tmpPatternEnd;tmpLeaf.Parse=typeof fParser==='function'?fParser:typeof fParser==='string'?()=>{return fParser;}:pData=>{return pData;};return true;}}module.exports=WordTree;},{}],
|
|
13920
|
+
for(var i=0;i<pPatternStart.length;i++){tmpLeaf=this.addChild(tmpLeaf,pPatternStart[i],i);}if(!tmpLeaf.hasOwnProperty('PatternEnd')){tmpLeaf.PatternEnd={};}let tmpPatternEnd=typeof pPatternEnd==='string'?pPatternEnd:pPatternStart;for(let i=0;i<tmpPatternEnd.length;i++){tmpLeaf=this.addEndChild(tmpLeaf,tmpPatternEnd[i],i);}tmpLeaf.PatternStartString=pPatternStart;tmpLeaf.PatternEndString=tmpPatternEnd;tmpLeaf.Parse=typeof fParser==='function'?fParser:typeof fParser==='string'?()=>{return fParser;}:pData=>{return pData;};return true;}}module.exports=WordTree;},{}],312:[function(require,module,exports){// shim for using process in browser
|
|
12871
13921
|
var process=module.exports={};// cached from whatever global is present so that test runners that stub it
|
|
12872
13922
|
// don't break things. But we need to wrap it in a try catch in case it is
|
|
12873
13923
|
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
|
@@ -12885,7 +13935,7 @@ return cachedClearTimeout.call(null,marker);}catch(e){// same as above but when
|
|
|
12885
13935
|
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
|
12886
13936
|
return cachedClearTimeout.call(this,marker);}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return;}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue);}else{queueIndex=-1;}if(queue.length){drainQueue();}}function drainQueue(){if(draining){return;}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex<len){if(currentQueue){currentQueue[queueIndex].run();}}queueIndex=-1;len=queue.length;}currentQueue=null;draining=false;runClearTimeout(timeout);}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1){for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i];}}queue.push(new Item(fun,args));if(queue.length===1&&!draining){runTimeout(drainQueue);}};// v8 likes predictible objects
|
|
12887
13937
|
function Item(fun,array){this.fun=fun;this.array=array;}Item.prototype.run=function(){this.fun.apply(null,this.array);};process.title='browser';process.browser=true;process.env={};process.argv=[];process.version='';// empty string to avoid regexp issues
|
|
12888
|
-
process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(name){return[];};process.binding=function(name){throw new Error('process.binding is not supported');};process.cwd=function(){return'/';};process.chdir=function(dir){throw new Error('process.chdir is not supported');};process.umask=function(){return 0;};},{}],
|
|
13938
|
+
process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(name){return[];};process.binding=function(name){throw new Error('process.binding is not supported');};process.cwd=function(){return'/';};process.chdir=function(dir){throw new Error('process.chdir is not supported');};process.umask=function(){return 0;};},{}],313:[function(require,module,exports){(function(global){(function(){/*! https://mths.be/punycode v1.4.1 by @mathias */;(function(root){/** Detect free variables */var freeExports=typeof exports=='object'&&exports&&!exports.nodeType&&exports;var freeModule=typeof module=='object'&&module&&!module.nodeType&&module;var freeGlobal=typeof global=='object'&&global;if(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal||freeGlobal.self===freeGlobal){root=freeGlobal;}/**
|
|
12889
13939
|
* The `punycode` object.
|
|
12890
13940
|
* @name punycode
|
|
12891
13941
|
* @type Object
|
|
@@ -13040,7 +14090,7 @@ for/* no condition */(q=delta,k=base;;k+=base){t=k<=bias?tMin:k>=bias+tMax?tMax:
|
|
|
13040
14090
|
if(typeof define=='function'&&typeof define.amd=='object'&&define.amd){define('punycode',function(){return punycode;});}else if(freeExports&&freeModule){if(module.exports==freeExports){// in Node.js, io.js, or RingoJS v0.8.0+
|
|
13041
14091
|
freeModule.exports=punycode;}else{// in Narwhal or RingoJS v0.7.0-
|
|
13042
14092
|
for(key in punycode){punycode.hasOwnProperty(key)&&(freeExports[key]=punycode[key]);}}}else{// in Rhino or a web browser
|
|
13043
|
-
root.punycode=punycode;}})(this);}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],
|
|
14093
|
+
root.punycode=punycode;}})(this);}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],314:[function(require,module,exports){'use strict';var replace=String.prototype.replace;var percentTwenties=/%20/g;var Format={RFC1738:'RFC1738',RFC3986:'RFC3986'};module.exports={'default':Format.RFC3986,formatters:{RFC1738:function(value){return replace.call(value,percentTwenties,'+');},RFC3986:function(value){return String(value);}},RFC1738:Format.RFC1738,RFC3986:Format.RFC3986};},{}],315:[function(require,module,exports){'use strict';var stringify=require('./stringify');var parse=require('./parse');var formats=require('./formats');module.exports={formats:formats,parse:parse,stringify:stringify};},{"./formats":314,"./parse":316,"./stringify":317}],316:[function(require,module,exports){'use strict';var utils=require('./utils');var has=Object.prototype.hasOwnProperty;var isArray=Array.isArray;var defaults={allowDots:false,allowEmptyArrays:false,allowPrototypes:false,allowSparse:false,arrayLimit:20,charset:'utf-8',charsetSentinel:false,comma:false,decodeDotInKeys:false,decoder:utils.decode,delimiter:'&',depth:5,duplicates:'combine',ignoreQueryPrefix:false,interpretNumericEntities:false,parameterLimit:1000,parseArrays:true,plainObjects:false,strictDepth:false,strictMerge:true,strictNullHandling:false,throwOnLimitExceeded:false};var interpretNumericEntities=function(str){return str.replace(/&#(\d+);/g,function($0,numberStr){return String.fromCharCode(parseInt(numberStr,10));});};var parseArrayValue=function(val,options,currentArrayLength){if(val&&typeof val==='string'&&options.comma&&val.indexOf(',')>-1){return val.split(',');}if(options.throwOnLimitExceeded&¤tArrayLength>=options.arrayLimit){throw new RangeError('Array limit exceeded. Only '+options.arrayLimit+' element'+(options.arrayLimit===1?'':'s')+' allowed in an array.');}return val;};// This is what browsers will submit when the ✓ character occurs in an
|
|
13044
14094
|
// application/x-www-form-urlencoded body and the encoding of the page containing
|
|
13045
14095
|
// the form is iso-8859-1, or when the submitted form has an accept-charset
|
|
13046
14096
|
// attribute of iso-8859-1. Presumably also with other charsets that do not contain
|
|
@@ -13053,13 +14103,13 @@ var i;var charset=options.charset;if(options.charsetSentinel){for(i=0;i<parts.le
|
|
|
13053
14103
|
}}}for(i=0;i<parts.length;++i){if(i===skipIndex){continue;}var part=parts[i];var bracketEqualsPos=part.indexOf(']=');var pos=bracketEqualsPos===-1?part.indexOf('='):bracketEqualsPos+1;var key;var val;if(pos===-1){key=options.decoder(part,defaults.decoder,charset,'key');val=options.strictNullHandling?null:'';}else{key=options.decoder(part.slice(0,pos),defaults.decoder,charset,'key');if(key!==null){val=utils.maybeMap(parseArrayValue(part.slice(pos+1),options,isArray(obj[key])?obj[key].length:0),function(encodedVal){return options.decoder(encodedVal,defaults.decoder,charset,'value');});}}if(val&&options.interpretNumericEntities&&charset==='iso-8859-1'){val=interpretNumericEntities(String(val));}if(part.indexOf('[]=')>-1){val=isArray(val)?[val]:val;}if(options.comma&&isArray(val)&&val.length>options.arrayLimit){if(options.throwOnLimitExceeded){throw new RangeError('Array limit exceeded. Only '+options.arrayLimit+' element'+(options.arrayLimit===1?'':'s')+' allowed in an array.');}val=utils.combine([],val,options.arrayLimit,options.plainObjects);}if(key!==null){var existing=has.call(obj,key);if(existing&&(options.duplicates==='combine'||part.indexOf('[]=')>-1)){obj[key]=utils.combine(obj[key],val,options.arrayLimit,options.plainObjects);}else if(!existing||options.duplicates==='last'){obj[key]=val;}}}return obj;};var parseObject=function(chain,val,options,valuesParsed){var currentArrayLength=0;if(chain.length>0&&chain[chain.length-1]==='[]'){var parentKey=chain.slice(0,-1).join('');currentArrayLength=Array.isArray(val)&&val[parentKey]?val[parentKey].length:0;}var leaf=valuesParsed?val:parseArrayValue(val,options,currentArrayLength);for(var i=chain.length-1;i>=0;--i){var obj;var root=chain[i];if(root==='[]'&&options.parseArrays){if(utils.isOverflow(leaf)){// leaf is already an overflow object, preserve it
|
|
13054
14104
|
obj=leaf;}else{obj=options.allowEmptyArrays&&(leaf===''||options.strictNullHandling&&leaf===null)?[]:utils.combine([],leaf,options.arrayLimit,options.plainObjects);}}else{obj=options.plainObjects?{__proto__:null}:{};var cleanRoot=root.charAt(0)==='['&&root.charAt(root.length-1)===']'?root.slice(1,-1):root;var decodedRoot=options.decodeDotInKeys?cleanRoot.replace(/%2E/g,'.'):cleanRoot;var index=parseInt(decodedRoot,10);var isValidArrayIndex=!isNaN(index)&&root!==decodedRoot&&String(index)===decodedRoot&&index>=0&&options.parseArrays;if(!options.parseArrays&&decodedRoot===''){obj={0:leaf};}else if(isValidArrayIndex&&index<options.arrayLimit){obj=[];obj[index]=leaf;}else if(isValidArrayIndex&&options.throwOnLimitExceeded){throw new RangeError('Array limit exceeded. Only '+options.arrayLimit+' element'+(options.arrayLimit===1?'':'s')+' allowed in an array.');}else if(isValidArrayIndex){obj[index]=leaf;utils.markOverflow(obj,index);}else if(decodedRoot!=='__proto__'){obj[decodedRoot]=leaf;}}leaf=obj;}return leaf;};var splitKeyIntoSegments=function splitKeyIntoSegments(givenKey,options){var key=options.allowDots?givenKey.replace(/\.([^.[]+)/g,'[$1]'):givenKey;if(options.depth<=0){if(!options.plainObjects&&has.call(Object.prototype,key)){if(!options.allowPrototypes){return;}}return[key];}var brackets=/(\[[^[\]]*])/;var child=/(\[[^[\]]*])/g;var segment=brackets.exec(key);var parent=segment?key.slice(0,segment.index):key;var keys=[];if(parent){if(!options.plainObjects&&has.call(Object.prototype,parent)){if(!options.allowPrototypes){return;}}keys[keys.length]=parent;}var i=0;while((segment=child.exec(key))!==null&&i<options.depth){i+=1;var segmentContent=segment[1].slice(1,-1);if(!options.plainObjects&&has.call(Object.prototype,segmentContent)){if(!options.allowPrototypes){return;}}keys[keys.length]=segment[1];}if(segment){if(options.strictDepth===true){throw new RangeError('Input depth exceeded depth option of '+options.depth+' and strictDepth is true');}keys[keys.length]='['+key.slice(segment.index)+']';}return keys;};var parseKeys=function parseQueryStringKeys(givenKey,val,options,valuesParsed){if(!givenKey){return;}var keys=splitKeyIntoSegments(givenKey,options);if(!keys){return;}return parseObject(keys,val,options,valuesParsed);};var normalizeParseOptions=function normalizeParseOptions(opts){if(!opts){return defaults;}if(typeof opts.allowEmptyArrays!=='undefined'&&typeof opts.allowEmptyArrays!=='boolean'){throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided');}if(typeof opts.decodeDotInKeys!=='undefined'&&typeof opts.decodeDotInKeys!=='boolean'){throw new TypeError('`decodeDotInKeys` option can only be `true` or `false`, when provided');}if(opts.decoder!==null&&typeof opts.decoder!=='undefined'&&typeof opts.decoder!=='function'){throw new TypeError('Decoder has to be a function.');}if(typeof opts.charset!=='undefined'&&opts.charset!=='utf-8'&&opts.charset!=='iso-8859-1'){throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');}if(typeof opts.throwOnLimitExceeded!=='undefined'&&typeof opts.throwOnLimitExceeded!=='boolean'){throw new TypeError('`throwOnLimitExceeded` option must be a boolean');}var charset=typeof opts.charset==='undefined'?defaults.charset:opts.charset;var duplicates=typeof opts.duplicates==='undefined'?defaults.duplicates:opts.duplicates;if(duplicates!=='combine'&&duplicates!=='first'&&duplicates!=='last'){throw new TypeError('The duplicates option must be either combine, first, or last');}var allowDots=typeof opts.allowDots==='undefined'?opts.decodeDotInKeys===true?true:defaults.allowDots:!!opts.allowDots;return{allowDots:allowDots,allowEmptyArrays:typeof opts.allowEmptyArrays==='boolean'?!!opts.allowEmptyArrays:defaults.allowEmptyArrays,allowPrototypes:typeof opts.allowPrototypes==='boolean'?opts.allowPrototypes:defaults.allowPrototypes,allowSparse:typeof opts.allowSparse==='boolean'?opts.allowSparse:defaults.allowSparse,arrayLimit:typeof opts.arrayLimit==='number'?opts.arrayLimit:defaults.arrayLimit,charset:charset,charsetSentinel:typeof opts.charsetSentinel==='boolean'?opts.charsetSentinel:defaults.charsetSentinel,comma:typeof opts.comma==='boolean'?opts.comma:defaults.comma,decodeDotInKeys:typeof opts.decodeDotInKeys==='boolean'?opts.decodeDotInKeys:defaults.decodeDotInKeys,decoder:typeof opts.decoder==='function'?opts.decoder:defaults.decoder,delimiter:typeof opts.delimiter==='string'||utils.isRegExp(opts.delimiter)?opts.delimiter:defaults.delimiter,// eslint-disable-next-line no-implicit-coercion, no-extra-parens
|
|
13055
14105
|
depth:typeof opts.depth==='number'||opts.depth===false?+opts.depth:defaults.depth,duplicates:duplicates,ignoreQueryPrefix:opts.ignoreQueryPrefix===true,interpretNumericEntities:typeof opts.interpretNumericEntities==='boolean'?opts.interpretNumericEntities:defaults.interpretNumericEntities,parameterLimit:typeof opts.parameterLimit==='number'?opts.parameterLimit:defaults.parameterLimit,parseArrays:opts.parseArrays!==false,plainObjects:typeof opts.plainObjects==='boolean'?opts.plainObjects:defaults.plainObjects,strictDepth:typeof opts.strictDepth==='boolean'?!!opts.strictDepth:defaults.strictDepth,strictMerge:typeof opts.strictMerge==='boolean'?!!opts.strictMerge:defaults.strictMerge,strictNullHandling:typeof opts.strictNullHandling==='boolean'?opts.strictNullHandling:defaults.strictNullHandling,throwOnLimitExceeded:typeof opts.throwOnLimitExceeded==='boolean'?opts.throwOnLimitExceeded:false};};module.exports=function(str,opts){var options=normalizeParseOptions(opts);if(str===''||str===null||typeof str==='undefined'){return options.plainObjects?{__proto__:null}:{};}var tempObj=typeof str==='string'?parseValues(str,options):str;var obj=options.plainObjects?{__proto__:null}:{};// Iterate over the keys and setup the new object
|
|
13056
|
-
var keys=Object.keys(tempObj);for(var i=0;i<keys.length;++i){var key=keys[i];var newObj=parseKeys(key,tempObj[key],options,typeof str==='string');obj=utils.merge(obj,newObj,options);}if(options.allowSparse===true){return obj;}return utils.compact(obj);};},{"./utils":
|
|
14106
|
+
var keys=Object.keys(tempObj);for(var i=0;i<keys.length;++i){var key=keys[i];var newObj=parseKeys(key,tempObj[key],options,typeof str==='string');obj=utils.merge(obj,newObj,options);}if(options.allowSparse===true){return obj;}return utils.compact(obj);};},{"./utils":318}],317:[function(require,module,exports){'use strict';var getSideChannel=require('side-channel');var utils=require('./utils');var formats=require('./formats');var has=Object.prototype.hasOwnProperty;var arrayPrefixGenerators={brackets:function brackets(prefix){return prefix+'[]';},comma:'comma',indices:function indices(prefix,key){return prefix+'['+key+']';},repeat:function repeat(prefix){return prefix;}};var isArray=Array.isArray;var push=Array.prototype.push;var pushToArray=function(arr,valueOrArray){push.apply(arr,isArray(valueOrArray)?valueOrArray:[valueOrArray]);};var toISO=Date.prototype.toISOString;var defaultFormat=formats['default'];var defaults={addQueryPrefix:false,allowDots:false,allowEmptyArrays:false,arrayFormat:'indices',charset:'utf-8',charsetSentinel:false,commaRoundTrip:false,delimiter:'&',encode:true,encodeDotInKeys:false,encoder:utils.encode,encodeValuesOnly:false,filter:void undefined,format:defaultFormat,formatter:formats.formatters[defaultFormat],// deprecated
|
|
13057
14107
|
indices:false,serializeDate:function serializeDate(date){return toISO.call(date);},skipNulls:false,strictNullHandling:false};var isNonNullishPrimitive=function isNonNullishPrimitive(v){return typeof v==='string'||typeof v==='number'||typeof v==='boolean'||typeof v==='symbol'||typeof v==='bigint';};var sentinel={};var stringify=function stringify(object,prefix,generateArrayPrefix,commaRoundTrip,allowEmptyArrays,strictNullHandling,skipNulls,encodeDotInKeys,encoder,filter,sort,allowDots,serializeDate,format,formatter,encodeValuesOnly,charset,sideChannel){var obj=object;var tmpSc=sideChannel;var step=0;var findFlag=false;while((tmpSc=tmpSc.get(sentinel))!==void undefined&&!findFlag){// Where object last appeared in the ref tree
|
|
13058
14108
|
var pos=tmpSc.get(object);step+=1;if(typeof pos!=='undefined'){if(pos===step){throw new RangeError('Cyclic object value');}else{findFlag=true;// Break while
|
|
13059
14109
|
}}if(typeof tmpSc.get(sentinel)==='undefined'){step=0;}}if(typeof filter==='function'){obj=filter(prefix,obj);}else if(obj instanceof Date){obj=serializeDate(obj);}else if(generateArrayPrefix==='comma'&&isArray(obj)){obj=utils.maybeMap(obj,function(value){if(value instanceof Date){return serializeDate(value);}return value;});}if(obj===null){if(strictNullHandling){return encoder&&!encodeValuesOnly?encoder(prefix,defaults.encoder,charset,'key',format):prefix;}obj='';}if(isNonNullishPrimitive(obj)||utils.isBuffer(obj)){if(encoder){var keyValue=encodeValuesOnly?prefix:encoder(prefix,defaults.encoder,charset,'key',format);return[formatter(keyValue)+'='+formatter(encoder(obj,defaults.encoder,charset,'value',format))];}return[formatter(prefix)+'='+formatter(String(obj))];}var values=[];if(typeof obj==='undefined'){return values;}var objKeys;if(generateArrayPrefix==='comma'&&isArray(obj)){// we need to join elements in
|
|
13060
14110
|
if(encodeValuesOnly&&encoder){obj=utils.maybeMap(obj,encoder);}objKeys=[{value:obj.length>0?obj.join(',')||null:void undefined}];}else if(isArray(filter)){objKeys=filter;}else{var keys=Object.keys(obj);objKeys=sort?keys.sort(sort):keys;}var encodedPrefix=encodeDotInKeys?String(prefix).replace(/\./g,'%2E'):String(prefix);var adjustedPrefix=commaRoundTrip&&isArray(obj)&&obj.length===1?encodedPrefix+'[]':encodedPrefix;if(allowEmptyArrays&&isArray(obj)&&obj.length===0){return adjustedPrefix+'[]';}for(var j=0;j<objKeys.length;++j){var key=objKeys[j];var value=typeof key==='object'&&key&&typeof key.value!=='undefined'?key.value:obj[key];if(skipNulls&&value===null){continue;}var encodedKey=allowDots&&encodeDotInKeys?String(key).replace(/\./g,'%2E'):String(key);var keyPrefix=isArray(obj)?typeof generateArrayPrefix==='function'?generateArrayPrefix(adjustedPrefix,encodedKey):adjustedPrefix:adjustedPrefix+(allowDots?'.'+encodedKey:'['+encodedKey+']');sideChannel.set(object,step);var valueSideChannel=getSideChannel();valueSideChannel.set(sentinel,sideChannel);pushToArray(values,stringify(value,keyPrefix,generateArrayPrefix,commaRoundTrip,allowEmptyArrays,strictNullHandling,skipNulls,encodeDotInKeys,generateArrayPrefix==='comma'&&encodeValuesOnly&&isArray(obj)?null:encoder,filter,sort,allowDots,serializeDate,format,formatter,encodeValuesOnly,charset,valueSideChannel));}return values;};var normalizeStringifyOptions=function normalizeStringifyOptions(opts){if(!opts){return defaults;}if(typeof opts.allowEmptyArrays!=='undefined'&&typeof opts.allowEmptyArrays!=='boolean'){throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided');}if(typeof opts.encodeDotInKeys!=='undefined'&&typeof opts.encodeDotInKeys!=='boolean'){throw new TypeError('`encodeDotInKeys` option can only be `true` or `false`, when provided');}if(opts.encoder!==null&&typeof opts.encoder!=='undefined'&&typeof opts.encoder!=='function'){throw new TypeError('Encoder has to be a function.');}var charset=opts.charset||defaults.charset;if(typeof opts.charset!=='undefined'&&opts.charset!=='utf-8'&&opts.charset!=='iso-8859-1'){throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');}var format=formats['default'];if(typeof opts.format!=='undefined'){if(!has.call(formats.formatters,opts.format)){throw new TypeError('Unknown format option provided.');}format=opts.format;}var formatter=formats.formatters[format];var filter=defaults.filter;if(typeof opts.filter==='function'||isArray(opts.filter)){filter=opts.filter;}var arrayFormat;if(opts.arrayFormat in arrayPrefixGenerators){arrayFormat=opts.arrayFormat;}else if('indices'in opts){arrayFormat=opts.indices?'indices':'repeat';}else{arrayFormat=defaults.arrayFormat;}if('commaRoundTrip'in opts&&typeof opts.commaRoundTrip!=='boolean'){throw new TypeError('`commaRoundTrip` must be a boolean, or absent');}var allowDots=typeof opts.allowDots==='undefined'?opts.encodeDotInKeys===true?true:defaults.allowDots:!!opts.allowDots;return{addQueryPrefix:typeof opts.addQueryPrefix==='boolean'?opts.addQueryPrefix:defaults.addQueryPrefix,allowDots:allowDots,allowEmptyArrays:typeof opts.allowEmptyArrays==='boolean'?!!opts.allowEmptyArrays:defaults.allowEmptyArrays,arrayFormat:arrayFormat,charset:charset,charsetSentinel:typeof opts.charsetSentinel==='boolean'?opts.charsetSentinel:defaults.charsetSentinel,commaRoundTrip:!!opts.commaRoundTrip,delimiter:typeof opts.delimiter==='undefined'?defaults.delimiter:opts.delimiter,encode:typeof opts.encode==='boolean'?opts.encode:defaults.encode,encodeDotInKeys:typeof opts.encodeDotInKeys==='boolean'?opts.encodeDotInKeys:defaults.encodeDotInKeys,encoder:typeof opts.encoder==='function'?opts.encoder:defaults.encoder,encodeValuesOnly:typeof opts.encodeValuesOnly==='boolean'?opts.encodeValuesOnly:defaults.encodeValuesOnly,filter:filter,format:format,formatter:formatter,serializeDate:typeof opts.serializeDate==='function'?opts.serializeDate:defaults.serializeDate,skipNulls:typeof opts.skipNulls==='boolean'?opts.skipNulls:defaults.skipNulls,sort:typeof opts.sort==='function'?opts.sort:null,strictNullHandling:typeof opts.strictNullHandling==='boolean'?opts.strictNullHandling:defaults.strictNullHandling};};module.exports=function(object,opts){var obj=object;var options=normalizeStringifyOptions(opts);var objKeys;var filter;if(typeof options.filter==='function'){filter=options.filter;obj=filter('',obj);}else if(isArray(options.filter)){filter=options.filter;objKeys=filter;}var keys=[];if(typeof obj!=='object'||obj===null){return'';}var generateArrayPrefix=arrayPrefixGenerators[options.arrayFormat];var commaRoundTrip=generateArrayPrefix==='comma'&&options.commaRoundTrip;if(!objKeys){objKeys=Object.keys(obj);}if(options.sort){objKeys.sort(options.sort);}var sideChannel=getSideChannel();for(var i=0;i<objKeys.length;++i){var key=objKeys[i];var value=obj[key];if(options.skipNulls&&value===null){continue;}pushToArray(keys,stringify(value,key,generateArrayPrefix,commaRoundTrip,options.allowEmptyArrays,options.strictNullHandling,options.skipNulls,options.encodeDotInKeys,options.encode?options.encoder:null,options.filter,options.sort,options.allowDots,options.serializeDate,options.format,options.formatter,options.encodeValuesOnly,options.charset,sideChannel));}var joined=keys.join(options.delimiter);var prefix=options.addQueryPrefix===true?'?':'';if(options.charsetSentinel){if(options.charset==='iso-8859-1'){// encodeURIComponent('✓'), the "numeric entity" representation of a checkmark
|
|
13061
14111
|
prefix+='utf8=%26%2310003%3B&';}else{// encodeURIComponent('✓')
|
|
13062
|
-
prefix+='utf8=%E2%9C%93&';}}return joined.length>0?prefix+joined:'';};},{"./formats":
|
|
14112
|
+
prefix+='utf8=%E2%9C%93&';}}return joined.length>0?prefix+joined:'';};},{"./formats":314,"./utils":318,"side-channel":326}],318:[function(require,module,exports){'use strict';var formats=require('./formats');var getSideChannel=require('side-channel');var has=Object.prototype.hasOwnProperty;var isArray=Array.isArray;// Track objects created from arrayLimit overflow using side-channel
|
|
13063
14113
|
// Stores the current max numeric index for O(1) lookup
|
|
13064
14114
|
var overflowChannel=getSideChannel();var markOverflow=function markOverflow(obj,maxIndex){overflowChannel.set(obj,maxIndex);return obj;};var isOverflow=function isOverflow(obj){return overflowChannel.has(obj);};var getMaxIndex=function getMaxIndex(obj){return overflowChannel.get(obj);};var setMaxIndex=function setMaxIndex(obj,maxIndex){overflowChannel.set(obj,maxIndex);};var hexTable=function(){var array=[];for(var i=0;i<256;++i){array[array.length]='%'+((i<16?'0':'')+i.toString(16)).toUpperCase();}return array;}();var compactQueue=function compactQueue(queue){while(queue.length>1){var item=queue.pop();var obj=item.obj[item.prop];if(isArray(obj)){var compacted=[];for(var j=0;j<obj.length;++j){if(typeof obj[j]!=='undefined'){compacted[compacted.length]=obj[j];}}item.obj[item.prop]=compacted;}}};var arrayToObject=function arrayToObject(source,options){var obj=options&&options.plainObjects?{__proto__:null}:{};for(var i=0;i<source.length;++i){if(typeof source[i]!=='undefined'){obj[i]=source[i];}}return obj;};var merge=function merge(target,source,options){/* eslint no-param-reassign: 0 */if(!source){return target;}if(typeof source!=='object'&&typeof source!=='function'){if(isArray(target)){var nextIndex=target.length;if(options&&typeof options.arrayLimit==='number'&&nextIndex>options.arrayLimit){return markOverflow(arrayToObject(target.concat(source),options),nextIndex);}target[nextIndex]=source;}else if(target&&typeof target==='object'){if(isOverflow(target)){// Add at next numeric index for overflow objects
|
|
13065
14115
|
var newIndex=getMaxIndex(target)+1;target[newIndex]=source;setMaxIndex(target,newIndex);}else if(options&&options.strictMerge){return[target,source];}else if(options&&(options.plainObjects||options.allowPrototypes)||!has.call(Object.prototype,source)){target[source]=true;}}else{return[target,source];}return target;}if(!target||typeof target!=='object'){if(isOverflow(source)){// Create new object with target at 0, source values shifted by 1
|
|
@@ -13076,7 +14126,7 @@ if(str.length===0){return str;}var string=str;if(typeof str==='symbol'){string=S
|
|
|
13076
14126
|
||c>=0x61&&c<=0x7A// A-Z
|
|
13077
14127
|
||format===formats.RFC1738&&(c===0x28||c===0x29)// ( )
|
|
13078
14128
|
){arr[arr.length]=segment.charAt(i);continue;}if(c<0x80){arr[arr.length]=hexTable[c];continue;}if(c<0x800){arr[arr.length]=hexTable[0xC0|c>>6]+hexTable[0x80|c&0x3F];continue;}if(c<0xD800||c>=0xE000){arr[arr.length]=hexTable[0xE0|c>>12]+hexTable[0x80|c>>6&0x3F]+hexTable[0x80|c&0x3F];continue;}i+=1;c=0x10000+((c&0x3FF)<<10|segment.charCodeAt(i)&0x3FF);arr[arr.length]=hexTable[0xF0|c>>18]+hexTable[0x80|c>>12&0x3F]+hexTable[0x80|c>>6&0x3F]+hexTable[0x80|c&0x3F];}out+=arr.join('');}return out;};var compact=function compact(value){var queue=[{obj:{o:value},prop:'o'}];var refs=[];for(var i=0;i<queue.length;++i){var item=queue[i];var obj=item.obj[item.prop];var keys=Object.keys(obj);for(var j=0;j<keys.length;++j){var key=keys[j];var val=obj[key];if(typeof val==='object'&&val!==null&&refs.indexOf(val)===-1){queue[queue.length]={obj:obj,prop:key};refs[refs.length]=val;}}}compactQueue(queue);return value;};var isRegExp=function isRegExp(obj){return Object.prototype.toString.call(obj)==='[object RegExp]';};var isBuffer=function isBuffer(obj){if(!obj||typeof obj!=='object'){return false;}return!!(obj.constructor&&obj.constructor.isBuffer&&obj.constructor.isBuffer(obj));};var combine=function combine(a,b,arrayLimit,plainObjects){// If 'a' is already an overflow object, add to it
|
|
13079
|
-
if(isOverflow(a)){var newIndex=getMaxIndex(a)+1;a[newIndex]=b;setMaxIndex(a,newIndex);return a;}var result=[].concat(a,b);if(result.length>arrayLimit){return markOverflow(arrayToObject(result,{plainObjects:plainObjects}),result.length-1);}return result;};var maybeMap=function maybeMap(val,fn){if(isArray(val)){var mapped=[];for(var i=0;i<val.length;i+=1){mapped[mapped.length]=fn(val[i]);}return mapped;}return fn(val);};module.exports={arrayToObject:arrayToObject,assign:assign,combine:combine,compact:compact,decode:decode,encode:encode,isBuffer:isBuffer,isOverflow:isOverflow,isRegExp:isRegExp,markOverflow:markOverflow,maybeMap:maybeMap,merge:merge};},{"./formats":
|
|
14129
|
+
if(isOverflow(a)){var newIndex=getMaxIndex(a)+1;a[newIndex]=b;setMaxIndex(a,newIndex);return a;}var result=[].concat(a,b);if(result.length>arrayLimit){return markOverflow(arrayToObject(result,{plainObjects:plainObjects}),result.length-1);}return result;};var maybeMap=function maybeMap(val,fn){if(isArray(val)){var mapped=[];for(var i=0;i<val.length;i+=1){mapped[mapped.length]=fn(val[i]);}return mapped;}return fn(val);};module.exports={arrayToObject:arrayToObject,assign:assign,combine:combine,compact:compact,decode:decode,encode:encode,isBuffer:isBuffer,isOverflow:isOverflow,isRegExp:isRegExp,markOverflow:markOverflow,maybeMap:maybeMap,merge:merge};},{"./formats":314,"side-channel":326}],319:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
|
|
13080
14130
|
//
|
|
13081
14131
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
13082
14132
|
// copy of this software and associated documentation files (the
|
|
@@ -13100,7 +14150,7 @@ if(isOverflow(a)){var newIndex=getMaxIndex(a)+1;a[newIndex]=b;setMaxIndex(a,newI
|
|
|
13100
14150
|
// obj.hasOwnProperty(prop) will break.
|
|
13101
14151
|
// See: https://github.com/joyent/node/issues/1707
|
|
13102
14152
|
function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop);}module.exports=function(qs,sep,eq,options){sep=sep||'&';eq=eq||'=';var obj={};if(typeof qs!=='string'||qs.length===0){return obj;}var regexp=/\+/g;qs=qs.split(sep);var maxKeys=1000;if(options&&typeof options.maxKeys==='number'){maxKeys=options.maxKeys;}var len=qs.length;// maxKeys <= 0 means that we should not limit keys count
|
|
13103
|
-
if(maxKeys>0&&len>maxKeys){len=maxKeys;}for(var i=0;i<len;++i){var x=qs[i].replace(regexp,'%20'),idx=x.indexOf(eq),kstr,vstr,k,v;if(idx>=0){kstr=x.substr(0,idx);vstr=x.substr(idx+1);}else{kstr=x;vstr='';}k=decodeURIComponent(kstr);v=decodeURIComponent(vstr);if(!hasOwnProperty(obj,k)){obj[k]=v;}else if(isArray(obj[k])){obj[k].push(v);}else{obj[k]=[obj[k],v];}}return obj;};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==='[object Array]';};},{}],
|
|
14153
|
+
if(maxKeys>0&&len>maxKeys){len=maxKeys;}for(var i=0;i<len;++i){var x=qs[i].replace(regexp,'%20'),idx=x.indexOf(eq),kstr,vstr,k,v;if(idx>=0){kstr=x.substr(0,idx);vstr=x.substr(idx+1);}else{kstr=x;vstr='';}k=decodeURIComponent(kstr);v=decodeURIComponent(vstr);if(!hasOwnProperty(obj,k)){obj[k]=v;}else if(isArray(obj[k])){obj[k].push(v);}else{obj[k]=[obj[k],v];}}return obj;};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==='[object Array]';};},{}],320:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
|
|
13104
14154
|
//
|
|
13105
14155
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
13106
14156
|
// copy of this software and associated documentation files (the
|
|
@@ -13120,10 +14170,10 @@ if(maxKeys>0&&len>maxKeys){len=maxKeys;}for(var i=0;i<len;++i){var x=qs[i].repla
|
|
|
13120
14170
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
13121
14171
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
13122
14172
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
13123
|
-
'use strict';var stringifyPrimitive=function(v){switch(typeof v){case'string':return v;case'boolean':return v?'true':'false';case'number':return isFinite(v)?v:'';default:return'';}};module.exports=function(obj,sep,eq,name){sep=sep||'&';eq=eq||'=';if(obj===null){obj=undefined;}if(typeof obj==='object'){return map(objectKeys(obj),function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;if(isArray(obj[k])){return map(obj[k],function(v){return ks+encodeURIComponent(stringifyPrimitive(v));}).join(sep);}else{return ks+encodeURIComponent(stringifyPrimitive(obj[k]));}}).join(sep);}if(!name)return'';return encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj));};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==='[object Array]';};function map(xs,f){if(xs.map)return xs.map(f);var res=[];for(var i=0;i<xs.length;i++){res.push(f(xs[i],i));}return res;}var objectKeys=Object.keys||function(obj){var res=[];for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))res.push(key);}return res;};},{}],
|
|
14173
|
+
'use strict';var stringifyPrimitive=function(v){switch(typeof v){case'string':return v;case'boolean':return v?'true':'false';case'number':return isFinite(v)?v:'';default:return'';}};module.exports=function(obj,sep,eq,name){sep=sep||'&';eq=eq||'=';if(obj===null){obj=undefined;}if(typeof obj==='object'){return map(objectKeys(obj),function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;if(isArray(obj[k])){return map(obj[k],function(v){return ks+encodeURIComponent(stringifyPrimitive(v));}).join(sep);}else{return ks+encodeURIComponent(stringifyPrimitive(obj[k]));}}).join(sep);}if(!name)return'';return encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj));};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==='[object Array]';};function map(xs,f){if(xs.map)return xs.map(f);var res=[];for(var i=0;i<xs.length;i++){res.push(f(xs[i],i));}return res;}var objectKeys=Object.keys||function(obj){var res=[];for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))res.push(key);}return res;};},{}],321:[function(require,module,exports){'use strict';exports.decode=exports.parse=require('./decode');exports.encode=exports.stringify=require('./encode');},{"./decode":319,"./encode":320}],322:[function(require,module,exports){/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *//* eslint-disable node/no-deprecated-api */var buffer=require('buffer');var Buffer=buffer.Buffer;// alternative to using Object.keys for old browsers
|
|
13124
14174
|
function copyProps(src,dst){for(var key in src){dst[key]=src[key];}}if(Buffer.from&&Buffer.alloc&&Buffer.allocUnsafe&&Buffer.allocUnsafeSlow){module.exports=buffer;}else{// Copy properties from require('buffer')
|
|
13125
14175
|
copyProps(buffer,exports);exports.Buffer=SafeBuffer;}function SafeBuffer(arg,encodingOrOffset,length){return Buffer(arg,encodingOrOffset,length);}SafeBuffer.prototype=Object.create(Buffer.prototype);// Copy static methods from Buffer
|
|
13126
|
-
copyProps(Buffer,SafeBuffer);SafeBuffer.from=function(arg,encodingOrOffset,length){if(typeof arg==='number'){throw new TypeError('Argument must not be a number');}return Buffer(arg,encodingOrOffset,length);};SafeBuffer.alloc=function(size,fill,encoding){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}var buf=Buffer(size);if(fill!==undefined){if(typeof encoding==='string'){buf.fill(fill,encoding);}else{buf.fill(fill);}}else{buf.fill(0);}return buf;};SafeBuffer.allocUnsafe=function(size){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}return Buffer(size);};SafeBuffer.allocUnsafeSlow=function(size){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}return buffer.SlowBuffer(size);};},{"buffer":21}],
|
|
14176
|
+
copyProps(Buffer,SafeBuffer);SafeBuffer.from=function(arg,encodingOrOffset,length){if(typeof arg==='number'){throw new TypeError('Argument must not be a number');}return Buffer(arg,encodingOrOffset,length);};SafeBuffer.alloc=function(size,fill,encoding){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}var buf=Buffer(size);if(fill!==undefined){if(typeof encoding==='string'){buf.fill(fill,encoding);}else{buf.fill(fill);}}else{buf.fill(0);}return buf;};SafeBuffer.allocUnsafe=function(size){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}return Buffer(size);};SafeBuffer.allocUnsafeSlow=function(size){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}return buffer.SlowBuffer(size);};},{"buffer":21}],323:[function(require,module,exports){'use strict';var inspect=require('object-inspect');var $TypeError=require('es-errors/type');/*
|
|
13127
14177
|
* This function traverses the list returning the node corresponding to the given key.
|
|
13128
14178
|
*
|
|
13129
14179
|
* That node is also moved to the head of the list, so that if it's accessed again we don't need to traverse the whole list.
|
|
@@ -13138,13 +14188,13 @@ key:key,next:objects.next,value:value};}};/** @type {import('./list.d.ts').listH
|
|
|
13138
14188
|
var listDelete=function(objects,key){if(objects){return listGetNode(objects,key,true);}};/** @type {import('.')} */module.exports=function getSideChannelList(){/** @typedef {ReturnType<typeof getSideChannelList>} Channel *//** @typedef {Parameters<Channel['get']>[0]} K *//** @typedef {Parameters<Channel['set']>[1]} V *//** @type {import('./list.d.ts').RootNode<V, K> | undefined} */var $o;/** @type {Channel} */var channel={assert:function(key){if(!channel.has(key)){throw new $TypeError('Side channel does not contain '+inspect(key));}},'delete':function(key){var root=$o&&$o.next;var deletedNode=listDelete($o,key);if(deletedNode&&root&&root===deletedNode){$o=void undefined;}return!!deletedNode;},get:function(key){return listGet($o,key);},has:function(key){return listHas($o,key);},set:function(key,value){if(!$o){// Initialize the linked list as an empty node, so that we don't have to special-case handling of the first node: we can always refer to it as (previous node).next, instead of something like (list).head
|
|
13139
14189
|
$o={next:void undefined};}// eslint-disable-next-line no-extra-parens
|
|
13140
14190
|
listSet(/** @type {NonNullable<typeof $o>} */$o,key,value);}};// @ts-expect-error TODO: figure out why this is erroring
|
|
13141
|
-
return channel;};},{"es-errors/type":48,"object-inspect":138}],
|
|
14191
|
+
return channel;};},{"es-errors/type":48,"object-inspect":138}],324:[function(require,module,exports){'use strict';var GetIntrinsic=require('get-intrinsic');var callBound=require('call-bound');var inspect=require('object-inspect');var $TypeError=require('es-errors/type');var $Map=GetIntrinsic('%Map%',true);/** @type {<K, V>(thisArg: Map<K, V>, key: K) => V} */var $mapGet=callBound('Map.prototype.get',true);/** @type {<K, V>(thisArg: Map<K, V>, key: K, value: V) => void} */var $mapSet=callBound('Map.prototype.set',true);/** @type {<K, V>(thisArg: Map<K, V>, key: K) => boolean} */var $mapHas=callBound('Map.prototype.has',true);/** @type {<K, V>(thisArg: Map<K, V>, key: K) => boolean} */var $mapDelete=callBound('Map.prototype.delete',true);/** @type {<K, V>(thisArg: Map<K, V>) => number} */var $mapSize=callBound('Map.prototype.size',true);/** @type {import('.')} */module.exports=!!$Map&&/** @type {Exclude<import('.'), false>} */function getSideChannelMap(){/** @typedef {ReturnType<typeof getSideChannelMap>} Channel *//** @typedef {Parameters<Channel['get']>[0]} K *//** @typedef {Parameters<Channel['set']>[1]} V *//** @type {Map<K, V> | undefined} */var $m;/** @type {Channel} */var channel={assert:function(key){if(!channel.has(key)){throw new $TypeError('Side channel does not contain '+inspect(key));}},'delete':function(key){if($m){var result=$mapDelete($m,key);if($mapSize($m)===0){$m=void undefined;}return result;}return false;},get:function(key){// eslint-disable-line consistent-return
|
|
13142
14192
|
if($m){return $mapGet($m,key);}},has:function(key){if($m){return $mapHas($m,key);}return false;},set:function(key,value){if(!$m){// @ts-expect-error TS can't handle narrowing a variable inside a closure
|
|
13143
14193
|
$m=new $Map();}$mapSet($m,key,value);}};// @ts-expect-error TODO: figure out why TS is erroring here
|
|
13144
|
-
return channel;};},{"call-bound":31,"es-errors/type":48,"get-intrinsic":105,"object-inspect":138}],
|
|
14194
|
+
return channel;};},{"call-bound":31,"es-errors/type":48,"get-intrinsic":105,"object-inspect":138}],325:[function(require,module,exports){'use strict';var GetIntrinsic=require('get-intrinsic');var callBound=require('call-bound');var inspect=require('object-inspect');var getSideChannelMap=require('side-channel-map');var $TypeError=require('es-errors/type');var $WeakMap=GetIntrinsic('%WeakMap%',true);/** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K) => V} */var $weakMapGet=callBound('WeakMap.prototype.get',true);/** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K, value: V) => void} */var $weakMapSet=callBound('WeakMap.prototype.set',true);/** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K) => boolean} */var $weakMapHas=callBound('WeakMap.prototype.has',true);/** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K) => boolean} */var $weakMapDelete=callBound('WeakMap.prototype.delete',true);/** @type {import('.')} */module.exports=$WeakMap?/** @type {Exclude<import('.'), false>} */function getSideChannelWeakMap(){/** @typedef {ReturnType<typeof getSideChannelWeakMap>} Channel *//** @typedef {Parameters<Channel['get']>[0]} K *//** @typedef {Parameters<Channel['set']>[1]} V *//** @type {WeakMap<K & object, V> | undefined} */var $wm;/** @type {Channel | undefined} */var $m;/** @type {Channel} */var channel={assert:function(key){if(!channel.has(key)){throw new $TypeError('Side channel does not contain '+inspect(key));}},'delete':function(key){if($WeakMap&&key&&(typeof key==='object'||typeof key==='function')){if($wm){return $weakMapDelete($wm,key);}}else if(getSideChannelMap){if($m){return $m['delete'](key);}}return false;},get:function(key){if($WeakMap&&key&&(typeof key==='object'||typeof key==='function')){if($wm){return $weakMapGet($wm,key);}}return $m&&$m.get(key);},has:function(key){if($WeakMap&&key&&(typeof key==='object'||typeof key==='function')){if($wm){return $weakMapHas($wm,key);}}return!!$m&&$m.has(key);},set:function(key,value){if($WeakMap&&key&&(typeof key==='object'||typeof key==='function')){if(!$wm){$wm=new $WeakMap();}$weakMapSet($wm,key,value);}else if(getSideChannelMap){if(!$m){$m=getSideChannelMap();}// eslint-disable-next-line no-extra-parens
|
|
13145
14195
|
/** @type {NonNullable<typeof $m>} */$m.set(key,value);}}};// @ts-expect-error TODO: figure out why this is erroring
|
|
13146
|
-
return channel;}:getSideChannelMap;},{"call-bound":31,"es-errors/type":48,"get-intrinsic":105,"object-inspect":138,"side-channel-map":
|
|
13147
|
-
return channel;};},{"es-errors/type":48,"object-inspect":138,"side-channel-list":
|
|
14196
|
+
return channel;}:getSideChannelMap;},{"call-bound":31,"es-errors/type":48,"get-intrinsic":105,"object-inspect":138,"side-channel-map":324}],326:[function(require,module,exports){'use strict';var $TypeError=require('es-errors/type');var inspect=require('object-inspect');var getSideChannelList=require('side-channel-list');var getSideChannelMap=require('side-channel-map');var getSideChannelWeakMap=require('side-channel-weakmap');var makeChannel=getSideChannelWeakMap||getSideChannelMap||getSideChannelList;/** @type {import('.')} */module.exports=function getSideChannel(){/** @typedef {ReturnType<typeof getSideChannel>} Channel *//** @type {Channel | undefined} */var $channelData;/** @type {Channel} */var channel={assert:function(key){if(!channel.has(key)){throw new $TypeError('Side channel does not contain '+inspect(key));}},'delete':function(key){return!!$channelData&&$channelData['delete'](key);},get:function(key){return $channelData&&$channelData.get(key);},has:function(key){return!!$channelData&&$channelData.has(key);},set:function(key,value){if(!$channelData){$channelData=makeChannel();}$channelData.set(key,value);}};// @ts-expect-error TODO: figure out why this is erroring
|
|
14197
|
+
return channel;};},{"es-errors/type":48,"object-inspect":138,"side-channel-list":323,"side-channel-map":324,"side-channel-weakmap":325}],327:[function(require,module,exports){(function(Buffer){(function(){/*! simple-concat. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */module.exports=function(stream,cb){var chunks=[];stream.on('data',function(chunk){chunks.push(chunk);});stream.once('end',function(){if(cb)cb(null,Buffer.concat(chunks));cb=null;});stream.once('error',function(err){if(cb)cb(err);cb=null;});};}).call(this);}).call(this,require("buffer").Buffer);},{"buffer":21}],328:[function(require,module,exports){(function(Buffer){(function(){/*! simple-get. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */module.exports=simpleGet;const concat=require('simple-concat');const decompressResponse=require('decompress-response');// excluded from browser build
|
|
13148
14198
|
const http=require('http');const https=require('https');const once=require('once');const querystring=require('querystring');const url=require('url');const isStream=o=>o!==null&&typeof o==='object'&&typeof o.pipe==='function';function simpleGet(opts,cb){opts=Object.assign({maxRedirects:10},typeof opts==='string'?{url:opts}:opts);cb=once(cb);if(opts.url){const{hostname,port,protocol,auth,path}=url.parse(opts.url);// eslint-disable-line node/no-deprecated-api
|
|
13149
14199
|
delete opts.url;if(!hostname&&!port&&!protocol&&!auth)opts.path=path;// Relative redirect
|
|
13150
14200
|
else Object.assign(opts,{hostname,port,protocol,auth,path});// Absolute redirect
|
|
@@ -13156,13 +14206,13 @@ res.resume();// Discard response
|
|
|
13156
14206
|
const redirectHost=url.parse(opts.url).hostname;// eslint-disable-line node/no-deprecated-api
|
|
13157
14207
|
// If redirected host is different than original host, drop headers to prevent cookie leak (#73)
|
|
13158
14208
|
if(redirectHost!==null&&redirectHost!==originalHost){delete opts.headers.cookie;delete opts.headers.authorization;}if(opts.method==='POST'&&[301,302].includes(res.statusCode)){opts.method='GET';// On 301/302 redirect, change POST to GET (see #35)
|
|
13159
|
-
delete opts.headers['content-length'];delete opts.headers['content-type'];}if(opts.maxRedirects--===0)return cb(new Error('too many redirects'));else return simpleGet(opts,cb);}const tryUnzip=typeof decompressResponse==='function'&&opts.method!=='HEAD';cb(null,tryUnzip?decompressResponse(res):res);});req.on('timeout',()=>{req.abort();cb(new Error('Request timed out'));});req.on('error',cb);if(isStream(body))body.on('error',cb).pipe(req);else req.end(body);return req;}simpleGet.concat=(opts,cb)=>{return simpleGet(opts,(err,res)=>{if(err)return cb(err);concat(res,(err,data)=>{if(err)return cb(err);if(opts.json){try{data=JSON.parse(data.toString());}catch(err){return cb(err,res,data);}}cb(null,res,data);});});};['get','post','put','patch','head','delete'].forEach(method=>{simpleGet[method]=(opts,cb)=>{if(typeof opts==='string')opts={url:opts};return simpleGet(Object.assign({method:method.toUpperCase()},opts),cb);};});}).call(this);}).call(this,require("buffer").Buffer);},{"buffer":21,"decompress-response":19,"http":
|
|
14209
|
+
delete opts.headers['content-length'];delete opts.headers['content-type'];}if(opts.maxRedirects--===0)return cb(new Error('too many redirects'));else return simpleGet(opts,cb);}const tryUnzip=typeof decompressResponse==='function'&&opts.method!=='HEAD';cb(null,tryUnzip?decompressResponse(res):res);});req.on('timeout',()=>{req.abort();cb(new Error('Request timed out'));});req.on('error',cb);if(isStream(body))body.on('error',cb).pipe(req);else req.end(body);return req;}simpleGet.concat=(opts,cb)=>{return simpleGet(opts,(err,res)=>{if(err)return cb(err);concat(res,(err,data)=>{if(err)return cb(err);if(opts.json){try{data=JSON.parse(data.toString());}catch(err){return cb(err,res,data);}}cb(null,res,data);});});};['get','post','put','patch','head','delete'].forEach(method=>{simpleGet[method]=(opts,cb)=>{if(typeof opts==='string')opts={url:opts};return simpleGet(Object.assign({method:method.toUpperCase()},opts),cb);};});}).call(this);}).call(this,require("buffer").Buffer);},{"buffer":21,"decompress-response":19,"http":329,"https":114,"once":139,"querystring":321,"simple-concat":327,"url":350}],329:[function(require,module,exports){(function(global){(function(){var ClientRequest=require('./lib/request');var response=require('./lib/response');var extend=require('xtend');var statusCodes=require('builtin-status-codes');var url=require('url');var http=exports;http.request=function(opts,cb){if(typeof opts==='string')opts=url.parse(opts);else opts=extend(opts);// Normally, the page is loaded from http or https, so not specifying a protocol
|
|
13160
14210
|
// will result in a (valid) protocol-relative url. However, this won't work if
|
|
13161
14211
|
// the protocol is something else, like 'file:'
|
|
13162
14212
|
var defaultProtocol=global.location.protocol.search(/^https?:$/)===-1?'http:':'';var protocol=opts.protocol||defaultProtocol;var host=opts.hostname||opts.host;var port=opts.port;var path=opts.path||'/';// Necessary for IPv6 addresses
|
|
13163
14213
|
if(host&&host.indexOf(':')!==-1)host='['+host+']';// This may be a relative url. The browser should always be able to interpret it correctly.
|
|
13164
14214
|
opts.url=(host?protocol+'//'+host:'')+(port?':'+port:'')+path;opts.method=(opts.method||'GET').toUpperCase();opts.headers=opts.headers||{};// Also valid opts.auth, opts.mode
|
|
13165
|
-
var req=new ClientRequest(opts);if(cb)req.on('response',cb);return req;};http.get=function get(opts,cb){var req=http.request(opts,cb);req.end();return req;};http.ClientRequest=ClientRequest;http.IncomingMessage=response.IncomingMessage;http.Agent=function(){};http.Agent.defaultMaxSockets=4;http.globalAgent=new http.Agent();http.STATUS_CODES=statusCodes;http.METHODS=['CHECKOUT','CONNECT','COPY','DELETE','GET','HEAD','LOCK','M-SEARCH','MERGE','MKACTIVITY','MKCOL','MOVE','NOTIFY','OPTIONS','PATCH','POST','PROPFIND','PROPPATCH','PURGE','PUT','REPORT','SEARCH','SUBSCRIBE','TRACE','UNLOCK','UNSUBSCRIBE'];}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"./lib/request":
|
|
14215
|
+
var req=new ClientRequest(opts);if(cb)req.on('response',cb);return req;};http.get=function get(opts,cb){var req=http.request(opts,cb);req.end();return req;};http.ClientRequest=ClientRequest;http.IncomingMessage=response.IncomingMessage;http.Agent=function(){};http.Agent.defaultMaxSockets=4;http.globalAgent=new http.Agent();http.STATUS_CODES=statusCodes;http.METHODS=['CHECKOUT','CONNECT','COPY','DELETE','GET','HEAD','LOCK','M-SEARCH','MERGE','MKACTIVITY','MKCOL','MOVE','NOTIFY','OPTIONS','PATCH','POST','PROPFIND','PROPPATCH','PURGE','PUT','REPORT','SEARCH','SUBSCRIBE','TRACE','UNLOCK','UNSUBSCRIBE'];}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"./lib/request":331,"./lib/response":332,"builtin-status-codes":22,"url":350,"xtend":353}],330:[function(require,module,exports){(function(global){(function(){exports.fetch=isFunction(global.fetch)&&isFunction(global.ReadableStream);exports.writableStream=isFunction(global.WritableStream);exports.abortController=isFunction(global.AbortController);// The xhr request to example.com may violate some restrictive CSP configurations,
|
|
13166
14216
|
// so if we're running in a browser that supports `fetch`, avoid calling getXHR()
|
|
13167
14217
|
// and assume support for certain features below.
|
|
13168
14218
|
var xhr;function getXHR(){// Cache the xhr value
|
|
@@ -13177,7 +14227,7 @@ exports.arraybuffer=exports.fetch||checkTypeSupport('arraybuffer');// These next
|
|
|
13177
14227
|
exports.msstream=!exports.fetch&&checkTypeSupport('ms-stream');exports.mozchunkedarraybuffer=!exports.fetch&&checkTypeSupport('moz-chunked-arraybuffer');// If fetch is supported, then overrideMimeType will be supported too. Skip calling
|
|
13178
14228
|
// getXHR().
|
|
13179
14229
|
exports.overrideMimeType=exports.fetch||(getXHR()?isFunction(getXHR().overrideMimeType):false);function isFunction(value){return typeof value==='function';}xhr=null;// Help gc
|
|
13180
|
-
}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],
|
|
14230
|
+
}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],331:[function(require,module,exports){(function(process,global,Buffer){(function(){var capability=require('./capability');var inherits=require('inherits');var response=require('./response');var stream=require('readable-stream');var IncomingMessage=response.IncomingMessage;var rStates=response.readyStates;function decideMode(preferBinary,useFetch){if(capability.fetch&&useFetch){return'fetch';}else if(capability.mozchunkedarraybuffer){return'moz-chunked-arraybuffer';}else if(capability.msstream){return'ms-stream';}else if(capability.arraybuffer&&preferBinary){return'arraybuffer';}else{return'text';}}var ClientRequest=module.exports=function(opts){var self=this;stream.Writable.call(self);self._opts=opts;self._body=[];self._headers={};if(opts.auth)self.setHeader('Authorization','Basic '+Buffer.from(opts.auth).toString('base64'));Object.keys(opts.headers).forEach(function(name){self.setHeader(name,opts.headers[name]);});var preferBinary;var useFetch=true;if(opts.mode==='disable-fetch'||'requestTimeout'in opts&&!capability.abortController){// If the use of XHR should be preferred. Not typically needed.
|
|
13181
14231
|
useFetch=false;preferBinary=true;}else if(opts.mode==='prefer-streaming'){// If streaming is a high priority but binary compatibility and
|
|
13182
14232
|
// the accuracy of the 'content-type' header aren't
|
|
13183
14233
|
preferBinary=false;}else if(opts.mode==='allow-wrong-content-type'){// If streaming is more important than preserving the 'content-type' header
|
|
@@ -13194,7 +14244,7 @@ if(self._mode==='moz-chunked-arraybuffer'){xhr.onprogress=function(){self._onXHR
|
|
|
13194
14244
|
* Even though the spec says it should be available in readyState 3,
|
|
13195
14245
|
* accessing it throws an exception in IE8
|
|
13196
14246
|
*/function statusValid(xhr){try{var status=xhr.status;return status!==null&&status!==0;}catch(e){return false;}}ClientRequest.prototype._onXHRProgress=function(){var self=this;self._resetTimers(false);if(!statusValid(self._xhr)||self._destroyed)return;if(!self._response)self._connect();self._response._onXHRProgress(self._resetTimers.bind(self));};ClientRequest.prototype._connect=function(){var self=this;if(self._destroyed)return;self._response=new IncomingMessage(self._xhr,self._fetchResponse,self._mode,self._resetTimers.bind(self));self._response.on('error',function(err){self.emit('error',err);});self.emit('response',self._response);};ClientRequest.prototype._write=function(chunk,encoding,cb){var self=this;self._body.push(chunk);cb();};ClientRequest.prototype._resetTimers=function(done){var self=this;global.clearTimeout(self._socketTimer);self._socketTimer=null;if(done){global.clearTimeout(self._fetchTimer);self._fetchTimer=null;}else if(self._socketTimeout){self._socketTimer=global.setTimeout(function(){self.emit('timeout');},self._socketTimeout);}};ClientRequest.prototype.abort=ClientRequest.prototype.destroy=function(err){var self=this;self._destroyed=true;self._resetTimers(true);if(self._response)self._response._destroyed=true;if(self._xhr)self._xhr.abort();else if(self._fetchAbortController)self._fetchAbortController.abort();if(err)self.emit('error',err);};ClientRequest.prototype.end=function(data,encoding,cb){var self=this;if(typeof data==='function'){cb=data;data=undefined;}stream.Writable.prototype.end.call(self,data,encoding,cb);};ClientRequest.prototype.setTimeout=function(timeout,cb){var self=this;if(cb)self.once('timeout',cb);self._socketTimeout=timeout;self._resetTimers(false);};ClientRequest.prototype.flushHeaders=function(){};ClientRequest.prototype.setNoDelay=function(){};ClientRequest.prototype.setSocketKeepAlive=function(){};// Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method
|
|
13197
|
-
var unsafeHeaders=['accept-charset','accept-encoding','access-control-request-headers','access-control-request-method','connection','content-length','cookie','cookie2','date','dnt','expect','host','keep-alive','origin','referer','te','trailer','transfer-encoding','upgrade','via'];}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer);},{"./capability":
|
|
14247
|
+
var unsafeHeaders=['accept-charset','accept-encoding','access-control-request-headers','access-control-request-method','connection','content-length','cookie','cookie2','date','dnt','expect','host','keep-alive','origin','referer','te','trailer','transfer-encoding','upgrade','via'];}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer);},{"./capability":330,"./response":332,"_process":312,"buffer":21,"inherits":116,"readable-stream":347}],332:[function(require,module,exports){(function(process,global,Buffer){(function(){var capability=require('./capability');var inherits=require('inherits');var stream=require('readable-stream');var rStates=exports.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4};var IncomingMessage=exports.IncomingMessage=function(xhr,response,mode,resetTimers){var self=this;stream.Readable.call(self);self._mode=mode;self.headers={};self.rawHeaders=[];self.trailers={};self.rawTrailers=[];// Fake the 'close' event, but only once 'end' fires
|
|
13198
14248
|
self.on('end',function(){// The nextTick is necessary to prevent the 'request' module from causing an infinite loop
|
|
13199
14249
|
process.nextTick(function(){self.emit('close');});});if(mode==='fetch'){self._fetchResponse=response;self.url=response.url;self.statusCode=response.status;self.statusMessage=response.statusText;response.headers.forEach(function(header,key){self.headers[key.toLowerCase()]=header;self.rawHeaders.push(key,header);});if(capability.writableStream){var writable=new WritableStream({write:function(chunk){resetTimers(false);return new Promise(function(resolve,reject){if(self._destroyed){reject();}else if(self.push(Buffer.from(chunk))){resolve();}else{self._resumeFetch=resolve;}});},close:function(){resetTimers(true);if(!self._destroyed)self.push(null);},abort:function(err){resetTimers(true);if(!self._destroyed)self.emit('error',err);}});try{response.body.pipeTo(writable).catch(function(err){resetTimers(true);if(!self._destroyed)self.emit('error',err);});return;}catch(e){}// pipeTo method isn't defined. Can't find a better way to feature test this
|
|
13200
14250
|
}// fallback for when writableStream or pipeTo aren't available
|
|
@@ -13202,13 +14252,13 @@ var reader=response.body.getReader();function read(){reader.read().then(function
|
|
|
13202
14252
|
}}};inherits(IncomingMessage,stream.Readable);IncomingMessage.prototype._read=function(){var self=this;var resolve=self._resumeFetch;if(resolve){self._resumeFetch=null;resolve();}};IncomingMessage.prototype._onXHRProgress=function(resetTimers){var self=this;var xhr=self._xhr;var response=null;switch(self._mode){case'text':response=xhr.responseText;if(response.length>self._pos){var newData=response.substr(self._pos);if(self._charset==='x-user-defined'){var buffer=Buffer.alloc(newData.length);for(var i=0;i<newData.length;i++)buffer[i]=newData.charCodeAt(i)&0xff;self.push(buffer);}else{self.push(newData,self._charset);}self._pos=response.length;}break;case'arraybuffer':if(xhr.readyState!==rStates.DONE||!xhr.response)break;response=xhr.response;self.push(Buffer.from(new Uint8Array(response)));break;case'moz-chunked-arraybuffer':// take whole
|
|
13203
14253
|
response=xhr.response;if(xhr.readyState!==rStates.LOADING||!response)break;self.push(Buffer.from(new Uint8Array(response)));break;case'ms-stream':response=xhr.response;if(xhr.readyState!==rStates.LOADING)break;var reader=new global.MSStreamReader();reader.onprogress=function(){if(reader.result.byteLength>self._pos){self.push(Buffer.from(new Uint8Array(reader.result.slice(self._pos))));self._pos=reader.result.byteLength;}};reader.onload=function(){resetTimers(true);self.push(null);};// reader.onerror = ??? // TODO: this
|
|
13204
14254
|
reader.readAsArrayBuffer(response);break;}// The ms-stream case handles end separately in reader.onload()
|
|
13205
|
-
if(self._xhr.readyState===rStates.DONE&&self._mode!=='ms-stream'){resetTimers(true);self.push(null);}};}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer);},{"./capability":
|
|
14255
|
+
if(self._xhr.readyState===rStates.DONE&&self._mode!=='ms-stream'){resetTimers(true);self.push(null);}};}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer);},{"./capability":330,"_process":312,"buffer":21,"inherits":116,"readable-stream":347}],333:[function(require,module,exports){'use strict';function _inheritsLoose(subClass,superClass){subClass.prototype=Object.create(superClass.prototype);subClass.prototype.constructor=subClass;subClass.__proto__=superClass;}var codes={};function createErrorType(code,message,Base){if(!Base){Base=Error;}function getMessage(arg1,arg2,arg3){if(typeof message==='string'){return message;}else{return message(arg1,arg2,arg3);}}var NodeError=/*#__PURE__*/function(_Base){_inheritsLoose(NodeError,_Base);function NodeError(arg1,arg2,arg3){return _Base.call(this,getMessage(arg1,arg2,arg3))||this;}return NodeError;}(Base);NodeError.prototype.name=Base.name;NodeError.prototype.code=code;codes[code]=NodeError;}// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
|
|
13206
14256
|
function oneOf(expected,thing){if(Array.isArray(expected)){var len=expected.length;expected=expected.map(function(i){return String(i);});if(len>2){return"one of ".concat(thing," ").concat(expected.slice(0,len-1).join(', '),", or ")+expected[len-1];}else if(len===2){return"one of ".concat(thing," ").concat(expected[0]," or ").concat(expected[1]);}else{return"of ".concat(thing," ").concat(expected[0]);}}else{return"of ".concat(thing," ").concat(String(expected));}}// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
|
|
13207
14257
|
function startsWith(str,search,pos){return str.substr(!pos||pos<0?0:+pos,search.length)===search;}// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
|
|
13208
14258
|
function endsWith(str,search,this_len){if(this_len===undefined||this_len>str.length){this_len=str.length;}return str.substring(this_len-search.length,this_len)===search;}// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
|
|
13209
14259
|
function includes(str,search,start){if(typeof start!=='number'){start=0;}if(start+search.length>str.length){return false;}else{return str.indexOf(search,start)!==-1;}}createErrorType('ERR_INVALID_OPT_VALUE',function(name,value){return'The value "'+value+'" is invalid for option "'+name+'"';},TypeError);createErrorType('ERR_INVALID_ARG_TYPE',function(name,expected,actual){// determiner: 'must be' or 'must not be'
|
|
13210
14260
|
var determiner;if(typeof expected==='string'&&startsWith(expected,'not ')){determiner='must not be';expected=expected.replace(/^not /,'');}else{determiner='must be';}var msg;if(endsWith(name,' argument')){// For cases like 'first argument'
|
|
13211
|
-
msg="The ".concat(name," ").concat(determiner," ").concat(oneOf(expected,'type'));}else{var type=includes(name,'.')?'property':'argument';msg="The \"".concat(name,"\" ").concat(type," ").concat(determiner," ").concat(oneOf(expected,'type'));}msg+=". Received type ".concat(typeof actual);return msg;},TypeError);createErrorType('ERR_STREAM_PUSH_AFTER_EOF','stream.push() after EOF');createErrorType('ERR_METHOD_NOT_IMPLEMENTED',function(name){return'The '+name+' method is not implemented';});createErrorType('ERR_STREAM_PREMATURE_CLOSE','Premature close');createErrorType('ERR_STREAM_DESTROYED',function(name){return'Cannot call '+name+' after a stream was destroyed';});createErrorType('ERR_MULTIPLE_CALLBACK','Callback called multiple times');createErrorType('ERR_STREAM_CANNOT_PIPE','Cannot pipe, not readable');createErrorType('ERR_STREAM_WRITE_AFTER_END','write after end');createErrorType('ERR_STREAM_NULL_VALUES','May not write null values to stream',TypeError);createErrorType('ERR_UNKNOWN_ENCODING',function(arg){return'Unknown encoding: '+arg;},TypeError);createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT','stream.unshift() after end event');module.exports.codes=codes;},{}],
|
|
14261
|
+
msg="The ".concat(name," ").concat(determiner," ").concat(oneOf(expected,'type'));}else{var type=includes(name,'.')?'property':'argument';msg="The \"".concat(name,"\" ").concat(type," ").concat(determiner," ").concat(oneOf(expected,'type'));}msg+=". Received type ".concat(typeof actual);return msg;},TypeError);createErrorType('ERR_STREAM_PUSH_AFTER_EOF','stream.push() after EOF');createErrorType('ERR_METHOD_NOT_IMPLEMENTED',function(name){return'The '+name+' method is not implemented';});createErrorType('ERR_STREAM_PREMATURE_CLOSE','Premature close');createErrorType('ERR_STREAM_DESTROYED',function(name){return'Cannot call '+name+' after a stream was destroyed';});createErrorType('ERR_MULTIPLE_CALLBACK','Callback called multiple times');createErrorType('ERR_STREAM_CANNOT_PIPE','Cannot pipe, not readable');createErrorType('ERR_STREAM_WRITE_AFTER_END','write after end');createErrorType('ERR_STREAM_NULL_VALUES','May not write null values to stream',TypeError);createErrorType('ERR_UNKNOWN_ENCODING',function(arg){return'Unknown encoding: '+arg;},TypeError);createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT','stream.unshift() after end event');module.exports.codes=codes;},{}],334:[function(require,module,exports){(function(process){(function(){// Copyright Joyent, Inc. and other Node contributors.
|
|
13212
14262
|
//
|
|
13213
14263
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
13214
14264
|
// copy of this software and associated documentation files (the
|
|
@@ -13253,7 +14303,7 @@ enumerable:false,get:function get(){if(this._readableState===undefined||this._wr
|
|
|
13253
14303
|
// has not been initialized yet
|
|
13254
14304
|
if(this._readableState===undefined||this._writableState===undefined){return;}// backward compatibility, the user is explicitly
|
|
13255
14305
|
// managing destroyed
|
|
13256
|
-
this._readableState.destroyed=value;this._writableState.destroyed=value;}});}).call(this);}).call(this,require('_process'));},{"./_stream_readable":
|
|
14306
|
+
this._readableState.destroyed=value;this._writableState.destroyed=value;}});}).call(this);}).call(this,require('_process'));},{"./_stream_readable":336,"./_stream_writable":338,"_process":312,"inherits":116}],335:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
|
|
13257
14307
|
//
|
|
13258
14308
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
13259
14309
|
// copy of this software and associated documentation files (the
|
|
@@ -13276,7 +14326,7 @@ this._readableState.destroyed=value;this._writableState.destroyed=value;}});}).c
|
|
|
13276
14326
|
// a passthrough stream.
|
|
13277
14327
|
// basically just the most minimal sort of Transform stream.
|
|
13278
14328
|
// Every written chunk gets output as-is.
|
|
13279
|
-
'use strict';module.exports=PassThrough;var Transform=require('./_stream_transform');require('inherits')(PassThrough,Transform);function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options);}PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk);};},{"./_stream_transform":
|
|
14329
|
+
'use strict';module.exports=PassThrough;var Transform=require('./_stream_transform');require('inherits')(PassThrough,Transform);function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options);}PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk);};},{"./_stream_transform":337,"inherits":116}],336:[function(require,module,exports){(function(process,global){(function(){// Copyright Joyent, Inc. and other Node contributors.
|
|
13280
14330
|
//
|
|
13281
14331
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
13282
14332
|
// copy of this software and associated documentation files (the
|
|
@@ -13528,7 +14578,7 @@ if(state.decoder)ret=state.buffer.join('');else if(state.buffer.length===1)ret=s
|
|
|
13528
14578
|
ret=state.buffer.consume(n,state.decoder);}return ret;}function endReadable(stream){var state=stream._readableState;debug('endReadable',state.endEmitted);if(!state.endEmitted){state.ended=true;process.nextTick(endReadableNT,state,stream);}}function endReadableNT(state,stream){debug('endReadableNT',state.endEmitted,state.length);// Check that we didn't get one last unshift.
|
|
13529
14579
|
if(!state.endEmitted&&state.length===0){state.endEmitted=true;stream.readable=false;stream.emit('end');if(state.autoDestroy){// In case of duplex streams we need a way to detect
|
|
13530
14580
|
// if the writable side is ready for autoDestroy as well
|
|
13531
|
-
var wState=stream._writableState;if(!wState||wState.autoDestroy&&wState.finished){stream.destroy();}}}}if(typeof Symbol==='function'){Readable.from=function(iterable,opts){if(from===undefined){from=require('./internal/streams/from');}return from(Readable,iterable,opts);};}function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++){if(xs[i]===x)return i;}return-1;}}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"../errors":
|
|
14581
|
+
var wState=stream._writableState;if(!wState||wState.autoDestroy&&wState.finished){stream.destroy();}}}}if(typeof Symbol==='function'){Readable.from=function(iterable,opts){if(from===undefined){from=require('./internal/streams/from');}return from(Readable,iterable,opts);};}function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++){if(xs[i]===x)return i;}return-1;}}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"../errors":333,"./_stream_duplex":334,"./internal/streams/async_iterator":339,"./internal/streams/buffer_list":340,"./internal/streams/destroy":341,"./internal/streams/from":343,"./internal/streams/state":345,"./internal/streams/stream":346,"_process":312,"buffer":21,"events":51,"inherits":116,"string_decoder/":348,"util":19}],337:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
|
|
13532
14582
|
//
|
|
13533
14583
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
13534
14584
|
// copy of this software and associated documentation files (the
|
|
@@ -13614,7 +14664,7 @@ ts.needTransform=true;}};Transform.prototype._destroy=function(err,cb){Duplex.pr
|
|
|
13614
14664
|
stream.push(data);// TODO(BridgeAR): Write a test for these two error cases
|
|
13615
14665
|
// if there's nothing in the write buffer, then that means
|
|
13616
14666
|
// that nothing more will ever be provided
|
|
13617
|
-
if(stream._writableState.length)throw new ERR_TRANSFORM_WITH_LENGTH_0();if(stream._transformState.transforming)throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();return stream.push(null);}},{"../errors":
|
|
14667
|
+
if(stream._writableState.length)throw new ERR_TRANSFORM_WITH_LENGTH_0();if(stream._transformState.transforming)throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();return stream.push(null);}},{"../errors":333,"./_stream_duplex":334,"inherits":116}],338:[function(require,module,exports){(function(process,global){(function(){// Copyright Joyent, Inc. and other Node contributors.
|
|
13618
14668
|
//
|
|
13619
14669
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
13620
14670
|
// copy of this software and associated documentation files (the
|
|
@@ -13749,7 +14799,7 @@ enumerable:false,get:function get(){if(this._writableState===undefined){return f
|
|
|
13749
14799
|
// has not been initialized yet
|
|
13750
14800
|
if(!this._writableState){return;}// backward compatibility, the user is explicitly
|
|
13751
14801
|
// managing destroyed
|
|
13752
|
-
this._writableState.destroyed=value;}});Writable.prototype.destroy=destroyImpl.destroy;Writable.prototype._undestroy=destroyImpl.undestroy;Writable.prototype._destroy=function(err,cb){cb(err);};}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"../errors":
|
|
14802
|
+
this._writableState.destroyed=value;}});Writable.prototype.destroy=destroyImpl.destroy;Writable.prototype._undestroy=destroyImpl.undestroy;Writable.prototype._destroy=function(err,cb){cb(err);};}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"../errors":333,"./_stream_duplex":334,"./internal/streams/destroy":341,"./internal/streams/state":345,"./internal/streams/stream":346,"_process":312,"buffer":21,"inherits":116,"util-deprecate":351}],339:[function(require,module,exports){(function(process){(function(){'use strict';var _Object$setPrototypeO;function _defineProperty(obj,key,value){key=_toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return typeof key==="symbol"?key:String(key);}function _toPrimitive(input,hint){if(typeof input!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(typeof res!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return(hint==="string"?String:Number)(input);}var finished=require('./end-of-stream');var kLastResolve=Symbol('lastResolve');var kLastReject=Symbol('lastReject');var kError=Symbol('error');var kEnded=Symbol('ended');var kLastPromise=Symbol('lastPromise');var kHandlePromise=Symbol('handlePromise');var kStream=Symbol('stream');function createIterResult(value,done){return{value:value,done:done};}function readAndResolve(iter){var resolve=iter[kLastResolve];if(resolve!==null){var data=iter[kStream].read();// we defer if data is null
|
|
13753
14803
|
// we can be expecting either 'end' or
|
|
13754
14804
|
// 'error'
|
|
13755
14805
|
if(data!==null){iter[kLastPromise]=null;iter[kLastResolve]=null;iter[kLastReject]=null;resolve(createIterResult(data,false));}}}function onReadable(iter){// we wait for the next tick, because it might
|
|
@@ -13771,7 +14821,7 @@ var data=this[kStream].read();if(data!==null){return Promise.resolve(createIterR
|
|
|
13771
14821
|
// Readable class this is attached to
|
|
13772
14822
|
return new Promise(function(resolve,reject){_this2[kStream].destroy(null,function(err){if(err){reject(err);return;}resolve(createIterResult(undefined,true));});});}),_Object$setPrototypeO),AsyncIteratorPrototype);var createReadableStreamAsyncIterator=function createReadableStreamAsyncIterator(stream){var _Object$create;var iterator=Object.create(ReadableStreamAsyncIteratorPrototype,(_Object$create={},_defineProperty(_Object$create,kStream,{value:stream,writable:true}),_defineProperty(_Object$create,kLastResolve,{value:null,writable:true}),_defineProperty(_Object$create,kLastReject,{value:null,writable:true}),_defineProperty(_Object$create,kError,{value:null,writable:true}),_defineProperty(_Object$create,kEnded,{value:stream._readableState.endEmitted,writable:true}),_defineProperty(_Object$create,kHandlePromise,{value:function value(resolve,reject){var data=iterator[kStream].read();if(data){iterator[kLastPromise]=null;iterator[kLastResolve]=null;iterator[kLastReject]=null;resolve(createIterResult(data,false));}else{iterator[kLastResolve]=resolve;iterator[kLastReject]=reject;}},writable:true}),_Object$create));iterator[kLastPromise]=null;finished(stream,function(err){if(err&&err.code!=='ERR_STREAM_PREMATURE_CLOSE'){var reject=iterator[kLastReject];// reject if we are waiting for data in the Promise
|
|
13773
14823
|
// returned by next() and store the error
|
|
13774
|
-
if(reject!==null){iterator[kLastPromise]=null;iterator[kLastResolve]=null;iterator[kLastReject]=null;reject(err);}iterator[kError]=err;return;}var resolve=iterator[kLastResolve];if(resolve!==null){iterator[kLastPromise]=null;iterator[kLastResolve]=null;iterator[kLastReject]=null;resolve(createIterResult(undefined,true));}iterator[kEnded]=true;});stream.on('readable',onReadable.bind(null,iterator));return iterator;};module.exports=createReadableStreamAsyncIterator;}).call(this);}).call(this,require('_process'));},{"./end-of-stream":
|
|
14824
|
+
if(reject!==null){iterator[kLastPromise]=null;iterator[kLastResolve]=null;iterator[kLastReject]=null;reject(err);}iterator[kError]=err;return;}var resolve=iterator[kLastResolve];if(resolve!==null){iterator[kLastPromise]=null;iterator[kLastResolve]=null;iterator[kLastReject]=null;resolve(createIterResult(undefined,true));}iterator[kEnded]=true;});stream.on('readable',onReadable.bind(null,iterator));return iterator;};module.exports=createReadableStreamAsyncIterator;}).call(this);}).call(this,require('_process'));},{"./end-of-stream":342,"_process":312}],340:[function(require,module,exports){'use strict';function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;})),keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target;}function _defineProperty(obj,key,value){key=_toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return typeof key==="symbol"?key:String(key);}function _toPrimitive(input,hint){if(typeof input!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(typeof res!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return(hint==="string"?String:Number)(input);}var _require=require('buffer'),Buffer=_require.Buffer;var _require2=require('util'),inspect=_require2.inspect;var custom=inspect&&inspect.custom||'inspect';function copyBuffer(src,target,offset){Buffer.prototype.copy.call(src,target,offset);}module.exports=/*#__PURE__*/function(){function BufferList(){_classCallCheck(this,BufferList);this.head=null;this.tail=null;this.length=0;}_createClass(BufferList,[{key:"push",value:function push(v){var entry={data:v,next:null};if(this.length>0)this.tail.next=entry;else this.head=entry;this.tail=entry;++this.length;}},{key:"unshift",value:function unshift(v){var entry={data:v,next:this.head};if(this.length===0)this.tail=entry;this.head=entry;++this.length;}},{key:"shift",value:function shift(){if(this.length===0)return;var ret=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;--this.length;return ret;}},{key:"clear",value:function clear(){this.head=this.tail=null;this.length=0;}},{key:"join",value:function join(s){if(this.length===0)return'';var p=this.head;var ret=''+p.data;while(p=p.next)ret+=s+p.data;return ret;}},{key:"concat",value:function concat(n){if(this.length===0)return Buffer.alloc(0);var ret=Buffer.allocUnsafe(n>>>0);var p=this.head;var i=0;while(p){copyBuffer(p.data,ret,i);i+=p.data.length;p=p.next;}return ret;}// Consumes a specified amount of bytes or characters from the buffered data.
|
|
13775
14825
|
},{key:"consume",value:function consume(n,hasStrings){var ret;if(n<this.head.data.length){// `slice` is the same for buffers and strings.
|
|
13776
14826
|
ret=this.head.data.slice(0,n);this.head.data=this.head.data.slice(n);}else if(n===this.head.data.length){// First chunk is a perfect match.
|
|
13777
14827
|
ret=this.shift();}else{// Result spans more than one buffer.
|
|
@@ -13780,7 +14830,7 @@ ret=hasStrings?this._getString(n):this._getBuffer(n);}return ret;}},{key:"first"
|
|
|
13780
14830
|
},{key:"_getBuffer",value:function _getBuffer(n){var ret=Buffer.allocUnsafe(n);var p=this.head;var c=1;p.data.copy(ret);n-=p.data.length;while(p=p.next){var buf=p.data;var nb=n>buf.length?buf.length:n;buf.copy(ret,ret.length-n,0,nb);n-=nb;if(n===0){if(nb===buf.length){++c;if(p.next)this.head=p.next;else this.head=this.tail=null;}else{this.head=p;p.data=buf.slice(nb);}break;}++c;}this.length-=c;return ret;}// Make sure the linked list only shows the minimal necessary information.
|
|
13781
14831
|
},{key:custom,value:function value(_,options){return inspect(this,_objectSpread(_objectSpread({},options),{},{// Only inspect one level.
|
|
13782
14832
|
depth:0,// It should not recurse.
|
|
13783
|
-
customInspect:false}));}}]);return BufferList;}();},{"buffer":21,"util":19}],
|
|
14833
|
+
customInspect:false}));}}]);return BufferList;}();},{"buffer":21,"util":19}],341:[function(require,module,exports){(function(process){(function(){'use strict';// undocumented cb() API, needed for core, not for public API
|
|
13784
14834
|
function destroy(err,cb){var _this=this;var readableDestroyed=this._readableState&&this._readableState.destroyed;var writableDestroyed=this._writableState&&this._writableState.destroyed;if(readableDestroyed||writableDestroyed){if(cb){cb(err);}else if(err){if(!this._writableState){process.nextTick(emitErrorNT,this,err);}else if(!this._writableState.errorEmitted){this._writableState.errorEmitted=true;process.nextTick(emitErrorNT,this,err);}}return this;}// we set destroyed to true before firing error callbacks in order
|
|
13785
14835
|
// to make it re-entrance safe in case destroy() is called within callbacks
|
|
13786
14836
|
if(this._readableState){this._readableState.destroyed=true;}// if this is a duplex stream mark the writable part as destroyed as well
|
|
@@ -13789,15 +14839,15 @@ if(this._writableState){this._writableState.destroyed=true;}this._destroy(err||n
|
|
|
13789
14839
|
// For now when you opt-in to autoDestroy we allow
|
|
13790
14840
|
// the error to be emitted nextTick. In a future
|
|
13791
14841
|
// semver major update we should change the default to this.
|
|
13792
|
-
var rState=stream._readableState;var wState=stream._writableState;if(rState&&rState.autoDestroy||wState&&wState.autoDestroy)stream.destroy(err);else stream.emit('error',err);}module.exports={destroy:destroy,undestroy:undestroy,errorOrDestroy:errorOrDestroy};}).call(this);}).call(this,require('_process'));},{"_process":
|
|
14842
|
+
var rState=stream._readableState;var wState=stream._writableState;if(rState&&rState.autoDestroy||wState&&wState.autoDestroy)stream.destroy(err);else stream.emit('error',err);}module.exports={destroy:destroy,undestroy:undestroy,errorOrDestroy:errorOrDestroy};}).call(this);}).call(this,require('_process'));},{"_process":312}],342:[function(require,module,exports){// Ported from https://github.com/mafintosh/end-of-stream with
|
|
13793
14843
|
// permission from the author, Mathias Buus (@mafintosh).
|
|
13794
14844
|
'use strict';var ERR_STREAM_PREMATURE_CLOSE=require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE;function once(callback){var called=false;return function(){if(called)return;called=true;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}callback.apply(this,args);};}function noop(){}function isRequest(stream){return stream.setHeader&&typeof stream.abort==='function';}function eos(stream,opts,callback){if(typeof opts==='function')return eos(stream,null,opts);if(!opts)opts={};callback=once(callback||noop);var readable=opts.readable||opts.readable!==false&&stream.readable;var writable=opts.writable||opts.writable!==false&&stream.writable;var onlegacyfinish=function onlegacyfinish(){if(!stream.writable)onfinish();};var writableEnded=stream._writableState&&stream._writableState.finished;var onfinish=function onfinish(){writable=false;writableEnded=true;if(!readable)callback.call(stream);};var readableEnded=stream._readableState&&stream._readableState.endEmitted;var onend=function onend(){readable=false;readableEnded=true;if(!writable)callback.call(stream);};var onerror=function onerror(err){callback.call(stream,err);};var onclose=function onclose(){var err;if(readable&&!readableEnded){if(!stream._readableState||!stream._readableState.ended)err=new ERR_STREAM_PREMATURE_CLOSE();return callback.call(stream,err);}if(writable&&!writableEnded){if(!stream._writableState||!stream._writableState.ended)err=new ERR_STREAM_PREMATURE_CLOSE();return callback.call(stream,err);}};var onrequest=function onrequest(){stream.req.on('finish',onfinish);};if(isRequest(stream)){stream.on('complete',onfinish);stream.on('abort',onclose);if(stream.req)onrequest();else stream.on('request',onrequest);}else if(writable&&!stream._writableState){// legacy streams
|
|
13795
|
-
stream.on('end',onlegacyfinish);stream.on('close',onlegacyfinish);}stream.on('end',onend);stream.on('finish',onfinish);if(opts.error!==false)stream.on('error',onerror);stream.on('close',onclose);return function(){stream.removeListener('complete',onfinish);stream.removeListener('abort',onclose);stream.removeListener('request',onrequest);if(stream.req)stream.req.removeListener('finish',onfinish);stream.removeListener('end',onlegacyfinish);stream.removeListener('close',onlegacyfinish);stream.removeListener('finish',onfinish);stream.removeListener('end',onend);stream.removeListener('error',onerror);stream.removeListener('close',onclose);};}module.exports=eos;},{"../../../errors":
|
|
14845
|
+
stream.on('end',onlegacyfinish);stream.on('close',onlegacyfinish);}stream.on('end',onend);stream.on('finish',onfinish);if(opts.error!==false)stream.on('error',onerror);stream.on('close',onclose);return function(){stream.removeListener('complete',onfinish);stream.removeListener('abort',onclose);stream.removeListener('request',onrequest);if(stream.req)stream.req.removeListener('finish',onfinish);stream.removeListener('end',onlegacyfinish);stream.removeListener('close',onlegacyfinish);stream.removeListener('finish',onfinish);stream.removeListener('end',onend);stream.removeListener('error',onerror);stream.removeListener('close',onclose);};}module.exports=eos;},{"../../../errors":333}],343:[function(require,module,exports){module.exports=function(){throw new Error('Readable.from is not available in the browser');};},{}],344:[function(require,module,exports){// Ported from https://github.com/mafintosh/pump with
|
|
13796
14846
|
// permission from the author, Mathias Buus (@mafintosh).
|
|
13797
14847
|
'use strict';var eos;function once(callback){var called=false;return function(){if(called)return;called=true;callback.apply(void 0,arguments);};}var _require$codes=require('../../../errors').codes,ERR_MISSING_ARGS=_require$codes.ERR_MISSING_ARGS,ERR_STREAM_DESTROYED=_require$codes.ERR_STREAM_DESTROYED;function noop(err){// Rethrow the error if it exists to avoid swallowing it
|
|
13798
14848
|
if(err)throw err;}function isRequest(stream){return stream.setHeader&&typeof stream.abort==='function';}function destroyer(stream,reading,writing,callback){callback=once(callback);var closed=false;stream.on('close',function(){closed=true;});if(eos===undefined)eos=require('./end-of-stream');eos(stream,{readable:reading,writable:writing},function(err){if(err)return callback(err);closed=true;callback();});var destroyed=false;return function(err){if(closed)return;if(destroyed)return;destroyed=true;// request.destroy just do .end - .abort is what we want
|
|
13799
|
-
if(isRequest(stream))return stream.abort();if(typeof stream.destroy==='function')return stream.destroy();callback(err||new ERR_STREAM_DESTROYED('pipe'));};}function call(fn){fn();}function pipe(from,to){return from.pipe(to);}function popCallback(streams){if(!streams.length)return noop;if(typeof streams[streams.length-1]!=='function')return noop;return streams.pop();}function pipeline(){for(var _len=arguments.length,streams=new Array(_len),_key=0;_key<_len;_key++){streams[_key]=arguments[_key];}var callback=popCallback(streams);if(Array.isArray(streams[0]))streams=streams[0];if(streams.length<2){throw new ERR_MISSING_ARGS('streams');}var error;var destroys=streams.map(function(stream,i){var reading=i<streams.length-1;var writing=i>0;return destroyer(stream,reading,writing,function(err){if(!error)error=err;if(err)destroys.forEach(call);if(reading)return;destroys.forEach(call);callback(error);});});return streams.reduce(pipe);}module.exports=pipeline;},{"../../../errors":
|
|
13800
|
-
return state.objectMode?16:16*1024;}module.exports={getHighWaterMark:getHighWaterMark};},{"../../../errors":
|
|
14849
|
+
if(isRequest(stream))return stream.abort();if(typeof stream.destroy==='function')return stream.destroy();callback(err||new ERR_STREAM_DESTROYED('pipe'));};}function call(fn){fn();}function pipe(from,to){return from.pipe(to);}function popCallback(streams){if(!streams.length)return noop;if(typeof streams[streams.length-1]!=='function')return noop;return streams.pop();}function pipeline(){for(var _len=arguments.length,streams=new Array(_len),_key=0;_key<_len;_key++){streams[_key]=arguments[_key];}var callback=popCallback(streams);if(Array.isArray(streams[0]))streams=streams[0];if(streams.length<2){throw new ERR_MISSING_ARGS('streams');}var error;var destroys=streams.map(function(stream,i){var reading=i<streams.length-1;var writing=i>0;return destroyer(stream,reading,writing,function(err){if(!error)error=err;if(err)destroys.forEach(call);if(reading)return;destroys.forEach(call);callback(error);});});return streams.reduce(pipe);}module.exports=pipeline;},{"../../../errors":333,"./end-of-stream":342}],345:[function(require,module,exports){'use strict';var ERR_INVALID_OPT_VALUE=require('../../../errors').codes.ERR_INVALID_OPT_VALUE;function highWaterMarkFrom(options,isDuplex,duplexKey){return options.highWaterMark!=null?options.highWaterMark:isDuplex?options[duplexKey]:null;}function getHighWaterMark(state,options,duplexKey,isDuplex){var hwm=highWaterMarkFrom(options,isDuplex,duplexKey);if(hwm!=null){if(!(isFinite(hwm)&&Math.floor(hwm)===hwm)||hwm<0){var name=isDuplex?duplexKey:'highWaterMark';throw new ERR_INVALID_OPT_VALUE(name,hwm);}return Math.floor(hwm);}// Default value
|
|
14850
|
+
return state.objectMode?16:16*1024;}module.exports={getHighWaterMark:getHighWaterMark};},{"../../../errors":333}],346:[function(require,module,exports){module.exports=require('events').EventEmitter;},{"events":51}],347:[function(require,module,exports){exports=module.exports=require('./lib/_stream_readable.js');exports.Stream=exports;exports.Readable=exports;exports.Writable=require('./lib/_stream_writable.js');exports.Duplex=require('./lib/_stream_duplex.js');exports.Transform=require('./lib/_stream_transform.js');exports.PassThrough=require('./lib/_stream_passthrough.js');exports.finished=require('./lib/internal/streams/end-of-stream.js');exports.pipeline=require('./lib/internal/streams/pipeline.js');},{"./lib/_stream_duplex.js":334,"./lib/_stream_passthrough.js":335,"./lib/_stream_readable.js":336,"./lib/_stream_transform.js":337,"./lib/_stream_writable.js":338,"./lib/internal/streams/end-of-stream.js":342,"./lib/internal/streams/pipeline.js":344}],348:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
|
|
13801
14851
|
//
|
|
13802
14852
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
13803
14853
|
// copy of this software and associated documentation files (the
|
|
@@ -13851,13 +14901,13 @@ function utf8End(buf){var r=buf&&buf.length?this.write(buf):'';if(this.lastNeed)
|
|
|
13851
14901
|
function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString('utf16le',i);if(r){var c=r.charCodeAt(r.length-1);if(c>=0xD800&&c<=0xDBFF){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];return r.slice(0,-1);}}return r;}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=buf[buf.length-1];return buf.toString('utf16le',i,buf.length-1);}// For UTF-16LE we do not explicitly append special replacement characters if we
|
|
13852
14902
|
// end on a partial character, we simply let v8 handle that.
|
|
13853
14903
|
function utf16End(buf){var r=buf&&buf.length?this.write(buf):'';if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString('utf16le',0,end);}return r;}function base64Text(buf,i){var n=(buf.length-i)%3;if(n===0)return buf.toString('base64',i);this.lastNeed=3-n;this.lastTotal=3;if(n===1){this.lastChar[0]=buf[buf.length-1];}else{this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];}return buf.toString('base64',i,buf.length-n);}function base64End(buf){var r=buf&&buf.length?this.write(buf):'';if(this.lastNeed)return r+this.lastChar.toString('base64',0,3-this.lastNeed);return r;}// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
|
|
13854
|
-
function simpleWrite(buf){return buf.toString(this.encoding);}function simpleEnd(buf){return buf&&buf.length?this.write(buf):'';}},{"safe-buffer":
|
|
14904
|
+
function simpleWrite(buf){return buf.toString(this.encoding);}function simpleEnd(buf){return buf&&buf.length?this.write(buf):'';}},{"safe-buffer":322}],349:[function(require,module,exports){(function(setImmediate,clearImmediate){(function(){var nextTick=require('process/browser.js').nextTick;var apply=Function.prototype.apply;var slice=Array.prototype.slice;var immediateIds={};var nextImmediateId=0;// DOM APIs, for completeness
|
|
13855
14905
|
exports.setTimeout=function(){return new Timeout(apply.call(setTimeout,window,arguments),clearTimeout);};exports.setInterval=function(){return new Timeout(apply.call(setInterval,window,arguments),clearInterval);};exports.clearTimeout=exports.clearInterval=function(timeout){timeout.close();};function Timeout(id,clearFn){this._id=id;this._clearFn=clearFn;}Timeout.prototype.unref=Timeout.prototype.ref=function(){};Timeout.prototype.close=function(){this._clearFn.call(window,this._id);};// Does not start the time, just sets up the members needed.
|
|
13856
14906
|
exports.enroll=function(item,msecs){clearTimeout(item._idleTimeoutId);item._idleTimeout=msecs;};exports.unenroll=function(item){clearTimeout(item._idleTimeoutId);item._idleTimeout=-1;};exports._unrefActive=exports.active=function(item){clearTimeout(item._idleTimeoutId);var msecs=item._idleTimeout;if(msecs>=0){item._idleTimeoutId=setTimeout(function onTimeout(){if(item._onTimeout)item._onTimeout();},msecs);}};// That's not how node.js implements it but the exposed api is the same.
|
|
13857
14907
|
exports.setImmediate=typeof setImmediate==="function"?setImmediate:function(fn){var id=nextImmediateId++;var args=arguments.length<2?false:slice.call(arguments,1);immediateIds[id]=true;nextTick(function onNextTick(){if(immediateIds[id]){// fn.call() is faster so we optimize for the common use-case
|
|
13858
14908
|
// @see http://jsperf.com/call-apply-segu
|
|
13859
14909
|
if(args){fn.apply(null,args);}else{fn.call(null);}// Prevent ids from leaking
|
|
13860
|
-
exports.clearImmediate(id);}});return id;};exports.clearImmediate=typeof clearImmediate==="function"?clearImmediate:function(id){delete immediateIds[id];};}).call(this);}).call(this,require("timers").setImmediate,require("timers").clearImmediate);},{"process/browser.js":
|
|
14910
|
+
exports.clearImmediate(id);}});return id;};exports.clearImmediate=typeof clearImmediate==="function"?clearImmediate:function(id){delete immediateIds[id];};}).call(this);}).call(this,require("timers").setImmediate,require("timers").clearImmediate);},{"process/browser.js":312,"timers":349}],350:[function(require,module,exports){/*
|
|
13861
14911
|
* Copyright Joyent, Inc. and other Node contributors.
|
|
13862
14912
|
*
|
|
13863
14913
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
@@ -14035,7 +15085,7 @@ if(psychotic){result.hostname=isAbsolute?'':srcPath.length?srcPath.shift():'';re
|
|
|
14035
15085
|
* this especially happens in cases like
|
|
14036
15086
|
* url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
|
14037
15087
|
*/var authInHost=result.host&&result.host.indexOf('@')>0?result.host.split('@'):false;if(authInHost){result.auth=authInHost.shift();result.hostname=authInHost.shift();result.host=result.hostname;}}mustEndAbs=mustEndAbs||result.host&&srcPath.length;if(mustEndAbs&&!isAbsolute){srcPath.unshift('');}if(srcPath.length>0){result.pathname=srcPath.join('/');}else{result.pathname=null;result.path=null;}// to support request.http
|
|
14038
|
-
if(result.pathname!==null||result.search!==null){result.path=(result.pathname?result.pathname:'')+(result.search?result.search:'');}result.auth=relative.auth||result.auth;result.slashes=result.slashes||relative.slashes;result.href=result.format();return result;};Url.prototype.parseHost=function(){var host=this.host;var port=portPattern.exec(host);if(port){port=port[0];if(port!==':'){this.port=port.substr(1);}host=host.substr(0,host.length-port.length);}if(host){this.hostname=host;}};exports.parse=urlParse;exports.resolve=urlResolve;exports.resolveObject=urlResolveObject;exports.format=urlFormat;exports.Url=Url;},{"punycode/":
|
|
15088
|
+
if(result.pathname!==null||result.search!==null){result.path=(result.pathname?result.pathname:'')+(result.search?result.search:'');}result.auth=relative.auth||result.auth;result.slashes=result.slashes||relative.slashes;result.href=result.format();return result;};Url.prototype.parseHost=function(){var host=this.host;var port=portPattern.exec(host);if(port){port=port[0];if(port!==':'){this.port=port.substr(1);}host=host.substr(0,host.length-port.length);}if(host){this.hostname=host;}};exports.parse=urlParse;exports.resolve=urlResolve;exports.resolveObject=urlResolveObject;exports.format=urlFormat;exports.Url=Url;},{"punycode/":313,"qs":315}],351:[function(require,module,exports){(function(global){(function(){/**
|
|
14039
15089
|
* Module exports.
|
|
14040
15090
|
*/module.exports=deprecate;/**
|
|
14041
15091
|
* Mark that a method should not be used.
|
|
@@ -14060,12 +15110,12 @@ if(result.pathname!==null||result.search!==null){result.path=(result.pathname?re
|
|
|
14060
15110
|
* @returns {Boolean}
|
|
14061
15111
|
* @api private
|
|
14062
15112
|
*/function config(name){// accessing global.localStorage can trigger a DOMException in sandboxed iframes
|
|
14063
|
-
try{if(!global.localStorage)return false;}catch(_){return false;}var val=global.localStorage[name];if(null==val)return false;return String(val).toLowerCase()==='true';}}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],
|
|
15113
|
+
try{if(!global.localStorage)return false;}catch(_){return false;}var val=global.localStorage[name];if(null==val)return false;return String(val).toLowerCase()==='true';}}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],352:[function(require,module,exports){// Returns a wrapper function that returns a wrapped callback
|
|
14064
15114
|
// The wrapper function should do some stuff, and return a
|
|
14065
15115
|
// presumably different callback function.
|
|
14066
15116
|
// This makes sure that own properties are retained, so that
|
|
14067
15117
|
// decorations and such are not lost along the way.
|
|
14068
|
-
module.exports=wrappy;function wrappy(fn,cb){if(fn&&cb)return wrappy(fn)(cb);if(typeof fn!=='function')throw new TypeError('need wrapper function');Object.keys(fn).forEach(function(k){wrapper[k]=fn[k];});return wrapper;function wrapper(){var args=new Array(arguments.length);for(var i=0;i<args.length;i++){args[i]=arguments[i];}var ret=fn.apply(this,args);var cb=args[args.length-1];if(typeof ret==='function'&&ret!==cb){Object.keys(cb).forEach(function(k){ret[k]=cb[k];});}return ret;}}},{}],
|
|
15118
|
+
module.exports=wrappy;function wrappy(fn,cb){if(fn&&cb)return wrappy(fn)(cb);if(typeof fn!=='function')throw new TypeError('need wrapper function');Object.keys(fn).forEach(function(k){wrapper[k]=fn[k];});return wrapper;function wrapper(){var args=new Array(arguments.length);for(var i=0;i<args.length;i++){args[i]=arguments[i];}var ret=fn.apply(this,args);var cb=args[args.length-1];if(typeof ret==='function'&&ret!==cb){Object.keys(cb).forEach(function(k){ret[k]=cb[k];});}return ret;}}},{}],353:[function(require,module,exports){module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty;function extend(){var target={};for(var i=0;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;}},{}],354:[function(require,module,exports){module.exports={ViewIdentifier:'Pict-FormEditor',DefaultRenderable:'FormEditor-Container',DefaultDestinationAddress:'#FormEditor-Container',AutoRender:false,// Address in AppData where the form configuration manifest lives
|
|
14069
15119
|
ManifestDataAddress:false,// Which tab is active by default: 'visual', 'objecteditor', 'json'
|
|
14070
15120
|
ActiveTab:'visual',CSS:/*css*/`
|
|
14071
15121
|
.pict-formeditor
|
|
@@ -14750,6 +15800,42 @@ ActiveTab:'visual',CSS:/*css*/`
|
|
|
14750
15800
|
outline-offset: -2px;
|
|
14751
15801
|
background: rgba(158, 107, 71, 0.05);
|
|
14752
15802
|
}
|
|
15803
|
+
.pict-fe-drag-insert-before
|
|
15804
|
+
{
|
|
15805
|
+
position: relative;
|
|
15806
|
+
background: rgba(158, 107, 71, 0.03);
|
|
15807
|
+
}
|
|
15808
|
+
.pict-fe-drag-insert-before::before
|
|
15809
|
+
{
|
|
15810
|
+
content: '';
|
|
15811
|
+
position: absolute;
|
|
15812
|
+
top: -1px;
|
|
15813
|
+
left: 0;
|
|
15814
|
+
right: 0;
|
|
15815
|
+
height: 3px;
|
|
15816
|
+
background: #9E6B47;
|
|
15817
|
+
border-radius: 2px;
|
|
15818
|
+
z-index: 10;
|
|
15819
|
+
pointer-events: none;
|
|
15820
|
+
}
|
|
15821
|
+
.pict-fe-drag-insert-after
|
|
15822
|
+
{
|
|
15823
|
+
position: relative;
|
|
15824
|
+
background: rgba(158, 107, 71, 0.03);
|
|
15825
|
+
}
|
|
15826
|
+
.pict-fe-drag-insert-after::after
|
|
15827
|
+
{
|
|
15828
|
+
content: '';
|
|
15829
|
+
position: absolute;
|
|
15830
|
+
bottom: -1px;
|
|
15831
|
+
left: 0;
|
|
15832
|
+
right: 0;
|
|
15833
|
+
height: 3px;
|
|
15834
|
+
background: #9E6B47;
|
|
15835
|
+
border-radius: 2px;
|
|
15836
|
+
z-index: 10;
|
|
15837
|
+
pointer-events: none;
|
|
15838
|
+
}
|
|
14753
15839
|
|
|
14754
15840
|
/* ---- Editor Layout: tab content + toggle + properties panel ---- */
|
|
14755
15841
|
.pict-fe-editor-layout
|
|
@@ -15370,7 +16456,6 @@ ActiveTab:'visual',CSS:/*css*/`
|
|
|
15370
16456
|
width: 100%;
|
|
15371
16457
|
height: 100%;
|
|
15372
16458
|
z-index: 9999;
|
|
15373
|
-
overflow: hidden;
|
|
15374
16459
|
}
|
|
15375
16460
|
.pict-fe-inputtype-picker
|
|
15376
16461
|
{
|
|
@@ -15475,6 +16560,101 @@ ActiveTab:'visual',CSS:/*css*/`
|
|
|
15475
16560
|
font-size: 12px;
|
|
15476
16561
|
}
|
|
15477
16562
|
|
|
16563
|
+
/* ---- Content Editor Overlay (Markdown/HTML) ---- */
|
|
16564
|
+
.pict-fe-content-editor-overlay
|
|
16565
|
+
{
|
|
16566
|
+
position: fixed;
|
|
16567
|
+
top: 0;
|
|
16568
|
+
left: 0;
|
|
16569
|
+
width: 100%;
|
|
16570
|
+
height: 100%;
|
|
16571
|
+
background: rgba(61, 50, 41, 0.4);
|
|
16572
|
+
z-index: 9998;
|
|
16573
|
+
}
|
|
16574
|
+
.pict-fe-content-editor
|
|
16575
|
+
{
|
|
16576
|
+
position: fixed;
|
|
16577
|
+
top: 5vh;
|
|
16578
|
+
left: 10vw;
|
|
16579
|
+
width: 80vw;
|
|
16580
|
+
height: 90vh;
|
|
16581
|
+
background: #FFF;
|
|
16582
|
+
border-radius: 8px;
|
|
16583
|
+
box-shadow: 0 8px 32px rgba(61, 50, 41, 0.25);
|
|
16584
|
+
z-index: 9999;
|
|
16585
|
+
display: flex;
|
|
16586
|
+
flex-direction: column;
|
|
16587
|
+
overflow: hidden;
|
|
16588
|
+
}
|
|
16589
|
+
.pict-fe-content-editor-header
|
|
16590
|
+
{
|
|
16591
|
+
display: flex;
|
|
16592
|
+
align-items: center;
|
|
16593
|
+
padding: 12px 16px;
|
|
16594
|
+
border-bottom: 1px solid #E8E2D8;
|
|
16595
|
+
background: #FAF8F5;
|
|
16596
|
+
flex-shrink: 0;
|
|
16597
|
+
}
|
|
16598
|
+
.pict-fe-content-editor-title
|
|
16599
|
+
{
|
|
16600
|
+
flex: 1;
|
|
16601
|
+
font-weight: 600;
|
|
16602
|
+
font-size: 14px;
|
|
16603
|
+
color: #3D3229;
|
|
16604
|
+
}
|
|
16605
|
+
.pict-fe-content-editor-close
|
|
16606
|
+
{
|
|
16607
|
+
background: #9E6B47;
|
|
16608
|
+
color: #FFF;
|
|
16609
|
+
border: none;
|
|
16610
|
+
border-radius: 4px;
|
|
16611
|
+
padding: 6px 16px;
|
|
16612
|
+
cursor: pointer;
|
|
16613
|
+
font-size: 13px;
|
|
16614
|
+
font-weight: 500;
|
|
16615
|
+
}
|
|
16616
|
+
.pict-fe-content-editor-close:hover
|
|
16617
|
+
{
|
|
16618
|
+
background: #8A5C3B;
|
|
16619
|
+
}
|
|
16620
|
+
.pict-fe-content-editor-body
|
|
16621
|
+
{
|
|
16622
|
+
flex: 1;
|
|
16623
|
+
overflow: auto;
|
|
16624
|
+
padding: 0;
|
|
16625
|
+
}
|
|
16626
|
+
.pict-fe-content-editor-fallback
|
|
16627
|
+
{
|
|
16628
|
+
width: 100%;
|
|
16629
|
+
height: 100%;
|
|
16630
|
+
border: none;
|
|
16631
|
+
padding: 16px;
|
|
16632
|
+
font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
|
|
16633
|
+
font-size: 13px;
|
|
16634
|
+
line-height: 1.6;
|
|
16635
|
+
color: #3D3229;
|
|
16636
|
+
resize: none;
|
|
16637
|
+
outline: none;
|
|
16638
|
+
box-sizing: border-box;
|
|
16639
|
+
}
|
|
16640
|
+
.pict-fe-props-content-edit-btn
|
|
16641
|
+
{
|
|
16642
|
+
width: 100%;
|
|
16643
|
+
padding: 8px 12px;
|
|
16644
|
+
background: #9E6B47;
|
|
16645
|
+
color: #FFF;
|
|
16646
|
+
border: none;
|
|
16647
|
+
border-radius: 4px;
|
|
16648
|
+
cursor: pointer;
|
|
16649
|
+
font-size: 13px;
|
|
16650
|
+
font-weight: 500;
|
|
16651
|
+
text-align: center;
|
|
16652
|
+
}
|
|
16653
|
+
.pict-fe-props-content-edit-btn:hover
|
|
16654
|
+
{
|
|
16655
|
+
background: #8A5C3B;
|
|
16656
|
+
}
|
|
16657
|
+
|
|
15478
16658
|
/* ---- Manifest Summary ---- */
|
|
15479
16659
|
.pict-fe-manifest-summary
|
|
15480
16660
|
{
|
|
@@ -17212,29 +18392,29 @@ ActiveTab:'visual',CSS:/*css*/`
|
|
|
17212
18392
|
box-shadow: 0 0 0 2px rgba(158, 107, 71, 0.1);
|
|
17213
18393
|
}
|
|
17214
18394
|
|
|
17215
|
-
/* ----
|
|
17216
|
-
.pict-fe-
|
|
18395
|
+
/* ---- Import Tab ---- */
|
|
18396
|
+
.pict-fe-import-container
|
|
17217
18397
|
{
|
|
17218
18398
|
display: flex;
|
|
17219
18399
|
flex-direction: column;
|
|
17220
18400
|
gap: 16px;
|
|
17221
18401
|
max-width: 640px;
|
|
17222
18402
|
}
|
|
17223
|
-
.pict-fe-
|
|
18403
|
+
.pict-fe-import-title
|
|
17224
18404
|
{
|
|
17225
18405
|
margin: 0;
|
|
17226
18406
|
font-size: 15px;
|
|
17227
18407
|
font-weight: 600;
|
|
17228
18408
|
color: #3D3229;
|
|
17229
18409
|
}
|
|
17230
|
-
.pict-fe-
|
|
18410
|
+
.pict-fe-import-description
|
|
17231
18411
|
{
|
|
17232
18412
|
margin: 0;
|
|
17233
18413
|
font-size: 13px;
|
|
17234
18414
|
color: #8A7F72;
|
|
17235
18415
|
line-height: 1.5;
|
|
17236
18416
|
}
|
|
17237
|
-
.pict-fe-
|
|
18417
|
+
.pict-fe-import-dropzone
|
|
17238
18418
|
{
|
|
17239
18419
|
position: relative;
|
|
17240
18420
|
display: flex;
|
|
@@ -17247,18 +18427,18 @@ ActiveTab:'visual',CSS:/*css*/`
|
|
|
17247
18427
|
cursor: pointer;
|
|
17248
18428
|
transition: border-color 0.15s, background 0.15s;
|
|
17249
18429
|
}
|
|
17250
|
-
.pict-fe-
|
|
18430
|
+
.pict-fe-import-dropzone:hover
|
|
17251
18431
|
{
|
|
17252
18432
|
border-color: #9E6B47;
|
|
17253
18433
|
background: #FAF5EE;
|
|
17254
18434
|
}
|
|
17255
|
-
.pict-fe-
|
|
18435
|
+
.pict-fe-import-dropzone-active
|
|
17256
18436
|
{
|
|
17257
18437
|
border-color: #9E6B47;
|
|
17258
18438
|
background: #F3EAE0;
|
|
17259
18439
|
border-style: solid;
|
|
17260
18440
|
}
|
|
17261
|
-
.pict-fe-
|
|
18441
|
+
.pict-fe-import-dropzone-content
|
|
17262
18442
|
{
|
|
17263
18443
|
display: flex;
|
|
17264
18444
|
flex-direction: column;
|
|
@@ -17266,27 +18446,27 @@ ActiveTab:'visual',CSS:/*css*/`
|
|
|
17266
18446
|
gap: 8px;
|
|
17267
18447
|
pointer-events: none;
|
|
17268
18448
|
}
|
|
17269
|
-
.pict-fe-
|
|
18449
|
+
.pict-fe-import-dropzone-icon
|
|
17270
18450
|
{
|
|
17271
18451
|
color: #D4C4A8;
|
|
17272
18452
|
}
|
|
17273
|
-
.pict-fe-
|
|
18453
|
+
.pict-fe-import-dropzone-icon svg
|
|
17274
18454
|
{
|
|
17275
18455
|
width: 48px;
|
|
17276
18456
|
height: 48px;
|
|
17277
18457
|
}
|
|
17278
|
-
.pict-fe-
|
|
18458
|
+
.pict-fe-import-dropzone-text
|
|
17279
18459
|
{
|
|
17280
18460
|
font-size: 16px;
|
|
17281
18461
|
font-weight: 600;
|
|
17282
18462
|
color: #3D3229;
|
|
17283
18463
|
}
|
|
17284
|
-
.pict-fe-
|
|
18464
|
+
.pict-fe-import-dropzone-subtext
|
|
17285
18465
|
{
|
|
17286
18466
|
font-size: 12px;
|
|
17287
18467
|
color: #8A7F72;
|
|
17288
18468
|
}
|
|
17289
|
-
.pict-fe-
|
|
18469
|
+
.pict-fe-import-file-input
|
|
17290
18470
|
{
|
|
17291
18471
|
position: absolute;
|
|
17292
18472
|
top: 0;
|
|
@@ -17296,11 +18476,11 @@ ActiveTab:'visual',CSS:/*css*/`
|
|
|
17296
18476
|
overflow: hidden;
|
|
17297
18477
|
opacity: 0;
|
|
17298
18478
|
}
|
|
17299
|
-
.pict-fe-
|
|
18479
|
+
.pict-fe-import-status
|
|
17300
18480
|
{
|
|
17301
18481
|
min-height: 0;
|
|
17302
18482
|
}
|
|
17303
|
-
.pict-fe-
|
|
18483
|
+
.pict-fe-import-status-success
|
|
17304
18484
|
{
|
|
17305
18485
|
padding: 10px 14px;
|
|
17306
18486
|
background: #E8F5E9;
|
|
@@ -17310,7 +18490,7 @@ ActiveTab:'visual',CSS:/*css*/`
|
|
|
17310
18490
|
color: #2E7D32;
|
|
17311
18491
|
line-height: 1.5;
|
|
17312
18492
|
}
|
|
17313
|
-
.pict-fe-
|
|
18493
|
+
.pict-fe-import-status-error
|
|
17314
18494
|
{
|
|
17315
18495
|
padding: 10px 14px;
|
|
17316
18496
|
background: #FFEBEE;
|
|
@@ -17599,7 +18779,7 @@ ActiveTab:'visual',CSS:/*css*/`
|
|
|
17599
18779
|
.pict-fe-help-body .pict-content-code-wrap .attr-name { color: #986801 !important; }
|
|
17600
18780
|
.pict-fe-help-body .pict-content .pict-content-code-wrap .attr-value,
|
|
17601
18781
|
.pict-fe-help-body .pict-content-code-wrap .attr-value { color: #50A14F !important; }
|
|
17602
|
-
`,Templates:[{Hash:'FormEditor-Container-Template',Template:'<div class="pict-formeditor" id="FormEditor-Wrap-{~D:Context[0].Hash~}"></div>'}],Renderables:[{RenderableHash:'FormEditor-Container',TemplateHash:'FormEditor-Container-Template',DestinationAddress:'#FormEditor-Container',RenderMethod:'replace'}]};},{}],
|
|
18782
|
+
`,Templates:[{Hash:'FormEditor-Container-Template',Template:'<div class="pict-formeditor" id="FormEditor-Wrap-{~D:Context[0].Hash~}"></div>'}],Renderables:[{RenderableHash:'FormEditor-Container',TemplateHash:'FormEditor-Container-Template',DestinationAddress:'#FormEditor-Container',RenderMethod:'replace'}]};},{}],355:[function(require,module,exports){// Pict Section: Form Editor
|
|
17603
18783
|
// A visual editor for pict-section-form configuration manifests.
|
|
17604
18784
|
// The main form editor view class
|
|
17605
18785
|
module.exports=require('./views/PictView-FormEditor.js');// Default configuration
|
|
@@ -17612,12 +18792,13 @@ module.exports.UtilitiesProvider=require('./providers/Pict-Provider-FormEditorUt
|
|
|
17612
18792
|
module.exports.PropertiesPanel=require('./views/PictView-FormEditor-PropertiesPanel.js');// Inline editing view
|
|
17613
18793
|
module.exports.InlineEditing=require('./views/PictView-FormEditor-InlineEditing.js');// Input type picker view
|
|
17614
18794
|
module.exports.InputTypePicker=require('./views/PictView-FormEditor-InputTypePicker.js');// Documentation provider for embedded help system
|
|
17615
|
-
module.exports.DocumentationProvider=require('./providers/Pict-Provider-FormEditorDocumentation.js')
|
|
18795
|
+
module.exports.DocumentationProvider=require('./providers/Pict-Provider-FormEditorDocumentation.js');// Markdown editor view (pict-section-markdowneditor for content editing)
|
|
18796
|
+
module.exports.MarkdownEditor=require('pict-section-markdowneditor');},{"./Pict-Section-FormEditor-DefaultConfiguration.js":354,"./providers/Pict-Provider-FormEditorDocumentation.js":358,"./providers/Pict-Provider-FormEditorDragDrop.js":359,"./providers/Pict-Provider-FormEditorIconography.js":360,"./providers/Pict-Provider-FormEditorManifestOps.js":361,"./providers/Pict-Provider-FormEditorRendering.js":362,"./providers/Pict-Provider-FormEditorUtilities.js":363,"./views/PictView-FormEditor-InlineEditing.js":365,"./views/PictView-FormEditor-InputTypePicker.js":366,"./views/PictView-FormEditor-PropertiesPanel.js":367,"./views/PictView-FormEditor.js":368,"pict-section-markdowneditor":224}],356:[function(require,module,exports){const libPictSectionForm=require('pict-section-form');class ChildPictApplication extends libPictSectionForm.PictFormApplication{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);// Trying this pattern -- it seems to make the most sense.
|
|
17616
18797
|
// MainViewportViewIdentifier: 'Default-View',
|
|
17617
18798
|
// MainViewportRenderableHash: false,
|
|
17618
18799
|
// MainViewportDestinationAddress: false,
|
|
17619
18800
|
// MainViewportDefaultDataAddress: false,
|
|
17620
|
-
this.options.AutoSolveAfterInitialize=false;this.options.AutoRenderMainViewportViewAfterInitialize=false;this.options.AutoRenderViewsAfterInitialize=false;this.options.AutoLoginAfterInitialize=false;this.options.AutoLoadDataAfterLogin=false;}onBeforeInitialize(){this.log.trace(`Initializing embedded application.`);return super.onBeforeInitialize();}onAfterInitialize(){this.log.trace(`Finished initializing embedded application.`);return super.onAfterInitialize();}onAfterRender(){return super.onAfterRender();}}module.exports=ChildPictApplication;},{"pict-section-form":155}],
|
|
18801
|
+
this.options.AutoSolveAfterInitialize=false;this.options.AutoRenderMainViewportViewAfterInitialize=false;this.options.AutoRenderViewsAfterInitialize=false;this.options.AutoLoginAfterInitialize=false;this.options.AutoLoadDataAfterLogin=false;}onBeforeInitialize(){this.log.trace(`Initializing embedded application.`);return super.onBeforeInitialize();}onAfterInitialize(){this.log.trace(`Finished initializing embedded application.`);return super.onAfterInitialize();}onAfterRender(){return super.onAfterRender();}}module.exports=ChildPictApplication;},{"pict-section-form":155}],357:[function(require,module,exports){const libPictProvider=require('pict-provider');const libPict=require('pict');const libPictCustomApplication=require('./Pict-Provider-ChildPictManager-Application.js');class ChildPictManager extends libPictProvider{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='PictProvider';// The cache location for other instances of pict
|
|
17621
18802
|
this._PictCache={};}// Check if a pict instance exists for this cache
|
|
17622
18803
|
childApplicationExists(pFormHash){const tmpFormHash=this.fable.DataFormat.sanitizeObjectKey(pFormHash);if(this._PictCache[tmpFormHash]){return true;}return false;}childApplication(pFormHash){const tmpFormHash=this.fable.DataFormat.sanitizeObjectKey(pFormHash);if(this.childApplicationExists(tmpFormHash)){return this._PictCache[tmpFormHash];}return null;}/**
|
|
17623
18804
|
* Destroy and remove a cached child application.
|
|
@@ -17648,7 +18829,7 @@ const tmpChildPictSettings={Product:`FormPreview-${tmpFormHash}`,ProductVersion:
|
|
|
17648
18829
|
// The parent already has all pict-section-form CSS loaded.
|
|
17649
18830
|
if(tmpChildPict.CSSMap){tmpChildPict.CSSMap.injectCSS=function(){};}this._PictCache[tmpFormHash]=tmpChildPict;// Set the global reference so {~P~} expressions resolve
|
|
17650
18831
|
if(typeof window!=='undefined'&&pBrowserAddress){let tmpAddressParts=pBrowserAddress.split('.');if(tmpAddressParts.length===2&&tmpAddressParts[0]==='window'){window[tmpAddressParts[1]]=tmpChildPict;}}// Configure the application to render into the target container
|
|
17651
|
-
let tmpAppOptions={MainViewportDestinationAddress:pDestinationSelector,AutoPopulateAfterRender:true};tmpChildPict.addApplication(tmpFormHash,tmpAppOptions,libPictCustomApplication);let tmpSelf=this;tmpChildPict.PictApplication.initializeAsync(function(pError){if(pError){tmpSelf.log.error('Error initializing renderable child pict application: '+pError);}if(typeof fCallback==='function'){fCallback(pError,tmpChildPict);}});return tmpChildPict;}catch(pError){this.log.error(`Error initializing renderable child pict application for form ${pFormHash}: ${pError}`);if(typeof fCallback==='function'){fCallback(pError,null);}return null;}}}module.exports=ChildPictManager;module.exports.default_configuration={};},{"./Pict-Provider-ChildPictManager-Application.js":
|
|
18832
|
+
let tmpAppOptions={MainViewportDestinationAddress:pDestinationSelector,AutoPopulateAfterRender:true};tmpChildPict.addApplication(tmpFormHash,tmpAppOptions,libPictCustomApplication);let tmpSelf=this;tmpChildPict.PictApplication.initializeAsync(function(pError){if(pError){tmpSelf.log.error('Error initializing renderable child pict application: '+pError);}if(typeof fCallback==='function'){fCallback(pError,tmpChildPict);}});return tmpChildPict;}catch(pError){this.log.error(`Error initializing renderable child pict application for form ${pFormHash}: ${pError}`);if(typeof fCallback==='function'){fCallback(pError,null);}return null;}}}module.exports=ChildPictManager;module.exports.default_configuration={};},{"./Pict-Provider-ChildPictManager-Application.js":356,"pict":254,"pict-provider":144}],358:[function(require,module,exports){const libPictProvider=require('pict-provider');/**
|
|
17652
18833
|
* Documentation Provider for the Form Editor.
|
|
17653
18834
|
*
|
|
17654
18835
|
* Manages fetching, caching, and navigation of markdown help articles.
|
|
@@ -17670,9 +18851,9 @@ this._ClickHandlerAttached=false;}/**
|
|
|
17670
18851
|
*
|
|
17671
18852
|
* @param {string} pPath - Path to the markdown file (e.g. 'docs/ToC.md')
|
|
17672
18853
|
* @param {boolean} pPushToStack - If true, push the current article onto the navigation stack before navigating
|
|
17673
|
-
*/loadArticle(pPath,pPushToStack){if(!pPath){pPath=this._BasePath+'ToC.md';}if(!this._ParentFormEditor){return;}//
|
|
17674
|
-
if(pPath
|
|
17675
|
-
|
|
18854
|
+
*/loadArticle(pPath,pPushToStack){if(!pPath){pPath=this._BasePath+'ToC.md';}if(!this._ParentFormEditor){return;}// Only push onto the navigation stack if we are navigating to a different article
|
|
18855
|
+
if(pPushToStack&&this._CurrentPath&&pPath!==this._CurrentPath){this._NavigationStack.push({path:this._CurrentPath,title:this._CurrentTitle});}this._CurrentPath=pPath;// If cached, render immediately (always render even if same article,
|
|
18856
|
+
// because the help panel may have just become visible and needs content)
|
|
17676
18857
|
if(this._Cache[pPath]){this._renderArticle(this._Cache[pPath].html,this._Cache[pPath].title);return;}// Show loading state
|
|
17677
18858
|
let tmpContentView=this._ParentFormEditor._HelpContentView;if(tmpContentView&&typeof tmpContentView.showLoading==='function'){let tmpBodyId='Pict-Content-Body';tmpContentView.showLoading('Loading article...',tmpBodyId);}// Fetch the markdown file
|
|
17678
18859
|
let tmpXHR=new XMLHttpRequest();tmpXHR.open('GET',pPath,true);tmpXHR.onreadystatechange=()=>{if(tmpXHR.readyState===4){if(tmpXHR.status===200){let tmpMarkdown=tmpXHR.responseText;let tmpTitle=this._extractTitle(tmpMarkdown);let tmpContentProvider=this._ParentFormEditor._HelpContentProvider;if(tmpContentProvider){let tmpLinkResolver=(pHref,pLinkText)=>{return this._linkResolver(pHref,pLinkText);};let tmpHTML=tmpContentProvider.parseMarkdown(tmpMarkdown,tmpLinkResolver);// Cache the result
|
|
@@ -17728,7 +18909,7 @@ if(this._CurrentTitle&&this._CurrentTitle!=='Help'){tmpHTML+='<span class="pict-
|
|
|
17728
18909
|
*
|
|
17729
18910
|
* @param {string} pString - The string to escape
|
|
17730
18911
|
* @returns {string} The escaped string
|
|
17731
|
-
*/_escapeHTML(pString){if(typeof pString!=='string'){return'';}return pString.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"');}}module.exports=FormEditorDocumentation;},{"pict-provider":144}],
|
|
18912
|
+
*/_escapeHTML(pString){if(typeof pString!=='string'){return'';}return pString.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"');}}module.exports=FormEditorDocumentation;},{"pict-provider":144}],359:[function(require,module,exports){const libPictProvider=require('pict-provider');class FormEditorDragDrop extends libPictProvider{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='PictProvider';// Back-reference to the parent FormEditor view (set after construction)
|
|
17732
18913
|
this._ParentFormEditor=null;}/**
|
|
17733
18914
|
* Enable or disable drag-and-drop reordering.
|
|
17734
18915
|
*
|
|
@@ -17741,19 +18922,30 @@ this._ParentFormEditor=null;}/**
|
|
|
17741
18922
|
if(pEvent&&pEvent.stopPropagation){pEvent.stopPropagation();}this._ParentFormEditor._DragState={Type:pType,Indices:[pIndex0,pIndex1,pIndex2,pIndex3].filter(pVal=>{return typeof pVal==='number';})};if(pEvent&&pEvent.dataTransfer){pEvent.dataTransfer.effectAllowed='move';// Required for Firefox
|
|
17742
18923
|
pEvent.dataTransfer.setData('text/plain','');}if(pEvent&&pEvent.currentTarget){pEvent.currentTarget.classList.add('pict-fe-dragging');}}onDragOver(pEvent,pType,pIndex0,pIndex1,pIndex2,pIndex3){if(!this._ParentFormEditor._DragAndDropEnabled||!this._ParentFormEditor._DragState){return;}// Only allow drops of the same type
|
|
17743
18924
|
if(this._ParentFormEditor._DragState.Type!==pType){return;}// Stop propagation so parent containers don't also highlight
|
|
17744
|
-
if(pEvent&&pEvent.stopPropagation){pEvent.stopPropagation();}pEvent.preventDefault();if(pEvent&&pEvent.dataTransfer){pEvent.dataTransfer.dropEffect='move';}if(pEvent&&pEvent.currentTarget){
|
|
17745
|
-
|
|
17746
|
-
|
|
17747
|
-
|
|
17748
|
-
this._ParentFormEditor._ManifestOpsProvider._syncRowIndices(tmpManifest,tmpSourceGroup);if(!tmpSameContainer){this._ParentFormEditor._ManifestOpsProvider._syncRowIndices(tmpManifest,tmpTargetGroup);}break;}case'input':{let tmpSourceSection=tmpManifest.Sections[tmpSourceIndices[0]];let tmpTargetSection=tmpManifest.Sections[tmpTargetIndices[0]];if(!tmpSourceSection||!Array.isArray(tmpSourceSection.Groups)||!tmpTargetSection||!Array.isArray(tmpTargetSection.Groups)){return;}let tmpSourceGroup=tmpSourceSection.Groups[tmpSourceIndices[1]];let tmpTargetGroup=tmpTargetSection.Groups[tmpTargetIndices[1]];if(!tmpSourceGroup||!Array.isArray(tmpSourceGroup.Rows)||!tmpTargetGroup||!Array.isArray(tmpTargetGroup.Rows)){return;}let tmpSourceRow=tmpSourceGroup.Rows[tmpSourceIndices[2]];let tmpTargetRow=tmpTargetGroup.Rows[tmpTargetIndices[2]];if(!tmpSourceRow||!Array.isArray(tmpSourceRow.Inputs)||!tmpTargetRow){return;}if(!Array.isArray(tmpTargetRow.Inputs)){tmpTargetRow.Inputs=[];}let tmpAddress=tmpSourceRow.Inputs.splice(tmpSourceIndices[3],1)[0];let tmpInsertIdx=tmpTargetIndices[3];let tmpSameContainer=tmpSourceIndices[0]===tmpTargetIndices[0]&&tmpSourceIndices[1]===tmpTargetIndices[1]&&tmpSourceIndices[2]===tmpTargetIndices[2];if(tmpSameContainer&&tmpSourceIndices[3]<tmpTargetIndices[3]){tmpInsertIdx--;}tmpTargetRow.Inputs.splice(tmpInsertIdx,0,tmpAddress);// Update the Descriptor's PictForm metadata for the new location
|
|
18925
|
+
if(pEvent&&pEvent.stopPropagation){pEvent.stopPropagation();}pEvent.preventDefault();if(pEvent&&pEvent.dataTransfer){pEvent.dataTransfer.dropEffect='move';}if(pEvent&&pEvent.currentTarget){// Detect whether the cursor is in the top or bottom half of the target
|
|
18926
|
+
let tmpRect=pEvent.currentTarget.getBoundingClientRect();let tmpMidpoint=tmpRect.top+tmpRect.height/2;let tmpIsTopHalf=pEvent.clientY<tmpMidpoint;pEvent.currentTarget.classList.remove('pict-fe-drag-insert-before');pEvent.currentTarget.classList.remove('pict-fe-drag-insert-after');if(tmpIsTopHalf){pEvent.currentTarget.classList.add('pict-fe-drag-insert-before');}else{pEvent.currentTarget.classList.add('pict-fe-drag-insert-after');}this._ParentFormEditor._DragState.InsertPosition=tmpIsTopHalf?'before':'after';}}onDragLeave(pEvent){if(pEvent&&pEvent.stopPropagation){pEvent.stopPropagation();}if(pEvent&&pEvent.currentTarget){pEvent.currentTarget.classList.remove('pict-fe-drag-over');pEvent.currentTarget.classList.remove('pict-fe-drag-insert-before');pEvent.currentTarget.classList.remove('pict-fe-drag-insert-after');}}onDrop(pEvent,pType,pIndex0,pIndex1,pIndex2,pIndex3){if(pEvent){pEvent.preventDefault();if(pEvent.stopPropagation){pEvent.stopPropagation();}}if(!this._ParentFormEditor._DragAndDropEnabled||!this._ParentFormEditor._DragState||this._ParentFormEditor._DragState.Type!==pType){this._ParentFormEditor._DragState=null;return;}let tmpTargetIndices=[pIndex0,pIndex1,pIndex2,pIndex3].filter(pVal=>{return typeof pVal==='number';});let tmpSourceIndices=this._ParentFormEditor._DragState.Indices;let tmpInsertPosition=this._ParentFormEditor._DragState.InsertPosition||'before';this._ParentFormEditor._DragState=null;// Check if source and target are identical
|
|
18927
|
+
if(tmpSourceIndices.length===tmpTargetIndices.length&&tmpSourceIndices.every((pVal,pIdx)=>{return pVal===tmpTargetIndices[pIdx];})){return;}let tmpManifest=this._ParentFormEditor._resolveManifestData();if(!tmpManifest||!Array.isArray(tmpManifest.Sections)){return;}switch(pType){case'section':{let tmpFromIdx=tmpSourceIndices[0];let tmpToIdx=tmpTargetIndices[0];if(tmpFromIdx===tmpToIdx){return;}let tmpItem=tmpManifest.Sections.splice(tmpFromIdx,1)[0];let tmpInsertIdx=this._computeInsertIndex(tmpFromIdx,tmpToIdx,true,tmpInsertPosition);tmpManifest.Sections.splice(tmpInsertIdx,0,tmpItem);break;}case'group':{let tmpSourceSection=tmpManifest.Sections[tmpSourceIndices[0]];let tmpTargetSection=tmpManifest.Sections[tmpTargetIndices[0]];if(!tmpSourceSection||!Array.isArray(tmpSourceSection.Groups)||!tmpTargetSection){return;}if(!Array.isArray(tmpTargetSection.Groups)){tmpTargetSection.Groups=[];}let tmpSameContainer=tmpSourceIndices[0]===tmpTargetIndices[0];let tmpItem=tmpSourceSection.Groups.splice(tmpSourceIndices[1],1)[0];let tmpInsertIdx=this._computeInsertIndex(tmpSourceIndices[1],tmpTargetIndices[1],tmpSameContainer,tmpInsertPosition);tmpTargetSection.Groups.splice(tmpInsertIdx,0,tmpItem);break;}case'row':{let tmpSourceSection=tmpManifest.Sections[tmpSourceIndices[0]];let tmpTargetSection=tmpManifest.Sections[tmpTargetIndices[0]];if(!tmpSourceSection||!Array.isArray(tmpSourceSection.Groups)||!tmpTargetSection||!Array.isArray(tmpTargetSection.Groups)){return;}let tmpSourceGroup=tmpSourceSection.Groups[tmpSourceIndices[1]];let tmpTargetGroup=tmpTargetSection.Groups[tmpTargetIndices[1]];if(!tmpSourceGroup||!Array.isArray(tmpSourceGroup.Rows)||!tmpTargetGroup){return;}if(!Array.isArray(tmpTargetGroup.Rows)){tmpTargetGroup.Rows=[];}let tmpItem=tmpSourceGroup.Rows.splice(tmpSourceIndices[2],1)[0];let tmpSameContainer=tmpSourceIndices[0]===tmpTargetIndices[0]&&tmpSourceIndices[1]===tmpTargetIndices[1];let tmpInsertIdx=this._computeInsertIndex(tmpSourceIndices[2],tmpTargetIndices[2],tmpSameContainer,tmpInsertPosition);tmpTargetGroup.Rows.splice(tmpInsertIdx,0,tmpItem);// Sync row indices on both source and target groups
|
|
18928
|
+
this._ParentFormEditor._ManifestOpsProvider._syncRowIndices(tmpManifest,tmpSourceGroup);if(!tmpSameContainer){this._ParentFormEditor._ManifestOpsProvider._syncRowIndices(tmpManifest,tmpTargetGroup);}break;}case'input':{let tmpSourceSection=tmpManifest.Sections[tmpSourceIndices[0]];let tmpTargetSection=tmpManifest.Sections[tmpTargetIndices[0]];if(!tmpSourceSection||!Array.isArray(tmpSourceSection.Groups)||!tmpTargetSection||!Array.isArray(tmpTargetSection.Groups)){return;}let tmpSourceGroup=tmpSourceSection.Groups[tmpSourceIndices[1]];let tmpTargetGroup=tmpTargetSection.Groups[tmpTargetIndices[1]];if(!tmpSourceGroup||!Array.isArray(tmpSourceGroup.Rows)||!tmpTargetGroup||!Array.isArray(tmpTargetGroup.Rows)){return;}let tmpSourceRow=tmpSourceGroup.Rows[tmpSourceIndices[2]];let tmpTargetRow=tmpTargetGroup.Rows[tmpTargetIndices[2]];if(!tmpSourceRow||!Array.isArray(tmpSourceRow.Inputs)||!tmpTargetRow){return;}if(!Array.isArray(tmpTargetRow.Inputs)){tmpTargetRow.Inputs=[];}let tmpAddress=tmpSourceRow.Inputs.splice(tmpSourceIndices[3],1)[0];let tmpSameContainer=tmpSourceIndices[0]===tmpTargetIndices[0]&&tmpSourceIndices[1]===tmpTargetIndices[1]&&tmpSourceIndices[2]===tmpTargetIndices[2];let tmpInsertIdx=this._computeInsertIndex(tmpSourceIndices[3],tmpTargetIndices[3],tmpSameContainer,tmpInsertPosition);tmpTargetRow.Inputs.splice(tmpInsertIdx,0,tmpAddress);// Update the Descriptor's PictForm metadata for the new location
|
|
17749
18929
|
if(typeof tmpAddress==='string'&&tmpManifest.Descriptors&&tmpManifest.Descriptors[tmpAddress]){let tmpDescriptor=tmpManifest.Descriptors[tmpAddress];if(!tmpDescriptor.PictForm){tmpDescriptor.PictForm={};}tmpDescriptor.PictForm.Section=tmpTargetSection.Hash||'';tmpDescriptor.PictForm.Group=tmpTargetGroup.Hash||'';tmpDescriptor.PictForm.Row=tmpTargetIndices[2]+1;}break;}default:return;}this._ParentFormEditor.renderVisualEditor();}onDragEnd(pEvent){if(pEvent&&pEvent.currentTarget){pEvent.currentTarget.classList.remove('pict-fe-dragging');}this._ParentFormEditor._DragState=null;// Clean up any leftover drag-over highlights
|
|
17750
|
-
let tmpContainer=this.pict.ContentAssignment.getElement(`#FormEditor-Panel-Visual-${this._ParentFormEditor.Hash}`);if(tmpContainer&&tmpContainer[0]){let tmpHighlighted=tmpContainer[0].querySelectorAll('.pict-fe-drag-over');for(let i=0;i<tmpHighlighted.length;i++){tmpHighlighted[i].classList.remove('pict-fe-drag-over');}}}/**
|
|
18930
|
+
let tmpContainer=this.pict.ContentAssignment.getElement(`#FormEditor-Panel-Visual-${this._ParentFormEditor.Hash}`);if(tmpContainer&&tmpContainer[0]){let tmpHighlighted=tmpContainer[0].querySelectorAll('.pict-fe-drag-over, .pict-fe-drag-insert-before, .pict-fe-drag-insert-after');for(let i=0;i<tmpHighlighted.length;i++){tmpHighlighted[i].classList.remove('pict-fe-drag-over');tmpHighlighted[i].classList.remove('pict-fe-drag-insert-before');tmpHighlighted[i].classList.remove('pict-fe-drag-insert-after');}}}/**
|
|
17751
18931
|
* Check whether two index arrays share the same parent container.
|
|
17752
18932
|
* Utility method — cross-container moves are allowed so this is
|
|
17753
18933
|
* not used as a gate in onDragOver/onDrop, but it remains available
|
|
17754
18934
|
* for callers that need to distinguish same-container vs cross-container moves.
|
|
17755
18935
|
*/_dragIndicesShareParent(pSourceIndices,pTargetIndices){if(pSourceIndices.length!==pTargetIndices.length){return false;}// Compare all indices except the last one (which is the item's own position)
|
|
17756
18936
|
for(let i=0;i<pSourceIndices.length-1;i++){if(pSourceIndices[i]!==pTargetIndices[i]){return false;}}return true;}/**
|
|
18937
|
+
* Compute the final insert index for a position-aware drag-and-drop.
|
|
18938
|
+
*
|
|
18939
|
+
* After removing the source item from its array, this method determines the
|
|
18940
|
+
* correct splice index based on the user's cursor position (insert before or
|
|
18941
|
+
* after the target).
|
|
18942
|
+
*
|
|
18943
|
+
* @param {number} pSourceIdx - The source item's index within its container
|
|
18944
|
+
* @param {number} pTargetIdx - The target item's index within its container
|
|
18945
|
+
* @param {boolean} pSameContainer - Whether source and target share the same parent
|
|
18946
|
+
* @param {string} pInsertPosition - 'before' or 'after'
|
|
18947
|
+
* @returns {number} The index to use with Array.splice after removing the source
|
|
18948
|
+
*/_computeInsertIndex(pSourceIdx,pTargetIdx,pSameContainer,pInsertPosition){let tmpLogicalTarget=pInsertPosition==='before'?pTargetIdx:pTargetIdx+1;if(pSameContainer&&pSourceIdx<tmpLogicalTarget){tmpLogicalTarget--;}return tmpLogicalTarget;}/**
|
|
17757
18949
|
* Build the drag attribute string for a container element.
|
|
17758
18950
|
* Returns an empty string when drag-and-drop is disabled.
|
|
17759
18951
|
*/_buildDragAttributes(pType,pIndices){if(!this._ParentFormEditor._DragAndDropEnabled){return'';}let tmpViewRef=this._ParentFormEditor._browserViewRef();let tmpArgs=pIndices.join(', ');return` draggable="true"`+` ondragstart="${tmpViewRef}._DragDropProvider.onDragStart(event, '${pType}', ${tmpArgs})"`+` ondragover="${tmpViewRef}._DragDropProvider.onDragOver(event, '${pType}', ${tmpArgs})"`+` ondragleave="${tmpViewRef}._DragDropProvider.onDragLeave(event)"`+` ondrop="${tmpViewRef}._DragDropProvider.onDrop(event, '${pType}', ${tmpArgs})"`+` ondragend="${tmpViewRef}._DragDropProvider.onDragEnd(event)"`;}/**
|
|
@@ -17770,7 +18962,7 @@ let tmpSourceSection=tmpManifest.Sections[tmpSourceIndices[0]];let tmpTargetSect
|
|
|
17770
18962
|
if(typeof tmpAddress==='string'&&tmpManifest.Descriptors&&tmpManifest.Descriptors[tmpAddress]){let tmpDescriptor=tmpManifest.Descriptors[tmpAddress];if(!tmpDescriptor.PictForm){tmpDescriptor.PictForm={};}tmpDescriptor.PictForm.Section=tmpTargetSection.Hash||'';tmpDescriptor.PictForm.Group=tmpTargetGroup.Hash||'';tmpDescriptor.PictForm.Row=tmpContainerIndices[2]+1;}break;}default:return;}this._ParentFormEditor.renderVisualEditor();}/**
|
|
17771
18963
|
* Build the drag handle HTML for a container element.
|
|
17772
18964
|
* Returns an empty string when drag-and-drop is disabled.
|
|
17773
|
-
*/_buildDragHandleHTML(pSize){if(!this._ParentFormEditor._DragAndDropEnabled){return'';}return`<span class="pict-fe-drag-handle">${this._ParentFormEditor._IconographyProvider.getIcon('Action','DragHandle',pSize||12)}</span>`;}}module.exports=FormEditorDragDrop;module.exports.default_configuration={};},{"pict-provider":144}],
|
|
18965
|
+
*/_buildDragHandleHTML(pSize){if(!this._ParentFormEditor._DragAndDropEnabled){return'';}return`<span class="pict-fe-drag-handle">${this._ParentFormEditor._IconographyProvider.getIcon('Action','DragHandle',pSize||12)}</span>`;}}module.exports=FormEditorDragDrop;module.exports.default_configuration={};},{"pict-provider":144}],360:[function(require,module,exports){/**
|
|
17774
18966
|
* Pict Provider: Form Editor Iconography
|
|
17775
18967
|
*
|
|
17776
18968
|
* Provides cohesive SVG icons for the Form Editor UI, organized by category:
|
|
@@ -17960,7 +19152,7 @@ this._DataTypeIcons['Binary']=function(pSize,pColors,pSW){return _svg(pSize,'<re
|
|
|
17960
19152
|
this._DataTypeIcons['DateTime']=function(pSize,pColors,pSW){return _svg(pSize,'<circle cx="12" cy="12" r="9" fill="'+pColors.Fill+'" stroke="'+pColors.Primary+'" stroke-width="'+pSW+'"/>'+'<polyline points="12 7 12 12 16 14" stroke="'+pColors.Accent+'" stroke-width="'+pSW+'" fill="none"/>');};// Array — stacked brackets
|
|
17961
19153
|
this._DataTypeIcons['Array']=function(pSize,pColors,pSW){return _svg(pSize,'<path d="M8 4H5v16h3" stroke="'+pColors.Primary+'" stroke-width="'+pSW+'" fill="none"/>'+'<path d="M16 4h3v16h-3" stroke="'+pColors.Primary+'" stroke-width="'+pSW+'" fill="none"/>'+'<circle cx="9" cy="12" r="1.2" fill="'+pColors.Accent+'"/>'+'<circle cx="12" cy="12" r="1.2" fill="'+pColors.Accent+'"/>'+'<circle cx="15" cy="12" r="1.2" fill="'+pColors.Accent+'"/>');};// Object — curly braces
|
|
17962
19154
|
this._DataTypeIcons['Object']=function(pSize,pColors,pSW){return _svg(pSize,'<path d="M8 3H6a2 2 0 00-2 2v4.5a1.5 1.5 0 01-1.5 1.5 1.5 1.5 0 011.5 1.5V17a2 2 0 002 2h2" stroke="'+pColors.Primary+'" stroke-width="'+pSW+'" fill="none"/>'+'<path d="M16 3h2a2 2 0 012 2v4.5a1.5 1.5 0 001.5 1.5 1.5 1.5 0 00-1.5 1.5V17a2 2 0 01-2 2h-2" stroke="'+pColors.Primary+'" stroke-width="'+pSW+'" fill="none"/>');};// Null — empty circle with dash
|
|
17963
|
-
this._DataTypeIcons['Null']=function(pSize,pColors,pSW){return _svg(pSize,'<circle cx="12" cy="12" r="8" fill="none" stroke="'+pColors.Muted+'" stroke-width="'+pSW+'" stroke-dasharray="3 2"/>'+'<line x1="8" y1="12" x2="16" y2="12" stroke="'+pColors.Muted+'" stroke-width="'+pSW+'"/>');};}}module.exports=PictProviderFormEditorIconography;module.exports.default_configuration=_DefaultProviderConfiguration;},{}],
|
|
19155
|
+
this._DataTypeIcons['Null']=function(pSize,pColors,pSW){return _svg(pSize,'<circle cx="12" cy="12" r="8" fill="none" stroke="'+pColors.Muted+'" stroke-width="'+pSW+'" stroke-dasharray="3 2"/>'+'<line x1="8" y1="12" x2="16" y2="12" stroke="'+pColors.Muted+'" stroke-width="'+pSW+'"/>');};}}module.exports=PictProviderFormEditorIconography;module.exports.default_configuration=_DefaultProviderConfiguration;},{}],361:[function(require,module,exports){const libPictProvider=require('pict-provider');class FormEditorManifestOps extends libPictProvider{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='PictProvider';// Back-reference to the parent FormEditor view (set after construction)
|
|
17964
19156
|
this._ParentFormEditor=null;}/**
|
|
17965
19157
|
* Reconcile the manifest structure so that every Descriptor's PictForm
|
|
17966
19158
|
* reference is reflected in its Section's Group's Rows[].Inputs[] arrays.
|
|
@@ -17983,8 +19175,9 @@ if(tmpExistingAddresses[tmpAddress]){continue;}let tmpDescriptor=tmpManifest.Des
|
|
|
17983
19175
|
let tmpGroupHash=tmpPictForm.Group||null;let tmpGroupIndex=-1;if(tmpGroupHash&&tmpGroupMap[tmpSectionHash].hasOwnProperty(tmpGroupHash)){tmpGroupIndex=tmpGroupMap[tmpSectionHash][tmpGroupHash];}else if(!tmpGroupHash&&tmpSection.Groups.length>0){// Default to first group when PictForm.Group is omitted
|
|
17984
19176
|
tmpGroupIndex=0;}if(tmpGroupIndex<0){// Create a default group for this section
|
|
17985
19177
|
let tmpNewGroupHash=tmpGroupHash||tmpSectionHash+'Group_Default';let tmpNewGroupName=tmpGroupHash||'Default';tmpSection.Groups.push({Hash:tmpNewGroupHash,Name:tmpNewGroupName,Layout:'Record'});tmpGroupIndex=tmpSection.Groups.length-1;tmpGroupMap[tmpSectionHash][tmpNewGroupHash]=tmpGroupIndex;}let tmpGroup=tmpSection.Groups[tmpGroupIndex];// Ensure the group has a Rows array
|
|
17986
|
-
if(!Array.isArray(tmpGroup.Rows)){tmpGroup.Rows=[];}// PictForm.Row is 1-based; pad with empty rows if necessary
|
|
17987
|
-
|
|
19178
|
+
if(!Array.isArray(tmpGroup.Rows)){tmpGroup.Rows=[];}// PictForm.Row is 1-based; pad with empty rows if necessary.
|
|
19179
|
+
// Row may be a number or a string (e.g. "2") in real-world manifests.
|
|
19180
|
+
let tmpRowNumber=parseInt(tmpPictForm.Row,10);if(isNaN(tmpRowNumber)||tmpRowNumber<1){tmpRowNumber=1;}let tmpRowIndex=tmpRowNumber-1;while(tmpGroup.Rows.length<=tmpRowIndex){tmpGroup.Rows.push({Inputs:[]});}let tmpRow=tmpGroup.Rows[tmpRowIndex];if(!Array.isArray(tmpRow.Inputs)){tmpRow.Inputs=[];}tmpRow.Inputs.push(tmpAddress);}}addSection(){let tmpManifest=this._resolveManifestData();if(!tmpManifest){return;}if(!Array.isArray(tmpManifest.Sections)){tmpManifest.Sections=[];}let tmpIndex=tmpManifest.Sections.length;let tmpSectionNum=tmpIndex+1;let tmpSectionName=`Section ${tmpSectionNum}`;let tmpSectionHash=`S${tmpSectionNum}`;let tmpGroupName='Group 1';let tmpGroupHash=`${tmpSectionHash}_G1`;tmpManifest.Sections.push({Hash:tmpSectionHash,Name:tmpSectionName,Groups:[{Hash:tmpGroupHash,Name:tmpGroupName,Layout:'Record'}]});this._ParentFormEditor.renderVisualEditor();}removeSection(pIndex){let tmpManifest=this._resolveManifestData();if(!tmpManifest||!Array.isArray(tmpManifest.Sections)){return;}if(pIndex>=0&&pIndex<tmpManifest.Sections.length){// Clean up Descriptor entries for all inputs in this section
|
|
17988
19181
|
let tmpSection=tmpManifest.Sections[pIndex];this._removeDescriptorsForSection(tmpManifest,tmpSection);tmpManifest.Sections.splice(pIndex,1);this._ParentFormEditor.renderVisualEditor();}}moveSectionUp(pIndex){let tmpManifest=this._resolveManifestData();if(!tmpManifest||!Array.isArray(tmpManifest.Sections)||pIndex<=0){return;}let tmpSection=tmpManifest.Sections.splice(pIndex,1)[0];tmpManifest.Sections.splice(pIndex-1,0,tmpSection);this._ParentFormEditor.renderVisualEditor();}moveSectionDown(pIndex){let tmpManifest=this._resolveManifestData();if(!tmpManifest||!Array.isArray(tmpManifest.Sections)||pIndex>=tmpManifest.Sections.length-1){return;}let tmpSection=tmpManifest.Sections.splice(pIndex,1)[0];tmpManifest.Sections.splice(pIndex+1,0,tmpSection);this._ParentFormEditor.renderVisualEditor();}updateSectionProperty(pSectionIndex,pProperty,pValue){let tmpManifest=this._resolveManifestData();if(!tmpManifest||!Array.isArray(tmpManifest.Sections)){return;}let tmpSection=tmpManifest.Sections[pSectionIndex];if(tmpSection){let tmpOldValue=tmpSection[pProperty];tmpSection[pProperty]=pValue;// When the section Hash changes, cascade to group hashes that
|
|
17989
19182
|
// are still auto-generated. Auto-generated group hashes follow
|
|
17990
19183
|
// the pattern {SectionHash}_G{...}. If the user has overridden
|
|
@@ -18116,9 +19309,9 @@ let tmpSelf=this._ParentFormEditor;setTimeout(function(){tmpSelf._UtilitiesProvi
|
|
|
18116
19309
|
*
|
|
18117
19310
|
* @param {object} pManifest - The manifest data object
|
|
18118
19311
|
* @param {object} pSection - The section being removed
|
|
18119
|
-
*/_removeDescriptorsForSection(pManifest,pSection){if(!pSection||!Array.isArray(pSection.Groups)||!pManifest){return;}for(let i=0;i<pSection.Groups.length;i++){this._removeDescriptorsForGroup(pManifest,pSection.Groups[i]);}}}module.exports=FormEditorManifestOps;},{"pict-provider":144}],
|
|
19312
|
+
*/_removeDescriptorsForSection(pManifest,pSection){if(!pSection||!Array.isArray(pSection.Groups)||!pManifest){return;}for(let i=0;i<pSection.Groups.length;i++){this._removeDescriptorsForGroup(pManifest,pSection.Groups[i]);}}}module.exports=FormEditorManifestOps;},{"pict-provider":144}],362:[function(require,module,exports){const libPictProvider=require('pict-provider');class FormEditorRendering extends libPictProvider{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='PictProvider';// Back-reference to the parent FormEditor view (set after construction)
|
|
18120
19313
|
this._ParentFormEditor=null;}_renderTabShell(){let tmpParent=this._ParentFormEditor;let tmpHash=tmpParent.Hash;let tmpViewRef=tmpParent._browserViewRef();let tmpHTML='';// Tab bar
|
|
18121
|
-
tmpHTML+='<div class="pict-fe-tabbar">';tmpHTML+=`<button class="pict-fe-tab pict-fe-tab-active" id="FormEditor-Tab-Visual-${tmpHash}" onclick="${tmpViewRef}.switchTab('visual')">Visual Editor</button>`;tmpHTML+=`<button class="pict-fe-tab" id="FormEditor-Tab-SolverEditor-${tmpHash}" onclick="${tmpViewRef}.switchTab('solvereditor')">Solver Editor</button>`;tmpHTML+=`<button class="pict-fe-tab" id="FormEditor-Tab-Solvers-${tmpHash}" onclick="${tmpViewRef}.switchTab('solvers')">Solvers</button>`;tmpHTML+=`<button class="pict-fe-tab" id="FormEditor-Tab-ListData-${tmpHash}" onclick="${tmpViewRef}.switchTab('listdata')">List Data</button>`;tmpHTML+=`<button class="pict-fe-tab" id="FormEditor-Tab-EntityData-${tmpHash}" onclick="${tmpViewRef}.switchTab('entitydata')">Providers</button>`;tmpHTML+=`<button class="pict-fe-tab" id="FormEditor-Tab-ObjectEditor-${tmpHash}" onclick="${tmpViewRef}.switchTab('objecteditor')">Object Editor</button>`;tmpHTML+=`<button class="pict-fe-tab" id="FormEditor-Tab-JSON-${tmpHash}" onclick="${tmpViewRef}.switchTab('json')">JSON</button>`;tmpHTML+=`<button class="pict-fe-tab" id="FormEditor-Tab-
|
|
19314
|
+
tmpHTML+='<div class="pict-fe-tabbar">';tmpHTML+=`<button class="pict-fe-tab pict-fe-tab-active" id="FormEditor-Tab-Visual-${tmpHash}" onclick="${tmpViewRef}.switchTab('visual')">Visual Editor</button>`;tmpHTML+=`<button class="pict-fe-tab" id="FormEditor-Tab-SolverEditor-${tmpHash}" onclick="${tmpViewRef}.switchTab('solvereditor')">Solver Editor</button>`;tmpHTML+=`<button class="pict-fe-tab" id="FormEditor-Tab-Solvers-${tmpHash}" onclick="${tmpViewRef}.switchTab('solvers')">Solvers</button>`;tmpHTML+=`<button class="pict-fe-tab" id="FormEditor-Tab-ListData-${tmpHash}" onclick="${tmpViewRef}.switchTab('listdata')">List Data</button>`;tmpHTML+=`<button class="pict-fe-tab" id="FormEditor-Tab-EntityData-${tmpHash}" onclick="${tmpViewRef}.switchTab('entitydata')">Providers</button>`;tmpHTML+=`<button class="pict-fe-tab" id="FormEditor-Tab-ObjectEditor-${tmpHash}" onclick="${tmpViewRef}.switchTab('objecteditor')">Object Editor</button>`;tmpHTML+=`<button class="pict-fe-tab" id="FormEditor-Tab-JSON-${tmpHash}" onclick="${tmpViewRef}.switchTab('json')">JSON</button>`;tmpHTML+=`<button class="pict-fe-tab" id="FormEditor-Tab-Import-${tmpHash}" onclick="${tmpViewRef}.switchTab('import')">Import</button>`;tmpHTML+=`<button class="pict-fe-tab" id="FormEditor-Tab-Preview-${tmpHash}" onclick="${tmpViewRef}.switchTab('preview')">Preview</button>`;tmpHTML+='</div>';// Editor layout: tab content panels + resize handle + properties panel
|
|
18122
19315
|
tmpHTML+='<div class="pict-fe-editor-layout">';// Tab content panels (stacked, only one active at a time)
|
|
18123
19316
|
tmpHTML+='<div class="pict-fe-editor-content">';// Visual editor panel
|
|
18124
19317
|
tmpHTML+=`<div class="pict-fe-tabcontent pict-fe-tabcontent-active" id="FormEditor-Panel-Visual-${tmpHash}"></div>`;// Solver editor tab panel
|
|
@@ -18127,8 +19320,8 @@ tmpHTML+=`<div class="pict-fe-tabcontent" id="FormEditor-Panel-Solvers-${tmpHash
|
|
|
18127
19320
|
tmpHTML+=`<div class="pict-fe-tabcontent" id="FormEditor-Panel-ListData-${tmpHash}">`;tmpHTML+=`<div id="FormEditor-ListDataTab-Container-${tmpHash}"></div>`;tmpHTML+='</div>';// Entity Data tab panel
|
|
18128
19321
|
tmpHTML+=`<div class="pict-fe-tabcontent" id="FormEditor-Panel-EntityData-${tmpHash}">`;tmpHTML+=`<div id="FormEditor-EntityDataTab-Container-${tmpHash}"></div>`;tmpHTML+='</div>';// Object editor panel
|
|
18129
19322
|
tmpHTML+=`<div class="pict-fe-tabcontent" id="FormEditor-Panel-ObjectEditor-${tmpHash}">`;tmpHTML+=`<div id="FormEditor-ObjectEditor-Container-${tmpHash}"></div>`;tmpHTML+='</div>';// JSON panel
|
|
18130
|
-
tmpHTML+=`<div class="pict-fe-tabcontent" id="FormEditor-Panel-JSON-${tmpHash}">`;tmpHTML+=`<div id="FormEditor-CodeEditor-Container-${tmpHash}"></div>`;tmpHTML+='</div>';//
|
|
18131
|
-
tmpHTML+=`<div class="pict-fe-tabcontent" id="FormEditor-Panel-
|
|
19323
|
+
tmpHTML+=`<div class="pict-fe-tabcontent" id="FormEditor-Panel-JSON-${tmpHash}">`;tmpHTML+=`<div id="FormEditor-CodeEditor-Container-${tmpHash}"></div>`;tmpHTML+='</div>';// Import panel
|
|
19324
|
+
tmpHTML+=`<div class="pict-fe-tabcontent" id="FormEditor-Panel-Import-${tmpHash}">`;tmpHTML+=`<div id="FormEditor-ImportTab-Container-${tmpHash}"></div>`;tmpHTML+='</div>';// Preview panel
|
|
18132
19325
|
tmpHTML+=`<div class="pict-fe-tabcontent" id="FormEditor-Panel-Preview-${tmpHash}">`;tmpHTML+=`<div id="FormEditor-PreviewTab-Container-${tmpHash}"></div>`;tmpHTML+='</div>';tmpHTML+='</div>';// pict-fe-editor-content
|
|
18133
19326
|
// Resize handle / collapse toggle (double-click to toggle)
|
|
18134
19327
|
tmpHTML+=`<div class="pict-fe-panel-toggle" onmousedown="${tmpViewRef}._UtilitiesProvider.onPanelResizeStart(event)" ondblclick="${tmpViewRef}._UtilitiesProvider.togglePropertiesPanel()">`;tmpHTML+='<div class="pict-fe-panel-toggle-grip"></div>';tmpHTML+='</div>';// Properties panel container
|
|
@@ -18172,10 +19365,10 @@ let tmpDisplayText='';if(tmpParent._InputDisplayMode==='hash'){tmpDisplayText=tm
|
|
|
18172
19365
|
let tmpIsSelected=false;if(tmpParent._SelectedTabularColumn&&tmpParent._SelectedTabularColumn.SectionIndex===pSectionIndex&&tmpParent._SelectedTabularColumn.GroupIndex===pGroupIndex&&tmpParent._SelectedTabularColumn.ColumnAddress===pColumnAddress){tmpIsSelected=true;}let tmpSelectedClass=tmpIsSelected?' pict-fe-input-selected':'';// DataType icon
|
|
18173
19366
|
let tmpDataTypeIconHTML=tmpParent._IconographyProvider.getDataTypeIcon(tmpType,12);if(!tmpDataTypeIconHTML){tmpDataTypeIconHTML=tmpParent._IconographyProvider.getIcon('Input','Default',12);}// Escape the column address for use in onclick
|
|
18174
19367
|
let tmpEscapedAddress=tmpParent._UtilitiesProvider._escapeAttr(pColumnAddress).replace(/'/g,"\\'");let tmpHTML='';tmpHTML+=`<div class="pict-fe-input${tmpSelectedClass}" id="FormEditor-SubCol-${tmpHash}-${pSectionIndex}-${pGroupIndex}-${pColumnIndex}" title="${tmpTooltip}" onclick="${tmpViewRef}._ManifestOpsProvider.selectSubmanifestColumn(${pSectionIndex}, ${pGroupIndex}, '${tmpEscapedAddress}')">`;tmpHTML+=`<span class="pict-fe-icon pict-fe-icon-datatype">${tmpDataTypeIconHTML}</span>`;tmpHTML+=`<span class="pict-fe-input-ordinal">${tmpOrdinal}</span>`;tmpHTML+=`<span class="pict-fe-input-name">${tmpParent._UtilitiesProvider._escapeHTML(tmpParent._UtilitiesProvider._truncateMiddle(tmpDisplayText,20))}</span>`;// Remove button
|
|
18175
|
-
tmpHTML+=`<button class="pict-fe-btn pict-fe-btn-sm pict-fe-btn-danger pict-fe-input-remove" onclick="event.stopPropagation(); ${tmpViewRef}._ManifestOpsProvider.removeSubmanifestColumn(${pSectionIndex}, ${pGroupIndex}, '${tmpEscapedAddress}')" title="Remove column">\u00D7</button>`;tmpHTML+='</div>';return tmpHTML;}
|
|
18176
|
-
tmpHTML+=`<div class="pict-fe-
|
|
18177
|
-
tmpHTML+=`<div class="pict-fe-
|
|
18178
|
-
if(typeof document!=='undefined'){let tmpDropZone=document.getElementById(`FormEditor-
|
|
19368
|
+
tmpHTML+=`<button class="pict-fe-btn pict-fe-btn-sm pict-fe-btn-danger pict-fe-input-remove" onclick="event.stopPropagation(); ${tmpViewRef}._ManifestOpsProvider.removeSubmanifestColumn(${pSectionIndex}, ${pGroupIndex}, '${tmpEscapedAddress}')" title="Remove column">\u00D7</button>`;tmpHTML+='</div>';return tmpHTML;}renderImportTabPanel(){let tmpParent=this._ParentFormEditor;let tmpHash=tmpParent.Hash;let tmpViewRef=tmpParent._browserViewRef();let tmpHTML='';tmpHTML+='<div class="pict-fe-import-container">';tmpHTML+='<h3 class="pict-fe-import-title">Import Form Configuration</h3>';tmpHTML+='<p class="pict-fe-import-description">Drop a CSV or JSON file below to load a form configuration. CSV files are processed through ManifestFactory. JSON files are loaded directly as manifests. If the file contains multiple forms, the first will be loaded and the rest will be available in the Load Configuration selector.</p>';// Drop zone
|
|
19369
|
+
tmpHTML+=`<div class="pict-fe-import-dropzone" id="FormEditor-ImportDropZone-${tmpHash}"`;tmpHTML+=` ondragover="event.preventDefault(); event.stopPropagation(); this.classList.add('pict-fe-import-dropzone-active');"`;tmpHTML+=` ondragleave="event.preventDefault(); event.stopPropagation(); this.classList.remove('pict-fe-import-dropzone-active');"`;tmpHTML+=` ondrop="event.preventDefault(); event.stopPropagation(); this.classList.remove('pict-fe-import-dropzone-active'); ${tmpViewRef}.handleImportDrop(event);">`;tmpHTML+='<div class="pict-fe-import-dropzone-content">';tmpHTML+=`<div class="pict-fe-import-dropzone-icon">${tmpParent._IconographyProvider.getIcon('Action','Add',48)}</div>`;tmpHTML+='<div class="pict-fe-import-dropzone-text">Drop CSV or JSON file here</div>';tmpHTML+='<div class="pict-fe-import-dropzone-subtext">or click to browse</div>';tmpHTML+='</div>';tmpHTML+=`<input type="file" accept=".csv,.json" class="pict-fe-import-file-input" id="FormEditor-ImportFileInput-${tmpHash}" onchange="${tmpViewRef}.handleImportFileSelect(event)" />`;tmpHTML+='</div>';// Status / results area
|
|
19370
|
+
tmpHTML+=`<div class="pict-fe-import-status" id="FormEditor-ImportStatus-${tmpHash}"></div>`;tmpHTML+='</div>';this.pict.ContentAssignment.assignContent(`#FormEditor-ImportTab-Container-${tmpHash}`,tmpHTML);// Wire up click-to-browse on the drop zone
|
|
19371
|
+
if(typeof document!=='undefined'){let tmpDropZone=document.getElementById(`FormEditor-ImportDropZone-${tmpHash}`);let tmpFileInput=document.getElementById(`FormEditor-ImportFileInput-${tmpHash}`);if(tmpDropZone&&tmpFileInput){tmpDropZone.addEventListener('click',()=>{tmpFileInput.click();});}}}_renderRow(pRow,pSectionIndex,pGroupIndex,pRowIndex){let tmpParent=this._ParentFormEditor;let tmpViewRef=tmpParent._browserViewRef();let tmpHTML='';tmpHTML+=`<div class="pict-fe-row"${tmpParent._DragDropProvider._buildDragAttributes('row',[pSectionIndex,pGroupIndex,pRowIndex])}>`;// Row header with index and actions
|
|
18179
19372
|
tmpHTML+='<div class="pict-fe-row-header">';tmpHTML+=tmpParent._DragDropProvider._buildDragHandleHTML(10);tmpHTML+=`<span class="pict-fe-icon pict-fe-icon-row">${tmpParent._IconographyProvider.getIcon('Row','Default',12)}</span>`;tmpHTML+=`<span class="pict-fe-row-label">Row ${pRowIndex+1}</span>`;tmpHTML+='<div class="pict-fe-row-actions">';let tmpManifest=tmpParent._resolveManifestData();let tmpGroup=tmpManifest.Sections[pSectionIndex].Groups[pGroupIndex];let tmpRowCount=tmpGroup.Rows?tmpGroup.Rows.length:0;if(pRowIndex>0){tmpHTML+=`<button class="pict-fe-btn pict-fe-btn-sm" onclick="${tmpViewRef}._ManifestOpsProvider.moveRowUp(${pSectionIndex}, ${pGroupIndex}, ${pRowIndex})" title="Move row up">\u25B2</button>`;}if(pRowIndex<tmpRowCount-1){tmpHTML+=`<button class="pict-fe-btn pict-fe-btn-sm" onclick="${tmpViewRef}._ManifestOpsProvider.moveRowDown(${pSectionIndex}, ${pGroupIndex}, ${pRowIndex})" title="Move row down">\u25BC</button>`;}tmpHTML+=`<button class="pict-fe-btn pict-fe-btn-sm pict-fe-btn-danger" onclick="${tmpViewRef}._ManifestOpsProvider.removeRow(${pSectionIndex}, ${pGroupIndex}, ${pRowIndex})" title="Remove row">\u00D7</button>`;tmpHTML+='</div>';tmpHTML+='</div>';// Row inputs
|
|
18180
19373
|
tmpHTML+=`<div class="pict-fe-row-inputs"${tmpParent._DragDropProvider._buildContainerDropAttributes('input',[pSectionIndex,pGroupIndex,pRowIndex])}>`;let tmpInputs=pRow.Inputs;if(Array.isArray(tmpInputs)&&tmpInputs.length>0){for(let m=0;m<tmpInputs.length;m++){tmpHTML+=this._renderInput(tmpInputs[m],pSectionIndex,pGroupIndex,pRowIndex,m);}}tmpHTML+=`<button class="pict-fe-btn pict-fe-btn-sm pict-fe-add-input" onclick="${tmpViewRef}._ManifestOpsProvider.addInput(${pSectionIndex}, ${pGroupIndex}, ${pRowIndex})"><span class="pict-fe-icon pict-fe-icon-add">${tmpParent._IconographyProvider.getIcon('Action','Add',10)}</span> Add Input</button>`;tmpHTML+='</div>';tmpHTML+='</div>';return tmpHTML;}_renderInput(pInputAddress,pSectionIndex,pGroupIndex,pRowIndex,pInputIndex){let tmpParent=this._ParentFormEditor;let tmpHash=tmpParent.Hash;let tmpViewRef=tmpParent._browserViewRef();let tmpManifest=tmpParent._resolveManifestData();// Look up the Descriptor by address
|
|
18181
19374
|
let tmpDescriptor=null;if(typeof pInputAddress==='string'&&tmpManifest&&tmpManifest.Descriptors){tmpDescriptor=tmpManifest.Descriptors[pInputAddress];}let tmpInputHash=tmpDescriptor?tmpDescriptor.Hash||pInputAddress:typeof pInputAddress==='string'?pInputAddress:'input';let tmpName=tmpDescriptor?tmpDescriptor.Name||'':'';let tmpType=tmpDescriptor?tmpDescriptor.DataType||'String':'String';let tmpInputType=tmpDescriptor&&tmpDescriptor.PictForm&&tmpDescriptor.PictForm.InputType?tmpDescriptor.PictForm.InputType:'';let tmpWidth=tmpDescriptor&&tmpDescriptor.PictForm&&tmpDescriptor.PictForm.Width?tmpDescriptor.PictForm.Width:'';// Ordinal number (1-based position in the row)
|
|
@@ -18184,7 +19377,7 @@ let tmpTooltipParts=[];tmpTooltipParts.push('Hash: '+tmpInputHash);if(tmpName){t
|
|
|
18184
19377
|
let tmpDisplayText='';if(tmpParent._InputDisplayMode==='hash'){tmpDisplayText=tmpInputHash;}else{tmpDisplayText=tmpName||tmpInputHash;}// Check if this input is currently selected
|
|
18185
19378
|
let tmpIsSelected=false;if(tmpParent._SelectedInputIndices&&tmpParent._SelectedInputIndices[0]===pSectionIndex&&tmpParent._SelectedInputIndices[1]===pGroupIndex&&tmpParent._SelectedInputIndices[2]===pRowIndex&&tmpParent._SelectedInputIndices[3]===pInputIndex){tmpIsSelected=true;}let tmpSelectedClass=tmpIsSelected?' pict-fe-input-selected':'';// DataType icon
|
|
18186
19379
|
let tmpDataTypeIconHTML=tmpParent._IconographyProvider.getDataTypeIcon(tmpType,12);if(!tmpDataTypeIconHTML){// Fallback to generic Input icon if no DataType icon
|
|
18187
|
-
tmpDataTypeIconHTML=tmpParent._IconographyProvider.getIcon('Input','Default',12);}let tmpHTML='';tmpHTML+=`<div class="pict-fe-input${tmpSelectedClass}" id="FormEditor-Input-${tmpHash}-${pSectionIndex}-${pGroupIndex}-${pRowIndex}-${pInputIndex}" title="${tmpTooltip}"${tmpParent._DragDropProvider._buildDragAttributes('input',[pSectionIndex,pGroupIndex,pRowIndex,pInputIndex])} onclick="${tmpViewRef}._UtilitiesProvider.selectInput(${pSectionIndex}, ${pGroupIndex}, ${pRowIndex}, ${pInputIndex})">`;tmpHTML+=tmpParent._DragDropProvider._buildDragHandleHTML(10);tmpHTML+=`<span class="pict-fe-icon pict-fe-icon-datatype">${tmpDataTypeIconHTML}</span>`;tmpHTML+=`<span class="pict-fe-input-ordinal">${tmpOrdinal}</span>`;tmpHTML+=`<span class="pict-fe-input-name">${tmpParent._UtilitiesProvider._escapeHTML(tmpParent._UtilitiesProvider._truncateMiddle(tmpDisplayText,20))}</span>`;tmpHTML+=`<button class="pict-fe-btn pict-fe-btn-sm pict-fe-btn-danger pict-fe-input-remove" onclick="event.stopPropagation(); ${tmpViewRef}._ManifestOpsProvider.removeInput(${pSectionIndex}, ${pGroupIndex}, ${pRowIndex}, ${pInputIndex})" title="Remove input">\u00D7</button>`;tmpHTML+='</div>';return tmpHTML;}}module.exports=FormEditorRendering;module.exports.default_configuration={};},{"pict-provider":144}],
|
|
19380
|
+
tmpDataTypeIconHTML=tmpParent._IconographyProvider.getIcon('Input','Default',12);}let tmpHTML='';tmpHTML+=`<div class="pict-fe-input${tmpSelectedClass}" id="FormEditor-Input-${tmpHash}-${pSectionIndex}-${pGroupIndex}-${pRowIndex}-${pInputIndex}" title="${tmpTooltip}"${tmpParent._DragDropProvider._buildDragAttributes('input',[pSectionIndex,pGroupIndex,pRowIndex,pInputIndex])} onclick="${tmpViewRef}._UtilitiesProvider.selectInput(${pSectionIndex}, ${pGroupIndex}, ${pRowIndex}, ${pInputIndex})">`;tmpHTML+=tmpParent._DragDropProvider._buildDragHandleHTML(10);tmpHTML+=`<span class="pict-fe-icon pict-fe-icon-datatype">${tmpDataTypeIconHTML}</span>`;tmpHTML+=`<span class="pict-fe-input-ordinal">${tmpOrdinal}</span>`;tmpHTML+=`<span class="pict-fe-input-name">${tmpParent._UtilitiesProvider._escapeHTML(tmpParent._UtilitiesProvider._truncateMiddle(tmpDisplayText,20))}</span>`;tmpHTML+=`<button class="pict-fe-btn pict-fe-btn-sm pict-fe-btn-danger pict-fe-input-remove" onclick="event.stopPropagation(); ${tmpViewRef}._ManifestOpsProvider.removeInput(${pSectionIndex}, ${pGroupIndex}, ${pRowIndex}, ${pInputIndex})" title="Remove input">\u00D7</button>`;tmpHTML+='</div>';return tmpHTML;}}module.exports=FormEditorRendering;module.exports.default_configuration={};},{"pict-provider":144}],363:[function(require,module,exports){const libPictProvider=require('pict-provider');class FormEditorUtilities extends libPictProvider{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='PictProvider';// Back-reference to the parent FormEditor view (set after construction)
|
|
18188
19381
|
this._ParentFormEditor=null;}/**
|
|
18189
19382
|
* Sanitize a string into a valid object key.
|
|
18190
19383
|
*
|
|
@@ -18220,7 +19413,7 @@ let tmpEndLength=Math.floor((pMaxLength-1)/3);let tmpStartLength=pMaxLength-1-tm
|
|
|
18220
19413
|
// Each definition can include a Manifest with Descriptors for
|
|
18221
19414
|
// InputType-specific PictForm properties, rendered in the properties panel.
|
|
18222
19415
|
let tmpDefaults=[// Text & Content
|
|
18223
|
-
{Hash:'TextArea',Name:'Text Area',Description:'Multi-line text input',Category:'Text & Content'},{Hash:'Markdown',Name:'Markdown',Description:'Markdown-formatted text editor',Category:'Text & Content'},{Hash:'HTML',Name:'HTML',Description:'Rich HTML content block',Category:'Text & Content'},// Selection
|
|
19416
|
+
{Hash:'TextArea',Name:'Text Area',Description:'Multi-line text input',Category:'Text & Content'},{Hash:'Markdown',Name:'Markdown',Description:'Markdown-formatted text editor',Category:'Text & Content',Manifest:{Descriptors:{'ExtraDescription':{Name:'Extra Description',Hash:'ExtraDescription',DataType:'String',Description:'Supplementary description text shown below the input'}}}},{Hash:'HTML',Name:'HTML',Description:'Rich HTML content block',Category:'Text & Content',Manifest:{Descriptors:{'ExtraDescription':{Name:'Extra Description',Hash:'ExtraDescription',DataType:'String',Description:'Supplementary description text shown below the input'}}}},// Selection
|
|
18224
19417
|
{Hash:'Option',Name:'Option',Description:'Dropdown select from a set of choices',Category:'Selection',Manifest:{Descriptors:{'SelectOptions':{Name:'Select Options',Hash:'SelectOptions',DataType:'String',Description:'JSON array of {id, text} option objects'},'SelectOptionsPickList':{Name:'Pick List Name',Hash:'SelectOptionsPickList',DataType:'String',Description:'Dynamic pick list name from AppData'}}}},{Hash:'Boolean',Name:'Boolean',Description:'Checkbox or toggle for true/false values',Category:'Selection'},{Hash:'Color',Name:'Color',Description:'Color picker input',Category:'Selection'},// Display
|
|
18225
19418
|
{Hash:'DisplayOnly',Name:'Display Only',Description:'Read-only display of the value with no input control',Category:'Display',Prominent:true},{Hash:'ReadOnly',Name:'Read Only',Description:'Input-styled read-only field',Category:'Display',Prominent:true},{Hash:'PreciseNumberReadOnly',Name:'Precise Number (Read Only)',Description:'Formatted precise number display with optional prefix/postfix',Category:'Display',Prominent:true,Manifest:{Descriptors:{'DecimalPrecision':{Name:'Decimal Precision',Hash:'DecimalPrecision',DataType:'Number',Description:'Number of decimal places to display'},'AddCommas':{Name:'Add Commas',Hash:'AddCommas',DataType:'Boolean',Description:'Add thousand-separator commas to the number'},'DigitsPrefix':{Name:'Prefix',Hash:'DigitsPrefix',DataType:'String',Description:'Prefix string prepended to the value (e.g. "$")'},'DigitsPostfix':{Name:'Postfix',Hash:'DigitsPostfix',DataType:'String',Description:'Postfix string appended to the value (e.g. " USD")'}}}},{Hash:'Hidden',Name:'Hidden',Description:'Hidden input, not visible to the user',Category:'Display'},{Hash:'Chart',Name:'Chart',Description:'Data visualization chart',Category:'Display',Manifest:{Descriptors:{'ChartType':{Name:'Chart Type',Hash:'ChartType',DataType:'String',Description:'Chart.js type (bar, line, pie, doughnut, radar, polarArea)'},'ChartLabelsAddress':{Name:'Labels Address',Hash:'ChartLabelsAddress',DataType:'String',Description:'AppData address to resolve chart labels from'},'ChartLabelsSolver':{Name:'Labels Solver',Hash:'ChartLabelsSolver',DataType:'String',Description:'Fable solver expression for chart labels'},'ChartDatasetsAddress':{Name:'Datasets Address',Hash:'ChartDatasetsAddress',DataType:'String',Description:'AppData address to resolve datasets from'}}}},{Hash:'Link',Name:'Link',Description:'Clickable hyperlink display',Category:'Display'},// Navigation
|
|
18226
19419
|
{Hash:'TabSectionSelector',Name:'Tab Section Selector',Description:'Selector that controls which sections are displayed as tabs',Category:'Navigation',Manifest:{Descriptors:{'TabSectionSet':{Name:'Section Set',Hash:'TabSectionSet',DataType:'String',Description:'JSON array of section hashes to show as tabs'},'DefaultTabSectionHash':{Name:'Default Tab',Hash:'DefaultTabSectionHash',DataType:'String',Description:'Hash of the initially selected tab'},'DefaultFromData':{Name:'Default From Data',Hash:'DefaultFromData',DataType:'Boolean',Description:'Use the data value to determine the default tab'}}}},{Hash:'TabGroupSelector',Name:'Tab Group Selector',Description:'Selector that controls which groups are displayed as tabs',Category:'Navigation',Manifest:{Descriptors:{'TabGroupSet':{Name:'Group Set',Hash:'TabGroupSet',DataType:'String',Description:'JSON array of group hashes to show as tabs'},'DefaultTabGroupHash':{Name:'Default Tab',Hash:'DefaultTabGroupHash',DataType:'String',Description:'Hash of the initially selected tab'},'DefaultFromData':{Name:'Default From Data',Hash:'DefaultFromData',DataType:'Boolean',Description:'Use the data value to determine the default tab'}}}},// Advanced
|
|
@@ -18330,7 +19523,7 @@ else if((tmpGroupLayout==='Tabular'||tmpGroupLayout==='RecordSet')&&tmpGroup.Rec
|
|
|
18330
19523
|
}_updateCodeEditor(){let tmpManifest=this._ParentFormEditor._resolveManifestData();let tmpJSON=JSON.stringify(tmpManifest,null,'\t');if(this._ParentFormEditor._CodeEditorView){if(this._ParentFormEditor._CodeEditorView.codeJar){// Code editor already initialized — just update the code
|
|
18331
19524
|
this._ParentFormEditor._CodeEditorView.setCode(tmpJSON);}else{// First time switching to JSON tab — render the code editor
|
|
18332
19525
|
this._ParentFormEditor._CodeEditorView.render();// After render, setCode with current manifest
|
|
18333
|
-
if(this._ParentFormEditor._CodeEditorView.codeJar){this._ParentFormEditor._CodeEditorView.setCode(tmpJSON);}}}}}module.exports=FormEditorUtilities;module.exports.default_configuration={};},{"pict-provider":144}],
|
|
19526
|
+
if(this._ParentFormEditor._CodeEditorView.codeJar){this._ParentFormEditor._CodeEditorView.setCode(tmpJSON);}}}}}module.exports=FormEditorUtilities;module.exports.default_configuration={};},{"pict-provider":144}],364:[function(require,module,exports){const libPictProvider=require('pict-provider');/**
|
|
18334
19527
|
* Provider that prevents the child pict form preview from injecting CSS
|
|
18335
19528
|
* into the parent form editor's #PICT-CSS style element.
|
|
18336
19529
|
*
|
|
@@ -18348,7 +19541,7 @@ if(this._ParentFormEditor._CodeEditorView.codeJar){this._ParentFormEditor._CodeE
|
|
|
18348
19541
|
* Replaces the child's injectCSS method with a no-op.
|
|
18349
19542
|
*
|
|
18350
19543
|
* @param {Object} pChildPict - The child pict instance
|
|
18351
|
-
*/disableChildCSSInjection(pChildPict){if(pChildPict&&pChildPict.CSSMap){pChildPict.CSSMap.injectCSS=function(){};}}}module.exports=PreviewCSSProvider;module.exports.default_configuration={};},{"pict-provider":144}],
|
|
19544
|
+
*/disableChildCSSInjection(pChildPict){if(pChildPict&&pChildPict.CSSMap){pChildPict.CSSMap.injectCSS=function(){};}}}module.exports=PreviewCSSProvider;module.exports.default_configuration={};},{"pict-provider":144}],365:[function(require,module,exports){const libPictView=require('pict-view');class PictViewFormEditorInlineEditing extends libPictView{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this._ParentFormEditor=null;}/**
|
|
18352
19545
|
* Begin inline editing of a Section or Group property (Name or Hash).
|
|
18353
19546
|
*
|
|
18354
19547
|
* @param {string} pType - 'Section' or 'Group'
|
|
@@ -18401,7 +19594,7 @@ let tmpInputSet=this.pict.ContentAssignment.getElement(`#${tmpElementId}-Input`)
|
|
|
18401
19594
|
*/commitEditInputDataType(pSectionIndex,pGroupIndex,pRowIndex,pInputIndex){let tmpHash=this._ParentFormEditor.Hash;let tmpElementId=`FormEditor-InputType-${tmpHash}-${pSectionIndex}-${pGroupIndex}-${pRowIndex}-${pInputIndex}`;let tmpInputSet=this.pict.ContentAssignment.getElement(`#${tmpElementId}-Input`);let tmpInput=Array.isArray(tmpInputSet)&&tmpInputSet.length>0?tmpInputSet[0]:tmpInputSet;if(!tmpInput||tmpInput.value===undefined){return;}// Guard against double-commit
|
|
18402
19595
|
if(tmpInput.dataset&&tmpInput.dataset.committed==='true'){return;}// Check if cancelled via Escape
|
|
18403
19596
|
if(tmpInput.dataset&&tmpInput.dataset.cancelled==='true'){this._ParentFormEditor.renderVisualEditor();return;}if(tmpInput.dataset){tmpInput.dataset.committed='true';}let tmpNewValue=tmpInput.value;// Update the Descriptor's DataType
|
|
18404
|
-
let tmpManifest=this._ParentFormEditor._resolveManifestData();if(tmpManifest&&tmpManifest.Sections){let tmpSection=tmpManifest.Sections[pSectionIndex];let tmpGroup=tmpSection&&tmpSection.Groups?tmpSection.Groups[pGroupIndex]:null;let tmpRow=tmpGroup&&tmpGroup.Rows?tmpGroup.Rows[pRowIndex]:null;if(tmpRow&&Array.isArray(tmpRow.Inputs)){let tmpAddress=tmpRow.Inputs[pInputIndex];if(typeof tmpAddress==='string'&&tmpManifest.Descriptors&&tmpManifest.Descriptors[tmpAddress]){tmpManifest.Descriptors[tmpAddress].DataType=tmpNewValue;}}}this._ParentFormEditor.renderVisualEditor();}}module.exports=PictViewFormEditorInlineEditing;},{"pict-view":
|
|
19597
|
+
let tmpManifest=this._ParentFormEditor._resolveManifestData();if(tmpManifest&&tmpManifest.Sections){let tmpSection=tmpManifest.Sections[pSectionIndex];let tmpGroup=tmpSection&&tmpSection.Groups?tmpSection.Groups[pGroupIndex]:null;let tmpRow=tmpGroup&&tmpGroup.Rows?tmpGroup.Rows[pRowIndex]:null;if(tmpRow&&Array.isArray(tmpRow.Inputs)){let tmpAddress=tmpRow.Inputs[pInputIndex];if(typeof tmpAddress==='string'&&tmpManifest.Descriptors&&tmpManifest.Descriptors[tmpAddress]){tmpManifest.Descriptors[tmpAddress].DataType=tmpNewValue;}}}this._ParentFormEditor.renderVisualEditor();}}module.exports=PictViewFormEditorInlineEditing;},{"pict-view":244}],366:[function(require,module,exports){const libPictView=require('pict-view');class PictViewFormEditorInputTypePicker extends libPictView{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this._ParentFormEditor=null;}/**
|
|
18405
19598
|
* Open the floating InputType picker for an Input.
|
|
18406
19599
|
*
|
|
18407
19600
|
* Renders a categorized, searchable panel anchored near the InputType chip.
|
|
@@ -18423,7 +19616,9 @@ let tmpOverlay=document.createElement('div');tmpOverlay.id=tmpPickerId+'-Overlay
|
|
|
18423
19616
|
tmpOverlay.addEventListener('wheel',function(pEvent){pEvent.preventDefault();},{passive:false});let tmpPickerContainer=document.createElement('div');tmpPickerContainer.id=tmpPickerId;tmpPickerContainer.className='pict-fe-inputtype-picker';tmpPickerContainer.innerHTML=tmpPickerHTML;tmpPickerContainer.onclick=function(e){e.stopPropagation();};// Contain scroll within the picker — allow internal scrolling but
|
|
18424
19617
|
// prevent scroll chaining to the page when at top/bottom boundary
|
|
18425
19618
|
tmpPickerContainer.addEventListener('wheel',function(pEvent){pEvent.stopPropagation();// Find the scrollable categories list inside the picker
|
|
18426
|
-
let tmpScrollable=tmpPickerContainer.querySelector('.pict-fe-inputtype-picker-categories');if(!tmpScrollable){pEvent.preventDefault();return;}let tmpAtTop=tmpScrollable.scrollTop<=0&&pEvent.deltaY<0;let tmpAtBottom=tmpScrollable.scrollTop+tmpScrollable.clientHeight>=tmpScrollable.scrollHeight&&pEvent.deltaY>0;if(tmpAtTop||tmpAtBottom){pEvent.preventDefault();}},{passive:false})
|
|
19619
|
+
let tmpScrollable=tmpPickerContainer.querySelector('.pict-fe-inputtype-picker-categories');if(!tmpScrollable){pEvent.preventDefault();return;}let tmpAtTop=tmpScrollable.scrollTop<=0&&pEvent.deltaY<0;let tmpAtBottom=tmpScrollable.scrollTop+tmpScrollable.clientHeight>=tmpScrollable.scrollHeight&&pEvent.deltaY>0;if(tmpAtTop||tmpAtBottom){pEvent.preventDefault();}},{passive:false});// Append overlay and picker as siblings on document.body so the picker
|
|
19620
|
+
// is not inside the overlay's stacking context (which can trap pointer events).
|
|
19621
|
+
document.body.appendChild(tmpOverlay);document.body.appendChild(tmpPickerContainer);// Position the picker using fixed viewport coordinates
|
|
18427
19622
|
// anchored below the InputType chip (or properties panel button as fallback)
|
|
18428
19623
|
let tmpAnchorEl=document.getElementById(tmpChipElementId);// If the inline chip doesn't exist (e.g. picker opened from properties panel), use the panel button
|
|
18429
19624
|
if(!tmpAnchorEl){tmpAnchorEl=document.getElementById(`FormEditor-PropsInputTypeBtn-${tmpHash}`);}if(tmpAnchorEl&&tmpAnchorEl.getBoundingClientRect){let tmpAnchorRect=tmpAnchorEl.getBoundingClientRect();tmpPickerContainer.style.position='fixed';tmpPickerContainer.style.top=tmpAnchorRect.bottom+4+'px';tmpPickerContainer.style.left=tmpAnchorRect.left+'px';// If the picker would overflow the right edge of the viewport,
|
|
@@ -18452,7 +19647,9 @@ let tmpCategories=[];let tmpCategorySeen={};let tmpCategoryItems={};for(let i=0;
|
|
|
18452
19647
|
let tmpSearchSet=this.pict.ContentAssignment.getElement(`#${tmpPickerId}-Search`);let tmpSearch=Array.isArray(tmpSearchSet)&&tmpSearchSet.length>0?tmpSearchSet[0]:tmpSearchSet;if(tmpSearch&&tmpSearch.focus){tmpSearch.focus();// Move cursor to end
|
|
18453
19648
|
if(tmpSearch.setSelectionRange){let tmpLen=tmpSearch.value.length;tmpSearch.setSelectionRange(tmpLen,tmpLen);}}}}/**
|
|
18454
19649
|
* Close the floating InputType picker.
|
|
18455
|
-
*/closeInputTypePicker(){let tmpHash=this._ParentFormEditor.Hash;let tmpOverlayId=`FormEditor-InputTypePicker-${tmpHash}-Overlay`;let
|
|
19650
|
+
*/closeInputTypePicker(){let tmpHash=this._ParentFormEditor.Hash;let tmpOverlayId=`FormEditor-InputTypePicker-${tmpHash}-Overlay`;let tmpPickerId=`FormEditor-InputTypePicker-${tmpHash}`;// Remove the overlay
|
|
19651
|
+
let tmpOverlaySet=this.pict.ContentAssignment.getElement(`#${tmpOverlayId}`);let tmpOverlay=Array.isArray(tmpOverlaySet)&&tmpOverlaySet.length>0?tmpOverlaySet[0]:tmpOverlaySet;if(tmpOverlay&&tmpOverlay.parentNode){tmpOverlay.parentNode.removeChild(tmpOverlay);}// Remove the picker container (now a sibling of the overlay, not a child)
|
|
19652
|
+
let tmpPickerSet=this.pict.ContentAssignment.getElement(`#${tmpPickerId}`);let tmpPicker=Array.isArray(tmpPickerSet)&&tmpPickerSet.length>0?tmpPickerSet[0]:tmpPickerSet;if(tmpPicker&&tmpPicker.parentNode){tmpPicker.parentNode.removeChild(tmpPicker);}this._InputTypePickerContext=null;}/**
|
|
18456
19653
|
* Commit the InputType selection from the picker, updating the Descriptor
|
|
18457
19654
|
* and re-rendering the visual editor.
|
|
18458
19655
|
*
|
|
@@ -18474,9 +19671,11 @@ this.closeInputTypePicker();// Resolve the current InputType from the ReferenceM
|
|
|
18474
19671
|
let tmpManifest=this._ParentFormEditor._resolveManifestData();let tmpCurrentValue='';if(tmpManifest&&tmpManifest.Sections){let tmpSection=tmpManifest.Sections[pSectionIndex];let tmpGroup=tmpSection&&Array.isArray(tmpSection.Groups)?tmpSection.Groups[pGroupIndex]:null;if(tmpGroup&&tmpGroup.RecordManifest){let tmpRefManifest=this._ParentFormEditor._ManifestOpsProvider._resolveReferenceManifest(tmpGroup.RecordManifest);if(tmpRefManifest&&tmpRefManifest.Descriptors&&tmpRefManifest.Descriptors[pColumnAddress]){let tmpDescriptor=tmpRefManifest.Descriptors[pColumnAddress];if(tmpDescriptor.PictForm&&tmpDescriptor.PictForm.InputType){tmpCurrentValue=tmpDescriptor.PictForm.InputType;}}}}// Store context — mark as tabular so commitEditInputType knows to handle it
|
|
18475
19672
|
this._InputTypePickerContext={SectionIndex:pSectionIndex,GroupIndex:pGroupIndex,ColumnAddress:pColumnAddress,IsTabular:true,CurrentValue:tmpCurrentValue};// Build the picker HTML
|
|
18476
19673
|
let tmpPickerHTML=this._renderInputTypePicker(tmpCurrentValue,'');// Anchor near the properties panel InputType button
|
|
18477
|
-
if(typeof document!=='undefined'){let tmpOverlay=document.createElement('div');tmpOverlay.id=tmpPickerId+'-Overlay';tmpOverlay.className='pict-fe-inputtype-overlay';tmpOverlay.onclick=function(){eval(tmpViewRef+'.closeInputTypePicker()');};tmpOverlay.addEventListener('wheel',function(pEvent){pEvent.preventDefault();},{passive:false});let tmpPickerContainer=document.createElement('div');tmpPickerContainer.id=tmpPickerId;tmpPickerContainer.className='pict-fe-inputtype-picker';tmpPickerContainer.innerHTML=tmpPickerHTML;tmpPickerContainer.onclick=function(e){e.stopPropagation();};tmpPickerContainer.addEventListener('wheel',function(pEvent){pEvent.stopPropagation();let tmpScrollable=tmpPickerContainer.querySelector('.pict-fe-inputtype-picker-categories');if(!tmpScrollable){pEvent.preventDefault();return;}let tmpAtTop=tmpScrollable.scrollTop<=0&&pEvent.deltaY<0;let tmpAtBottom=tmpScrollable.scrollTop+tmpScrollable.clientHeight>=tmpScrollable.scrollHeight&&pEvent.deltaY>0;if(tmpAtTop||tmpAtBottom){pEvent.preventDefault();}},{passive:false})
|
|
19674
|
+
if(typeof document!=='undefined'){let tmpOverlay=document.createElement('div');tmpOverlay.id=tmpPickerId+'-Overlay';tmpOverlay.className='pict-fe-inputtype-overlay';tmpOverlay.onclick=function(){eval(tmpViewRef+'.closeInputTypePicker()');};tmpOverlay.addEventListener('wheel',function(pEvent){pEvent.preventDefault();},{passive:false});let tmpPickerContainer=document.createElement('div');tmpPickerContainer.id=tmpPickerId;tmpPickerContainer.className='pict-fe-inputtype-picker';tmpPickerContainer.innerHTML=tmpPickerHTML;tmpPickerContainer.onclick=function(e){e.stopPropagation();};tmpPickerContainer.addEventListener('wheel',function(pEvent){pEvent.stopPropagation();let tmpScrollable=tmpPickerContainer.querySelector('.pict-fe-inputtype-picker-categories');if(!tmpScrollable){pEvent.preventDefault();return;}let tmpAtTop=tmpScrollable.scrollTop<=0&&pEvent.deltaY<0;let tmpAtBottom=tmpScrollable.scrollTop+tmpScrollable.clientHeight>=tmpScrollable.scrollHeight&&pEvent.deltaY>0;if(tmpAtTop||tmpAtBottom){pEvent.preventDefault();}},{passive:false});// Append overlay and picker as siblings on document.body so the picker
|
|
19675
|
+
// is not inside the overlay's stacking context (which can trap pointer events).
|
|
19676
|
+
document.body.appendChild(tmpOverlay);document.body.appendChild(tmpPickerContainer);// Position anchored to the InputType button in the properties panel
|
|
18478
19677
|
let tmpAnchorEl=document.getElementById(`FormEditor-PropsInputTypeBtn-${tmpHash}`);if(tmpAnchorEl&&tmpAnchorEl.getBoundingClientRect){let tmpAnchorRect=tmpAnchorEl.getBoundingClientRect();tmpPickerContainer.style.position='fixed';tmpPickerContainer.style.top=tmpAnchorRect.bottom+4+'px';tmpPickerContainer.style.left=tmpAnchorRect.left+'px';let tmpPickerWidth=340;if(tmpAnchorRect.left+tmpPickerWidth>window.innerWidth){tmpPickerContainer.style.left=Math.max(8,window.innerWidth-tmpPickerWidth-8)+'px';}let tmpPickerMaxHeight=420;if(tmpAnchorRect.bottom+4+tmpPickerMaxHeight>window.innerHeight){tmpPickerContainer.style.top='';tmpPickerContainer.style.bottom=window.innerHeight-tmpAnchorRect.top+4+'px';}}// Focus the search input
|
|
18479
|
-
let tmpSearchSet=this.pict.ContentAssignment.getElement(`#${tmpPickerId}-Search`);let tmpSearch=Array.isArray(tmpSearchSet)&&tmpSearchSet.length>0?tmpSearchSet[0]:tmpSearchSet;if(tmpSearch&&tmpSearch.focus){tmpSearch.focus();}}}}module.exports=PictViewFormEditorInputTypePicker;},{"pict-view":
|
|
19678
|
+
let tmpSearchSet=this.pict.ContentAssignment.getElement(`#${tmpPickerId}-Search`);let tmpSearch=Array.isArray(tmpSearchSet)&&tmpSearchSet.length>0?tmpSearchSet[0]:tmpSearchSet;if(tmpSearch&&tmpSearch.focus){tmpSearch.focus();}}}}module.exports=PictViewFormEditorInputTypePicker;},{"pict-view":244}],367:[function(require,module,exports){const libPictView=require('pict-view');/**
|
|
18480
19679
|
* Properties Panel for the Form Editor
|
|
18481
19680
|
*
|
|
18482
19681
|
* Displays and edits properties of the currently selected input Descriptor.
|
|
@@ -18567,10 +19766,13 @@ this._updateTabOverflow();// Wire up the searchable selector dropdowns
|
|
|
18567
19766
|
this._wireSearchableSelector('Section');this._wireSearchableSelector('Group');this._wireSearchableSelector('Input');// Wire up the address input if an input is selected
|
|
18568
19767
|
if(this._SelectedInput&&tmpActiveTab==='properties'){let tmpResolved=this._resolveSelectedDescriptor();if(tmpResolved&&tmpResolved.Address){this._wireAddressConfirmation(tmpResolved.Address);}}// Wire up the address input if a tabular column is selected
|
|
18569
19768
|
else if(this._SelectedTabularColumn&&tmpActiveTab==='properties'){let tmpResolved=this._resolveSelectedTabularDescriptor();if(tmpResolved&&tmpResolved.Address){this._wireAddressConfirmation(tmpResolved.Address);}}// Initialize help content view and load article when Help tab is active
|
|
18570
|
-
if(tmpActiveTab==='help'&&this._ParentFormEditor._DocumentationProvider){let tmpDocProvider=this._ParentFormEditor._DocumentationProvider
|
|
18571
|
-
tmpDocProvider._ClickHandlerAttached=false
|
|
18572
|
-
|
|
18573
|
-
|
|
19769
|
+
if(tmpActiveTab==='help'&&this._ParentFormEditor._DocumentationProvider){let tmpDocProvider=this._ParentFormEditor._DocumentationProvider;// The help body DOM was just recreated, so the old click handler is gone
|
|
19770
|
+
tmpDocProvider._ClickHandlerAttached=false;let tmpPath=tmpDocProvider._CurrentPath||'docs/ToC.md';let tmpHelpBodyId=`FormEditor-Help-Body-${this._ParentFormEditor.Hash}`;let tmpHelpBody=document.getElementById(tmpHelpBodyId);if(tmpHelpBody){// If the article is already cached, render it directly into
|
|
19771
|
+
// the help body — bypassing the "Loading content..." intermediate
|
|
19772
|
+
// state which can persist if renderPanel() is called again before
|
|
19773
|
+
// the content has settled.
|
|
19774
|
+
if(tmpDocProvider._Cache[tmpPath]){let tmpCached=tmpDocProvider._Cache[tmpPath];tmpHelpBody.innerHTML=`<div class="pict-content" id="Pict-Content-Body">${tmpCached.html}</div>`;tmpDocProvider._CurrentPath=tmpPath;tmpDocProvider._CurrentTitle=tmpCached.title||'Help';tmpDocProvider._attachClickHandler();tmpDocProvider._renderBreadcrumbs();}else{// Not yet cached — show loading placeholder and fetch via XHR
|
|
19775
|
+
tmpHelpBody.innerHTML='<div class="pict-content" id="Pict-Content-Body"><div class="pict-content-loading">Loading content...</div></div>';tmpDocProvider.loadArticle(tmpPath,false);}}}}/**
|
|
18574
19776
|
* Render the Form Dashboard tab content.
|
|
18575
19777
|
*
|
|
18576
19778
|
* Provides an extended overview of the form manifest including:
|
|
@@ -18818,7 +20020,9 @@ return'symbol';}/**
|
|
|
18818
20020
|
* Initializes it once if it does not yet exist.
|
|
18819
20021
|
*
|
|
18820
20022
|
* @returns {Object|null} The ExpressionParser instance, or null if unavailable
|
|
18821
|
-
*/_ensureExpressionParser(){let tmpChildManager=this.
|
|
20023
|
+
*/_ensureExpressionParser(){let tmpChildManager=this._ParentFormEditor._ChildPictManager;if(!tmpChildManager){return null;}if(!tmpChildManager.childApplicationExists('ExpressionParser')){// Deep clone the manifest so the child pict does not mutate
|
|
20024
|
+
// the live editor manifest (e.g. adding InputIndex, GroupIndex, etc.)
|
|
20025
|
+
let tmpManifestClone=JSON.parse(JSON.stringify(this._ParentFormEditor._resolveManifestData()||{}));tmpChildManager.initializeChildApplication('ExpressionParser',tmpManifestClone);}let tmpChildApp=tmpChildManager.childApplication('ExpressionParser');if(!tmpChildApp||!tmpChildApp.ExpressionParser){return null;}return tmpChildApp.ExpressionParser;}/**
|
|
18822
20026
|
* Look up a token string against known descriptor hashes in the manifest.
|
|
18823
20027
|
* Returns the matching input entry (with Name, Hash, Address, DataType,
|
|
18824
20028
|
* SectionName, GroupName, etc.) or null if no match.
|
|
@@ -18861,8 +20065,11 @@ tmpLinterPanel.innerHTML=this._renderSolverEditorLinterTab();}else{tmpLinterPane
|
|
|
18861
20065
|
* Attach a delegated click handler on the linter panel to intercept
|
|
18862
20066
|
* #help: links. When clicked, switches the properties panel to the
|
|
18863
20067
|
* Help tab and loads the referenced article.
|
|
18864
|
-
*/_attachLinterHelpClickHandler(){if(this._LinterClickHandlerAttached){return;}if(typeof document==='undefined'){return;}let tmpEditorHash=this._ParentFormEditor.Hash;let tmpLinterPanel=document.getElementById(`PictFE-SolverEditor-LinterPanel-${tmpEditorHash}`);if(!tmpLinterPanel){return;}let tmpSelf=this;tmpLinterPanel.addEventListener('click',function(pEvent){let tmpEl=pEvent.target;while(tmpEl&&tmpEl!==tmpLinterPanel){if(tmpEl.tagName==='A'&&tmpEl.getAttribute('href')&&tmpEl.getAttribute('href').indexOf('#help:')===0){pEvent.preventDefault();let tmpPath=tmpEl.getAttribute('href').substring(6)
|
|
18865
|
-
|
|
20068
|
+
*/_attachLinterHelpClickHandler(){if(this._LinterClickHandlerAttached){return;}if(typeof document==='undefined'){return;}let tmpEditorHash=this._ParentFormEditor.Hash;let tmpLinterPanel=document.getElementById(`PictFE-SolverEditor-LinterPanel-${tmpEditorHash}`);if(!tmpLinterPanel){return;}let tmpSelf=this;tmpLinterPanel.addEventListener('click',function(pEvent){let tmpEl=pEvent.target;while(tmpEl&&tmpEl!==tmpLinterPanel){if(tmpEl.tagName==='A'&&tmpEl.getAttribute('href')&&tmpEl.getAttribute('href').indexOf('#help:')===0){pEvent.preventDefault();pEvent.stopPropagation();let tmpPath=tmpEl.getAttribute('href').substring(6);let tmpDocProvider=tmpSelf._ParentFormEditor._DocumentationProvider;if(tmpDocProvider){// Push current article to navigation stack if navigating to a different one
|
|
20069
|
+
if(tmpDocProvider._CurrentPath&&tmpPath!==tmpDocProvider._CurrentPath){tmpDocProvider._NavigationStack.push({path:tmpDocProvider._CurrentPath,title:tmpDocProvider._CurrentTitle});}// Always go through setPanelTab which rebuilds the
|
|
20070
|
+
// panel DOM fresh (creating #Pict-Content-Body) and
|
|
20071
|
+
// then calls loadArticle from cache synchronously.
|
|
20072
|
+
tmpDocProvider._CurrentPath=tmpPath;tmpSelf._ParentFormEditor._UtilitiesProvider.setPanelTab('help');}return;}tmpEl=tmpEl.parentElement;}});this._LinterClickHandlerAttached=true;}/**
|
|
18866
20073
|
* Show the pending-linting spinner on the Expression Linter tab.
|
|
18867
20074
|
*/_showLinterPending(){if(typeof document==='undefined'){return;}let tmpEditorHash=this._ParentFormEditor.Hash;let tmpSpinner=document.getElementById(`PictFE-SolverLinterSpinner-${tmpEditorHash}`);if(tmpSpinner){tmpSpinner.classList.add('pict-fe-solver-linter-spinner-visible');}}/**
|
|
18868
20075
|
* Hide the pending-linting spinner on the Expression Linter tab.
|
|
@@ -19067,7 +20274,11 @@ let tmpRow=pResolved.Row;if(tmpRow&&Array.isArray(tmpRow.Inputs)){let tmpIdx=tmp
|
|
|
19067
20274
|
* @param {object} pDescriptor - The full Descriptor object for the selected input
|
|
19068
20275
|
* @param {string} pPanelViewRef - The browser-accessible view reference string
|
|
19069
20276
|
* @return {string} HTML string for the InputType properties section
|
|
19070
|
-
*/_renderInputTypeProperties(pInputType,pDescriptor,pPanelViewRef){if(!pInputType){return'<div class="pict-fe-props-placeholder">Select an InputType to see additional properties.</div>';}let
|
|
20277
|
+
*/_renderInputTypeProperties(pInputType,pDescriptor,pPanelViewRef){if(!pInputType){return'<div class="pict-fe-props-placeholder">Select an InputType to see additional properties.</div>';}let tmpPictForm=pDescriptor&&pDescriptor.PictForm?pDescriptor.PictForm:{};let tmpHTML='';// Markdown and HTML types get a Content editor section
|
|
20278
|
+
if(pInputType==='Markdown'||pInputType==='HTML'){let tmpContent=pDescriptor.Content||'';let tmpDefault=pDescriptor.Default||'';let tmpViewRef=this._ParentFormEditor._browserViewRef();let tmpInputIndices=this._SelectedInput;if(tmpInputIndices){tmpHTML+=`<div class="pict-fe-props-section-header">Content</div>`;// "Edit Content" button that opens the markdown editor overlay
|
|
20279
|
+
tmpHTML+='<div class="pict-fe-props-field">';tmpHTML+=`<button class="pict-fe-props-content-edit-btn" onclick="${tmpViewRef}.openContentEditor(${tmpInputIndices.SectionIndex}, ${tmpInputIndices.GroupIndex}, ${tmpInputIndices.RowIndex}, ${tmpInputIndices.InputIndex})">`;tmpHTML+=`Edit Content`;if(tmpContent){tmpHTML+=` (${tmpContent.length} chars)`;}tmpHTML+=`</button>`;tmpHTML+='</div>';// Default value textarea
|
|
20280
|
+
tmpHTML+='<div class="pict-fe-props-field">';tmpHTML+='<div class="pict-fe-props-label">Default Value</div>';tmpHTML+=`<textarea class="pict-fe-props-textarea" rows="3" placeholder="Fallback content when no value is set" onchange="${pPanelViewRef}.commitDescriptorPropertyChange('Default', this.value)">${this._escapeHTML(tmpDefault)}</textarea>`;tmpHTML+='</div>';tmpHTML+='<div class="pict-fe-props-section-divider"></div>';}}// Standard Manifest-based properties
|
|
20281
|
+
let tmpManifest=this._ParentFormEditor._UtilitiesProvider._getInputTypeManifest(pInputType);if(!tmpManifest||!tmpManifest.Descriptors||Object.keys(tmpManifest.Descriptors).length===0){if(tmpHTML.length===0){return'<div class="pict-fe-props-placeholder">No additional properties for '+this._escapeHTML(pInputType)+'.</div>';}return tmpHTML;}tmpHTML+=`<div class="pict-fe-props-section-header">${this._escapeHTML(pInputType)} Properties</div>`;let tmpDescriptorKeys=Object.keys(tmpManifest.Descriptors);for(let i=0;i<tmpDescriptorKeys.length;i++){let tmpPropHash=tmpDescriptorKeys[i];let tmpPropDescriptor=tmpManifest.Descriptors[tmpPropHash];let tmpPropName=tmpPropDescriptor.Name||tmpPropHash;let tmpPropDataType=tmpPropDescriptor.DataType||'String';let tmpPropDescription=tmpPropDescriptor.Description||'';let tmpCurrentValue=tmpPictForm.hasOwnProperty(tmpPropHash)?tmpPictForm[tmpPropHash]:'';tmpHTML+='<div class="pict-fe-props-field">';tmpHTML+=`<div class="pict-fe-props-label" title="${this._escapeAttr(tmpPropDescription)}">${this._escapeHTML(tmpPropName)}</div>`;if(tmpPropDataType==='Boolean'){let tmpChecked=tmpCurrentValue?' checked':'';tmpHTML+=`<label class="pict-fe-props-checkbox-label">`;tmpHTML+=`<input type="checkbox" class="pict-fe-props-checkbox"${tmpChecked} onchange="${pPanelViewRef}.commitPictFormChange('${tmpPropHash}', this.checked, 'Boolean')" />`;tmpHTML+=` ${this._escapeHTML(tmpPropDescription)}</label>`;}else if(tmpPropDataType==='Number'){let tmpDisplayValue=typeof tmpCurrentValue==='number'?String(tmpCurrentValue):'';tmpHTML+=`<input class="pict-fe-props-input" type="number" value="${this._escapeAttr(tmpDisplayValue)}" placeholder="${this._escapeAttr(tmpPropDescription)}" onchange="${pPanelViewRef}.commitPictFormChange('${tmpPropHash}', this.value, 'Number')" />`;}else{// String — use a textarea for values that describe JSON arrays or templates
|
|
19071
20282
|
let tmpIsMultiline=tmpPropDescription.indexOf('JSON')>=0||tmpPropHash==='Template';if(tmpIsMultiline){let tmpDisplayValue='';if(typeof tmpCurrentValue==='string'){tmpDisplayValue=tmpCurrentValue;}else if(tmpCurrentValue!==null&&tmpCurrentValue!==undefined&&typeof tmpCurrentValue!=='string'){// Stringify arrays/objects for display
|
|
19072
20283
|
try{tmpDisplayValue=JSON.stringify(tmpCurrentValue,null,2);}catch(e){tmpDisplayValue=String(tmpCurrentValue);}}tmpHTML+=`<textarea class="pict-fe-props-textarea" rows="4" placeholder="${this._escapeAttr(tmpPropDescription)}" onchange="${pPanelViewRef}.commitPictFormChange('${tmpPropHash}', this.value, 'String')">${this._escapeHTML(tmpDisplayValue)}</textarea>`;}else{let tmpDisplayValue=typeof tmpCurrentValue==='string'?tmpCurrentValue:tmpCurrentValue!==null&&tmpCurrentValue!==undefined?String(tmpCurrentValue):'';tmpHTML+=`<input class="pict-fe-props-input" type="text" value="${this._escapeAttr(tmpDisplayValue)}" placeholder="${this._escapeAttr(tmpPropDescription)}" onchange="${pPanelViewRef}.commitPictFormChange('${tmpPropHash}', this.value, 'String')" />`;}}tmpHTML+='</div>';}return tmpHTML;}/**
|
|
19073
20284
|
* Commit a PictForm property change for the currently selected input.
|
|
@@ -19079,7 +20290,15 @@ try{tmpDisplayValue=JSON.stringify(tmpCurrentValue,null,2);}catch(e){tmpDisplayV
|
|
|
19079
20290
|
{if(typeof pValue==='string'&&pValue.length>0){// Try to parse JSON for array/object properties
|
|
19080
20291
|
let tmpTrimmed=pValue.trim();if(tmpTrimmed.charAt(0)==='['&&tmpTrimmed.charAt(tmpTrimmed.length-1)===']'||tmpTrimmed.charAt(0)==='{'&&tmpTrimmed.charAt(tmpTrimmed.length-1)==='}'){try{tmpDescriptor.PictForm[pPropertyHash]=JSON.parse(tmpTrimmed);}catch(e){// Not valid JSON — store as raw string
|
|
19081
20292
|
tmpDescriptor.PictForm[pPropertyHash]=pValue;}}else{tmpDescriptor.PictForm[pPropertyHash]=pValue;}}else{delete tmpDescriptor.PictForm[pPropertyHash];}break;}}// Re-render the parent's visual editor (which also re-renders this panel)
|
|
19082
|
-
this._ParentFormEditor.renderVisualEditor();}
|
|
20293
|
+
this._ParentFormEditor.renderVisualEditor();}/**
|
|
20294
|
+
* Commit a change to a direct descriptor property (e.g. Content, Default).
|
|
20295
|
+
*
|
|
20296
|
+
* Unlike commitPictFormChange which modifies descriptor.PictForm[key],
|
|
20297
|
+
* this modifies descriptor[key] directly.
|
|
20298
|
+
*
|
|
20299
|
+
* @param {string} pPropertyHash - The descriptor property key
|
|
20300
|
+
* @param {*} pValue - The new value
|
|
20301
|
+
*/commitDescriptorPropertyChange(pPropertyHash,pValue){if(!this._SelectedInput||!this._ParentFormEditor){return;}let tmpResolved=this._resolveSelectedDescriptor();if(!tmpResolved||!tmpResolved.Descriptor){return;}if(pValue===''||pValue===null||pValue===undefined){delete tmpResolved.Descriptor[pPropertyHash];}else{tmpResolved.Descriptor[pPropertyHash]=pValue;}this._ParentFormEditor.renderVisualEditor();}/* -------------------------------------------------------------------------- *//* Options Tab *//* -------------------------------------------------------------------------- *//**
|
|
19083
20302
|
* Render the full content for the Options tab.
|
|
19084
20303
|
* Section A: Input Options (only if an input is selected)
|
|
19085
20304
|
* Section B: Named Option Lists (always shown)
|
|
@@ -19596,8 +20815,9 @@ this._ParentFormEditor.renderVisualEditor();}/**
|
|
|
19596
20815
|
* Escape HTML content characters.
|
|
19597
20816
|
*/_escapeHTML(pString){if(typeof pString!=='string'){return'';}return pString.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"');}/**
|
|
19598
20817
|
* Get the browser-accessible reference to this view.
|
|
19599
|
-
*/_browserViewRef(){return`${this.pict.browserAddress}.views['${this.Hash}']`;}}module.exports=PictViewFormEditorPropertiesPanel;},{"pict-view":
|
|
19600
|
-
this._ObjectEditorView=null;this._CodeEditorView=null;this._SolverCodeEditorView=null;this._HelpContentView=null;this._HelpContentProvider=null;this._DocumentationProvider=null;//
|
|
20818
|
+
*/_browserViewRef(){return`${this.pict.browserAddress}.views['${this.Hash}']`;}}module.exports=PictViewFormEditorPropertiesPanel;},{"pict-view":244}],368:[function(require,module,exports){const libPictView=require('pict-view');const libPictSectionObjectEditor=require('pict-section-objecteditor');const libPictSectionCode=require('pict-section-code');const libPictSectionContent=require('pict-section-content');const libPictSectionMarkdownEditor=require('pict-section-markdowneditor');const _DefaultConfiguration=require('../Pict-Section-FormEditor-DefaultConfiguration.js');const libFormEditorIconography=require('../providers/Pict-Provider-FormEditorIconography.js');const libFormEditorUtilities=require('../providers/Pict-Provider-FormEditorUtilities.js');const libFormEditorDragDrop=require('../providers/Pict-Provider-FormEditorDragDrop.js');const libFormEditorInlineEditing=require('./PictView-FormEditor-InlineEditing.js');const libFormEditorInputTypePicker=require('./PictView-FormEditor-InputTypePicker.js');const libFormEditorRendering=require('../providers/Pict-Provider-FormEditorRendering.js');const libFormEditorManifestOps=require('../providers/Pict-Provider-FormEditorManifestOps.js');const libChildPictManager=require('../providers/Pict-Provider-ChildPictManager.js');const libPreviewCSS=require('../providers/Pict-Provider-PreviewCSS.js');const libFormEditorDocumentation=require('../providers/Pict-Provider-FormEditorDocumentation.js');const libManifestFactory=require('pict-section-form').ManifestFactory;class PictViewFormEditor extends libPictView{constructor(pFable,pOptions,pServiceHash){let tmpOptions=Object.assign({},JSON.parse(JSON.stringify(_DefaultConfiguration)),pOptions);if(!tmpOptions.ManifestDataAddress){tmpOptions.ManifestDataAddress='FormEditor.Manifest';}super(pFable,tmpOptions,pServiceHash);this._ActiveTab=tmpOptions.ActiveTab||'visual';// Child view references
|
|
20819
|
+
this._ObjectEditorView=null;this._CodeEditorView=null;this._SolverCodeEditorView=null;this._HelpContentView=null;this._HelpContentProvider=null;this._DocumentationProvider=null;// Content editor (markdown editor overlay for Markdown/HTML inputs)
|
|
20820
|
+
this._ContentEditorView=null;this._ContentEditorContext=null;// Supported Manyfest DataTypes
|
|
19601
20821
|
this._ManyfestDataTypes=['String','Number','Float','Integer','PreciseNumber','Boolean','Binary','DateTime','Array','Object','Null'];// Create the iconography provider
|
|
19602
20822
|
this._IconographyProvider=new libFormEditorIconography(tmpOptions.Iconography||{});// Create the child pict manager provider for managing any embedded pict instances (e.g. the solver editor)
|
|
19603
20823
|
let tmpChildPictManagerHash=`${pServiceHash||'FormEditor'}-ChildPictManager`;this._ChildPictManager=this.pict.addProvider(tmpChildPictManagerHash,{},libChildPictManager);// Create the preview CSS provider so the child pict form preview
|
|
@@ -19632,7 +20852,9 @@ try{let tmpParsed=JSON.parse(pCode);tmpSelf._setManifestData(tmpParsed);}catch(e
|
|
|
19632
20852
|
}};// Create the solver code editor child view (pict-section-code for Solver Editor tab)
|
|
19633
20853
|
let tmpSolverCodeEditorHash=`${this.Hash}-SolverCodeEditor`;this._SolverCodeEditorView=this.pict.addView(tmpSolverCodeEditorHash,{ViewIdentifier:tmpSolverCodeEditorHash,TargetElementAddress:`#FormEditor-SolverCodeEditor-Container-${this.Hash}`,Language:'javascript',ReadOnly:false,LineNumbers:true,DefaultCode:'',AddClosing:false,IndentOn:false,MoveToNewLine:false,AutoRender:false,RenderOnLoad:false,DefaultRenderable:'SolverCodeEditor-Wrap',DefaultDestinationAddress:`#FormEditor-SolverCodeEditor-Container-${this.Hash}`,Renderables:[{RenderableHash:'SolverCodeEditor-Wrap',TemplateHash:'CodeEditor-Container',DestinationAddress:`#FormEditor-SolverCodeEditor-Container-${this.Hash}`}]},libPictSectionCode);this._SolverCodeEditorView.initialize();// Set a custom solver DSL highlight function
|
|
19634
20854
|
this._SolverCodeEditorView.setHighlightFunction(this._buildSolverHighlightFunction());// Create the help content view (PictContentView for rendering parsed markdown)
|
|
19635
|
-
let tmpHelpContentViewHash=`${this.Hash}-HelpContentView`;this._HelpContentView=this.pict.addView(tmpHelpContentViewHash,{ViewIdentifier:tmpHelpContentViewHash,DefaultRenderable:'HelpContent-Wrap',DefaultDestinationAddress:`#FormEditor-Help-Body-${this.Hash}`,AutoRender:false,Renderables:[{RenderableHash:'HelpContent-Wrap',TemplateHash:'Pict-Content-Template',DestinationAddress:`#FormEditor-Help-Body-${this.Hash}`}]},libPictSectionContent);this._HelpContentView.initialize()
|
|
20855
|
+
let tmpHelpContentViewHash=`${this.Hash}-HelpContentView`;this._HelpContentView=this.pict.addView(tmpHelpContentViewHash,{ViewIdentifier:tmpHelpContentViewHash,DefaultRenderable:'HelpContent-Wrap',DefaultDestinationAddress:`#FormEditor-Help-Body-${this.Hash}`,AutoRender:false,Renderables:[{RenderableHash:'HelpContent-Wrap',TemplateHash:'Pict-Content-Template',DestinationAddress:`#FormEditor-Help-Body-${this.Hash}`}]},libPictSectionContent);this._HelpContentView.initialize();// Create the content editor child view (pict-section-markdowneditor for Markdown/HTML input content)
|
|
20856
|
+
let tmpContentEditorHash=`${this.Hash}-ContentEditor`;this.pict.AppData.FormEditor=this.pict.AppData.FormEditor||{};this.pict.AppData.FormEditor.ContentEditorSegments=[{Content:''}];this._ContentEditorView=this.pict.addView(tmpContentEditorHash,{ViewIdentifier:tmpContentEditorHash,ContentDataAddress:'FormEditor.ContentEditorSegments',AutoRender:false,RenderOnLoad:false,EnableRichPreview:true,ReadOnly:false,DefaultRenderable:'MarkdownEditor-Wrap',DefaultDestinationAddress:`#FormEditor-ContentEditor-Body-${this.Hash}`,TargetElementAddress:`#FormEditor-ContentEditor-Body-${this.Hash}`,Renderables:[{RenderableHash:'MarkdownEditor-Wrap',TemplateHash:'MarkdownEditor-Container',DestinationAddress:`#FormEditor-ContentEditor-Body-${this.Hash}`}]},libPictSectionMarkdownEditor);this._ContentEditorView.initialize();// Sync content changes back to the descriptor (tmpSelf already defined above for code editor)
|
|
20857
|
+
this._ContentEditorView.onContentChange=function(pSegmentIndex,pContent){if(tmpSelf._ContentEditorContext){let tmpContent=tmpSelf._ContentEditorView.getAllContent();tmpSelf._setContentEditorValue(tmpContent);}};}/**
|
|
19636
20858
|
* Build the custom syntax highlight function for the solver DSL.
|
|
19637
20859
|
*
|
|
19638
20860
|
* The function tokenizes the raw code to extract string literals first,
|
|
@@ -19675,19 +20897,31 @@ tmpResult+='<span class="operator">'+escapeHTML(tmpFullMatch)+'</span>';}tmpLast
|
|
|
19675
20897
|
if(tmpLastIndex<tmpCode.length){tmpResult+=escapeHTML(tmpCode.substring(tmpLastIndex));}pElement.innerHTML=tmpResult;};}/* -------------------------------------------------------------------------- *//* Code Section: Rendering *//* -------------------------------------------------------------------------- */onAfterRender(){super.onAfterRender();// Inject CSS
|
|
19676
20898
|
if(this.options.CSS){this.pict.CSSMap.injectCSS(this.options.ViewIdentifier,this.options.CSS);}// Build the full tab bar and content panels programmatically
|
|
19677
20899
|
this._RenderingProvider._renderTabShell();this.renderVisualEditor();this._syncTabState();}renderVisualEditor(){return this._RenderingProvider.renderVisualEditor();}/* -------------------------------------------------------------------------- *//* Code Section: Tab Management *//* -------------------------------------------------------------------------- */switchTab(pTabName){this._ActiveTab=pTabName;this._syncTabState();if(pTabName==='objecteditor'){// Render the object editor container first, then expand to 2 levels
|
|
19678
|
-
this._ObjectEditorView.render();this._ObjectEditorView.expandToDepth(2);}else if(pTabName==='json'){this._UtilitiesProvider._updateCodeEditor();}else if(pTabName==='visual'){this.renderVisualEditor();}else if(pTabName==='solvereditor'){if(this._PropertiesPanelView){this._PropertiesPanelView.renderSolverEditorTabPanel();}}else if(pTabName==='solvers'){if(this._PropertiesPanelView){this._PropertiesPanelView.renderSolversTabPanel();}}else if(pTabName==='listdata'){if(this._PropertiesPanelView){this._PropertiesPanelView.renderListDataTabPanel();}}else if(pTabName==='entitydata'){if(this._PropertiesPanelView){this._PropertiesPanelView.renderEntityDataTabPanel();}}else if(pTabName==='
|
|
19679
|
-
let tmpTabButtonSet=this.pict.ContentAssignment.getElement(`#FormEditor-Tab-${tmpTabNames[i]}-${tmpHash}`);let tmpTabPanelSet=this.pict.ContentAssignment.getElement(`#FormEditor-Panel-${tmpTabNames[i]}-${tmpHash}`);let tmpTabButton=Array.isArray(tmpTabButtonSet)&&tmpTabButtonSet.length>0?tmpTabButtonSet[0]:tmpTabButtonSet;let tmpTabPanel=Array.isArray(tmpTabPanelSet)&&tmpTabPanelSet.length>0?tmpTabPanelSet[0]:tmpTabPanelSet;if(tmpTabButton&&tmpTabButton.className!==undefined){if(tmpTabs[i]===this._ActiveTab){tmpTabButton.className='pict-fe-tab pict-fe-tab-active';}else{tmpTabButton.className='pict-fe-tab';}}if(tmpTabPanel&&tmpTabPanel.className!==undefined){if(tmpTabs[i]===this._ActiveTab){tmpTabPanel.className='pict-fe-tabcontent pict-fe-tabcontent-active';}else{tmpTabPanel.className='pict-fe-tabcontent';}}}}/* -------------------------------------------------------------------------- *//* Code Section: Data Helpers *//* -------------------------------------------------------------------------- */_resolveManifestData(){let tmpAddress=this.options.ManifestDataAddress;if(!tmpAddress){return null;}let tmpSegments=tmpAddress.split('.');let tmpCurrent=this.fable;for(let i=0;i<tmpSegments.length;i++){if(tmpCurrent&&typeof tmpCurrent==='object'&&tmpCurrent.hasOwnProperty(tmpSegments[i])){tmpCurrent=tmpCurrent[tmpSegments[i]];}else{return null;}}return tmpCurrent;}_setManifestData(pData){let tmpAddress=this.options.ManifestDataAddress;if(!tmpAddress){return;}let tmpSegments=tmpAddress.split('.');let tmpCurrent=this.fable;for(let i=0;i<tmpSegments.length-1;i++){if(!tmpCurrent.hasOwnProperty(tmpSegments[i])||typeof tmpCurrent[tmpSegments[i]]!=='object'){tmpCurrent[tmpSegments[i]]={};}tmpCurrent=tmpCurrent[tmpSegments[i]];}tmpCurrent[tmpSegments[tmpSegments.length-1]]=pData;}_createEmptyManifest(){return{Scope:'NewForm',Sections:[],Descriptors:{},ReferenceManifests:{},StaticOptionLists:[],PickLists:[]};}/* -------------------------------------------------------------------------- *//* Code Section: CSV
|
|
19680
|
-
let tmpCSVParser=this.fable.instantiateServiceProviderWithoutRegistration('CSVParser');tmpCSVParser.EscapedQuoteString='"';let tmpLines=pCSVContent.split('\n');let tmpRecords=[];for(let i=0;i<tmpLines.length;i++){let tmpLine=tmpLines[i];if(tmpLine.trim().length===0){continue;}let tmpRecord=tmpCSVParser.parseCSVLine(tmpLine);if(tmpRecord){tmpRecords.push(tmpRecord);}}if(tmpRecords.length===0){this.
|
|
19681
|
-
let tmpManifestFactory=this.fable.instantiateServiceProviderWithoutRegistration('ManifestFactory');let tmpManifests=tmpManifestFactory.createManifestsFromTabularArray(tmpRecords);let tmpManifestKeys=Object.keys(tmpManifests);if(tmpManifestKeys.length===0){this.
|
|
20900
|
+
this._ObjectEditorView.render();this._ObjectEditorView.expandToDepth(2);}else if(pTabName==='json'){this._UtilitiesProvider._updateCodeEditor();}else if(pTabName==='visual'){this.renderVisualEditor();}else if(pTabName==='solvereditor'){if(this._PropertiesPanelView){this._PropertiesPanelView.renderSolverEditorTabPanel();}}else if(pTabName==='solvers'){if(this._PropertiesPanelView){this._PropertiesPanelView.renderSolversTabPanel();}}else if(pTabName==='listdata'){if(this._PropertiesPanelView){this._PropertiesPanelView.renderListDataTabPanel();}}else if(pTabName==='entitydata'){if(this._PropertiesPanelView){this._PropertiesPanelView.renderEntityDataTabPanel();}}else if(pTabName==='import'){this._RenderingProvider.renderImportTabPanel();}else if(pTabName==='preview'){if(this._PropertiesPanelView){this._PropertiesPanelView.renderPreviewTabPanel();}}}_syncTabState(){let tmpHash=this.Hash;let tmpTabs=['visual','solvereditor','solvers','listdata','entitydata','objecteditor','json','import','preview'];let tmpTabNames=['Visual','SolverEditor','Solvers','ListData','EntityData','ObjectEditor','JSON','Import','Preview'];for(let i=0;i<tmpTabs.length;i++){// getElement returns an array; grab the first match
|
|
20901
|
+
let tmpTabButtonSet=this.pict.ContentAssignment.getElement(`#FormEditor-Tab-${tmpTabNames[i]}-${tmpHash}`);let tmpTabPanelSet=this.pict.ContentAssignment.getElement(`#FormEditor-Panel-${tmpTabNames[i]}-${tmpHash}`);let tmpTabButton=Array.isArray(tmpTabButtonSet)&&tmpTabButtonSet.length>0?tmpTabButtonSet[0]:tmpTabButtonSet;let tmpTabPanel=Array.isArray(tmpTabPanelSet)&&tmpTabPanelSet.length>0?tmpTabPanelSet[0]:tmpTabPanelSet;if(tmpTabButton&&tmpTabButton.className!==undefined){if(tmpTabs[i]===this._ActiveTab){tmpTabButton.className='pict-fe-tab pict-fe-tab-active';}else{tmpTabButton.className='pict-fe-tab';}}if(tmpTabPanel&&tmpTabPanel.className!==undefined){if(tmpTabs[i]===this._ActiveTab){tmpTabPanel.className='pict-fe-tabcontent pict-fe-tabcontent-active';}else{tmpTabPanel.className='pict-fe-tabcontent';}}}}/* -------------------------------------------------------------------------- *//* Code Section: Data Helpers *//* -------------------------------------------------------------------------- */_resolveManifestData(){let tmpAddress=this.options.ManifestDataAddress;if(!tmpAddress){return null;}let tmpSegments=tmpAddress.split('.');let tmpCurrent=this.fable;for(let i=0;i<tmpSegments.length;i++){if(tmpCurrent&&typeof tmpCurrent==='object'&&tmpCurrent.hasOwnProperty(tmpSegments[i])){tmpCurrent=tmpCurrent[tmpSegments[i]];}else{return null;}}return tmpCurrent;}_setManifestData(pData){let tmpAddress=this.options.ManifestDataAddress;if(!tmpAddress){return;}let tmpSegments=tmpAddress.split('.');let tmpCurrent=this.fable;for(let i=0;i<tmpSegments.length-1;i++){if(!tmpCurrent.hasOwnProperty(tmpSegments[i])||typeof tmpCurrent[tmpSegments[i]]!=='object'){tmpCurrent[tmpSegments[i]]={};}tmpCurrent=tmpCurrent[tmpSegments[i]];}tmpCurrent[tmpSegments[tmpSegments.length-1]]=pData;}_createEmptyManifest(){return{Scope:'NewForm',Sections:[],Descriptors:{},ReferenceManifests:{},StaticOptionLists:[],PickLists:[]};}/* -------------------------------------------------------------------------- *//* Code Section: Import (CSV / JSON) *//* -------------------------------------------------------------------------- */handleImportDrop(pEvent){let tmpFiles=pEvent.dataTransfer?pEvent.dataTransfer.files:[];if(tmpFiles.length<1){return;}let tmpFile=tmpFiles[0];let tmpName=tmpFile.name.toLowerCase();if(!tmpName.endsWith('.csv')&&!tmpName.endsWith('.json')){this._setImportStatus('error','Please drop a CSV or JSON file.');return;}this._readImportFile(tmpFile);}handleImportFileSelect(pEvent){let tmpFiles=pEvent.target?pEvent.target.files:[];if(tmpFiles.length<1){return;}this._readImportFile(tmpFiles[0]);}_readImportFile(pFile){let tmpReader=new FileReader();tmpReader.onload=pEvent=>{let tmpContent=pEvent.target.result;let tmpName=pFile.name.toLowerCase();if(tmpName.endsWith('.json')){this._processJSONContent(tmpContent,pFile.name);}else{this._processCSVContent(tmpContent,pFile.name);}};tmpReader.onerror=()=>{this._setImportStatus('error',`Error reading file: ${pFile.name}`);};tmpReader.readAsText(pFile);}_processCSVContent(pCSVContent,pFileName){// Use Fable's CSVParser to parse the CSV line-by-line
|
|
20902
|
+
let tmpCSVParser=this.fable.instantiateServiceProviderWithoutRegistration('CSVParser');tmpCSVParser.EscapedQuoteString='"';let tmpLines=pCSVContent.split('\n');let tmpRecords=[];for(let i=0;i<tmpLines.length;i++){let tmpLine=tmpLines[i];if(tmpLine.trim().length===0){continue;}let tmpRecord=tmpCSVParser.parseCSVLine(tmpLine);if(tmpRecord){tmpRecords.push(tmpRecord);}}if(tmpRecords.length===0){this._setImportStatus('error','No valid records found in CSV file.');this._showToast('error','No valid records found in CSV file.');return;}// Use ManifestFactory to generate form configurations
|
|
20903
|
+
let tmpManifestFactory=this.fable.instantiateServiceProviderWithoutRegistration('ManifestFactory');let tmpManifests=tmpManifestFactory.createManifestsFromTabularArray(tmpRecords);let tmpManifestKeys=Object.keys(tmpManifests);if(tmpManifestKeys.length===0){this._setImportStatus('error','CSV parsed but no valid form configurations were generated. Ensure the CSV has a "Form" column.');this._showToast('error','No form configurations generated. Ensure the CSV has a "Form" column.');return;}this._loadImportedManifests(tmpManifests,pFileName,'CSV');}_processJSONContent(pJSONContent,pFileName){let tmpParsed;try{tmpParsed=JSON.parse(pJSONContent);}catch(pError){this._setImportStatus('error',`Invalid JSON: ${pError.message}`);this._showToast('error','Failed to parse JSON file.');return;}if(!tmpParsed||typeof tmpParsed!=='object'){this._setImportStatus('error','JSON file did not contain a valid object.');this._showToast('error','JSON file did not contain a valid object.');return;}// Detect whether this is a single manifest or a multi-form bundle.
|
|
20904
|
+
// A single manifest has Descriptors and/or Sections at the top level.
|
|
20905
|
+
// A multi-form bundle is an object whose values are each manifests
|
|
20906
|
+
// (like the output of ManifestFactory).
|
|
20907
|
+
let tmpIsSingleManifest=tmpParsed.Descriptors||tmpParsed.Sections;if(tmpIsSingleManifest){// Wrap in a keyed object so _loadImportedManifests can handle it uniformly
|
|
20908
|
+
let tmpFormName=tmpParsed.Scope||tmpParsed.FormName||pFileName.replace(/\.json$/i,'');let tmpManifests={};tmpManifests[tmpFormName]=tmpParsed;this._loadImportedManifests(tmpManifests,pFileName,'JSON');}else{// Check if the values look like manifests (at least one has Descriptors or Sections)
|
|
20909
|
+
let tmpKeys=Object.keys(tmpParsed);let tmpHasManifestValues=false;for(let i=0;i<tmpKeys.length;i++){let tmpValue=tmpParsed[tmpKeys[i]];if(tmpValue&&typeof tmpValue==='object'&&(tmpValue.Descriptors||tmpValue.Sections)){tmpHasManifestValues=true;break;}}if(tmpHasManifestValues){this._loadImportedManifests(tmpParsed,pFileName,'JSON');}else{this._setImportStatus('error','JSON file does not appear to contain a valid form manifest. Expected an object with Descriptors and/or Sections.');this._showToast('error','JSON does not contain a valid form manifest.');}}}/**
|
|
20910
|
+
* Common handler for loading imported manifests (from CSV or JSON).
|
|
20911
|
+
*
|
|
20912
|
+
* @param {object} pManifests - Keyed object of form manifests
|
|
20913
|
+
* @param {string} pFileName - Original file name
|
|
20914
|
+
* @param {string} pSourceType - 'CSV' or 'JSON' for display purposes
|
|
20915
|
+
*/_loadImportedManifests(pManifests,pFileName,pSourceType){let tmpManifestKeys=Object.keys(pManifests);if(tmpManifestKeys.length===0){this._setImportStatus('error',`${pSourceType} parsed but no valid form configurations were found.`);this._showToast('error',`No form configurations found in ${pSourceType} file.`);return;}// Load the first manifest into the editor data address.
|
|
19682
20916
|
// Do NOT call this.render() here — that rebuilds the entire tab shell
|
|
19683
|
-
// and destroys the
|
|
20917
|
+
// and destroys the import panel the user is looking at. Each tab lazily
|
|
19684
20918
|
// renders its own content when switched to, so the data will be picked
|
|
19685
20919
|
// up automatically.
|
|
19686
|
-
let tmpFirstKey=tmpManifestKeys[0];let tmpFirstManifest=
|
|
20920
|
+
let tmpFirstKey=tmpManifestKeys[0];let tmpFirstManifest=pManifests[tmpFirstKey];this._setManifestData(tmpFirstManifest);// Emit event with all manifests for the host application to handle
|
|
19687
20921
|
// (fire before toast so the selector is updated first)
|
|
19688
|
-
if(typeof this.
|
|
19689
|
-
let tmpDescriptorCount=Object.keys(tmpFirstManifest.Descriptors||{}).length;let tmpSectionCount=(tmpFirstManifest.Sections||[]).length;let tmpToastMessage=`Loaded \u201C${tmpFirstKey}\u201D \u2014 ${tmpDescriptorCount} descriptors, ${tmpSectionCount} section${tmpSectionCount!==1?'s':''}`;if(tmpManifestKeys.length>1){tmpToastMessage+=` \u00B7 ${tmpManifestKeys.length-1} additional form${tmpManifestKeys.length>2?'s':''} added to selector`;}this._showToast('success',tmpToastMessage);// Also update the in-tab status area (persists when user returns to
|
|
19690
|
-
let tmpStatusParts=[];tmpStatusParts.push(`Loaded <strong>${this._UtilitiesProvider._escapeHTML(tmpFirstKey)}</strong> (${tmpDescriptorCount} descriptors, ${tmpSectionCount} sections)`);if(tmpManifestKeys.length>1){tmpStatusParts.push(`<br/>${tmpManifestKeys.length-1} additional form(s) found: ${tmpManifestKeys.slice(1).map(pKey=>'<strong>'+this._UtilitiesProvider._escapeHTML(pKey)+'</strong>').join(', ')}`);tmpStatusParts.push('<br/>These have been added to the Load Configuration selector.');}this.
|
|
20922
|
+
if(typeof this.onImport==='function'){this.onImport(pManifests,pFileName);}// Build a toast notification
|
|
20923
|
+
let tmpDescriptorCount=Object.keys(tmpFirstManifest.Descriptors||{}).length;let tmpSectionCount=(tmpFirstManifest.Sections||[]).length;let tmpToastMessage=`Loaded \u201C${tmpFirstKey}\u201D \u2014 ${tmpDescriptorCount} descriptors, ${tmpSectionCount} section${tmpSectionCount!==1?'s':''}`;if(tmpManifestKeys.length>1){tmpToastMessage+=` \u00B7 ${tmpManifestKeys.length-1} additional form${tmpManifestKeys.length>2?'s':''} added to selector`;}this._showToast('success',tmpToastMessage);// Also update the in-tab status area (persists when user returns to import tab)
|
|
20924
|
+
let tmpStatusParts=[];tmpStatusParts.push(`Loaded <strong>${this._UtilitiesProvider._escapeHTML(tmpFirstKey)}</strong> from ${pSourceType} (${tmpDescriptorCount} descriptors, ${tmpSectionCount} sections)`);if(tmpManifestKeys.length>1){tmpStatusParts.push(`<br/>${tmpManifestKeys.length-1} additional form(s) found: ${tmpManifestKeys.slice(1).map(pKey=>'<strong>'+this._UtilitiesProvider._escapeHTML(pKey)+'</strong>').join(', ')}`);tmpStatusParts.push('<br/>These have been added to the Load Configuration selector.');}this._setImportStatus('success',tmpStatusParts.join(''));}_setImportStatus(pType,pMessage){let tmpHash=this.Hash;let tmpStatusClass=pType==='error'?'pict-fe-import-status-error':'pict-fe-import-status-success';let tmpHTML=`<div class="${tmpStatusClass}">${pMessage}</div>`;this.pict.ContentAssignment.assignContent(`#FormEditor-ImportStatus-${tmpHash}`,tmpHTML);}/**
|
|
19691
20925
|
* Show a floating toast notification inside the form editor.
|
|
19692
20926
|
*
|
|
19693
20927
|
* @param {string} pType - 'success' or 'error'
|
|
@@ -19700,5 +20934,43 @@ let tmpToast=document.createElement('div');tmpToast.className='pict-fe-toast pic
|
|
|
19700
20934
|
requestAnimationFrame(()=>{tmpToast.classList.add('pict-fe-toast-visible');});// Auto-dismiss
|
|
19701
20935
|
let tmpDismiss=()=>{tmpToast.classList.remove('pict-fe-toast-visible');tmpToast.classList.add('pict-fe-toast-exit');tmpToast.addEventListener('transitionend',()=>{if(tmpToast.parentNode){tmpToast.parentNode.removeChild(tmpToast);}});// Fallback removal if transitionend doesn't fire
|
|
19702
20936
|
setTimeout(()=>{if(tmpToast.parentNode){tmpToast.parentNode.removeChild(tmpToast);}},400);};setTimeout(tmpDismiss,tmpDuration);// Also allow click to dismiss
|
|
19703
|
-
tmpToast.addEventListener('click',tmpDismiss);}/* -------------------------------------------------------------------------- *//* Code Section:
|
|
20937
|
+
tmpToast.addEventListener('click',tmpDismiss);}/* -------------------------------------------------------------------------- *//* Code Section: Content Editor *//* -------------------------------------------------------------------------- *//**
|
|
20938
|
+
* Open the content editor overlay for a Markdown or HTML input.
|
|
20939
|
+
*
|
|
20940
|
+
* Creates a modal overlay with the pict-section-markdowneditor embedded,
|
|
20941
|
+
* pre-loaded with the descriptor's Content property. Falls back to a plain
|
|
20942
|
+
* textarea if CodeMirror modules are not available.
|
|
20943
|
+
*
|
|
20944
|
+
* @param {number} pSectionIndex
|
|
20945
|
+
* @param {number} pGroupIndex
|
|
20946
|
+
* @param {number} pRowIndex
|
|
20947
|
+
* @param {number} pInputIndex
|
|
20948
|
+
*/openContentEditor(pSectionIndex,pGroupIndex,pRowIndex,pInputIndex){// Resolve the descriptor
|
|
20949
|
+
let tmpManifest=this._resolveManifestData();if(!tmpManifest||!tmpManifest.Sections){return;}let tmpSection=tmpManifest.Sections[pSectionIndex];let tmpGroup=tmpSection&&tmpSection.Groups?tmpSection.Groups[pGroupIndex]:null;let tmpRow=tmpGroup&&tmpGroup.Rows?tmpGroup.Rows[pRowIndex]:null;let tmpDescriptor=null;let tmpInputType='';if(tmpRow&&Array.isArray(tmpRow.Inputs)){let tmpAddress=tmpRow.Inputs[pInputIndex];if(typeof tmpAddress==='string'&&tmpManifest.Descriptors&&tmpManifest.Descriptors[tmpAddress]){tmpDescriptor=tmpManifest.Descriptors[tmpAddress];tmpInputType=tmpDescriptor.PictForm&&tmpDescriptor.PictForm.InputType?tmpDescriptor.PictForm.InputType:'';}}if(!tmpDescriptor){return;}// Close any existing content editor first (before setting new context)
|
|
20950
|
+
this.closeContentEditor();// Read existing content
|
|
20951
|
+
let tmpContent=tmpDescriptor.Content||tmpDescriptor.Default||'';// Store context
|
|
20952
|
+
this._ContentEditorContext={SectionIndex:pSectionIndex,GroupIndex:pGroupIndex,RowIndex:pRowIndex,InputIndex:pInputIndex};// Load content into the segments data address
|
|
20953
|
+
this.pict.AppData.FormEditor=this.pict.AppData.FormEditor||{};this.pict.AppData.FormEditor.ContentEditorSegments=[{Content:tmpContent}];let tmpViewRef=this._browserViewRef();let tmpEditorId=`FormEditor-ContentEditor-${this.Hash}`;let tmpInputName=tmpDescriptor.Name||tmpDescriptor.Hash||'Input';if(typeof document!=='undefined'){// Create the backdrop overlay
|
|
20954
|
+
let tmpOverlay=document.createElement('div');tmpOverlay.id=`${tmpEditorId}-Overlay`;tmpOverlay.className='pict-fe-content-editor-overlay';tmpOverlay.onclick=function(){eval(tmpViewRef+'.closeContentEditor()');};// Create the editor container
|
|
20955
|
+
let tmpEditorContainer=document.createElement('div');tmpEditorContainer.id=tmpEditorId;tmpEditorContainer.className='pict-fe-content-editor';tmpEditorContainer.onclick=function(e){e.stopPropagation();};// Header
|
|
20956
|
+
let tmpHeaderHTML='';tmpHeaderHTML+='<div class="pict-fe-content-editor-header">';tmpHeaderHTML+=`<div class="pict-fe-content-editor-title">${tmpInputType} Content: ${this._UtilitiesProvider._escapeHTML(tmpInputName)}</div>`;tmpHeaderHTML+=`<button class="pict-fe-content-editor-close" onclick="${tmpViewRef}.closeContentEditor()">Save & Close</button>`;tmpHeaderHTML+='</div>';// Body (target for the markdown editor)
|
|
20957
|
+
tmpHeaderHTML+=`<div class="pict-fe-content-editor-body" id="FormEditor-ContentEditor-Body-${this.Hash}"></div>`;tmpEditorContainer.innerHTML=tmpHeaderHTML;// Append as siblings on document.body (same pattern as InputType picker)
|
|
20958
|
+
document.body.appendChild(tmpOverlay);document.body.appendChild(tmpEditorContainer);// Try to render the markdown editor into the body container
|
|
20959
|
+
let tmpUseFallback=false;try{this._ContentEditorView.render();// Check if CodeMirror modules are available
|
|
20960
|
+
if(!this._ContentEditorView._codeMirrorModules){tmpUseFallback=true;}}catch(pError){this.log.warn(`Content editor markdown view failed to render: ${pError.message}`);tmpUseFallback=true;}if(tmpUseFallback){// Fallback to a plain textarea
|
|
20961
|
+
let tmpBodyEl=document.getElementById(`FormEditor-ContentEditor-Body-${this.Hash}`);if(tmpBodyEl){let tmpEscapedContent=this._UtilitiesProvider._escapeHTML(tmpContent);tmpBodyEl.innerHTML=`<textarea class="pict-fe-content-editor-fallback" id="FormEditor-ContentEditor-Fallback-${this.Hash}">${tmpEscapedContent}</textarea>`;}}}}/**
|
|
20962
|
+
* Close the content editor overlay, saving the content back to the descriptor.
|
|
20963
|
+
*/closeContentEditor(){let tmpEditorId=`FormEditor-ContentEditor-${this.Hash}`;// Read content from the fallback textarea if it exists, otherwise from the markdown editor
|
|
20964
|
+
if(this._ContentEditorContext&&typeof document!=='undefined'){let tmpFallbackEl=document.getElementById(`FormEditor-ContentEditor-Fallback-${this.Hash}`);if(tmpFallbackEl){this._setContentEditorValue(tmpFallbackEl.value);}else{// Marshal from the markdown editor
|
|
20965
|
+
let tmpContent=this._ContentEditorView.getAllContent();this._setContentEditorValue(tmpContent);}}// Remove overlay
|
|
20966
|
+
if(typeof document!=='undefined'){let tmpOverlayId=`${tmpEditorId}-Overlay`;let tmpOverlay=document.getElementById(tmpOverlayId);if(tmpOverlay&&tmpOverlay.parentNode){tmpOverlay.parentNode.removeChild(tmpOverlay);}// Remove editor container
|
|
20967
|
+
let tmpEditor=document.getElementById(tmpEditorId);if(tmpEditor&&tmpEditor.parentNode){tmpEditor.parentNode.removeChild(tmpEditor);}}this._ContentEditorContext=null;// Refresh the visual editor and properties panel
|
|
20968
|
+
this.renderVisualEditor();}/**
|
|
20969
|
+
* Write content back to the descriptor's Content property.
|
|
20970
|
+
*
|
|
20971
|
+
* @param {string} pContent - The content string to store
|
|
20972
|
+
*/_setContentEditorValue(pContent){if(!this._ContentEditorContext){return;}let tmpManifest=this._resolveManifestData();if(!tmpManifest||!tmpManifest.Sections){return;}let tmpCtx=this._ContentEditorContext;let tmpSection=tmpManifest.Sections[tmpCtx.SectionIndex];let tmpGroup=tmpSection&&tmpSection.Groups?tmpSection.Groups[tmpCtx.GroupIndex]:null;let tmpRow=tmpGroup&&tmpGroup.Rows?tmpGroup.Rows[tmpCtx.RowIndex]:null;if(tmpRow&&Array.isArray(tmpRow.Inputs)){let tmpAddress=tmpRow.Inputs[tmpCtx.InputIndex];if(typeof tmpAddress==='string'&&tmpManifest.Descriptors&&tmpManifest.Descriptors[tmpAddress]){let tmpDescriptor=tmpManifest.Descriptors[tmpAddress];if(pContent&&pContent.length>0){tmpDescriptor.Content=pContent;}else{delete tmpDescriptor.Content;}}}}/* -------------------------------------------------------------------------- *//* Code Section: Utility *//* -------------------------------------------------------------------------- */_browserViewRef(){return`${this.pict.browserAddress}.views['${this.Hash}']`;}// Proxy methods for the InputType picker child view.
|
|
20973
|
+
// The picker's inline onclick handlers reference the parent form editor's
|
|
20974
|
+
// browser view ref, so these must exist on the parent to route calls through.
|
|
20975
|
+
commitEditInputType(pInputTypeHash){this._InputTypePickerView.commitEditInputType(pInputTypeHash);}closeInputTypePicker(){this._InputTypePickerView.closeInputTypePicker();}_onInputTypePickerSearch(pQuery){this._InputTypePickerView._onInputTypePickerSearch(pQuery);}}module.exports=PictViewFormEditor;},{"../Pict-Section-FormEditor-DefaultConfiguration.js":354,"../providers/Pict-Provider-ChildPictManager.js":357,"../providers/Pict-Provider-FormEditorDocumentation.js":358,"../providers/Pict-Provider-FormEditorDragDrop.js":359,"../providers/Pict-Provider-FormEditorIconography.js":360,"../providers/Pict-Provider-FormEditorManifestOps.js":361,"../providers/Pict-Provider-FormEditorRendering.js":362,"../providers/Pict-Provider-FormEditorUtilities.js":363,"../providers/Pict-Provider-PreviewCSS.js":364,"./PictView-FormEditor-InlineEditing.js":365,"./PictView-FormEditor-InputTypePicker.js":366,"./PictView-FormEditor-PropertiesPanel.js":367,"pict-section-code":147,"pict-section-content":151,"pict-section-form":155,"pict-section-markdowneditor":224,"pict-section-objecteditor":226,"pict-view":244}]},{},[1])(1);});
|
|
19704
20976
|
//# sourceMappingURL=form_editor_example.js.map
|