pict-section-form 1.0.130 → 1.0.132

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.
Files changed (30) hide show
  1. package/example_applications/complex_table/Complex-Tabular-Application.js +1 -1
  2. package/example_applications/complex_table/html/index.html +1 -1
  3. package/example_applications/simple_form/Simple-Form_Default_Manifest.json +1 -1
  4. package/package.json +2 -2
  5. package/source/providers/Pict-Provider-DynamicTabularData.js +23 -6
  6. package/source/views/Pict-View-Form-Metacontroller.js +32 -7
  7. package/source/views/support/Pict-Provider-PSF-Support.js +314 -0
  8. package/source/views/support/Pict-View-PSF-AppData-Visualization.js +137 -0
  9. package/source/views/support/Pict-View-PSF-DebugViewer.js +81 -64
  10. package/source/views/support/Pict-View-PSF-LifeCycle-Visualization.js +19 -10
  11. package/source/views/support/Pict-View-PSF-Solver-Visualization.js +164 -0
  12. package/source/views/support/Pict-View-PSF-SpecificSolve-Visualization.js +45 -0
  13. package/source/views/support/Pict-View-PSF-SupportBase.js +280 -4
  14. package/types/source/providers/Pict-Provider-DynamicTabularData.d.ts.map +1 -1
  15. package/types/source/views/Pict-View-Form-Metacontroller.d.ts +12 -0
  16. package/types/source/views/Pict-View-Form-Metacontroller.d.ts.map +1 -1
  17. package/types/source/views/support/Pict-Provider-PSF-Support.d.ts +30 -0
  18. package/types/source/views/support/Pict-Provider-PSF-Support.d.ts.map +1 -0
  19. package/types/source/views/support/Pict-View-PSF-AppData-Visualization.d.ts +26 -0
  20. package/types/source/views/support/Pict-View-PSF-AppData-Visualization.d.ts.map +1 -0
  21. package/types/source/views/support/Pict-View-PSF-DebugViewer.d.ts +2 -11
  22. package/types/source/views/support/Pict-View-PSF-DebugViewer.d.ts.map +1 -1
  23. package/types/source/views/support/Pict-View-PSF-LifeCycle-Visualization.d.ts +5 -5
  24. package/types/source/views/support/Pict-View-PSF-LifeCycle-Visualization.d.ts.map +1 -1
  25. package/types/source/views/support/Pict-View-PSF-Solver-Visualization.d.ts +22 -0
  26. package/types/source/views/support/Pict-View-PSF-Solver-Visualization.d.ts.map +1 -1
  27. package/types/source/views/support/Pict-View-PSF-SpecificSolve-Visualization.d.ts +23 -0
  28. package/types/source/views/support/Pict-View-PSF-SpecificSolve-Visualization.d.ts.map +1 -0
  29. package/types/source/views/support/Pict-View-PSF-SupportBase.d.ts +4 -1
  30. package/types/source/views/support/Pict-View-PSF-SupportBase.d.ts.map +1 -1
@@ -88,7 +88,7 @@ module.exports.default_configuration.pict_configuration = {
88
88
  {
89
89
  //onclick="{~D:Record.Macro.DataRequestFunction~}"
90
90
  "HashPostfix": "-Template-Wrap-Prefix",
91
- "Template": "<h1>Rectangular Area Solver Micro-app</h1><div><a href=\"#\" onclick=\"{~Pict~}.PictApplication.solve()\">[ solve ]</a> <a href=\"#\" onclick=\"{~P~}.views.PictFormMetacontroller.showSupportViewInlineEditor()\">[ editor ]</a></div><hr />"
91
+ "Template": "<h1>Rectangular Area Solver Micro-app</h1><div><a href=\"#\" onclick=\"{~Pict~}.PictApplication.solve()\">[ solve ]</a> <a href=\"#\" onclick=\"{~P~}.views.PictFormMetacontroller.showSupportViewInlineEditor()\">[ debug ]</a></div><hr />"
92
92
  }
93
93
  ],
94
94
 
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <title>Complex Table.</title>
5
5
  <style id="PICT-CSS"></style>
6
- <script src="./pict.min.js" type="text/javascript"></script>
6
+ <script src="./pict.js" type="text/javascript"></script>
7
7
  <script type="text/javascript">Pict.safeOnDocumentReady(() => { Pict.safeLoadPictApplication(ComplexTabularApplication, 0)});</script>
8
8
  <!-- CSS placed here to simulate an external collection where we can leverage existing class names/patterns -->
