pict-section-form 1.0.23 → 1.0.25

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 (26) hide show
  1. package/debug/PICTSection-TabularManifests.json +33 -10
  2. package/debug/TabularManifestCSV.csv +1 -1
  3. package/debug/data/ExampleForm.json +33 -10
  4. package/example_applications/complex_table/Complex-Tabular-CustomDataProvider.js +2 -2
  5. package/package.json +4 -4
  6. package/source/providers/Pict-Provider-DynamicInput.js +107 -0
  7. package/source/providers/Pict-Provider-DynamicSolver.js +3 -6
  8. package/source/providers/Pict-Provider-DynamicTemplates-DefaultFormTemplates.js +4 -0
  9. package/source/providers/Pict-Provider-DynamicTemplates.js +8 -0
  10. package/source/providers/Pict-Provider-MetatemplateGenerator.js +325 -2
  11. package/source/providers/Pict-Provider-MetatemplateMacros.js +103 -0
  12. package/source/services/ManifestFactory.js +161 -6
  13. package/source/views/Pict-View-DynamicForm.js +133 -589
  14. package/source/views/Pict-View-Form-Metacontroller.js +1 -6
  15. package/types/Pict-Section-Form.d.ts +1 -0
  16. package/types/providers/Pict-Provider-DynamicSolver.d.ts.map +1 -1
  17. package/types/providers/Pict-Provider-Informary.d.ts.map +1 -1
  18. package/types/providers/Pict-Provider-InputExtension.d.ts +23 -0
  19. package/types/providers/Pict-Provider-InputExtension.d.ts.map +1 -1
  20. package/types/providers/inputs/Pict-Provider-Input-DateTime.d.ts +3 -3
  21. package/types/providers/inputs/Pict-Provider-Input-DateTime.d.ts.map +1 -1
  22. package/types/services/ManifestFactory.d.ts +1 -1
  23. package/types/services/ManifestFactory.d.ts.map +1 -1
  24. package/types/views/Pict-View-DynamicForm.d.ts +2 -0
  25. package/types/views/Pict-View-DynamicForm.d.ts.map +1 -1
  26. package/types/views/Pict-View-Form-Metacontroller.d.ts.map +1 -1
@@ -56,10 +56,28 @@
56
56
  "DataAddress": "Header.Planet",
57
57
  "DataType": "String",
58
58
  "PictForm": {
59
- "InputType": "SelectFixed",
59
+ "InputType": "Option",
60
60
  "Row": "3",
61
61
  "Width": "1",
62
62
  "Units": "planetary",
63
+ "SelectOptions": [
64
+ {
65
+ "id": "Earth",
66
+ "text": "Earth"
67
+ },
68
+ {
69
+ "id": "Mars",
70
+ "text": "Mars"
71
+ },
72
+ {
73
+ "id": "Saturn",
74
+ "text": "Saturn"
75
+ },
76
+ {
77
+ "id": "Jupiter",
78
+ "text": "Jupiter"
79
+ }
80
+ ],
63
81
  "Section": "Header",
64
82
  "Group": "General_Info"
65
83
  }
@@ -198,15 +216,15 @@
198
216
  {
199
217
  "Name": "Package Dimensions",
200
218
  "Hash": "Package_Dimensions",
201
- "Solvers": [
202
- "Area = Width * Height"
203
- ],
219
+ "Solvers": [],
204
220
  "Groups": [
205
221
  {
206
222
  "Name": "Size",
207
223
  "Hash": "Size",
208
224
  "Rows": [],
209
- "RecordSetSolvers": [],
225
+ "RecordSetSolvers": [
226
+ "Area = Width * Height"
227
+ ],
210
228
  "Layout": "Tabular",
211
229
  "RecordSetAddress": "Inventory.Packages",
212
230
  "RecordManifest": "Packages"
@@ -241,7 +259,8 @@
241
259
  "Width": "3",
242
260
  "Section": "Package_Dimensions",
243
261
  "Group": "Size"
244
- }
262
+ },
263
+ "IsTabular": true
245
264
  },
246
265
  "ReceiveDate": {
247
266
  "Hash": "ReceiveDate",
@@ -253,7 +272,8 @@
253
272
  "Width": "1",
254
273
  "Section": "Package_Dimensions",
255
274
  "Group": "Size"
256
- }
275
+ },
276
+ "IsTabular": true
257
277
  },
