pict-section-form 1.0.166 → 1.0.167
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/debug/PICTSection-TabularManifests.json +17 -2
- package/debug/TabularManifestCSV.csv +2 -1
- package/debug/data/DefaultFormManifest.json +17 -2
- package/debug/data/MathExampleForm-Reconstituted.csv +3 -2
- package/debug/data/MathExampleForm.json +17 -2
- package/package.json +1 -1
- package/source/providers/Pict-Provider-DynamicFormSolverBehaviors.js +62 -0
- package/source/views/Pict-View-DynamicForm.js +37 -0
|
@@ -97,6 +97,19 @@
|
|
|
97
97
|
},
|
|
98
98
|
"Default": "50000"
|
|
99
99
|
},
|
|
100
|
+
"Header.BoxRowCount": {
|
|
101
|
+
"Hash": "HeaderBoxRowCount",
|
|
102
|
+
"Name": "Number of Box Styles",
|
|
103
|
+
"DataAddress": "Header.BoxRowCount",
|
|
104
|
+
"DataType": "Number",
|
|
105
|
+
"PictForm": {
|
|
106
|
+
"Row": "5",
|
|
107
|
+
"Width": "12",
|
|
108
|
+
"Section": "Header",
|
|
109
|
+
"Group": "General_Info"
|
|
110
|
+
},
|
|
111
|
+
"Default": "8"
|
|
112
|
+
},
|
|
100
113
|
"BookData.CurrentIDBook": {
|
|
101
114
|
"Hash": "CurrentIDBook",
|
|
102
115
|
"Name": "IDBook",
|
|
@@ -169,7 +182,7 @@
|
|
|
169
182
|
"Section": "Basic_Geometry",
|
|
170
183
|
"Group": "BasicGeoGrp"
|
|
171
184
|
},
|
|
172
|
-
"Default": "
|
|
185
|
+
"Default": "5",
|
|
173
186
|
"AnotherObject": {
|
|
174
187
|
"NotPictForm": {
|
|
175
188
|
"y": 22
|
|
@@ -721,7 +734,9 @@
|
|
|
721
734
|
{
|
|
722
735
|
"Name": "Header",
|
|
723
736
|
"Hash": "Header",
|
|
724
|
-
"Solvers": [
|
|
737
|
+
"Solvers": [
|
|
738
|
+
"BoxRowCountSuccess = SETTABULARROWLENGTH(\"BoxCollSec\", \"BoxCollGrp\", HeaderBoxRowCount, 1)"
|
|
739
|
+
],
|
|
725
740
|
"Groups": [
|
|
726
741
|
{
|
|
727
742
|
"Name": "General Info",
|
|
@@ -7,10 +7,11 @@ MathExampleForm,,,,,,Header,,General Info,,,,,2,12,,,Header.Description,Descript
|
|
|
7
7
|
MathExampleForm,,,,,,Header,,General Info,,,,,3,6,,,Header.Planet,Planet,Planet,,planetary,String,,Option,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
8
8
|
MathExampleForm,,,,,,Header,,General Info,,,,,3,6,,,Header.Universe,Universe,Universe,,planetary,String,,Option,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,15.2,17
|
|
9
9
|
MathExampleForm,,,,,,Header,,General Info,,,,,4,12,,,Header.WarehouseVolume,Warehouse Volume,WarehouseVolume,,,Number,,,,,50000,,,,,,,,,,,,,,,,,,,,,,,,,,,,,t,,
|
|
10
|
+
MathExampleForm,,,,,,Header,,General Info,,,,,5,12,,,Header.BoxRowCount,Number of Box Styles,HeaderBoxRowCount,,,Number,,,"BoxRowCountSuccess = SETTABULARROWLENGTH(""BoxCollSec"", ""BoxCollGrp"", HeaderBoxRowCount, 1)",,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,t,,
|
|
10
11
|
MathExampleForm,,,,,,REST Request,,Book Data,,,,,1,6,,,BookData.CurrentIDBook,IDBook,CurrentIDBook,,,Number,,,,,,,,Book from REST request,Book,IDBook,LoadedBook,,,,,,,,,,,,,,,,,,,,,,,,86,
|
|
11
12
|
MathExampleForm,,,,,,MatheMagic,,Math is Magic,,,,,1,1,,,HelpContent.Math,So Very Magic,MathHelpContent,,,String,,HTML,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
12
13
|
MathExampleForm,,,,,,Basic Geometry,,Rectangle,BasicGeoGrp,,,,1,6,,,Geometry.Rectangle.Width,Width,RectangleWidth,,,Number,,,,,7.25,,,,,,,,,,,,,,,,,,,,,,,,,,,,,y,11,190
|
|
13
|
-
MathExampleForm,,,,,,Basic Geometry,,Rectangle,BasicGeoGrp,,,,1,6,,,Geometry.Rectangle.Height,Height,RectangleHeight,,,Number,,,,,
|
|
14
|
+
MathExampleForm,,,,,,Basic Geometry,,Rectangle,BasicGeoGrp,,,,1,6,,,Geometry.Rectangle.Height,Height,RectangleHeight,,,Number,,,,,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,22
|
|
14
15
|
MathExampleForm,,,,,,Basic Geometry,,Rectangle,BasicGeoGrp,,,,2,3,,,Geometry.Rectangle.Area,Area,RectangleArea,,unrounded,Number,,,RectangleArea = RectangleWidth * RectangleHeight,,,Area of the Rectangle.,,,,,,,,,,,,,,,,,,,,,,,,,,,This is a test for random data injection.,1,,
|
|
15
16
|
MathExampleForm,,,,,,Basic Geometry,,Rectangle,BasicGeoGrp,,,,2,3,,,Geometry.Rectangle.AreaRoundedDefault,Area Rounded,RectangleAreaRoundedDefault,,default,Number,,,RectangleAreaRoundedDefault = ROUND(RectangleWidth * RectangleHeight),,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,frog,
|
|
16
17
|
MathExampleForm,,,,,,Basic Geometry,,Rectangle,BasicGeoGrp,,,,2,3,,,Geometry.Rectangle.AreaRoundedThree,Area Rounded 3,RectangleAreaRoundedThree,,3,Number,,,"RectangleAreaRoundedThree = ROUND((RectangleWidth * RectangleHeight), 3)",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
@@ -96,6 +96,19 @@
|
|
|
96
96
|
},
|
|
97
97
|
"Default": "50000"
|
|
98
98
|
},
|
|
99
|
+
"Header.BoxRowCount": {
|
|
100
|
+
"Hash": "HeaderBoxRowCount",
|
|
101
|
+
"Name": "Number of Box Styles",
|
|
102
|
+
"DataAddress": "Header.BoxRowCount",
|
|
103
|
+
"DataType": "Number",
|
|
104
|
+
"PictForm": {
|
|
105
|
+
"Row": "5",
|
|
106
|
+
"Width": "12",
|
|
107
|
+
"Section": "Header",
|
|
108
|
+
"Group": "General_Info"
|
|
109
|
+
},
|
|
110
|
+
"Default": "8"
|
|
111
|
+
},
|
|
99
112
|
"BookData.CurrentIDBook": {
|
|
100
113
|
"Hash": "CurrentIDBook",
|
|
101
114
|
"Name": "IDBook",
|
|
@@ -169,7 +182,7 @@
|
|
|
169
182
|
"Section": "Basic_Geometry",
|
|
170
183
|
"Group": "BasicGeoGrp"
|
|
171
184
|
},
|
|
172
|
-
"Default": "
|
|
185
|
+
"Default": "5",
|
|
173
186
|
"AnotherObject": {
|
|
174
187
|
"NotPictForm": {
|
|
175
188
|
"y": 22
|
|
@@ -870,7 +883,9 @@
|
|
|
870
883
|
{
|
|
871
884
|
"Name": "Header",
|
|
872
885
|
"Hash": "Header",
|
|
873
|
-
"Solvers": [
|
|
886
|
+
"Solvers": [
|
|
887
|
+
"BoxRowCountSuccess = SETTABULARROWLENGTH(\"BoxCollSec\", \"BoxCollGrp\", HeaderBoxRowCount, 1)"
|
|
888
|
+
],
|
|
874
889
|
"Groups": [
|
|
875
890
|
{
|
|
876
891
|
"Name": "General Info",
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
Form,Form Name,SubManifest,HideTabularEditingControls,GroupRecordSetAddress,DataOnly,Section Name,Section Hash,Group Name,Group Hash,Group Layout,Group CSS,Group Show Title,Row,Width,Minimum Row Count,Maximum Row Count,Input Address,Input Name,Input Hash,Input Extra,Units,DataType,Decimal Precision,InputType,Equation,Equation Ordinal,Default,Description,Tooltip,Input Notes,Entity,EntityColumnFilter,EntityDestination,SingleRecord,TriggerGroup,TriggerAddress,TriggerAllInputs,MarshalEmptyValues,ChartType,ChartLabelsAddress,ChartLabelsSolver,ChartDatasetsAddress,ChartDatasetsLabel,ChartDatasetsSolvers
|
|
2
|
-
MathExampleForm,Math Example Form,,,,,Header,Header,General Info,General_Info,,,,1,3,,,Header.FirstName,First Name,HeaderFirstName,,,String
|
|
2
|
+
MathExampleForm,Math Example Form,,,,,Header,Header,General Info,General_Info,,,,1,3,,,Header.FirstName,First Name,HeaderFirstName,,,String,,,"BoxRowCountSuccess = SETTABULARROWLENGTH(""BoxCollSec"", ""BoxCollGrp"", HeaderBoxRowCount, 1)",1,,,,,,,,,,,,,,,,,,
|
|
3
3
|
MathExampleForm,,,,,,Header,Header,General Info,General_Info,,,,1,3,,,Header.LastName,Last Name,HeaderLastName,,,String,,,,,,,,,,,,,,,,,,,,,,
|
|
4
4
|
MathExampleForm,,,,,,Header,Header,General Info,General_Info,,,,1,6,,,Header.JobTitle,Job Title,JobTitle,,,String,,,,,,,,,,,,,,,,,,,,,,
|
|
5
5
|
MathExampleForm,,,,,,Header,Header,General Info,General_Info,,,,2,12,,,Header.Description,Description,Description,,,String,,,,,,,,,,,,,,,,,,,,,,
|
|
6
6
|
MathExampleForm,,,,,,Header,Header,General Info,General_Info,,,,3,6,,,Header.Planet,Planet,Planet,,planetary,String,,Option,,,,,,,,,,,,,,,,,,,,
|
|
7
7
|
MathExampleForm,,,,,,Header,Header,General Info,General_Info,,,,3,6,,,Header.Universe,Universe,Universe,,planetary,String,,Option,,,,,,,,,,,,,,,,,,,,
|
|
8
8
|
MathExampleForm,,,,,,Header,Header,General Info,General_Info,,,,4,12,,,Header.WarehouseVolume,Warehouse Volume,WarehouseVolume,,,Number,,,,,50000,,,,,,,,,,,,,,,,,
|
|
9
|
+
MathExampleForm,,,,,,Header,Header,General Info,General_Info,,,,5,12,,,Header.BoxRowCount,Number of Box Styles,HeaderBoxRowCount,,,Number,,,,,8,,,,,,,,,,,,,,,,,
|
|
9
10
|
MathExampleForm,,,,,,REST Request,REST_Request,Book Data,Book_Data,,,,1,6,,,BookData.CurrentIDBook,IDBook,CurrentIDBook,,,Number,,,,,,,,Book from REST request,Book,IDBook,LoadedBook,,,,,,,,,,,
|
|
10
11
|
MathExampleForm,,,,,,MatheMagic,MatheMagic,Math is Magic,Math_is_Magic,,,,1,1,,,HelpContent.Math,So Very Magic,MathHelpContent,,,String,,HTML,,,,,,,,,,,,,,,,,,,,
|
|
11
12
|
MathExampleForm,,,,,,Basic Geometry,Basic_Geometry,Rectangle,BasicGeoGrp,,,,1,6,,,Geometry.Rectangle.Width,Width,RectangleWidth,,,Number,,,RectangleArea = RectangleWidth * RectangleHeight,1,7.25,,,,,,,,,,,,,,,,,
|
|
12
|
-
MathExampleForm,,,,,,Basic Geometry,Basic_Geometry,Rectangle,BasicGeoGrp,,,,1,6,,,Geometry.Rectangle.Height,Height,RectangleHeight,,,Number,,,RectangleAreaRoundedDefault = ROUND(RectangleWidth * RectangleHeight),1,
|
|
13
|
+
MathExampleForm,,,,,,Basic Geometry,Basic_Geometry,Rectangle,BasicGeoGrp,,,,1,6,,,Geometry.Rectangle.Height,Height,RectangleHeight,,,Number,,,RectangleAreaRoundedDefault = ROUND(RectangleWidth * RectangleHeight),1,5,,,,,,,,,,,,,,,,,
|
|
13
14
|
MathExampleForm,,,,,,Basic Geometry,Basic_Geometry,Rectangle,BasicGeoGrp,,,,2,3,,,Geometry.Rectangle.Area,Area,RectangleArea,,unrounded,Number,,,"RectangleAreaRoundedThree = ROUND((RectangleWidth * RectangleHeight), 3)",1,,Area of the Rectangle.,,,,,,,,,,,,,,,,
|
|
14
15
|
MathExampleForm,,,,,,Basic Geometry,Basic_Geometry,Rectangle,BasicGeoGrp,,,,2,3,,,Geometry.Rectangle.AreaRoundedDefault,Area Rounded,RectangleAreaRoundedDefault,,default,Number,,,"RectangleAreaRoundedFive = ROUND(RectangleArea, 5)",1,,,,,,,,,,,,,,,,,,
|
|
15
16
|
MathExampleForm,,,,,,Basic Geometry,Basic_Geometry,Rectangle,BasicGeoGrp,,,,2,3,,,Geometry.Rectangle.AreaRoundedThree,Area Rounded 3,RectangleAreaRoundedThree,,3,Number,,,CircleArea = PI() * CircleRadius^2,1,,,,,,,,,,,,,,,,,,
|
|
@@ -96,6 +96,19 @@
|
|
|
96
96
|
},
|
|
97
97
|
"Default": "50000"
|
|
98
98
|
},
|
|
99
|
+
"Header.BoxRowCount": {
|
|
100
|
+
"Hash": "HeaderBoxRowCount",
|
|
101
|
+
"Name": "Number of Box Styles",
|
|
102
|
+
"DataAddress": "Header.BoxRowCount",
|
|
103
|
+
"DataType": "Number",
|
|
104
|
+
"PictForm": {
|
|
105
|
+
"Row": "5",
|
|
106
|
+
"Width": "12",
|
|
107
|
+
"Section": "Header",
|
|
108
|
+
"Group": "General_Info"
|
|
109
|
+
},
|
|
110
|
+
"Default": "8"
|
|
111
|
+
},
|
|
99
112
|
"BookData.CurrentIDBook": {
|
|
100
113
|
"Hash": "CurrentIDBook",
|
|
101
114
|
"Name": "IDBook",
|
|
@@ -169,7 +182,7 @@
|
|
|
169
182
|
"Section": "Basic_Geometry",
|
|
170
183
|
"Group": "BasicGeoGrp"
|
|
171
184
|
},
|
|
172
|
-
"Default": "
|
|
185
|
+
"Default": "5",
|
|
173
186
|
"AnotherObject": {
|
|
174
187
|
"NotPictForm": {
|
|
175
188
|
"y": 22
|
|
@@ -870,7 +883,9 @@
|
|
|
870
883
|
{
|
|
871
884
|
"Name": "Header",
|
|
872
885
|
"Hash": "Header",
|
|
873
|
-
"Solvers": [
|
|
886
|
+
"Solvers": [
|
|
887
|
+
"BoxRowCountSuccess = SETTABULARROWLENGTH(\"BoxCollSec\", \"BoxCollGrp\", HeaderBoxRowCount, 1)"
|
|
888
|
+
],
|
|
874
889
|
"Groups": [
|
|
875
890
|
{
|
|
876
891
|
"Name": "General Info",
|
package/package.json
CHANGED
|
@@ -91,6 +91,8 @@ class PictDynamicFormsSolverBehaviors extends libPictProvider
|
|
|
91
91
|
this.addSolverFunction(pExpressionParser, 'enablesolverordinal', 'fable.providers.DynamicFormSolverBehaviors.enableSolverOrdinal', 'Enables a solver ordinal so that it can run.');
|
|
92
92
|
this.addSolverFunction(pExpressionParser, 'disablesolverordinall', 'fable.providers.DynamicFormSolverBehaviors.disableSolverOrdinal', 'Disables a solver ordinal so that it will not run.');
|
|
93
93
|
|
|
94
|
+
this.addSolverFunction(pExpressionParser, 'settabularrowlength', 'fable.providers.DynamicFormSolverBehaviors.setTabularRowLength', 'Sets the length of a tabular data set.');
|
|
95
|
+
|
|
94
96
|
return false;
|
|
95
97
|
}
|
|
96
98
|
|
|
@@ -241,6 +243,66 @@ class PictDynamicFormsSolverBehaviors extends libPictProvider
|
|
|
241
243
|
return true;
|
|
242
244
|
}
|
|
243
245
|
|
|
246
|
+
/**
|
|
247
|
+
* Set the length of a tabular set
|
|
248
|
+
* @param {string} pSectionHash - The hash of the section containing the tabular group
|
|
249
|
+
* @param {string} pGroupHash - The hash of the tabular group
|
|
250
|
+
* @param {number|string} pLength - The desired length of the tabular set
|
|
251
|
+
* @param {boolean|string} pDeleteExtraRows - If true, will delete extra rows from the end if the length is less than current
|
|
252
|
+
* @returns
|
|
253
|
+
*/
|
|
254
|
+
setTabularRowLength(pSectionHash, pGroupHash, pLength, pDeleteExtraRows = false)
|
|
255
|
+
{
|
|
256
|
+
let tmpGroupView = this.pict.views.PictFormMetacontroller.getSectionViewFromHash(pSectionHash)
|
|
257
|
+
if (!tmpGroupView)
|
|
258
|
+
{
|
|
259
|
+
this.log.warn(`PictDynamicFormsInformary: showGroup could not find group with section hash [${pSectionHash}] group [${pGroupHash}].`);
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
let tmpGroupIndex = tmpGroupView.getGroupIndexFromHash(pGroupHash);
|
|
263
|
+
if (tmpGroupIndex < 0)
|
|
264
|
+
{
|
|
265
|
+
this.log.warn(`PictDynamicFormsInformary: setTabularRowLength could not find group with section hash [${pSectionHash}] group [${pGroupHash}].`);
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
let tmpTabularRecordSet = tmpGroupView.getTabularRecordSet(tmpGroupIndex);
|
|
269
|
+
if (!tmpTabularRecordSet || !Array.isArray(tmpTabularRecordSet))
|
|
270
|
+
{
|
|
271
|
+
this.log.warn(`PictDynamicFormsInformary: setTabularRowLength could not find a valid tabular record set with section hash [${pSectionHash}] group [${pGroupHash}].`);
|
|
272
|
+
return false;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
let tmpLength = parseInt(pLength.toString());
|
|
276
|
+
if (isNaN(tmpLength) || tmpLength < 0)
|
|
277
|
+
{
|
|
278
|
+
this.log.warn(`PictDynamicFormsInformary: setTabularRowLength was given an invalid length [${pLength}] with section hash [${pSectionHash}] group [${pGroupHash}].`);
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// See if the length is less than what we have
|
|
283
|
+
let tmpCurrentLength = tmpTabularRecordSet.length;
|
|
284
|
+
|
|
285
|
+
let tmpDeleteExtraRows = (pDeleteExtraRows == true || pDeleteExtraRows == '1');
|
|
286
|
+
|
|
287
|
+
if (tmpLength > tmpCurrentLength)
|
|
288
|
+
{
|
|
289
|
+
// Add rows until we are at the expected length
|
|
290
|
+
for (let i = tmpCurrentLength; i < tmpLength; i++)
|
|
291
|
+
{
|
|
292
|
+
tmpGroupView.createDynamicTableRow(tmpGroupIndex);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
else if (tmpLength < tmpCurrentLength && tmpDeleteExtraRows)
|
|
296
|
+
{
|
|
297
|
+
// Remove rows from the end until we are at the expected length
|
|
298
|
+
for (let i = tmpCurrentLength - 1; i >= tmpLength; i--)
|
|
299
|
+
{
|
|
300
|
+
tmpGroupView.deleteDynamicTableRow(tmpGroupIndex, i);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
|
|
244
306
|
generateHTMLHexColor(pRed, pGreen, pBlue)
|
|
245
307
|
{
|
|
246
308
|
let tmpRed = (parseInt(pRed) || 0);
|
|
@@ -902,6 +902,43 @@ class PictViewDynamicForm extends libPictViewClass
|
|
|
902
902
|
this.pict.providers.MetatemplateGenerator.rebuildCustomTemplate(this);
|
|
903
903
|
}
|
|
904
904
|
|
|
905
|
+
/**
|
|
906
|
+
* Returns the index of a group within the sectionDefinition.Groups array that matches the provided hash.
|
|
907
|
+
*
|
|
908
|
+
* @param {string} pGroupHash - The hash value of the group to find.
|
|
909
|
+
* @returns {number} The index of the group if found; otherwise, -1.
|
|
910
|
+
*/
|
|
911
|
+
getGroupIndexFromHash(pGroupHash)
|
|
912
|
+
{
|
|
913
|
+
for (let i = 0; i < this.sectionDefinition.Groups.length; i++)
|
|
914
|
+
{
|
|
915
|
+
if (this.sectionDefinition.Groups[i].Hash === pGroupHash)
|
|
916
|
+
{
|
|
917
|
+
return i;
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
this.log.warn(`PICT View Metatemplate Helper getGroupIndexByHash could not find group with hash [${pGroupHash}].`);
|
|
921
|
+
return -1;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
/**
|
|
925
|
+
* Get a group by its hash
|
|
926
|
+
* @param {string} pGroupHash - The hash of the group to retrieve.
|
|
927
|
+
* @returns {object|boolean} - The group object if found, or false if the group hash is not found.
|
|
928
|
+
*/
|
|
929
|
+
getGroupFromHash(pGroupHash)
|
|
930
|
+
{
|
|
931
|
+
for (let i = 0; i < this.sectionDefinition.Groups.length; i++)
|
|
932
|
+
{
|
|
933
|
+
if (this.sectionDefinition.Groups[i].Hash === pGroupHash)
|
|
934
|
+
{
|
|
935
|
+
return this.sectionDefinition.Groups[i];
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
this.log.warn(`PICT View Metatemplate Helper getGroupByHash could not find group with hash [${pGroupHash}].`);
|
|
939
|
+
return false;
|
|
940
|
+
}
|
|
941
|
+
|
|
905
942
|
/**
|
|
906
943
|
* Retrieves a group from the PICT View Metatemplate Helper based on the provided group index.
|
|
907
944
|
*
|