pict-section-form 1.0.121 → 1.0.123

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 (59) hide show
  1. package/debug/PICTSection-TabularManifests.json +3 -3
  2. package/debug/data/DefaultFormManifest.json +7 -7
  3. package/debug/data/MathExampleForm.json +351 -4
  4. package/example_applications/Build-Examples.sh +5 -0
  5. package/example_applications/Clean-Examples.sh +2 -1
  6. package/example_applications/Open-Examples.sh +2 -1
  7. package/example_applications/complex_table/Complex-Tabular-Application.js +3 -3
  8. package/example_applications/postcard_example/providers/PictProvider-PostKardInputExtension.js +38 -7
  9. package/example_applications/simple_distill/Simple-Form-Application.js +2 -2
  10. package/example_applications/simple_table/.quackage.json +9 -0
  11. package/package.json +2 -2
  12. package/source/providers/Pict-Provider-DynamicFormSolverBehaviors.js +33 -6
  13. package/source/providers/Pict-Provider-DynamicInputEvents.js +26 -4
  14. package/source/providers/Pict-Provider-InputExtension.js +49 -8
  15. package/source/providers/inputs/Pict-Provider-Input-AutofillTriggerGroup.js +72 -25
  16. package/source/providers/inputs/Pict-Provider-Input-DateTime.js +6 -4
  17. package/source/providers/inputs/Pict-Provider-Input-EntityBundleRequest.js +19 -13
  18. package/source/providers/inputs/Pict-Provider-Input-HTML.js +12 -8
  19. package/source/providers/inputs/Pict-Provider-Input-Link.js +6 -4
  20. package/source/providers/inputs/Pict-Provider-Input-Markdown.js +12 -8
  21. package/source/providers/inputs/Pict-Provider-Input-PreciseNumber.js +6 -4
  22. package/source/providers/inputs/Pict-Provider-Input-Select.js +25 -20
  23. package/source/providers/inputs/Pict-Provider-Input-TabGroupSelector.js +3 -2
  24. package/source/providers/inputs/Pict-Provider-Input-TabSectionSelector.js +3 -2
  25. package/source/providers/inputs/Pict-Provider-Input-TemplatedEntityLookup.js +12 -8
  26. package/source/services/ManifestFactory.js +1 -1
  27. package/source/views/Pict-View-DynamicForm.js +188 -17
  28. package/source/views/Pict-View-Form-Metacontroller.js +12 -2
  29. package/types/source/providers/Pict-Provider-DynamicFormSolverBehaviors.d.ts +10 -1
  30. package/types/source/providers/Pict-Provider-DynamicFormSolverBehaviors.d.ts.map +1 -1
  31. package/types/source/providers/Pict-Provider-DynamicInputEvents.d.ts +4 -2
  32. package/types/source/providers/Pict-Provider-DynamicInputEvents.d.ts.map +1 -1
  33. package/types/source/providers/Pict-Provider-InputExtension.d.ts +41 -8
  34. package/types/source/providers/Pict-Provider-InputExtension.d.ts.map +1 -1
  35. package/types/source/providers/inputs/Pict-Provider-Input-AutofillTriggerGroup.d.ts +5 -5
  36. package/types/source/providers/inputs/Pict-Provider-Input-AutofillTriggerGroup.d.ts.map +1 -1
  37. package/types/source/providers/inputs/Pict-Provider-Input-DateTime.d.ts +4 -2
  38. package/types/source/providers/inputs/Pict-Provider-Input-DateTime.d.ts.map +1 -1
  39. package/types/source/providers/inputs/Pict-Provider-Input-EntityBundleRequest.d.ts +10 -5
  40. package/types/source/providers/inputs/Pict-Provider-Input-EntityBundleRequest.d.ts.map +1 -1
  41. package/types/source/providers/inputs/Pict-Provider-Input-HTML.d.ts +6 -3
  42. package/types/source/providers/inputs/Pict-Provider-Input-HTML.d.ts.map +1 -1
  43. package/types/source/providers/inputs/Pict-Provider-Input-Link.d.ts +4 -2
  44. package/types/source/providers/inputs/Pict-Provider-Input-Link.d.ts.map +1 -1
  45. package/types/source/providers/inputs/Pict-Provider-Input-Markdown.d.ts +6 -3
  46. package/types/source/providers/inputs/Pict-Provider-Input-Markdown.d.ts.map +1 -1
  47. package/types/source/providers/inputs/Pict-Provider-Input-PreciseNumber.d.ts +4 -2
  48. package/types/source/providers/inputs/Pict-Provider-Input-PreciseNumber.d.ts.map +1 -1
  49. package/types/source/providers/inputs/Pict-Provider-Input-Select.d.ts +11 -6
  50. package/types/source/providers/inputs/Pict-Provider-Input-Select.d.ts.map +1 -1
  51. package/types/source/providers/inputs/Pict-Provider-Input-TabGroupSelector.d.ts.map +1 -1
  52. package/types/source/providers/inputs/Pict-Provider-Input-TabSectionSelector.d.ts.map +1 -1
  53. package/types/source/providers/inputs/Pict-Provider-Input-TemplatedEntityLookup.d.ts +6 -3
  54. package/types/source/providers/inputs/Pict-Provider-Input-TemplatedEntityLookup.d.ts.map +1 -1
  55. package/types/source/views/Pict-View-DynamicForm.d.ts +39 -6
  56. package/types/source/views/Pict-View-DynamicForm.d.ts.map +1 -1
  57. package/types/source/views/Pict-View-Form-Metacontroller.d.ts +2 -1
  58. package/types/source/views/Pict-View-Form-Metacontroller.d.ts.map +1 -1
  59. package/utility/csvparser/ParseCSV-Command-BuildDistilling.js +4 -4