258
278
  "Width": {
259
279
  "Hash": "Width",
@@ -266,7 +286,8 @@
266
286
  "Units": "inches",
267
287
  "Section": "Package_Dimensions",
268
288
  "Group": "Size"
269
- }
289
+ },
290
+ "IsTabular": true
270
291
  },
271
292
  "Height": {
272
293
  "Hash": "Height",
@@ -279,7 +300,8 @@
279
300
  "Units": "inches",
280
301
  "Section": "Package_Dimensions",
281
302
  "Group": "Size"
282
- }
303
+ },
304
+ "IsTabular": true
283
305
  },
284
306
  "Area": {
285
307
  "Hash": "Area",
@@ -292,7 +314,8 @@
292
314
  "Units": "square inches",
293
315
  "Section": "Package_Dimensions",
294
316
  "Group": "Size"
295
- }
317
+ },
318
+ "IsTabular": true
296
319
  }
297
320
  },
298
321
  "Sections": [],
@@ -3,7 +3,7 @@ ExampleForm,Example Form,,,Header,General Info,1,1,Header.FirstName,First Name,H
3
3
  ExampleForm,,,,Header,General Info,1,1,Header.LastName,Last Name,HeaderLastName,,,String,,,,,,
4
4
  ExampleForm,,,,Header,General Info,1,2,Header.JobTitle,Job Title,JobTitle,,,String,,,,,,
5
5
  ExampleForm,,,,Header,General Info,2,4,Header.Description,Description,Description,,,String,,,,,,
6
- ExampleForm,,,,Header,General Info,3,1,Header.Planet,Planet,Planet,"Earth,Mars,Saturn,Jupiter",planetary,String,SelectFixed,,,,,
6
+ ExampleForm,,,,Header,General Info,3,1,Header.Planet,Planet,Planet,"Earth,Mars,Saturn,Jupiter",planetary,String,Option,,,,,
7
7
  ExampleForm,,,,Header,Address,1,1,Header.Location.Address,Address,Address,,,String,,,,,,
8
8
  ExampleForm,,,,Header,Address,2,2,Header.Location.City,City,City,,,String,,,,,,
9
9
  ExampleForm,,,,Header,Address,2,2,Header.Location.State,State,State,,,String,,,,,,
@@ -55,10 +55,28 @@
55
55
  "DataAddress": "Header.Planet",
56
56
  "DataType": "String",
57
57
  "PictForm": {
58
- "InputType": "SelectFixed",
58
+ "InputType": "Option",
59
59
  "Row": "3",
60
60
  "Width": "1",
61
61
  "Units": "planetary",
62
+ "SelectOptions": [
63
+ {
64
+ "id": "Earth",
65
+ "text": "Earth"
66
+ },
67
+ {
68
+ "id": "Mars",
69
+ "text": "Mars"
70
+ },
71
+ {
72
+ "id": "Saturn",
73
+ "text": "Saturn"
74
+ },
75
+ {
76
+ "id": "Jupiter",
77
+ "text": "Jupiter"
78
+ }
79
+ ],
62
80
  "Section": "Header",
63
81
  "Group": "General_Info"
64
82
  }
@@ -197,15 +215,15 @@
197
215
  {
198
216
  "Name": "Package Dimensions",
199
217
  "Hash": "Package_Dimensions",
200
- "Solvers": [
201
- "Area = Width * Height"
202
- ],
218
+ "Solvers": [],
203
219
  "Groups": [
204
220
  {
205
221
  "Name": "Size",
206
222
  "Hash": "Size",
207
223
  "Rows": [],
208
- "RecordSetSolvers": [],
224
+ "RecordSetSolvers": [
225
+ "Area = Width * Height"
226
+ ],
209
227
  "Layout": "Tabular",
210
228
  "RecordSetAddress": "Inventory.Packages",
211
229
  "RecordManifest": "Packages"
@@ -240,7 +258,8 @@
240
258
  "Width": "3",
241
259
  "Section": "Package_Dimensions",
242
260
  "Group": "Size"
243
- }
261
+ },
262
+ "IsTabular": true
244
263
  },
245
264
  "ReceiveDate": {
246
265
  "Hash": "ReceiveDate",
@@ -252,7 +271,8 @@
252
271
  "Width": "1",
253
272
  "Section": "Package_Dimensions",
254
273
  "Group": "Size"
255
- }
274
+ },
275
+ "IsTabular": true
256
276
  },
