pict-section-form 1.0.111 → 1.0.113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example_applications/complex_table/Complex-Tabular-Application.js +33 -0
- package/example_applications/complex_table/html/index.html +1 -0
- package/example_applications/simple_form/Simple-Form_Default_Manifest.json +13 -1
- package/package.json +5 -5
- package/source/providers/Pict-Provider-DynamicFormSolverBehaviors.js +206 -0
- package/source/providers/Pict-Provider-DynamicSolver.js +18 -52
- package/source/providers/inputs/Pict-Provider-Input-TabGroupSelector.js +1 -0
- package/source/services/ManifestFactory.js +1 -1
- package/source/views/Pict-View-Form-Metacontroller.js +312 -12
- package/types/source/providers/Pict-Provider-DynamicFormSolverBehaviors.d.ts +46 -0
- package/types/source/providers/Pict-Provider-DynamicFormSolverBehaviors.d.ts.map +1 -0
- package/types/source/providers/Pict-Provider-DynamicSolver.d.ts.map +1 -1
- package/types/source/providers/inputs/Pict-Provider-Input-TabGroupSelector.d.ts.map +1 -1
- package/types/source/views/Pict-View-Form-Metacontroller.d.ts +48 -2
- package/types/source/views/Pict-View-Form-Metacontroller.d.ts.map +1 -1
|
@@ -566,6 +566,39 @@ module.exports.default_configuration.pict_configuration = {
|
|
|
566
566
|
},
|
|
567
567
|
|
|
568
568
|
ReferenceManifests: {
|
|
569
|
+
DynamicSection1: {
|
|
570
|
+
Scope: "DynamicSection1",
|
|
571
|
+
Descriptors: {
|
|
572
|
+
DynamicField1: {
|
|
573
|
+
Name: "Dynamic Field 1",
|
|
574
|
+
Hash: "DynamicField1",
|
|
575
|
+
DataType: "String",
|
|
576
|
+
PictForm: { Section: "DynamicSection1", Group: "DynamicGroup1", Row: 1 },
|
|
577
|
+
},
|
|
578
|
+
DynamicField2: {
|
|
579
|
+
Name: "Dynamic Field 2",
|
|
580
|
+
Hash: "DynamicField2",
|
|
581
|
+
DataType: "String",
|
|
582
|
+
PictForm: { Section: "DynamicSection1", Group: "DynamicGroup2", Row: 1 },
|
|
583
|
+
},
|
|
584
|
+
},
|
|
585
|
+
Sections: [
|
|
586
|
+
{
|
|
587
|
+
Hash: "DynamicSection1",
|
|
588
|
+
Name: "Dynamic Section 1",
|
|
589
|
+
Groups: [
|
|
590
|
+
{
|
|
591
|
+
Hash: "DynamicGroup1",
|
|
592
|
+
Name: "Dynamic Group 1",
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
Hash: "DynamicGroup2",
|
|
596
|
+
Name: "Dynamic Group 2",
|
|
597
|
+
}
|
|
598
|
+
]
|
|
599
|
+
}
|
|
600
|
+
]
|
|
601
|
+
},
|
|
569
602
|
FruitEditor: {
|
|
570
603
|
Scope: "FruitEditor",
|
|
571
604
|
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
</style>
|
|
35
35
|
</head>
|
|
36
36
|
<body>
|
|
37
|
+
<button type="button" onclick="_Pict.views.PictFormMetacontroller.injectManifestsByHash(['DynamicSection1'], 'FruitGrid'); _Pict.views.PictFormMetacontroller.updateMetatemplateInDOM();">Add Dynamic Section</button>
|
|
37
38
|
<div id="Pict-Form-Container"></div>
|
|
38
39
|
<script src="./complex_tabular_application.js" type="text/javascript"></script>
|
|
39
40
|
</body>
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
"DTPN = Height * Width",
|
|
19
19
|
"ITPNRO = Height * Width",
|
|
20
20
|
"ITDRO = Height * Width",
|
|
21
|
-
"ITPRO = Height * Width"
|
|
21
|
+
"ITPRO = Height * Width",
|
|
22
|
+
"LoggedValues = logvalues(\"ITPRO\", ITPRO)",
|
|
23
|
+
"VisibleMarshalingSection = SetSectionVisibility(\"Marshaling\", if(ITPRO,\"LT\", 10000, \"\", 1))"
|
|
22
24
|
],
|
|
23
25
|
"MetaTemplates":
|
|
24
26
|
[
|
|
@@ -88,6 +90,16 @@
|
|
|
88
90
|
,"PictForm": {"Section":"Area", "Row":4, "Width":2 }
|
|
89
91
|
},
|
|
90
92
|
|
|
93
|
+
"Help.Content":
|
|
94
|
+
{
|
|
95
|
+
"Name":"Area of a Rectangle",
|
|
96
|
+
"Hash":"HelpContent",
|
|
97
|
+
"DataType":"String",
|
|
98
|
+
"Default": "<p>To calculate the area of a rectangle, you multiply its length by its width. The length is one side of the rectangle, and the width is the adjacent side at a right angle. Since a rectangle has opposite sides that are equal and all angles are right angles, this simple multiplication gives the total space inside the rectangle, expressed in square units.</p>"
|
|
99
|
+
,"PictForm": { "InputType": "HTML", "Section":"Area", "Group":"Help" }
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
|
|
91
103
|
"DTPN":
|
|
92
104
|
{
|
|
93
105
|
"Name":"DataType PreciseNumber",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pict-section-form",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.113",
|
|
4
4
|
"description": "Pict dynamic form sections",
|
|
5
5
|
"main": "source/Pict-Section-Form.js",
|
|
6
6
|
"directories": {
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
"author": "steven velozo <steven@velozo.com>",
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@eslint/js": "^9.
|
|
30
|
+
"@eslint/js": "^9.36.0",
|
|
31
31
|
"browser-env": "^3.3.0",
|
|
32
|
-
"eslint": "^9.
|
|
32
|
+
"eslint": "^9.36.0",
|
|
33
33
|
"jquery": "^3.7.1",
|
|
34
|
-
"pict": "^1.0.
|
|
34
|
+
"pict": "^1.0.302",
|
|
35
35
|
"pict-application": "^1.0.27",
|
|
36
36
|
"pict-service-commandlineutility": "^1.0.15",
|
|
37
37
|
"quackage": "^1.0.42",
|
|
38
38
|
"tui-grid": "^4.21.22",
|
|
39
|
-
"typescript": "^5.
|
|
39
|
+
"typescript": "^5.9.2"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"fable-serviceproviderbase": "^3.0.15",
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
const libPictProvider = require('pict-provider');
|
|
2
|
+
|
|
3
|
+
// TODO: Pull this back to pict as a core service once we are happy with the shape.
|
|
4
|
+
/** @type {Record<string, any>} */
|
|
5
|
+
const _DefaultProviderConfiguration = (
|
|
6
|
+
{
|
|
7
|
+
"ProviderIdentifier": "Pict-DynamicForms-SolverBehaviors",
|
|
8
|
+
|
|
9
|
+
"AutoInitialize": false,
|
|
10
|
+
"AutoInitializeOrdinal": 0,
|
|
11
|
+
"AutoSolveWithApp": false
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Provides functions available in the solver for manipulating the form.
|
|
16
|
+
* Such as showing/hiding sections, inputs, groups. Coloring inputs,
|
|
17
|
+
* sections, groups. Applying styles to inputs, sections, groups.
|
|
18
|
+
* Extends the `libPictProvider` class.
|
|
19
|
+
*/
|
|
20
|
+
class PictDynamicFormsSolverBehaviors extends libPictProvider
|
|
21
|
+
{
|
|
22
|
+
/**
|
|
23
|
+
* Creates an instance of the `PictDynamicFormsInformary` class.
|
|
24
|
+
* @param {object} pFable - The fable object.
|
|
25
|
+
* @param {object} pOptions - The options object.
|
|
26
|
+
* @param {object} pServiceHash - The service hash object.
|
|
27
|
+
*/
|
|
28
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
29
|
+
{
|
|
30
|
+
let tmpOptions = Object.assign({}, JSON.parse(JSON.stringify(_DefaultProviderConfiguration)), pOptions);
|
|
31
|
+
|
|
32
|
+
super(pFable, tmpOptions, pServiceHash);
|
|
33
|
+
|
|
34
|
+
/** @type {any} */
|
|
35
|
+
this.options;
|
|
36
|
+
/** @type {import('pict') & { newManyfest: (options: any) => import('manyfest') }} */
|
|
37
|
+
this.pict;
|
|
38
|
+
/** @type {any} */
|
|
39
|
+
this.log;
|
|
40
|
+
|
|
41
|
+
/** @type {string} */
|
|
42
|
+
this.cssHideSectionClass = 'pict-section-form-hidden-section';
|
|
43
|
+
this.cssHideGroupClass = 'pict-section-form-hidden-group';
|
|
44
|
+
this.cssSnippet = '.pict-section-form-hidden-section { display: none; } .pict-section-form-hidden-group { display: none; }';
|
|
45
|
+
|
|
46
|
+
this.setCSSSnippets();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
setCSSSnippets(pCSSHideClass, pCSSSnippet)
|
|
50
|
+
{
|
|
51
|
+
this.cssHideClass = pCSSHideClass || this.cssHideClass;
|
|
52
|
+
this.cssSnippet = pCSSSnippet || this.cssSnippet;
|
|
53
|
+
this.pict.CSSMap.addCSS('Pict-Section-Form-SolverBehaviors', this.cssSnippet, 1001, 'Pict-DynamicForm-SolverBehaviors');
|
|
54
|
+
this.pict.CSSMap.injectCSS();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
addSolverFunction(pExpressionParser, pFunctionName, pFunctionAddress, pFunctionComment)
|
|
58
|
+
{
|
|
59
|
+
let tmpFunctionName = (pFunctionName || '').trim().toLowerCase();
|
|
60
|
+
if (pExpressionParser.functionMap.hasOwnProperty(tmpFunctionName))
|
|
61
|
+
{
|
|
62
|
+
this.log.warn(`PictDynamicFormsInformary: Function ${tmpFunctionName} already exists in the solver, overwriting with address [${pFunctionAddress}].`);
|
|
63
|
+
//return false;
|
|
64
|
+
}
|
|
65
|
+
pExpressionParser.functionMap[tmpFunctionName] = (
|
|
66
|
+
{
|
|
67
|
+
Name: pFunctionComment || `Autogenerated function ${tmpFunctionName}`,
|
|
68
|
+
Address: pFunctionAddress,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
injectBehaviors(pExpressionParser)
|
|
73
|
+
{
|
|
74
|
+
// Wire up the solver functions.
|
|
75
|
+
this.addSolverFunction(pExpressionParser, 'logValues', 'fable.providers.DynamicFormSolverBehaviors.logValues', 'Logs a set of values to the console and returns the last one.');
|
|
76
|
+
this.addSolverFunction(pExpressionParser, 'setSectionVisibility', 'fable.providers.DynamicFormSolverBehaviors.setSectionVisibility', 'Sets a sections visiblity to true or fales based on the second parameter.');
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
getSectionSelector(pSectionFormID)
|
|
81
|
+
{
|
|
82
|
+
return `#SECTION-${pSectionFormID}`;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
setSectionVisibility(pSectionHash, pVisible)
|
|
86
|
+
{
|
|
87
|
+
if (pVisible)
|
|
88
|
+
{
|
|
89
|
+
return this.showSection(pSectionHash);
|
|
90
|
+
}
|
|
91
|
+
else
|
|
92
|
+
{
|
|
93
|
+
return this.hideSection(pSectionHash);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* THESE DO NOT BELONG HERE BUT THIS WORKS FOR NOW */
|
|
98
|
+
hideSection(pSectionHash)
|
|
99
|
+
{
|
|
100
|
+
let tmpSectionView = this.pict.views.PictFormMetacontroller.getSectionViewFromHash(pSectionHash)
|
|
101
|
+
if (!tmpSectionView)
|
|
102
|
+
{
|
|
103
|
+
this.log.warn(`PictDynamicFormsInformary: hideSection could not find section with hash [${pSectionHash}].`);
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (this.pict.ContentAssignment.hasClass(this.getSectionSelector(tmpSectionView.formID), this.cssHideSectionClass))
|
|
108
|
+
{
|
|
109
|
+
// Already hidden.
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
this.pict.ContentAssignment.addClass(this.getSectionSelector(tmpSectionView.formID), this.cssHideSectionClass);
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
showSection(pSectionHash)
|
|
118
|
+
{
|
|
119
|
+
let tmpSectionView = this.pict.views.PictFormMetacontroller.getSectionViewFromHash(pSectionHash)
|
|
120
|
+
if (!tmpSectionView)
|
|
121
|
+
{
|
|
122
|
+
this.log.warn(`PictDynamicFormsInformary: showSection could not find section with hash [${pSectionHash}].`);
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (!this.pict.ContentAssignment.hasClass(this.getSectionSelector(tmpSectionView.formID), this.cssHideSectionClass))
|
|
127
|
+
{
|
|
128
|
+
// Already visible.
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
this.pict.ContentAssignment.removeClass(this.getSectionSelector(tmpSectionView.formID), this.cssHideSectionClass);
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
getGroupSelector(pSectionFormID, pGroupHash)
|
|
137
|
+
{
|
|
138
|
+
return `#GROUP-${pSectionFormID}-${pGroupHash}`;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
setGroupVisibility(pSectionHash, pGroupHash, pVisible)
|
|
142
|
+
{
|
|
143
|
+
if (pVisible)
|
|
144
|
+
{
|
|
145
|
+
return this.showGroup(pSectionHash, pGroupHash);
|
|
146
|
+
}
|
|
147
|
+
else
|
|
148
|
+
{
|
|
149
|
+
return this.hideGroup(pSectionHash, pGroupHash);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
hideGroup(pSectionHash, pGroupHash)
|
|
154
|
+
{
|
|
155
|
+
let tmpGroupView = this.pict.views.PictFormMetacontroller.getSectionViewFromHash(pSectionHash)
|
|
156
|
+
if (!tmpGroupView)
|
|
157
|
+
{
|
|
158
|
+
this.log.warn(`PictDynamicFormsInformary: hideGroup could not find group with section hash [${pSectionHash}] group [${pGroupHash}].`);
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (this.pict.ContentAssignment.hasClass(this.getGroupSelector(tmpGroupView.formID, pGroupHash), this.cssHideGroupClass))
|
|
163
|
+
{
|
|
164
|
+
// Already hidden.
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
this.pict.ContentAssignment.addClass(this.getGroupSelector(tmpGroupView.formID, pGroupHash), this.cssHideGroupClass);
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
showGroup(pSectionHash, pGroupHash)
|
|
173
|
+
{
|
|
174
|
+
let tmpGroupView = this.pict.views.PictFormMetacontroller.getSectionViewFromHash(pSectionHash)
|
|
175
|
+
if (!tmpGroupView)
|
|
176
|
+
{
|
|
177
|
+
this.log.warn(`PictDynamicFormsInformary: showGroup could not find group with section hash [${pSectionHash}] group [${pGroupHash}].`);
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (!this.pict.ContentAssignment.hasClass(this.getGroupSelector(tmpGroupView.formID, pGroupHash), this.cssHideGroupClass))
|
|
182
|
+
{
|
|
183
|
+
// Already visible.
|
|
184
|
+
return true;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
this.pict.ContentAssignment.removeClass(this.getGroupSelector(tmpGroupView.formID, pGroupHash), this.cssHideGroupClass);
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
logValues()
|
|
192
|
+
{
|
|
193
|
+
let tmpLastValue = null;
|
|
194
|
+
let tmpLogLine = 'Solver logvalues call: ';
|
|
195
|
+
for (let i = 0; i < arguments.length; i++)
|
|
196
|
+
{
|
|
197
|
+
tmpLastValue = arguments[i];
|
|
198
|
+
tmpLogLine += ` [${i}]=[${tmpLastValue}]`;
|
|
199
|
+
}
|
|
200
|
+
this.log.info(tmpLogLine);
|
|
201
|
+
return tmpLastValue;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
module.exports = PictDynamicFormsSolverBehaviors;
|
|
206
|
+
module.exports.default_configuration = _DefaultProviderConfiguration;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const libPictProvider = require('pict-provider');
|
|
2
2
|
|
|
3
|
+
const libDynamicFormSolverBehaviors = require('./Pict-Provider-DynamicFormSolverBehaviors.js');
|
|
4
|
+
|
|
3
5
|
const libListDistilling = require('./Pict-Provider-ListDistilling.js');
|
|
4
6
|
const libDynamicMetaLists = require('./Pict-Provider-MetaLists.js');
|
|
5
7
|
|
|
@@ -57,58 +59,22 @@ class PictDynamicSolver extends libPictProvider
|
|
|
57
59
|
// Initialize the solver service if it isn't up
|
|
58
60
|
this.fable.instantiateServiceProviderIfNotExists('ExpressionParser');
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (!this.pict.providers['Pict-Input-TabGroupSelector'])
|
|
77
|
-
{
|
|
78
|
-
this.pict.addProvider('Pict-Input-TabGroupSelector', libInputTabGroupSelector.default_configuration, libInputTabGroupSelector);
|
|
79
|
-
}
|
|
80
|
-
if (!this.pict.providers['Pict-Input-TabSectionSelector'])
|
|
81
|
-
{
|
|
82
|
-
this.pict.addProvider('Pict-Input-TabSectionSelector', libInputTabSectionSelector.default_configuration, libInputTabSectionSelector);
|
|
83
|
-
}
|
|
84
|
-
if (!this.pict.providers['Pict-Input-EntityBundleRequest'])
|
|
85
|
-
{
|
|
86
|
-
this.pict.addProvider('Pict-Input-EntityBundleRequest', libInputEntityBundleRequest.default_configuration, libInputEntityBundleRequest);
|
|
87
|
-
}
|
|
88
|
-
if (!this.pict.providers['Pict-Input-AutofillTriggerGroup'])
|
|
89
|
-
{
|
|
90
|
-
this.pict.addProvider('Pict-Input-AutofillTriggerGroup', libInputAutofillTriggerGroup.default_configuration, libInputAutofillTriggerGroup);
|
|
91
|
-
}
|
|
92
|
-
if (!this.pict.providers['Pict-Input-Markdown'])
|
|
93
|
-
{
|
|
94
|
-
this.pict.addProvider('Pict-Input-Markdown', libInputMarkdown.default_configuration, libInputMarkdown);
|
|
95
|
-
}
|
|
96
|
-
if (!this.pict.providers['Pict-Input-HTML'])
|
|
97
|
-
{
|
|
98
|
-
this.pict.addProvider('Pict-Input-HTML', libInputHTML.default_configuration, libInputHTML);
|
|
99
|
-
}
|
|
100
|
-
if (!this.pict.providers['Pict-Input-PreciseNumber'])
|
|
101
|
-
{
|
|
102
|
-
this.pict.addProvider('Pict-Input-PreciseNumber', libInputPreciseNumber.default_configuration, libInputPreciseNumber);
|
|
103
|
-
}
|
|
104
|
-
if (!this.pict.providers['Pict-Input-TemplatedEntityLookup'])
|
|
105
|
-
{
|
|
106
|
-
this.pict.addProvider('Pict-Input-TemplatedEntityLookup', libInputTemplatedEntityLookup.default_configuration, libInputTemplatedEntityLookup);
|
|
107
|
-
}
|
|
108
|
-
if (!this.pict.providers['Pict-Input-Link'])
|
|
109
|
-
{
|
|
110
|
-
this.pict.addProvider('Pict-Input-Link', libInputLink.default_configuration, libInputLink);
|
|
111
|
-
}
|
|
62
|
+
this.pict.addProviderSingleton('DynamicFormSolverBehaviors', libDynamicFormSolverBehaviors.default_configuration, libDynamicFormSolverBehaviors);
|
|
63
|
+
this.pict.providers.DynamicFormSolverBehaviors.injectBehaviors(this.fable.ExpressionParser);
|
|
64
|
+
this.pict.addProviderSingleton('DynamicMetaLists', libDynamicMetaLists.default_configuration, libDynamicMetaLists);
|
|
65
|
+
this.pict.addProviderSingleton('ListDistilling', libListDistilling.default_configuration, libListDistilling);
|
|
66
|
+
this.pict.addProviderSingleton('Pict-Input-Select', libInputSelect.default_configuration, libInputSelect);
|
|
67
|
+
this.pict.addProviderSingleton('Pict-Input-DateTime', libInputDateTime.default_configuration, libInputDateTime);
|
|
68
|
+
this.pict.addProviderSingleton('Pict-Input-TabGroupSelector', libInputTabGroupSelector.default_configuration, libInputTabGroupSelector);
|
|
69
|
+
this.pict.addProviderSingleton('Pict-Input-TabSectionSelector', libInputTabSectionSelector.default_configuration, libInputTabSectionSelector);
|
|
70
|
+
this.pict.addProviderSingleton('Pict-Input-EntityBundleRequest', libInputEntityBundleRequest.default_configuration, libInputEntityBundleRequest);
|
|
71
|
+
this.pict.addProviderSingleton('Pict-Input-AutofillTriggerGroup', libInputAutofillTriggerGroup.default_configuration, libInputAutofillTriggerGroup);
|
|
72
|
+
this.pict.addProviderSingleton('Pict-Input-Markdown', libInputMarkdown.default_configuration, libInputMarkdown);
|
|
73
|
+
this.pict.addProviderSingleton('Pict-Input-HTML', libInputHTML.default_configuration, libInputHTML);
|
|
74
|
+
this.pict.addProviderSingleton('Pict-Input-PreciseNumber', libInputPreciseNumber.default_configuration, libInputPreciseNumber);
|
|
75
|
+
this.pict.addProviderSingleton('Pict-Input-TemplatedEntityLookup', libInputTemplatedEntityLookup.default_configuration, libInputTemplatedEntityLookup);
|
|
76
|
+
this.pict.addProviderSingleton('Pict-Input-Link', libInputLink.default_configuration, libInputLink);
|
|
77
|
+
this.pict.addProviderSingleton('Pict-Input-Link', libInputLink.default_configuration, libInputLink);
|
|
112
78
|
}
|
|
113
79
|
|
|
114
80
|
/**
|
|
@@ -33,6 +33,7 @@ class CustomInputHandler extends libPictSectionInputExtension
|
|
|
33
33
|
this.cssHideClass = pCSSHideClass || this.cssHideClass;
|
|
34
34
|
this.cssSnippet = pCSSSnippet || this.cssSnippet;
|
|
35
35
|
this.pict.CSSMap.addCSS('Pict-Section-Form-Input-Group-TabSelector', this.cssSnippet, 1001, 'Pict-Input-TabSelector');
|
|
36
|
+
this.pict.CSSMap.injectCSS();
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
getTabSelector(pView, pInput, pGroupHash)
|
|
@@ -623,7 +623,7 @@ class ManifestFactory extends libFableServiceProviderBase
|
|
|
623
623
|
if (tmpRecord['Equation'])
|
|
624
624
|
{
|
|
625
625
|
this.log.trace(`Adding solver to ${tmpRecord.Form} --> ${tmpGroup.Name} for ${tmpRecord['Input Hash']}: ${tmpRecord['Equation']}`);
|
|
626
|
-
if (tmpGroup.Layout == 'Tabular')
|
|
626
|
+
if ((tmpGroup.Layout == 'Tabular') || (tmpGroup.Layout == 'RecordSet'))
|
|
627
627
|
{
|
|
628
628
|
tmpGroup.RecordSetSolvers.push(tmpRecord['Equation']);
|
|
629
629
|
}
|
|
@@ -166,6 +166,144 @@ class PictFormMetacontroller extends libPictViewClass
|
|
|
166
166
|
return pViewFilterState;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
/**
|
|
170
|
+
* @param {string} pSectionManifestHash - The hash of the section to find.
|
|
171
|
+
*
|
|
172
|
+
* @return {Record<string, any>} The section definition object, or undefined if not found.
|
|
173
|
+
*/
|
|
174
|
+
findDynamicSectionManifestDefinition(pSectionManifestHash)
|
|
175
|
+
{
|
|
176
|
+
const sectionManifest = this.manifestDescription?.ReferenceManifests?.[pSectionManifestHash];
|
|
177
|
+
if (typeof(sectionManifest) !== 'object')
|
|
178
|
+
{
|
|
179
|
+
this.log.error(`findDynamicSectionManifestDefinition() could not find a section manifest with hash [${pSectionManifestHash}]`);
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
return sectionManifest;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* @param {Record<string, any>} pManifest - The manifest to add
|
|
187
|
+
* @param {string} [pAfterSectionHash] - The hash of the section to add after. Omit to add to the start.
|
|
188
|
+
*/
|
|
189
|
+
injectManifest(pManifest, pAfterSectionHash)
|
|
190
|
+
{
|
|
191
|
+
const tmpAllViewKeys = Object.keys(this.pict.views);
|
|
192
|
+
const tmpReferenceManifestViewIndex = pAfterSectionHash ? tmpAllViewKeys.indexOf(`PictSectionForm-${pAfterSectionHash}`) : -1;
|
|
193
|
+
const tmpViewsToShift = [];
|
|
194
|
+
if (tmpReferenceManifestViewIndex >= 0)
|
|
195
|
+
{
|
|
196
|
+
// reorder views (hacky - add layer to do this more directly)
|
|
197
|
+
for (let i = tmpReferenceManifestViewIndex + 1; i < tmpAllViewKeys.length; i++)
|
|
198
|
+
{
|
|
199
|
+
const tmpKey = tmpAllViewKeys[i];
|
|
200
|
+
tmpViewsToShift.push({ key: tmpKey, view: this.pict.views[tmpKey] });
|
|
201
|
+
delete this.pict.views[tmpKey];
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
const tmpViewsToRender = this.bootstrapAdditiveManifest(pManifest, pAfterSectionHash);
|
|
205
|
+
for (const tmpViewToShift of tmpViewsToShift)
|
|
206
|
+
{
|
|
207
|
+
this.pict.views[tmpViewToShift.key] = tmpViewToShift.view;
|
|
208
|
+
}
|
|
209
|
+
// this ensures if we re-render everything, we have the new sections in the template
|
|
210
|
+
this.generateMetatemplate();
|
|
211
|
+
this.regenerateFormSectionTemplates();
|
|
212
|
+
//FIXME: for some reason, DOM append is not synchronous, so we need to delay the render....................?
|
|
213
|
+
setTimeout(() =>
|
|
214
|
+
{
|
|
215
|
+
for (const tmpViewToRender of tmpViewsToRender)
|
|
216
|
+
{
|
|
217
|
+
tmpViewToRender.render();
|
|
218
|
+
}
|
|
219
|
+
}, 0);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Changes:
|
|
224
|
+
* * The hashes of each section+group to be globally unique.
|
|
225
|
+
* * The data address of each element to map to a unique location.
|
|
226
|
+
*
|
|
227
|
+
* @param {Record<string, any>} pManifest - The manifest to create a distinct copy of.
|
|
228
|
+
* @param {string} [pUUID] - (optional) The UUID to use for uniqueness. If not provided, a new one will be generated.
|
|
229
|
+
*
|
|
230
|
+
* @return {Record<string, any>} A distinct copy of the manifest.
|
|
231
|
+
*/
|
|
232
|
+
createDistinctManifest(pManifest, pUUID)
|
|
233
|
+
{
|
|
234
|
+
const tmpUUID = pUUID != null ? pUUID : this.pict.getUUID().replace(/-/g, '');
|
|
235
|
+
const tmpManifest = JSON.parse(JSON.stringify(pManifest));
|
|
236
|
+
for (const tmpSection of tmpManifest.Sections || [])
|
|
237
|
+
{
|
|
238
|
+
tmpSection.Hash = `${tmpSection.Hash}_${tmpUUID}`;
|
|
239
|
+
for (const tmpGroup of tmpSection.Groups || [])
|
|
240
|
+
{
|
|
241
|
+
tmpGroup.Hash = `${tmpGroup.Hash}_${tmpUUID}`;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
const tmpNewDescriptors = {};
|
|
245
|
+
for (const [ tmpKey, tmpDescriptor ] of Object.entries(tmpManifest.Descriptors || {}))
|
|
246
|
+
{
|
|
247
|
+
//FIXME: do we want to allow prefixing the data address? (ex. nesting it under a parent object) - caller can still do this themselves.
|
|
248
|
+
tmpDescriptor.DataAddress = `${tmpDescriptor.DataAddress || tmpKey}_${tmpUUID}`;
|
|
249
|
+
if (tmpDescriptor.Hash)
|
|
250
|
+
{
|
|
251
|
+
tmpDescriptor.Hash = `${tmpDescriptor.Hash}_${tmpUUID}`;
|
|
252
|
+
}
|
|
253
|
+
if (tmpDescriptor.PictForm)
|
|
254
|
+
{
|
|
255
|
+
if (tmpDescriptor.PictForm.Section)
|
|
256
|
+
{
|
|
257
|
+
tmpDescriptor.PictForm.Section = `${tmpDescriptor.PictForm.Section}_${tmpUUID}`;
|
|
258
|
+
}
|
|
259
|
+
if (tmpDescriptor.PictForm.Group)
|
|
260
|
+
{
|
|
261
|
+
tmpDescriptor.PictForm.Group = `${tmpDescriptor.PictForm.Group}_${tmpUUID}`;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
tmpNewDescriptors[`${tmpKey}_${tmpUUID}`] = tmpDescriptor;
|
|
265
|
+
}
|
|
266
|
+
tmpManifest.Descriptors = tmpNewDescriptors;
|
|
267
|
+
return tmpManifest;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* @param {Array<string>} pManifestHashes - The hashes of the manifests to add.
|
|
272
|
+
* @param {string} [pAfterSectionHash] - The hash of the section to add after. Omit to add to the start.
|
|
273
|
+
* @param {string} [pUUID] - (optional) The UUID to use for uniqueness. If not provided, a new one will be generated.
|
|
274
|
+
*/
|
|
275
|
+
injectManifestsByHash(pManifestHashes, pAfterSectionHash, pUUID)
|
|
276
|
+
{
|
|
277
|
+
for (const tmpManifestHash of pManifestHashes)
|
|
278
|
+
{
|
|
279
|
+
const tmpManifest = this.findDynamicSectionManifestDefinition(tmpManifestHash);
|
|
280
|
+
if (tmpManifest)
|
|
281
|
+
{
|
|
282
|
+
const tmpUniqueManifest = this.createDistinctManifest(tmpManifest, pUUID);
|
|
283
|
+
this.injectManifest(tmpUniqueManifest, pAfterSectionHash);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* @param {Record<string, any>} pSectionsManifest - The section definition object.
|
|
290
|
+
* @param {string} [pAfterSectionHash] - The hash of the section to add after. Omit to add to the start.
|
|
291
|
+
*/
|
|
292
|
+
bootstrapAdditiveManifest(pSectionsManifest, pAfterSectionHash)
|
|
293
|
+
{
|
|
294
|
+
const tmpViewsToRender = [];
|
|
295
|
+
const tmpNewSectionDefinitions = this.bootstrapPictFormViewsFromManifest(pSectionsManifest, pAfterSectionHash);
|
|
296
|
+
for (const tmpNewSectionDefinition of tmpNewSectionDefinitions)
|
|
297
|
+
{
|
|
298
|
+
const tmpView = this.pict.views[`PictSectionForm-${tmpNewSectionDefinition.Hash}`];
|
|
299
|
+
if (tmpView)
|
|
300
|
+
{
|
|
301
|
+
tmpViewsToRender.push(tmpView);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return tmpViewsToRender;
|
|
305
|
+
}
|
|
306
|
+
|
|
169
307
|
/**
|
|
170
308
|
* Filters the views based on the provided filter and sort functions.
|
|
171
309
|
*
|
|
@@ -180,6 +318,7 @@ class PictFormMetacontroller extends libPictViewClass
|
|
|
180
318
|
// Generate the filter state object
|
|
181
319
|
let tmpViewFilterState = (
|
|
182
320
|
{
|
|
321
|
+
//FIXME: need to be able to control this order better - adding dynamic sections will always put them at the end, which is rarely what you want
|
|
183
322
|
ViewHashList: Object.keys(this.pict.views),
|
|
184
323
|
// If there is no customization to the filter or sort, just render the last set.
|
|
185
324
|
RenderLastRenderedViewsWithoutCustomization: true,
|
|
@@ -378,7 +517,7 @@ class PictFormMetacontroller extends libPictViewClass
|
|
|
378
517
|
|
|
379
518
|
if (!this.formTemplatePrefix)
|
|
380
519
|
{
|
|
381
|
-
this.formTemplatePrefix = this.pict.providers.MetatemplateGenerator.baseTemplatePrefix
|
|
520
|
+
this.formTemplatePrefix = this.pict.providers.MetatemplateGenerator.baseTemplatePrefix;
|
|
382
521
|
}
|
|
383
522
|
|
|
384
523
|
// Add the Form Prefix stuff
|
|
@@ -422,6 +561,100 @@ class PictFormMetacontroller extends libPictViewClass
|
|
|
422
561
|
this.pict.TemplateProvider.addTemplate(this.options.MetaTemplateHash, tmpTemplate);
|
|
423
562
|
}
|
|
424
563
|
|
|
564
|
+
/**
|
|
565
|
+
* Generates a meta template for the DynamicForm views managed by this Metacontroller.
|
|
566
|
+
*
|
|
567
|
+
* @param {Function} [fFormSectionFilter] - (optional) The filter function to apply on the form section.
|
|
568
|
+
* @param {SortFunction} [fSortFunction] - (optional) The sort function to apply on the form section.
|
|
569
|
+
*
|
|
570
|
+
* @return {void}
|
|
571
|
+
*/
|
|
572
|
+
updateMetatemplateInDOM(fFormSectionFilter, fSortFunction)
|
|
573
|
+
{
|
|
574
|
+
if (!this.formTemplatePrefix)
|
|
575
|
+
{
|
|
576
|
+
this.formTemplatePrefix = this.pict.providers.MetatemplateGenerator.baseTemplatePrefix;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
let tmpViewList = this.filterViews(fFormSectionFilter, fSortFunction);
|
|
580
|
+
let tmpPrevDiv = null;
|
|
581
|
+
let tmpDeferredDivContent;
|
|
582
|
+
let tmpDeferredDivID = null;
|
|
583
|
+
|
|
584
|
+
for (let i = 0; i < tmpViewList.length; i++)
|
|
585
|
+
{
|
|
586
|
+
let tmpFormView = tmpViewList[i];
|
|
587
|
+
if (tmpFormView === this)
|
|
588
|
+
{
|
|
589
|
+
continue;
|
|
590
|
+
}
|
|
591
|
+
if (!tmpFormView.isPictSectionForm)
|
|
592
|
+
{
|
|
593
|
+
continue;
|
|
594
|
+
}
|
|
595
|
+
if (!tmpFormView.options.IncludeInMetatemplateSectionGeneration)
|
|
596
|
+
{
|
|
597
|
+
continue;
|
|
598
|
+
}
|
|
599
|
+
const tmpFormDivID = tmpFormView.options.CustomTargetID || `Pict-${this.UUID}-${tmpFormView.options.Hash}-Wrap`;
|
|
600
|
+
let tmpFormDivs = this.pict.ContentAssignment.getElement(`#${tmpFormDivID}`);
|
|
601
|
+
if (tmpFormDivs.length > 0)
|
|
602
|
+
{
|
|
603
|
+
const tmpFormDiv = tmpFormDivs[0];
|
|
604
|
+
if (tmpDeferredDivID)
|
|
605
|
+
{
|
|
606
|
+
// We have a deferred div ID, so we need to insert it before this one
|
|
607
|
+
this.pict.ContentAssignment.insertContentBefore(`#${tmpFormDivID}`, tmpDeferredDivContent);
|
|
608
|
+
tmpDeferredDivID = null;
|
|
609
|
+
tmpDeferredDivContent = null;
|
|
610
|
+
}
|
|
611
|
+
tmpPrevDiv = tmpFormDiv;
|
|
612
|
+
continue;
|
|
613
|
+
}
|
|
614
|
+
let tmpFormDivTemplate = '';
|
|
615
|
+
if (tmpFormView.options.IncludeInMetatemplateSectionGeneration)
|
|
616
|
+
{
|
|
617
|
+
tmpFormDivTemplate += `\n{~T:${this.formTemplatePrefix}-Template-Form-Container-Wrap-Prefix:Pict.views["${tmpFormView.Hash}"]~}`;
|
|
618
|
+
if (tmpFormView.isPictSectionForm)
|
|
619
|
+
{
|
|
620
|
+
tmpFormDivTemplate += `\n{~T:${this.formTemplatePrefix}-Template-Form-Container:Pict.views["${tmpFormView.Hash}"]~}`;
|
|
621
|
+
}
|
|
622
|
+
else
|
|
623
|
+
{
|
|
624
|
+
//NOTE: For now, requiring the destination address to be an ID for this case
|
|
625
|
+
tmpFormView.options.CustomTargetID = tmpFormView.options.DefaultDestinationAddress.replace(/#/, '');
|
|
626
|
+
tmpFormDivTemplate += `\n{~T:${this.formTemplatePrefix}-Template-Form-Container-Custom:Pict.views["${tmpFormView.Hash}"]~}`;
|
|
627
|
+
}
|
|
628
|
+
tmpFormDivTemplate += `\n{~T:${this.formTemplatePrefix}-Template-Form-Container-Wrap-Postfix:Pict.views["${tmpFormView.Hash}"]~}`;
|
|
629
|
+
}
|
|
630
|
+
else if (!tmpFormView.isPictSectionForm)
|
|
631
|
+
{
|
|
632
|
+
//NOTE: For now, requiring the destination address to be an ID for this case
|
|
633
|
+
tmpFormView.options.CustomTargetID = tmpFormView.options.DefaultDestinationAddress.replace(/#/, '');
|
|
634
|
+
tmpFormDivTemplate += `\n{~T:${this.formTemplatePrefix}-Template-Form-Container-Wrap-Prefix:Pict.views["${tmpFormView.Hash}"]~}`;
|
|
635
|
+
tmpFormDivTemplate += `\n{~T:${this.formTemplatePrefix}-Template-Form-Container-Custom:Pict.views["${tmpFormView.Hash}"]~}`;
|
|
636
|
+
tmpFormDivTemplate += `\n{~T:${this.formTemplatePrefix}-Template-Form-Container-Wrap-Postfix:Pict.views["${tmpFormView.Hash}"]~}`;
|
|
637
|
+
}
|
|
638
|
+
const tmpFormDivContent = this.pict.parseTemplate(tmpFormDivTemplate, tmpFormView, null, [this]);
|
|
639
|
+
if (tmpPrevDiv)
|
|
640
|
+
{
|
|
641
|
+
this.pict.ContentAssignment.insertContentAfter(`#${tmpPrevDiv.id}`, tmpFormDivContent);
|
|
642
|
+
tmpFormDivs = this.pict.ContentAssignment.getElement(`#${tmpFormDivID}`);
|
|
643
|
+
tmpPrevDiv = tmpFormDivs;
|
|
644
|
+
continue;
|
|
645
|
+
}
|
|
646
|
+
tmpDeferredDivID = tmpFormDivID;
|
|
647
|
+
tmpDeferredDivContent = tmpFormDivContent;
|
|
648
|
+
}
|
|
649
|
+
if (tmpDeferredDivID)
|
|
650
|
+
{
|
|
651
|
+
// this means the container was empty, so just add it to the end
|
|
652
|
+
this.pict.ContentAssignment.appendContent(`#Pict-${this.UUID}-FormContainer`, tmpDeferredDivContent);
|
|
653
|
+
tmpDeferredDivID = null;
|
|
654
|
+
tmpDeferredDivContent = null;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
|
|
425
658
|
/**
|
|
426
659
|
* Retrieves a safe clone of the section definition for a given manyfest section description object.
|
|
427
660
|
*
|
|
@@ -471,13 +704,32 @@ class PictFormMetacontroller extends libPictViewClass
|
|
|
471
704
|
}
|
|
472
705
|
}
|
|
473
706
|
|
|
707
|
+
getSectionViewFromHash(pSectionHash)
|
|
708
|
+
{
|
|
709
|
+
let tmpSectionHash = (typeof(pSectionHash) === 'string') ? pSectionHash : false;
|
|
710
|
+
if (!tmpSectionHash)
|
|
711
|
+
{
|
|
712
|
+
this.log.error('getSectionViewFromHash() called without a valid section hash.');
|
|
713
|
+
return false;
|
|
714
|
+
}
|
|
715
|
+
let tmpViewHash = `PictSectionForm-${tmpSectionHash}`;
|
|
716
|
+
if (tmpViewHash in this.fable.views)
|
|
717
|
+
{
|
|
718
|
+
return this.fable.views[tmpViewHash];
|
|
719
|
+
}
|
|
720
|
+
this.log.error(`getSectionViewFromHash() could not find a view for section hash [${tmpSectionHash}].`);
|
|
721
|
+
return false;
|
|
722
|
+
}
|
|
723
|
+
|
|
474
724
|
/**
|
|
475
725
|
* Bootstraps Pict DynamicForm views from a Manyfest description JSON object.
|
|
476
726
|
*
|
|
477
727
|
* @param {Object} pManifestDescription - The manifest description object.
|
|
478
|
-
* @
|
|
728
|
+
* @param {string} [pAfterSectionHash] - The hash of the section to add after. Omit to add to the start.
|
|
729
|
+
*
|
|
730
|
+
* @returns {Array<Record<string, any>>} - An array of section definitions added.
|
|
479
731
|
*/
|
|
480
|
-
bootstrapPictFormViewsFromManifest(pManifestDescription)
|
|
732
|
+
bootstrapPictFormViewsFromManifest(pManifestDescription, pAfterSectionHash)
|
|
481
733
|
{
|
|
482
734
|
let tmpManifestDescription = (typeof(pManifestDescription) === 'object') ? pManifestDescription : false;
|
|
483
735
|
let tmpSectionList = [];
|
|
@@ -497,8 +749,51 @@ class PictFormMetacontroller extends libPictViewClass
|
|
|
497
749
|
return tmpSectionList;
|
|
498
750
|
}
|
|
499
751
|
}
|
|
500
|
-
this.manifestDescription
|
|
501
|
-
|
|
752
|
+
if (this.manifestDescription)
|
|
753
|
+
{
|
|
754
|
+
this.stashedManifestDescription = this.manifestDescription;
|
|
755
|
+
this.manifestDescription = tmpManifestDescription;
|
|
756
|
+
//FIXME: merge manifests more fully... should this be an external capability?
|
|
757
|
+
for (const [ tmpKey, tmpDescriptor ] of Object.entries(this.manifestDescription.Descriptors || {}))
|
|
758
|
+
{
|
|
759
|
+
if (this.stashedManifestDescription.Descriptors[tmpKey])
|
|
760
|
+
{
|
|
761
|
+
this.log.error(`PictFormMetacontroller.bootstrapPictFormViewsFromManifest() found a duplicate descriptor key [${tmpKey}] when merging manifests. The new descriptor will be skipped.`);
|
|
762
|
+
continue;
|
|
763
|
+
}
|
|
764
|
+
this.stashedManifestDescription.Descriptors[tmpKey] = JSON.parse(JSON.stringify(tmpDescriptor));
|
|
765
|
+
}
|
|
766
|
+
for (const tmpKey of Object.keys(this.manifestDescription.ReferenceManifests || {}))
|
|
767
|
+
{
|
|
768
|
+
if (this.stashedManifestDescription.ReferenceManifests[tmpKey])
|
|
769
|
+
{
|
|
770
|
+
this.log.warn(`PictFormMetacontroller.bootstrapPictFormViewsFromManifest() found a duplicate reference manifest key [${tmpKey}] when merging manifests. The new reference manifest will be skipped.`);
|
|
771
|
+
continue;
|
|
772
|
+
}
|
|
773
|
+
this.stashedManifestDescription.ReferenceManifests[tmpKey] = JSON.parse(JSON.stringify(this.manifestDescription.ReferenceManifests[tmpKey]));
|
|
774
|
+
}
|
|
775
|
+
let tmpInsertAtIndex = this.stashedManifestDescription.Sections.findIndex((pSection) => pSection.Hash == pAfterSectionHash);
|
|
776
|
+
if (tmpInsertAtIndex < 0)
|
|
777
|
+
{
|
|
778
|
+
tmpInsertAtIndex = 0;
|
|
779
|
+
}
|
|
780
|
+
else
|
|
781
|
+
{
|
|
782
|
+
// We want to insert AFTER the found index, so increment by 1
|
|
783
|
+
++tmpInsertAtIndex;
|
|
784
|
+
}
|
|
785
|
+
for (const tmpSection of this.manifestDescription.Sections || [])
|
|
786
|
+
{
|
|
787
|
+
const tmpClonedSection = JSON.parse(JSON.stringify(tmpSection));
|
|
788
|
+
this.stashedManifestDescription.Sections.splice(tmpInsertAtIndex, 0, tmpClonedSection);
|
|
789
|
+
++tmpInsertAtIndex;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
else
|
|
793
|
+
{
|
|
794
|
+
this.manifestDescription = tmpManifestDescription;
|
|
795
|
+
}
|
|
796
|
+
let tmpManifest = this.fable.instantiateServiceProviderWithoutRegistration('Manifest', this.manifestDescription);
|
|
502
797
|
|
|
503
798
|
if (this.options.AutoPopulateDefaultObject)
|
|
504
799
|
{
|
|
@@ -511,11 +806,11 @@ class PictFormMetacontroller extends libPictViewClass
|
|
|
511
806
|
}
|
|
512
807
|
|
|
513
808
|
// Get the list of Explicitly Defined section hashes from the Sections property of the manifest
|
|
514
|
-
if (('Sections' in
|
|
809
|
+
if (('Sections' in this.manifestDescription) && Array.isArray(this.manifestDescription.Sections))
|
|
515
810
|
{
|
|
516
|
-
for (let i = 0; i <
|
|
811
|
+
for (let i = 0; i < this.manifestDescription.Sections.length; i++)
|
|
517
812
|
{
|
|
518
|
-
let tmpSectionDefinition = this.getSectionDefinition(
|
|
813
|
+
let tmpSectionDefinition = this.getSectionDefinition(this.manifestDescription.Sections[i]);
|
|
519
814
|
|
|
520
815
|
if (tmpSectionDefinition)
|
|
521
816
|
{
|
|
@@ -581,17 +876,17 @@ class PictFormMetacontroller extends libPictViewClass
|
|
|
581
876
|
{
|
|
582
877
|
tmpViewConfiguration.Manifests = {};
|
|
583
878
|
}
|
|
584
|
-
tmpViewConfiguration.Manifests.Section =
|
|
879
|
+
tmpViewConfiguration.Manifests.Section = this.manifestDescription;
|
|
585
880
|
tmpViewConfiguration.AutoMarshalDataOnSolve = this.options.AutoMarshalDataOnSolve;
|
|
586
881
|
this.pict.addView(tmpViewHash, tmpViewConfiguration, libPictViewDynamicForm);
|
|
587
882
|
}
|
|
588
883
|
|
|
589
|
-
if ('PickLists' in
|
|
884
|
+
if ('PickLists' in this.manifestDescription)
|
|
590
885
|
{
|
|
591
|
-
let tmpPickListKeys = Object.keys(
|
|
886
|
+
let tmpPickListKeys = Object.keys(this.manifestDescription.PickLists);
|
|
592
887
|
for (let i = 0; i < tmpPickListKeys.length; i++)
|
|
593
888
|
{
|
|
594
|
-
let tmpPickList =
|
|
889
|
+
let tmpPickList = this.manifestDescription.PickLists[tmpPickListKeys[i]];
|
|
595
890
|
this.pict.providers.DynamicMetaLists.buildList(tmpPickList);
|
|
596
891
|
}
|
|
597
892
|
}
|
|
@@ -606,6 +901,11 @@ class PictFormMetacontroller extends libPictViewClass
|
|
|
606
901
|
}
|
|
607
902
|
}
|
|
608
903
|
|
|
904
|
+
if (this.stashedManifestDescription)
|
|
905
|
+
{
|
|
906
|
+
this.manifestDescription = this.stashedManifestDescription;
|
|
907
|
+
delete this.stashedManifestDescription;
|
|
908
|
+
}
|
|
609
909
|
return tmpSectionList;
|
|
610
910
|
}
|
|
611
911
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export = PictDynamicFormsSolverBehaviors;
|
|
2
|
+
/**
|
|
3
|
+
* Provides functions available in the solver for manipulating the form.
|
|
4
|
+
* Such as showing/hiding sections, inputs, groups. Coloring inputs,
|
|
5
|
+
* sections, groups. Applying styles to inputs, sections, groups.
|
|
6
|
+
* Extends the `libPictProvider` class.
|
|
7
|
+
*/
|
|
8
|
+
declare class PictDynamicFormsSolverBehaviors extends libPictProvider {
|
|
9
|
+
/**
|
|
10
|
+
* Creates an instance of the `PictDynamicFormsInformary` class.
|
|
11
|
+
* @param {object} pFable - The fable object.
|
|
12
|
+
* @param {object} pOptions - The options object.
|
|
13
|
+
* @param {object} pServiceHash - The service hash object.
|
|
14
|
+
*/
|
|
15
|
+
constructor(pFable: object, pOptions: object, pServiceHash: object);
|
|
16
|
+
/** @type {any} */
|
|
17
|
+
options: any;
|
|
18
|
+
/** @type {import('pict') & { newManyfest: (options: any) => import('manyfest') }} */
|
|
19
|
+
pict: import("pict") & {
|
|
20
|
+
newManyfest: (options: any) => import("manyfest");
|
|
21
|
+
};
|
|
22
|
+
/** @type {string} */
|
|
23
|
+
cssHideSectionClass: string;
|
|
24
|
+
cssHideGroupClass: string;
|
|
25
|
+
cssSnippet: string;
|
|
26
|
+
setCSSSnippets(pCSSHideClass: any, pCSSSnippet: any): void;
|
|
27
|
+
cssHideClass: any;
|
|
28
|
+
addSolverFunction(pExpressionParser: any, pFunctionName: any, pFunctionAddress: any, pFunctionComment: any): void;
|
|
29
|
+
injectBehaviors(pExpressionParser: any): boolean;
|
|
30
|
+
getSectionSelector(pSectionFormID: any): string;
|
|
31
|
+
setSectionVisibility(pSectionHash: any, pVisible: any): boolean;
|
|
32
|
+
hideSection(pSectionHash: any): boolean;
|
|
33
|
+
showSection(pSectionHash: any): boolean;
|
|
34
|
+
getGroupSelector(pSectionFormID: any, pGroupHash: any): string;
|
|
35
|
+
setGroupVisibility(pSectionHash: any, pGroupHash: any, pVisible: any): boolean;
|
|
36
|
+
hideGroup(pSectionHash: any, pGroupHash: any): boolean;
|
|
37
|
+
showGroup(pSectionHash: any, pGroupHash: any): boolean;
|
|
38
|
+
logValues(...args: any[]): any;
|
|
39
|
+
}
|
|
40
|
+
declare namespace PictDynamicFormsSolverBehaviors {
|
|
41
|
+
export { _DefaultProviderConfiguration as default_configuration };
|
|
42
|
+
}
|
|
43
|
+
import libPictProvider = require("pict-provider");
|
|
44
|
+
/** @type {Record<string, any>} */
|
|
45
|
+
declare const _DefaultProviderConfiguration: Record<string, any>;
|
|
46
|
+
//# sourceMappingURL=Pict-Provider-DynamicFormSolverBehaviors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pict-Provider-DynamicFormSolverBehaviors.d.ts","sourceRoot":"","sources":["../../../source/providers/Pict-Provider-DynamicFormSolverBehaviors.js"],"names":[],"mappings":";AAaA;;;;;GAKG;AACH;IAEC;;;;;OAKG;IACH,oBAJW,MAAM,YACN,MAAM,gBACN,MAAM,EAqBhB;IAbA,kBAAkB;IAClB,SADW,GAAG,CACF;IACZ,qFAAqF;IACrF,MADW,OAAO,MAAM,CAAC,GAAG;QAAE,WAAW,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,UAAU,CAAC,CAAA;KAAE,CACxE;IAIT,qBAAqB;IACrB,qBADW,MAAM,CAC4C;IAC7D,0BAAyD;IACzD,mBAA2H;IAK5H,2DAMC;IAJA,kBAAsD;IAMvD,kHAaC;IAED,iDAMC;IAED,gDAGC;IAED,gEAUC;IAGD,wCAiBC;IAED,wCAiBC;IAED,+DAGC;IAED,+EAUC;IAED,uDAiBC;IAED,uDAiBC;IAED,+BAWC;CACD;;;;;AAvMD,kCAAkC;AAClC,6CADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAQ3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pict-Provider-DynamicSolver.d.ts","sourceRoot":"","sources":["../../../source/providers/Pict-Provider-DynamicSolver.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Pict-Provider-DynamicSolver.d.ts","sourceRoot":"","sources":["../../../source/providers/Pict-Provider-DynamicSolver.js"],"names":[],"mappings":";AA8BA;;GAEG;AACH;IAEC;;;;;;OAMG;IACH,oBAJW,MAAM,YACN,MAAM,gBACN,MAAM,EAqChB;IA9BA,6BAA6B;IAC7B,MADW,OAAO,MAAM,CAAC,CAChB;IACT,gGAAgG;IAChG,OADW,OAAO,MAAM,CAAC,GAAG;QAAE,qCAAqC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,GAAG,CAAA;KAAE,CAClF;IA6BX;;;;;;;;;OASG;IACH,qBALW,MAAM,GAAC,MAAM,cACb,OAAO,aACP,MAAM,GACJ,MAAM,GAAC,SAAS,CA8B5B;IAED;;;;;;;OAOG;IACH,wDAFW,MAAM,QAyDhB;IAED;;;;;OAKG;IACH,gEAFW,MAAM,QA+BhB;IAED;;;;;OAKG;IACH,sDAFW,MAAM,QAwBhB;IAED;;;;;;;;OAQG;IACH,gCAJW,MAAM,yBAWhB;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,yBAFW,QAAM,MAAM,EAAE,QAiFxB;IADA;;;;;MAAuC;CAExC;;;;;AAhWD,kCAAkC;AAClC,6CADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAS3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pict-Provider-Input-TabGroupSelector.d.ts","sourceRoot":"","sources":["../../../../source/providers/inputs/Pict-Provider-Input-TabGroupSelector.js"],"names":[],"mappings":";AAEA;;;;;;GAMG;AACH;IAEC,2DAiBC;IAbA,6BAA6B;IAC7B,MADW,OAAO,MAAM,CAAC,CAChB;IACT,6BAA6B;IAC7B,OADW,OAAO,MAAM,CAAC,CACf;IAIV,qBAAqB;IACrB,cADW,MAAM,CAC0B;IAC3C,4BAAuD;IACvD,mBAAgH;IAKjH,
|
|
1
|
+
{"version":3,"file":"Pict-Provider-Input-TabGroupSelector.d.ts","sourceRoot":"","sources":["../../../../source/providers/inputs/Pict-Provider-Input-TabGroupSelector.js"],"names":[],"mappings":";AAEA;;;;;;GAMG;AACH;IAEC,2DAiBC;IAbA,6BAA6B;IAC7B,MADW,OAAO,MAAM,CAAC,CAChB;IACT,6BAA6B;IAC7B,OADW,OAAO,MAAM,CAAC,CACf;IAIV,qBAAqB;IACrB,cADW,MAAM,CAC0B;IAC3C,4BAAuD;IACvD,mBAAgH;IAKjH,2DAMC;IAED,iEAGC;IAED,sDAGC;IAED,6EAyCC;IAED;;;;OAIG;IACH,wCAHW,MAAM,GACJ,MAAM,CAKlB;CA0CD"}
|
|
@@ -44,6 +44,39 @@ declare class PictFormMetacontroller extends libPictViewClass {
|
|
|
44
44
|
onSolve(): any;
|
|
45
45
|
onBeforeFilterViews(pViewFilterState: any): any;
|
|
46
46
|
onAfterFilterViews(pViewFilterState: any): any;
|
|
47
|
+
/**
|
|
48
|
+
* @param {string} pSectionManifestHash - The hash of the section to find.
|
|
49
|
+
*
|
|
50
|
+
* @return {Record<string, any>} The section definition object, or undefined if not found.
|
|
51
|
+
*/
|
|
52
|
+
findDynamicSectionManifestDefinition(pSectionManifestHash: string): Record<string, any>;
|
|
53
|
+
/**
|
|
54
|
+
* @param {Record<string, any>} pManifest - The manifest to add
|
|
55
|
+
* @param {string} [pAfterSectionHash] - The hash of the section to add after. Omit to add to the start.
|
|
56
|
+
*/
|
|
57
|
+
injectManifest(pManifest: Record<string, any>, pAfterSectionHash?: string): void;
|
|
58
|
+
/**
|
|
59
|
+
* Changes:
|
|
60
|
+
* * The hashes of each section+group to be globally unique.
|
|
61
|
+
* * The data address of each element to map to a unique location.
|
|
62
|
+
*
|
|
63
|
+
* @param {Record<string, any>} pManifest - The manifest to create a distinct copy of.
|
|
64
|
+
* @param {string} [pUUID] - (optional) The UUID to use for uniqueness. If not provided, a new one will be generated.
|
|
65
|
+
*
|
|
66
|
+
* @return {Record<string, any>} A distinct copy of the manifest.
|
|
67
|
+
*/
|
|
68
|
+
createDistinctManifest(pManifest: Record<string, any>, pUUID?: string): Record<string, any>;
|
|
69
|
+
/**
|
|
70
|
+
* @param {Array<string>} pManifestHashes - The hashes of the manifests to add.
|
|
71
|
+
* @param {string} [pAfterSectionHash] - The hash of the section to add after. Omit to add to the start.
|
|
72
|
+
* @param {string} [pUUID] - (optional) The UUID to use for uniqueness. If not provided, a new one will be generated.
|
|
73
|
+
*/
|
|
74
|
+
injectManifestsByHash(pManifestHashes: Array<string>, pAfterSectionHash?: string, pUUID?: string): void;
|
|
75
|
+
/**
|
|
76
|
+
* @param {Record<string, any>} pSectionsManifest - The section definition object.
|
|
77
|
+
* @param {string} [pAfterSectionHash] - The hash of the section to add after. Omit to add to the start.
|
|
78
|
+
*/
|
|
79
|
+
bootstrapAdditiveManifest(pSectionsManifest: Record<string, any>, pAfterSectionHash?: string): any[];
|
|
47
80
|
/**
|
|
48
81
|
* Filters the views based on the provided filter and sort functions.
|
|
49
82
|
*
|
|
@@ -93,6 +126,15 @@ declare class PictFormMetacontroller extends libPictViewClass {
|
|
|
93
126
|
* @returns {void}
|
|
94
127
|
*/
|
|
95
128
|
generateMetatemplate(fFormSectionFilter?: Function, fSortFunction?: SortFunction): void;
|
|
129
|
+
/**
|
|
130
|
+
* Generates a meta template for the DynamicForm views managed by this Metacontroller.
|
|
131
|
+
*
|
|
132
|
+
* @param {Function} [fFormSectionFilter] - (optional) The filter function to apply on the form section.
|
|
133
|
+
* @param {SortFunction} [fSortFunction] - (optional) The sort function to apply on the form section.
|
|
134
|
+
*
|
|
135
|
+
* @return {void}
|
|
136
|
+
*/
|
|
137
|
+
updateMetatemplateInDOM(fFormSectionFilter?: Function, fSortFunction?: SortFunction): void;
|
|
96
138
|
/**
|
|
97
139
|
* Retrieves a safe clone of the section definition for a given manyfest section description object.
|
|
98
140
|
*
|
|
@@ -100,13 +142,17 @@ declare class PictFormMetacontroller extends libPictViewClass {
|
|
|
100
142
|
* @returns {object|boolean} - The section definition if successful, otherwise false.
|
|
101
143
|
*/
|
|
102
144
|
getSectionDefinition(pSectionObject: object): object | boolean;
|
|
145
|
+
getSectionViewFromHash(pSectionHash: any): any;
|
|
103
146
|
/**
|
|
104
147
|
* Bootstraps Pict DynamicForm views from a Manyfest description JSON object.
|
|
105
148
|
*
|
|
106
149
|
* @param {Object} pManifestDescription - The manifest description object.
|
|
107
|
-
* @
|
|
150
|
+
* @param {string} [pAfterSectionHash] - The hash of the section to add after. Omit to add to the start.
|
|
151
|
+
*
|
|
152
|
+
* @returns {Array<Record<string, any>>} - An array of section definitions added.
|
|
108
153
|
*/
|
|
109
|
-
bootstrapPictFormViewsFromManifest(pManifestDescription: any): any
|
|
154
|
+
bootstrapPictFormViewsFromManifest(pManifestDescription: any, pAfterSectionHash?: string): Array<Record<string, any>>;
|
|
155
|
+
stashedManifestDescription: any;
|
|
110
156
|
manifestDescription: any;
|
|
111
157
|
/**
|
|
112
158
|
* Trigger an event on all inputs on all views.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pict-View-Form-Metacontroller.d.ts","sourceRoot":"","sources":["../../../source/views/Pict-View-Form-Metacontroller.js"],"names":[],"mappings":";AASA;;GAEG;AAEH;;;;;;GAMG;AACH;IAEC,2DAaC;IALA,yBAA2B;IAE3B,wBAAsF;IAEtF,cAAkC;IAQnC,wCAGC;IARD,kCAGC;IAOD;;;;OAIG;IACH,qBAFa,GAAG,CAaf;IAED;;;;OAIG;IACH,mBAFa,GAAG,CAaf;IAED,yCAYC;IAED;;;;;OAKG;IACH,kCAHW,aAAa,GACX,IAAI,CAsBhB;IAwBD;;;;OAIG;IACH,WAFa,GAAG,CAMf;IAED,gDAGC;IAED,+CAGC;IAED;;;;;;;;OAQG;IACH,wDAHW,YAAY,
|
|
1
|
+
{"version":3,"file":"Pict-View-Form-Metacontroller.d.ts","sourceRoot":"","sources":["../../../source/views/Pict-View-Form-Metacontroller.js"],"names":[],"mappings":";AASA;;GAEG;AAEH;;;;;;GAMG;AACH;IAEC,2DAaC;IALA,yBAA2B;IAE3B,wBAAsF;IAEtF,cAAkC;IAQnC,wCAGC;IARD,kCAGC;IAOD;;;;OAIG;IACH,qBAFa,GAAG,CAaf;IAED;;;;OAIG;IACH,mBAFa,GAAG,CAaf;IAED,yCAYC;IAED;;;;;OAKG;IACH,kCAHW,aAAa,GACX,IAAI,CAsBhB;IAwBD;;;;OAIG;IACH,WAFa,GAAG,CAMf;IAED,gDAGC;IAED,+CAGC;IAED;;;;OAIG;IACH,2DAJW,MAAM,GAEL,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAW9B;IAED;;;OAGG;IACH,0BAHW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,sBACnB,MAAM,QAiChB;IAED;;;;;;;;;OASG;IACH,kCALW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,UACnB,MAAM,GAEL,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAsC9B;IAED;;;;OAIG;IACH,uCAJW,KAAK,CAAC,MAAM,CAAC,sBACb,MAAM,UACN,MAAM,QAahB;IAED;;;OAGG;IACH,6CAHW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,sBACnB,MAAM,SAehB;IAED;;;;;;;;OAQG;IACH,wDAHW,YAAY,SAoHtB;IAED;;;;;;;OAOG;IACH,4CAHW,MAAM,GACJ,IAAI,CAShB;IAED;;;;OAIG;IACH,6BAFa,IAAI,CAQhB;IAED;;;;;;;OAOG;IACH,+DAFW,YAAY,QAatB;IAED;;;;;OAKG;IACH,8EAFW,YAAY,QAmBtB;IAED;;;;;;OAMG;IACH,oEAHW,YAAY,GACV,IAAI,CAkDhB;IAED;;;;;;;OAOG;IACH,uEAJW,YAAY,GAEX,IAAI,CAsFf;IAED;;;;;OAKG;IACH,qCAHW,MAAM,GACJ,MAAM,GAAC,OAAO,CA2C1B;IAED,+CAeC;IAED;;;;;;;OAOG;IACH,kFAJW,MAAM,GAEJ,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAoLtC;IA5JC,gCAA0D;IAC1D,yBAAiD;IA6JnD;;;OAGG;IACH,gCAFW,MAAM,QAgBhB;IAED;;;;OAIG;IACH,4BAFa,OAAO,CAKnB;CACD;;;;;qCAGU,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;oBAr6BjB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,KAAK,MAAM"}
|