@@ -149,7 +149,7 @@ class PictDynamicFormsSolverBehaviors extends libPictProvider
149
149
 
150
150
  setGroupVisibility(pSectionHash, pGroupHash, pVisible)
151
151
  {
152
- if (pVisible)
152
+ if (pVisible != "0")
153
153
  {
154
154
  return this.showGroup(pSectionHash, pGroupHash);
155
155
  }
@@ -264,7 +264,7 @@ class PictDynamicFormsSolverBehaviors extends libPictProvider
264
264
  }
265
265
 
266
266
  let tmpElementSet = this.pict.ContentAssignment.getElement(this.getGroupSelector(tmpGroupView.formID, pGroupHash));
267
-
267
+
268
268
  if (tmpElementSet.length < 1)
269
269
  {
270
270
  this.log.warn(`PictDynamicFormsInformary: colorGroup could not find group element with section hash [${pSectionHash}] group [${pGroupHash}] selector [${this.getGroupSelector(tmpGroupView.formID, pGroupHash)}].`);
@@ -277,14 +277,23 @@ class PictDynamicFormsSolverBehaviors extends libPictProvider
277
277
  return true;
278
278
  }
279
279
 
280
- colorInputBackground(pSectionHash, pInputHash, pColor, pApplyChange)
280
+ /**
281
+ * Colors an input background or its container with a HTML hex color (e.g. #FF0000 for red).
282
+ * @param {string} pSectionHash - The hash of the section containing the input.
283
+ * @param {string} pInputHash - The hash of the input to color.
284
+ * @param {string} pColor - The HTML hex color to apply (e.g. #FF0000 for red).
285
+ * @param {string} pApplyChange - If "0", the change will not be applied.
286
+ * @param {string} [pClassTarget] - Optional. If provided, the color will be applied to the closest element with this class instead of the input itself.
287
+ * @returns {boolean} - Returns true if the color was applied successfully or if the change was skipped for pApplyChange equal to "0", false otherwise.
288
+ */
289
+ colorInputBackground(pSectionHash, pInputHash, pColor, pApplyChange, pClassTarget)
281
290
  {
282
291
  if (pApplyChange == "0")
283
292
  {
284
293
  return true;
285
294
  }
286
295
 
287
- let tmpInputView = this.pict.views.PictFormMetacontroller.getInputViewFromHash(pSectionHash)
296
+ let tmpInputView = this.pict.views.PictFormMetacontroller.getSectionViewFromHash(pSectionHash)
288
297
 
289
298
  if (!tmpInputView)
290
299
  {
@@ -300,15 +309,33 @@ class PictDynamicFormsSolverBehaviors extends libPictProvider
300
309
  return false;
301
310
  }
302
311
 
303
- let tmpElementSet = this.pict.ContentAssignment.getElement(`#INPUT-${tmpInput.formID}`);
312
+ let tmpElementSet = this.pict.ContentAssignment.getElement(`#${tmpInput.Macro.RawHTMLID}`);
304
313
 
305
314
  if (tmpElementSet.length < 1)
306
315
  {
307
- this.log.warn(`PictDynamicFormsInformary: colorInput could not find input element with section hash [${pSectionHash}] input [${pInputHash}] selector [#INPUT-${tmpInput.formID}].`);
316
+ this.log.warn(`PictDynamicFormsInformary: colorInput could not find input element with section hash [${pSectionHash}] input [${pInputHash}] selector [${ tmpElementSet[0].id}].`);
308
317
  return false;
309
318
  }
310
319
 
311
320
  let tmpElement = tmpElementSet[0];
321
+
322
+ // if we passed a class target, find the closest element with that class and apply the color to it
323
+ // otherwise, just apply it to the input element itself
324
+ if (pClassTarget)
325
+ {
326
+ // find closest target by class name and if we find it, immediately break out of the loop
327
+ for (let i = 0; i < tmpElementSet.length; i++)
328
+ {
329
+ const element = tmpElementSet[i];
330
+ const closest = element.closest(`.${pClassTarget}`);
331
+ if (closest)
332
+ {
333
+ tmpElement = closest;
334
+ break;
335
+ }
336
+ }
337
+ }
338
+
312
339
  tmpElement.style.backgroundColor = pColor;
313
340
 
314
341
  return true;
@@ -75,9 +75,11 @@ class PictDynamicInputEvents extends libPictProvider
75
75
  * @param {Object} pView - The view object.
76
76
  * @param {string} pInputHash - The input hash.
77
77
  * @param {string} pEvent - The input event.
78
+ * @param {string} [pTransactionGUID] - (optional) The active transaction GUID.
78
79
  */
79
- inputEvent(pView, pInputHash, pEvent)
80
+ inputEvent(pView, pInputHash, pEvent, pTransactionGUID)
80
81
  {
82
+ const tmpTransactionGUID = (pTransactionGUID && typeof pTransactionGUID === 'string') ? pTransactionGUID : this.pict.getUUID();
81
83
  let tmpInput = pView.getInputFromHash(pInputHash);
82
84
  if (pInputHash)
83
85
  {
@@ -94,7 +96,11 @@ class PictDynamicInputEvents extends libPictProvider
94
96
  // we may find uninitialized inputs here, so we do not send events to those
95
97
  if (tmpInput.Macro)
96
98
  {
97
- pView.pict.providers[tmpInputProviderList[i]].onEvent(pView, tmpInput, tmpValue, tmpInput.Macro.HTMLSelector, pEvent);
99
+ pView.pict.providers[tmpInputProviderList[i]].onEvent(pView, tmpInput, tmpValue, tmpInput.Macro.HTMLSelector, pEvent, tmpTransactionGUID);
100
+ pView.registerOnTransactionCompleteCallback(tmpTransactionGUID, () =>
101
+ {
102
+ pView.pict.providers[tmpInputProviderList[i]].onAfterEventCompletion(pView, tmpInput, tmpValue, tmpInput.Macro.HTMLSelector, pEvent, tmpTransactionGUID);
103
+ });
98
104
  }
99
105
  }
100
106
  else
@@ -102,6 +108,11 @@ class PictDynamicInputEvents extends libPictProvider
102
108
  pView.log.error(`Dynamic form [${pView.Hash}]::[${pView.UUID}] inputEvent ${pEvent} cannot find embedded provider [${tmpInputProviderList[i]}] for input [${tmpInput.Hash}].`);
103
109
  }
104
110
  }