257
277
  "Width": {
258
278
  "Hash": "Width",
@@ -265,7 +285,8 @@
265
285
  "Units": "inches",
266
286
  "Section": "Package_Dimensions",
267
287
  "Group": "Size"
268
- }
288
+ },
289
+ "IsTabular": true
269
290
  },
270
291
  "Height": {
271
292
  "Hash": "Height",
@@ -278,7 +299,8 @@
278
299
  "Units": "inches",
279
300
  "Section": "Package_Dimensions",
280
301
  "Group": "Size"
281
- }
302
+ },
303
+ "IsTabular": true
282
304
  },
283
305
  "Area": {
284
306
  "Hash": "Area",
@@ -291,7 +313,8 @@
291
313
  "Units": "square inches",
292
314
  "Section": "Package_Dimensions",
293
315
  "Group": "Size"
294
- }
316
+ },
317
+ "IsTabular": true
295
318
  }
296
319
  },
297
320
  "Sections": [],
@@ -11,14 +11,14 @@ class CustomInputHandler extends libPictSectionInputExtension
11
11
  {
12
12
  this.log.trace(`CustomInputHandler.onInputInitializeTabular() for view [${pView.Hash}] called`);
13
13
  //this.log.trace(`The input object is: ${JSON.stringify(pInput)}`);
14
- return super.onInputInitialize(pView, pGroup, pInput, pHTMLSelector);
14
+ return super.onInputInitialize(pView, pGroup, pInput, pValue, pHTMLSelector);
15
15
  }
16
16
 
17
17
  onInputInitializeTabular(pView, pGroup, pInput, pValue, pHTMLSelector)
18
18
  {
19
19
  this.log.trace(`CustomInputHandler.onInputInitializeTabular() for view [${pView.Hash}] called`);
20
20
  //this.log.trace(`The input object is: ${JSON.stringify(pInput)}`);
21
- return super.onInputInitializeTabular(pView, pGroup, pInput, pHTMLSelector);
21
+ return super.onInputInitializeTabular(pView, pGroup, pInput, pValue, pHTMLSelector);
22
22
  }
23
23
  }
24
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pict-section-form",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "Pict dynamic form sections",
5
5
  "main": "source/Pict-Section-Form.js",
