pict-section-form 1.1.9 → 1.2.0
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/README.md +1 -1
- package/docs/Configuration.md +1 -0
- package/docs/Layouts.md +60 -0
- package/docs/_version.json +3 -3
- package/docs/examples/README.md +1 -1
- package/docs/examples/change_tracking/change_tracking.js +322 -20
- package/docs/examples/diagram_form/diagram_form_example.min.js +2 -2
- package/docs/examples/dynamic_analysis/dynamic_analysis_application.js +301 -20
- package/docs/examples/gradebook/README.md +43 -1
- package/docs/examples/gradebook/gradebook_application.min.js +2 -2
- package/docs/examples/ndt_field_test/ndt_field_test.js +322 -20
- package/docs/examples/richtext_form/richtext_form_example.min.js +2 -3
- package/docs/examples/scope_mathematics/scope_mathematics.js +322 -20
- package/docs/examples/simple_table/README.md +1 -0
- package/docs/examples/simple_table/simple_tabular_application.min.js +2 -2
- package/docs/examples/superhero_studio/superhero_studio_example.min.js +2 -3
- package/docs/index.html +2 -2
- package/docs/retold-catalog.json +1 -1
- package/docs/retold-keyword-index.json +10252 -9612
- package/example_applications/complex_table/Complex-Tabular-Application.js +5 -0
- package/example_applications/gradebook/Gradebook-Application.js +19 -4
- package/example_applications/gradebook/package.json +2 -2
- package/example_applications/simple_table/README-SimpleTable.md +9 -0
- package/example_applications/simple_table/Simple-Tabular-Application.js +6 -1
- package/package.json +1 -1
- package/source/providers/layouts/Pict-Layout-Tabular.js +639 -1
- package/test/PictSectionForm-Tabular-Features_tests.js +293 -0
|
@@ -2817,7 +2817,7 @@ if(tmpIsRootRenderable&&pRenderable&&pRenderable.TransactionHash){this.pict.Tran
|
|
|
2817
2817
|
* Lifecycle hook that triggers after data is marshaled into the view (async flow).
|
|
2818
2818
|
*
|
|
2819
2819
|
* @param {ErrorCallback} fCallback - The callback to call when the async operation is complete.
|
|
2820
|
-
*/onAfterMarshalToViewAsync(fCallback){this.onAfterMarshalToView();return fCallback();}/** @return {boolean} - True if the object is a PictView. */get isPictView(){return true;}}module.exports=PictView;},{"../package.json":38,"fable-serviceproviderbase":4}],40:[function(require,module,exports){module.exports={"name":"pict-section-form","version":"1.
|
|
2820
|
+
*/onAfterMarshalToViewAsync(fCallback){this.onAfterMarshalToView();return fCallback();}/** @return {boolean} - True if the object is a PictView. */get isPictView(){return true;}}module.exports=PictView;},{"../package.json":38,"fable-serviceproviderbase":4}],40:[function(require,module,exports){module.exports={"name":"pict-section-form","version":"1.2.0","description":"Pict dynamic form sections","main":"source/Pict-Section-Form.js","directories":{"test":"test"},"repository":{"type":"git","url":"git+https://github.com/fable-retold/pict-section-form.git"},"bugs":{"url":"https://github.com/fable-retold/pict-section-form/issues"},"homepage":"https://github.com/fable-retold/pict-section-form#readme","scripts":{"start":"node source/Pict-Section-Form.js","tests":"npx quack test -g","coverage":"npx quack coverage","build":"npx quack build","test":"npx quack test","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.373","pict-application":"^1.0.34","pict-docuserve":"^1.4.19","pict-service-commandlineutility":"^1.0.19","quackage":"^1.3.0","tui-grid":"^4.21.22","typescript":"^5.9.3"},"dependencies":{"chart.js":"^4.5.1","fable-serviceproviderbase":"^3.0.19","marked":"^4.3.0","pict-provider":"^1.0.13","pict-section-excalidraw":"^1.0.3","pict-section-markdowneditor":"^1.0.17","pict-section-tuigrid":"^1.0.31","pict-template":"^1.0.15","pict-view":"^1.0.68"},"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"]}};},{}],41:[function(require,module,exports){// The container for all the Pict-Section-Form related code.
|
|
2821
2821
|
// The main dynamic view class
|
|
2822
2822
|
module.exports=require('./views/Pict-View-DynamicForm.js');//module.exports.default_configuration = require('./views/Pict-View-DynamicForm-DefaultConfiguration.json');
|
|
2823
2823
|
// The dynamic application dependencies
|
|
@@ -4548,7 +4548,7 @@ pView.setDataTabularByHash(pInput.PictForm.GroupIndex,pInput.Hash,pRowIndex,tmpV
|
|
|
4548
4548
|
* @param {string} pHTMLSelector - The HTML selector of the input.
|
|
4549
4549
|
* @param {string} pTransactionGUID - The transaction GUID, if any.
|
|
4550
4550
|
* @returns {any} - The result of the super.onDataChange method.
|
|
4551
|
-
*/onDataChange(pView,pInput,pValue,pHTMLSelector,pTransactionGUID){let tmpTriggerGroupConfigurations=this.getTriggerGroupConfigurationArray(pInput);if(Array.isArray(tmpTriggerGroupConfigurations)&&this.pict.views.PictFormMetacontroller){for(let i=0;i<tmpTriggerGroupConfigurations.length;i++){const tmpGroupConfig=tmpTriggerGroupConfigurations[i];if(tmpGroupConfig.TriggerAllInputs){if(Array.isArray(tmpGroupConfig.PreSolvers)){this.pict.providers.DynamicSolver.executeSolvers(pView,tmpGroupConfig.PreSolvers,"AutofillTriggerGroup hash ".concat(tmpGroupConfig.TriggerGroupHash," pre-trigger"));}pView.registerOnTransactionCompleteCallback(pTransactionGUID,()=>{if(Array.isArray(tmpGroupConfig.PostSolvers)){this.pict.providers.DynamicSolver.executeSolvers(pView,tmpGroupConfig.PostSolvers,"AutofillTriggerGroup hash ".concat(tmpGroupConfig.TriggerGroupHash," post-trigger"));}});this.pict.views.PictFormMetacontroller.triggerGlobalInputEvent("TriggerGroup:".concat(tmpGroupConfig.TriggerGroupHash,":DataChange:").concat(pInput.Hash||pInput.DataAddress,":").concat(this.pict.getUUID()),pTransactionGUID);}}}return super.onDataChange(pView,pInput,pValue,pHTMLSelector,pTransactionGUID);}/**
|
|
4551
|
+
*/onDataChange(pView,pInput,pValue,pHTMLSelector,pTransactionGUID){let tmpTriggerGroupConfigurations=this.getTriggerGroupConfigurationArray(pInput);if(Array.isArray(tmpTriggerGroupConfigurations)&&this.pict.views.PictFormMetacontroller){for(let i=0;i<tmpTriggerGroupConfigurations.length;i++){const tmpGroupConfig=tmpTriggerGroupConfigurations[i];if(tmpGroupConfig.TriggerAllInputs){if(Array.isArray(tmpGroupConfig.PreSolvers)){this.pict.providers.DynamicSolver.executeSolvers(pView,tmpGroupConfig.PreSolvers,"AutofillTriggerGroup hash ".concat(tmpGroupConfig.TriggerGroupHash," pre-trigger"));}pView.registerOnTransactionCompleteCallback(pTransactionGUID,()=>{if(Array.isArray(tmpGroupConfig.PostSolvers)){this.pict.providers.DynamicSolver.executeSolvers(pView,tmpGroupConfig.PostSolvers,"AutofillTriggerGroup hash ".concat(tmpGroupConfig.TriggerGroupHash," post-trigger"));const tmpMarshalScope=tmpGroupConfig.MarshalOnComplete;if(tmpMarshalScope===true){this.pict.views.PictFormMetacontroller.marshalToView();}else if(tmpMarshalScope){this.pict.views.PictFormMetacontroller.marshalSectionToView(tmpMarshalScope.Section);this.pict.views.PictFormMetacontroller.marshalInputToView(tmpMarshalScope.Input);}}});this.pict.views.PictFormMetacontroller.triggerGlobalInputEvent("TriggerGroup:".concat(tmpGroupConfig.TriggerGroupHash,":DataChange:").concat(pInput.Hash||pInput.DataAddress,":").concat(this.pict.getUUID()),pTransactionGUID);}}}return super.onDataChange(pView,pInput,pValue,pHTMLSelector,pTransactionGUID);}/**
|
|
4552
4552
|
* Handles the change event for tabular data.
|
|
4553
4553
|
*
|
|
4554
4554
|
* @param {Object} pView - The view object.
|
|
@@ -4558,7 +4558,7 @@ pView.setDataTabularByHash(pInput.PictForm.GroupIndex,pInput.Hash,pRowIndex,tmpV
|
|
|
4558
4558
|
* @param {number} pRowIndex - The index of the row.
|
|
4559
4559
|
* @param {string} pTransactionGUID - The transaction GUID, if any.
|
|
4560
4560
|
* @returns {any} - The result of the super method.
|
|
4561
|
-
*/onDataChangeTabular(pView,pInput,pValue,pHTMLSelector,pRowIndex,pTransactionGUID){let tmpTriggerGroupConfigurations=this.getTriggerGroupConfigurationArray(pInput);if(Array.isArray(tmpTriggerGroupConfigurations)&&this.pict.views.PictFormMetacontroller){for(let i=0;i<tmpTriggerGroupConfigurations.length;i++){const tmpGroupConfig=tmpTriggerGroupConfigurations[i];if(tmpGroupConfig.TriggerAllInputs){if(Array.isArray(tmpGroupConfig.PreSolvers)){this.pict.providers.DynamicSolver.executeSolvers(pView,tmpGroupConfig.PreSolvers,"AutofillTriggerGroup hash ".concat(tmpGroupConfig.TriggerGroupHash," tabular pre-trigger"));}pView.registerOnTransactionCompleteCallback(pTransactionGUID,()=>{if(Array.isArray(tmpGroupConfig.PostSolvers)){this.pict.providers.DynamicSolver.executeSolvers(pView,tmpGroupConfig.PostSolvers,"AutofillTriggerGroup hash ".concat(tmpGroupConfig.TriggerGroupHash," tabular post-trigger"));}});this.pict.views.PictFormMetacontroller.triggerGlobalInputEvent("TriggerGroup:".concat(tmpGroupConfig.TriggerGroupHash,":DataChange:").concat(pInput.Hash||pInput.DataAddress,":").concat(this.pict.getUUID()),pTransactionGUID);}}}return super.onDataChangeTabular(pView,pInput,pValue,pHTMLSelector,pRowIndex,pTransactionGUID);}/**
|
|
4561
|
+
*/onDataChangeTabular(pView,pInput,pValue,pHTMLSelector,pRowIndex,pTransactionGUID){let tmpTriggerGroupConfigurations=this.getTriggerGroupConfigurationArray(pInput);if(Array.isArray(tmpTriggerGroupConfigurations)&&this.pict.views.PictFormMetacontroller){for(let i=0;i<tmpTriggerGroupConfigurations.length;i++){const tmpGroupConfig=tmpTriggerGroupConfigurations[i];if(tmpGroupConfig.TriggerAllInputs){if(Array.isArray(tmpGroupConfig.PreSolvers)){this.pict.providers.DynamicSolver.executeSolvers(pView,tmpGroupConfig.PreSolvers,"AutofillTriggerGroup hash ".concat(tmpGroupConfig.TriggerGroupHash," tabular pre-trigger"));}pView.registerOnTransactionCompleteCallback(pTransactionGUID,()=>{if(Array.isArray(tmpGroupConfig.PostSolvers)){this.pict.providers.DynamicSolver.executeSolvers(pView,tmpGroupConfig.PostSolvers,"AutofillTriggerGroup hash ".concat(tmpGroupConfig.TriggerGroupHash," tabular post-trigger"));const tmpMarshalScope=tmpGroupConfig.MarshalOnComplete;if(tmpMarshalScope===true){this.pict.views.PictFormMetacontroller.marshalToView();}else if(tmpMarshalScope){this.pict.views.PictFormMetacontroller.marshalSectionToView(tmpMarshalScope.Section);this.pict.views.PictFormMetacontroller.marshalInputToView(tmpMarshalScope.Input);}}});this.pict.views.PictFormMetacontroller.triggerGlobalInputEvent("TriggerGroup:".concat(tmpGroupConfig.TriggerGroupHash,":DataChange:").concat(pInput.Hash||pInput.DataAddress,":").concat(this.pict.getUUID()),pTransactionGUID);}}}return super.onDataChangeTabular(pView,pInput,pValue,pHTMLSelector,pRowIndex,pTransactionGUID);}/**
|
|
4562
4562
|
* This input extension only responds to events
|
|
4563
4563
|
*
|
|
4564
4564
|
* @param {Object} pView - The view object.
|
|
@@ -4572,7 +4572,7 @@ pView.setDataTabularByHash(pInput.PictForm.GroupIndex,pInput.Hash,pRowIndex,tmpV
|
|
|
4572
4572
|
if('TriggerAddress'in tmpAutoFillTriggerGroup){// Autofill based on the address list as it isn't a select option
|
|
4573
4573
|
this.autoFillFromAddressList(pView,pInput,tmpAutoFillTriggerGroup,pHTMLSelector);}if(tmpAutoFillTriggerGroup.SelectOptionsRefresh){// Regenerate the picklist
|
|
4574
4574
|
// Because the pick lists are view specific, we need to lookup the view the input is in
|
|
4575
|
-
let tmpInputView=this.pict.views[pInput.PictForm.ViewHash];this.pict.providers.DynamicMetaLists.rebuildListByHash(pInput.PictForm.SelectOptionsPickList);this.pict.providers['Pict-Input-Select'].refreshSelectList(tmpInputView,tmpInputView.getGroup(pInput.PictForm.GroupIndex),tmpInputView.getRow(pInput.PictForm.GroupIndex,pInput.PictForm.Row),pInput,pValue,pHTMLSelector);tmpInputView.manualMarshalDataToViewByInput(pInput,tmpEventGUID);}if(Array.isArray(tmpAutoFillTriggerGroup.PostSolvers)){this.pict.providers.DynamicSolver.executeSolvers(pView,tmpAutoFillTriggerGroup.PostSolvers,"AutofillTriggerGroup hash ".concat(tmpAutoFillTriggerGroup.TriggerGroupHash," post-autofill"));}}return super.onAfterEventCompletion(pView,pInput,pValue,pHTMLSelector,pEvent,pTransactionGUID);}/**
|
|
4575
|
+
let tmpInputView=this.pict.views[pInput.PictForm.ViewHash];this.pict.providers.DynamicMetaLists.rebuildListByHash(pInput.PictForm.SelectOptionsPickList);this.pict.providers['Pict-Input-Select'].refreshSelectList(tmpInputView,tmpInputView.getGroup(pInput.PictForm.GroupIndex),tmpInputView.getRow(pInput.PictForm.GroupIndex,pInput.PictForm.Row),pInput,pValue,pHTMLSelector);tmpInputView.manualMarshalDataToViewByInput(pInput,tmpEventGUID);}if(Array.isArray(tmpAutoFillTriggerGroup.PostSolvers)){this.pict.providers.DynamicSolver.executeSolvers(pView,tmpAutoFillTriggerGroup.PostSolvers,"AutofillTriggerGroup hash ".concat(tmpAutoFillTriggerGroup.TriggerGroupHash," post-autofill"));const tmpMarshalScope=tmpAutoFillTriggerGroup.MarshalOnComplete;if(tmpMarshalScope===true){this.pict.views.PictFormMetacontroller.marshalToView();}else if(tmpMarshalScope){this.pict.views.PictFormMetacontroller.marshalSectionToView(tmpMarshalScope.Section);this.pict.views.PictFormMetacontroller.marshalInputToView(tmpMarshalScope.Input);}}}return super.onAfterEventCompletion(pView,pInput,pValue,pHTMLSelector,pEvent,pTransactionGUID);}/**
|
|
4576
4576
|
* Handles events for the Pict-Provider-InputExtension.
|
|
4577
4577
|
*
|
|
4578
4578
|
* @param {Object} pView - The view object.
|
|
@@ -4881,15 +4881,63 @@ let tmpInputSelectValue;try{tmpInputSelectValue=this.pict.ContentAssignment.read
|
|
|
4881
4881
|
* provider.commit(inputHash, fCallback)
|
|
4882
4882
|
*/const libPictSectionInputExtension=require('../Pict-Provider-InputExtension.js');const libPictSectionExcalidraw=require('pict-section-excalidraw');// Form templates live in pict-section-form's default-template set, so no
|
|
4883
4883
|
// runtime template injection is needed here. CSS still needs registering.
|
|
4884
|
-
const libCSS=require('./Pict-Provider-Input-Diagram-CSS.js');const libThemeify=require('./util/Themeify-SVG.js');const _DefaultProviderConfiguration={ProviderIdentifier:'Pict-Input-Diagram',AutoInitialize:true,AutoInitializeOrdinal:0,AutoSolveWithApp:false}
|
|
4885
|
-
|
|
4884
|
+
const libCSS=require('./Pict-Provider-Input-Diagram-CSS.js');const libThemeify=require('./util/Themeify-SVG.js');const _DefaultProviderConfiguration={ProviderIdentifier:'Pict-Input-Diagram',AutoInitialize:true,AutoInitializeOrdinal:0,AutoSolveWithApp:false};/**
|
|
4885
|
+
* @typedef {Object} Instance
|
|
4886
|
+
* @property {string} mode - 'edit' or 'view'
|
|
4887
|
+
* @property {string} slotID - The HTML ID of the content slot for this input
|
|
4888
|
+
* @property {string} lastValue - The last known value (SVG string)
|
|
4889
|
+
* @property {Object} viewInstance - The editor view instance (if in edit mode)
|
|
4890
|
+
* @property {string} viewHash - The hash of the editor view (if in edit mode)
|
|
4891
|
+
* @property {Object} input - The input definition object
|
|
4892
|
+
*/class PictInputDiagram extends libPictSectionInputExtension{/**
|
|
4893
|
+
* Creates an instance of the PictInputExtensionProvider class.
|
|
4894
|
+
*
|
|
4895
|
+
* @param {import('pict')} pFable - The Pict instance.
|
|
4896
|
+
* @param {Record<string, any>} [pOptions] - The options for the provider.
|
|
4897
|
+
* @param {string} [pServiceHash] - The service hash for the provider.
|
|
4898
|
+
*/constructor(pFable,pOptions,pServiceHash){let tmpOptions=Object.assign({},JSON.parse(JSON.stringify(_DefaultProviderConfiguration)),pOptions);super(pFable,tmpOptions,pServiceHash);/** @type {import('pict')} */this.pict;/** @type {any} */this.log;// inputHash → { mode, slotID, lastValue (SVG string), viewInstance?, viewHash?, input }
|
|
4899
|
+
/** @type {Record<String, Instance>} */this._instances={};// Register the scoped CSS.
|
|
4886
4900
|
if(this.pict&&this.pict.CSSMap&&typeof this.pict.CSSMap.addCSS==='function'){this.pict.CSSMap.addCSS('Pict-Input-Diagram-CSS',libCSS,500);}}// ----------------------------------------------------------------------------
|
|
4887
4901
|
// Helpers
|
|
4888
4902
|
// ----------------------------------------------------------------------------
|
|
4889
|
-
|
|
4903
|
+
/**
|
|
4904
|
+
* @param {string} pInputHTMLID - The RawHTMLID of the input.
|
|
4905
|
+
* @returns {string} The HTML ID selector for the content display slot corresponding to the input.
|
|
4906
|
+
*/getContentDisplayHTMLID(pInputHTMLID){return"#DISPLAY-FOR-".concat(pInputHTMLID);}/**
|
|
4907
|
+
* @param {string} pInputHTMLID - The RawHTMLID of the input.
|
|
4908
|
+
* @param {number} pRowIndex - The row index for tabular inputs.
|
|
4909
|
+
* @returns {string} The HTML ID selector for the content display slot corresponding to the tabular input.
|
|
4910
|
+
*/getTabularContentDisplayInputID(pInputHTMLID,pRowIndex){return"#DISPLAY-FOR-TABULAR-".concat(pInputHTMLID,"-").concat(pRowIndex);}/**
|
|
4911
|
+
* Resolve the value to use for display/editing, following this precedence:
|
|
4912
|
+
* 1. The provided pValue (if a non-empty string)
|
|
4913
|
+
* 2. The input's Content property (if a non-empty string)
|
|
4914
|
+
* 3. The input's Default property (if a non-empty string)
|
|
4915
|
+
* 4. An empty string if none of the above are valid
|
|
4916
|
+
*
|
|
4917
|
+
* @param {Object} pInput - The input definition object.
|
|
4918
|
+
* @param {any} pValue - The value provided for the input.
|
|
4919
|
+
* @returns {string} The resolved value to use for display/editing.
|
|
4920
|
+
*/_resolveValue(pInput,pValue){if(typeof pValue==='string'&&pValue.length>0)return pValue;if(pInput&&pInput.Content&&typeof pInput.Content==='string')return pInput.Content;if(pInput&&pInput.Default&&typeof pInput.Default==='string')return pInput.Default;return'';}/**
|
|
4921
|
+
* @param {any} pValue - The value to check.
|
|
4922
|
+
* @return {boolean} True if the value is a string that appears to contain an <svg> element, false otherwise.
|
|
4923
|
+
*/_isLikelySvg(pValue){return typeof pValue==='string'&&/<svg[\s>]/i.test(pValue);}/**
|
|
4924
|
+
* @param {string} pSlotID - The HTML ID of the content slot to assign.
|
|
4925
|
+
* @param {string} pHTML - The HTML string to assign to the slot.
|
|
4926
|
+
* @returns {boolean} True if the assignment was successful, false otherwise.
|
|
4927
|
+
*/_assignSlotContent(pSlotID,pHTML){if(this.pict&&this.pict.ContentAssignment&&typeof this.pict.ContentAssignment.assignContent==='function'){this.pict.ContentAssignment.assignContent(pSlotID,pHTML);return true;}return false;}/**
|
|
4928
|
+
* @param {string} pInputHTMLID - The RawHTMLID of the input whose hidden value field should be updated.
|
|
4929
|
+
* @param {string} pValue - The SVG string to set as the value of the hidden input field.
|
|
4930
|
+
* @returns {boolean} True if the value was successfully written and a change event dispatched, false otherwise.
|
|
4931
|
+
*/_writeHiddenInputValue(pInputHTMLID,pValue){let tmpEl=typeof document!=='undefined'?document.getElementById(pInputHTMLID):null;if(!tmpEl)return false;tmpEl.value=pValue==null?'':String(pValue);try{tmpEl.dispatchEvent(new Event('change',{bubbles:true}));}catch(pErr){/* jsdom may lack Event */}return true;}_resolveVendor(){if(typeof window==='undefined')return null;return window.PictSectionExcalidrawVendor||null;}/**
|
|
4890
4932
|
* Wrap an SVG string in a thin <div> for the view-mode slot. If the value
|
|
4891
4933
|
* is empty or not an SVG, show an "(empty)" placeholder.
|
|
4892
|
-
|
|
4934
|
+
*
|
|
4935
|
+
* @param {string} pValue - The SVG string to wrap for display.
|
|
4936
|
+
* @returns {string} The HTML string to assign to the view slot.
|
|
4937
|
+
*/_buildViewHTML(pValue){if(this._isLikelySvg(pValue)){return"<div class=\"pict-section-form-diagram-view\">".concat(pValue,"</div>");}return"<div class=\"pict-section-form-diagram-view is-empty\">(empty diagram)</div>";}/**
|
|
4938
|
+
* @param {Object} pInput - The input definition object.
|
|
4939
|
+
* @param {string} pMode - The mode to set ('edit' or 'view').
|
|
4940
|
+
*/_setSlotModeClass(pInput,pMode){if(typeof document==='undefined')return;let tmpRawHTMLID=pInput.Macro.RawHTMLID;let tmpOuter=document.getElementById(tmpRawHTMLID)||document.querySelector(this.getContentDisplayHTMLID(tmpRawHTMLID));if(!tmpOuter||!tmpOuter.classList)return;tmpOuter.classList.remove('mode-edit','mode-view','pict-section-form-diagram-edit');if(pMode==='edit'){tmpOuter.classList.add('mode-edit','pict-section-form-diagram-edit');}else{tmpOuter.classList.add('mode-view');}}// ----------------------------------------------------------------------------
|
|
4893
4941
|
// View mode
|
|
4894
4942
|
// ----------------------------------------------------------------------------
|
|
4895
4943
|
_mountView(pView,pInput,pValue){let tmpRawHTMLID=pInput.Macro.RawHTMLID;let tmpSlotID=this.getContentDisplayHTMLID(tmpRawHTMLID);let tmpValue=this._resolveValue(pInput,pValue);this._assignSlotContent(tmpSlotID,this._buildViewHTML(tmpValue));this._setSlotModeClass(pInput,'view');let tmpInst=this._instances[pInput.Hash]||{};tmpInst.mode='view';tmpInst.slotID=tmpSlotID;tmpInst.lastValue=tmpValue;tmpInst.input=pInput;tmpInst.viewInstance=null;this._instances[pInput.Hash]=tmpInst;}// ----------------------------------------------------------------------------
|
|
@@ -4916,7 +4964,32 @@ getMode(pInputHash){let tmpInst=this._instances[pInputHash];return tmpInst?tmpIn
|
|
|
4916
4964
|
let tmpThemeColors=tmpInst.themeColors!==false;let tmpProvider=this;let tmpRawHTMLID=tmpInst.input.Macro.RawHTMLID;try{let tmpExportPromise=tmpInst.viewInstance.exportSvg({exportEmbedScene:true,exportBackground:false});Promise.resolve(tmpExportPromise).then(pSvgEl=>{let tmpSvgStr=pSvgEl&&typeof pSvgEl.outerHTML==='string'?pSvgEl.outerHTML:null;if(tmpSvgStr){if(tmpThemeColors)tmpSvgStr=libThemeify.themeifySVG(tmpSvgStr);tmpProvider._writeHiddenInputValue(tmpRawHTMLID,tmpSvgStr);tmpInst.lastValue=tmpSvgStr;}if(typeof fCallback==='function')fCallback(null);},pErr=>{if(typeof fCallback==='function')fCallback(pErr);});}catch(pErr){if(typeof fCallback==='function')fCallback(pErr);}}// ----------------------------------------------------------------------------
|
|
4917
4965
|
// Lifecycle hooks
|
|
4918
4966
|
// ----------------------------------------------------------------------------
|
|
4919
|
-
onInputInitialize(pView,pGroup,pRow,pInput,pValue,pHTMLSelector,pTransactionGUID){this._mountView(pView,pInput,pValue);return super.onInputInitialize(pView,pGroup,pRow,pInput,pValue,pHTMLSelector,pTransactionGUID);}
|
|
4967
|
+
onInputInitialize(pView,pGroup,pRow,pInput,pValue,pHTMLSelector,pTransactionGUID){this._mountView(pView,pInput,pValue);return super.onInputInitialize(pView,pGroup,pRow,pInput,pValue,pHTMLSelector,pTransactionGUID);}/**
|
|
4968
|
+
* A tabular input has been initialized (rendered into the DOM)
|
|
4969
|
+
*
|
|
4970
|
+
* Called when an input has this Provider hash in its 'Providers' array.
|
|
4971
|
+
*
|
|
4972
|
+
* @param {Object} pView - The view object.
|
|
4973
|
+
* @param {Object} pGroup - The group definition object.
|
|
4974
|
+
* @param {Object} pInput - The input object.
|
|
4975
|
+
* @param {any} pValue - The value of the input object
|
|
4976
|
+
* @param {string} pHTMLSelector - The HTML selector for the input object (it will return an array).
|
|
4977
|
+
* @param {string} pTransactionGUID - The transaction GUID for the event dispatch.
|
|
4978
|
+
* @param {number} pRowIndex - The row index of the tabular data
|
|
4979
|
+
*
|
|
4980
|
+
* @return {boolean}
|
|
4981
|
+
*/onInputInitializeTabular(pView,pGroup,pInput,pValue,pHTMLSelector,pRowIndex,pTransactionGUID){super.onInputInitializeTabular(pView,pGroup,pInput,pValue,pHTMLSelector,pRowIndex,pTransactionGUID);let tmpErr=new Error('Diagram InputType is not supported inside Tabular rows in Phase 1.');if(this.log)this.log.warn('[Pict-Input-Diagram] tabular not supported',{inputHash:pInput&&pInput.Hash});throw tmpErr;}/**
|
|
4982
|
+
* Fires when data is marshaled to the form for this input.
|
|
4983
|
+
*
|
|
4984
|
+
* @param {Object} pView - The view object.
|
|
4985
|
+
* @param {Object} pGroup - The group definition object.
|
|
4986
|
+
* @param {number} pRow - The Row index.
|
|
4987
|
+
* @param {Object} pInput - The input object.
|
|
4988
|
+
* @param {any} pValue - The value to marshal.
|
|
4989
|
+
* @param {string} pHTMLSelector - The HTML selector.
|
|
4990
|
+
* @param {string} pTransactionGUID - The transaction GUID for the event dispatch.
|
|
4991
|
+
* @returns {boolean} - Returns true if the data was successfully marshaled to the form.
|
|
4992
|
+
*/onDataMarshalToForm(pView,pGroup,pRow,pInput,pValue,pHTMLSelector,pTransactionGUID){let tmpInst=this._instances[pInput.Hash];if(!tmpInst){this._mountView(pView,pInput,pValue);}else if(tmpInst.mode==='view'){this._mountView(pView,pInput,pValue);}else{// Edit mode: hot-replace the editor's scene.
|
|
4920
4993
|
tmpInst.lastValue=typeof pValue==='string'?pValue:tmpInst.lastValue;this._extractSceneFromSvg(tmpInst.lastValue,(pErr,pScene)=>{if(pErr||!pScene)return;if(tmpInst.viewInstance&&typeof tmpInst.viewInstance.setScene==='function'){try{tmpInst.viewInstance.setScene(pScene);}catch(pSetErr){if(this.log)this.log.warn('[Pict-Input-Diagram] setScene threw after marshal',{error:pSetErr.message});}}});}return super.onDataMarshalToForm(pView,pGroup,pRow,pInput,pValue,pHTMLSelector,pTransactionGUID);}onDataMarshalToFormTabular(pView,pGroup,pInput,pValue,pHTMLSelector,pRowIndex,pTransactionGUID){return super.onDataMarshalToFormTabular(pView,pGroup,pInput,pValue,pHTMLSelector,pRowIndex,pTransactionGUID);}}module.exports=PictInputDiagram;module.exports.default_configuration=_DefaultProviderConfiguration;},{"../Pict-Provider-InputExtension.js":53,"./Pict-Provider-Input-Diagram-CSS.js":63,"./util/Themeify-SVG.js":78,"pict-section-excalidraw":20}],65:[function(require,module,exports){const libPictSectionInputExtension=require('../Pict-Provider-InputExtension.js');/**
|
|
4921
4994
|
* CustomInputHandler class for Entity Bundle Requests.
|
|
4922
4995
|
*
|
|
@@ -4983,7 +5056,7 @@ if(pCustomRequestInformation.Destination){this.pict.manifest.setValueByHash(this
|
|
|
4983
5056
|
if(typeof pInput!=='object'||!('PictForm'in pInput)||!('EntitiesBundle'in pInput.PictForm)||!Array.isArray(pInput.PictForm.EntitiesBundle)){this.log.warn("Input at ".concat(pHTMLSelector," is set as an EntityBundleRequest input but no array of entity requests was found"));return null;}const tmpLoadGUID="BundleLoad-".concat(this.pict.getUUID());if(pTransactionGUID){pView.registerEventTransactionAsyncOperation(pTransactionGUID,tmpLoadGUID);}let tmpInput=pInput;let tmpValue=pValue;let tmpAnticipate=this.fable.newAnticipate();if(tmpInput.PictForm.EntitiesBundle.length>0&&tmpInput.PictForm.EntitiesBundle[0].PictMode){tmpAnticipate.anticipate(fNext=>{this.pict.EntityProvider.gatherDataFromServer(tmpInput.PictForm.EntitiesBundle,pError=>{// in case of an empty array, or all tasks being synchronous, wait for the next tick so we don't get event ordering problems
|
|
4984
5057
|
setTimeout(()=>fNext(pError),0);});});}else{const tmpStateStack=[];/** @type {Record<string, any>} */let tmpState={Value:tmpValue,Input:tmpInput,View:pView};for(let i=0;i<tmpInput.PictForm.EntitiesBundle.length;i++){let tmpEntityBundleEntry=tmpInput.PictForm.EntitiesBundle[i];tmpAnticipate.anticipate(fNext=>{try{switch(tmpEntityBundleEntry.Type){case'Custom':return this.gatherCustomDataSet(fNext,tmpEntityBundleEntry,pView,tmpInput,tmpValue);case'SetStateAddress':tmpStateStack.push(tmpState);tmpState=this.fable.manifest.getValueByHash(this.fable,tmpEntityBundleEntry.StateAddress);if(typeof tmpState==='undefined'){tmpState={};this.fable.manifest.setValueByHash(this.fable,tmpEntityBundleEntry.StateAddress,tmpState);}break;case'PopState':if(tmpStateStack.length>0){tmpState=tmpStateStack.pop();}else{this.log.warn("EntityBundleRequest encountered a PopState without a matching SetStateAddress.");}break;case'MapJoin':this.pict.EntityProvider.mapJoin(tmpEntityBundleEntry,this.pict.EntityProvider.prepareState(tmpState,tmpEntityBundleEntry));break;case'ProjectDataset':this.pict.EntityProvider.projectDataset(tmpEntityBundleEntry,this.pict.EntityProvider.prepareState(tmpState,tmpEntityBundleEntry));break;// This is the default case, for a meadow entity set or single entity
|
|
4985
5058
|
case'MeadowEntity':default:return this.gatherEntitySet(fNext,tmpEntityBundleEntry,pView,tmpInput,tmpValue);}}catch(pError){this.log.error("EntityBundleRequest error gathering entity set: ".concat(pError),pError);}return fNext();});}// in case of an empty array, or all tasks being synchronous, wait for the next tick so we don't get event ordering problems
|
|
4986
|
-
tmpAnticipate.anticipate(fNext=>setTimeout(fNext,0));}tmpAnticipate.anticipate(fNext=>{if(tmpInput.PictForm.EntityBundleTriggerGroup&&this.pict.views.PictFormMetacontroller){const tmpGroupConfig=this.getTriggerGroupConfigurationArray(tmpInput,tmpInput.PictForm.EntityBundleTriggerGroup)[0];if(tmpGroupConfig&&Array.isArray(tmpGroupConfig.PreSolvers)){this.pict.providers.DynamicSolver.executeSolvers(pView,tmpGroupConfig.PreSolvers,"EntityBundleTriggerGroup hash ".concat(tmpGroupConfig.TriggerGroupHash," pre-trigger"));}let tmpTransactionGUID;if(tmpGroupConfig&&Array.isArray(tmpGroupConfig.PostSolvers)){tmpTransactionGUID=pTransactionGUID||this.pict.getUUID();if(tmpTransactionGUID!==pTransactionGUID){this.pict.TransactionTracking.registerTransaction(tmpTransactionGUID);}pView.registerOnTransactionCompleteCallback(tmpTransactionGUID,()=>{if(Array.isArray(tmpGroupConfig.PostSolvers)){this.pict.providers.DynamicSolver.executeSolvers(pView,tmpGroupConfig.PostSolvers,"EntityBundleTriggerGroup hash ".concat(tmpGroupConfig.TriggerGroupHash,"
|
|
5059
|
+
tmpAnticipate.anticipate(fNext=>setTimeout(fNext,0));}tmpAnticipate.anticipate(fNext=>{if(tmpInput.PictForm.EntityBundleTriggerGroup&&this.pict.views.PictFormMetacontroller){const tmpGroupConfig=this.getTriggerGroupConfigurationArray(tmpInput,tmpInput.PictForm.EntityBundleTriggerGroup)[0];if(tmpGroupConfig&&Array.isArray(tmpGroupConfig.PreSolvers)){this.pict.providers.DynamicSolver.executeSolvers(pView,tmpGroupConfig.PreSolvers,"EntityBundleTriggerGroup hash ".concat(tmpGroupConfig.TriggerGroupHash," pre-trigger"));}let tmpTransactionGUID;if(tmpGroupConfig&&Array.isArray(tmpGroupConfig.PostSolvers)){tmpTransactionGUID=pTransactionGUID||this.pict.getUUID();if(tmpTransactionGUID!==pTransactionGUID){this.pict.TransactionTracking.registerTransaction(tmpTransactionGUID);}pView.registerOnTransactionCompleteCallback(tmpTransactionGUID,()=>{if(Array.isArray(tmpGroupConfig.PostSolvers)){this.pict.providers.DynamicSolver.executeSolvers(pView,tmpGroupConfig.PostSolvers,"EntityBundleTriggerGroup hash ".concat(tmpGroupConfig.TriggerGroupHash," post-trigger"));const tmpMarshalScope=tmpGroupConfig.MarshalOnComplete;if(tmpMarshalScope===true){this.pict.views.PictFormMetacontroller.marshalToView();}else if(tmpMarshalScope){this.pict.views.PictFormMetacontroller.marshalSectionToView(tmpMarshalScope.Section);this.pict.views.PictFormMetacontroller.marshalInputToView(tmpMarshalScope.Input);}}});}// Trigger the autofill global event
|
|
4987
5060
|
this.pict.views.PictFormMetacontroller.triggerGlobalInputEvent("TriggerGroup:".concat(tmpInput.PictForm.EntityBundleTriggerGroup,":BundleLoad:").concat(pInput.Hash||pInput.DataAddress,":").concat(this.pict.getUUID()),pTransactionGUID);if(tmpTransactionGUID&&tmpTransactionGUID!==pTransactionGUID){pView.finalizeTransaction(tmpTransactionGUID);}}if(tmpInput.PictForm.EntityBundleTriggerMetacontrollerSolve&&this.pict.views.PictFormMetacontroller){// Trigger the solve global event
|
|
4988
5061
|
this.pict.views.PictFormMetacontroller.solve();}if(tmpInput.PictForm.EntityBundleTriggerMetacontrollerRender&&this.pict.views.PictFormMetacontroller){// Trigger the render
|
|
4989
5062
|
this.pict.views.PictFormMetacontroller.render();}fNext();});return new Promise((pResolve,pReject)=>{// Now fire the "autofilldata" event for the groups.
|
|
@@ -5324,7 +5397,13 @@ tmpProvider._writeHiddenInputValue(tmpRawHTMLID,pContent);let tmpLatest=tmpProvi
|
|
|
5324
5397
|
// its default base64 inline; we *don't* want that when text-only,
|
|
5325
5398
|
// so we eat the file by calling back with an error.
|
|
5326
5399
|
fImgCallback('Image uploads are disabled for this field.');return true;}let tmpUploaderName=tmpRichTextOpts.ImageUploader;if(tmpUploaderName&&tmpProvider.pict&&tmpProvider.pict.PictApplication&&typeof tmpProvider.pict.PictApplication[tmpUploaderName]==='function'){try{return tmpProvider.pict.PictApplication[tmpUploaderName](pFile,pInput,fImgCallback);}catch(pErr){if(tmpProvider.log){tmpProvider.log.warn('[Pict-Input-RichText] ImageUploader threw',{error:pErr.message,inputHash:pInput.Hash});}fImgCallback(pErr.message);return true;}}// No uploader configured + AllowImages=true → default base64 inline.
|
|
5327
|
-
return false;}
|
|
5400
|
+
return false;}/**
|
|
5401
|
+
* Push CodeMirror extensions before the editor mounts. We enable
|
|
5402
|
+
* line wrapping by default so long markdown paragraphs flow to
|
|
5403
|
+
* the next visual line instead of horizontally scrolling — the
|
|
5404
|
+
* almost-always-correct default for prose. Opt out via
|
|
5405
|
+
* `PictForm.RichText.WordWrap: false` in the descriptor.
|
|
5406
|
+
*/customConfigureExtensions(pExtensions,pSegmentIndex){let tmpWantWrap=tmpRichTextOpts.WordWrap!==false;if(tmpWantWrap){let tmpCM=this._codeMirrorModules;if(tmpCM&&tmpCM.EditorView&&tmpCM.EditorView.lineWrapping){pExtensions.push(tmpCM.EditorView.lineWrapping);}}return pExtensions;}}this.pict.addView(tmpViewHash,tmpEditorOpts,RichTextFormEditor);let tmpEditorView=this.pict.views[tmpViewHash];if(!tmpEditorView){let tmpErr=new Error('Failed to instantiate RichText editor view '+tmpViewHash);if(this.log)this.log.error('[Pict-Input-RichText] addView returned nothing',{viewHash:tmpViewHash});if(typeof fCallback==='function')fCallback(tmpErr);return;}// Surface mode on the outer slot for the optional toggle-chip pseudo.
|
|
5328
5407
|
if(typeof document!=='undefined'){let tmpOuter=document.querySelector(tmpSlotID);if(tmpOuter&&tmpOuter.classList){tmpOuter.classList.remove('mode-view');tmpOuter.classList.add('mode-edit','pict-section-form-richtext-edit');}}tmpInst.mode='edit';tmpInst.slotID=tmpSlotID;tmpInst.lastValue=tmpContent;tmpInst.viewInstance=tmpEditorView;tmpInst.viewHash=tmpViewHash;this._instances[pInput.Hash]=tmpInst;// Render the editor. The view's render() resolves TargetElementAddress
|
|
5329
5408
|
// against ContentAssignment and paints into the slot.
|
|
5330
5409
|
try{let tmpResult=tmpEditorView.render();// Some renders are async (Promise-returning) and some are sync.
|
|
@@ -6009,7 +6088,11 @@ this.pict.TemplateProvider.addTemplate(pGroup.SectionTabularRowVirtualTemplateHa
|
|
|
6009
6088
|
// pict's built-in icon registry (so they theme + scale like every other glyph).
|
|
6010
6089
|
if(this.pict&&this.pict.providers&&this.pict.providers.Icon&&typeof this.pict.providers.Icon.registerSet==='function'){this.pict.providers.Icon.registerSet({Outline:{Sort:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 20V5"/><path d="M5.5 8.5L9 5L12.5 8.5"/><path d="M15 4V19"/><path d="M11.5 15.5L15 19L18.5 15.5"/></svg>',SortAscending:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20V5"/><path d="M6 11L12 5L18 11"/></svg>',SortDescending:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 4V19"/><path d="M6 13L12 19L18 13"/></svg>'}});}// CSS for the clickable sort control. Inactive glyphs are faded; the
|
|
6011
6090
|
// actively-sorted column's glyph is full opacity.
|
|
6012
|
-
if(this.pict&&this.pict.CSSMap&&typeof this.pict.CSSMap.addCSS==='function'){this.pict.CSSMap.addCSS('Pict-Layout-Tabular-Sort-CSS','.pict-tabular-sort-control { cursor: pointer; display: inline-flex; vertical-align: middle; margin-left: 0.3em; opacity: 0.4; }'+' .pict-tabular-sort-control:hover { opacity: 0.75; }'+' .pict-tabular-sort-control.pict-tabular-sort-asc, .pict-tabular-sort-control.pict-tabular-sort-desc { opacity: 1; }',500)
|
|
6091
|
+
if(this.pict&&this.pict.CSSMap&&typeof this.pict.CSSMap.addCSS==='function'){this.pict.CSSMap.addCSS('Pict-Layout-Tabular-Sort-CSS','.pict-tabular-sort-control { cursor: pointer; display: inline-flex; vertical-align: middle; margin-left: 0.3em; opacity: 0.4; }'+' .pict-tabular-sort-control:hover { opacity: 0.75; }'+' .pict-tabular-sort-control.pict-tabular-sort-asc, .pict-tabular-sort-control.pict-tabular-sort-desc { opacity: 1; }',500);// CSS for the optional ColumnChooser feature: a right-aligned trigger button
|
|
6092
|
+
// above the table and a fixed-position popover of checkbox rows. Fixed +
|
|
6093
|
+
// JS-positioned (like the recordset's column chooser) so no ancestor
|
|
6094
|
+
// overflow can clip it; the transparent backdrop catches outside clicks.
|
|
6095
|
+
this.pict.CSSMap.addCSS('Pict-Layout-Tabular-ColumnChooser-CSS',/*css*/"\n\t.pict-tabular-colchooser-bar { display: flex; justify-content: flex-end; margin: 0 0 0.35rem; }\n\t.pict-tabular-colchooser-trigger { display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer; font: inherit; font-size: 0.88rem;\n\t\tpadding: 0.3rem 0.65rem; border: 1px solid var(--theme-color-border-default, #d7dce3); border-radius: 7px;\n\t\tbackground: var(--theme-color-background-panel, #fff); color: var(--theme-color-text-secondary, #45505f); }\n\t.pict-tabular-colchooser-trigger:hover { background: var(--theme-color-background-tertiary, #eceef2); color: var(--theme-color-text-primary, #1f2733); }\n\t.pict-tabular-colchooser-count { font-size: 0.8em; color: var(--theme-color-text-muted, #6b7686); }\n\t.pict-tabular-colchooser-pop { position: fixed; z-index: 30; min-width: 220px; max-width: 320px; display: none; }\n\t.pict-tabular-colchooser-pop.open { display: block; }\n\t.pict-tabular-colchooser-backdrop { position: fixed; inset: 0; z-index: 0; }\n\t.pict-tabular-colchooser-panel { position: relative; z-index: 1; display: flex; flex-direction: column; max-height: min(70vh, 420px);\n\t\tbackground: var(--theme-color-background-panel, #fff); border: 1px solid var(--theme-color-border-default, #d7dce3);\n\t\tborder-radius: 10px; box-shadow: 0 10px 28px rgba(17, 24, 39, 0.14); overflow: hidden; }\n\t.pict-tabular-colchooser-list { flex: 1 1 auto; overflow-y: auto; padding: 0.25rem 0; }\n\t.pict-tabular-colchooser-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; cursor: pointer;\n\t\tpadding: 0.32rem 0.8rem; color: var(--theme-color-text-primary, #1f2733); }\n\t.pict-tabular-colchooser-row:hover { background: var(--theme-color-background-tertiary, #eceef2); }\n\t.pict-tabular-colchooser-row input { flex: 0 0 auto; margin: 0; cursor: pointer; }\n\t.pict-tabular-colchooser-footer { flex: 0 0 auto; display: flex; justify-content: flex-end; padding: 0.45rem 0.7rem; border-top: 1px solid var(--theme-color-border-light, #e8ebf0); }\n\t.pict-tabular-colchooser-reset { font: inherit; font-size: 0.84rem; cursor: pointer; border: none; background: transparent; color: var(--theme-color-text-muted, #6b7686); padding: 0.15rem 0.3rem; border-radius: 5px; }\n\t.pict-tabular-colchooser-reset:hover { color: var(--theme-color-text-primary, #1f2733); background: var(--theme-color-background-tertiary, #eceef2); }\n",500);}}/**
|
|
6013
6096
|
* Builds one prime-header `<th>` with an injected, clickable sort control
|
|
6014
6097
|
* `<span>` carrying the sort SVG glyph. Used when the group has
|
|
6015
6098
|
* `ColumnSorting: true`. The glyph reflects the current sort state of the
|
|
@@ -6067,14 +6150,23 @@ tmpView.rebuildCustomTemplate();tmpView.render();if(this.pict.views.PictFormMeta
|
|
|
6067
6150
|
* @param {Object} pView
|
|
6068
6151
|
* @param {Object} pGroup
|
|
6069
6152
|
* @returns {Array<Array<{Label: string, ColumnSpan: number, CSSClass: string}>>}
|
|
6070
|
-
*/_buildExpandedHeadersConfig(pView,pGroup){let tmpExpanded=[];//
|
|
6071
|
-
|
|
6153
|
+
*/_buildExpandedHeadersConfig(pView,pGroup){let tmpExpanded=[];// When the column chooser has hidden columns, each user-provided header
|
|
6154
|
+
// cell's ColumnSpan shrinks by the hidden columns it covers (cells reduced
|
|
6155
|
+
// to zero drop out), so the stacked headers stay aligned with the columns
|
|
6156
|
+
// that actually render. The spans partition the configured (non-
|
|
6157
|
+
// TabularHidden) data columns in manifest order — same contract the
|
|
6158
|
+
// span-total warning in generateGroupLayoutTemplate enforces.
|
|
6159
|
+
let tmpChooserHiddenSet=this._getTabularColumnChooserHiddenSet(pView,pGroup);let tmpConfiguredColumnVisibility=[];if(tmpChooserHiddenSet&&pGroup.supportingManifest&&Array.isArray(pGroup.supportingManifest.elementAddresses)){for(let k=0;k<pGroup.supportingManifest.elementAddresses.length;k++){let tmpDescriptor=pGroup.supportingManifest.elementDescriptors[pGroup.supportingManifest.elementAddresses[k]];if(!tmpDescriptor||tmpDescriptor.PictForm&&tmpDescriptor.PictForm.TabularHidden){continue;}tmpConfiguredColumnVisibility.push(!tmpChooserHiddenSet.has(String(pGroup.supportingManifest.elementAddresses[k])));}}// Render user-provided Headers config first (at the top of the table).
|
|
6160
|
+
if(Array.isArray(pGroup.Headers)){for(let r=0;r<pGroup.Headers.length;r++){let tmpRowConfig=pGroup.Headers[r];if(!Array.isArray(tmpRowConfig)){continue;}let tmpNormalizedRow=[];// Walks the configured-column visibility list as spans consume columns.
|
|
6161
|
+
let tmpColumnCursor=0;for(let c=0;c<tmpRowConfig.length;c++){let tmpCell=tmpRowConfig[c];if(!tmpCell||typeof tmpCell!=='object'){continue;}let tmpColumnSpan=Number(tmpCell.ColumnSpan)>0?Number(tmpCell.ColumnSpan):1;if(tmpChooserHiddenSet){let tmpVisibleSpan=0;for(let s=0;s<tmpColumnSpan;s++){// Columns past the configured set keep their span (the
|
|
6162
|
+
// misalignment warning will already have fired for that).
|
|
6163
|
+
if(tmpColumnCursor>=tmpConfiguredColumnVisibility.length||tmpConfiguredColumnVisibility[tmpColumnCursor]){tmpVisibleSpan++;}tmpColumnCursor++;}if(tmpVisibleSpan===0){continue;}tmpColumnSpan=tmpVisibleSpan;}tmpNormalizedRow.push({Label:typeof tmpCell.Label==='string'?tmpCell.Label:'',ColumnSpan:tmpColumnSpan,CSSClass:typeof tmpCell.CSSClass==='string'?tmpCell.CSSClass:''});}tmpExpanded.push(tmpNormalizedRow);}}// Then synthesize a clustered super-header row from any DynamicColumns generator
|
|
6072
6164
|
// that declared a HeaderGroupTemplate. This row sits JUST ABOVE the default
|
|
6073
6165
|
// column-name row so the visual cluster lines up with the columns it groups.
|
|
6074
6166
|
// Walk the supportingManifest in order and group adjacent descriptors that
|
|
6075
6167
|
// share both _DynamicColumnGeneratorIndex and _DynamicColumnHeaderGroup; static
|
|
6076
6168
|
// descriptors get blank "spacer" cells.
|
|
6077
|
-
let tmpHasHeaderGroups=false;if(Array.isArray(pGroup.DynamicColumns)){for(let g=0;g<pGroup.DynamicColumns.length;g++){if(pGroup.DynamicColumns[g]&&pGroup.DynamicColumns[g].HeaderGroupTemplate){tmpHasHeaderGroups=true;break;}}}if(tmpHasHeaderGroups&&pGroup.supportingManifest){let tmpSynthRow=[];let tmpCurrentRun=null;let tmpAddresses=pGroup.supportingManifest.elementAddresses;for(let k=0;k<tmpAddresses.length;k++){let tmpDescriptor=pGroup.supportingManifest.elementDescriptors[tmpAddresses[k]];if(!tmpDescriptor){continue;}if(tmpDescriptor.PictForm&&tmpDescriptor.PictForm.TabularHidden){continue;}let tmpIsDynamic=typeof tmpDescriptor._DynamicColumnGeneratorIndex==='number';let tmpGroupLabel=tmpIsDynamic&&typeof tmpDescriptor._DynamicColumnHeaderGroup==='string'?tmpDescriptor._DynamicColumnHeaderGroup:'';let tmpRunKey=tmpIsDynamic?"D".concat(tmpDescriptor._DynamicColumnGeneratorIndex,"|").concat(tmpGroupLabel):"S|".concat(k);if(tmpCurrentRun&&tmpCurrentRun.RunKey===tmpRunKey){tmpCurrentRun.Cell.ColumnSpan+=1;}else{tmpCurrentRun={RunKey:tmpRunKey,Cell:{Label:tmpIsDynamic?tmpGroupLabel:'',ColumnSpan:1,CSSClass:tmpIsDynamic?'pict-tabular-dynamic-header-group':'pict-tabular-static-header-spacer'}};tmpSynthRow.push(tmpCurrentRun.Cell);}}tmpExpanded.push(tmpSynthRow);}return tmpExpanded;}/**
|
|
6169
|
+
let tmpHasHeaderGroups=false;if(Array.isArray(pGroup.DynamicColumns)){for(let g=0;g<pGroup.DynamicColumns.length;g++){if(pGroup.DynamicColumns[g]&&pGroup.DynamicColumns[g].HeaderGroupTemplate){tmpHasHeaderGroups=true;break;}}}if(tmpHasHeaderGroups&&pGroup.supportingManifest){let tmpSynthRow=[];let tmpCurrentRun=null;let tmpAddresses=pGroup.supportingManifest.elementAddresses;for(let k=0;k<tmpAddresses.length;k++){let tmpDescriptor=pGroup.supportingManifest.elementDescriptors[tmpAddresses[k]];if(!tmpDescriptor){continue;}if(tmpDescriptor.PictForm&&tmpDescriptor.PictForm.TabularHidden){continue;}if(tmpChooserHiddenSet&&tmpChooserHiddenSet.has(String(tmpAddresses[k]))){continue;}let tmpIsDynamic=typeof tmpDescriptor._DynamicColumnGeneratorIndex==='number';let tmpGroupLabel=tmpIsDynamic&&typeof tmpDescriptor._DynamicColumnHeaderGroup==='string'?tmpDescriptor._DynamicColumnHeaderGroup:'';let tmpRunKey=tmpIsDynamic?"D".concat(tmpDescriptor._DynamicColumnGeneratorIndex,"|").concat(tmpGroupLabel):"S|".concat(k);if(tmpCurrentRun&&tmpCurrentRun.RunKey===tmpRunKey){tmpCurrentRun.Cell.ColumnSpan+=1;}else{tmpCurrentRun={RunKey:tmpRunKey,Cell:{Label:tmpIsDynamic?tmpGroupLabel:'',ColumnSpan:1,CSSClass:tmpIsDynamic?'pict-tabular-dynamic-header-group':'pict-tabular-static-header-spacer'}};tmpSynthRow.push(tmpCurrentRun.Cell);}}tmpExpanded.push(tmpSynthRow);}return tmpExpanded;}/**
|
|
6078
6170
|
* Compute per-row label metadata for a tabular group with RowLabels config.
|
|
6079
6171
|
*
|
|
6080
6172
|
* Walks the current RecordSetAddress array. For each row, resolves the
|
|
@@ -6181,6 +6273,163 @@ if(Array.isArray(tmpGroup.RowLabelMetadata)&&!isNaN(tmpRowKeyNum)&&tmpRowKeyNum>
|
|
|
6181
6273
|
* @param {Object} pView
|
|
6182
6274
|
* @param {Object} pGroup
|
|
6183
6275
|
*/_reapplyTabularSelectionHighlights(pView,pGroup){let tmpBehaviors=this.pict.providers.DynamicFormSolverBehaviors;if(!tmpBehaviors||!pView.sectionDefinition){return;}let tmpSectionHash=pView.sectionDefinition.Hash;if(pGroup._RowSelectionConfig&&pGroup._RowSelectionConfig.HighlightClass){let tmpRows=this._getTabularSelectionArray(pView,pGroup._RowSelectionConfig);for(let i=0;i<tmpRows.length;i++){tmpBehaviors.highlightTabularRow(tmpSectionHash,pGroup.Hash,i,tmpRows[i]?1:0,pGroup._RowSelectionConfig.HighlightClass);}}if(pGroup._ColumnSelectionConfig&&pGroup._ColumnSelectionConfig.HighlightClass){let tmpColumns=this._getTabularSelectionArray(pView,pGroup._ColumnSelectionConfig);for(let i=0;i<tmpColumns.length;i++){tmpBehaviors.highlightTabularColumn(tmpSectionHash,pGroup.Hash,i,tmpColumns[i]?1:0,pGroup._ColumnSelectionConfig.HighlightClass);}}}/**
|
|
6276
|
+
* Normalize a Group.ColumnChooser config value.
|
|
6277
|
+
*
|
|
6278
|
+
* Accepts `true` (use all defaults) or an object
|
|
6279
|
+
* `{ Enabled, DataAddress, ButtonLabel, DefaultHiddenColumns }`. Returns null
|
|
6280
|
+
* when the chooser is not enabled (the feature is strictly opt-in).
|
|
6281
|
+
*
|
|
6282
|
+
* - `DataAddress` — address (relative to the form's marshal destination) where
|
|
6283
|
+
* the array of hidden column hashes is stored, so it persists with the form data.
|
|
6284
|
+
* - `ButtonLabel` — text for the trigger button above the table.
|
|
6285
|
+
* - `DefaultHiddenColumns` — column hashes hidden until the user changes them
|
|
6286
|
+
* (merged with any descriptor-level `PictForm.TabularDefaultHidden` flags).
|
|
6287
|
+
*
|
|
6288
|
+
* @param {boolean|Object} pConfigValue
|
|
6289
|
+
* @param {string} pDefaultDataAddress
|
|
6290
|
+
* @returns {{DataAddress: string, ButtonLabel: string, DefaultHiddenColumns: Array<string>}|null}
|
|
6291
|
+
*/_normalizeColumnChooserConfig(pConfigValue,pDefaultDataAddress){if(pConfigValue!==true&&(typeof pConfigValue!=='object'||pConfigValue===null)){return null;}let tmpConfig=typeof pConfigValue==='object'?pConfigValue:{};if(tmpConfig.Enabled===false){return null;}return{DataAddress:typeof tmpConfig.DataAddress==='string'&&tmpConfig.DataAddress.length>0?tmpConfig.DataAddress:pDefaultDataAddress,ButtonLabel:typeof tmpConfig.ButtonLabel==='string'&&tmpConfig.ButtonLabel.length>0?tmpConfig.ButtonLabel:'Columns',DefaultHiddenColumns:Array.isArray(tmpConfig.DefaultHiddenColumns)?tmpConfig.DefaultHiddenColumns.map(pHash=>String(pHash)):[]};}/**
|
|
6292
|
+
* Lazily normalize (and cache on the group) the ColumnChooser config. The
|
|
6293
|
+
* template bake re-normalizes each pass; this accessor covers code paths
|
|
6294
|
+
* (marshal hooks, inline handlers) that may run against a group whose
|
|
6295
|
+
* template hasn't been baked yet.
|
|
6296
|
+
*
|
|
6297
|
+
* @param {Object} pGroup
|
|
6298
|
+
* @returns {{DataAddress: string, ButtonLabel: string, DefaultHiddenColumns: Array<string>}|null}
|
|
6299
|
+
*/_ensureTabularColumnChooserConfig(pGroup){if(pGroup._ColumnChooserConfig===undefined){pGroup._ColumnChooserConfig=this._normalizeColumnChooserConfig(pGroup.ColumnChooser,"".concat(pGroup.Hash,"_HiddenColumns"));}return pGroup._ColumnChooserConfig;}/**
|
|
6300
|
+
* The absolute address (within the form's marshal destination) of the
|
|
6301
|
+
* chooser's hidden-column-hash array.
|
|
6302
|
+
*
|
|
6303
|
+
* @param {Object} pView
|
|
6304
|
+
* @param {{DataAddress: string}} pChooserConfig
|
|
6305
|
+
* @returns {string}
|
|
6306
|
+
*/_getTabularHiddenColumnsAddress(pView,pChooserConfig){return"".concat(pView.getMarshalDestinationAddress(),".").concat(pChooserConfig.DataAddress);}/**
|
|
6307
|
+
* The set of column hashes hidden BY DEFAULT for a group: the chooser
|
|
6308
|
+
* config's DefaultHiddenColumns plus every descriptor flagged
|
|
6309
|
+
* `PictForm.TabularDefaultHidden`. These apply only until the user changes
|
|
6310
|
+
* column visibility (which writes an explicit array into the form data).
|
|
6311
|
+
*
|
|
6312
|
+
* @param {Object} pGroup
|
|
6313
|
+
* @returns {Array<string>}
|
|
6314
|
+
*/_getTabularColumnChooserDefaultHidden(pGroup){let tmpConfig=pGroup._ColumnChooserConfig;if(!tmpConfig){return[];}let tmpDefaultHidden={};for(let i=0;i<tmpConfig.DefaultHiddenColumns.length;i++){tmpDefaultHidden[tmpConfig.DefaultHiddenColumns[i]]=true;}if(pGroup.supportingManifest&&Array.isArray(pGroup.supportingManifest.elementAddresses)){for(let k=0;k<pGroup.supportingManifest.elementAddresses.length;k++){let tmpHash=pGroup.supportingManifest.elementAddresses[k];let tmpDescriptor=pGroup.supportingManifest.elementDescriptors[tmpHash];if(tmpDescriptor&&tmpDescriptor.PictForm&&!tmpDescriptor.PictForm.TabularHidden&&tmpDescriptor.PictForm.TabularDefaultHidden===true){tmpDefaultHidden[String(tmpHash)]=true;}}}return Object.keys(tmpDefaultHidden);}/**
|
|
6315
|
+
* The EFFECTIVE set of chooser-hidden column hashes for a group: the array
|
|
6316
|
+
* stored in the form data when the user has made choices, otherwise the
|
|
6317
|
+
* configured defaults. Returns null when the chooser is not enabled, so
|
|
6318
|
+
* callers can use a single falsy check to keep the legacy code path intact.
|
|
6319
|
+
*
|
|
6320
|
+
* @param {Object} pView
|
|
6321
|
+
* @param {Object} pGroup
|
|
6322
|
+
* @returns {Set<string>|null}
|
|
6323
|
+
*/_getTabularColumnChooserHiddenSet(pView,pGroup){let tmpConfig=this._ensureTabularColumnChooserConfig(pGroup);if(!tmpConfig){return null;}let tmpStored=this.pict.resolveStateFromAddress(this._getTabularHiddenColumnsAddress(pView,tmpConfig));let tmpHiddenList=Array.isArray(tmpStored)?tmpStored:this._getTabularColumnChooserDefaultHidden(pGroup);let tmpHiddenSet=new Set();for(let i=0;i<tmpHiddenList.length;i++){tmpHiddenSet.add(String(tmpHiddenList[i]));}return tmpHiddenSet;}/**
|
|
6324
|
+
* A canonical string for the group's effective hidden-column set, used to
|
|
6325
|
+
* detect (on marshal) that loaded form data carries different column
|
|
6326
|
+
* visibility than the table template was baked with.
|
|
6327
|
+
*
|
|
6328
|
+
* @param {Object} pView
|
|
6329
|
+
* @param {Object} pGroup
|
|
6330
|
+
* @returns {string}
|
|
6331
|
+
*/_getTabularColumnChooserStateKey(pView,pGroup){let tmpHiddenSet=this._getTabularColumnChooserHiddenSet(pView,pGroup);if(!tmpHiddenSet){return'';}return Array.from(tmpHiddenSet).sort().join('|');}/**
|
|
6332
|
+
* The columns the chooser can manage, in manifest order. Statically hidden
|
|
6333
|
+
* descriptors (`PictForm.TabularHidden`) are never choosable and never
|
|
6334
|
+
* listed. Each entry carries the descriptor's manifest index so inline
|
|
6335
|
+
* handlers can address it without string-escaping concerns.
|
|
6336
|
+
*
|
|
6337
|
+
* @param {Object} pView
|
|
6338
|
+
* @param {Object} pGroup
|
|
6339
|
+
* @returns {Array<{Key: string, Name: string, ColumnIndex: number, Visible: boolean}>}
|
|
6340
|
+
*/_getTabularChoosableColumns(pView,pGroup){let tmpColumns=[];if(!pGroup.supportingManifest||!Array.isArray(pGroup.supportingManifest.elementAddresses)){return tmpColumns;}let tmpHiddenSet=this._getTabularColumnChooserHiddenSet(pView,pGroup);for(let k=0;k<pGroup.supportingManifest.elementAddresses.length;k++){let tmpHash=String(pGroup.supportingManifest.elementAddresses[k]);let tmpDescriptor=pGroup.supportingManifest.elementDescriptors[tmpHash];if(!tmpDescriptor||tmpDescriptor.PictForm&&tmpDescriptor.PictForm.TabularHidden){continue;}tmpColumns.push({Key:tmpHash,Name:tmpDescriptor.Name!=null&&String(tmpDescriptor.Name).length>0?String(tmpDescriptor.Name):tmpHash,ColumnIndex:k,Visible:!(tmpHiddenSet&&tmpHiddenSet.has(tmpHash))});}return tmpColumns;}/**
|
|
6341
|
+
* DOM element id for one of the chooser's baked elements (TRIGGER / POPOVER),
|
|
6342
|
+
* namespaced by form and group so multiple tabular groups can each carry
|
|
6343
|
+
* their own chooser.
|
|
6344
|
+
*
|
|
6345
|
+
* @param {Object} pView
|
|
6346
|
+
* @param {Object} pGroup
|
|
6347
|
+
* @param {string} pElement
|
|
6348
|
+
* @returns {string}
|
|
6349
|
+
*/_getTabularColumnChooserElementId(pView,pGroup,pElement){return"PICTFORM-COLCHOOSER-".concat(pElement,"-").concat(pView.formID,"-").concat(pGroup.Hash);}/**
|
|
6350
|
+
* Builds the chooser bar baked above the table: a right-aligned trigger
|
|
6351
|
+
* button (with a "n hidden" hint when columns are hidden) plus the empty
|
|
6352
|
+
* popover container the open action renders into.
|
|
6353
|
+
*
|
|
6354
|
+
* @param {Object} pView
|
|
6355
|
+
* @param {Object} pGroup
|
|
6356
|
+
* @returns {string}
|
|
6357
|
+
*/_buildTabularColumnChooserBarHTML(pView,pGroup){let tmpColumns=this._getTabularChoosableColumns(pView,pGroup);let tmpHiddenCount=tmpColumns.filter(pColumn=>!pColumn.Visible).length;let tmpGlyph=typeof this.pict.icon==='function'?this.pict.icon('Settings'):'';let tmpCountHint=tmpHiddenCount>0?" <span class=\"pict-tabular-colchooser-count\">(".concat(tmpHiddenCount," hidden)</span>"):'';return"<div class=\"pict-tabular-colchooser-bar\">"+"<button type=\"button\" class=\"pict-tabular-colchooser-trigger\" id=\"".concat(this._getTabularColumnChooserElementId(pView,pGroup,'TRIGGER'),"\" ")+"title=\"Choose which columns to show\" "+"onclick=\"_Pict.providers['Pict-Layout-Tabular'].toggleTabularColumnChooser('".concat(pView.Hash,"', ").concat(pGroup.GroupIndex,")\">")+"".concat(tmpGlyph," ").concat(this._escapeHTML(pGroup._ColumnChooserConfig.ButtonLabel)).concat(tmpCountHint,"</button>")+"<div class=\"pict-tabular-colchooser-pop\" id=\"".concat(this._getTabularColumnChooserElementId(pView,pGroup,'POPOVER'),"\"></div>")+"</div>";}/**
|
|
6358
|
+
* Renders the chooser popover's content (backdrop + panel of checkbox rows +
|
|
6359
|
+
* reset footer) into its baked container. Runs on open and after each toggle
|
|
6360
|
+
* (the table re-render replaces the popover element, so its content must be
|
|
6361
|
+
* repainted to keep the menu open across toggles).
|
|
6362
|
+
*
|
|
6363
|
+
* @param {Object} pView
|
|
6364
|
+
* @param {Object} pGroup
|
|
6365
|
+
*/_renderTabularColumnChooserPopover(pView,pGroup){let tmpColumns=this._getTabularChoosableColumns(pView,pGroup);let tmpRowsHTML='';for(let i=0;i<tmpColumns.length;i++){let tmpColumn=tmpColumns[i];tmpRowsHTML+="<label class=\"pict-tabular-colchooser-row\">"+"<input type=\"checkbox\"".concat(tmpColumn.Visible?' checked="checked"':''," ")+"onchange=\"_Pict.providers['Pict-Layout-Tabular'].toggleTabularColumnVisibility('".concat(pView.Hash,"', ").concat(pGroup.GroupIndex,", ").concat(tmpColumn.ColumnIndex,", this.checked)\">")+"<span>".concat(this._escapeHTML(tmpColumn.Name),"</span>")+"</label>";}let tmpPopoverHTML="<div class=\"pict-tabular-colchooser-backdrop\" onclick=\"_Pict.providers['Pict-Layout-Tabular'].closeTabularColumnChooser('".concat(pView.Hash,"', ").concat(pGroup.GroupIndex,")\"></div>")+"<div class=\"pict-tabular-colchooser-panel\">"+"<div class=\"pict-tabular-colchooser-list\">".concat(tmpRowsHTML,"</div>")+"<div class=\"pict-tabular-colchooser-footer\">"+"<button type=\"button\" class=\"pict-tabular-colchooser-reset\" onclick=\"_Pict.providers['Pict-Layout-Tabular'].resetTabularColumnVisibility('".concat(pView.Hash,"', ").concat(pGroup.GroupIndex,")\">Reset to defaults</button>")+"</div>"+"</div>";this.pict.ContentAssignment.assignContent("#".concat(this._getTabularColumnChooserElementId(pView,pGroup,'POPOVER')),tmpPopoverHTML);}/**
|
|
6366
|
+
* Reflect the chooser popover's open/closed state on its container element,
|
|
6367
|
+
* positioning it against the trigger when opening.
|
|
6368
|
+
*
|
|
6369
|
+
* @param {Object} pView
|
|
6370
|
+
* @param {Object} pGroup
|
|
6371
|
+
* @param {boolean} pOpen
|
|
6372
|
+
*/_paintTabularColumnChooserOpenState(pView,pGroup,pOpen){let tmpPopoverElements=this.pict.ContentAssignment.getElement("#".concat(this._getTabularColumnChooserElementId(pView,pGroup,'POPOVER')));if(!tmpPopoverElements.length){return;}tmpPopoverElements[0].classList.toggle('open',!!pOpen);if(pOpen){this._positionTabularColumnChooserPopover(pView,pGroup,tmpPopoverElements[0]);}}/**
|
|
6373
|
+
* Position the (fixed) chooser popover against its trigger button, flipping
|
|
6374
|
+
* above when the room below is genuinely cramped — same approach as the
|
|
6375
|
+
* recordset's column chooser, so no ancestor overflow can clip it.
|
|
6376
|
+
*
|
|
6377
|
+
* @param {Object} pView
|
|
6378
|
+
* @param {Object} pGroup
|
|
6379
|
+
* @param {HTMLElement} pPopover
|
|
6380
|
+
*/_positionTabularColumnChooserPopover(pView,pGroup,pPopover){let tmpTriggerElements=this.pict.ContentAssignment.getElement("#".concat(this._getTabularColumnChooserElementId(pView,pGroup,'TRIGGER')));if(!tmpTriggerElements.length||typeof window==='undefined'){return;}let tmpPanel=pPopover.querySelector('.pict-tabular-colchooser-panel');let tmpRect=tmpTriggerElements[0].getBoundingClientRect();let tmpGap=6;let tmpMargin=8;let tmpViewportHeight=window.innerHeight;let tmpViewportWidth=window.innerWidth;let tmpWidth=pPopover.offsetWidth||240;// Right-align the popover to the (right-aligned) trigger, clamped into the viewport.
|
|
6381
|
+
pPopover.style.left="".concat(Math.round(Math.max(tmpMargin,Math.min(tmpRect.right-tmpWidth,tmpViewportWidth-tmpWidth-tmpMargin))),"px");pPopover.style.right='auto';let tmpSpaceBelow=tmpViewportHeight-tmpRect.bottom-tmpGap-tmpMargin;let tmpSpaceAbove=tmpRect.top-tmpGap-tmpMargin;if(tmpSpaceBelow>=220||tmpSpaceBelow>=tmpSpaceAbove){pPopover.style.top="".concat(Math.round(tmpRect.bottom+tmpGap),"px");pPopover.style.bottom='auto';if(tmpPanel){tmpPanel.style.maxHeight="".concat(Math.max(160,Math.min(tmpSpaceBelow,420)),"px");}}else{pPopover.style.top='auto';pPopover.style.bottom="".concat(Math.round(tmpViewportHeight-tmpRect.top+tmpGap),"px");if(tmpPanel){tmpPanel.style.maxHeight="".concat(Math.max(160,Math.min(tmpSpaceAbove,420)),"px");}}}/**
|
|
6382
|
+
* Rebuild + re-render a tabular view and re-marshal the form data into it.
|
|
6383
|
+
* Same tail as sortTabularColumn: the rebuild re-bakes the table template
|
|
6384
|
+
* (column set, headers, chooser bar), the render repaints, the marshal
|
|
6385
|
+
* pushes current values back into the freshly built inputs.
|
|
6386
|
+
*
|
|
6387
|
+
* @param {Object} pView
|
|
6388
|
+
*/_rebuildTabularGroupView(pView){pView.rebuildCustomTemplate();pView.render();if(this.pict.views.PictFormMetacontroller){this.pict.views.PictFormMetacontroller.marshalFormSections();}else{pView.marshalToView();}}/**
|
|
6389
|
+
* Inline-handler entry point: opens/closes a group's column chooser popover
|
|
6390
|
+
* (the trigger button's handler). Open/closed is derived from the popover's
|
|
6391
|
+
* DOM class, not an instance flag — a re-render replaces the popover element
|
|
6392
|
+
* (visually closed), so a flag would go stale and demand a double-click.
|
|
6393
|
+
*
|
|
6394
|
+
* @param {string} pViewHash
|
|
6395
|
+
* @param {number|string} pGroupIndex
|
|
6396
|
+
* @returns {boolean}
|
|
6397
|
+
*/toggleTabularColumnChooser(pViewHash,pGroupIndex){let tmpView=this.pict.views[pViewHash];if(!tmpView||!tmpView.sectionDefinition||!Array.isArray(tmpView.sectionDefinition.Groups)){return false;}let tmpGroup=tmpView.sectionDefinition.Groups[Number(pGroupIndex)];if(!tmpGroup||!this._ensureTabularColumnChooserConfig(tmpGroup)){return false;}let tmpPopoverElements=this.pict.ContentAssignment.getElement("#".concat(this._getTabularColumnChooserElementId(tmpView,tmpGroup,'POPOVER')));if(tmpPopoverElements.length&&tmpPopoverElements[0].classList.contains('open')){this._paintTabularColumnChooserOpenState(tmpView,tmpGroup,false);return true;}this._renderTabularColumnChooserPopover(tmpView,tmpGroup);this._paintTabularColumnChooserOpenState(tmpView,tmpGroup,true);return true;}/**
|
|
6398
|
+
* Inline-handler entry point: closes a group's column chooser popover (the
|
|
6399
|
+
* backdrop's handler).
|
|
6400
|
+
*
|
|
6401
|
+
* @param {string} pViewHash
|
|
6402
|
+
* @param {number|string} pGroupIndex
|
|
6403
|
+
* @returns {boolean}
|
|
6404
|
+
*/closeTabularColumnChooser(pViewHash,pGroupIndex){let tmpView=this.pict.views[pViewHash];if(!tmpView||!tmpView.sectionDefinition||!Array.isArray(tmpView.sectionDefinition.Groups)){return false;}let tmpGroup=tmpView.sectionDefinition.Groups[Number(pGroupIndex)];if(!tmpGroup){return false;}this._paintTabularColumnChooserOpenState(tmpView,tmpGroup,false);return true;}/**
|
|
6405
|
+
* Inline-handler entry point: shows/hides one column (a chooser checkbox's
|
|
6406
|
+
* handler). Writes the updated hidden-hash array into the form data (so it
|
|
6407
|
+
* persists with a save), rebuilds the table template without the column,
|
|
6408
|
+
* re-renders, re-marshals, then re-opens the popover the re-render closed.
|
|
6409
|
+
*
|
|
6410
|
+
* Hiding never touches the underlying record data — the column's values
|
|
6411
|
+
* stay in the record set and reappear when the column is shown again.
|
|
6412
|
+
*
|
|
6413
|
+
* Refuses to hide the last visible column (the checkbox snaps back).
|
|
6414
|
+
*
|
|
6415
|
+
* @param {string} pViewHash
|
|
6416
|
+
* @param {number|string} pGroupIndex
|
|
6417
|
+
* @param {number|string} pColumnIndex - The column's manifest index (stable within a bake).
|
|
6418
|
+
* @param {boolean} pVisible - true to show the column, false to hide it.
|
|
6419
|
+
* @returns {boolean}
|
|
6420
|
+
*/toggleTabularColumnVisibility(pViewHash,pGroupIndex,pColumnIndex,pVisible){let tmpView=this.pict.views[pViewHash];if(!tmpView||!tmpView.sectionDefinition||!Array.isArray(tmpView.sectionDefinition.Groups)){return false;}let tmpGroup=tmpView.sectionDefinition.Groups[Number(pGroupIndex)];if(!tmpGroup){return false;}let tmpConfig=this._ensureTabularColumnChooserConfig(tmpGroup);if(!tmpConfig){return false;}let tmpColumns=this._getTabularChoosableColumns(tmpView,tmpGroup);let tmpColumn=tmpColumns.find(pCandidate=>pCandidate.ColumnIndex===Number(pColumnIndex));if(!tmpColumn){return false;}let tmpHiddenSet=this._getTabularColumnChooserHiddenSet(tmpView,tmpGroup);if(pVisible){tmpHiddenSet.delete(tmpColumn.Key);}else{let tmpVisibleCount=tmpColumns.filter(pCandidate=>pCandidate.Visible).length;if(tmpVisibleCount<=1&&tmpColumn.Visible){this.log.warn("PICT Form Tabular column chooser on group [".concat(tmpGroup.Hash,"] refused to hide the last visible column [").concat(tmpColumn.Key,"]."));// Repaint the popover so the refused checkbox snaps back to checked.
|
|
6421
|
+
this._renderTabularColumnChooserPopover(tmpView,tmpGroup);this._paintTabularColumnChooserOpenState(tmpView,tmpGroup,true);return false;}tmpHiddenSet.add(tmpColumn.Key);}this.pict.setStateValueAtAddress(this._getTabularHiddenColumnsAddress(tmpView,tmpConfig),null,Array.from(tmpHiddenSet));this._rebuildTabularGroupView(tmpView);// The re-render replaced the popover element (closed); keep the menu open
|
|
6422
|
+
// so the user can toggle several columns in one visit.
|
|
6423
|
+
this._renderTabularColumnChooserPopover(tmpView,tmpGroup);this._paintTabularColumnChooserOpenState(tmpView,tmpGroup,true);return true;}/**
|
|
6424
|
+
* Inline-handler entry point: resets a group's column visibility to its
|
|
6425
|
+
* configured defaults (the reset footer button's handler). Writes the
|
|
6426
|
+
* default hidden set into the form data explicitly — the user interacted,
|
|
6427
|
+
* so the state should serialize deterministically with a save.
|
|
6428
|
+
*
|
|
6429
|
+
* @param {string} pViewHash
|
|
6430
|
+
* @param {number|string} pGroupIndex
|
|
6431
|
+
* @returns {boolean}
|
|
6432
|
+
*/resetTabularColumnVisibility(pViewHash,pGroupIndex){let tmpView=this.pict.views[pViewHash];if(!tmpView||!tmpView.sectionDefinition||!Array.isArray(tmpView.sectionDefinition.Groups)){return false;}let tmpGroup=tmpView.sectionDefinition.Groups[Number(pGroupIndex)];if(!tmpGroup){return false;}let tmpConfig=this._ensureTabularColumnChooserConfig(tmpGroup);if(!tmpConfig){return false;}this.pict.setStateValueAtAddress(this._getTabularHiddenColumnsAddress(tmpView,tmpConfig),null,this._getTabularColumnChooserDefaultHidden(tmpGroup));this._rebuildTabularGroupView(tmpView);this._renderTabularColumnChooserPopover(tmpView,tmpGroup);this._paintTabularColumnChooserOpenState(tmpView,tmpGroup,true);return true;}/**
|
|
6184
6433
|
* Generate a group layout template for a single-record dynamically generated group view.
|
|
6185
6434
|
*
|
|
6186
6435
|
* This is the standard name / field entry form that you're used to filling out for addresses
|
|
@@ -6193,7 +6442,12 @@ if(Array.isArray(tmpGroup.RowLabelMetadata)&&!isNaN(tmpRowKeyNum)&&tmpRowKeyNum>
|
|
|
6193
6442
|
// In this case we are going to load the descriptors from the supportingManifests
|
|
6194
6443
|
if(!pGroup.supportingManifest){this.log.error("PICT Form [".concat(pView.UUID,"]::[").concat(pView.Hash,"] error generating tabular metatemplate: missing group manifest ").concat(pGroup.RecordManifest," from supportingManifests."));return'';}let tmpMetatemplateGenerator=this.pict.providers.MetatemplateGenerator;let tmpTemplate='';let tmpTemplateSetRecordRowTemplate='';// Read new optional configuration.
|
|
6195
6444
|
let tmpEditingControlsPosition=typeof pGroup.EditingControlsPosition==='string'?pGroup.EditingControlsPosition:'right';let tmpRowLabels=Array.isArray(pGroup.RowLabels)?pGroup.RowLabels:[];let tmpSuppressDefaultColumnHeaderRow=pGroup.SuppressDefaultColumnHeaderRow===true;// ColumnSorting (off by default): injects a clickable sort-glyph span into every prime header cell.
|
|
6196
|
-
let tmpColumnSortingEnabled=pGroup.ColumnSorting===true;if(tmpColumnSortingEnabled&&!pGroup._SortState){pGroup._SortState={ColumnIndex:-1,Direction:'none'};}
|
|
6445
|
+
let tmpColumnSortingEnabled=pGroup.ColumnSorting===true;if(tmpColumnSortingEnabled&&!pGroup._SortState){pGroup._SortState={ColumnIndex:-1,Direction:'none'};}// ColumnChooser (off by default): a menu of checkboxes above the table that
|
|
6446
|
+
// shows/hides columns, with the hidden set stored in the form data. Normalized
|
|
6447
|
+
// BEFORE the headers expand so chooser-hidden columns adjust header spans.
|
|
6448
|
+
pGroup._ColumnChooserConfig=this._normalizeColumnChooserConfig(pGroup.ColumnChooser,"".concat(pGroup.Hash,"_HiddenColumns"));let tmpChooserHiddenSet=this._getTabularColumnChooserHiddenSet(pView,pGroup);// Remember what visibility this bake used, so a marshal carrying different
|
|
6449
|
+
// (e.g. freshly loaded) state knows to trigger a rebuild.
|
|
6450
|
+
pGroup._ColumnChooserBakedStateKey=tmpChooserHiddenSet?Array.from(tmpChooserHiddenSet).sort().join('|'):'';let tmpExpandedHeaders=this._buildExpandedHeadersConfig(pView,pGroup);// Stash the structures referenced by the templates below.
|
|
6197
6451
|
pGroup.ExpandedHeaders=tmpExpandedHeaders;pGroup.RowLabelHeaderCells=tmpRowLabels.map(pLabel=>({Name:pLabel.Name||'',CSSClass:typeof pLabel.CSSClass==='string'?pLabel.CSSClass:''}));// Selectable rows / columns. When enabled, a checkbox column / header row is
|
|
6198
6452
|
// rendered and the boolean selection state is stored in the form data so it
|
|
6199
6453
|
// persists with a save. Solvers can read that state; selection optionally
|
|
@@ -6203,19 +6457,24 @@ let tmpLeadingColumnCount=(tmpRowSelectionEnabled?1:0)+tmpRowLabels.length+(tmpE
|
|
|
6203
6457
|
// extra-postfix slots by registering empty view-specific overrides. This keeps the
|
|
6204
6458
|
// existing template machinery intact for backwards compatibility -- consumers that
|
|
6205
6459
|
// don't opt in to the new behavior see identical output.
|
|
6206
|
-
if(tmpEditingControlsPosition==='left'||tmpEditingControlsPosition==='hidden'){this.pict.TemplateProvider.addTemplate(pView.getViewSpecificTemplateHash('-TabularTemplate-Row-ExtraPostfix'),'');this.pict.TemplateProvider.addTemplate(pView.getViewSpecificTemplateHash('-TabularTemplate-RowHeader-ExtraPostfix'),'');}
|
|
6460
|
+
if(tmpEditingControlsPosition==='left'||tmpEditingControlsPosition==='hidden'){this.pict.TemplateProvider.addTemplate(pView.getViewSpecificTemplateHash('-TabularTemplate-Row-ExtraPostfix'),'');this.pict.TemplateProvider.addTemplate(pView.getViewSpecificTemplateHash('-TabularTemplate-RowHeader-ExtraPostfix'),'');}// The chooser bar sits ABOVE the group's table container (a div can't live
|
|
6461
|
+
// inside <table> without the browser foster-parenting it out anyway).
|
|
6462
|
+
if(pGroup._ColumnChooserConfig){tmpTemplate+=this._buildTabularColumnChooserBarHTML(pView,pGroup);}tmpTemplate+=tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView,"-TabularTemplate-Group-Prefix","getGroup(\"".concat(pGroup.GroupIndex,"\")"));// Header section
|
|
6207
6463
|
tmpTemplate+=tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView,"-TabularTemplate-RowHeader-Prefix","getGroup(\"".concat(pGroup.GroupIndex,"\")"));// Emit additional header rows (above the default column-name row).
|
|
6208
6464
|
// Each row gets its own <tr>; leading non-data columns get blank <th>s
|
|
6209
6465
|
// prepended (and a trailing one for right-side editing controls) for alignment.
|
|
6210
6466
|
for(let r=0;r<tmpExpandedHeaders.length;r++){let tmpHeaderRow=tmpExpandedHeaders[r];tmpTemplate+=tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView,"-TabularTemplate-ExtraHeaderRow-Prefix","getGroup(\"".concat(pGroup.GroupIndex,"\")"));for(let l=0;l<tmpLeadingColumnCount;l++){tmpTemplate+="<th class=\"pict-row-label-spacer\"></th>";}for(let c=0;c<tmpHeaderRow.length;c++){let tmpCellAddress="getGroup(\"".concat(pGroup.GroupIndex,"\").ExpandedHeaders.").concat(r,".").concat(c);tmpTemplate+=tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView,"-TabularTemplate-ExtraHeaderCell",tmpCellAddress);}if(tmpEditingRight){tmpTemplate+="<th class=\"pict-row-label-spacer\"></th>";}tmpTemplate+=tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView,"-TabularTemplate-ExtraHeaderRow-Postfix","getGroup(\"".concat(pGroup.GroupIndex,"\")"));}// Column-selection header row -- a <tr> of checkboxes, one per visible data
|
|
6211
6467
|
// column, plus leading/trailing spacers to line up with the data columns.
|
|
6212
|
-
if(tmpColumnSelectionEnabled){let tmpColumnSelectionState=this._getTabularSelectionArray(pView,pGroup._ColumnSelectionConfig);let tmpColumnSelectRow="<tr class=\"pict-tabular-column-select-row\">";for(let l=0;l<tmpLeadingColumnCount;l++){tmpColumnSelectRow+="<th class=\"pict-row-label-spacer\"></th>";}for(let k=0;k<pGroup.supportingManifest.elementAddresses.length;k++){let tmpColumnDescriptor=pGroup.supportingManifest.elementDescriptors[pGroup.supportingManifest.elementAddresses[k]];if(!tmpColumnDescriptor||tmpColumnDescriptor.PictForm&&tmpColumnDescriptor.PictForm.TabularHidden){continue;}let tmpColumnCheckedAttr=tmpColumnSelectionState[k]?' checked="checked"':'';tmpColumnSelectRow+="<th class=\"pict-tabular-column-select\">"+"<input type=\"checkbox\"".concat(tmpColumnCheckedAttr," onchange=\"_Pict.providers['Pict-Layout-Tabular'].toggleTabularColumnSelection('").concat(pView.Hash,"', ").concat(pGroup.GroupIndex,", ").concat(k,", this.checked)\">")+"</th>";}if(tmpEditingRight){tmpColumnSelectRow+="<th class=\"pict-row-label-spacer\"></th>";}tmpColumnSelectRow+="</tr>";tmpTemplate+=tmpColumnSelectRow;}// Existing ExtraPrefix slot (preserved for host overrides)
|
|
6468
|
+
if(tmpColumnSelectionEnabled){let tmpColumnSelectionState=this._getTabularSelectionArray(pView,pGroup._ColumnSelectionConfig);let tmpColumnSelectRow="<tr class=\"pict-tabular-column-select-row\">";for(let l=0;l<tmpLeadingColumnCount;l++){tmpColumnSelectRow+="<th class=\"pict-row-label-spacer\"></th>";}for(let k=0;k<pGroup.supportingManifest.elementAddresses.length;k++){let tmpColumnDescriptor=pGroup.supportingManifest.elementDescriptors[pGroup.supportingManifest.elementAddresses[k]];if(!tmpColumnDescriptor||tmpColumnDescriptor.PictForm&&tmpColumnDescriptor.PictForm.TabularHidden){continue;}if(tmpChooserHiddenSet&&tmpChooserHiddenSet.has(String(pGroup.supportingManifest.elementAddresses[k]))){continue;}let tmpColumnCheckedAttr=tmpColumnSelectionState[k]?' checked="checked"':'';tmpColumnSelectRow+="<th class=\"pict-tabular-column-select\">"+"<input type=\"checkbox\"".concat(tmpColumnCheckedAttr," onchange=\"_Pict.providers['Pict-Layout-Tabular'].toggleTabularColumnSelection('").concat(pView.Hash,"', ").concat(pGroup.GroupIndex,", ").concat(k,", this.checked)\">")+"</th>";}if(tmpEditingRight){tmpColumnSelectRow+="<th class=\"pict-row-label-spacer\"></th>";}tmpColumnSelectRow+="</tr>";tmpTemplate+=tmpColumnSelectRow;}// Existing ExtraPrefix slot (preserved for host overrides)
|
|
6213
6469
|
tmpTemplate+=tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView,"-TabularTemplate-RowHeader-ExtraPrefix","getGroup(\"".concat(pGroup.GroupIndex,"\")"));// Row-selection header cell.
|
|
6214
6470
|
if(tmpRowSelectionEnabled){tmpTemplate+="<th class=\"pict-row-label-header pict-tabular-row-select-header\">".concat(this._escapeHTML(pGroup._RowSelectionConfig.HeaderLabel),"</th>");}// Row label header cells in the default header row.
|
|
6215
6471
|
for(let l=0;l<tmpRowLabels.length;l++){let tmpLabelHeaderAddress="getGroup(\"".concat(pGroup.GroupIndex,"\").RowLabelHeaderCells.").concat(l);tmpTemplate+=tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView,"-TabularTemplate-RowLabel-HeaderCell",tmpLabelHeaderAddress);}// Header cell matching the left-side editing controls column, if configured.
|
|
6216
6472
|
if(tmpEditingLeft){tmpTemplate+="<th class=\"pict-row-label-header pict-tabular-editing-controls-header\"></th>";}// Per-descriptor header cells + the per-descriptor row body template.
|
|
6217
6473
|
let tmpDataColumnCount=0;for(let k=0;k<pGroup.supportingManifest.elementAddresses.length;k++){let tmpSupportingManifestHash=pGroup.supportingManifest.elementAddresses[k];let tmpInput=pGroup.supportingManifest.elementDescriptors[tmpSupportingManifestHash];// Update the InputIndex to match the current render config
|
|
6218
|
-
if(!('PictForm'in tmpInput)){tmpInput.PictForm={};}if(tmpInput.PictForm.TabularHidden){continue;}
|
|
6474
|
+
if(!('PictForm'in tmpInput)){tmpInput.PictForm={};}if(tmpInput.PictForm.TabularHidden){continue;}// Chooser-hidden columns are skipped at bake time (neither header nor row
|
|
6475
|
+
// cells render) but their record data is never touched — showing the
|
|
6476
|
+
// column again restores it intact, same invariant as DynamicColumns.
|
|
6477
|
+
if(tmpChooserHiddenSet&&tmpChooserHiddenSet.has(String(tmpSupportingManifestHash))){continue;}tmpInput.PictForm.InputIndex=k;tmpInput.PictForm.GroupIndex=pGroup.GroupIndex;tmpInput.PictForm.RowIndex=0;if(!tmpSuppressDefaultColumnHeaderRow){if(tmpColumnSortingEnabled){tmpTemplate+=this._buildSortableHeaderCell(pView,pGroup,tmpInput,k);}else{tmpTemplate+=tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView,"-TabularTemplate-HeaderCell","getTabularRecordInput(\"".concat(pGroup.GroupIndex,"\",\"").concat(k,"\")"));}}tmpTemplateSetRecordRowTemplate+=tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView,"-TabularTemplate-Cell-Prefix","getTabularRecordInput(\"".concat(pGroup.GroupIndex,"\",\"").concat(k,"\")"));let tmpInputType='PictForm'in tmpInput&&tmpInput.PictForm.InputType?tmpInput.PictForm.InputType:'Default';tmpTemplateSetRecordRowTemplate+=tmpMetatemplateGenerator.getTabularInputMetatemplateTemplateReference(pView,tmpInput.DataType,tmpInputType,"getTabularRecordInput(\"".concat(pGroup.GroupIndex,"\",\"").concat(k,"\")"),pGroup.GroupIndex,k);tmpTemplateSetRecordRowTemplate+=tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView,"-TabularTemplate-Cell-Postfix","getTabularRecordInput(\"".concat(pGroup.GroupIndex,"\",\"").concat(k,"\")"));tmpDataColumnCount++;}tmpTemplate+=tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView,"-TabularTemplate-RowHeader-ExtraPostfix","getGroup(\"".concat(pGroup.GroupIndex,"\")"));tmpTemplate+=tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView,"-TabularTemplate-RowHeader-Postfix","getGroup(\"".concat(pGroup.GroupIndex,"\")"));// Warn on header alignment mismatches (data-column count must equal each extra-header
|
|
6219
6478
|
// row's total ColumnSpan).
|
|
6220
6479
|
for(let r=0;r<tmpExpandedHeaders.length;r++){let tmpSpanTotal=0;for(let c=0;c<tmpExpandedHeaders[r].length;c++){tmpSpanTotal+=tmpExpandedHeaders[r][c].ColumnSpan||1;}if(tmpSpanTotal!==tmpDataColumnCount){this.log.warn("PICT Form [".concat(pView.UUID,"]::[").concat(pView.Hash,"] tabular group [").concat(pGroup.Hash,"] header row ").concat(r," total ColumnSpan (").concat(tmpSpanTotal,") does not match data column count (").concat(tmpDataColumnCount,"). Header will visually misalign."));}}// Compute initial row label metadata; recomputed on every marshal in onDataMarshalToForm.
|
|
6221
6480
|
this._computeRowLabelMetadata(pView,pGroup);// This is the template by which the tabular template includes the rows.
|
|
@@ -6254,7 +6513,12 @@ this.pict.TemplateProvider.addTemplate(pGroup.SectionTabularRowVirtualTemplateHa
|
|
|
6254
6513
|
* @returns {boolean}
|
|
6255
6514
|
*/onDataMarshalToForm(pView,pGroup){if(!pGroup){return true;}// Avoid recursion when this hook itself triggers a render -> marshal cycle.
|
|
6256
6515
|
if(pGroup._RebuildInProgress){return true;}let tmpHasDynamicColumns=Array.isArray(pGroup.DynamicColumns)&&pGroup.DynamicColumns.length>0;if(tmpHasDynamicColumns&&this.fable.ManifestFactory&&typeof this.fable.ManifestFactory._resolveDynamicColumns==='function'){let tmpResult=this.fable.ManifestFactory._resolveDynamicColumns(pView,pGroup);if(tmpResult&&tmpResult.changed){pGroup._RebuildInProgress=true;try{pView.rebuildCustomTemplate();pView.render();}finally{pGroup._RebuildInProgress=false;}// The re-render rebuilt the table DOM -- restore selection highlights.
|
|
6257
|
-
this._reapplyTabularSelectionHighlights(pView,pGroup);return true;}}
|
|
6516
|
+
this._reapplyTabularSelectionHighlights(pView,pGroup);return true;}}// When the chooser's effective hidden-column set differs from the one the
|
|
6517
|
+
// current table template was baked with (e.g. the host just loaded saved
|
|
6518
|
+
// form data carrying a <GroupHash>_HiddenColumns array), rebuild so the
|
|
6519
|
+
// table reflects the loaded visibility. Steady state is a no-op — the
|
|
6520
|
+
// bake stamped _ColumnChooserBakedStateKey from the same form data.
|
|
6521
|
+
if(this._ensureTabularColumnChooserConfig(pGroup)){let tmpCurrentStateKey=this._getTabularColumnChooserStateKey(pView,pGroup);if(tmpCurrentStateKey!==pGroup._ColumnChooserBakedStateKey){pGroup._RebuildInProgress=true;try{pView.rebuildCustomTemplate();pView.render();}finally{pGroup._RebuildInProgress=false;}this._reapplyTabularSelectionHighlights(pView,pGroup);return true;}}this._computeRowLabelMetadata(pView,pGroup);// Keep selection highlights in sync with the (possibly reloaded) selection data.
|
|
6258
6522
|
this._reapplyTabularSelectionHighlights(pView,pGroup);return true;}}module.exports=TabularLayout;},{"../Pict-Provider-DynamicLayout.js":46}],84:[function(require,module,exports){const libPictSectionGroupLayout=require('../Pict-Provider-DynamicLayout.js');const libPictSectionTuiGridLayout=require('./Pict-Layout-TuiGrid/Pict-Section-TuiGrid.js');class TuiGridLayout extends libPictSectionGroupLayout{/**
|
|
6259
6523
|
* @param {import('pict')} pFable - The Fable instance.
|
|
6260
6524
|
* @param {any} [pOptions={}] - The options for the TuiGrid layout.
|
|
@@ -7622,6 +7886,23 @@ this.pict.ContentAssignment.appendContent("#Pict-".concat(this.UUID,"-FormContai
|
|
|
7622
7886
|
tmpSectionDefinition.Name=tmpSectionDefinition.Hash;}if(!('Description'in tmpSectionDefinition)){// If there isn't a description, use the name
|
|
7623
7887
|
tmpSectionDefinition.Description="PICT Section [".concat(tmpSectionDefinition.Name,"].");}if(!('Groups'in tmpSectionDefinition)){// If there isn't a groups array, create an empty one
|
|
7624
7888
|
tmpSectionDefinition.Groups=[];}return tmpSectionDefinition;}catch(pError){this.log.error("getSectionDefinition() failed to parse the section object with error: ".concat(pError.message||pError));return false;}}getSectionViewFromHash(pSectionHash){let tmpSectionHash=typeof pSectionHash==='string'?pSectionHash:false;if(!tmpSectionHash){this.log.error('getSectionViewFromHash() called without a valid section hash.');return false;}let tmpViewHash="PictSectionForm-".concat(tmpSectionHash);if(tmpViewHash in this.fable.views){return this.fable.views[tmpViewHash];}this.log.error("getSectionViewFromHash() could not find a view for section hash [".concat(tmpSectionHash,"]."));return false;}/**
|
|
7889
|
+
* Marshal one or more section views' data to the DOM.
|
|
7890
|
+
*
|
|
7891
|
+
* For values written outside the normal solve -> marshal cycle (e.g. a trigger group's `PostSolvers`
|
|
7892
|
+
* running in an EntityBundleRequest transaction-complete callback). The global equivalent is
|
|
7893
|
+
* `marshalToView()`; this is the section-scoped, cheaper option.
|
|
7894
|
+
*
|
|
7895
|
+
* @param {string|string[]} pSectionHashes - a section hash, or an array of section hashes
|
|
7896
|
+
* @returns {void}
|
|
7897
|
+
*/marshalSectionToView(pSectionHashes){const tmpSectionHashes=(Array.isArray(pSectionHashes)?pSectionHashes:[pSectionHashes]).filter(pHash=>typeof pHash==='string'&&pHash.length>0);for(const tmpSectionHash of tmpSectionHashes){const tmpSectionView=this.getSectionViewFromHash(tmpSectionHash);if(tmpSectionView){tmpSectionView.marshalToView();}}}/**
|
|
7898
|
+
* Marshal one or more inputs' data to the DOM, wherever they live (finds the owning section view).
|
|
7899
|
+
*
|
|
7900
|
+
* The single-input equivalent of {@link marshalSectionToView}; use it when only specific fields
|
|
7901
|
+
* changed (e.g. a trigger group that computed one read-only attribute).
|
|
7902
|
+
*
|
|
7903
|
+
* @param {string|string[]} pInputHashes - an input hash, or an array of input hashes
|
|
7904
|
+
* @returns {void}
|
|
7905
|
+
*/marshalInputToView(pInputHashes){const tmpInputHashes=(Array.isArray(pInputHashes)?pInputHashes:[pInputHashes]).filter(pHash=>typeof pHash==='string'&&pHash.length>0);if(tmpInputHashes.length<1){return;}const tmpSectionViews=this.filterViews();for(const tmpInputHash of tmpInputHashes){for(let i=0;i<tmpSectionViews.length;i++){const tmpSectionView=tmpSectionViews[i];if(tmpSectionView===this||typeof tmpSectionView.getInputFromHash!=='function'){continue;}const tmpInput=tmpSectionView.getInputFromHash(tmpInputHash);if(tmpInput){tmpSectionView.manualMarshalDataToViewByInput(tmpInput);break;}}}}/**
|
|
7625
7906
|
* Clears out the manifest description set on the meta controller.
|
|
7626
7907
|
*/clearManifestDescription(){this.manifestDescription=null;}/**
|
|
7627
7908
|
* Bootstraps Pict DynamicForm views from a Manyfest description JSON object.
|