111
+ if (pTransactionGUID !== tmpTransactionGUID)
112
+ {
113
+ // since we synthesized this transaction, finalize it
114
+ pView.finalizeTransaction(tmpTransactionGUID);
115
+ }
105
116
  }
106
117
  catch (pError)
107
118
  {
@@ -171,9 +182,11 @@ class PictDynamicInputEvents extends libPictProvider
171
182
  * @param {number} pInputIndex - The index of the input.
172
183
  * @param {number} pRowIndex - The index of the row.
173
184
  * @param {string} pEvent - The input event.
185
+ * @param {string} [pTransactionGUID] - (optional) The active transaction GUID.
174
186
  */
175
- inputEventTabular(pView, pGroupIndex, pInputIndex, pRowIndex, pEvent)
187
+ inputEventTabular(pView, pGroupIndex, pInputIndex, pRowIndex, pEvent, pTransactionGUID)
176
188
  {
189
+ const tmpTransactionGUID = (pTransactionGUID && typeof pTransactionGUID === 'string') ? pTransactionGUID : this.pict.getUUID();
177
190
  let tmpInput = pView.getTabularRecordInput(pGroupIndex, pInputIndex);
178
191
  if (pGroupIndex != null && pInputIndex != null && pRowIndex != null && tmpInput)
179
192
  {
@@ -191,13 +204,22 @@ class PictDynamicInputEvents extends libPictProvider
191
204
  {
192
205
  if (pView.pict.providers[tmpInputProviderList[i]])
193
206
  {
194
- pView.pict.providers[tmpInputProviderList[i]].onEventTabular(pView, tmpInput, tmpValue, tmpVirtualInformaryHTMLSelector, pRowIndex, pEvent);
207
+ pView.pict.providers[tmpInputProviderList[i]].onEventTabular(pView, tmpInput, tmpValue, tmpVirtualInformaryHTMLSelector, pRowIndex, pEvent, tmpTransactionGUID);
208
+ pView.registerOnTransactionCompleteCallback(tmpTransactionGUID, () =>
209
+ {
210
+ pView.pict.providers[tmpInputProviderList[i]].onAfterEventTabularCompletion(pView, tmpInput, tmpValue, tmpVirtualInformaryHTMLSelector, pRowIndex, pEvent, tmpTransactionGUID);
211
+ });
195
212
  }
196
213
  else
197
214
  {
198
215
  pView.log.error(`Dynamic form [${pView.Hash}]::[${pView.UUID}] cannot find embedded provider [${tmpInputProviderList[i]}] for input [${tmpInput.Hash}] row ${pRowIndex} calling inputEvent ${pEvent}.`);
199
216
  }
200
217
  }
218
+ if (pTransactionGUID !== tmpTransactionGUID)
219
+ {
220
+ // since we synthesized this transaction, finalize it
221
+ pView.finalizeTransaction(tmpTransactionGUID);
222
+ }
201
223
  }
202
224
  catch (pError)
203
225
  {
@@ -65,9 +65,10 @@ class PictInputExtensionProvider extends libPictProvider
65
65
  * @param {Object} pRow - The Row index.
66
66
  * @param {Object} pInput - The input object.
67
67
  * @param {any} pValue - The value of the input object
68
+ * @param {string} pTransactionGUID - The transaction GUID for the event dispatch.
68
69
  * @param {string} pHTMLSelector - The HTML selector for the input object
69
70
  */
70
- onInputInitialize(pView, pGroup, pRow, pInput, pValue, pHTMLSelector)
71
+ onInputInitialize(pView, pGroup, pRow, pInput, pValue, pHTMLSelector, pTransactionGUID)
71
72
  {
72
73
  return true;
73
74
  }
@@ -82,9 +83,10 @@ class PictInputExtensionProvider extends libPictProvider
82
83
  * @param {Object} pInput - The input object.
83
84
  * @param {any} pValue - The value of the input object
84
85
  * @param {string} pHTMLSelector - The HTML selector for the input object (it will return an array).
86
+ * @param {string} pTransactionGUID - The transaction GUID for the event dispatch.
85
87
  * @param {number} pRowIndex - The row index of the tabular data
86
88
  */
87
- onInputInitializeTabular(pView, pGroup, pInput, pValue, pHTMLSelector, pRowIndex)
89
+ onInputInitializeTabular(pView, pGroup, pInput, pValue, pHTMLSelector, pRowIndex, pTransactionGUID)
88
90
  {
89
91
  return true;
90
92
  }
@@ -98,8 +100,9 @@ class PictInputExtensionProvider extends libPictProvider
98
100
  * @param {Object} pInput - The input object.
99
101
  * @param {any} pValue - The new value of the input object
100
102
  * @param {string} pHTMLSelector - The HTML selector for the input object
103
+ * @param {string} pTransactionGUID - The transaction GUID for the event dispatch.
101
104
  */
102
- onDataChange(pView, pInput, pValue, pHTMLSelector)
105
+ onDataChange(pView, pInput, pValue, pHTMLSelector, pTransactionGUID)
103
106
  {
104
107
  return true;
105
108
  }
@@ -112,8 +115,9 @@ class PictInputExtensionProvider extends libPictProvider
112
115
  * @param {any} pValue - The new value of the input object
113
116
  * @param {string} pHTMLSelector - The HTML selector for the input object
114
117
  * @param {number} pRowIndex - The row index of the tabular data
118
+ * @param {string} pTransactionGUID - The transaction GUID for the event dispatch.
115
119
  */
116
- onDataChangeTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex)
120
+ onDataChangeTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex, pTransactionGUID)
117
121
  {
118
122
  return true;
119
123
  }
@@ -127,9 +131,10 @@ class PictInputExtensionProvider extends libPictProvider
127
131
  * @param {Object} pInput - The input object.
128
132
  * @param {any} pValue - The value to marshal.
129
133
  * @param {string} pHTMLSelector - The HTML selector.
134
+ * @param {string} pTransactionGUID - The transaction GUID for the event dispatch.
130
135
  * @returns {boolean} - Returns true if the data was successfully marshaled to the form.
131
136
  */
132
- onDataMarshalToForm(pView, pGroup, pRow, pInput, pValue, pHTMLSelector)
137
+ onDataMarshalToForm(pView, pGroup, pRow, pInput, pValue, pHTMLSelector, pTransactionGUID)
133
138
  {
134
139
  return true;
135
140
  }
@@ -143,9 +148,10 @@ class PictInputExtensionProvider extends libPictProvider
143
148
  * @param {any} pValue - The value to marshal.
144
149
  * @param {string} pHTMLSelector - The HTML selector.
145
150
  * @param {number} pRowIndex - The index of the input in the row columns.
151
+ * @param {string} pTransactionGUID - The transaction GUID for the event dispatch.
146
152
  * @returns {boolean} - Returns true if the data was successfully marshaled to the form.
147
153
  */
148
- onDataMarshalToFormTabular(pView, pGroup, pInput, pValue, pHTMLSelector, pRowIndex)
154
+ onDataMarshalToFormTabular(pView, pGroup, pInput, pValue, pHTMLSelector, pRowIndex, pTransactionGUID)
149
155
  {
150
156
  return true;
151
157
  }
@@ -188,9 +194,43 @@ class PictInputExtensionProvider extends libPictProvider
188
194
  * @param {any} pValue - The value from AppData.
189
195
  * @param {string} pHTMLSelector - The HTML selector.
190
196
  * @param {string} pEvent - The event hash that is expected to be triggered.
197
+ * @param {string} pTransactionGUID - The transaction GUID, if any.
191
198
  * @returns {boolean} - Returns true.
192
199
  */
193
- onEvent(pView, pInput, pValue, pHTMLSelector, pEvent)
200
+ onEvent(pView, pInput, pValue, pHTMLSelector, pEvent, pTransactionGUID)
201
+ {
202
+ return true;
203
+ }
204
+
205
+ /**
206
+ * Handles events for the Pict-Provider-InputExtension.
207
+ *
208
+ * @param {Object} pView - The view object.
209
+ * @param {Object} pInput - The input object.
210
+ * @param {any} pValue - The value from AppData.
211
+ * @param {string} pHTMLSelector - The HTML selector.
212
+ * @param {string} pEvent - The event hash that is expected to be triggered.
213
+ * @param {string} pTransactionGUID - The transaction GUID, if any.
214
+ * @returns {boolean} - Returns true.
215
+ */
216
+ onAfterEventCompletion(pView, pInput, pValue, pHTMLSelector, pEvent, pTransactionGUID)
217
+ {
218
+ return true;
219
+ }
220
+
221
+ /**
222
+ * Handles events for the Pict-Provider-InputExtension.
223
+ *
224
+ * @param {Object} pView - The view object.
225
+ * @param {Object} pInput - The input object.
226
+ * @param {any} pValue - The value from AppData.
227
+ * @param {string} pHTMLSelector - The HTML selector.
228
+ * @param {number} pRowIndex - The row index of the tabular data.
229
+ * @param {string} pEvent - The event hash that is expected to be triggered.
230
+ * @param {string} pTransactionGUID - The transaction GUID, if any.
231
+ * @returns {boolean} - Returns true.
232
+ */
233
+ onEventTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex, pEvent, pTransactionGUID)
194
234
  {
195
235
  return true;
196
236
  }