9
9
  <style type="text/css">
@@ -30,7 +30,7 @@
30
30
  [
31
31
  {
32
32
  "HashPostfix": "-Template-Wrap-Prefix",
33
- "Template": "<h1>Rectangular Area Solver Micro-app</h1><div><a href=\"#\" onclick=\"{~P~}.PictApplication.solve()\">[ solve ]</a> <a href=\"#\" onclick=\"{~P~}.views.PictFormMetacontroller.showSupportViewInlineEditor()\">[ editor ]</a></div><hr />"
33
+ "Template": "<h1>Rectangular Area Solver Micro-app</h1><div><a href=\"#\" onclick=\"{~P~}.PictApplication.solve()\">[ solve ]</a> <a href=\"#\" onclick=\"{~P~}.views.PictFormMetacontroller.showSupportViewInlineEditor()\">[ debug ]</a></div><hr />"
34
34
  }
35
35
  ]
36
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pict-section-form",
3
- "version": "1.0.130",
3
+ "version": "1.0.132",
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.36.0",
33
33
  "jquery": "^3.7.1",
34
- "pict": "^1.0.310",
34
+ "pict": "^1.0.312",
35
35
  "pict-application": "^1.0.29",
36
36
  "pict-service-commandlineutility": "^1.0.15",
37
37
  "quackage": "^1.0.42",
@@ -172,7 +172,8 @@ class DynamicTabularData extends libPictProvider
172
172
  {
173
173
  tmpRowPrototype = JSON.parse(JSON.stringify(tmpGroup.DefaultRows[tmpDestinationObject.length]));
174
174
  }
175
- tmpDestinationObject.push(tmpGroup.supportingManifest.populateDefaults(tmpRowPrototype))
175
+ tmpDestinationObject.push(tmpGroup.supportingManifest.populateDefaults(tmpRowPrototype));
176
+ this.pict.providers.DynamicSolver.solveViews();
176
177
  pView.render();
177
178
  pView.marshalToView();
178
179
  }
@@ -180,6 +181,7 @@ class DynamicTabularData extends libPictProvider
180
181
  {
181
182
  let tmpRowIndex = pView.fable.getUUID();
182
183
  tmpDestinationObject[tmpRowIndex] = tmpGroup.supportingManifest.populateDefaults({});
184
+ this.pict.providers.DynamicSolver.solveViews();
183
185
  pView.render();
184
186
  pView.marshalToView();
185
187
  }
@@ -253,8 +255,11 @@ class DynamicTabularData extends libPictProvider
253
255
  }
254
256
  let tmpElementToBeMoved = tmpDestinationObject.splice(tmpRowIndex, 1);
255
257
  tmpDestinationObject.splice(tmpNewRowIndex, 0, tmpElementToBeMoved[0]);
258
+ this.pict.providers.DynamicSolver.solveViews();
256
259
  pView.render();
257
- pView.marshalToView();
260
+ //pView.marshalToView();
261
+ // We've re-rendered but we don't know what needs to be marshaled based on the solve that ran above so marshal everything
262
+ this.pict.views.PictFormMetacontroller.marshalFormSections();
258
263
  }
259
264
  else if (typeof(tmpDestinationObject) === 'object')
260
265
  {
@@ -289,8 +294,11 @@ class DynamicTabularData extends libPictProvider
289
294
  }
290
295
  let tmpElementToBeMoved = tmpDestinationObject.splice(tmpRowIndex, 1);
291
296
  tmpDestinationObject.splice(tmpRowIndex + 1, 0, tmpElementToBeMoved[0]);
297
+ this.pict.providers.DynamicSolver.solveViews();
292
298
  pView.render();
293
- pView.marshalToView();
299
+ //pView.marshalToView();
300
+ // We've re-rendered but we don't know what needs to be marshaled based on the solve that ran above so marshal everything
301
+ this.pict.views.PictFormMetacontroller.marshalFormSections();
294
302
  }
295
303
  else if (typeof(tmpDestinationObject) === 'object')
296
304
  {
@@ -330,8 +338,11 @@ class DynamicTabularData extends libPictProvider
330
338
  }
331
339
  let tmpElementToBeMoved = tmpDestinationObject.splice(tmpRowIndex, 1);
332
340
  tmpDestinationObject.splice(tmpRowIndex - 1, 0, tmpElementToBeMoved[0]);
341
+ this.pict.providers.DynamicSolver.solveViews();
333
342
  pView.render();
