pict-section-form 1.0.131 → 1.0.133
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/complex_table/html/index.html +2 -2
- package/example_applications/simple_form/Simple-Form_Default_Manifest.json +1 -1
- package/package.json +3 -3
- package/source/views/Pict-View-Form-Metacontroller.js +57 -18
- package/source/views/support/Pict-Provider-PSF-Support.js +314 -0
- package/source/views/support/Pict-View-PSF-AppData-Visualization.js +137 -0
- package/source/views/support/Pict-View-PSF-DebugViewer.js +68 -187
- package/source/views/support/Pict-View-PSF-LifeCycle-Visualization.js +19 -10
- package/source/views/support/Pict-View-PSF-Solver-Visualization.js +164 -0
- package/source/views/support/Pict-View-PSF-SpecificSolve-Visualization.js +45 -0
- package/source/views/support/Pict-View-PSF-SupportBase.js +220 -36
- package/types/source/providers/Pict-Provider-DynamicTabularData.d.ts.map +1 -1
- package/types/source/views/Pict-View-Form-Metacontroller.d.ts +23 -1
- package/types/source/views/Pict-View-Form-Metacontroller.d.ts.map +1 -1
- package/types/source/views/support/Pict-Provider-PSF-Support.d.ts +30 -0
- package/types/source/views/support/Pict-Provider-PSF-Support.d.ts.map +1 -0
- package/types/source/views/support/Pict-View-PSF-AppData-Visualization.d.ts +26 -0
- package/types/source/views/support/Pict-View-PSF-AppData-Visualization.d.ts.map +1 -0
- package/types/source/views/support/Pict-View-PSF-DebugViewer.d.ts +2 -11
- package/types/source/views/support/Pict-View-PSF-DebugViewer.d.ts.map +1 -1
- package/types/source/views/support/Pict-View-PSF-LifeCycle-Visualization.d.ts +5 -5
- package/types/source/views/support/Pict-View-PSF-LifeCycle-Visualization.d.ts.map +1 -1
- package/types/source/views/support/Pict-View-PSF-Solver-Visualization.d.ts +22 -0
- package/types/source/views/support/Pict-View-PSF-Solver-Visualization.d.ts.map +1 -1
- package/types/source/views/support/Pict-View-PSF-SpecificSolve-Visualization.d.ts +23 -0
- package/types/source/views/support/Pict-View-PSF-SpecificSolve-Visualization.d.ts.map +1 -0
- package/types/source/views/support/Pict-View-PSF-SupportBase.d.ts +4 -1
- 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()\">[
|
|
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.
|
|
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">
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
</style>
|
|
35
35
|
</head>
|
|
36
36
|
<body>
|
|
37
|
-
<button type="button" onclick="_Pict.views.PictFormMetacontroller.injectManifestsByHash(['DynamicSection1'], 'FruitGrid');
|
|
37
|
+
<button type="button" onclick="_Pict.views.PictFormMetacontroller.injectManifestsByHash(['DynamicSection1'], 'FruitGrid');">Add Dynamic Section</button>
|
|
38
38
|
<div id="Pict-Form-Container"></div>
|
|
39
39
|
<script src="./complex_tabular_application.js" type="text/javascript"></script>
|
|
40
40
|
</body>
|
|
@@ -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()\">[
|
|
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.
|
|
3
|
+
"version": "1.0.133",
|
|
4
4
|
"description": "Pict dynamic form sections",
|
|
5
5
|
"main": "source/Pict-Section-Form.js",
|
|
6
6
|
"directories": {
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"browser-env": "^3.3.0",
|
|
32
32
|
"eslint": "^9.36.0",
|
|
33
33
|
"jquery": "^3.7.1",
|
|
34
|
-
"pict": "^1.0.
|
|
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",
|
|
38
38
|
"tui-grid": "^4.21.22",
|
|
39
|
-
"typescript": "^5.9.
|
|
39
|
+
"typescript": "^5.9.3"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"fable-serviceproviderbase": "^3.0.15",
|
|
@@ -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
|
|
|
@@ -195,11 +198,38 @@ class PictFormMetacontroller extends libPictViewClass
|
|
|
195
198
|
/**
|
|
196
199
|
* @param {Record<string, any>} pManifest - The manifest to add
|
|
197
200
|
* @param {string} [pAfterSectionHash] - The hash of the section to add after. Omit to add to the start.
|
|
201
|
+
* @param {string} [pUUID] - (optional) The UUID to use for uniqueness. If not provided, a new one will be generated.
|
|
202
|
+
*
|
|
203
|
+
* @return {Array<import('./Pict-View-DynamicForm.js')>} the views that correspond to the newly added sections
|
|
204
|
+
*/
|
|
205
|
+
injectManifestAndRender(pManifest, pAfterSectionHash, pUUID)
|
|
206
|
+
{
|
|
207
|
+
const tmpManifest = pUUID ? this.createDistinctManifest(pManifest, pUUID) : pManifest;
|
|
208
|
+
const tmpViewsToRender = this.injectManifest(tmpManifest, pAfterSectionHash);
|
|
209
|
+
this.updateMetatemplateInDOM();
|
|
210
|
+
//FIXME: for some reason, DOM append is not synchronous, so we need to delay the render....................?
|
|
211
|
+
setTimeout(() =>
|
|
212
|
+
{
|
|
213
|
+
for (const tmpViewToRender of tmpViewsToRender)
|
|
214
|
+
{
|
|
215
|
+
tmpViewToRender.render();
|
|
216
|
+
}
|
|
217
|
+
}, 0);
|
|
218
|
+
|
|
219
|
+
return tmpViewsToRender;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* @param {Record<string, any>} pManifest - The manifest to add
|
|
224
|
+
* @param {string} [pAfterSectionHash] - The hash of the section to add after. Omit to add to the start.
|
|
225
|
+
*
|
|
226
|
+
* @return {Array<import('./Pict-View-DynamicForm.js')>} the views that correspond to the newly added sections; note that these views are NOT rendered yet
|
|
198
227
|
*/
|
|
199
228
|
injectManifest(pManifest, pAfterSectionHash)
|
|
200
229
|
{
|
|
230
|
+
const tmpAfterSectionHash = pAfterSectionHash ? (pAfterSectionHash.startsWith('PictSectionForm-') ? pAfterSectionHash : `PictSectionForm-${pAfterSectionHash}`) : null;
|
|
201
231
|
const tmpAllViewKeys = Object.keys(this.pict.views);
|
|
202
|
-
const tmpReferenceManifestViewIndex =
|
|
232
|
+
const tmpReferenceManifestViewIndex = tmpAfterSectionHash ? tmpAllViewKeys.indexOf(tmpAfterSectionHash) : -1;
|
|
203
233
|
const tmpViewsToShift = [];
|
|
204
234
|
if (tmpReferenceManifestViewIndex >= 0)
|
|
205
235
|
{
|
|
@@ -211,22 +241,20 @@ class PictFormMetacontroller extends libPictViewClass
|
|
|
211
241
|
delete this.pict.views[tmpKey];
|
|
212
242
|
}
|
|
213
243
|
}
|
|
214
|
-
const tmpViewsToRender = this.bootstrapAdditiveManifest(pManifest,
|
|
244
|
+
const tmpViewsToRender = this.bootstrapAdditiveManifest(pManifest, tmpAfterSectionHash);
|
|
215
245
|
for (const tmpViewToShift of tmpViewsToShift)
|
|
216
246
|
{
|
|
217
247
|
this.pict.views[tmpViewToShift.key] = tmpViewToShift.view;
|
|
218
248
|
}
|
|
219
249
|
// this ensures if we re-render everything, we have the new sections in the template
|
|
220
250
|
this.generateMetatemplate();
|
|
221
|
-
|
|
222
|
-
//FIXME: for some reason, DOM append is not synchronous, so we need to delay the render....................?
|
|
223
|
-
setTimeout(() =>
|
|
251
|
+
for (const tmpViewToRender of tmpViewsToRender)
|
|
224
252
|
{
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
253
|
+
tmpViewToRender.rebuildCustomTemplate();
|
|
254
|
+
}
|
|
255
|
+
this.pict.CSSMap.injectCSS();
|
|
256
|
+
|
|
257
|
+
return tmpViewsToRender;
|
|
230
258
|
}
|
|
231
259
|
|
|
232
260
|
/**
|
|
@@ -284,15 +312,25 @@ class PictFormMetacontroller extends libPictViewClass
|
|
|
284
312
|
*/
|
|
285
313
|
injectManifestsByHash(pManifestHashes, pAfterSectionHash, pUUID)
|
|
286
314
|
{
|
|
315
|
+
let tmpViewsToRender = [];
|
|
287
316
|
for (const tmpManifestHash of pManifestHashes)
|
|
288
317
|
{
|
|
289
318
|
const tmpManifest = this.findDynamicSectionManifestDefinition(tmpManifestHash);
|
|
290
319
|
if (tmpManifest)
|
|
291
320
|
{
|
|
292
321
|
const tmpUniqueManifest = this.createDistinctManifest(tmpManifest, pUUID);
|
|
293
|
-
this.injectManifest(tmpUniqueManifest, pAfterSectionHash);
|
|
322
|
+
const tmpViews = this.injectManifest(tmpUniqueManifest, pAfterSectionHash);
|
|
323
|
+
tmpViewsToRender = tmpViewsToRender.concat(tmpViews);
|
|
294
324
|
}
|
|
295
325
|
}
|
|
326
|
+
this.updateMetatemplateInDOM();
|
|
327
|
+
setTimeout(() =>
|
|
328
|
+
{
|
|
329
|
+
for (const tmpViewToRender of tmpViewsToRender)
|
|
330
|
+
{
|
|
331
|
+
tmpViewToRender.render();
|
|
332
|
+
}
|
|
333
|
+
}, 0);
|
|
296
334
|
}
|
|
297
335
|
|
|
298
336
|
/**
|
|
@@ -1113,12 +1151,13 @@ class PictFormMetacontroller extends libPictViewClass
|
|
|
1113
1151
|
|
|
1114
1152
|
showSupportViewInlineEditor()
|
|
1115
1153
|
{
|
|
1116
|
-
// 1. See if the
|
|
1117
|
-
if
|
|
1118
|
-
{
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
}
|
|
1154
|
+
// 1. See if the Support views are loaded
|
|
1155
|
+
// 2. Load the support view if it isn't
|
|
1156
|
+
this.pict.addViewSingleton("Pict-Form-DebugViewer", {}, this.SupportViewPrototypes.DebugViewer);
|
|
1157
|
+
this.pict.addViewSingleton("Pict-Form-AppDataViewer", {}, this.SupportViewPrototypes.AppDataViewer);
|
|
1158
|
+
// this.pict.addViewSingleton("Pict-Form-LifecycleVisualization", {}, this.SupportViewPrototypes.LifecycleVisualization);
|
|
1159
|
+
this.pict.addViewSingleton("Pict-Form-SolverVisualization", {}, this.SupportViewPrototypes.SolverVisualization);
|
|
1160
|
+
// this.pict.addViewSingleton("Pict-Form-SpecificSolveVisualization", {}, this.SupportViewPrototypes.SpecificSolveVisualization);
|
|
1122
1161
|
|
|
1123
1162
|
// 3. See if the container for the support view is loaded
|
|
1124
1163
|
// 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;
|