@@ -204,9 +244,10 @@ class PictInputExtensionProvider extends libPictProvider
204
244
  * @param {string} pHTMLSelector - The HTML selector.
205
245
  * @param {number} pRowIndex - The row index of the tabular data.
206
246
  * @param {string} pEvent - The event hash that is expected to be triggered.
247
+ * @param {string} pTransactionGUID - The transaction GUID, if any.
207
248
  * @returns {boolean} - Returns true.
208
249
  */
209
- onEventTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex, pEvent)
250
+ onAfterEventTabularCompletion(pView, pInput, pValue, pHTMLSelector, pRowIndex, pEvent, pTransactionGUID)
210
251
  {
211
252
  return true;
212
253
  }
@@ -15,7 +15,7 @@ const libPictSectionInputExtension = require('../Pict-Provider-InputExtension.js
15
15
  Providers: ["Pict-Input-AutofillTriggerGroup"],
16
16
  AutofillTriggerGroup:
17
17
  {
18
- TriggerGroupName: "Author",
18
+ TriggerGroupHash: "Author",
19
19
  TriggerAddress: "AppData.CurrentAuthor.Name",
20
20
  MarshalEmptyValues: true
21
21
  }
@@ -56,9 +56,9 @@ class CustomInputHandler extends libPictSectionInputExtension
56
56
  autoFillFromAddressList(pView, pInput, pTriggerGroupInfo, pHTMLSelector)
57
57
  {
58
58
  // First sanity check the triggergroupinfo
59
- if (!('TriggerGroupName' in pTriggerGroupInfo) || (typeof(pTriggerGroupInfo.TriggerGroupName) != 'string'))
59
+ if (!('TriggerGroupHash' in pTriggerGroupInfo) || (typeof(pTriggerGroupInfo.TriggerGroupHash) != 'string'))
60
60
  {
61
- this.log.warn(`AutofillTriggerGroup failed to autofill because a TriggerGroupName string is not present.`);
61
+ this.log.warn(`AutofillTriggerGroup failed to autofill because a TriggerGroupHash string is not present.`);
62
62
  return false;
63
63
  }
64
64
  if (!('TriggerAddress' in pTriggerGroupInfo) || (typeof(pTriggerGroupInfo.TriggerAddress) != 'string'))
@@ -82,9 +82,9 @@ class CustomInputHandler extends libPictSectionInputExtension
82
82
  autoFillFromAddressListTabular(pView, pInput, pTriggerGroupInfo, pHTMLSelector, pRowIndex)
83
83
  {
84
84
  // First sanity check the triggergroupinfo
85
- if (!('TriggerGroupName' in pTriggerGroupInfo) || (typeof(pTriggerGroupInfo.TriggerGroupName) != 'string'))
85
+ if (!('TriggerGroupHash' in pTriggerGroupInfo) || (typeof(pTriggerGroupInfo.TriggerGroupHash) != 'string'))
86
86
  {
87
- this.log.warn(`AutofillTriggerGroup failed to autofill because a TriggerGroupName string is not present.`);
87
+ this.log.warn(`AutofillTriggerGroup failed to autofill because a TriggerGroupHash string is not present.`);
88
88
  return false;
89
89
  }
90
90
  if (!('TriggerAddress' in pTriggerGroupInfo) || (typeof(pTriggerGroupInfo.TriggerAddress) != 'string'))
@@ -113,22 +113,26 @@ class CustomInputHandler extends libPictSectionInputExtension
113
113
  * @param {Object} pInput - The input object.
114
114
  * @param {any} pValue - The new value of the input.
115
115
  * @param {string} pHTMLSelector - The HTML selector of the input.
116
+ * @param {string} pTransactionGUID - The transaction GUID, if any.
116
117
  * @returns {any} - The result of the super.onDataChange method.
117
118
  */
118
- onDataChange(pView, pInput, pValue, pHTMLSelector)
119
+ onDataChange(pView, pInput, pValue, pHTMLSelector, pTransactionGUID)
119
120
  {
120
121
  let tmpTriggerGroupConfigurations = this.getTriggerGroupConfigurationArray(pInput);
121
122
  if (Array.isArray(tmpTriggerGroupConfigurations) && this.pict.views.PictFormMetacontroller)
122
123
  {
123
124
  for (let i = 0; i < tmpTriggerGroupConfigurations.length; i++)
124
125
  {
125
- if (tmpTriggerGroupConfigurations[i].TriggerAllInputs)
126
+ const tmpGroupConfig = tmpTriggerGroupConfigurations[i];
127
+ if (tmpGroupConfig.TriggerAllInputs)
126
128
  {
127
- this.pict.views.PictFormMetacontroller.triggerGlobalInputEvent(`AFTG-ODC-${this.pict.getUUID()}`);
129
+ this.pict.views.PictFormMetacontroller.triggerGlobalInputEvent(
130
+ `TriggerGroup:${tmpGroupConfig.TriggerGroupHash}:DataChange:${pInput.Hash || pInput.DataAddress}:${this.pict.getUUID()}`,
131
+ pTransactionGUID);
128
132
  }
129
133
  }
130
134
  }
131
- return super.onDataChange(pView, pInput, pValue, pHTMLSelector);
135
+ return super.onDataChange(pView, pInput, pValue, pHTMLSelector, pTransactionGUID);
132
136
  }
133
137
 
134
138
  /**
@@ -139,34 +143,52 @@ class CustomInputHandler extends libPictSectionInputExtension
139
143
  * @param {any} pValue - The new value.
140
144
  * @param {string} pHTMLSelector - The HTML selector.
141
145
  * @param {number} pRowIndex - The index of the row.
146
+ * @param {string} pTransactionGUID - The transaction GUID, if any.
142
147
  * @returns {any} - The result of the super method.
143
148
  */
144
- onDataChangeTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex)
149
+ onDataChangeTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex, pTransactionGUID)
145
150
  {
146
151
  let tmpTriggerGroupConfigurations = this.getTriggerGroupConfigurationArray(pInput);
147
152
  if (Array.isArray(tmpTriggerGroupConfigurations) && this.pict.views.PictFormMetacontroller)
148
153
  {
149
154
  for (let i = 0; i < tmpTriggerGroupConfigurations.length; i++)
150
155
  {
151
- if (tmpTriggerGroupConfigurations[i].TriggerAllInputs)
156
+ const tmpGroupConfig = tmpTriggerGroupConfigurations[i];
157
+ if (tmpGroupConfig.TriggerAllInputs)
152
158
  {
153
- this.pict.views.PictFormMetacontroller.triggerGlobalInputEvent(`AFTG-ODC-${this.pict.getUUID()}`);
159
+ this.pict.views.PictFormMetacontroller.triggerGlobalInputEvent(
160
+ `TriggerGroup:${tmpGroupConfig.TriggerGroupHash}:DataChange:${pInput.Hash || pInput.DataAddress}:${this.pict.getUUID()}`,
161
+ pTransactionGUID);
154
162
  }
155
163
  }
156
164
  }
157
- return super.onDataChangeTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex);
165
+ return super.onDataChangeTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex, pTransactionGUID);
158
166
  }