6
6
  "directories": {
@@ -27,11 +27,11 @@
27
27
  "author": "steven velozo <steven@velozo.com>",
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
- "@eslint/js": "^9.6.0",
30
+ "@eslint/js": "^9.7.0",
31
31
  "browser-env": "^3.3.0",
32
- "eslint": "^9.6.0",
32
+ "eslint": "^9.7.0",
33
33
  "jquery": "^3.7.1",
34
- "pict": "^1.0.205",
34
+ "pict": "^1.0.209",
35
35
  "pict-application": "^1.0.19",
36
36
  "pict-service-commandlineutility": "^1.0.13",
37
37
  "quackage": "^1.0.30",
@@ -0,0 +1,107 @@
1
+ const libPictProvider = require('pict-provider');
2
+
3
+ const _DefaultProviderConfiguration = (
4
+ {
5
+ "ProviderIdentifier": "Pict-DynamicForms-Input",
6
+
7
+ "AutoInitialize": true,
8
+ "AutoInitializeOrdinal": 0,
9
+
10
+ "AutoSolveWithApp": false
11
+ });
12
+
13
+ /**
14
+ * The PictDynamicInput class is a provider that manages data brokering and provider mappings for dynamic inputs.
15
+ */
16
+ class PictDynamicInput extends libPictProvider
17
+ {
18
+ /**
19
+ * Creates an instance of the PictDynamicLayout class.
20
+ *
21
+ * @param {object} pFable - The fable object.
22
+ * @param {object} pOptions - The options object.
23
+ * @param {object} pServiceHash - The service hash object.
24
+ */
25
+ constructor(pFable, pOptions, pServiceHash)
26
+ {
27
+ let tmpOptions = Object.assign({}, JSON.parse(JSON.stringify(_DefaultProviderConfiguration)), pOptions);
28
+ super(pFable, tmpOptions, pServiceHash);
29
+ // A map of strings for each input template, mapping it to arrays of default providers.
30
+ this.templateProviderMap = {};
31
+ }
32
+
33
+ getInputTemplateHash(pView, pInput)
34
+ {
35
+ if (pInput.IsTabular)
36
+ {
37
+ let tmpTemplateBeginInputTypePostfix = `-TabularTemplate-Begin-Input-InputType-${pInput.PictForm.InputType}`;
38
+ let tmpTemplateEndInputTypePostfix = `-TabularTemplate-End-Input-InputType-${pInput.PictForm.InputType}`;
39
+
40
+ let tmpTemplateBeginDataTypePostfix = `-TabularTemplate-Begin-Input-DataType-${pInput.DataType}`;
41
+ let tmpTemplateEndDataTypePostfix = `-TabularTemplate-End-Input-DataType-${pInput.DataType}`;
42
+ if (pView.checkViewSpecificTemplate(tmpTemplateBeginInputTypePostfix) && pView.checkViewSpecificTemplate(tmpTemplateEndInputTypePostfix))
43
+ {
44
+ return pView.getViewSpecificTemplateHash(tmpTemplateBeginInputTypePostfix);
45
+ }
46
+ else if (pView.checkThemeSpecificTemplate(tmpTemplateBeginInputTypePostfix) && pView.checkThemeSpecificTemplate(tmpTemplateEndInputTypePostfix))
47
+ {
48
+ return pView.getThemeSpecificTemplateHash(tmpTemplateBeginInputTypePostfix);
49
+ }
50
+ else if (pView.checkViewSpecificTemplate(tmpTemplateBeginDataTypePostfix) && pView.checkViewSpecificTemplate(tmpTemplateEndDataTypePostfix))
51
+ {
52
+ return pView.getViewSpecificTemplateHash(tmpTemplateBeginDataTypePostfix);
53
+ }
54
+ else if (pView.checkThemeSpecificTemplate(tmpTemplateBeginDataTypePostfix) && pView.checkThemeSpecificTemplate(tmpTemplateEndDataTypePostfix))
55
+ {
56
+ return pView.getThemeSpecificTemplateHash(tmpTemplateBeginDataTypePostfix);
57
+ }
58
+ }
59
+ else
60
+ {
61
+ let tmpTemplateInputTypePostfix = `-Template-Input-InputType-${pInput.PictForm.InputType}`;
62
+ let tmpTemplateDataTypePostfix = `-Template-Input-DataType-${pInput.DataType}`;
63
+ if (pView.checkViewSpecificTemplate(tmpTemplateInputTypePostfix))
64
+ {
65
+ return pView.getViewSpecificTemplateHash(tmpTemplateInputTypePostfix);
66
+ }
67
+ else if (pView.checkThemeSpecificTemplate(tmpTemplateInputTypePostfix))
68
+ {
69
+ return pView.getThemeSpecificTemplateHash(tmpTemplateInputTypePostfix);
70
+ }
71
+ else if (pView.checkViewSpecificTemplate(tmpTemplateDataTypePostfix))
72
+ {
73
+ return pView.getViewSpecificTemplateHash(tmpTemplateDataTypePostfix);
74
+ }
75
+ else if (pView.checkThemeSpecificTemplate(tmpTemplateDataTypePostfix))
76
+ {
77
+ return pView.getThemeSpecificTemplateHash(tmpTemplateDataTypePostfix);
78
+ }
79
+ }
80
+ return false;
81
+ }
82
+
83
+ addDefaultInputProvider(pTemplateFullHash, pProvider)
84
+ {
85
+ if (!(pTemplateFullHash in this.templateProviderMap))
86
+ {
87
+ this.templateProviderMap[pTemplateFullHash] = [];
88
+ }
89
+ if (this.templateProviderMap[pTemplateFullHash].indexOf(pProvider) < 0)
90
+ {
91
+ this.templateProviderMap[pTemplateFullHash].push(pProvider);
92
+ }
93
+ }
94
+
95
+ getDefaultInputProviders(pView, pInput)
96
+ {
97
+ let tmpTemplateHash = this.getInputTemplateHash(pView, pInput);
98
+ if (tmpTemplateHash && this.templateProviderMap[tmpTemplateHash])
99
+ {
100
+ return this.templateProviderMap[tmpTemplateHash];
101
+ }
102
+ return [];
103
+ }
104
+ }
105
+
106
+ module.exports = PictDynamicInput;
107
+ module.exports.default_configuration = _DefaultProviderConfiguration;
@@ -37,18 +37,15 @@ class PictDynamicSolver extends libPictProvider
37
37
 
38
38
  if (!this.pict.providers.DynamicMetaLists)
39
39
  {
40
- let tmpDynamicMetaLists = this.pict.addProvider('DynamicMetaLists', libDynamicMetaLists.default_configuration, libDynamicMetaLists);
41
- tmpDynamicMetaLists.initialize();
40
+ this.pict.addProvider('DynamicMetaLists', libDynamicMetaLists.default_configuration, libDynamicMetaLists);
42
41
  }
43
42
  if (!this.pict.providers['Pict-Input-Select']);
44
43
  {
45
- let tmpInputSelectProvider = this.pict.addProvider('Pict-Input-Select', libInputSelect.default_configuration, libInputSelect);
46
- tmpInputSelectProvider.initialize();
44
+ this.pict.addProvider('Pict-Input-Select', libInputSelect.default_configuration, libInputSelect);
47
45
  }
48
46
  if (!this.pict.providers['Pict-Input-DateTime']);
49
47
  {
50
- let tmpInputDateTimeProvider = this.pict.addProvider('Pict-Input-DateTime', libInputDateTime.default_configuration, libInputDateTime);
51
- tmpInputDateTimeProvider.initialize();
48
+ this.pict.addProvider('Pict-Input-DateTime', libInputDateTime.default_configuration, libInputDateTime);
52
49
  }
53
50
  }