334
- pView.marshalToView();
343
+ //pView.marshalToView();
344
+ // We've re-rendered but we don't know what needs to be marshaled based on the solve that ran above so marshal everything
345
+ this.pict.views.PictFormMetacontroller.marshalFormSections();
335
346
  }
336
347
  else if (typeof(tmpDestinationObject) === 'object')
337
348
  {
@@ -372,8 +383,11 @@ class DynamicTabularData extends libPictProvider
372
383
  return false;
373
384
  }
374
385
  tmpDestinationObject.splice(tmpRowIndex, 1);
386
+ this.pict.providers.DynamicSolver.solveViews();
375
387
  pView.render();
376
- pView.marshalToView();
388
+ //pView.marshalToView();
389
+ // We've re-rendered but we don't know what needs to be marshaled based on the solve that ran above so marshal everything
390
+ this.pict.views.PictFormMetacontroller.marshalFormSections();
377
391
  }
378
392
  else if (typeof(tmpDestinationObject) === 'object')
379
393
  {
@@ -384,8 +398,11 @@ class DynamicTabularData extends libPictProvider
384
398
  return false;
385
399
  }
386
400
  delete tmpDestinationObject[tmpRowIndex]
401
+ this.pict.providers.DynamicSolver.solveViews();
387
402
  pView.render();
388
- pView.marshalToView();
403
+ //pView.marshalToView();
404
+ // We've re-rendered but we don't know what needs to be marshaled based on the solve that ran above so marshal everything
405
+ this.pict.views.PictFormMetacontroller.marshalFormSections();
389
406
  }
390
407
  }
391
408
  }
@@ -41,7 +41,10 @@ class PictFormMetacontroller extends libPictViewClass
41
41
  this.SupportViewPrototypes = (
42
42
  {
43
43
  LifecycleVisualization: require('./support/Pict-View-PSF-LifeCycle-Visualization.js'),
44
- DebugViewer: require('./support/Pict-View-PSF-DebugViewer.js')
44
+ DebugViewer: require('./support/Pict-View-PSF-DebugViewer.js'),
45
+ AppDataViewer: require('./support/Pict-View-PSF-AppData-Visualization.js'),
46
+ SolverVisualization: require('./support/Pict-View-PSF-Solver-Visualization.js'),
47
+ SpecificSolveVisualization: require('./support/Pict-View-PSF-SpecificSolve-Visualization.js'),
45
48
  });
46
49
  }
47
50
 
@@ -489,6 +492,27 @@ class PictFormMetacontroller extends libPictViewClass
489
492
  }
490
493
  }
491
494
 