159
167
 
160
- // This input extension only responds to events
161
- onEvent(pView, pInput, pValue, pHTMLSelector, pEvent)
168
+ /**
169
+ * This input extension only responds to events
170
+ *
171
+ * @param {Object} pView - The view object.
172
+ * @param {Object} pInput - The input object.
173
+ * @param {any} pValue - The value from AppData.
174
+ * @param {string} pHTMLSelector - The HTML selector.
175
+ * @param {string} pEvent - The event hash that is expected to be triggered.
176
+ * @param {string} pTransactionGUID - The transaction GUID, if any.
177
+ * @returns {boolean} - Returns true.
178
+ */
179
+ onEvent(pView, pInput, pValue, pHTMLSelector, pEvent, pTransactionGUID)
162
180
  {
163
- // Get all inputs that are in this autofill trigger group
164
- let tmpEventGUID = (typeof(pEvent) === 'string') ? pEvent : this.pict.getUUID();
181
+ const tmpPayload = typeof pValue === 'string' ? pEvent : '';
182
+ let [ tmpType, tmpGroupHash, tmpEvent, tmpInputHash, tmpEventGUID ] = tmpPayload.split(':');
183
+ if (!tmpEventGUID)
184
+ {
185
+ tmpEventGUID = this.pict.getUUID();
186
+ }
165
187
 
166
188
  let tmpAutoFillTriggerGroups = pInput.PictForm.AutofillTriggerGroup;
167
- if (!tmpAutoFillTriggerGroups)
189
+ if (!tmpAutoFillTriggerGroups || tmpType !== 'TriggerGroup' || (pInput.Hash || pInput.DataAddress) == tmpInputHash)
168
190
  {
169
- return super.onEvent(pView, pInput, pValue, pHTMLSelector, pEvent);
191
+ return super.onEvent(pView, pInput, pValue, pHTMLSelector, pEvent, pTransactionGUID);
170
192
  }
171
193
  if (!Array.isArray(tmpAutoFillTriggerGroups))
172
194
  {
@@ -175,6 +197,10 @@ class CustomInputHandler extends libPictSectionInputExtension
175
197
  for (let i = 0; i < tmpAutoFillTriggerGroups.length; i++)
176
198
  {
177
199
  let tmpAutoFillTriggerGroup = tmpAutoFillTriggerGroups[i];
200
+ if (tmpAutoFillTriggerGroup.TriggerGroupHash !== tmpGroupHash)
201
+ {
202
+ continue;
203
+ }
178
204
 
179
205
  //FIXME: why is this check here? revisit
180
206
  if ('TriggerAddress' in tmpAutoFillTriggerGroup)
@@ -194,17 +220,34 @@ class CustomInputHandler extends libPictSectionInputExtension
194
220
  }
195
221
  }
196
222
 
197
- return super.onEvent(pView, pInput, pValue, pHTMLSelector, pEvent);
223
+ return super.onEvent(pView, pInput, pValue, pHTMLSelector, pEvent, pTransactionGUID);
198
224
  }