54
51
 
@@ -157,6 +157,7 @@ Glug glug glug Oo... -->
157
157
  },
158
158
  {
159
159
  "HashPostfix": "-Template-Input-InputType-Option",
160
+ "DefaultInputExtensions": ["Pict-Input-Select"],
160
161
  "Template": /*HTML*/`
161
162
  <!-- InputType Option {~D:Record.Hash~} {~D:Record.DataType~} -->
162
163
  <input type="hidden" {~D:Record.Macro.InputFullProperties~} {~D:Record.Macro.InputChangeHandler~} value="">
@@ -172,6 +173,7 @@ Glug glug glug Oo... -->
172
173
  },
173
174
  {
174
175
  "HashPostfix": "-Template-Input-DataType-DateTime",
176
+ "DefaultInputExtensions": ["Pict-Input-DateTime"],
175
177
  "Template": /*HTML*/`
176
178
  <!-- DataType DateTime {~D:Record.Hash~} {~D:Record.DataType~} -->
177
179
  <input type="hidden" {~D:Record.Macro.InputFullProperties~} value="">
@@ -372,6 +374,7 @@ Glug glug glug Oo... -->
372
374
  },
373
375
  {
374
376
  "HashPostfix": "-TabularTemplate-Begin-Input-InputType-Option",
377
+ "DefaultInputExtensions": ["Pict-Input-Select"],
375
378
  "Template": /*HTML*/`
376
379
  <!-- InputType Option {~D:Record.Hash~} {~D:Record.DataType~} -->
377
380
  <input type="hidden" id="SELECT-TABULAR-DATA-{~D:Record.Macro.RawHTMLID~}-{~D:Context[2].Key~}" {~D:Record.Macro.HTMLName~} {~D:Record.Macro.InformaryTabular~} `
@@ -395,6 +398,7 @@ Glug glug glug Oo... -->
395
398
  },
396
399
  {
397
400
  "HashPostfix": "-TabularTemplate-Begin-Input-DataType-DateTime",
401
+ "DefaultInputExtensions": ["Pict-Input-DateTime"],
398
402
  "Template": /*HTML*/`
399
403
  <!-- DataType DateTime {~D:Record.Hash~} {~D:Record.DataType~} -->
400
404
  <input type="hidden" id="DATETIME-TABULAR-DATA-{~D:Record.Macro.RawHTMLID~}-{~D:Context[2].Key~}" {~D:Record.Macro.HTMLName~} {~D:Record.Macro.InformaryTabular~} `
@@ -58,6 +58,14 @@ class PictDynamicFormsTemplates extends libPictProvider
58
58
  Hash: tmpTemplateHash,
59
59
  Template: tmpTemplate.Template
60
60
  });
61
+ if ('DefaultInputExtensions' in tmpTemplate)
62
+ {
63
+ this.formsTemplateSet[tmpTemplateHash].DefaultInputExtensions = tmpTemplate.DefaultInputExtensions;
64
+ for (let i = 0; i < tmpTemplate.DefaultInputExtensions.length; i++)
65
+ {
66
+ this.pict.providers.DynamicInput.addDefaultInputProvider(tmpTemplateHash, tmpTemplate.DefaultInputExtensions[i]);
67
+ }
68
+ }
61
69
  }
62
70
 
63
71
  for (let i = 0; i < _DefaultFormTemplates.Templates.length; i++)