pict-section-form 1.0.101 → 1.0.103
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/postcard_example/README.md +6 -0
- package/example_applications/postcard_example/providers/PictProvider-BestPostcardTheme.js +3 -3
- package/example_applications/postcard_example/providers/PictProvider-Dynamic-Sections.js +42 -2
- package/example_applications/postcard_example/views/PictView-Postcard-DynamicInputs.js +45 -4
- package/example_applications/postcard_example/views/PictView-Postcard-Navigation.json +2 -2
- package/package.json +2 -2
- package/source/providers/Pict-Provider-DynamicTemplates.js +6 -0
- package/source/providers/Pict-Provider-MetaLists.js +7 -0
- package/source/providers/Pict-Provider-MetatemplateGenerator.js +12 -7
- package/source/providers/inputs/Pict-Provider-Input-AutofillTriggerGroup.js +2 -2
- package/source/providers/inputs/Pict-Provider-Input-EntityBundleRequest.js +3 -3
- package/source/providers/inputs/Pict-Provider-Input-TabSectionSelector.js +1 -1
- package/source/templates/Pict-Template-ControlFromDynamicManifest.js +1 -1
- package/source/templates/Pict-Template-ControlFromDynamicManifestForHash.js +1 -1
- package/source/templates/Pict-Template-DyanmicView-Value.js +1 -1
- package/source/templates/Pict-Template-DyanmicView-ValueByHash.js +1 -1
- package/source/templates/Pict-Template-Metatemplate-InputWithHashAddress.js +1 -1
- package/source/templates/Pict-Template-Metatemplate-InputWithView.js +224 -0
- package/source/templates/Pict-Template-Metatemplate-InputWithViewAndDescriptorAddress.js +225 -0
- package/source/templates/Pict-Template-Metatemplate-InputWithViewAndHashAddress.js +244 -0
- package/source/views/Pict-View-DynamicForm.js +5 -5
- package/source/views/Pict-View-Form-Metacontroller.js +0 -17
- package/test/PictSectionForm-Basic_tests.js +2 -0
- package/types/source/providers/Pict-Provider-DynamicTemplates.d.ts.map +1 -1
- package/types/source/providers/Pict-Provider-Informary.d.ts +2 -2
- package/types/source/providers/Pict-Provider-Informary.d.ts.map +1 -1
- package/types/source/providers/Pict-Provider-MetaLists.d.ts.map +1 -1
- package/types/source/providers/Pict-Provider-MetatemplateGenerator.d.ts +3 -1
- package/types/source/providers/Pict-Provider-MetatemplateGenerator.d.ts.map +1 -1
- package/types/source/templates/Pict-Template-Metatemplate-InputWithView.d.ts +35 -0
- package/types/source/templates/Pict-Template-Metatemplate-InputWithView.d.ts.map +1 -0
- package/types/source/templates/Pict-Template-Metatemplate-InputWithViewAndDescriptorAddress.d.ts +37 -0
- package/types/source/templates/Pict-Template-Metatemplate-InputWithViewAndDescriptorAddress.d.ts.map +1 -0
- package/types/source/templates/Pict-Template-Metatemplate-InputWithViewAndHashAddress.d.ts +35 -0
- package/types/source/templates/Pict-Template-Metatemplate-InputWithViewAndHashAddress.d.ts.map +1 -0
- package/types/source/views/Pict-View-DynamicForm.d.ts.map +1 -1
- package/types/source/views/Pict-View-Form-Metacontroller.d.ts +0 -8
- package/types/source/views/Pict-View-Form-Metacontroller.d.ts.map +1 -1
|
@@ -18,3 +18,9 @@ how you can also use configuration to display basic content or other html templa
|
|
|
18
18
|
|
|
19
19
|
By leveraging some of the more rich `{~Entity:` and such jellyfish templates, these
|
|
20
20
|
configuration-only views can be fairly capable (not just static HTML content).
|
|
21
|
+
|
|
22
|
+
## Data Marhsalling
|
|
23
|
+
|
|
24
|
+
Note for long time enjoyers of Postkard, the data marshalling has changed a bit. You
|
|
25
|
+
no longer need to manually marshal using the navigation. Look forward to a new manual
|
|
26
|
+
marhsalling example in the future.
|
|
@@ -76,7 +76,7 @@ Glug glug CUSTOMIZED glug Oo... -->
|
|
|
76
76
|
"Template": /*HTML*/`
|
|
77
77
|
<div class="pure-u-1 pure-u-md-1-3">
|
|
78
78
|
<label {~D:Record.Macro.HTMLForID~}>{~D:Record.Name~}:</label>
|
|
79
|
-
<input type="text" {~D:Record.Macro.HTMLID~} {~D:Record.Macro.InputFullProperties~} class="pure-u-23-24" />
|
|
79
|
+
<input type="text" {~D:Record.Macro.HTMLID~} {~D:Record.Macro.InputFullProperties~} {~D:Record.Macro.InputChangeHandler~} class="pure-u-23-24" />
|
|
80
80
|
</div>
|
|
81
81
|
`
|
|
82
82
|
},
|
|
@@ -85,7 +85,7 @@ Glug glug CUSTOMIZED glug Oo... -->
|
|
|
85
85
|
"Template": /*HTML*/`
|
|
86
86
|
<div class="pure-u-1 pure-u-md-1-3">
|
|
87
87
|
<label {~D:Record.Macro.HTMLForID~}>{~D:Record.Name~}:</label>
|
|
88
|
-
<input type="text" {~D:Record.Macro.HTMLID~} {~D:Record.Macro.InputFullProperties~} class="pure-u-23-24" />
|
|
88
|
+
<input type="text" {~D:Record.Macro.HTMLID~} {~D:Record.Macro.InputFullProperties~} {~D:Record.Macro.InputChangeHandler~} class="pure-u-23-24" />
|
|
89
89
|
</div>
|
|
90
90
|
`
|
|
91
91
|
},
|
|
@@ -113,7 +113,7 @@ Glug glug CUSTOMIZED glug Oo... -->
|
|
|
113
113
|
"Template": /*HTML*/`
|
|
114
114
|
<div class="pure-u-1 pure-u-md-1-3">
|
|
115
115
|
<label {~D:Record.Macro.HTMLForID~}><em>{~D:Record.Name~}:</em></label>
|
|
116
|
-
<input type="text" {~D:Record.Macro.CustomPictSettingsProperty~} {~D:Record.Macro.DirectAssignment~} {~D:Record.Macro.HTMLID~} {~D:Record.Macro.InputFullProperties~} class="pure-u-23-24" />
|
|
116
|
+
<input type="text" {~D:Record.Macro.CustomPictSettingsProperty~} {~D:Record.Macro.DirectAssignment~} {~D:Record.Macro.HTMLID~} {~D:Record.Macro.InputFullProperties~} {~D:Record.Macro.InputChangeHandler~} class="pure-u-23-24" />
|
|
117
117
|
<a href="#" onclick="{~P~}.views['{~D:Context[0].Hash~}'].inputEvent('{~D:Record.Hash~}', 'BestEventEvarrrr')" class="pure-button">Sign</a>
|
|
118
118
|
</div>
|
|
119
119
|
`
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const libPictProvider = require('pict-provider');
|
|
2
|
+
const libPictViewDynamicForm = require('../../../source/views/Pict-View-DynamicForm.js');
|
|
2
3
|
|
|
3
|
-
const _DEFAULT_PROVIDER_CONFIGURATION =
|
|
4
|
+
const _DEFAULT_PROVIDER_CONFIGURATION =
|
|
4
5
|
{
|
|
5
6
|
ProviderIdentifier: 'Postcard-DynamicSection-Provider',
|
|
6
7
|
|
|
@@ -18,6 +19,45 @@ class PostcardDynamicSectionProvider extends libPictProvider
|
|
|
18
19
|
|
|
19
20
|
onInitializeAsync(fCallback)
|
|
20
21
|
{
|
|
22
|
+
const tmpDynamicInputViewSection = (
|
|
23
|
+
{
|
|
24
|
+
"Hash": "PostkardDynamicInputs",
|
|
25
|
+
"Name": "Custom Dynamic Inputs",
|
|
26
|
+
"ViewHash": "MyDynamicView",
|
|
27
|
+
|
|
28
|
+
"AutoMarshalDataOnSolve": true,
|
|
29
|
+
"IncludeInMetatemplateSectionGeneration": false,
|
|
30
|
+
|
|
31
|
+
"Manifests": {
|
|
32
|
+
"Section": {
|
|
33
|
+
"Scope": "PostkardDyanmic",
|
|
34
|
+
"Sections": [
|
|
35
|
+
{
|
|
36
|
+
"Hash": "PostkardDynamicInputs",
|
|
37
|
+
"Name": "Dynamic Inputs"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"Descriptors": {
|
|
41
|
+
"Postkard.DynamicInputPlaceholder": {
|
|
42
|
+
"Name": "DynamicInputPlaceholder",
|
|
43
|
+
"Hash": "DynamicInputPlaceholder",
|
|
44
|
+
"DataType": "String",
|
|
45
|
+
"Macro": {
|
|
46
|
+
"HTMLSelector": ""
|
|
47
|
+
},
|
|
48
|
+
"PictForm": {
|
|
49
|
+
"Section": "PostkardDynamicInputs"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
if (!(tmpDynamicInputViewSection.ViewHash in this.pict.views))
|
|
58
|
+
{
|
|
59
|
+
this.pict.addView(tmpDynamicInputViewSection.ViewHash, Object.assign({}, tmpDynamicInputViewSection), libPictViewDynamicForm);
|
|
60
|
+
}
|
|
21
61
|
this.log.info('PostcardDynamicSectionProvider.onInitializeAsync() called --- loading dynamic section views from "server".');
|
|
22
62
|
// Load the dynamnic section views from the server
|
|
23
63
|
this.pict.settings.DefaultFormManifest = require('./PictProvider-Dynamic-Sections-MockServerResponse.json');
|
|
@@ -28,4 +68,4 @@ class PostcardDynamicSectionProvider extends libPictProvider
|
|
|
28
68
|
}
|
|
29
69
|
|
|
30
70
|
module.exports = PostcardDynamicSectionProvider;
|
|
31
|
-
module.exports.default_configuration = _DEFAULT_PROVIDER_CONFIGURATION;
|
|
71
|
+
module.exports.default_configuration = _DEFAULT_PROVIDER_CONFIGURATION;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const libPictView = require('pict-view');
|
|
2
|
-
const { isTemplateSpan } = require('typescript');
|
|
3
2
|
|
|
4
3
|
const _ViewConfiguration = (
|
|
5
4
|
{
|
|
@@ -26,6 +25,8 @@ and
|
|
|
26
25
|
|
|
27
26
|
{~MTI:Second funny place for the data's storage, yo...:DynamoData.SomeFunnyPlaceForTheDataAsASignatureInputType:String:PostKardSignature~}
|
|
28
27
|
|
|
28
|
+
{~IWVDA:MyDynamicView:AppData.CustomDescriptor~}
|
|
29
|
+
|
|
29
30
|
<br />
|
|
30
31
|
|
|
31
32
|
<a href="#" onclick="_Pict.views.PostcardDynamicInputs.makeMoreInputs();" class="button">Add More Inputs</a>
|
|
@@ -43,7 +44,7 @@ and
|
|
|
43
44
|
}]
|
|
44
45
|
});
|
|
45
46
|
|
|
46
|
-
class
|
|
47
|
+
class PostcardDynamicInputsView extends libPictView
|
|
47
48
|
{
|
|
48
49
|
constructor(pFable, pOptions, pServiceHash)
|
|
49
50
|
{
|
|
@@ -52,21 +53,61 @@ class PostcardMainApplicationView extends libPictView
|
|
|
52
53
|
this.inputCounter = 0;
|
|
53
54
|
}
|
|
54
55
|
|
|
56
|
+
onInitialize()
|
|
57
|
+
{
|
|
58
|
+
this.pict.AppData.CustomDescriptor =
|
|
59
|
+
{
|
|
60
|
+
Hash: 'CustomPostkardData',
|
|
61
|
+
Name: 'Custom PostKard Data',
|
|
62
|
+
Address: 'CustomPostkardData',
|
|
63
|
+
DataType: 'String',
|
|
64
|
+
PictForm:
|
|
65
|
+
{
|
|
66
|
+
InputType: 'TexaArea',
|
|
67
|
+
Description: 'This is a custom descriptor for the PostKard application.',
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
return super.onInitialize();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
onAfterRender()
|
|
74
|
+
{
|
|
75
|
+
this.pict.PictApplication.marshalToViews();
|
|
76
|
+
return super.onAfterRender();
|
|
77
|
+
}
|
|
78
|
+
|
|
55
79
|
makeMoreInputs()
|
|
56
80
|
{
|
|
57
81
|
let tmpDefectInput = {
|
|
58
82
|
SpecificDefectHash: this.fable.getUUID(),
|
|
59
83
|
InputCounter: this.inputCounter++
|
|
60
84
|
};
|
|
85
|
+
if (!Array.isArray(this.pict.AppData.CustomDescriptors))
|
|
86
|
+
{
|
|
87
|
+
this.pict.AppData.CustomDescriptors = [];
|
|
88
|
+
}
|
|
89
|
+
const tmpIndex = this.pict.AppData.CustomDescriptors.length;
|
|
90
|
+
this.pict.AppData.CustomDescriptors.push(
|
|
91
|
+
{
|
|
92
|
+
Hash: `CustomPostkardData${tmpIndex}`,
|
|
93
|
+
Name: `Custom PostKard Data ${tmpIndex}`,
|
|
94
|
+
Address: `CustomPostkardData${tmpIndex}`,
|
|
95
|
+
DataType: 'PreciseNumber',
|
|
96
|
+
PictForm:
|
|
97
|
+
{
|
|
98
|
+
Description: 'This is a custom descriptor for the PostKard application.',
|
|
99
|
+
},
|
|
100
|
+
});
|
|
61
101
|
|
|
62
|
-
this.pict.parseTemplate(
|
|
102
|
+
this.pict.parseTemplate(`<p>Input Numero {~D:Record.InputCounter~}: {~MTIWHA:Nombre:Record.SpecificDefectHash:String~} {~IWVDA:MyDynamicView:AppData.CustomDescriptors[${tmpIndex}]~}</p>`, tmpDefectInput,
|
|
63
103
|
function (pError, pParsedTemplate)
|
|
64
104
|
{
|
|
65
105
|
this.pict.ContentAssignment.appendContent('#DynamicInputContainer', pParsedTemplate);
|
|
106
|
+
this.pict.PictApplication.marshalToViews();
|
|
66
107
|
}.bind(this));
|
|
67
108
|
}
|
|
68
109
|
}
|
|
69
110
|
|
|
70
|
-
module.exports =
|
|
111
|
+
module.exports = PostcardDynamicInputsView;
|
|
71
112
|
|
|
72
113
|
module.exports.default_configuration = _ViewConfiguration;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"Templates": [
|
|
12
12
|
{
|
|
13
13
|
"Hash": "Postcard-Top-Navigation",
|
|
14
|
-
"Template": "<span class=\"pure-menu-heading\">Postkard</span><ul class=\"pure-menu-list\"><li class=\"pure-menu-item\"><a href=\"#\" onclick=\"{~P~}.views.PostcardMainApplication.render()\" class=\"pure-menu-link\">Send a Kard</a></li><li class=\"pure-menu-item\"><a href=\"#\" onclick=\"{~P~}.views.PostcardAbout.render()\" class=\"pure-menu-link\">About</a></li><li class=\"pure-menu-item\"><a href=\"#\" onclick=\"{~P~}.views.PostcardLegal.render()\" class=\"pure-menu-link\">Legal</a></li><li class=\"pure-menu-item menu-item-divided\"><a href=\"#\" onclick=\"{~P~}.PictApplication.
|
|
14
|
+
"Template": "<span class=\"pure-menu-heading\">Postkard</span><ul class=\"pure-menu-list\"><li class=\"pure-menu-item\"><a href=\"#\" onclick=\"{~P~}.views.PostcardMainApplication.render()\" class=\"pure-menu-link\">Send a Kard</a></li><li class=\"pure-menu-item\"><a href=\"#\" onclick=\"{~P~}.views.PostcardAbout.render()\" class=\"pure-menu-link\">About</a></li><li class=\"pure-menu-item\"><a href=\"#\" onclick=\"{~P~}.views.PostcardLegal.render()\" class=\"pure-menu-link\">Legal</a></li><li class=\"pure-menu-item menu-item-divided\"><a href=\"#\" onclick=\"{~P~}.PictApplication.changeToPostcardTheme()\" class=\"pure-menu-link\">Postkard Pure CSS Theme</a></li><li class=\"pure-menu-item\"><a href=\"#\" onclick=\"{~P~}.PictApplication.changeToDefaultTheme()\" class=\"pure-menu-link\">Pict Raw HTML Form Theme</a></li><li class=\"pure-menu-item\"><a href=\"#\" onclick=\"{~P~}.views.PostcardDynamicInputs.render()\" class=\"pure-menu-link\">Dynamo</a></li></ul>"
|
|
15
15
|
}
|
|
16
16
|
],
|
|
17
17
|
"Renderables": [
|
|
@@ -21,4 +21,4 @@
|
|
|
21
21
|
"DestinationAddress": "#Postcard-Navigation-Container"
|
|
22
22
|
}
|
|
23
23
|
]
|
|
24
|
-
}
|
|
24
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pict-section-form",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.103",
|
|
4
4
|
"description": "Pict dynamic form sections",
|
|
5
5
|
"main": "source/Pict-Section-Form.js",
|
|
6
6
|
"directories": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"browser-env": "^3.3.0",
|
|
32
32
|
"eslint": "^9.26.0",
|
|
33
33
|
"jquery": "^3.7.1",
|
|
34
|
-
"pict": "^1.0.
|
|
34
|
+
"pict": "^1.0.277",
|
|
35
35
|
"pict-application": "^1.0.27",
|
|
36
36
|
"pict-service-commandlineutility": "^1.0.15",
|
|
37
37
|
"quackage": "^1.0.42",
|
|
@@ -8,6 +8,9 @@ const templateSetReadOnlyTemplates = require('./dynamictemplates/Pict-DynamicTem
|
|
|
8
8
|
const libTemplateValueSetWithGroup = require('../templates/Pict-Template-Metacontroller-ValueSetWithGroup.js');
|
|
9
9
|
const libTemplateDynamicInput = require('../templates/Pict-Template-Metatemplate-Input.js');
|
|
10
10
|
const libTemplateDynamicInputWithHashAddress = require('../templates/Pict-Template-Metatemplate-InputWithHashAddress.js');
|
|
11
|
+
const libTemplateDynamicInputWithView = require('../templates/Pict-Template-Metatemplate-InputWithView.js');
|
|
12
|
+
const libTemplateDynamicInputWithViewAndHashAddress = require('../templates/Pict-Template-Metatemplate-InputWithViewAndHashAddress.js');
|
|
13
|
+
const libTemplateDynamicInputWithViewAndDescriptorAddress = require('../templates/Pict-Template-Metatemplate-InputWithViewAndDescriptorAddress.js');
|
|
11
14
|
const libTemplateControlFromDynamicManifest = require('../templates/Pict-Template-ControlFromDynamicManifest.js');
|
|
12
15
|
const libTemplateControlFromDynamicManifestForHash = require('../templates/Pict-Template-ControlFromDynamicManifestForHash.js');
|
|
13
16
|
const libTemplateGetViewSchemaValue = require('../templates/Pict-Template-DyanmicView-Value.js');
|
|
@@ -58,6 +61,9 @@ class PictDynamicFormsTemplates extends libPictProvider
|
|
|
58
61
|
this.pict.addTemplate(libTemplateValueSetWithGroup);
|
|
59
62
|
this.pict.addTemplate(libTemplateDynamicInput);
|
|
60
63
|
this.pict.addTemplate(libTemplateDynamicInputWithHashAddress);
|
|
64
|
+
this.pict.addTemplate(libTemplateDynamicInputWithView);
|
|
65
|
+
this.pict.addTemplate(libTemplateDynamicInputWithViewAndHashAddress);
|
|
66
|
+
this.pict.addTemplate(libTemplateDynamicInputWithViewAndDescriptorAddress);
|
|
61
67
|
this.pict.addTemplate(libTemplatePluckJoinUnique);
|
|
62
68
|
this.pict.addTemplate(libTemplateControlFromDynamicManifest);
|
|
63
69
|
this.pict.addTemplate(libTemplateControlFromDynamicManifestForHash);
|
|
@@ -168,6 +168,13 @@ class PictMetalist extends libPictProvider
|
|
|
168
168
|
return false;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
if (!this.pict.views.PictFormMetacontroller)
|
|
172
|
+
{
|
|
173
|
+
this.log.error(`Dynamic MetaList Provider [${this.UUID}]::[${this.Hash}] requires PictFormMetacontroller but not found. Skipping.`);
|
|
174
|
+
this.computedLists[pListObject.Hash] = [];
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
|
|
171
178
|
// Now try to fetch the list data
|
|
172
179
|
let tmpListData = this.pict.views.PictFormMetacontroller.getValueByHash(pListObject.ListSourceAddress);
|
|
173
180
|
if (!tmpListData)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const libPictProvider = require('pict-provider');
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const libPictViewDynamicForm = require('../views/Pict-View-DynamicForm.js');
|
|
4
4
|
|
|
5
5
|
/** @type {Record<string, any>} */
|
|
6
6
|
const _DefaultProviderConfiguration = (
|
|
@@ -65,7 +65,8 @@ class PictMetatemplateGenerator extends libPictProvider
|
|
|
65
65
|
/** @type {any} */
|
|
66
66
|
this.log;
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
/** @type {libPictViewDynamicForm} */
|
|
69
|
+
this.dynamicInputView;
|
|
69
70
|
|
|
70
71
|
this.baseTemplatePrefix = "Pict-MT-Base";
|
|
71
72
|
}
|
|
@@ -78,12 +79,16 @@ class PictMetatemplateGenerator extends libPictProvider
|
|
|
78
79
|
|
|
79
80
|
createOnDemandMetatemplateView()
|
|
80
81
|
{
|
|
81
|
-
|
|
82
|
+
const tmpViewConfiguration = JSON.parse(JSON.stringify(_DynamicInputViewSection));
|
|
82
83
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
if (tmpViewConfiguration.ViewHash in this.pict.views)
|
|
85
|
+
{
|
|
86
|
+
this.dynamicInputView = this.pict.views[tmpViewConfiguration.ViewHash];
|
|
87
|
+
}
|
|
88
|
+
else
|
|
89
|
+
{
|
|
90
|
+
this.dynamicInputView = this.pict.addView(tmpViewConfiguration.ViewHash, tmpViewConfiguration, libPictViewDynamicForm);
|
|
91
|
+
}
|
|
87
92
|
}
|
|
88
93
|
|
|
89
94
|
/**
|
|
@@ -118,7 +118,7 @@ class CustomInputHandler extends libPictSectionInputExtension
|
|
|
118
118
|
onDataChange(pView, pInput, pValue, pHTMLSelector)
|
|
119
119
|
{
|
|
120
120
|
let tmpTriggerGroupConfigurations = this.getTriggerGroupConfigurationArray(pInput);
|
|
121
|
-
if (Array.isArray(tmpTriggerGroupConfigurations))
|
|
121
|
+
if (Array.isArray(tmpTriggerGroupConfigurations) && this.pict.views.PictFormMetacontroller)
|
|
122
122
|
{
|
|
123
123
|
for (let i = 0; i < tmpTriggerGroupConfigurations.length; i++)
|
|
124
124
|
{
|
|
@@ -144,7 +144,7 @@ class CustomInputHandler extends libPictSectionInputExtension
|
|
|
144
144
|
onDataChangeTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex)
|
|
145
145
|
{
|
|
146
146
|
let tmpTriggerGroupConfigurations = this.getTriggerGroupConfigurationArray(pInput);
|
|
147
|
-
if (Array.isArray(tmpTriggerGroupConfigurations))
|
|
147
|
+
if (Array.isArray(tmpTriggerGroupConfigurations) && this.pict.views.PictFormMetacontroller)
|
|
148
148
|
{
|
|
149
149
|
for (let i = 0; i < tmpTriggerGroupConfigurations.length; i++)
|
|
150
150
|
{
|
|
@@ -245,17 +245,17 @@ class CustomInputHandler extends libPictSectionInputExtension
|
|
|
245
245
|
tmpAnticipate.anticipate(
|
|
246
246
|
(fNext) =>
|
|
247
247
|
{
|
|
248
|
-
if (tmpInput.PictForm.EntityBundleTriggerGroup)
|
|
248
|
+
if (tmpInput.PictForm.EntityBundleTriggerGroup && this.pict.views.PictFormMetacontroller)
|
|
249
249
|
{
|
|
250
250
|
// Trigger the autofill global event
|
|
251
251
|
this.pict.views.PictFormMetacontroller.triggerGlobalInputEvent(`AutoFill-${tmpInput.PictForm.EntityBundleTriggerGroup}`);
|
|
252
252
|
}
|
|
253
|
-
if (tmpInput.PictForm.EntityBundleTriggerMetacontrollerSolve)
|
|
253
|
+
if (tmpInput.PictForm.EntityBundleTriggerMetacontrollerSolve && this.pict.views.PictFormMetacontroller)
|
|
254
254
|
{
|
|
255
255
|
// Trigger the solve global event
|
|
256
256
|
this.pict.views.PictFormMetacontroller.solve();
|
|
257
257
|
}
|
|
258
|
-
if (tmpInput.PictForm.EntityBundleTriggerMetacontrollerRender)
|
|
258
|
+
if (tmpInput.PictForm.EntityBundleTriggerMetacontrollerRender && this.pict.views.PictFormMetacontroller)
|
|
259
259
|
{
|
|
260
260
|
// Trigger the render
|
|
261
261
|
this.pict.views.PictFormMetacontroller.render();
|
|
@@ -47,7 +47,7 @@ class CustomInputHandler extends libPictSectionInputExtension
|
|
|
47
47
|
|
|
48
48
|
getSectionSelector(pTabViewSectionHash)
|
|
49
49
|
{
|
|
50
|
-
return `#Pict-${this.
|
|
50
|
+
return `#Pict-${this.UUID}-${pTabViewSectionHash}-Wrap`;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
selectTabByViewHash(pViewHash, pInputHash, pTabViewHash)
|
|
@@ -91,7 +91,7 @@ class PictTemplateControlFromDynamicManifest extends libPictTemplate
|
|
|
91
91
|
/** @type{import('../views/Pict-View-Form-Metacontroller.js')} */
|
|
92
92
|
const metacontroller = this.pict.views.PictFormMetacontroller;
|
|
93
93
|
/** @type {Manyfest} */
|
|
94
|
-
const manifest = metacontroller.manifest;
|
|
94
|
+
const manifest = metacontroller ? metacontroller.manifest : this.pict.manifest;
|
|
95
95
|
const descriptor = manifest.getDescriptor(tmpHash);
|
|
96
96
|
if (!descriptor)
|
|
97
97
|
{
|
|
@@ -56,7 +56,7 @@ class PictTemplateControlFromDynamicManifest extends libPictTemplate
|
|
|
56
56
|
/** @type{import('../views/Pict-View-Form-Metacontroller.js')} */
|
|
57
57
|
const metacontroller = this.pict.views.PictFormMetacontroller;
|
|
58
58
|
/** @type {import('./Pict-Template-ControlFromDynamicManifest.js').Manyfest} */
|
|
59
|
-
const manifest = metacontroller.manifest;
|
|
59
|
+
const manifest = metacontroller ? metacontroller.manifest : this.pict.manifest;
|
|
60
60
|
const descriptor = manifest.getDescriptorByHash(tmpHash);
|
|
61
61
|
if (!descriptor)
|
|
62
62
|
{
|
|
@@ -55,7 +55,7 @@ class PictTemplateGetViewSchemaValue extends libPictTemplate
|
|
|
55
55
|
/** @type{import('../views/Pict-View-Form-Metacontroller.js')} */
|
|
56
56
|
const metacontroller = this.pict.views.PictFormMetacontroller;
|
|
57
57
|
/** @type {import('./Pict-Template-ControlFromDynamicManifest.js').Manyfest} */
|
|
58
|
-
const manifest = metacontroller.manifest;
|
|
58
|
+
const manifest = metacontroller ? metacontroller.manifest : this.pict.manifest;
|
|
59
59
|
const descriptor = manifest.getDescriptor(tmpSchemaAddress);
|
|
60
60
|
if (!descriptor)
|
|
61
61
|
{
|
|
@@ -55,7 +55,7 @@ class PictTemplateGetViewSchemaValueByHash extends libPictTemplate
|
|
|
55
55
|
/** @type{import('../views/Pict-View-Form-Metacontroller.js')} */
|
|
56
56
|
const metacontroller = this.pict.views.PictFormMetacontroller;
|
|
57
57
|
/** @type {import('./Pict-Template-ControlFromDynamicManifest.js').Manyfest} */
|
|
58
|
-
const manifest = metacontroller.manifest;
|
|
58
|
+
const manifest = metacontroller ? metacontroller.manifest : this.pict.manifest;
|
|
59
59
|
const descriptor = manifest.getDescriptorByHash(tmpSchemaHash);
|
|
60
60
|
if (!descriptor)
|
|
61
61
|
{
|
|
@@ -149,7 +149,7 @@ class PictTemplateMetatemplateInputTemplate extends libPictTemplate
|
|
|
149
149
|
let tmpDataType;
|
|
150
150
|
let tmpInputType;
|
|
151
151
|
|
|
152
|
-
// This is just a simple 2 part hash (the
|
|
152
|
+
// This is just a simple 2 part hash (the Address and the DataType)
|
|
153
153
|
let tmpHashTemplateSeparator = tmpHash.split(':');
|
|
154
154
|
if (tmpHashTemplateSeparator.length < 2)
|
|
155
155
|
{
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
const libPictTemplate = require('pict-template');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This is a template that will generate a dynamic input using a provided dynamic view (by hash)
|
|
5
|
+
*/
|
|
6
|
+
class PictTemplateInputWithViewTemplate extends libPictTemplate
|
|
7
|
+
{
|
|
8
|
+
/**
|
|
9
|
+
* @param {Object} pFable - The Fable Framework instance
|
|
10
|
+
* @param {Object} pOptions - The options for the service
|
|
11
|
+
* @param {String} pServiceHash - The hash of the service
|
|
12
|
+
*/
|
|
13
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
14
|
+
{
|
|
15
|
+
super(pFable, pOptions, pServiceHash);
|
|
16
|
+
|
|
17
|
+
/** @type {import('pict')} */
|
|
18
|
+
this.pict;
|
|
19
|
+
/** @type {import('pict') & { ManifestFactory: import('../services/ManifestFactory.js') }} */
|
|
20
|
+
this.fable;
|
|
21
|
+
/** @type {any} */
|
|
22
|
+
this.log;
|
|
23
|
+
|
|
24
|
+
this.addPattern('{~InputWithView:', '~}');
|
|
25
|
+
this.addPattern('{~IWV:', '~}');
|
|
26
|
+
|
|
27
|
+
this.currentInputIndex = 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Renders an arbitrary PICT input by hash, with a custom data type, input type and label. The Record reference is ignored in this template.
|
|
32
|
+
*
|
|
33
|
+
* @param {string} pTemplateHash - The template hash.
|
|
34
|
+
* @param {object} pRecord - The record object.
|
|
35
|
+
* @param {array} pContextArray - The context array.
|
|
36
|
+
* @param {any} [pScope] - A sticky scope that can be used to carry state and simplify template
|
|
37
|
+
* @returns {string} - The rendered template.
|
|
38
|
+
*/
|
|
39
|
+
render(pTemplateHash, pRecord, pContextArray, pScope)
|
|
40
|
+
{
|
|
41
|
+
let tmpHash = pTemplateHash.trim();
|
|
42
|
+
let tmpMetatemplateGenerator = this.pict.providers.MetatemplateGenerator;
|
|
43
|
+
|
|
44
|
+
if (this.pict.LogNoisiness > 0)
|
|
45
|
+
{
|
|
46
|
+
this.log.trace(`PICT Metacontroller Template [InputWithView]::[${tmpHash}]`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
let tmpViewHash;
|
|
50
|
+
let tmpInputName;
|
|
51
|
+
let tmpInputAddress;
|
|
52
|
+
let tmpDataType;
|
|
53
|
+
let tmpInputType;
|
|
54
|
+
|
|
55
|
+
let tmpHashTemplateSeparator = tmpHash.split(':');
|
|
56
|
+
if (tmpHashTemplateSeparator.length < 3)
|
|
57
|
+
{
|
|
58
|
+
this.log.warn(`InputWithView template requires at least three parameters (ViewHash, Address and DataType) [${tmpHash}]`);
|
|
59
|
+
return '';
|
|
60
|
+
}
|
|
61
|
+
tmpViewHash = tmpHashTemplateSeparator[0];
|
|
62
|
+
tmpInputName = tmpHashTemplateSeparator[1];
|
|
63
|
+
tmpInputAddress = tmpHashTemplateSeparator[2];
|
|
64
|
+
tmpDataType = tmpHashTemplateSeparator[3];
|
|
65
|
+
if (tmpHashTemplateSeparator.length > 4)
|
|
66
|
+
{
|
|
67
|
+
tmpInputType = tmpHashTemplateSeparator[4];
|
|
68
|
+
}
|
|
69
|
+
// Construct a fake input object
|
|
70
|
+
let tmpInput = {
|
|
71
|
+
Address: tmpInputAddress,
|
|
72
|
+
DataAddress: tmpInputAddress,
|
|
73
|
+
Name: tmpInputName,
|
|
74
|
+
Hash: this.fable.ManifestFactory.sanitizeObjectKey(tmpInputAddress),
|
|
75
|
+
DataType: tmpDataType,
|
|
76
|
+
PictForm: {
|
|
77
|
+
InformaryDataAddress: tmpInputAddress,
|
|
78
|
+
GroupIndex: 0,
|
|
79
|
+
Row: 0
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
this.currentInputIndex++;
|
|
84
|
+
|
|
85
|
+
if (tmpInputType)
|
|
86
|
+
{
|
|
87
|
+
tmpInput.PictForm.InputType = tmpInputType;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const tmpInputView = this.pict.views[tmpViewHash];
|
|
91
|
+
|
|
92
|
+
if (!tmpInputView || !tmpInputView.sectionManifest || typeof tmpInputView.getRow !== 'function')
|
|
93
|
+
{
|
|
94
|
+
this.log.warn(`InputWithView template requires a valid dynamic View hash [${tmpHash}]`);
|
|
95
|
+
return '';
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Check to see if the input is already in the manifest
|
|
99
|
+
let tmpRow = tmpInputView.getRow(0, 0);
|
|
100
|
+
|
|
101
|
+
for (let i = 0; i < tmpRow.Inputs.length; i++)
|
|
102
|
+
{
|
|
103
|
+
if (tmpRow.Inputs[i].Hash === tmpInput.Hash)
|
|
104
|
+
{
|
|
105
|
+
let tmpInput = tmpRow.Inputs[i];
|
|
106
|
+
return this.pict.parseTemplate(tmpMetatemplateGenerator.getInputMetatemplateTemplateReference(tmpInputView, tmpInput.DataType, tmpInput.PictForm.InputType, `getInput("0","0","${tmpInput.PictForm.InputIndex}")`), tmpInput, null, [tmpInputView], tmpInputView);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// It isn't already in the manifest, so add it.
|
|
111
|
+
tmpInput.PictForm.InputIndex = tmpRow.Inputs.length;
|
|
112
|
+
tmpInputView.sectionManifest.addDescriptor(tmpInput.Address, tmpInput);
|
|
113
|
+
tmpRow.Inputs.push(tmpInput);
|
|
114
|
+
|
|
115
|
+
this.pict.providers.MetatemplateMacros.buildInputMacros(tmpInputView, tmpInput);
|
|
116
|
+
|
|
117
|
+
// Now generate the metatemplate
|
|
118
|
+
let tmpTemplate = tmpMetatemplateGenerator.getInputMetatemplateTemplateReference(tmpInputView, tmpInput.DataType, tmpInput.PictForm.InputType, `getInput("0","0","${tmpInput.PictForm.InputIndex}")`);
|
|
119
|
+
|
|
120
|
+
// Now parse it and return it.
|
|
121
|
+
return this.pict.parseTemplate(tmpTemplate, tmpInput, null, [tmpInputView], tmpInputView);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Renders an arbitrary PICT input by hash, with a custom data type, input type and label. The Record reference is ignored in this template.
|
|
126
|
+
*
|
|
127
|
+
* @param {string} pTemplateHash - The schema hash of the control.
|
|
128
|
+
* @param {object} pRecord - The record object.
|
|
129
|
+
* @param {function | null} fCallback - The callback function.
|
|
130
|
+
* @param {array} pContextArray - The context array.
|
|
131
|
+
* @param {any} [pScope] - A sticky scope that can be used to carry state and simplify template
|
|
132
|
+
*
|
|
133
|
+
* @return {void}
|
|
134
|
+
*/
|
|
135
|
+
renderAsync(pTemplateHash, pRecord, fCallback, pContextArray, pScope)
|
|
136
|
+
{
|
|
137
|
+
let tmpHash = pTemplateHash.trim();
|
|
138
|
+
let tmpMetatemplateGenerator = this.pict.providers.MetatemplateGenerator;
|
|
139
|
+
|
|
140
|
+
if (this.pict.LogNoisiness > 0)
|
|
141
|
+
{
|
|
142
|
+
this.log.trace(`PICT Metacontroller Template [InputWithView]::[${tmpHash}]`);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
let tmpViewHash;
|
|
146
|
+
let tmpInputName;
|
|
147
|
+
let tmpInputAddress;
|
|
148
|
+
let tmpDataType;
|
|
149
|
+
let tmpInputType;
|
|
150
|
+
|
|
151
|
+
// This is just a simple 2 part hash (the entity and the ID)
|
|
152
|
+
let tmpHashTemplateSeparator = tmpHash.split(':');
|
|
153
|
+
if (tmpHashTemplateSeparator.length < 3)
|
|
154
|
+
{
|
|
155
|
+
this.log.warn(`InputWithView template requires at least three parameters (ViewHash, Address and DataType) [${tmpHash}]`);
|
|
156
|
+
return fCallback(null, '');
|
|
157
|
+
}
|
|
158
|
+
tmpViewHash = tmpHashTemplateSeparator[0];
|
|
159
|
+
tmpInputName = tmpHashTemplateSeparator[1];
|
|
160
|
+
tmpInputAddress = tmpHashTemplateSeparator[2];
|
|
161
|
+
tmpDataType = tmpHashTemplateSeparator[3];
|
|
162
|
+
if (tmpHashTemplateSeparator.length > 4)
|
|
163
|
+
{
|
|
164
|
+
tmpInputType = tmpHashTemplateSeparator[4];
|
|
165
|
+
}
|
|
166
|
+
// Construct a fake input object
|
|
167
|
+
let tmpInput = {
|
|
168
|
+
Address: tmpInputAddress,
|
|
169
|
+
DataAddress: tmpInputAddress,
|
|
170
|
+
Name: tmpInputName,
|
|
171
|
+
Hash: this.fable.ManifestFactory.sanitizeObjectKey(tmpInputAddress),
|
|
172
|
+
DataType: tmpDataType,
|
|
173
|
+
PictForm: {
|
|
174
|
+
InformaryDataAddress: tmpInputAddress,
|
|
175
|
+
GroupIndex: 0,
|
|
176
|
+
Row: 0
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
this.currentInputIndex++;
|
|
181
|
+
|
|
182
|
+
if (tmpInputType)
|
|
183
|
+
{
|
|
184
|
+
tmpInput.PictForm.InputType = tmpInputType;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const tmpInputView = this.pict.views[tmpViewHash];
|
|
188
|
+
|
|
189
|
+
if (!tmpInputView || !tmpInputView.sectionManifest || typeof tmpInputView.getRow !== 'function')
|
|
190
|
+
{
|
|
191
|
+
this.log.warn(`InputWithView template requires a valid dynamic View hash [${tmpHash}]`);
|
|
192
|
+
return fCallback(null, '');
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Check to see if the input is already in the manifest
|
|
196
|
+
let tmpRow = tmpInputView.getRow(0, 0);
|
|
197
|
+
|
|
198
|
+
for (let i = 0; i < tmpRow.Inputs.length; i++)
|
|
199
|
+
{
|
|
200
|
+
if (tmpRow.Inputs[i].Hash === tmpInput.Hash)
|
|
201
|
+
{
|
|
202
|
+
let tmpInput = tmpRow.Inputs[i];
|
|
203
|
+
let tmpTemplate = tmpMetatemplateGenerator.getInputMetatemplateTemplateReference(tmpInputView, tmpInput.DataType, tmpInput.PictForm.InputType, `getInput("0","0","${tmpInput.PictForm.InputIndex}")`);
|
|
204
|
+
this.pict.parseTemplate(tmpTemplate, tmpInput, fCallback, [tmpInputView], tmpInputView);
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// It isn't already in the manifest, so add it.
|
|
210
|
+
tmpInput.PictForm.InputIndex = tmpRow.Inputs.length;
|
|
211
|
+
tmpInputView.sectionManifest.addDescriptor(tmpInput.Address, tmpInput);
|
|
212
|
+
tmpRow.Inputs.push(tmpInput);
|
|
213
|
+
|
|
214
|
+
this.pict.providers.MetatemplateMacros.buildInputMacros(tmpInputView, tmpInput);
|
|
215
|
+
|
|
216
|
+
// Now generate the metatemplate
|
|
217
|
+
let tmpTemplate = tmpMetatemplateGenerator.getInputMetatemplateTemplateReference(tmpInputView, tmpInput.DataType, tmpInput.PictForm.InputType, `getInput("0","0","${tmpInput.PictForm.InputIndex}")`);
|
|
218
|
+
|
|
219
|
+
this.pict.parseTemplate(tmpTemplate, tmpInput, fCallback, [tmpInputView], tmpInputView);
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
module.exports = PictTemplateInputWithViewTemplate;
|