199
225
 
200
- onEventTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex, pEvent)
226
+ /**
227
+ * Handles events for the Pict-Provider-InputExtension.
228
+ *
229
+ * @param {Object} pView - The view object.
230
+ * @param {Object} pInput - The input object.
231
+ * @param {any} pValue - The value from AppData.
232
+ * @param {string} pHTMLSelector - The HTML selector.
233
+ * @param {number} pRowIndex - The row index of the tabular data.
234
+ * @param {string} pEvent - The event hash that is expected to be triggered.
235
+ * @param {string} pTransactionGUID - The transaction GUID, if any.
236
+ * @returns {boolean} - Returns true.
237
+ */
238
+ onEventTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex, pEvent, pTransactionGUID)
201
239
  {
202
- let tmpEventGUID = (typeof(pEvent) === 'string') ? pEvent : this.pict.getUUID();
240
+ const tmpPayload = typeof pValue === 'string' ? pEvent : '';
241
+ let [ tmpType, tmpGroupHash, tmpEvent, tmpInputHash, tmpEventGUID ] = tmpPayload.split(':');
242
+ if (!tmpEventGUID)
243
+ {
244
+ tmpEventGUID = this.pict.getUUID();
245
+ }
203
246
 
204
- if (!pInput.PictForm.hasOwnProperty('AutofillTriggerGroup'))
247
+ if (!pInput.PictForm.AutofillTriggerGroup || tmpType !== 'TriggerGroup' || (pInput.Hash || pInput.DataAddress) == tmpInputHash)
205
248
  {
206
249
  // Do nothing for now -- this is the triggering element
207
- return;
250
+ return super.onEventTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex, pEvent, pTransactionGUID);
208
251
  }