495
+ /**
496
+ * Marshals data to the form sections based on the provided filter and sort functions
497
+ *
498
+ * If no filter and sort functions are provided, render all form sections.
499
+ *
500
+ * @param {Function} [fFilterFunction] - The filter function used to filter the views.
501
+ * @param {SortFunction} [fSortFunction] - The sort function used to sort the views.
502
+ */
503
+ marshalFormSections(fFilterFunction, fSortFunction)
504
+ {
505
+ let tmpViewList = this.filterViews(fFilterFunction, fSortFunction);
506
+ for (let i = 0; i < tmpViewList.length; i++)
507
+ {
508
+ if (tmpViewList[i] === this)
509
+ {
510
+ continue;
511
+ }
512
+ tmpViewList[i].marshalToView();
513
+ }
514
+ }
515
+
492
516
  /**
493
517
  * Regenerates the DyunamicForm section templates based on the provided filter and sort function.
494
518
  *
@@ -1092,12 +1116,13 @@ class PictFormMetacontroller extends libPictViewClass
1092
1116
 
1093
1117
  showSupportViewInlineEditor()
1094
1118
  {
1095
- // 1. See if the Inline Editor support view is loaded
1096
- if (!("Pict-Form-DebugViewer" in this.pict.views))
1097
- {
1098
- // 2. Load the support view if it isn't
1099
- this.pict.addView("Pict-Form-DebugViewer", {}, this.SupportViewPrototypes.DebugViewer);
1100
- }
1119
+ // 1. See if the Support views are loaded
1120
+ // 2. Load the support view if it isn't
1121
+ this.pict.addViewSingleton("Pict-Form-DebugViewer", {}, this.SupportViewPrototypes.DebugViewer);
1122
+ this.pict.addViewSingleton("Pict-Form-AppDataViewer", {}, this.SupportViewPrototypes.AppDataViewer);
1123
+ // this.pict.addViewSingleton("Pict-Form-LifecycleVisualization", {}, this.SupportViewPrototypes.LifecycleVisualization);
1124
+ this.pict.addViewSingleton("Pict-Form-SolverVisualization", {}, this.SupportViewPrototypes.SolverVisualization);
1125
+ // this.pict.addViewSingleton("Pict-Form-SpecificSolveVisualization", {}, this.SupportViewPrototypes.SpecificSolveVisualization);
1101
1126
 
1102
1127
  // 3. See if the container for the support view is loaded
1103
1128
  // 4. Render the container for the support view if it isn't loaded
@@ -0,0 +1,314 @@
1
+ const libPictProvider = require('pict-provider');
2
+
3
+ /** @type {Record<string, any>} */
4
+ const _DefaultProviderConfiguration = (
5
+ {
6
+ "ProviderIdentifier": "Pict-Form-SupportExtensions",
7
+
8
+ "AutoInitialize": true,
9
+ "AutoInitializeOrdinal": 0,
10
+
11
+ "AutoSolveWithApp": false
12
+ });
13
+
14
+ /**
15
+ * Represents a class that provides dynamic templates for the Pict form section provider.
16
+ * @extends libPictProvider
17
+ */
18
+ class PictSupportExtension extends libPictProvider
19
+ {
20
+ /**
21
+ * Constructs a new instance of the PictProviderDynamicTemplates class.
22
+ * @param {Object} pFable - The pFable object.
23
+ * @param {Object} pOptions - The options object.
24
+ * @param {Object} pServiceHash - The service hash object.
25
+ */
26
+ constructor(pFable, pOptions, pServiceHash)
27
+ {
28
+ let tmpOptions = Object.assign({}, JSON.parse(JSON.stringify(_DefaultProviderConfiguration)), pOptions);
29
+
30
+ super(pFable, tmpOptions, pServiceHash);
31
+
32
+ // These next blocks of code manually do what views often do, to support sharing of this across multiple views.
33
+
34
+ // Only add this css if it doesn't exist already in the css map
35
+ if (!('Pict-Support' in this.pict.CSSMap.inlineCSSMap))
36
+ {
37
+ this.pict.CSSMap.addCSS('Pict-Support',
38
+ /*css*/`
39
+ :root{
40
+ --PSF-Global-background-color: #dcdce5;
41
+ --PSF-Global-text-color: #333333;
42
+
43
+ --PSFExt-gutter-size: 5px;
44
+ --PSFExt-indentation-size: calc(2 * var(--PSFExt-gutter-size));
45
+ --PSFExt-Global-background-color: #dedede;
46
+ --PSFExt-Global-text-color: #333333;
47
+ --PSFExt-Section-background-color: #efefef;
48
+ --PSFExt-Section-button-color: #5A52A3;
49
+ --PSFExt-Section-button-text-color: #D8D7E5;
50
+ --PSFExt-Section-token-color: #eAf3a2;
51
+ --PSFExt-Section-label-color: #999;
52
+ --PSFExt-Section-Data-background-color: #fafafa;
53
+ --PSFExt-Section-Group-Header-background-color: #ebebff;
54
+ --PSFExt-Section-Group-Row-Header-background-color: #dcf0f0;
55
+ --PSFExt-Solver-Entry-text-color: #bb4a9c;
56
+ --PSFExt-Section-DynamicInput-background-color: #a3ccd8;
57
+ --PSFExt-Section-DynamicInput-button-color: #2b89a4;
58
+ --PSFExt-Section-DynamicInput-button-text-color: #D8D7E5;
59
+ }
60
+
61
+ /** Wrapping container */
62
+ #Pict-Form-Extensions-Wrap {
63
+ display:flex;
64
+ flex-direction: column;
65
+ height: 75vh;
66
+ overflow: hidden;
67
+ position: absolute;
68
+ left: 50%;
69
+ top: 0px;
70
+ width: 20vw;
71
+ min-width: 340px;
72
+ min-height: 200px;
73
+ }
74
+ #Pict-Form-Extension-DragControl {
75
+ background-color: #eae;
76
+ cursor: move;
77
+ padding: 4px 6px;
78
+ border-radius: 3px;
79
+ border: 1px solid #111;
80
+ }
81
+ #Pict-Form-Extensions-Container {
82
+ flex-grow: 1;
83
+ overflow: auto;
84
+ margin-top: 2px;
85
+ color: var(--PSF-Global-text-color);
86
+ background-color: var(--PSF-Global-background-color);
87
+ padding: 10px;
88
+ border: 4px double #111;
89
+ border-radius: 8px;
90
+ box-shadow: 2px 2px 10px rgba(0,0,0,0.5);
91
+ font-size: 14px;
92
+ font-family: Arial, sans-serif;
93
+ font-size: 14px;
94
+ }
95
+ #Pict-Form-Extension-ResizeControl {
96
+ background-color: #eae;
97
+ cursor: move;
98
+ padding: 4px 4px;
99
+ border-radius: 3px;
100
+ border: 1px solid #111;
101
+ }
102
+ .PSFExt-Extension-Footer {
103
+ text-align: right;
104
+ font-size: 10px;
105
+ font-weight: bold;
106
+ margin-top: 8px;
107
+ }
108
+
109
+ /** Headers */
110
+ .PSFExt-Extension-Header {
111
+ font-size: 10px;
112
+ font-weight: bold;
113
+ margin-bottom: var(--PSFExt-gutter-size);
114
+ }
115
+ .PSFExt-Global-Header {
116
+ padding: var(--PSFExt-gutter-size);
117
+ margin: 0;
118
+ }
119
+ .PSFExt-Section-Header {
120
+ padding: var(--PSFExt-gutter-size);
121
+ margin: 0;
122
+ }
123
+ .PSFExt-Content-Header {
124
+ padding: var(--PSFExt-gutter-size);
125
+ margin: 0;
126
+ background-color: var(--PSFExt-Section-background-color);
127
+ }
128
+ .PSFExt-Data-Header {
129
+ font-weight: bold;
130
+ border-bottom: 1px dotted #ccc;
131
+ padding: var(--PSFExt-gutter-size);
132
+ }
133
+ /** Section content */
134
+ .PSFExt-Section {
135
+ margin: var(--PSFExt-gutter-size);
136
+ padding: var(--PSFExt-gutter-size);
137
+ background-color: var(--PSFExt-Section-background-color);
138
+ border-radius: 4px;
139
+ }
140
+ .PSFExt-Section-Descriptors {
141
+ padding: var(--PSFExt-gutter-size) 0;
142
+ }
143
+ .PSFExt-Section-Group {
144
+ padding: var(--PSFExt-gutter-size);
145
+ }
146
+ .PSFExt-Section-Buttons {
147
+ list-style-type: none;
148
+ padding: 0;
149
+ padding-bottom: var(--PSFExt-gutter-size);
150
+ margin: calc(var(--PSFExt-gutter-size) * 2) var(--PSFExt-gutter-size);
151
+ }
152
+ .PSFExt-Section-Button {
153
+ display: inline;
154
+ margin-right: calc(var(--PSFExt-gutter-size) * 0.25);
155
+ text-decoration: none;
156
+ background-color: var(--PSFExt-Section-button-color);
157
+ padding: var(--PSFExt-gutter-size);
158
+ border-radius: var(--PSFExt-gutter-size);
159
+ }
160
+ .PSFExt-Section-Button a {
161
+ text-decoration: none;
162
+ color: var(--PSFExt-Section-button-text-color);
163
+ }
164
+ .PSFExt-Section-Button a:hover {
165
+ text-decoration: underline;
166
+ }
167
+ .PSFExt-Section-Solver-Entry:not(:last-child) {
168
+ border-bottom: 1px solid #ccc;
169
+ }
170
+ .PSFExt-Solver-Entry {
171
+ font-family: "Courier New", "Lucida Console", monospace;
172
+ font-weight: bold;
173
+ margin-top: var(--PSFExt-gutter-size);
174
+ padding: var(--PSFExt-gutter-size);
175
+ line-height: 1.2;
176
+ color: var(--PSFExt-Solver-Entry-text-color);
177
+ border-bottom: 1px dotted #ccc;
178
+ }
179
+ .PSFExt-Solver-Result {
180
+ font-family: "Courier New", "Lucida Console", monospace;
181
+ font-weight: bold;
182
+ margin-top: var(--PSFExt-gutter-size);
183
+ padding: 0 var(--PSFExt-gutter-size);
184
+ line-height: 1.2;
185
+ }
186
+ .PSFExt-Section-ExtraData {
187
+ padding-top: calc(var(--PSFExt-gutter-size) / 2);
188
+ padding-bottom: calc(var(--PSFExt-gutter-size) / 2);
189
+ background-color: var(--PSFExt-Section-Data-background-color);
190
+ }
191
+ .PSFExt-Section-Group .PSFExt-Content-Header.PSFExt-Section-Group-Header {
192
+ background-color: var(--PSFExt-Section-Group-Header-background-color);
193
+ }
194
+ .PSFExt-Section-Group .PSFExt-Content-Header.PSFExt-Section-Group-Row-Header {
195
+ background-color: var(--PSFExt-Section-Group-Row-Header-background-color);
196
+ }
197
+ .PSFExt-DeEmphasize {
198
+ color: var(--PSFExt-Section-label-color);
199
+ font-size: smaller;
200
+ }
201
+ .PSFExt-Data {
202
+ margin-left: var(--PSFExt-indentation-size);
203
+ line-height: 0.85;
204
+ font-size: smaller;
205
+ }
206
+ .PSFExt-Data-Table {
207
+ width: 100%;
208
+ border-collapse: collapse;
209
+ margin-left: var(--PSFExt-indentation-size);
210
+ margin-top: var(--PSFExt-gutter-size);
211
+ margin-bottom: var(--PSFExt-gutter-size);
212
+ overflow-x: auto;
213
+ }
214
+ .PSFExt-Label {
215
+ min-width: 15%;
216
+ color: var(--PSFExt-Section-label-color);
217
+ margin: var(--PSFExt-gutter-size) 0;
218
+ }
219
+ .PSFExt-Label::after {
220
+ content: ": ";
221
+ }
222
+ .PSFExt-Hidden {
223
+ display: none;
224
+ }
225
+ .PSFExt-Section-Solver-DynamicInput {
226
+ background-color: #ffffff;
227
+ }
228
+
229
+ /** empty states */
230
+ .PSFExt-Section-Solvers:empty::before {
231
+ content: "No Section Solvers Defined";
232
+ font-style: italic;
233
+ color: var(--PSFExt-Section-label-color);
234
+ margin-left: var(--PSFExt-indentation-size);
235
+ text-align: center;
236
+ padding: var(--PSFExt-gutter-size);
237
+ display: block;
238
+ font-size: smaller;
239
+ }
240
+ .PSFExt-Group-Solvers:empty::before {
241
+ content: "No Group/RecordSet Solvers Defined";
242
+ font-style: italic;
243
+ color: var(--PSFExt-Section-label-color);
244
+ margin-left: var(--PSFExt-indentation-size);
245
+ text-align: center;
246
+ padding: var(--PSFExt-gutter-size);
247
+ display: block;
248
+ font-size: smaller;
249
+ }
250
+ .PSFExt-ExpressionEditbox {
251
+ width: calc(100% - 20px);
252
+ resize: vertical;
253
+ min-height: 80px;
254
+ font-family: monospace;
255
+ font-size: 0.9em;
256
+ }
257
+ .PSFExt-Token {
258
+ background-color: var(--PSFExt-Section-token-color);
259
+ }
260
+ `, 1000, 'Pict-Form-SupportBase');
261
+ }
262
+
263
+ // Only add these templates if they doesn't exist
264
+ if (this.pict.TemplateProvider.getTemplate('Pict-Form-Support-Container') == null)
265
+ {
266
+ this.pict.TemplateProvider.addTemplate('Pict-Form-Support-Container',
267
+ /*html*/`
268
+ <div id="Pict-Form-Extensions-Wrap">
269
+ <p class="PSFExt-Extension-Header"><span id="Pict-Form-Extension-DragControl" class="PSDV-Extension-Header-Controlbar">Pict.Extensions {~TS:Pict-Form-Support-Container-Link:Pict.providers[Pict-Form-SupportExtensions].getSupportViewLinks()~} <a href="javascript:void(0);" onclick="{~P~}.ContentAssignment.toggleClass('#Pict-Form-Extensions-Container', 'PSFExt-Hidden');{~P~}.ContentAssignment.toggleClass('#Pict-Form-Extensions-Footer', 'PSFExt-Hidden');">toggle</a></span></p>
270
+ <div id="Pict-Form-Extensions-Container"></div>
271
+ <p id="Pict-Form-Extensions-Footer" class="PSFExt-Extension-Footer"><span id="Pict-Form-Extension-ResizeControl">Pict.Extensions Resize</span></p>
272
+ </div>
273
+ `);
274
+ }
275
+ if (this.pict.TemplateProvider.getTemplate('Pict-Form-Support-Container-Link') == null)
276
+ {
277
+ this.pict.TemplateProvider.addTemplate('Pict-Form-Support-Container-Link',
278
+ /*html*/` [ <a href="{~D:Record.Link~}" onclick="{~D:Record.OnClick~}" data-shortname="{~D:Record.ShortName~}" data-longname="{~D:Record.LongName~}">{~D:Record.ShortName~}</a> ] `);
279
+ }
280
+
281
+
282
+ this.SupportViews = {};
283
+ }
284
+
285
+ registerSupportView(pView)
286
+ {
287
+ this.pict.log.info(`Registering support view ${pView.Hash} with Pict Support Extension provider.`);
288
+ this.SupportViews[pView.Hash] = pView;
289
+ }
290
+
291
+ getSupportViewLinks()
292
+ {
293
+ let tmpLinks = [];
294
+ let tmpSupportViewHashes = Object.keys(this.SupportViews);
295
+ for (let i = 0; i < tmpSupportViewHashes.length; i++)
296
+ {
297
+ let tmpViewHash = tmpSupportViewHashes[i];
298
+ let tmpView = this.SupportViews[tmpViewHash];
299
+ tmpLinks.push(
300
+ {
301
+ Hash: tmpView.Hash,
302
+ Link: `javascript:void(0);`,
303
+ ShortName: tmpView.DisplayShortName,
304
+ LongName: tmpView.DisplayLongName,
305
+ OnClick: `${this.pict.browserAddress}.views['${tmpView.Hash}'].render()`
306
+ }
307
+ );
308
+ }
309
+ return tmpLinks;
310
+ }
311
+ }
312
+
313
+ module.exports = PictSupportExtension;
314
+ module.exports.default_configuration = _DefaultProviderConfiguration;
@@ -0,0 +1,137 @@
1
+ const libPictViewFormSupportBase = require(`./Pict-View-PSF-SupportBase.js`);
2
+
3
+ const defaultViewConfiguration = (
4
+ {
5
+ ViewIdentifier: "Pict-Form-AppData",
6
+
7
+ DefaultRenderable: 'Pict-Form-AppData-Renderable',
8
+ DefaultDestinationAddress: "#Pict-Form-Extensions-Container",
9
+
10
+ RenderOnLoad: false,
11
+
12
+ CSS: /*css*/``,
13
+
14
+ Templates: [
15
+ {
16
+ Hash: "Pict-Form-AppData-Content",
17
+ Template: /*html*/`
18
+ <div id="Pict-Form-AppData-Content">
19
+ <h2 class="PSFAD-Global-Header">Pict Form Data Visualization</h2>
20
+ <p class="PSFExt-Data">
21
+ <span class="PSFExt-Label">Form Marshal Destination</span> {~D:Pict.views.PictFormMetacontroller.viewMarshalDestination~}
22
+ </p>
23
+ <p class="PSFExt-Data">
24
+ <span class="PSFExt-Label">Form Data</span> [<a href="javascript:void(0);" onclick="{~P~}.views['{~D:Context[0].Hash~}'].downloadJSONObjectAsFile('Pict.{~D:Pict.views.PictFormMetacontroller.viewMarshalDestination~}')">Download JSON</a>]
25
+ </p>
26
+ <p class="PSFExt-Data">
27
+ <span class="PSFExt-Label">AppData</span> [<a href="javascript:void(0);" onclick="{~P~}.views['{~D:Context[0].Hash~}'].downloadJSONObjectAsFile('Pict.AppData')">Download AppData JSON</a>]
28
+ </p>
29
+ <p class="PSFExt-Data">
30
+ <span class="PSFExt-Label">Fable Settings</span> [<a href="javascript:void(0);" onclick="{~P~}.views['{~D:Context[0].Hash~}'].downloadJSONObjectAsFile('Pict.settings')">Download fable settings JSON</a>]
31
+ </p>
32
+ <p class="PSFExt-Data">
33
+ <span class="PSFExt-Label">Application Options</span> [<a href="javascript:void(0);" onclick="{~P~}.views['{~D:Context[0].Hash~}'].downloadJSONObjectAsFile('Pict.PictApplication.options')">Download Application options JSON</a>]
34
+ </p>
35
+ <div id="PSFExt-Data-Browser" class="PSFExt-Section">
36
+ {~TVS:Pict-Form-AppData:Context[0].flattenMarshalDestination()~}
37
+ </div>
38
+ `
39
+ },
40
+ {
41
+ Hash: "Pict-Form-AppData",
42
+ Template: /*html*/`
43
+ <div class="PSFExt-Section">
44
+ <h3 class="PSFExt-Section-Header"><span class="PSFExt-DeEmphasize">Address:</span>
45
+ {~D:Record.Key~}
46
+ </h3>
47
+ <div id="PSFExt-AD-{~D:Record.Key~}-Extra" class="PSFExt-Section-ExtraData">
48
+ {~TIfAbs:Pict-Form-AppData-ObjectValueDisplay:Record:Record.Value.DataType^==^Object~}
49
+ {~TIfAbs:Pict-Form-AppData-NotObjectValueDisplay:Record:Record.Value.DataType^!=^Object~}
50
+ </div>
51
+ </div>
52
+ `
53
+ },
54
+ {
55
+ Hash: "Pict-Form-AppData-NotObjectValueDisplay",
56
+ Template: /*html*/`
57
+ <!-- Not Object Value Display -->
58
+ {~TIfAbs:Pict-Form-AppData-ArrayValueDisplay:Record:Record.Value.DataType^==^Array~}
59
+ {~TIfAbs:Pict-Form-AppData-PrimitiveValueDisplay:Record:Record.Value.DataType^!=^Array~}
60
+ `
61
+ },
62
+ {
63
+ Hash: "Pict-Form-AppData-ObjectValueDisplay",
64
+ Template: /*html*/`
65
+ <!-- Object Value Display -->
66
+ <p class="PSFExt-Data">
67
+ <span class="PSFExt-Label">Type</span> Javascript Object {~T:Pict-Form-AppData-ObjectDownloadLink~}
68
+ </p>
69
+ `
70
+ },
71
+ {
72
+ Hash: "Pict-Form-AppData-ArrayValueDisplay",
73
+ Template: /*html*/`
74
+ <!-- Array Value Display -->
75
+ <p class="PSFExt-Data">
76
+ <span class="PSFExt-Label">Type</span> Array {~TIfAbs:Pict-Form-AppData-ArrayDownloadLink~}
77
+
78
+ </p>
79
+ `
80
+ },
81
+ {
82
+ Hash: "Pict-Form-AppData-PrimitiveValueDisplay",
83
+ Template: /*html*/`
84
+ <!-- Primitive Value Display -->
85
+ <p class="PSFExt-Data">
86
+ <span class="PSFExt-Label">Value</span> {~D:Record.Value.Default~}
87
+ </p>
88
+ `
89
+ },
90
+ {
91
+ Hash: "Pict-Form-AppData-ObjectDownloadLink",
92
+ Template: /*html*/`[<a href="javascript:void(0);" onclick="{~P~}.views['{~D:Context[0].Hash~}'].downloadJSONObjectAsFile('Pict.{~D:Pict.views.PictFormMetacontroller.viewMarshalDestination~}')">Download JSON</a>]`
93
+ },
94
+ {
95
+ Hash: "Pict-Form-AppData-ArrayDownloadLink",
96
+ Template: /*html*/`[<a href="javascript:void(0);" onclick="{~P~}.views['{~D:Context[0].Hash~}'].downloadJSONObjectAsFile('Pict.{~D:Pict.views.PictFormMetacontroller.viewMarshalDestination~}')">Download Array</a>]`
97
+ }
98
+ ],
99
+ Renderables: [
100
+ {
101
+ RenderableHash: "Pict-Form-AppData-Renderable",
102
+ TemplateHash: "Pict-Form-AppData-Content"
103
+ }
104
+ ]
105
+ });
106
+
107
+ class PictFormsAppData extends libPictViewFormSupportBase
108
+ {
109
+ constructor(pFable, pOptions, pServiceHash)
110
+ {
111
+ super(pFable, pOptions, pServiceHash);
112
+
113
+ this.DisplayShortName = 'FD';
114
+ this.DisplayLongName = 'FormData';
115
+ }
116
+
117
+ flattenMarshalDestination()
118
+ {
119
+ return this.flattenAddress(this.pict.views.PictFormMetacontroller.viewMarshalDestination);
120
+ }
121
+
122
+ flattenAppData()
123
+ {
124
+ return this.flattenAddress('AppData');
125
+ }
126
+
127
+ flattenAddress(pAddress)
128
+ {
129
+ let tmpData = this.pict.resolveStateFromAddress(pAddress);
130
+ // Now flatten the entire data structure...
131
+ return this.pict.manifest.objectAddressGeneration.generateAddressses(tmpData);
132
+ }
133
+ }
134
+
135
+ module.exports = PictFormsAppData;
136
+
137
+ module.exports.default_configuration = defaultViewConfiguration;