pict-section-form 1.0.21 → 1.0.23
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 +1 -1
- package/example_applications/manyfest_editor/html/index.html +3 -3
- package/example_applications/manyfest_editor/providers/Manyfest-Router.js +8 -1
- package/example_applications/manyfest_editor/source/Manyfest-Editor.js +1 -1
- package/example_applications/manyfest_editor/views/Manyfest-Code-View.js +1 -1
- package/example_applications/manyfest_editor/views/Manyfest-LoadList-View.js +2 -2
- package/example_applications/postcard_example/Pict-Application-Postcard.js +8 -3
- package/example_applications/postcard_example/providers/PictProvider-BestPostcardTheme.js +11 -0
- package/example_applications/postcard_example/providers/PictProvider-Dynamic-Sections-MockServerResponse.json +1 -1
- package/example_applications/postcard_example/providers/PictProvider-PostKardInputExtension.js +23 -0
- package/example_applications/postcard_example/views/PictView-Postcard-Navigation.json +1 -1
- package/example_applications/simple_form/Simple-Form_Default_Manifest.json +1 -1
- package/package.json +1 -1
- package/source/providers/Pict-Provider-DynamicTemplates-DefaultFormTemplates-ReadOnly.js +4 -4
- package/source/providers/Pict-Provider-DynamicTemplates-DefaultFormTemplates.js +8 -8
- package/source/providers/Pict-Provider-InputExtension.js +32 -0
- package/source/views/Pict-View-DynamicForm-DefaultConfiguration.json +3 -3
- package/source/views/Pict-View-DynamicForm.js +96 -18
|
@@ -45,7 +45,7 @@ module.exports.default_configuration.pict_configuration = {
|
|
|
45
45
|
{
|
|
46
46
|
//onclick="{~D:Record.Macro.DataRequestFunction~}"
|
|
47
47
|
"HashPostfix": "-Template-Wrap-Prefix",
|
|
48
|
-
"Template": "<h1>Rectangular Area Solver Micro-app</h1><div><a href=\"#\" onclick=\"
|
|
48
|
+
"Template": "<h1>Rectangular Area Solver Micro-app</h1><div><a href=\"#\" onclick=\"{~Pict~}.PictApplication.solve()\">[ solve ]</a></div><hr />"
|
|
49
49
|
}
|
|
50
50
|
],
|
|
51
51
|
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
<div id="navbarBasicExample" class="navbar-menu">
|
|
48
48
|
<div class="navbar-start">
|
|
49
49
|
<a class="navbar-item"> Overview </a>
|
|
50
|
-
<a class="navbar-item" href="
|
|
51
|
-
<a class="navbar-item"> Descriptors </a>
|
|
50
|
+
<a class="navbar-item" href="#/Manyfest/Code"> Code </a>
|
|
51
|
+
<a class="navbar-item" href="#/Manyfest/Editor"> Descriptors </a>
|
|
52
52
|
<a class="navbar-item"> Sections </a>
|
|
53
53
|
<a class="navbar-item"> Reference Manifests </a>
|
|
54
54
|
</div>
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
</div>
|
|
72
72
|
|
|
73
73
|
<div class="buttons">
|
|
74
|
-
<a class="button is-primary" href="
|
|
74
|
+
<a class="button is-primary" href="#/Manyfest/Save"> <strong>Save</strong> </a>
|
|
75
75
|
</div>
|
|
76
76
|
</div>
|
|
77
77
|
</div>
|
|
@@ -31,9 +31,16 @@ class ManyfestRouter extends libPictProvider
|
|
|
31
31
|
this.router.on('/Manyfest/Code',
|
|
32
32
|
(pData) =>
|
|
33
33
|
{
|
|
34
|
-
|
|
34
|
+
this.pict.views.ManyfestCodeView.render();
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
+
this.router.on('/Manyfest/Save',
|
|
38
|
+
(pData) =>
|
|
39
|
+
{
|
|
40
|
+
this.pict.providers.DataProvider.saveManyfest()
|
|
41
|
+
});
|
|
42
|
+
)
|
|
43
|
+
|
|
37
44
|
return super.onInitializeAsync(fCallback);
|
|
38
45
|
}
|
|
39
46
|
}
|
|
@@ -16,7 +16,7 @@ const _DEFAULT_VIEW_CONFIGURATION = (
|
|
|
16
16
|
<div class="container">
|
|
17
17
|
<h1 class="title">Manyfest Raw Code</h1>
|
|
18
18
|
<h2 class="subtitle">Your lens into the guts of this machine.</h2>
|
|
19
|
-
<textarea {~D:Record.Macro.InputFullProperties~} id="ManyfestRawCodeEditor" onchange="
|
|
19
|
+
<textarea {~D:Record.Macro.InputFullProperties~} id="ManyfestRawCodeEditor" onchange="{~P~}.views.ManyfestCodeView.marshalFromView()">{~D:Context[0].getManyfestRawCode()~}</textarea>
|
|
20
20
|
</div>
|
|
21
21
|
`
|
|
22
22
|
}
|
|
@@ -21,7 +21,7 @@ const _DEFAULT_VIEW_CONFIGURATION = (
|
|
|
21
21
|
{
|
|
22
22
|
Hash: "Manyfest-LoadList-Entry-Template",
|
|
23
23
|
Template: /*html*/`
|
|
24
|
-
<a class="navbar-item" href="#" onclick="
|
|
24
|
+
<a class="navbar-item" href="#" onclick="{~P~}.providers.DataProvider.loadManyfest('{~D:Record.Scope~}')"> {~D:Record.Scope~} </a>
|
|
25
25
|
`
|
|
26
26
|
},
|
|
27
27
|
{
|
|
@@ -33,7 +33,7 @@ const _DEFAULT_VIEW_CONFIGURATION = (
|
|
|
33
33
|
{
|
|
34
34
|
Hash: "Manyfest-DeleteList-Entry-Template",
|
|
35
35
|
Template: /*html*/`
|
|
36
|
-
<a class="navbar-item" href="#" onclick="
|
|
36
|
+
<a class="navbar-item" href="#" onclick="{~P~}.providers.DataProvider.removeScopeFromManyfestList('{~D:Record.Scope~}')"> {~D:Record.Scope~} </a>
|
|
37
37
|
`
|
|
38
38
|
},
|
|
39
39
|
{
|
|
@@ -4,8 +4,11 @@ const libPictSectionForm = require('../../source/Pict-Section-Form.js');
|
|
|
4
4
|
|
|
5
5
|
const libProviderDynamicSection = require('./providers/PictProvider-Dynamic-Sections.js');
|
|
6
6
|
|
|
7
|
+
const libProviderInputExtension = require('./providers/PictProvider-PostKardInputExtension.js');
|
|
8
|
+
|
|
7
9
|
const libMainApplicationView = require('./views/PictView-Postcard-MainApplication.js')
|
|
8
10
|
|
|
11
|
+
|
|
9
12
|
class PostcardApplication extends libPictApplication
|
|
10
13
|
{
|
|
11
14
|
constructor(pFable, pOptions, pServiceHash)
|
|
@@ -15,6 +18,8 @@ class PostcardApplication extends libPictApplication
|
|
|
15
18
|
this.pict.addProvider('Postcard-DynamicSection-Provider', libProviderDynamicSection.default_configuration, libProviderDynamicSection);
|
|
16
19
|
this.pict.addProvider('Postcard-Default-Theme-Provider', {}, require('./providers/PictProvider-BestPostcardTheme.js'));
|
|
17
20
|
|
|
21
|
+
this.pict.addProvider('PostKardInputExtension', libProviderInputExtension.default_configuration, libProviderInputExtension);
|
|
22
|
+
|
|
18
23
|
this.pict.addView('PostcardNavigation', require('./views/PictView-Postcard-Navigation.json'));
|
|
19
24
|
this.pict.addView('PostcardAbout', require('./views/PictView-Postcard-Content-About.json'));
|
|
20
25
|
this.pict.addView('PostcardLegal', require('./views/PictView-Postcard-Content-Legal.json'));
|
|
@@ -30,7 +35,7 @@ class PostcardApplication extends libPictApplication
|
|
|
30
35
|
|
|
31
36
|
changeToDefaultTheme()
|
|
32
37
|
{
|
|
33
|
-
this.pict.views.PictFormMetacontroller.formTemplatePrefix =
|
|
38
|
+
this.pict.views.PictFormMetacontroller.formTemplatePrefix = this.pict.providers.PictFormSectionDefaultTemplateProvider.formsTemplateSetPrefix
|
|
34
39
|
// This generates the container metatemplates after we switch themes.
|
|
35
40
|
this.pict.views.PictFormMetacontroller.generateMetatemplate();
|
|
36
41
|
// This generates the view templates for each dynamic view generated from config.
|
|
@@ -45,7 +50,7 @@ class PostcardApplication extends libPictApplication
|
|
|
45
50
|
|
|
46
51
|
changeToPostcardTheme()
|
|
47
52
|
{
|
|
48
|
-
this.pict.views.PictFormMetacontroller.formTemplatePrefix =
|
|
53
|
+
this.pict.views.PictFormMetacontroller.formTemplatePrefix = this.pict.providers['Postcard-Default-Theme-Provider'].formsTemplateSetPrefix;
|
|
49
54
|
// This generates the container metatemplates after we switch themes.
|
|
50
55
|
this.pict.views.PictFormMetacontroller.generateMetatemplate();
|
|
51
56
|
// This generates the view templates for each dynamic view generated from config.
|
|
@@ -61,7 +66,7 @@ class PostcardApplication extends libPictApplication
|
|
|
61
66
|
onAfterInitializeAsync(fCallback)
|
|
62
67
|
{
|
|
63
68
|
// Default to the Pure theme
|
|
64
|
-
this.pict.views.PictFormMetacontroller.formTemplatePrefix =
|
|
69
|
+
this.pict.views.PictFormMetacontroller.formTemplatePrefix = this.pict.providers['Postcard-Default-Theme-Provider'].formsTemplateSetPrefix;
|
|
65
70
|
|
|
66
71
|
// Set a custom address for all the views to marshal to.
|
|
67
72
|
// This can also be set on specific views (same property)
|
|
@@ -106,6 +106,17 @@ Glug glug CUSTOMIZED glug Oo... -->
|
|
|
106
106
|
<textarea {~D:Record.Macro.HTMLID~} {~D:Record.Macro.InputFullProperties~} class="pure-u-23-24"></textarea>
|
|
107
107
|
</div>
|
|
108
108
|
|
|
109
|
+
`
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"HashPostfix": "-Template-Input-InputType-PostKardSignature",
|
|
113
|
+
"Template": /*HTML*/`
|
|
114
|
+
<div class="pure-u-1 pure-u-md-1-3">
|
|
115
|
+
<label {~D:Record.Macro.HTMLForID~}><em>{~D:Record.Name~}:</em></label>
|
|
116
|
+
<input type="text" {~D:Record.Macro.HTMLID~} {~D:Record.Macro.InputFullProperties~} class="pure-u-23-24" />
|
|
117
|
+
<a href="#" onclick="{~P~}.views['{~D:Context[0].Hash~}'].inputEvent('{~D:Record.Hash~}', 'BestEventEvarrrr')" class="pure-button">Sign</a>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
109
120
|
`
|
|
110
121
|
}
|
|
111
122
|
]});
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"Hash":"SignatureLine",
|
|
79
79
|
"Description":"How you would like your card signed.",
|
|
80
80
|
"DataType":"String"
|
|
81
|
-
,"PictForm": { "Section":"Postcard", "Group":"Content", "Row":4, "Width":12 }
|
|
81
|
+
,"PictForm": { "InputType":"PostKardSignature", "Section":"Postcard", "Group":"Content", "Row":4, "Width":12, "Providers": ["PostKardInputExtension"] }
|
|
82
82
|
},
|
|
83
83
|
"DeliveryDestination.StreetAddress1":
|
|
84
84
|
{
|
package/example_applications/postcard_example/providers/PictProvider-PostKardInputExtension.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const libPictFormSection = require('../../../source/Pict-Section-Form.js');
|
|
2
|
+
|
|
3
|
+
class CustomInputHandler extends libPictFormSection.PictInputExtensionProvider
|
|
4
|
+
{
|
|
5
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
6
|
+
{
|
|
7
|
+
super(pFable, pOptions, pServiceHash);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
onEvent(pView, pInput, pValue, pHTMLSelector, pEvent)
|
|
11
|
+
{
|
|
12
|
+
console.log(`Alert alert event happened for ${pInput}: ${pEvent}`);
|
|
13
|
+
return super.onEvent(pView, pInput, pValue, pHTMLSelector, pEvent);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
onEventTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex, pEvent)
|
|
17
|
+
{
|
|
18
|
+
console.log(`Alert alert event happened for ${pInput} row ${pRowIndex}: ${pEvent}`);
|
|
19
|
+
return super.onEventTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex, pEvent);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = CustomInputHandler;
|
|
@@ -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=\"
|
|
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.marshalDataFromViewToAppData()\" class=\"pure-menu-link\">Store Data</a></li><li class=\"pure-menu-item\"><a href=\"#\" onclick=\"{~P~}.PictApplication.marshalDataFromAppDataToView()\" class=\"pure-menu-link\">Read Data</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></ul>"
|
|
15
15
|
}
|
|
16
16
|
],
|
|
17
17
|
"Renderables": [
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
[
|
|
19
19
|
{
|
|
20
20
|
"HashPostfix": "-Template-Wrap-Prefix",
|
|
21
|
-
"Template": "<h1>Rectangular Area Solver Micro-app</h1><div><a href=\"#\" onclick=\"
|
|
21
|
+
"Template": "<h1>Rectangular Area Solver Micro-app</h1><div><a href=\"#\" onclick=\"{~P~}.PictApplication.solve()\">[ solve ]</a></div><hr />"
|
|
22
22
|
}
|
|
23
23
|
]
|
|
24
24
|
}
|
package/package.json
CHANGED
|
@@ -195,9 +195,9 @@ Glug glug glug Oo... -->
|
|
|
195
195
|
{
|
|
196
196
|
"HashPostfix": "-TabularTemplate-Row-ExtraPostfix",
|
|
197
197
|
"Template": /*HTML*/`<!-- TabularTemplateRow-ExtraPostfix-->
|
|
198
|
-
<td><a href="#" onClick="
|
|
199
|
-
<a href="#" onClick="
|
|
200
|
-
<a href="#" onClick="
|
|
198
|
+
<td><a href="#" onClick="{~P~}.views['{~D:Context[0].Hash~}'].deleteDynamicTableRow({~D:Record.Group~},'{~D:Record.Key~}')">del</a>
|
|
199
|
+
<a href="#" onClick="{~P~}.views['{~D:Context[0].Hash~}'].moveDynamicTableRowUp({~D:Record.Group~},'{~D:Record.Key~}')">up</a>
|
|
200
|
+
<a href="#" onClick="{~P~}.views['{~D:Context[0].Hash~}'].moveDynamicTableRowDown({~D:Record.Group~},'{~D:Record.Key~}')">down</a></td>
|
|
201
201
|
`
|
|
202
202
|
},
|
|
203
203
|
/*
|
|
@@ -285,7 +285,7 @@ Glug glug glug Oo... -->
|
|
|
285
285
|
},
|
|
286
286
|
{
|
|
287
287
|
"HashPostfix": "-TabularTemplate-InformaryAddress-Input",
|
|
288
|
-
"Template": /*HTML*/` data-i-index="{~D:Context[2].Key~}" onchange="
|
|
288
|
+
"Template": /*HTML*/` data-i-index="{~D:Context[2].Key~}" onchange="{~P~}.views['{~D:Context[0].Hash~}'].dataChangedTabular('{~D:Context[2].Group~}', '{~D:Record.PictForm.InputIndex~}', '{~D:Context[2].Key~}')" `
|
|
289
289
|
},
|
|
290
290
|
/*
|
|
291
291
|
* END Tabular Input Templates
|
|
@@ -244,9 +244,9 @@ Glug glug glug Oo... -->
|
|
|
244
244
|
{
|
|
245
245
|
"HashPostfix": "-TabularTemplate-Row-ExtraPostfix",
|
|
246
246
|
"Template": /*HTML*/`<!-- TabularTemplateRow-ExtraPostfix-->
|
|
247
|
-
<td><a href="#" onClick="
|
|
248
|
-
<a href="#" onClick="
|
|
249
|
-
<a href="#" onClick="
|
|
247
|
+
<td><a href="#" onClick="{~P~}.views['{~D:Context[0].Hash~}'].deleteDynamicTableRow({~D:Record.Group~},'{~D:Record.Key~}')">del</a>
|
|
248
|
+
<a href="#" onClick="{~P~}.views['{~D:Context[0].Hash~}'].moveDynamicTableRowUp({~D:Record.Group~},'{~D:Record.Key~}')">up</a>
|
|
249
|
+
<a href="#" onClick="{~P~}.views['{~D:Context[0].Hash~}'].moveDynamicTableRowDown({~D:Record.Group~},'{~D:Record.Key~}')">down</a></td>
|
|
250
250
|
`
|
|
251
251
|
},
|
|
252
252
|
/*
|
|
@@ -334,7 +334,7 @@ Glug glug glug Oo... -->
|
|
|
334
334
|
},
|
|
335
335
|
{
|
|
336
336
|
"HashPostfix": "-TabularTemplate-InformaryAddress-Input",
|
|
337
|
-
"Template": /*HTML*/` data-i-index="{~D:Context[2].Key~}" onchange="
|
|
337
|
+
"Template": /*HTML*/` data-i-index="{~D:Context[2].Key~}" onchange="{~P~}.views['{~D:Context[0].Hash~}'].dataChangedTabular('{~D:Context[2].Group~}', '{~D:Record.PictForm.InputIndex~}', '{~D:Context[2].Key~}')" `
|
|
338
338
|
},
|
|
339
339
|
|
|
340
340
|
{
|
|
@@ -379,14 +379,14 @@ Glug glug glug Oo... -->
|
|
|
379
379
|
{
|
|
380
380
|
"HashPostfix": "-TabularTemplate-End-Input-InputType-Option",
|
|
381
381
|
"Template": /*HTML*/` value="">
|
|
382
|
-
<select id="SELECT-TABULAR-DROPDOWN-{~D:Record.Macro.RawHTMLID~}-{~D:Context[2].Key~}" onchange="
|
|
382
|
+
<select id="SELECT-TABULAR-DROPDOWN-{~D:Record.Macro.RawHTMLID~}-{~D:Context[2].Key~}" onchange="{~P~}.views['{~D:Context[0].Hash~}'].inputDataRequestTabular('{~D:Context[2].Group~}', '{~D:Record.PictForm.InputIndex~}', '{~D:Context[2].Key~}')"></select>
|
|
383
383
|
`
|
|
384
384
|
},
|
|
385
385
|
{
|
|
386
386
|
"HashPostfix": "-TabularTemplate-Begin-Input-InputType-Boolean",
|
|
387
387
|
"Template": /*HTML*/`
|
|
388
388
|
<!-- InputType Boolean {~D:Record.Hash~} {~D:Record.DataType~} -->
|
|
389
|
-
<input type="checkbox"
|
|
389
|
+
<input type="checkbox" {~D:Record.Macro.HTMLName~} {~D:Record.Macro.InformaryTabular~} `
|
|
390
390
|
},
|
|
391
391
|
{
|
|
392
392
|
"HashPostfix": "-TabularTemplate-End-Input-InputType-Boolean",
|
|
@@ -402,14 +402,14 @@ Glug glug glug Oo... -->
|
|
|
402
402
|
{
|
|
403
403
|
"HashPostfix": "-TabularTemplate-End-Input-DataType-DateTime",
|
|
404
404
|
"Template": /*HTML*/` value="">
|
|
405
|
-
<input id="DATETIME-TABULAR-INPUT-{~D:Record.Macro.RawHTMLID~}-{~D:Context[2].Key~}" onchange="
|
|
405
|
+
<input id="DATETIME-TABULAR-INPUT-{~D:Record.Macro.RawHTMLID~}-{~D:Context[2].Key~}" onchange="{~P~}.views['{~D:Context[0].Hash~}'].inputDataRequestTabular('{~D:Context[2].Group~}', '{~D:Record.PictForm.InputIndex~}', '{~D:Context[2].Key~}')" type="datetime-local" value="" />
|
|
406
406
|
`
|
|
407
407
|
},
|
|
408
408
|
{
|
|
409
409
|
"HashPostfix": "-TabularTemplate-Begin-Input-InputType-Hidden",
|
|
410
410
|
"Template": /*HTML*/`
|
|
411
411
|
<!-- InputType Hidden {~D:Record.Hash~} {~D:Record.DataType~} -->
|
|
412
|
-
<input type="hidden" {~D:Record.Macro.InputFullProperties~} {~D:Record.Macro.InputChangeHandler~}
|
|
412
|
+
<input type="hidden" {~D:Record.Macro.InputFullProperties~} {~D:Record.Macro.InputChangeHandler~} {~D:Record.Macro.InformaryTabular~}
|
|
413
413
|
`
|
|
414
414
|
},
|
|
415
415
|
{
|
|
@@ -152,6 +152,38 @@ class PictInputExtensionProvider extends libPictProvider
|
|
|
152
152
|
{
|
|
153
153
|
return true;
|
|
154
154
|
}
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Handles events for the Pict-Provider-InputExtension.
|
|
159
|
+
*
|
|
160
|
+
* @param {Object} pView - The view object.
|
|
161
|
+
* @param {Object} pInput - The input object.
|
|
162
|
+
* @param {string} pValue - The value from AppData.
|
|
163
|
+
* @param {string} pHTMLSelector - The HTML selector.
|
|
164
|
+
* @param {string} pEvent - The event hash that is expected to be triggered.
|
|
165
|
+
* @returns {boolean} - Returns true.
|
|
166
|
+
*/
|
|
167
|
+
onEvent(pView, pInput, pValue, pHTMLSelector, pEvent)
|
|
168
|
+
{
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Handles events for the Pict-Provider-InputExtension.
|
|
174
|
+
*
|
|
175
|
+
* @param {Object} pView - The view object.
|
|
176
|
+
* @param {Object} pInput - The input object.
|
|
177
|
+
* @param {string} pValue - The value from AppData.
|
|
178
|
+
* @param {string} pHTMLSelector - The HTML selector.
|
|
179
|
+
* @param {number} pRowIndex - The row index of the tabular data.
|
|
180
|
+
* @param {string} pEvent - The event hash that is expected to be triggered.
|
|
181
|
+
* @returns {boolean} - Returns true.
|
|
182
|
+
*/
|
|
183
|
+
onEventTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex, pEvent)
|
|
184
|
+
{
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
155
187
|
}
|
|
156
188
|
|
|
157
189
|
module.exports = PictInputExtensionProvider;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"Group": {
|
|
17
17
|
"HTMLID": " id=\"Group-{~D:Context[0].UUID~}\" ",
|
|
18
18
|
|
|
19
|
-
"TabularCreateRowFunctionCall": "
|
|
19
|
+
"TabularCreateRowFunctionCall": "{~P~}.views['{~D:Context[0].Hash~}'].createDynamicTableRow({~D:Record.GroupIndex~})"
|
|
20
20
|
},
|
|
21
21
|
"Input": {
|
|
22
22
|
"Informary": " data-i-form=\"{~D:Context[0].formID~}\" data-i-datum=\"{~D:Record.PictForm.InformaryDataAddress~}\" ",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"HTMLForID": " for=\"{~D:Context[0].UUID~}-FormInput-{~D:Record.Hash~}\" ",
|
|
34
34
|
|
|
35
35
|
"InputFullProperties": " data-i-form=\"{~D:Context[0].formID~}\" data-i-datum=\"{~D:Record.PictForm.InformaryDataAddress~}\" name=\"{~D:Record.Name~}\" ",
|
|
36
|
-
"InputChangeHandler": " onchange=\"
|
|
36
|
+
"InputChangeHandler": " onchange=\"{~P~}.views['{~D:Context[0].Hash~}'].dataChanged('{~D:Record.Hash~}')\" ",
|
|
37
37
|
|
|
38
|
-
"DataRequestFunction": "
|
|
38
|
+
"DataRequestFunction": " {~P~}.views['{~D:Context[0].Hash~}'].inputDataRequest('{~D:Record.Hash~}'); "
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
|
|
@@ -463,24 +463,6 @@ class PictViewDynamicForm extends libPictViewClass
|
|
|
463
463
|
tmpGroup.Rows = [];
|
|
464
464
|
}
|
|
465
465
|
|
|
466
|
-
if (tmpGroup.supportingManifest && (typeof(tmpGroup.RecordSetAddress) == 'string'))
|
|
467
|
-
{
|
|
468
|
-
let tmpSupportingManifestDescriptorKeys = Object.keys(tmpGroup.supportingManifest.elementDescriptors);
|
|
469
|
-
for (let k = 0; k < tmpSupportingManifestDescriptorKeys.length; k++)
|
|
470
|
-
{
|
|
471
|
-
let tmpInput = tmpGroup.supportingManifest.elementDescriptors[tmpSupportingManifestDescriptorKeys[k]];
|
|
472
|
-
|
|
473
|
-
if (!('PictForm' in tmpInput))
|
|
474
|
-
{
|
|
475
|
-
tmpInput.PictForm = {};
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
tmpInput.PictForm.InformaryDataAddress = tmpSupportingManifestDescriptorKeys[k];
|
|
479
|
-
tmpInput.PictForm.InformaryContainerAddress = tmpGroup.RecordSetAddress;
|
|
480
|
-
tmpInput.RowIdentifierTemplateHash = '{~D:Record.RowID~}';
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
|
|
484
466
|
let tmpRowHash = (typeof(tmpDescriptor.PictForm.Row) == 'string') ? tmpDescriptor.PictForm.Row :
|
|
485
467
|
(typeof(tmpDescriptor.PictForm.Row) == 'number') ? `Row_${tmpDescriptor.PictForm.Row.toString()}` :
|
|
486
468
|
'Row_Default';
|
|
@@ -534,6 +516,23 @@ class PictViewDynamicForm extends libPictViewClass
|
|
|
534
516
|
tmpGroup.supportingManifest = this.fable.instantiateServiceProviderWithoutRegistration('Manifest', this.options.Manifests.Section.ReferenceManifests[tmpGroup.RecordManifest]);
|
|
535
517
|
}
|
|
536
518
|
}
|
|
519
|
+
if (tmpGroup.supportingManifest && (typeof(tmpGroup.RecordSetAddress) == 'string'))
|
|
520
|
+
{
|
|
521
|
+
let tmpSupportingManifestDescriptorKeys = Object.keys(tmpGroup.supportingManifest.elementDescriptors);
|
|
522
|
+
for (let k = 0; k < tmpSupportingManifestDescriptorKeys.length; k++)
|
|
523
|
+
{
|
|
524
|
+
let tmpInput = tmpGroup.supportingManifest.elementDescriptors[tmpSupportingManifestDescriptorKeys[k]];
|
|
525
|
+
|
|
526
|
+
if (!('PictForm' in tmpInput))
|
|
527
|
+
{
|
|
528
|
+
tmpInput.PictForm = {};
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
tmpInput.PictForm.InformaryDataAddress = tmpSupportingManifestDescriptorKeys[k];
|
|
532
|
+
tmpInput.PictForm.InformaryContainerAddress = tmpGroup.RecordSetAddress;
|
|
533
|
+
tmpInput.RowIdentifierTemplateHash = '{~D:Record.RowID~}';
|
|
534
|
+
}
|
|
535
|
+
}
|
|
537
536
|
}
|
|
538
537
|
|
|
539
538
|
}
|
|
@@ -1245,6 +1244,42 @@ class PictViewDynamicForm extends libPictViewClass
|
|
|
1245
1244
|
}
|
|
1246
1245
|
}
|
|
1247
1246
|
|
|
1247
|
+
inputEvent(pInputHash, pEvent)
|
|
1248
|
+
{
|
|
1249
|
+
let tmpInput = this.getInputFromHash(pInputHash);
|
|
1250
|
+
if (pInputHash)
|
|
1251
|
+
{
|
|
1252
|
+
let tmpHashAddress = this.sectionManifest.resolveHashAddress(pInputHash);
|
|
1253
|
+
try
|
|
1254
|
+
{
|
|
1255
|
+
let tmpMarshalDestinationObject = this.getMarshalDestinationObject();
|
|
1256
|
+
if (tmpInput && tmpInput.PictForm && ('Providers' in tmpInput.PictForm) && Array.isArray(tmpInput.PictForm.Providers))
|
|
1257
|
+
{
|
|
1258
|
+
let tmpValue = this.sectionManifest.getValueByHash(tmpMarshalDestinationObject, tmpHashAddress);
|
|
1259
|
+
for (let i = 0; i < tmpInput.PictForm.Providers.length; i++)
|
|
1260
|
+
{
|
|
1261
|
+
if (this.pict.providers[tmpInput.PictForm.Providers[i]])
|
|
1262
|
+
{
|
|
1263
|
+
this.pict.providers[tmpInput.PictForm.Providers[i]].onEvent(this, tmpInput, tmpValue, tmpInput.Macro.HTMLSelector, pEvent);
|
|
1264
|
+
}
|
|
1265
|
+
else
|
|
1266
|
+
{
|
|
1267
|
+
this.log.error(`Dynamic form [${this.Hash}]::[${this.UUID}] inputEvent ${pEvent} cannot find provider [${tmpInput.PictForm.Providers[i]}] for input [${tmpInput.Hash}].`);
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
catch (pError)
|
|
1273
|
+
{
|
|
1274
|
+
this.log.error(`Dynamic form [${this.Hash}]::[${this.UUID}] gross error running inputEvent ${pEvent} specific (${pInputHash}) data from view in dataChanged event: ${pError}`);
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
else
|
|
1278
|
+
{
|
|
1279
|
+
this.log.error(`Dynamic form [${this.Hash}]::[${this.UUID}] cannot find input hash [${pInputHash}] for inputEvent ${pEvent} event.`);
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1248
1283
|
inputDataRequestTabular(pGroupIndex, pInputIndex, pRowIndex)
|
|
1249
1284
|
{
|
|
1250
1285
|
let tmpInput = this.getTabularRecordInput(pGroupIndex, pInputIndex);
|
|
@@ -1288,6 +1323,49 @@ class PictViewDynamicForm extends libPictViewClass
|
|
|
1288
1323
|
this.marshalToView();
|
|
1289
1324
|
}
|
|
1290
1325
|
|
|
1326
|
+
inputEventTabular(pGroupIndex, pInputIndex, pRowIndex, pEvent)
|
|
1327
|
+
{
|
|
1328
|
+
let tmpInput = this.getTabularRecordInput(pGroupIndex, pInputIndex);
|
|
1329
|
+
if (pGroupIndex && pInputIndex && pRowIndex && tmpInput)
|
|
1330
|
+
{
|
|
1331
|
+
try
|
|
1332
|
+
{
|
|
1333
|
+
let tmpMarshalDestinationObject = this.getMarshalDestinationObject();
|
|
1334
|
+
if (tmpInput && tmpInput.PictForm && ('Providers' in tmpInput.PictForm) && Array.isArray(tmpInput.PictForm.Providers))
|
|
1335
|
+
{
|
|
1336
|
+
// TODO: Can we simplify this?
|
|
1337
|
+
let tmpValueAddress = this.pict.providers.Informary.getComposedContainerAddress(tmpInput.PictForm.InformaryContainerAddress, pRowIndex, tmpInput.PictForm.InformaryDataAddress);
|
|
1338
|
+
let tmpValue = this.sectionManifest.getValueByHash(tmpMarshalDestinationObject, tmpValueAddress);
|
|
1339
|
+
|
|
1340
|
+
let tmpVirtualInformaryHTMLSelector = tmpInput.Macro.HTMLSelectorTabular+`[data-i-index="${pRowIndex}"]`;
|
|
1341
|
+
for (let i = 0; i < tmpInput.PictForm.Providers.length; i++)
|
|
1342
|
+
{
|
|
1343
|
+
if (this.pict.providers[tmpInput.PictForm.Providers[i]])
|
|
1344
|
+
{
|
|
1345
|
+
this.pict.providers[tmpInput.PictForm.Providers[i]].onEventTabular(this, tmpInput, tmpValue, tmpVirtualInformaryHTMLSelector, pRowIndex, pEvent);
|
|
1346
|
+
}
|
|
1347
|
+
else
|
|
1348
|
+
{
|
|
1349
|
+
this.log.error(`Dynamic form [${this.Hash}]::[${this.UUID}] cannot find provider [${tmpInput.PictForm.Providers[i]}] for input [${tmpInput.Hash}] row ${pRowIndex} calling inputEvent ${pEvent}.`);
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
catch (pError)
|
|
1355
|
+
{
|
|
1356
|
+
this.log.error(`Dynamic form [${this.Hash}]::[${this.UUID}] gross error marshaling specific (${pInputHash}) tabular data for group ${pGroupIndex} row ${pRowIndex} from view in calling inputEvent ${pEvent}: ${pError}`);
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
else
|
|
1360
|
+
{
|
|
1361
|
+
// This is what is called whenever a hash is changed. We could marshal from view, solve and remarshal to view.
|
|
1362
|
+
this.marshalFromView();
|
|
1363
|
+
}
|
|
1364
|
+
// Run any dynamic input providers for the input hash.
|
|
1365
|
+
this.pict.PictApplication.solve();
|
|
1366
|
+
this.marshalToView();
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1291
1369
|
get isPictSectionForm()
|
|
1292
1370
|
{
|
|
1293
1371
|
return true;
|