209
252
  let tmpAutoFillTriggerGroups = pInput.PictForm.AutofillTriggerGroup;
210
253
  if (!Array.isArray(tmpAutoFillTriggerGroups))
@@ -213,6 +256,10 @@ class CustomInputHandler extends libPictSectionInputExtension
213
256
  }
214
257
  for (const tmpAutoFillTriggerGroup of tmpAutoFillTriggerGroups)
215
258
  {
259
+ if (tmpAutoFillTriggerGroup.TriggerGroupHash !== tmpGroupHash)
260
+ {
261
+ continue;
262
+ }
216
263
  //FIXME: why is this flow different from non-tabular? revisit
217
264
  if (!tmpAutoFillTriggerGroup.SelectOptionsRefresh)
218
265
  {
@@ -235,7 +282,7 @@ class CustomInputHandler extends libPictSectionInputExtension
235
282
  }
236
283
  }
237
284
 
238
- return super.onEventTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex, pEvent);
285
+ return super.onEventTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex, pEvent, pTransactionGUID);
239
286
  }
240
287
  }
241
288
 
@@ -63,12 +63,13 @@ class CustomInputHandler extends libPictSectionInputExtension
63
63
  * @param {Object} pInput - The input object.
64
64
  * @param {any} pValue - The value to be assigned.
65
65
  * @param {string} pHTMLSelector - The HTML selector.
66
+ * @param {string} pTransactionGUID - The transaction GUID for the event dispatch.
66
67
  * @returns {any} - The result of the super method call.
67
68
  */
68
- onDataMarshalToForm(pView, pGroup, pRow, pInput, pValue, pHTMLSelector)
69
+ onDataMarshalToForm(pView, pGroup, pRow, pInput, pValue, pHTMLSelector, pTransactionGUID)
69
70
  {
70
71
  this.pict.ContentAssignment.assignContent(this.getDateTimeInputHTMLID(pInput.Macro.RawHTMLID), pValue);
71
- return super.onDataMarshalToForm(pView, pGroup, pRow, pInput, pValue, pHTMLSelector);
72
+ return super.onDataMarshalToForm(pView, pGroup, pRow, pInput, pValue, pHTMLSelector, pTransactionGUID);
72
73
  }
73
74
 
74
75
  /**
@@ -80,12 +81,13 @@ class CustomInputHandler extends libPictSectionInputExtension
80
81
  * @param {any} pValue - The value to be assigned.
81
82
  * @param {string} pHTMLSelector - The HTML selector.
82
83
  * @param {number} pRowIndex - The index of the row.
84
+ * @param {string} pTransactionGUID - The transaction GUID for the event dispatch.
83
85
  * @returns {any} - The result of the data marshaling.
84
86
  */
85
- onDataMarshalToFormTabular(pView, pGroup, pInput, pValue, pHTMLSelector, pRowIndex)
87
+ onDataMarshalToFormTabular(pView, pGroup, pInput, pValue, pHTMLSelector, pRowIndex, pTransactionGUID)
86
88
  {
87
89
  this.pict.ContentAssignment.assignContent(this.getTabularDateTimeInputHTMLID(pInput.Macro.RawHTMLID, pRowIndex), pValue);
88
- return super.onDataMarshalToFormTabular(pView, pGroup, pInput, pValue, pHTMLSelector, pRowIndex);
90
+ return super.onDataMarshalToFormTabular(pView, pGroup, pInput, pValue, pHTMLSelector, pRowIndex, pTransactionGUID);
89
91
  }
90
92
 
91
93
  /**
@@ -248,7 +248,7 @@ class CustomInputHandler extends libPictSectionInputExtension
248
248
  if (tmpInput.PictForm.EntityBundleTriggerGroup && this.pict.views.PictFormMetacontroller)
249
249
  {
250
250
  // Trigger the autofill global event
251
- this.pict.views.PictFormMetacontroller.triggerGlobalInputEvent(`AutoFill-${tmpInput.PictForm.EntityBundleTriggerGroup}`);
251
+ this.pict.views.PictFormMetacontroller.triggerGlobalInputEvent(`TriggerGroup:${tmpInput.PictForm.EntityBundleTriggerGroup}:BundleLoad:${pInput.Hash || pInput.DataAddress}:${this.pict.getUUID()}`);
252
252
  }
253
253
  if (tmpInput.PictForm.EntityBundleTriggerMetacontrollerSolve && this.pict.views.PictFormMetacontroller)
254
254
  {
@@ -289,9 +289,10 @@ class CustomInputHandler extends libPictSectionInputExtension
289
289
  * @param {Object} pInput - The input object.
290
290
  * @param {any} pValue - The input value.
291
291
  * @param {string} pHTMLSelector - The HTML selector.
292
+ * @param {string} pTransactionGUID - The transaction GUID for the event dispatch.
292
293
  * @returns {boolean} - Returns true if the input element is successfully initialized, false otherwise.
293
294
  */
294
- onInputInitialize(pView, pGroup, pRow, pInput, pValue, pHTMLSelector)
295
+ onInputInitialize(pView, pGroup, pRow, pInput, pValue, pHTMLSelector, pTransactionGUID)
295
296
  {
296
297
  // Try to get the input element
297
298
  if (pValue && pInput.PictForm && pInput.PictForm.EntityBundleTriggerOnInitialize)
@@ -300,7 +301,7 @@ class CustomInputHandler extends libPictSectionInputExtension
300
301
  this.gatherDataFromServer(pView, pInput, pValue, pHTMLSelector);
301
302
  }
