pict-section-form
Advanced tools
Comparing version 1.0.10 to 1.0.12
@@ -25,3 +25,4 @@ const libPictSectionForm = require('../../../source/Pict-Section-Form.js'); | ||
"DefaultFormManifest": require(`./manifests/Gradebook-Manifest.js`) | ||
"DefaultFormManifest": require(`./manifests/Gradebook-Manifest.js`), | ||
"ConfigurationOnlyViews": require(`./views/BasicContent-View-Templates.json`) | ||
}); |
{ | ||
"Scope": "Assignment", | ||
"Descriptors": | ||
{ | ||
"Title": | ||
{ | ||
"Name": "Assignment Title", | ||
"Hash": "Title", | ||
"DataType": "String", | ||
"Default": "(unnamed assignment)", | ||
"PictForm": { "Section": "AssignmentGrid", "Group":"AssignmentGrid" } | ||
}, | ||
"Weight": | ||
{ | ||
"Name": "Weight", | ||
"Hash": "AssignmentWeight", | ||
"DataType": "String", | ||
"Default": "1.0", | ||
"PictForm": { "Section": "AssignmentGrid", "Group":"AssignmentGrid" } | ||
}, | ||
"Points": | ||
{ | ||
"Name": "Points", | ||
"Hash": "AssignmentPoints", | ||
"DataType": "String", | ||
"Default": "100", | ||
"PictForm": { "Section": "AssignmentGrid", "Group":"AssignmentGrid" } | ||
}, | ||
"EffectiveWeight": | ||
{ | ||
"Name": "Effective Weight", | ||
"Hash": "ClassWeight", | ||
"DataType": "String", | ||
"PictForm": { "Section": "AssignmentGrid", "Group":"AssignmentGrid" } | ||
} | ||
} | ||
} |
@@ -8,7 +8,7 @@ module.exports = ( | ||
"Hash": "ClassManagement", | ||
"Name": "Class", | ||
"Name": "My Classroom", | ||
"Groups": [ | ||
{ | ||
"Hash": "StudentList", | ||
"Name": "My Classroom", | ||
"Name": "Student List", | ||
@@ -18,2 +18,10 @@ "Layout": "Tabular", | ||
"RecordManifest": "Student" | ||
}, | ||
{ | ||
"Hash": "AssignmentList", | ||
"Name": "Assignment List", | ||
"Layout": "Tabular", | ||
"RecordSetAddress": "AssignmentList", | ||
"RecordManifest": "Assignment" | ||
} | ||
@@ -26,3 +34,3 @@ ] | ||
{ | ||
"Students": | ||
"StudentList": | ||
{ | ||
@@ -34,3 +42,12 @@ "Name": "Student Roster", | ||
, "PictForm": { "Section":"ClassManagement", "Group":"StudentList" } | ||
}, | ||
"AssignmentList": | ||
{ | ||
"Name": "Curriculum", | ||
"Hash": "StudentData", | ||
"DataType": "Array", | ||
"Default": [] | ||
, "PictForm": { "Section":"ClassManagement", "Group":"AssignmentList" } | ||
} | ||
}, | ||
@@ -37,0 +54,0 @@ |
{ | ||
"Scope": "Student", | ||
"Descriptors": | ||
{ | ||
"StudentName": | ||
{ | ||
"Name": "Student Full Name", | ||
"Hash": "StudentName", | ||
"DataType": "String", | ||
"Default": "(unnamed student)" | ||
, "PictForm": { "Section": "StudentGrid", "Group":"StudentGrid" } | ||
}, | ||
"StudentID": | ||
{ | ||
"Name": "Learning Style", | ||
"Hash": "StudentLearningStyle", | ||
"DataType": "String" | ||
, "PictForm": { "Section": "StudentGrid", "Group":"StudentGrid" } | ||
}, | ||
"StudentAge": | ||
{ | ||
"Name": "Age", | ||
"Hash": "Age", | ||
"DataType": "Number" | ||
"Descriptors": { | ||
"StudentName": { | ||
"Name": "Student Full Name", | ||
"Hash": "StudentName", | ||
"DataType": "String", | ||
"Default": "(unnamed student)", | ||
"PictForm": { | ||
"Section": "StudentGrid", | ||
"Group": "StudentGrid" | ||
} | ||
}, | ||
"StudentID": { | ||
"Name": "Learning Style", | ||
"Hash": "StudentLearningStyle", | ||
"DataType": "String", | ||
"PictForm": { | ||
"Section": "StudentGrid", | ||
"Group": "StudentGrid" | ||
} | ||
}, | ||
"ShoeSize": { | ||
"Name": "Shoe Size", | ||
"Hash": "ShoeSize", | ||
"DataType": "Number", | ||
"Default": 7.5, | ||
"PictForm": { | ||
"Section": "StudentGrid", | ||
"Group": "StudentGrid" | ||
} | ||
}, | ||
"StudentAge": { | ||
"Name": "Age", | ||
"Hash": "Age", | ||
"DataType": "Number" | ||
} | ||
} | ||
} |
@@ -9,28 +9,15 @@ const libPictFormSection = require('../../../source/Pict-Section-Form.js'); | ||
[ | ||
/* | ||
* | ||
* [ Section Wrap Templates ] | ||
* | ||
*/ | ||
// -Form-Template-Wrap-Prefix | ||
{ | ||
"HashPostfix": "-Template-Wrap-Prefix", | ||
"Template": /*HTML*/` | ||
<!-- Pict Form Wrap Prefix [{~D:Context[0].UUID~}]::[{~D:Context[0].Hash~}] --> | ||
` | ||
"Template": /*HTML*/` ` | ||
}, | ||
// -Form-Template-Wrap-Postfix | ||
{ | ||
"HashPostfix": "-Template-Wrap-Postfix", | ||
"Template": /*HTML*/` | ||
<!-- Pict Form Wrap Postfix [{~D:Context[0].UUID~}]::[{~D:Context[0].Hash~}] --> | ||
` | ||
"Template": /*HTML*/` ` | ||
}, | ||
// -Form-Template-Section-Prefix | ||
{ | ||
"HashPostfix": "-Template-Section-Prefix", | ||
"Template": /*HTML*/` | ||
<!-- Form Section Prefix [{~D:Context[0].UUID~}]::[{~D:Context[0].Hash~}] {~D:Record.Hash~}::{~D:Record.Name~} --> | ||
<form class="pure-form pure-form-stacked"> | ||
@@ -40,3 +27,2 @@ <fieldset> | ||
}, | ||
// -Form-Template-Section-Postfix | ||
{ | ||
@@ -47,3 +33,2 @@ "HashPostfix": "-Template-Section-Postfix", | ||
</form> | ||
<!-- Form Section Postfix [{~D:Context[0].UUID~}]::[{~D:Context[0].Hash~}] {~D:Record.Hash~}::{~D:Record.Name~} --> | ||
` | ||
@@ -53,12 +38,5 @@ }, | ||
/* | ||
* | ||
* [ Group and Row Templates (default) ] | ||
* | ||
*/ | ||
// -Form-Template-Group-Prefix | ||
{ | ||
"HashPostfix": "-Template-Group-Prefix", | ||
"Template": /*HTML*/` | ||
<!-- Form Template Group Prefix [{~D:Context[0].UUID~}]::[{~D:Context[0].Hash~}] {~D:Record.Hash~}::{~D:Record.Name~} --> | ||
<legend>{~D:Record.Name~}</legend> | ||
@@ -68,23 +46,15 @@ <div class="pure-g"> | ||
}, | ||
// -Form-Template-Row-Prefix | ||
{ | ||
"HashPostfix": "-Template-Row-Prefix", | ||
"Template": /*HTML*/` | ||
<!-- Form Template Row Prefix [{~D:Context[0].UUID~}]::[{~D:Context[0].Hash~}] {~D:Record.Hash~}::{~D:Record.Name~} --> | ||
<div> | ||
` | ||
}, | ||
// -Form-Template-Row-Postfix | ||
{ | ||
"HashPostfix": "-Template-Row-Postfix", | ||
"Template": /*HTML*/` | ||
<!-- Form Template Row Postfix [{~D:Context[0].UUID~}]::[{~D:Context[0].Hash~}] {~D:Record.Hash~}::{~D:Record.Name~} --> | ||
` | ||
"Template": /*HTML*/` ` | ||
}, | ||
// -Form-Template-Group-Postfix | ||
{ | ||
"HashPostfix": "-Template-Group-Postfix", | ||
"Template": /*HTML*/` | ||
<!-- Form Template Group Prefix [{~D:Context[0].UUID~}]::[{~D:Context[0].Hash~}] {~D:Record.Hash~}::{~D:Record.Name~} --> | ||
` | ||
"Template": /*HTML*/` ` | ||
}, | ||
@@ -94,11 +64,7 @@ | ||
/* | ||
* | ||
* [ Input Templates (Default) ] | ||
* | ||
* [ Input Templates ] | ||
*/ | ||
// -Form-Template-Input | ||
{ | ||
"HashPostfix": "-Template-Input", | ||
"Template": /*HTML*/` | ||
<!-- DEFAULT Input {~"D:Record.Hash~} {~D:Record.DataType~} --> | ||
<div class="pure-u-1 pure-u-md-1-3"> | ||
@@ -110,7 +76,5 @@ <label {~D:Record.Macro.HTMLForID~}>{~D:Record.Name~}:</label> | ||
}, | ||
// -Form-Template-Input-DataType-String | ||
{ | ||
"HashPostfix": "-Template-Input-DataType-String", | ||
"Template": /*HTML*/` | ||
<!-- DataType Number {~D:Record.Hash~} {~D:Record.DataType~} --> | ||
<div class="pure-u-1 pure-u-md-1-3"> | ||
@@ -122,7 +86,5 @@ <label {~D:Record.Macro.HTMLForID~}>{~D:Record.Name~}:</label> | ||
}, | ||
// -Form-Template-Input-DataType-Number | ||
{ | ||
"HashPostfix": "-Template-Input-DataType-Number", | ||
"Template": /*HTML*/` | ||
<!-- DataType Number {~D:Record.Hash~} {~D:Record.DataType~} --> | ||
<div class="pure-u-1 pure-u-md-1-3"> | ||
@@ -134,7 +96,5 @@ <label {~D:Record.Macro.HTMLForID~}>{~D:Record.Name~}:</label> | ||
}, | ||
// -Form-Template-Input-InputType-TextArea | ||
{ | ||
"HashPostfix": "-Template-Input-InputType-TextArea", | ||
"Template": /*HTML*/` | ||
<!-- InputType TextArea {~D:Record.Hash~} {~D:Record.DataType~} --> | ||
<div class="pure-u-1 pure-u-md-1-3"> | ||
@@ -147,3 +107,3 @@ <label {~D:Record.Macro.HTMLForID~}>{~D:Record.Name~}:</label> | ||
} | ||
]}); // End of _Theme | ||
]}); | ||
@@ -150,0 +110,0 @@ class PostcardTheme extends libPictFormSection.PictFormTemplateProvider |
@@ -33,3 +33,7 @@ { | ||
"Description": "The email address and phone number of the sender.", | ||
"Groups": [] | ||
"Groups": [{ | ||
"Name": "Delivery Confirmation Information", | ||
"Hash": "DeliveryConfirmationInfo", | ||
"Description": "How should we tell you that it got there safely." | ||
}] | ||
} | ||
@@ -126,3 +130,3 @@ ], | ||
"DataType":"String" | ||
,"PictForm": { "Section":"Confirmation", "Row":1, "Width":12 } | ||
,"PictForm": { "Section":"DeliveryConfirmationInfo", "Row":1, "Width":12 } | ||
}, | ||
@@ -135,3 +139,3 @@ "SenderData.PhoneNumber": | ||
"DataType":"String" | ||
,"PictForm": { "Section":"Confirmation", "Row":2, "Width":10, "CSSClasses": ["VeryImportantData"] } | ||
,"PictForm": { "Section":"DeliveryConfirmationInfo", "Row":2, "Width":10, "CSSClasses": ["VeryImportantData"] } | ||
}, | ||
@@ -144,5 +148,5 @@ "SenderData.ExplicitConsentToMailers": | ||
"DataType":"Boolean" | ||
,"PictForm": { "Section":"Confirmation", "Row":1, "Width":2 } | ||
,"PictForm": { "Section":"DeliveryConfirmationInfo", "Row":1, "Width":2 } | ||
} | ||
} | ||
} |
@@ -39,2 +39,3 @@ const libPictSectionForm = require('../../source/Pict-Section-Form.js'); | ||
"Layout": "Tabular", | ||
"RecordSetAddress": "FruitData.FruityVice", | ||
@@ -49,3 +50,3 @@ "RecordManifest": "FruitEditor" | ||
{ | ||
"FruityVice": | ||
"FruitData.FruityVice": | ||
{ | ||
@@ -52,0 +53,0 @@ "Name": "Fruits of the Earth", |
{ | ||
"name": "pict-section-form", | ||
"version": "1.0.10", | ||
"version": "1.0.12", | ||
"description": "Pict dynamic form sections", | ||
@@ -29,3 +29,3 @@ "main": "source/Pict-Section-Form.js", | ||
"jquery": "^3.7.1", | ||
"pict": "^1.0.195", | ||
"pict": "^1.0.198", | ||
"pict-application": "^1.0.18", | ||
@@ -35,2 +35,3 @@ "quackage": "^1.0.30" | ||
"dependencies": { | ||
"fable-serviceproviderbase": "^3.0.13", | ||
"pict-provider": "^1.0.2", | ||
@@ -37,0 +38,0 @@ "pict-view": "^1.0.47" |
@@ -71,2 +71,3 @@ const libPictViewClass = require('pict-view'); | ||
this.renderFormSections(); | ||
// this.solve(); | ||
this.marshalToView(); | ||
@@ -328,2 +329,3 @@ } | ||
"AutoPopulateDefaultObject": true, | ||
"AutoSolveBeforeRender": true, | ||
"AutoPopulateAfterRender": true, | ||
@@ -330,0 +332,0 @@ |
module.exports = ( | ||
{ | ||
"TemplatePrefix": "Pict-Forms-Basic", | ||
"Templates":[ | ||
"Templates": | ||
[ | ||
/* | ||
* | ||
* [ Metacontroller Templates ] | ||
* | ||
*/ | ||
// -Form-Container-Header | ||
* | ||
* [ Metacontroller Templates ] | ||
* | ||
*/ | ||
// the form "Header", rendered once before the dynamic views, after which come the section(s), then their group(s) | ||
{ | ||
"HashPostfix": "-Template-Form-Container-Header", | ||
"Template": /*HTML*/` | ||
<!-- | ||
Pict Form Metacontroller container Header | ||
<!-- Pict Form Metacontroller container Header | ||
@@ -23,8 +22,6 @@ ;,//;, ,;/ | ||
Glug glug glug Oo... | ||
--> | ||
Glug glug glug Oo... --> | ||
<div id="Pict-{~D:Context[0].UUID~}-FormContainer" class="pict-form">` | ||
}, | ||
// -Form-Container-Wrap-Prefix | ||
// | ||
{ | ||
@@ -34,6 +31,6 @@ "HashPostfix": "-Template-Form-Container-Wrap-Prefix", | ||
<!-- Pict Form Metacontroller container [{~D:Context[0].UUID~}] --> | ||
<div id="Pict-{~D:Context[0].UUID~}-FormContainer" class="pict-form">` | ||
<div id="Pict-{~D:Context[0].UUID~}-{~D:Record.options.Hash~}-Wrap" class="pict-form">` | ||
}, | ||
// -Form-Container | ||
// This is the DIV each section (view) renders into. | ||
// the container div into which the actual view renders. | ||
// if you overwrite this template, make sure this ID is available on a container somewhere or auto rendering won't work | ||
{ | ||
@@ -58,7 +55,7 @@ "HashPostfix": "-Template-Form-Container", | ||
/* | ||
* | ||
* [ Section Wrap Templates ] | ||
* | ||
*/ | ||
// -Form-Template-Wrap-Prefix | ||
* | ||
* [ Basic Form Templates START ] | ||
* | ||
*/ | ||
// the wrapping container for a view which is a collection of form section(s)... | ||
{ | ||
@@ -70,3 +67,2 @@ "HashPostfix": "-Template-Wrap-Prefix", | ||
}, | ||
// -Form-Template-Wrap-Postfix | ||
{ | ||
@@ -78,5 +74,3 @@ "HashPostfix": "-Template-Wrap-Postfix", | ||
}, | ||
// -Form-Template-Section-Prefix | ||
// the wrapping container for each specific section in a form... for legends and the like | ||
{ | ||
@@ -99,9 +93,6 @@ "HashPostfix": "-Template-Section-Prefix", | ||
/* | ||
* | ||
* [ Group and Row Templates (default) ] | ||
* | ||
*/ | ||
// -Form-Template-Group-Prefix | ||
* BEGIN Group and Row Templates (default) | ||
*/ | ||
// a "group" is a cluster of inputs that are further categorized into row(s) | ||
{ | ||
@@ -115,3 +106,4 @@ "HashPostfix": "-Template-Group-Prefix", | ||
}, | ||
// -Form-Template-Row-Prefix | ||
// row(s) are useful when our form has multiple inputs on some lines and a single on another... | ||
// like city, state and zip all in the same "row" of an address form | ||
{ | ||
@@ -124,3 +116,2 @@ "HashPostfix": "-Template-Row-Prefix", | ||
}, | ||
// -Form-Template-Row-Postfix | ||
{ | ||
@@ -133,3 +124,2 @@ "HashPostfix": "-Template-Row-Postfix", | ||
}, | ||
// -Form-Template-Group-Postfix | ||
{ | ||
@@ -142,10 +132,9 @@ "HashPostfix": "-Template-Group-Postfix", | ||
}, | ||
/* | ||
* END Group and Row Templates (default) | ||
*/ | ||
/* | ||
* | ||
* [ Input Templates (Default) ] | ||
* | ||
*/ | ||
// -Form-Template-Input | ||
* BEGIN Input Templates (default) | ||
*/ | ||
{ | ||
@@ -158,3 +147,2 @@ "HashPostfix": "-Template-Input", | ||
}, | ||
// -Form-Template-Input-DataType-String | ||
{ | ||
@@ -167,3 +155,2 @@ "HashPostfix": "-Template-Input-DataType-String", | ||
}, | ||
// -Form-Template-Input-DataType-Number | ||
{ | ||
@@ -176,3 +163,2 @@ "HashPostfix": "-Template-Input-DataType-Number", | ||
}, | ||
// -Form-Template-Input-InputType-TextArea | ||
{ | ||
@@ -185,9 +171,18 @@ "HashPostfix": "-Template-Input-InputType-TextArea", | ||
}, | ||
/* | ||
* END Input Templates (default) | ||
*/ | ||
/* | ||
* | ||
* [ Basic Form Templates END ] | ||
* | ||
*/ | ||
/* | ||
* | ||
* [ Tabular Templates ] | ||
* | ||
*/ | ||
* | ||
* [ Tabular Templates START ] | ||
* | ||
*/ | ||
{ | ||
@@ -199,8 +194,20 @@ "HashPostfix": "-TabularTemplate-Group-Prefix", | ||
<tbody> | ||
<!-- Form Template Group Prefix [{~D:Context[0].UUID~}]::[{~D:Context[0].Hash~}] {~D:Record.Hash~}::{~D:Record.Name~} --> | ||
<!-- Form Tabular Template Group Prefix [{~D:Context[0].UUID~}]::[{~D:Context[0].Hash~}] {~D:Record.Hash~}::{~D:Record.Name~} --> | ||
` | ||
}, | ||
{ | ||
"HashPostfix": "-TabularTemplate-Group-Postfix", | ||
"Template": /*HTML*/` | ||
</tbody> | ||
</table> | ||
<div><a href="#" onclick="{~D:Record.Macro.TabularCreateRowFunctionCall~}">create</a></div> | ||
</div> | ||
<!-- Form Tabular Template Group Prefix [{~D:Context[0].UUID~}]::[{~D:Context[0].Hash~}] {~D:Record.Hash~}::{~D:Record.Name~} --> | ||
` | ||
}, | ||
// These templates are meant to be an easily overridable "add buttons to the row" template. | ||
/* | ||
* BEGIN Tabular Template "Extra" Columns | ||
* these are meant to be easy ways to add controls to the left or right side of a record column | ||
*/ | ||
{ | ||
@@ -210,19 +217,29 @@ "HashPostfix": "-TabularTemplate-RowHeader-ExtraPrefix", | ||
}, | ||
// because the row extension template below adds an extra column, we need to make our header have parity | ||
{ | ||
"HashPostfix": "-TabularTemplate-Row-ExtraPrefix", | ||
"Template": /*HTML*/`<!-- TabularTemplateRow-ExtraPrefix -->` | ||
}, | ||
{ | ||
"HashPostfix": "-TabularTemplate-RowHeader-ExtraPostfix", | ||
"Template": /*HTML*/`<!-- TabularTemplateRowHeader-ExtraPostfix --> | ||
<th></th> | ||
<th style="min-width:100px;"></th> | ||
` | ||
}, | ||
{ | ||
"HashPostfix": "-TabularTemplate-Row-ExtraPrefix", | ||
"Template": /*HTML*/`<!-- TabularTemplateRow-ExtraPrefix -->` | ||
}, | ||
// by default PICT puts a "delete row" button on the right side of a tabular templateset | ||
{ | ||
"HashPostfix": "-TabularTemplate-Row-ExtraPostfix", | ||
"Template": /*HTML*/`<!-- TabularTemplateRow-ExtraPostfix--> | ||
<td><a href="#" onClick="_Pict.views['{~D:Context[0].Hash~}'].deleteDynamicTableRow({~D:Record.Group~},'{~D:Record.Key~}')">PICT.del</a></td> | ||
<td><a href="#" onClick="_Pict.views['{~D:Context[0].Hash~}'].deleteDynamicTableRow({~D:Record.Group~},'{~D:Record.Key~}')">del</a> | ||
<a href="#" onClick="_Pict.views['{~D:Context[0].Hash~}'].moveDynamicTableRowUp({~D:Record.Group~},'{~D:Record.Key~}')">up</a> | ||
<a href="#" onClick="_Pict.views['{~D:Context[0].Hash~}'].moveDynamicTableRowDown({~D:Record.Group~},'{~D:Record.Key~}')">down</a></td> | ||
` | ||
}, | ||
/* | ||
* END Tabular Template "Extra" Columns | ||
*/ | ||
/* | ||
* BEGIN Tabular Template Header Columns | ||
*/ | ||
{ | ||
@@ -250,8 +267,9 @@ "HashPostfix": "-TabularTemplate-RowHeader-Prefix", | ||
}, | ||
/* | ||
* END Tabular Template Header Columns | ||
*/ | ||
/* | ||
* | ||
* BEGINNING of the Tabular TemplateSet metatemplate entries | ||
* | ||
* BEGIN Tabular TemplateSet Templates (row and cell prefix/postfix ... tr/td) | ||
* (these are repeated for each "row" which is a record, and then wrap each "cell" which is a columnar input) | ||
*/ | ||
@@ -282,23 +300,8 @@ { | ||
/* | ||
* | ||
* END of the above Tabular TemplateSet metatemplate entries | ||
* | ||
* END Tabular TemplateSet Templates | ||
*/ | ||
{ | ||
"HashPostfix": "-TabularTemplate-Group-Postfix", | ||
"Template": /*HTML*/` | ||
</tbody> | ||
</table> | ||
<div><a href="#" onclick="{~D:Record.Macro.TabularCreateRowFunctionCall~}">PICT.create</a></div> | ||
</div> | ||
<!-- Form Template Group Prefix [{~D:Context[0].UUID~}]::[{~D:Context[0].Hash~}] {~D:Record.Hash~}::{~D:Record.Name~} --> | ||
` | ||
}, | ||
/* | ||
* | ||
* Input Templates (tabular) | ||
* | ||
* BEGIN Tabular Input Templates | ||
*/ | ||
@@ -349,4 +352,12 @@ { | ||
} | ||
/* | ||
* END Tabular Input Templates | ||
*/ | ||
/* | ||
* | ||
* [ Tabular Templates END ] | ||
* | ||
*/ | ||
] | ||
}); |
@@ -38,10 +38,2 @@ const libPictViewClass = require('pict-view'); | ||
} | ||
if (!tmpOptions.SectionTabularRowVirtualTemplateHash) | ||
{ | ||
tmpOptions.SectionTabularRowVirtualTemplateHash = `Pict-Form-Template-TabularRow-Virtual-${tmpOptions.Hash}`; | ||
} | ||
if (!tmpOptions.SectionTabularRowTemplateHash) | ||
{ | ||
tmpOptions.SectionTabularRowTemplateHash = `Pict-Form-Template-TabularRow-${tmpOptions.Hash}`; | ||
} | ||
@@ -67,2 +59,16 @@ if (tmpOptions.Renderables.length < 1) | ||
// Shift solvers to an array of tasks | ||
this.sectionSolvers = []; | ||
// Pull in solvers | ||
if (('Solvers' in this.options) && Array.isArray(this.options.Solvers)) | ||
{ | ||
for (let i = 0; i < this.options.Solvers.length; i++) | ||
{ | ||
if (typeof(this.options.Solvers[i]) === 'string') | ||
{ | ||
this.sectionSolvers.push(this.options.Solvers[i]); | ||
} | ||
} | ||
} | ||
if (!this.pict.providers.PictFormSectionDefaultTemplateProvider) | ||
@@ -120,2 +126,12 @@ { | ||
addSolver(pSolveFunctionString) | ||
{ | ||
return ( | ||
{ | ||
"Type": "SingleSolve", | ||
"Priority": 0, | ||
"SolveFunction": pSolveFunctionString | ||
}); | ||
} | ||
renderToPrimary() | ||
@@ -223,2 +239,40 @@ { | ||
// Solve the groups | ||
for (let j = 0; j < this.sectionDefinition.Groups.length; j++) | ||
{ | ||
let tmpGroup = this.sectionDefinition.Groups[j]; | ||
if (`RecordSetSolvers` in tmpGroup) | ||
{ | ||
for (let k = 0; k < tmpGroup.RecordSetSolvers.length; k++) | ||
{ | ||
this.log.trace(`Dynamic View [${this.UUID}]::[${this.Hash}] solving equation ${k} [${tmpGroup.RecordSetSolvers[k]}]`); | ||
let tmpRecordSet = this.getTabularRecordSet(j); | ||
if (typeof(tmpRecordSet) == 'object') | ||
{ | ||
let tmpRecordSetKeys = Object.keys(tmpRecordSet); | ||
for (let l = 0; l < tmpRecordSetKeys.length; l++) | ||
{ | ||
let tmpRecord = tmpRecordSet[tmpRecordSetKeys[l]]; | ||
let tmpResultsObject = {}; | ||
let tmpSolutionValue = this.fable.ExpressionParser.solve(tmpGroup.RecordSetSolvers[k], tmpRecord, tmpResultsObject, tmpGroup.supportingManifest, tmpRecord); | ||
this.log.trace(`Group ${tmpGroup.Hash} solver ${k} [${tmpGroup.RecordSetSolvers[k]}] record ${l} result was ${tmpSolutionValue}`); | ||
} | ||
} | ||
if (typeof(tmpRecordSet) == 'array') | ||
{ | ||
for (let l = 0; l < tmpRecordSet.length; l++) | ||
{ | ||
let tmpRecord = tmpRecordSet[l]; | ||
let tmpResultsObject = {}; | ||
let tmpSolutionValue = this.fable.ExpressionParser.solve(tmpGroup.RecordSetSolvers[k], tmpRecord, tmpResultsObject, tmpGroup.supportingManifest, tmpRecord); | ||
this.log.trace(`Group ${tmpGroup.Hash} solver ${k} [${tmpGroup.RecordSetSolvers[k]}] record ${l} result was ${tmpSolutionValue}`); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
if (Array.isArray(this.options.Solvers)) | ||
@@ -566,2 +620,6 @@ { | ||
tmpGroup.SectionTabularRowVirtualTemplateHash = `Pict-Form-Template-TabularRow-Virtual-${this.options.Hash}-G${tmpGroup.GroupIndex}`; | ||
tmpGroup.SectionTabularRowTemplateHash = `Pict-Form-Template-TabularRow-${this.options.Hash}-G${tmpGroup.GroupIndex}`; | ||
// Group layouts are customizable | ||
@@ -633,12 +691,12 @@ // The three basic group layouts: | ||
tmpTemplateSetVirtualRowTemplate += this.getMetatemplateTemplateReferenceRaw(`-TabularTemplate-Row-ExtraPrefix`, `Record`); | ||
tmpTemplateSetVirtualRowTemplate += `\n\n{~T:${this.options.SectionTabularRowTemplateHash}:Record~}\n`; | ||
tmpTemplateSetVirtualRowTemplate += `\n\n{~T:${tmpGroup.SectionTabularRowTemplateHash}:Record~}\n`; | ||
tmpTemplateSetVirtualRowTemplate += this.getMetatemplateTemplateReferenceRaw(`-TabularTemplate-Row-ExtraPostfix`, `Record`); | ||
// This is a custom template expression | ||
tmpTemplate += `\n\n{~MTVS:${this.options.SectionTabularRowVirtualTemplateHash}:${tmpGroup.GroupIndex}:${this.getMarshalDestinationAddress()}.${tmpGroup.RecordSetAddress}~}\n`; | ||
tmpTemplate += `\n\n{~MTVS:${tmpGroup.SectionTabularRowVirtualTemplateHash}:${tmpGroup.GroupIndex}:${this.getMarshalDestinationAddress()}.${tmpGroup.RecordSetAddress}~}\n`; | ||
tmpTemplate += this.getMetatemplateTemplateReference(`-TabularTemplate-Group-Postfix`, `getGroup("${i}")`); | ||
// Add the TemplateSetTemplate | ||
this.pict.TemplateProvider.addTemplate(this.options.SectionTabularRowVirtualTemplateHash, tmpTemplateSetVirtualRowTemplate); | ||
this.pict.TemplateProvider.addTemplate(this.options.SectionTabularRowTemplateHash, tmpTemplateSetRecordRowTemplate); | ||
this.pict.TemplateProvider.addTemplate(tmpGroup.SectionTabularRowVirtualTemplateHash, tmpTemplateSetVirtualRowTemplate); | ||
this.pict.TemplateProvider.addTemplate(tmpGroup.SectionTabularRowTemplateHash, tmpTemplateSetRecordRowTemplate); | ||
break; | ||
@@ -745,2 +803,14 @@ case 'Record': | ||
getTabularRecordSet(pGroupIndex) | ||
{ | ||
// The neat thing about how the tabular groups work is that we can make it clever about whether it's an object or an array. | ||
let tmpGroup = this.getGroup(pGroupIndex); | ||
if (!tmpGroup) | ||
{ | ||
this.log.warn(`PICT View Metatemplate Helper getTabularRecordSet ${pGroupIndex} was not a valid group.`); | ||
return false; | ||
} | ||
return this.sectionManifest.getValueByHash(this.getMarshalDestinationObject(), tmpGroup.RecordSetAddress); | ||
} | ||
getGroup(pGroupIndex) | ||
@@ -786,2 +856,93 @@ { | ||
setDynamicTableRowIndex(pGroupIndex, pRowIndex, pNewRowIndex) | ||
{ | ||
let tmpGroup = this.getGroup(pGroupIndex); | ||
if (tmpGroup) | ||
{ | ||
let tmpDestinationObject = this.sectionManifest.getValueByHash(this.getMarshalDestinationObject(), tmpGroup.RecordSetAddress); | ||
if (Array.isArray(tmpDestinationObject)) | ||
{ | ||
let tmpRowIndex = parseInt(pRowIndex, 10); | ||
let tmpNewRowIndex = parseInt(pNewRowIndex, 10); | ||
if ((tmpDestinationObject.length <= tmpRowIndex) || (tmpRowIndex < 0)) | ||
{ | ||
this.pict.log.error(`Dynamic View [${this.UUID}]::[${this.Hash}] Group ${tmpGroup.Hash} attempting to move row [${pRowIndex}] to [${pNewRowIndex}] but the index is out of bounds.`); | ||
return false; | ||
} | ||
let tmpElementToBeMoved = tmpDestinationObject.splice(tmpRowIndex, 1); | ||
tmpDestinationObject.splice(tmpNewRowIndex, 0, tmpElementToBeMoved[0]); | ||
this.render(); | ||
this.marshalToView(); | ||
} | ||
else if (typeof(tmpDestinationObject) === 'object') | ||
{ | ||
this.pict.log.error(`Dynamic View [${this.UUID}]::[${this.Hash}] Group ${tmpGroup.Hash} attempting to move row [${pRowIndex}] to [${pNewRowIndex}] but it's an object not an array; order isn't controllable.`); | ||
} | ||
} | ||
} | ||
moveDynamicTableRowDown(pGroupIndex, pRowIndex) | ||
{ | ||
let tmpGroup = this.getGroup(pGroupIndex); | ||
if (tmpGroup) | ||
{ | ||
let tmpDestinationObject = this.sectionManifest.getValueByHash(this.getMarshalDestinationObject(), tmpGroup.RecordSetAddress); | ||
if (Array.isArray(tmpDestinationObject)) | ||
{ | ||
let tmpRowIndex = parseInt(pRowIndex, 10); | ||
if (tmpDestinationObject.length <= tmpRowIndex) | ||
{ | ||
this.pict.log.error(`Dynamic View [${this.UUID}]::[${this.Hash}] Group ${tmpGroup.Hash} attempting to move row [${pRowIndex}] down but it's already at the bottom.`); | ||
return false; | ||
} | ||
let tmpElementToBeMoved = tmpDestinationObject.splice(tmpRowIndex, 1); | ||
tmpDestinationObject.splice(tmpRowIndex + 1, 0, tmpElementToBeMoved[0]); | ||
this.render(); | ||
this.marshalToView(); | ||
} | ||
else if (typeof(tmpDestinationObject) === 'object') | ||
{ | ||
this.pict.log.error(`Dynamic View [${this.UUID}]::[${this.Hash}] Group ${tmpGroup.Hash} attempting to move row [${pRowIndex}] but it's an object not an array; order isn't controllable.`); | ||
} | ||
} | ||
} | ||
moveDynamicTableRowUp(pGroupIndex, pRowIndex) | ||
{ | ||
let tmpGroup = this.getGroup(pGroupIndex); | ||
if (tmpGroup) | ||
{ | ||
let tmpDestinationObject = this.sectionManifest.getValueByHash(this.getMarshalDestinationObject(), tmpGroup.RecordSetAddress); | ||
if (Array.isArray(tmpDestinationObject)) | ||
{ | ||
let tmpRowIndex = parseInt(pRowIndex, 10); | ||
if (tmpRowIndex == 0) | ||
{ | ||
this.pict.log.error(`Dynamic View [${this.UUID}]::[${this.Hash}] Group ${tmpGroup.Hash} attempting to move row [${pRowIndex}] up but it's already at the top.`); | ||
return false; | ||
} | ||
if (tmpDestinationObject.length <= tmpRowIndex) | ||
{ | ||
this.pict.log.error(`Dynamic View [${this.UUID}]::[${this.Hash}] Group ${tmpGroup.Hash} attempting to move row [${pRowIndex}] but the index is out of bounds.`); | ||
return false; | ||
} | ||
let tmpElementToBeMoved = tmpDestinationObject.splice(tmpRowIndex, 1); | ||
tmpDestinationObject.splice(tmpRowIndex - 1, 0, tmpElementToBeMoved[0]); | ||
this.render(); | ||
this.marshalToView(); | ||
} | ||
else if (typeof(tmpDestinationObject) === 'object') | ||
{ | ||
this.pict.log.error(`Dynamic View [${this.UUID}]::[${this.Hash}] Group ${tmpGroup.Hash} attempting to move row [${pRowIndex}] but it's an object not an array; order isn't controllable.`); | ||
} | ||
} | ||
} | ||
deleteDynamicTableRow(pGroupIndex, pRowIndex) | ||
@@ -788,0 +949,0 @@ { |
@@ -10,6 +10,2 @@ // The container for all the Pict-Section-Form related code. | ||
// The metatemplate generator provider | ||
// (if we decide to abstract this out from the view class) | ||
// module.exports.PictFormMetatemplateGenerator = require('./Pict-Section-Form-MetatemplateGenerator.js'); | ||
// The metacontroller view | ||
@@ -16,0 +12,0 @@ module.exports.PictFormMetacontroller = require('./Pict-Form-Metacontroller.js'); |
@@ -28,3 +28,3 @@ const libPictProvider = require('pict-provider'); | ||
let tmpSelector = `[data-i-form="${pFormHash}"]`; | ||
this.log.trace(`Getting form elements for form hash selector: ${tmpSelector}`); | ||
//this.log.trace(`Getting form elements for form hash selector: ${tmpSelector}`); | ||
return this.pict.ContentAssignment.getElement(tmpSelector); | ||
@@ -67,3 +67,6 @@ } | ||
this.log.trace(`Informary marshalling BrowserForm Data ${tmpBrowserValue} from form element [${tmpDatumAddress}] in container [${tmpContainerAddress}] at index [${tmpIndex}] to the datum address [${tmpDatumAddress}].`); | ||
if (this.pict.LogNoisiness > 3) | ||
{ | ||
this.log.trace(`Informary marshalling BrowserForm Data ${tmpBrowserValue} from form element [${tmpDatumAddress}] in container [${tmpContainerAddress}] at index [${tmpIndex}] to the datum address [${tmpDatumAddress}].`); | ||
} | ||
@@ -104,3 +107,6 @@ if (typeof(tmpBrowserValue) === 'undefined') | ||
this.log.trace(`Informary marshalling App State data ${tmpAppStateValue} to Browser Form element [${tmpDatumAddress}] in container [${tmpContainerAddress}] at index [${tmpIndex}].`); | ||
if (this.pict.LogNoisiness > 3) | ||
{ | ||
this.log.trace(`Informary marshalling App State data ${tmpAppStateValue} to Browser Form element [${tmpDatumAddress}] in container [${tmpContainerAddress}] at index [${tmpIndex}].`); | ||
} | ||
@@ -116,3 +122,6 @@ if (typeof(tmpAppStateValue) !== 'undefined') | ||
this.log.trace(`Informary marshalling App State data ${tmpAppStateValue} to Browser Form element [${tmpDatumAddress}] in container [${tmpContainerAddress}] at index [${tmpIndex}].`); | ||
if (this.pict.LogNoisiness > 3) | ||
{ | ||
this.log.trace(`Informary marshalling App State data ${tmpAppStateValue} to Browser Form element [${tmpDatumAddress}] in container [${tmpContainerAddress}] at index [${tmpIndex}].`); | ||
} | ||
@@ -119,0 +128,0 @@ if (typeof(tmpAppStateValue) !== 'undefined') |
@@ -1,2 +0,2 @@ | ||
const libPictTemplate = require('pict').PictTemplateClass; | ||
const libPictTemplate = require('./Pict-Template-Base.js'); | ||
@@ -3,0 +3,0 @@ class PictTemplateMetacontrollerValueSet extends libPictTemplate |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6476599
251
90905
3
6