pict-section-form 1.0.33 → 1.0.34
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/debug/data/Application.js +7 -0
- package/debug/data/index.html +13 -0
- package/debug/data/package.json +27 -0
- package/example_applications/complex_table/Complex-Tabular-Application.js +1 -2
- package/package.json +3 -3
- package/source/providers/Pict-Provider-DynamicSolver.js +6 -1
- package/source/providers/dynamictemplates/Pict-DynamicTemplates-DefaultFormTemplates.js +17 -0
- package/source/providers/inputs/Pict-Provider-Input-DateTime.js +69 -3
- package/source/providers/inputs/Pict-Provider-Input-Select.js +110 -1
- package/source/providers/inputs/Pict-Provider-Input-TabSelector.js +145 -0
- package/source/providers/layouts/Pict-Layout-TuiGrid/Pict-Section-TuiGrid.js +19 -0
- package/source/services/ManifestFactory.js +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const libPictSectionForm = require('../../source/Pict-Section-Form.js');
|
|
2
|
+
module.exports = libPictSectionForm.PictFormApplication;
|
|
3
|
+
module.exports.default_configuration.pict_configuration = (
|
|
4
|
+
{
|
|
5
|
+
"Product": "Debug",
|
|
6
|
+
"DefaultFormManifest": require("./ExampleForm.json")
|
|
7
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<title>Debug.</title>
|
|
5
|
+
<style id="PICT-CSS"></style>
|
|
6
|
+
<script src="./pict.min.js" type="text/javascript"></script>
|
|
7
|
+
<script type="text/javascript">Pict.safeOnDocumentReady(() => { Pict.safeLoadPictApplication(DebugApplication, 1)});</script>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="Pict-Form-Container"></div>
|
|
11
|
+
<script src="./debug_application.min.js" type="text/javascript"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "debug_application",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "Application.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"start": "node Application.js",
|
|
8
|
+
"build": "npx quack build && npx quack copy"
|
|
9
|
+
},
|
|
10
|
+
"author": "steven",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
},
|
|
14
|
+
"copyFilesSettings": {
|
|
15
|
+
"whenFileExists": "overwrite"
|
|
16
|
+
},
|
|
17
|
+
"copyFiles": [
|
|
18
|
+
{
|
|
19
|
+
"from": "./index.html",
|
|
20
|
+
"to": "./dist/"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"from": "../../node_modules/pict/dist/*",
|
|
24
|
+
"to": "./dist/"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
@@ -268,8 +268,7 @@ module.exports.default_configuration.pict_configuration = {
|
|
|
268
268
|
Name: "Fruits of the Earth",
|
|
269
269
|
Hash: "FruitGrid",
|
|
270
270
|
DataType: "Array",
|
|
271
|
-
Default: []
|
|
272
|
-
PictForm: { Section: "FruitGrid", Group: "FruitGrid" },
|
|
271
|
+
Default: []
|
|
273
272
|
},
|
|
274
273
|
|
|
275
274
|
"FruitData.FruityVice[].nutritions.calories": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pict-section-form",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.34",
|
|
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.9.0",
|
|
33
33
|
"jquery": "^3.7.1",
|
|
34
|
-
"pict": "^1.0.
|
|
34
|
+
"pict": "^1.0.215",
|
|
35
35
|
"pict-application": "^1.0.20",
|
|
36
36
|
"pict-service-commandlineutility": "^1.0.15",
|
|
37
37
|
"quackage": "^1.0.33",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"pict-provider": "^1.0.2",
|
|
43
43
|
"pict-section-tuigrid": "^1.0.26",
|
|
44
44
|
"pict-template": "^1.0.6",
|
|
45
|
-
"pict-view": "^1.0.
|
|
45
|
+
"pict-view": "^1.0.53"
|
|
46
46
|
},
|
|
47
47
|
"mocha": {
|
|
48
48
|
"diff": true,
|
|
@@ -4,6 +4,7 @@ const libDynamicMetaLists = require('./Pict-Provider-MetaLists.js');
|
|
|
4
4
|
|
|
5
5
|
const libInputSelect = require('./inputs/Pict-Provider-Input-Select.js');
|
|
6
6
|
const libInputDateTime = require('./inputs/Pict-Provider-Input-DateTime.js');
|
|
7
|
+
const libInputTabSelector = require('./inputs/Pict-Provider-Input-TabSelector.js');
|
|
7
8
|
|
|
8
9
|
const _DefaultProviderConfiguration = (
|
|
9
10
|
{
|
|
@@ -47,6 +48,10 @@ class PictDynamicSolver extends libPictProvider
|
|
|
47
48
|
{
|
|
48
49
|
this.pict.addProvider('Pict-Input-DateTime', libInputDateTime.default_configuration, libInputDateTime);
|
|
49
50
|
}
|
|
51
|
+
if (!this.pict.providers['Pict-Input-TabSelector']);
|
|
52
|
+
{
|
|
53
|
+
this.pict.addProvider('Pict-Input-TabSelector', libInputTabSelector.default_configuration, libInputTabSelector);
|
|
54
|
+
}
|
|
50
55
|
}
|
|
51
56
|
|
|
52
57
|
/**
|
|
@@ -121,7 +126,7 @@ class PictDynamicSolver extends libPictProvider
|
|
|
121
126
|
tmpView.log.trace(`Dynamic View [${tmpView.UUID}]::[${tmpView.Hash}] solving RecordSet ordinal ${tmpSolver.Ordinal} [${tmpSolver.Expression}]`);
|
|
122
127
|
}
|
|
123
128
|
|
|
124
|
-
let tmpRecordSet = tmpView.getTabularRecordSet(
|
|
129
|
+
let tmpRecordSet = tmpView.getTabularRecordSet(tmpGroup.GroupIndex);
|
|
125
130
|
|
|
126
131
|
if (typeof(tmpRecordSet) == 'object')
|
|
127
132
|
{
|
|
@@ -183,6 +183,23 @@ Glug glug glug Oo... -->
|
|
|
183
183
|
/*
|
|
184
184
|
* END Input Templates (default)
|
|
185
185
|
*/
|
|
186
|
+
/*
|
|
187
|
+
*
|
|
188
|
+
* [ External Control Templates START ]
|
|
189
|
+
*
|
|
190
|
+
*/
|
|
191
|
+
{
|
|
192
|
+
"HashPostfix": "-Template-Input-InputType-Tab",
|
|
193
|
+
"DefaultInputExtensions": ["Pict-Input-Tab"],
|
|
194
|
+
"Template": /*HTML*/`
|
|
195
|
+
<!-- InputType Option {~D:Record.Hash~} {~D:Record.DataType~} -->
|
|
196
|
+
<input type="hidden" {~D:Record.Macro.InputFullProperties~} {~D:Record.Macro.InputChangeHandler~} value="">
|
|
197
|
+
<span>{~D:Record.Name~}:</span> <select id="TAB-SELECT-FOR-{~D:Record.Macro.RawHTMLID~}" onchange="{~D:Record.Macro.DataRequestFunction~}"></select>
|
|
198
|
+
`
|
|
199
|
+
},
|
|
200
|
+
/*
|
|
201
|
+
* END View Management Templates (default)
|
|
202
|
+
*/
|
|
186
203
|
/*
|
|
187
204
|
*
|
|
188
205
|
* [ Basic Form Templates END ]
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
const libPictSectionInputExtension = require('../Pict-Provider-InputExtension.js');
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* CustomInputHandler class.
|
|
5
|
+
* Represents a custom input handler for a Pict section form.
|
|
6
|
+
* @extends libPictSectionInputExtension
|
|
7
|
+
*/
|
|
3
8
|
class CustomInputHandler extends libPictSectionInputExtension
|
|
4
9
|
{
|
|
5
10
|
constructor(pFable, pOptions, pServiceHash)
|
|
@@ -7,34 +12,87 @@ class CustomInputHandler extends libPictSectionInputExtension
|
|
|
7
12
|
super(pFable, pOptions, pServiceHash);
|
|
8
13
|
}
|
|
9
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Generates the HTML ID for a DateTime input element based on the given input HTML ID.
|
|
17
|
+
*
|
|
18
|
+
* @param {string} pInputHTMLID - The input HTML ID.
|
|
19
|
+
* @returns {string} The generated DateTime input HTML ID.
|
|
20
|
+
*/
|
|
10
21
|
getDateTimeInputHTMLID(pInputHTMLID)
|
|
11
22
|
{
|
|
12
23
|
return `#DATETIME-INPUT-FOR-${pInputHTMLID}`;
|
|
13
24
|
}
|
|
14
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Generates the HTML ID for a hidden input element in a tabular datetime data provider.
|
|
28
|
+
*
|
|
29
|
+
* @param {string} pInputHTMLID - The HTML ID of the input element.
|
|
30
|
+
* @param {number} pRowIndex - The index of the row in the tabular data.
|
|
31
|
+
* @returns {string} - The generated HTML ID for the hidden input element.
|
|
32
|
+
*/
|
|
15
33
|
getTabularDateTimeHiddenInputHTMLID(pInputHTMLID, pRowIndex)
|
|
16
34
|
{
|
|
17
35
|
return `#DATETIME-TABULAR-DATA-${pInputHTMLID}-${pRowIndex}`;
|
|
18
36
|
}
|
|
19
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Generates a tabular date-time input HTML ID based on the provided input HTML ID and row index.
|
|
40
|
+
*
|
|
41
|
+
* @param {string} pInputHTMLID - The input HTML ID.
|
|
42
|
+
* @param {number} pRowIndex - The row index.
|
|
43
|
+
* @returns {string} The tabular date-time input HTML ID.
|
|
44
|
+
*/
|
|
20
45
|
getTabularDateTimeInputHTMLID(pInputHTMLID, pRowIndex)
|
|
21
46
|
{
|
|
22
47
|
return `#DATETIME-TABULAR-INPUT-${pInputHTMLID}-${pRowIndex}`;
|
|
23
48
|
}
|
|
24
49
|
|
|
25
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Fires after data has been marshaled to the form.
|
|
52
|
+
*
|
|
53
|
+
* This is important because the DateTime has a "shadow" hidden input that stores the value for the date control.
|
|
54
|
+
*
|
|
55
|
+
* @param {Object} pView - The view object.
|
|
56
|
+
* @param {Object} pGroup - The group object.
|
|
57
|
+
* @param {Object} pRow - The row object.
|
|
58
|
+
* @param {Object} pInput - The input object.
|
|
59
|
+
* @param {any} pValue - The value to be assigned.
|
|
60
|
+
* @param {string} pHTMLSelector - The HTML selector.
|
|
61
|
+
* @returns {any} - The result of the super method call.
|
|
62
|
+
*/
|
|
26
63
|
onDataMarshalToForm(pView, pGroup, pRow, pInput, pValue, pHTMLSelector)
|
|
27
64
|
{
|
|
28
65
|
this.pict.ContentAssignment.assignContent(this.getDateTimeInputHTMLID(pInput.Macro.RawHTMLID), pValue);
|
|
29
66
|
return super.onDataMarshalToForm(pView, pGroup, pRow, pInput, pValue, pHTMLSelector);
|
|
30
67
|
}
|
|
31
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Marshals data to the form in a tabular format.
|
|
71
|
+
*
|
|
72
|
+
* @param {Object} pView - The view object.
|
|
73
|
+
* @param {Object} pGroup - The group object.
|
|
74
|
+
* @param {Object} pRow - The row object.
|
|
75
|
+
* @param {Object} pInput - The input object.
|
|
76
|
+
* @param {any} pValue - The value to be assigned.
|
|
77
|
+
* @param {string} pHTMLSelector - The HTML selector.
|
|
78
|
+
* @param {number} pRowIndex - The index of the row.
|
|
79
|
+
* @returns {any} - The result of the data marshaling.
|
|
80
|
+
*/
|
|
32
81
|
onDataMarshalToFormTabular(pView, pGroup, pInput, pValue, pHTMLSelector, pRowIndex)
|
|
33
82
|
{
|
|
34
83
|
this.pict.ContentAssignment.assignContent(this.getTabularDateTimeInputHTMLID(pInput.Macro.RawHTMLID, pRowIndex), pValue);
|
|
35
84
|
return super.onDataMarshalToFormTabular(pView, pGroup, pInput, pValue, pHTMLSelector, pRowIndex);
|
|
36
85
|
}
|
|
37
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Handles the data request event for the specified input.
|
|
89
|
+
*
|
|
90
|
+
* @param {Object} pView - The view object.
|
|
91
|
+
* @param {Object} pInput - The input object.
|
|
92
|
+
* @param {any} pValue - The value to be assigned.
|
|
93
|
+
* @param {string} pHTMLSelector - The HTML selector.
|
|
94
|
+
* @returns {boolean} - Returns true if the data request is successful, otherwise false.
|
|
95
|
+
*/
|
|
38
96
|
onDataRequest(pView, pInput, pValue, pHTMLSelector)
|
|
39
97
|
{
|
|
40
98
|
// TODO: Should this be opinionated about time zone? If so, this is the start of it.
|
|
@@ -63,6 +121,16 @@ class CustomInputHandler extends libPictSectionInputExtension
|
|
|
63
121
|
return super.onDataRequest(pView, pInput, pValue, pHTMLSelector);
|
|
64
122
|
}
|
|
65
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Handles the data request event for the specified input when in a tabular section.
|
|
126
|
+
*
|
|
127
|
+
* @param {Object} pView - The view object.
|
|
128
|
+
* @param {Object} pInput - The input object.
|
|
129
|
+
* @param {any} pValue - The value to be assigned.
|
|
130
|
+
* @param {string} pHTMLSelector - The HTML selector.
|
|
131
|
+
* @param {number} pRowIndex - The index of the row.
|
|
132
|
+
* @returns {boolean} - Returns true if the data request is successful, otherwise false.
|
|
133
|
+
*/
|
|
66
134
|
onDataRequestTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex)
|
|
67
135
|
{
|
|
68
136
|
// TODO: If we decide to be opinionated about time zone, use the above here as well
|
|
@@ -79,8 +147,6 @@ class CustomInputHandler extends libPictSectionInputExtension
|
|
|
79
147
|
|
|
80
148
|
return super.onDataRequestTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex);
|
|
81
149
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
150
|
}
|
|
85
151
|
|
|
86
152
|
module.exports = CustomInputHandler;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
const libPictSectionInputExtension = require('../Pict-Provider-InputExtension.js');
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* CustomInputHandler class.
|
|
5
|
+
*
|
|
6
|
+
* @class
|
|
7
|
+
* @extends libPictSectionInputExtension
|
|
8
|
+
* @memberof providers.inputs
|
|
9
|
+
*/
|
|
3
10
|
class CustomInputHandler extends libPictSectionInputExtension
|
|
4
11
|
{
|
|
5
12
|
constructor(pFable, pOptions, pServiceHash)
|
|
@@ -7,26 +14,57 @@ class CustomInputHandler extends libPictSectionInputExtension
|
|
|
7
14
|
super(pFable, pOptions, pServiceHash);
|
|
8
15
|
}
|
|
9
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Generates the HTML ID for a select input element.
|
|
19
|
+
*
|
|
20
|
+
* @param {string} pInputHTMLID - The HTML ID of the input element.
|
|
21
|
+
* @returns {string} - The generated HTML ID for the select input element.
|
|
22
|
+
*/
|
|
10
23
|
getSelectInputHTMLID(pInputHTMLID)
|
|
11
24
|
{
|
|
12
25
|
return `#SELECT-FOR-${pInputHTMLID}`;
|
|
13
26
|
}
|
|
14
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Generates a tabular select input ID based on the provided input HTML ID and row index.
|
|
30
|
+
*
|
|
31
|
+
* @param {string} pInputHTMLID - The input HTML ID.
|
|
32
|
+
* @param {number} pRowIndex - The row index.
|
|
33
|
+
* @returns {string} - The generated tabular select input ID.
|
|
34
|
+
*/
|
|
15
35
|
getTabularSelectInputID(pInputHTMLID, pRowIndex)
|
|
16
36
|
{
|
|
17
37
|
return `#SELECT-TABULAR-DATA-${pInputHTMLID}-${pRowIndex}`;
|
|
18
38
|
}
|
|
19
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Generates a tabular select dropdown ID based on the input HTML ID and row index.
|
|
42
|
+
*
|
|
43
|
+
* @param {string} pInputHTMLID - The HTML ID of the input.
|
|
44
|
+
* @param {number} pRowIndex - The index of the row.
|
|
45
|
+
* @returns {string} - The generated tabular select dropdown ID.
|
|
46
|
+
*/
|
|
20
47
|
getTabularSelectDropdownID(pInputHTMLID, pRowIndex)
|
|
21
48
|
{
|
|
22
49
|
return `#SELECT-TABULAR-DROPDOWN-${pInputHTMLID}-${pRowIndex}`;
|
|
23
50
|
}
|
|
24
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Initializes the input element for the Pict provider select input.
|
|
54
|
+
*
|
|
55
|
+
* @param {Object} pView - The view object.
|
|
56
|
+
* @param {Object} pGroup - The group object.
|
|
57
|
+
* @param {Object} pRow - The row object.
|
|
58
|
+
* @param {Object} pInput - The input object.
|
|
59
|
+
* @param {any} pValue - The input value.
|
|
60
|
+
* @param {string} pHTMLSelector - The HTML selector.
|
|
61
|
+
* @returns {boolean} - Returns true if the input element is successfully initialized, false otherwise.
|
|
62
|
+
*/
|
|
25
63
|
onInputInitialize(pView, pGroup, pRow, pInput, pValue, pHTMLSelector)
|
|
26
64
|
{
|
|
27
65
|
// Try to get the input element
|
|
28
66
|
let tmpInputSelectElement = this.pict.ContentAssignment.getElement(this.getSelectInputHTMLID(pInput.Macro.RawHTMLID));
|
|
29
|
-
let tmpDefaultData = pInput.PictForm
|
|
67
|
+
let tmpDefaultData = pInput.PictForm?.SelectOptions;
|
|
30
68
|
|
|
31
69
|
if (pInput.PictForm.SelectOptionsPickList && this.pict.providers.DynamicMetaLists.hasList(pView.Hash, pInput.PictForm.SelectOptionsPickList))
|
|
32
70
|
{
|
|
@@ -57,6 +95,17 @@ class CustomInputHandler extends libPictSectionInputExtension
|
|
|
57
95
|
return super.onInputInitialize(pView, pGroup, pRow, pInput, pValue, pHTMLSelector);
|
|
58
96
|
}
|
|
59
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Initializes a tabular input element.
|
|
100
|
+
*
|
|
101
|
+
* @param {Object} pView - The view object.
|
|
102
|
+
* @param {Object} pGroup - The group object.
|
|
103
|
+
* @param {Object} pInput - The input object.
|
|
104
|
+
* @param {any} pValue - The input value.
|
|
105
|
+
* @param {string} pHTMLSelector - The HTML selector.
|
|
106
|
+
* @param {number} pRowIndex - The index of the row.
|
|
107
|
+
* @returns {any} - The result of the initialization.
|
|
108
|
+
*/
|
|
60
109
|
onInputInitializeTabular(pView, pGroup, pInput, pValue, pHTMLSelector, pRowIndex)
|
|
61
110
|
{
|
|
62
111
|
// Try to get the input element
|
|
@@ -92,16 +141,46 @@ class CustomInputHandler extends libPictSectionInputExtension
|
|
|
92
141
|
return super.onInputInitializeTabular(pView, pGroup, pInput, pValue, pHTMLSelector, pRowIndex);
|
|
93
142
|
}
|
|
94
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Handles the change event for the data in the select input.
|
|
146
|
+
*
|
|
147
|
+
* @param {Object} pView - The view object.
|
|
148
|
+
* @param {Object} pInput - The input object.
|
|
149
|
+
* @param {any} pValue - The new value of the input.
|
|
150
|
+
* @param {string} pHTMLSelector - The HTML selector of the input.
|
|
151
|
+
* @returns {any} - The result of the super.onDataChange method.
|
|
152
|
+
*/
|
|
95
153
|
onDataChange(pView, pInput, pValue, pHTMLSelector)
|
|
96
154
|
{
|
|
97
155
|
return super.onDataChange(pView, pInput, pValue, pHTMLSelector);
|
|
98
156
|
}
|
|
99
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Handles the change event for tabular data.
|
|
160
|
+
*
|
|
161
|
+
* @param {Object} pView - The view object.
|
|
162
|
+
* @param {Object} pInput - The input object.
|
|
163
|
+
* @param {any} pValue - The new value.
|
|
164
|
+
* @param {string} pHTMLSelector - The HTML selector.
|
|
165
|
+
* @param {number} pRowIndex - The index of the row.
|
|
166
|
+
* @returns {any} - The result of the super method.
|
|
167
|
+
*/
|
|
100
168
|
onDataChangeTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex)
|
|
101
169
|
{
|
|
102
170
|
return super.onDataChangeTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex);
|
|
103
171
|
}
|
|
104
172
|
|
|
173
|
+
/**
|
|
174
|
+
* Marshals data to the form for the given input.
|
|
175
|
+
*
|
|
176
|
+
* @param {Object} pView - The view object.
|
|
177
|
+
* @param {Object} pGroup - The group object.
|
|
178
|
+
* @param {Object} pRow - The row object.
|
|
179
|
+
* @param {Object} pInput - The input object.
|
|
180
|
+
* @param {any} pValue - The value to be marshaled.
|
|
181
|
+
* @param {string} pHTMLSelector - The HTML selector.
|
|
182
|
+
* @returns {boolean} - Returns true if the value is successfully marshaled to the form, otherwise false.
|
|
183
|
+
*/
|
|
105
184
|
onDataMarshalToForm(pView, pGroup, pRow, pInput, pValue, pHTMLSelector)
|
|
106
185
|
{
|
|
107
186
|
let tmpInputSelectElement = this.pict.ContentAssignment.getElement(this.getSelectInputHTMLID(pInput.Macro.RawHTMLID));
|
|
@@ -135,6 +214,17 @@ class CustomInputHandler extends libPictSectionInputExtension
|
|
|
135
214
|
return super.onDataMarshalToForm(pView, pGroup, pRow, pInput, pValue, pHTMLSelector);
|
|
136
215
|
}
|
|
137
216
|
|
|
217
|
+
/**
|
|
218
|
+
* Marshals data to a form in tabular format.
|
|
219
|
+
*
|
|
220
|
+
* @param {Object} pView - The view object.
|
|
221
|
+
* @param {Object} pGroup - The group object.
|
|
222
|
+
* @param {Object} pInput - The input object.
|
|
223
|
+
* @param {any} pValue - The value parameter.
|
|
224
|
+
* @param {string} pHTMLSelector - The HTML selector parameter.
|
|
225
|
+
* @param {number} pRowIndex - The row index parameter.
|
|
226
|
+
* @returns {any} - The result of the data marshaling.
|
|
227
|
+
*/
|
|
138
228
|
onDataMarshalToFormTabular(pView, pGroup, pInput, pValue, pHTMLSelector, pRowIndex)
|
|
139
229
|
{
|
|
140
230
|
let tmpInputSelectElement = this.pict.ContentAssignment.getElement(this.getTabularSelectDropdownID(pInput.Macro.RawHTMLID, pRowIndex));
|
|
@@ -169,6 +259,15 @@ class CustomInputHandler extends libPictSectionInputExtension
|
|
|
169
259
|
return super.onDataMarshalToFormTabular(pView, pGroup, pInput, pValue, pHTMLSelector, pRowIndex);
|
|
170
260
|
}
|
|
171
261
|
|
|
262
|
+
/**
|
|
263
|
+
* Handles the data request event for a select input in the PictProviderInputSelect class.
|
|
264
|
+
*
|
|
265
|
+
* @param {Object} pView - The view object.
|
|
266
|
+
* @param {Object} pInput - The input object.
|
|
267
|
+
* @param {any} pValue - The value object.
|
|
268
|
+
* @param {string} pHTMLSelector - The HTML selector object.
|
|
269
|
+
* @returns {any} - The result of the onDataRequest method.
|
|
270
|
+
*/
|
|
172
271
|
onDataRequest(pView, pInput, pValue, pHTMLSelector)
|
|
173
272
|
{
|
|
174
273
|
let tmpInputSelectValue = this.pict.ContentAssignment.readContent(this.getSelectInputHTMLID(pInput.Macro.RawHTMLID));
|
|
@@ -177,6 +276,16 @@ class CustomInputHandler extends libPictSectionInputExtension
|
|
|
177
276
|
return super.onDataRequest(pView, pInput, tmpInputSelectValue, pHTMLSelector);
|
|
178
277
|
}
|
|
179
278
|
|
|
279
|
+
/**
|
|
280
|
+
* Handles the data request event for a tabular input.
|
|
281
|
+
*
|
|
282
|
+
* @param {Object} pView - The view object.
|
|
283
|
+
* @param {Object} pInput - The input object.
|
|
284
|
+
* @param {any} pValue - The value object.
|
|
285
|
+
* @param {string} pHTMLSelector - The HTML selector.
|
|
286
|
+
* @param {number} pRowIndex - The row index.
|
|
287
|
+
* @returns {any} - The result of the data request.
|
|
288
|
+
*/
|
|
180
289
|
onDataRequestTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex)
|
|
181
290
|
{
|
|
182
291
|
let tmpInputSelectValue = this.pict.ContentAssignment.readContent(this.getTabularSelectDropdownID(pInput.Macro.RawHTMLID, pRowIndex));
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
const libPictSectionInputExtension = require('../Pict-Provider-InputExtension.js');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* CustomInputHandler class.
|
|
5
|
+
*
|
|
6
|
+
* @class
|
|
7
|
+
* @extends libPictSectionInputExtension
|
|
8
|
+
* @memberof providers.inputs
|
|
9
|
+
*/
|
|
10
|
+
class CustomInputHandler extends libPictSectionInputExtension
|
|
11
|
+
{
|
|
12
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
13
|
+
{
|
|
14
|
+
super(pFable, pOptions, pServiceHash);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Generates the HTML ID for a select input element.
|
|
19
|
+
* @param {string} pInputHTMLID - The HTML ID of the input element.
|
|
20
|
+
* @returns {string} - The generated HTML ID for the select input element.
|
|
21
|
+
*/
|
|
22
|
+
getTabSelectorInputHTMLID(pInputHTMLID)
|
|
23
|
+
{
|
|
24
|
+
return `#TAB-SELECT-FOR-${pInputHTMLID}`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Initializes the input element for the Pict provider select input.
|
|
29
|
+
* @param {Object} pView - The view object.
|
|
30
|
+
* @param {Object} pGroup - The group object.
|
|
31
|
+
* @param {Object} pRow - The row object.
|
|
32
|
+
* @param {Object} pInput - The input object.
|
|
33
|
+
* @param {any} pValue - The input value.
|
|
34
|
+
* @param {string} pHTMLTabSelector - The HTML selector.
|
|
35
|
+
* @returns {boolean} - Returns true if the input element is successfully initialized, false otherwise.
|
|
36
|
+
*/
|
|
37
|
+
onInputInitialize(pView, pGroup, pRow, pInput, pValue, pHTMLTabSelector)
|
|
38
|
+
{
|
|
39
|
+
// Try to get the input element
|
|
40
|
+
let tmpInputTabSelectorElement = this.pict.ContentAssignment.getElement(this.getTabSelectorInputHTMLID(pInput.Macro.RawHTMLID));
|
|
41
|
+
let tmpDefaultData = pInput.PictForm?.TabSelectorOptions;
|
|
42
|
+
|
|
43
|
+
if (pInput.PictForm.TabSelectorOptionsPickList && this.pict.providers.DynamicMetaLists.hasList(pView.Hash, pInput.PictForm.TabSelectorOptionsPickList))
|
|
44
|
+
{
|
|
45
|
+
tmpDefaultData = this.pict.providers.DynamicMetaLists.getList(pView.Hash, pInput.PictForm.TabSelectorOptionsPickList);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// TODO: Determine later if this should ever be an array.
|
|
49
|
+
if (tmpInputTabSelectorElement && tmpInputTabSelectorElement.length > 0)
|
|
50
|
+
{
|
|
51
|
+
tmpInputTabSelectorElement = tmpInputTabSelectorElement[0];
|
|
52
|
+
}
|
|
53
|
+
else
|
|
54
|
+
{
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (tmpInputTabSelectorElement && tmpDefaultData && Array.isArray(tmpDefaultData))
|
|
59
|
+
{
|
|
60
|
+
for (let i = 0; i < tmpDefaultData.length; i++)
|
|
61
|
+
{
|
|
62
|
+
let tmpOption = document.createElement('option');
|
|
63
|
+
tmpOption.value = tmpDefaultData[i].id;
|
|
64
|
+
tmpOption.text = tmpDefaultData[i].text;
|
|
65
|
+
tmpInputTabSelectorElement.appendChild(tmpOption);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return super.onInputInitialize(pView, pGroup, pRow, pInput, pValue, pHTMLTabSelector);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Handles the change event for the data in the select input.
|
|
74
|
+
* @param {Object} pView - The view object.
|
|
75
|
+
* @param {Object} pInput - The input object.
|
|
76
|
+
* @param {any} pValue - The new value of the input.
|
|
77
|
+
* @param {string} pHTMLTabSelector - The HTML selector of the input.
|
|
78
|
+
* @returns {any} - The result of the super.onDataChange method.
|
|
79
|
+
*/
|
|
80
|
+
onDataChange(pView, pInput, pValue, pHTMLTabSelector)
|
|
81
|
+
{
|
|
82
|
+
return super.onDataChange(pView, pInput, pValue, pHTMLTabSelector);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Marshals data to the form for the given input.
|
|
87
|
+
* @param {Object} pView - The view object.
|
|
88
|
+
* @param {Object} pGroup - The group object.
|
|
89
|
+
* @param {Object} pRow - The row object.
|
|
90
|
+
* @param {Object} pInput - The input object.
|
|
91
|
+
* @param {any} pValue - The value to be marshaled.
|
|
92
|
+
* @param {string} pHTMLTabSelector - The HTML selector.
|
|
93
|
+
* @returns {boolean} - Returns true if the value is successfully marshaled to the form, otherwise false.
|
|
94
|
+
*/
|
|
95
|
+
onDataMarshalToForm(pView, pGroup, pRow, pInput, pValue, pHTMLTabSelector)
|
|
96
|
+
{
|
|
97
|
+
let tmpInputTabSelectorElement = this.pict.ContentAssignment.getElement(this.getTabSelectorInputHTMLID(pInput.Macro.RawHTMLID));
|
|
98
|
+
if (tmpInputTabSelectorElement && tmpInputTabSelectorElement.length > 0)
|
|
99
|
+
{
|
|
100
|
+
tmpInputTabSelectorElement = tmpInputTabSelectorElement[0];
|
|
101
|
+
}
|
|
102
|
+
else
|
|
103
|
+
{
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
let tmpValueTabSelectored = false;
|
|
108
|
+
|
|
109
|
+
for (let i = 0; i < tmpInputTabSelectorElement.options.length; i++)
|
|
110
|
+
{
|
|
111
|
+
if (tmpInputTabSelectorElement.options[i].value === pValue)
|
|
112
|
+
{
|
|
113
|
+
tmpInputTabSelectorElement.selectedIndex = i;
|
|
114
|
+
tmpValueTabSelectored = true;
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (!tmpValueTabSelectored)
|
|
120
|
+
{
|
|
121
|
+
tmpInputTabSelectorElement.selectedIndex = -1;
|
|
122
|
+
this.pict.log.error(`The value [${pValue}] was not found in the select options for input [${pInput.Macro.RawHTMLID}] but was set in the hidden HTML input.`);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return super.onDataMarshalToForm(pView, pGroup, pRow, pInput, pValue, pHTMLTabSelector);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Handles the data request event for a select input in the PictProviderInputTabSelector class.
|
|
130
|
+
* @param {Object} pView - The view object.
|
|
131
|
+
* @param {Object} pInput - The input object.
|
|
132
|
+
* @param {any} pValue - The value object.
|
|
133
|
+
* @param {string} pHTMLTabSelector - The HTML selector object.
|
|
134
|
+
* @returns {any} - The result of the onDataRequest method.
|
|
135
|
+
*/
|
|
136
|
+
onDataRequest(pView, pInput, pValue, pHTMLTabSelector)
|
|
137
|
+
{
|
|
138
|
+
let tmpInputTabSelectorValue = this.pict.ContentAssignment.readContent(this.getTabSelectorInputHTMLID(pInput.Macro.RawHTMLID));
|
|
139
|
+
this.pict.ContentAssignment.assignContent(pHTMLTabSelector, tmpInputTabSelectorValue);
|
|
140
|
+
pView.dataChanged(pInput.Hash);
|
|
141
|
+
return super.onDataRequest(pView, pInput, tmpInputTabSelectorValue, pHTMLTabSelector);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
module.exports = CustomInputHandler;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
const libPictSectionTuiGrid = require('pict-section-tuigrid');
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* TuiGridLayout class represents a layout for TuiGrid in the Pict-Layout-TuiGrid module.
|
|
5
|
+
* @extends libPictSectionTuiGrid
|
|
6
|
+
*/
|
|
3
7
|
class TuiGridLayout extends libPictSectionTuiGrid
|
|
4
8
|
{
|
|
5
9
|
constructor(pFable, pOptions, pServiceHash)
|
|
@@ -11,6 +15,13 @@ class TuiGridLayout extends libPictSectionTuiGrid
|
|
|
11
15
|
this.cachedGridData = [];
|
|
12
16
|
}
|
|
13
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Custom configuration for the grid settings -- fires when
|
|
20
|
+
*
|
|
21
|
+
* Sets the grid data to the cached grid data for the tuigrid.
|
|
22
|
+
*
|
|
23
|
+
* @returns {any} The result of the super.customConfigureGridSettings() method.
|
|
24
|
+
*/
|
|
14
25
|
customConfigureGridSettings()
|
|
15
26
|
{
|
|
16
27
|
// Set the grid data to the cached grid data
|
|
@@ -18,6 +29,14 @@ class TuiGridLayout extends libPictSectionTuiGrid
|
|
|
18
29
|
return super.customConfigureGridSettings();
|
|
19
30
|
}
|
|
20
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Handles the change event in the Pict-Section-TuiGrid component.
|
|
34
|
+
*
|
|
35
|
+
* Updates the state in the model based on the grid changes. This is
|
|
36
|
+
*
|
|
37
|
+
* @param {Object} pChangeData - The change data object.
|
|
38
|
+
* @returns {any} - The result of the super changeHandler method.
|
|
39
|
+
*/
|
|
21
40
|
changeHandler(pChangeData)
|
|
22
41
|
{
|
|
23
42
|
// Update the state in our model based on the grid
|
|
@@ -11,7 +11,6 @@ class ManifestFactory extends libFableServiceProviderBase
|
|
|
11
11
|
{
|
|
12
12
|
// Intersect default options, parent constructor, service information
|
|
13
13
|
let tmpOptions = Object.assign({}, JSON.parse(JSON.stringify(_DefaultManifestSettings)), pOptions);
|
|
14
|
-
|
|
15
14
|
super(pFable, pOptions, pServiceHash);
|
|
16
15
|
|
|
17
16
|
this.manifest = tmpOptions.Manifest;
|
|
@@ -396,6 +395,7 @@ class ManifestFactory extends libFableServiceProviderBase
|
|
|
396
395
|
|
|
397
396
|
if (tmpRecord['Equation'])
|
|
398
397
|
{
|
|
398
|
+
this.log.trace(`Adding solver to ${tmpRecord.Form} --> ${tmpGroup.Name} for ${tmpRecord['Input Hash']}: ${tmpRecord['Equation']}`);
|
|
399
399
|
if (tmpGroup.Layout == 'Tabular')
|
|
400
400
|
{
|
|
401
401
|
tmpGroup.RecordSetSolvers.push(tmpRecord['Equation']);
|