302
303
  // This is in case we need to do a request on initial load!
303
- return super.onInputInitialize(pView, pGroup, pRow, pInput, pValue, pHTMLSelector);
304
+ return super.onInputInitialize(pView, pGroup, pRow, pInput, pValue, pHTMLSelector, pTransactionGUID);
304
305
  }
305
306
 
306
307
  /**
@@ -312,11 +313,12 @@ class CustomInputHandler extends libPictSectionInputExtension
312
313
  * @param {any} pValue - The input value.
313
314
  * @param {string} pHTMLSelector - The HTML selector.
314
315
  * @param {number} pRowIndex - The index of the row.
316
+ * @param {string} pTransactionGUID - The transaction GUID for the event dispatch.
315
317
  * @returns {any} - The result of the initialization.
316
318
  */
317
- onInputInitializeTabular(pView, pGroup, pInput, pValue, pHTMLSelector, pRowIndex)
319
+ onInputInitializeTabular(pView, pGroup, pInput, pValue, pHTMLSelector, pRowIndex, pTransactionGUID)
318
320
  {
319
- return super.onInputInitializeTabular(pView, pGroup, pInput, pValue, pHTMLSelector, pRowIndex);
321
+ return super.onInputInitializeTabular(pView, pGroup, pInput, pValue, pHTMLSelector, pRowIndex, pTransactionGUID);
320
322
  }
321
323
 
322
324
  /**
@@ -326,12 +328,13 @@ class CustomInputHandler extends libPictSectionInputExtension
326
328
  * @param {Object} pInput - The input object.
327
329
  * @param {any} pValue - The new value of the input.
328
330
  * @param {string} pHTMLSelector - The HTML selector of the input.
331
+ * @param {string} pTransactionGUID - The transaction GUID for the event dispatch.
329
332
  * @returns {any} - The result of the super.onDataChange method.
330
333
  */
331
- onDataChange(pView, pInput, pValue, pHTMLSelector)
334
+ onDataChange(pView, pInput, pValue, pHTMLSelector, pTransactionGUID)
332
335
  {
333
336
  this.gatherDataFromServer(pView, pInput, pValue, pHTMLSelector);
334
- return super.onDataChange(pView, pInput, pValue, pHTMLSelector);
337
+ return super.onDataChange(pView, pInput, pValue, pHTMLSelector, pTransactionGUID);
335
338
  }
336
339
 
337
340
  /**
@@ -342,12 +345,13 @@ class CustomInputHandler extends libPictSectionInputExtension
342
345
  * @param {any} pValue - The new value.
343
346
  * @param {string} pHTMLSelector - The HTML selector.
344
347
  * @param {number} pRowIndex - The index of the row.
348
+ * @param {string} pTransactionGUID - The transaction GUID for the event dispatch.
345
349
  * @returns {any} - The result of the super method.
346
350
  */
347
- onDataChangeTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex)
351
+ onDataChangeTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex, pTransactionGUID)
348
352
  {
349
353
  this.gatherDataFromServer(pView, pInput, pValue, pHTMLSelector);
350
- return super.onDataChangeTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex);
354
+ return super.onDataChangeTabular(pView, pInput, pValue, pHTMLSelector, pRowIndex, pTransactionGUID);
351
355
  }
352
356
 
353
357
  /**
@@ -359,11 +363,12 @@ class CustomInputHandler extends libPictSectionInputExtension
359
363
  * @param {Object} pInput - The input object.
360
364
  * @param {any} pValue - The value to be marshaled.
361
365
  * @param {string} pHTMLSelector - The HTML selector.
366
+ * @param {string} pTransactionGUID - The transaction GUID for the event dispatch.
362
367
  * @returns {boolean} - Returns true if the value is successfully marshaled to the form, otherwise false.
363
368
  */
364
- onDataMarshalToForm(pView, pGroup, pRow, pInput, pValue, pHTMLSelector)
369
+ onDataMarshalToForm(pView, pGroup, pRow, pInput, pValue, pHTMLSelector, pTransactionGUID)
365
370
  {
366
- return super.onDataMarshalToForm(pView, pGroup, pRow, pInput, pValue, pHTMLSelector);
371
+ return super.onDataMarshalToForm(pView, pGroup, pRow, pInput, pValue, pHTMLSelector, pTransactionGUID);
367
372
  }
368
373
 
369
374
  /**
@@ -375,11 +380,12 @@ class CustomInputHandler extends libPictSectionInputExtension
375
380
  * @param {any} pValue - The value parameter.
376
381
  * @param {string} pHTMLSelector - The HTML selector parameter.
377
382
  * @param {number} pRowIndex - The row index parameter.
383
+ * @param {string} pTransactionGUID - The transaction GUID for the event dispatch.
378
384
  * @returns {any} - The result of the data marshaling.
379
385
  */
380
- onDataMarshalToFormTabular(pView, pGroup, pInput, pValue, pHTMLSelector, pRowIndex)
386
+ onDataMarshalToFormTabular(pView, pGroup, pInput, pValue, pHTMLSelector, pRowIndex, pTransactionGUID)
381
387
  {
382
- return super.onDataMarshalToFormTabular(pView, pGroup, pInput, pValue, pHTMLSelector, pRowIndex);
388
+ return super.onDataMarshalToFormTabular(pView, pGroup, pInput, pValue, pHTMLSelector, pRowIndex, pTransactionGUID);
383
389
  }
384
390
  }
385
391