pict-section-form 1.0.122 → 1.0.124

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 (56) hide show
  1. package/example_applications/Build-Examples.sh +5 -0
  2. package/example_applications/Clean-Examples.sh +2 -1
  3. package/example_applications/Open-Examples.sh +2 -1
  4. package/example_applications/postcard_example/providers/PictProvider-PostKardInputExtension.js +38 -7
  5. package/package.json +2 -2
  6. package/source/providers/Pict-Provider-DynamicFormSolverBehaviors.js +28 -6
  7. package/source/providers/Pict-Provider-DynamicInputEvents.js +26 -4
  8. package/source/providers/Pict-Provider-DynamicSolver.js +1 -1
  9. package/source/providers/Pict-Provider-InputExtension.js +49 -8
  10. package/source/providers/inputs/Pict-Provider-Input-AutofillTriggerGroup.js +43 -15
  11. package/source/providers/inputs/Pict-Provider-Input-DateTime.js +6 -4
  12. package/source/providers/inputs/Pict-Provider-Input-EntityBundleRequest.js +35 -18
  13. package/source/providers/inputs/Pict-Provider-Input-HTML.js +12 -8
  14. package/source/providers/inputs/Pict-Provider-Input-Link.js +6 -4
  15. package/source/providers/inputs/Pict-Provider-Input-Markdown.js +12 -8
  16. package/source/providers/inputs/Pict-Provider-Input-PreciseNumber.js +6 -4
  17. package/source/providers/inputs/Pict-Provider-Input-Select.js +25 -20
  18. package/source/providers/inputs/Pict-Provider-Input-TabGroupSelector.js +3 -2
  19. package/source/providers/inputs/Pict-Provider-Input-TabSectionSelector.js +3 -2
  20. package/source/providers/inputs/Pict-Provider-Input-TemplatedEntityLookup.js +12 -8
  21. package/source/views/Pict-View-DynamicForm.js +205 -29
  22. package/source/views/Pict-View-Form-Metacontroller.js +12 -2
  23. package/types/source/providers/Pict-Provider-DynamicFormSolverBehaviors.d.ts +10 -1
  24. package/types/source/providers/Pict-Provider-DynamicFormSolverBehaviors.d.ts.map +1 -1
  25. package/types/source/providers/Pict-Provider-DynamicInputEvents.d.ts +4 -2
  26. package/types/source/providers/Pict-Provider-DynamicInputEvents.d.ts.map +1 -1
  27. package/types/source/providers/Pict-Provider-DynamicSolver.d.ts +2 -1
  28. package/types/source/providers/Pict-Provider-DynamicSolver.d.ts.map +1 -1
  29. package/types/source/providers/Pict-Provider-InputExtension.d.ts +41 -8
  30. package/types/source/providers/Pict-Provider-InputExtension.d.ts.map +1 -1
  31. package/types/source/providers/inputs/Pict-Provider-Input-AutofillTriggerGroup.d.ts +4 -4
  32. package/types/source/providers/inputs/Pict-Provider-Input-AutofillTriggerGroup.d.ts.map +1 -1
  33. package/types/source/providers/inputs/Pict-Provider-Input-DateTime.d.ts +4 -2
  34. package/types/source/providers/inputs/Pict-Provider-Input-DateTime.d.ts.map +1 -1
  35. package/types/source/providers/inputs/Pict-Provider-Input-EntityBundleRequest.d.ts +13 -7
  36. package/types/source/providers/inputs/Pict-Provider-Input-EntityBundleRequest.d.ts.map +1 -1
  37. package/types/source/providers/inputs/Pict-Provider-Input-HTML.d.ts +6 -3
  38. package/types/source/providers/inputs/Pict-Provider-Input-HTML.d.ts.map +1 -1
  39. package/types/source/providers/inputs/Pict-Provider-Input-Link.d.ts +4 -2
  40. package/types/source/providers/inputs/Pict-Provider-Input-Link.d.ts.map +1 -1
  41. package/types/source/providers/inputs/Pict-Provider-Input-Markdown.d.ts +6 -3
  42. package/types/source/providers/inputs/Pict-Provider-Input-Markdown.d.ts.map +1 -1
  43. package/types/source/providers/inputs/Pict-Provider-Input-PreciseNumber.d.ts +4 -2
  44. package/types/source/providers/inputs/Pict-Provider-Input-PreciseNumber.d.ts.map +1 -1
  45. package/types/source/providers/inputs/Pict-Provider-Input-Select.d.ts +11 -6
  46. package/types/source/providers/inputs/Pict-Provider-Input-Select.d.ts.map +1 -1
  47. package/types/source/providers/inputs/Pict-Provider-Input-TabGroupSelector.d.ts.map +1 -1
  48. package/types/source/providers/inputs/Pict-Provider-Input-TabSectionSelector.d.ts.map +1 -1
  49. package/types/source/providers/inputs/Pict-Provider-Input-TemplatedEntityLookup.d.ts +6 -3
  50. package/types/source/providers/inputs/Pict-Provider-Input-TemplatedEntityLookup.d.ts.map +1 -1
  51. package/types/source/views/Pict-View-DynamicForm.d.ts +39 -7
  52. package/types/source/views/Pict-View-DynamicForm.d.ts.map +1 -1
  53. package/types/source/views/Pict-View-Form-Metacontroller.d.ts +2 -1
  54. package/types/source/views/Pict-View-Form-Metacontroller.d.ts.map +1 -1
  55. package/utility/csvparser/ParseCSV-Command-BuildDistilling.js +3 -3
  56. package/utility/csvparser/ParseCSV-Command-Inject.js +3 -1
@@ -6,6 +6,10 @@ const libPackage = require('../../package.json');
6
6
  /** @type {Record<string, any>} */
7
7
  const _DefaultConfiguration = require('./Pict-View-DynamicForm-DefaultConfiguration.json');
8
8
 
9
+ const PENDING_ASYNC_OPERATION_TYPE = 'PendingAsyncOperation';
10
+ const TRANSACTION_COMPLETE_CALLBACK_TYPE = 'onTransactionComplete';
11
+ const READY_TO_FINALIZE_TYPE = 'ReadyToFinalize';
12
+
9
13
  /**
10
14
  * Represents a dynamic form view for the Pict application.
11
15
  *
@@ -64,7 +68,8 @@ class PictViewDynamicForm extends libPictViewClass
64
68
  }
65
69
 
66
70
  // Use this to manage transactions
67
- this.transactionTracking = this.pict.newTransactionTracker();
71
+ //FIXME: should we have these sioled??
72
+ //this.transactionTracking = this.pict.newTransactionTracker();
68
73
 
69
74
  /** @type {Record<string, any>} */
70
75
  this._PackagePictView = this._Package;
@@ -172,11 +177,13 @@ class PictViewDynamicForm extends libPictViewClass
172
177
  let tmpValue = this.sectionManifest.getValueByHash(tmpMarshalDestinationObject, tmpHashAddress);
173
178
 
174
179
  let tmpInputProviderList = this.getInputProviderList(tmpInput);
180
+ const tmpTransactionGUID = this.fable.getUUID();
181
+ this.pict.TransactionTracking.registerTransaction(tmpTransactionGUID);
175
182
  for (let i = 0; i < tmpInputProviderList.length; i++)
176
183
  {
177
184
  if (this.pict.providers[tmpInputProviderList[i]])
178
185
  {
179
- this.pict.providers[tmpInputProviderList[i]].onDataChange(this, tmpInput, tmpValue, tmpInput.Macro.HTMLSelector);
186
+ this.pict.providers[tmpInputProviderList[i]].onDataChange(this, tmpInput, tmpValue, tmpInput.Macro.HTMLSelector, tmpTransactionGUID);
180
187
  }
181
188
  else
182
189
  {
@@ -233,11 +240,13 @@ class PictViewDynamicForm extends libPictViewClass
233
240
  // Each row has a distinct address!
234
241
  let tmpVirtualInformaryHTMLSelector = tmpInput.Macro.HTMLSelectorTabular + `[data-i-index="${pRowIndex}"]`;
235
242
  let tmpInputProviderList = this.getInputProviderList(tmpInput);
243
+ const tmpTransactionGUID = this.fable.getUUID();
244
+ this.pict.TransactionTracking.registerTransaction(tmpTransactionGUID);
236
245
  for (let i = 0; i < tmpInputProviderList.length; i++)
237
246
  {
238
247
  if (this.pict.providers[tmpInputProviderList[i]])
239
248
  {
240
- this.pict.providers[tmpInputProviderList[i]].onDataChangeTabular(this, tmpInput, tmpValue, tmpVirtualInformaryHTMLSelector, pRowIndex);
249
+ this.pict.providers[tmpInputProviderList[i]].onDataChangeTabular(this, tmpInput, tmpValue, tmpVirtualInformaryHTMLSelector, pRowIndex, tmpTransactionGUID);
241
250
  }
242
251
  else
243
252
  {
@@ -263,6 +272,8 @@ class PictViewDynamicForm extends libPictViewClass
263
272
  /**
264
273
  * Sets the data in a specific form input based on the provided input object
265
274
  *
275
+ * FIXME: does this need to have a transaction GUID passed in?
276
+ *
266
277
  * @param {object} pInput - The input object.
267
278
  * @param {any} pValue - The value to set.
268
279
  * @returns {boolean} Returns true if the data was set successfully, false otherwise.
@@ -278,17 +289,20 @@ class PictViewDynamicForm extends libPictViewClass
278
289
  // Each row has a distinct address!
279
290
  let tmpVirtualInformaryHTMLSelector = pInput.Macro.HTMLSelector;
280
291
  let tmpInputProviderList = this.getInputProviderList(pInput);
292
+ const tmpTransactionGUID = this.fable.getUUID();
293
+ this.pict.TransactionTracking.registerTransaction(tmpTransactionGUID);
281
294
  for (let i = 0; i < tmpInputProviderList.length; i++)
282
295
  {
283
296
  if (this.pict.providers[tmpInputProviderList[i]])
284
297
  {
285
- this.pict.providers[tmpInputProviderList[i]].onDataChange(this, pInput, tmpValue, tmpVirtualInformaryHTMLSelector);
298
+ this.pict.providers[tmpInputProviderList[i]].onDataChange(this, pInput, tmpValue, tmpVirtualInformaryHTMLSelector, tmpTransactionGUID);
286
299
  }
287
300
  else
288
301
  {
289
302
  this.log.error(`Dynamic form setDataByInput [${this.Hash}]::[${this.UUID}] cannot find provider [${tmpInputProviderList[i]}] for input [${pInput.Hash}].`);
290
303
  }
291
304
  }
305
+ this.finalizeTransaction(tmpTransactionGUID);
292
306
  }
293
307
  catch (pError)
294
308
  {
@@ -301,6 +315,8 @@ class PictViewDynamicForm extends libPictViewClass
301
315
  /**
302
316
  * Sets the data in a specific tabular form input based on the provided hash, group and row.
303
317
  *
318
+ * FIXME: does this need to have a transaction GUID passed in?
319
+ *
304
320
  * @param {number} pGroupIndex - The index of the group.
305
321
  * @param {string} pInputHash - The hash of the input.
306
322
  * @param {number} pRowIndex - The index of the row.
@@ -353,17 +369,20 @@ class PictViewDynamicForm extends libPictViewClass
353
369
  // Each row has a distinct address!
354
370
  let tmpVirtualInformaryHTMLSelector = tmpInput.Macro.HTMLSelectorTabular + `[data-i-index="${pRowIndex}"]`;
355
371
  let tmpInputProviderList = this.getInputProviderList(tmpInput);
372
+ const tmpTransactionGUID = this.fable.getUUID();
373
+ this.pict.TransactionTracking.registerTransaction(tmpTransactionGUID);
356
374
  for (let i = 0; i < tmpInputProviderList.length; i++)
357
375
  {
358
376
  if (this.pict.providers[tmpInputProviderList[i]])
359
377
  {
360
- this.pict.providers[tmpInputProviderList[i]].onDataChangeTabular(this, tmpInput, tmpValue, tmpVirtualInformaryHTMLSelector, pRowIndex);
378
+ this.pict.providers[tmpInputProviderList[i]].onDataChangeTabular(this, tmpInput, tmpValue, tmpVirtualInformaryHTMLSelector, pRowIndex, tmpTransactionGUID);
361
379
  }
362
380
  else
363
381
  {
364
382
  this.log.error(`Dynamic form setDataTabularByHash [${this.Hash}]::[${this.UUID}] cannot find provider [${tmpInputProviderList[i]}] for input [${tmpInput.Hash}] row ${pRowIndex}.`);
365
383
  }
366
384
  }
385
+ this.finalizeTransaction(tmpTransactionGUID);
367
386
  }
368
387
  catch (pError)
369
388
  {
@@ -428,7 +447,7 @@ class PictViewDynamicForm extends libPictViewClass
428
447
  try
429
448
  {
430
449
  let tmpTransactionGUID = this.fable.getUUID();
431
- this.transactionTracking.registerTransaction(tmpTransactionGUID);
450
+ this.pict.TransactionTracking.registerTransaction(tmpTransactionGUID);
432
451
  let tmpMarshalDestinationObject = this.getMarshalDestinationObject();
433
452
  // TODO: Add optional transaction awareness to informary
434
453
  this.pict.providers.Informary.marshalDataToForm(tmpMarshalDestinationObject, this.formID, this.sectionManifest);
@@ -447,7 +466,7 @@ class PictViewDynamicForm extends libPictViewClass
447
466
  try
448
467
  {
449
468
  let tmpTransactionGUID = (typeof(pTransactionGUID) == 'string') ? pTransactionGUID : this.fable.getUUID();
450
- this.transactionTracking.registerTransaction(tmpTransactionGUID);
469
+ this.pict.TransactionTracking.registerTransaction(tmpTransactionGUID);
451
470
  this.pict.providers.Informary.manualMarshalDataToFormByInput(pInput);
452
471
  this.runLayoutProviderFunctions('onDataMarshalToForm', tmpTransactionGUID);
453
472
  this.runInputProviderFunctions('onDataMarshalToForm', pInput.Hash, null, tmpTransactionGUID);
@@ -463,7 +482,7 @@ class PictViewDynamicForm extends libPictViewClass
463
482
  try
464
483
  {
465
484
  let tmpTransactionGUID = (typeof(pTransactionGUID) == 'string') ? pTransactionGUID : this.fable.getUUID();
466
- this.transactionTracking.registerTransaction(tmpTransactionGUID);
485
+ this.pict.TransactionTracking.registerTransaction(tmpTransactionGUID);
467
486
  this.pict.providers.Informary.manualMarshalTabularDataToFormByInput(pInput, pRowIndex);
468
487
  this.runLayoutProviderFunctions('onDataMarshalToForm', tmpTransactionGUID);
469
488
  this.runInputProviderFunctions('onDataMarshalToForm', pInput.Hash, pRowIndex, tmpTransactionGUID);
@@ -502,7 +521,7 @@ class PictViewDynamicForm extends libPictViewClass
502
521
  try
503
522
  {
504
523
  let tmpTransactionGUID = this.fable.getUUID();
505
- this.transactionTracking.registerTransaction(tmpTransactionGUID);
524
+ this.pict.TransactionTracking.registerTransaction(tmpTransactionGUID);
506
525
  this.runInputProviderFunctions('onAfterMarshalToForm', null, null, tmpTransactionGUID);
507
526
 
508
527
  }
@@ -588,7 +607,7 @@ class PictViewDynamicForm extends libPictViewClass
588
607
  onAfterRender(pRenderable)
589
608
  {
590
609
  let tmpTransactionGUID = this.fable.getUUID();
591
- this.transactionTracking.registerTransaction(tmpTransactionGUID);
610
+ this.pict.TransactionTracking.registerTransaction(tmpTransactionGUID);
592
611
 
593
612
  this.runLayoutProviderFunctions('onGroupLayoutInitialize', tmpTransactionGUID);
594
613
  this.runInputProviderFunctions('onInputInitialize', null, null, tmpTransactionGUID);
@@ -614,7 +633,7 @@ class PictViewDynamicForm extends libPictViewClass
614
633
  runLayoutProviderFunctions(pFunctionName, pTransactionGUID)
615
634
  {
616
635
  const tmpTransactionGUID = (typeof(pTransactionGUID) === 'string') ? pTransactionGUID : this.fable.getUUID();
617
- const tmpTransaction = this.transactionTracking.registerTransaction(tmpTransactionGUID);
636
+ const tmpTransaction = this.pict.TransactionTracking.registerTransaction(tmpTransactionGUID);
618
637
 
619
638
  // Check to see if there are any hooks set from the input templates
620
639
  let tmpLayoutProviders = this.pict.ContentAssignment.getElement(`${this.sectionDefinition.DefaultDestinationAddress} [data-i-pictdynamiclayout="true"]`);
@@ -646,7 +665,7 @@ class PictViewDynamicForm extends libPictViewClass
646
665
  if (tmpLayoutProvider && (pFunctionName in tmpLayoutProvider))
647
666
  {
648
667
  let tmpFunction = tmpLayoutProvider[pFunctionName];
649
- if (this.transactionTracking.checkEvent(tmpTransaction.TransactionKey, `G${tmpGroupIndex}-L${tmpLayout}`, pFunctionName))
668
+ if (this.pict.TransactionTracking.checkEvent(tmpTransaction.TransactionKey, `G${tmpGroupIndex}-L${tmpLayout}`, pFunctionName))
650
669
  {
651
670
  tmpFunction.call(tmpLayoutProvider, this, tmpGroup);
652
671
  }
@@ -665,7 +684,7 @@ class PictViewDynamicForm extends libPictViewClass
665
684
  runInputProviderFunctions(pFunctionName, pInputHash, pRowIndex, pTransactionGUID)
666
685
  {
667
686
  const tmpTransactionGUID = (typeof(pTransactionGUID) === 'string') ? pTransactionGUID : this.fable.getUUID();
668
- const tmpTransaction = this.transactionTracking.registerTransaction(tmpTransactionGUID);
687
+ const tmpTransaction = this.pict.TransactionTracking.registerTransaction(tmpTransactionGUID);
669
688
 
670
689
  // Check to see if there are any hooks set from the input templates
671
690
  for (let i = 0; i < this.sectionDefinition.Groups.length; i++)
@@ -699,8 +718,8 @@ class PictViewDynamicForm extends libPictViewClass
699
718
  this.log.trace(`Dynamic form [${this.Hash}]::[${this.UUID}] running provider [${tmpInputProviderList[l]}] function [${pFunctionName}] for input [${tmpInput.Hash}].`);
700
719
  }
701
720
  // TODO: Right now the Option input requires this bug to work
702
- //if (this.transactionTracking.checkEvent(tmpTransaction.TransactionKey, `I${tmpInput.Hash}-P${tmpInputProviderList[l]}`, pFunctionName))
703
- if ((tmpInput.PictForm.InputType == 'Option') || this.transactionTracking.checkEvent(tmpTransaction.TransactionKey, `I${tmpInput.Hash}-P${tmpInputProviderList[l]}`, pFunctionName))
721
+ //if (this.pict.TransactionTracking.checkEvent(tmpTransaction.TransactionKey, `I${tmpInput.Hash}-P${tmpInputProviderList[l]}`, pFunctionName))
722
+ if ((tmpInput.PictForm.InputType == 'Option') || this.pict.TransactionTracking.checkEvent(tmpTransaction.TransactionKey, `I${tmpInput.Hash}-P${tmpInputProviderList[l]}`, pFunctionName))
704
723
  {
705
724
  this.pict.providers[tmpInputProviderList[l]][pFunctionName](this, tmpGroup, j, tmpInput, tmpValue, tmpInput.Macro.HTMLSelector);
706
725
  }
@@ -752,7 +771,7 @@ class PictViewDynamicForm extends libPictViewClass
752
771
  let tmpValue = this.sectionManifest.getValueByHash(this.getMarshalDestinationObject(), tmpValueAddress);
753
772
  try
754
773
  {
755
- if (this.transactionTracking.checkEvent(tmpTransaction.TransactionKey, `TI${tmpInput.Hash}-P${tmpInputProviderList[l]}-R${r}`, pFunctionName))
774
+ if (this.pict.TransactionTracking.checkEvent(tmpTransaction.TransactionKey, `TI${tmpInput.Hash}-P${tmpInputProviderList[l]}-R${r}`, pFunctionName))
756
775
  {
757
776
  this.pict.providers[tmpInputProviderList[l]][pFunctionName + 'Tabular'](this, tmpGroup, tmpInput, tmpValue, tmpInput.Macro.HTMLSelectorTabular, r);
758
777
  }
@@ -773,6 +792,7 @@ class PictViewDynamicForm extends libPictViewClass
773
792
  }
774
793
  }
775
794
  }
795
+ this.finalizeTransaction(tmpTransactionGUID);
776
796
  }
777
797
 
778
798
  /**
@@ -982,30 +1002,34 @@ class PictViewDynamicForm extends libPictViewClass
982
1002
  *
983
1003
  * @param {String} pInputHash - The input hash object.
984
1004
  * @param {string} pEvent - The input event string.
1005
+ * @param {string} [pTransactionGUID] - The transaction GUID.
985
1006
  * @returns {any} - The result of the input event handling.
986
1007
  */
987
- inputEvent(pInputHash, pEvent)
1008
+ inputEvent(pInputHash, pEvent, pTransactionGUID)
988
1009
  {
989
- return this.pict.providers.DynamicInputEvents.inputEvent(this, pInputHash, pEvent);
1010
+ return this.pict.providers.DynamicInputEvents.inputEvent(this, pInputHash, pEvent, pTransactionGUID);
990
1011
  }
991
1012
 
992
1013
  /**
993
1014
  * @deprecated
994
1015
  * @param {string} pEvent - The input event string.
995
1016
  * @param {Object} pCompletedHashes - the hashes that have already signaled the event
1017
+ * @param {string} [pTransactionGUID] - The transaction GUID.
996
1018
  */
997
- globalInputEvent(pEvent, pCompletedHashes)
1019
+ globalInputEvent(pEvent, pCompletedHashes, pTransactionGUID)
998
1020
  {
999
- this.manifestInputEvent(pEvent, pCompletedHashes);
1021
+ this.manifestInputEvent(pEvent, pCompletedHashes, pTransactionGUID);
1000
1022
  }
1001
1023
 
1002
1024
  /**
1003
1025
  *
1004
1026
  * @param {string} pEvent - The input event string.
1005
1027
  * @param {Object} pCompletedHashes - the hashes that have already signaled the event
1028
+ * @param {string} [pTransactionGUID] - The transaction GUID.
1006
1029
  */
1007
- manifestInputEvent(pEvent, pCompletedHashes)
1030
+ manifestInputEvent(pEvent, pCompletedHashes, pTransactionGUID)
1008
1031
  {
1032
+ const tmpTransactionGUID = (pTransactionGUID && typeof(pTransactionGUID) === 'string') ? pTransactionGUID : this.fable.getUUID();
1009
1033
  const tmpInputHashes = Object.keys(this.sectionManifest.elementHashes);
1010
1034
 
1011
1035
  for (let i = 0; i < tmpInputHashes.length; i++)
@@ -1013,9 +1037,14 @@ class PictViewDynamicForm extends libPictViewClass
1013
1037
  if (!(tmpInputHashes[i] in pCompletedHashes))
1014
1038
  {
1015
1039
  pCompletedHashes[tmpInputHashes[i]] = true;
1016
- this.inputEvent(tmpInputHashes[i], pEvent);
1040
+ this.inputEvent(tmpInputHashes[i], pEvent, pTransactionGUID);
1017
1041
  }
1018
1042
  }
1043
+ if (pTransactionGUID !== tmpTransactionGUID)
1044
+ {
1045
+ // We created a transaction, so finalize it.
1046
+ this.finalizeTransaction(tmpTransactionGUID);
1047
+ }
1019
1048
  }
1020
1049
 
1021
1050
  /**
@@ -1038,11 +1067,150 @@ class PictViewDynamicForm extends libPictViewClass
1038
1067
  * @param {number} pInputIndex - The index of the input.
1039
1068
  * @param {number} pRowIndex - The index of the row.
1040
1069
  * @param {string} pEvent - The input event object.
1070
+ * @param {string} [pTransactionGUID] - The transaction GUID.
1041
1071
  * @returns {any} - The result of the input event handling.
1042
1072
  */
1043
- inputEventTabular(pGroupIndex, pInputIndex, pRowIndex, pEvent)
1073
+ inputEventTabular(pGroupIndex, pInputIndex, pRowIndex, pEvent, pTransactionGUID)
1074
+ {
1075
+ return this.pict.providers.DynamicInputEvents.inputEventTabular(this, pGroupIndex, pInputIndex, pRowIndex, pEvent, pTransactionGUID);
1076
+ }
1077
+
1078
+ /**
1079
+ * @param {string} pTransactionGUID - The transaction GUID.
1080
+ * @param {string} pAsyncOperationHash - The hash of the async operation.
1081
+ */
1082
+ registerEventTransactionAsyncOperation(pTransactionGUID, pAsyncOperationHash)
1083
+ {
1084
+ this.pict.TransactionTracking.pushToTransactionQueue(pTransactionGUID, pAsyncOperationHash, PENDING_ASYNC_OPERATION_TYPE);
1085
+ }
1086
+
1087
+ /**
1088
+ * @param {string} pTransactionGUID - The transaction GUID.
1089
+ * @param {string} pAsyncOperationHash - The hash of the async operation.
1090
+ *
1091
+ * @return {boolean} - Returns true if the async operation was found and marked as complete, otherwise false.
1092
+ */
1093
+ eventTransactionAsyncOperationComplete(pTransactionGUID, pAsyncOperationHash)
1094
+ {
1095
+ const tmpQueue = this.pict.TransactionTracking.checkTransactionQueue(pTransactionGUID);
1096
+ let tmpPendingAsyncOperationCount = 0;
1097
+ let tmpMarkedOperationCount = 0;
1098
+ let tmpFinalized = false;
1099
+ for (let i = 0; i < tmpQueue.length; i++)
1100
+ {
1101
+ const tmpQueueItem = tmpQueue[i];
1102
+ if (tmpQueueItem.Type === PENDING_ASYNC_OPERATION_TYPE)
1103
+ {
1104
+ if (tmpQueueItem.Data === pAsyncOperationHash)
1105
+ {
1106
+ tmpQueue.splice(i, 1);
1107
+ ++tmpMarkedOperationCount;
1108
+ --i;
1109
+ }
1110
+ else
1111
+ {
1112
+ ++tmpPendingAsyncOperationCount;
1113
+ }
1114
+ }
1115
+ if (tmpQueueItem.Type === READY_TO_FINALIZE_TYPE)
1116
+ {
1117
+ tmpFinalized = true;
1118
+ }
1119
+ }
1120
+ if (tmpPendingAsyncOperationCount === 0)
1121
+ {
1122
+ for (const tmpQueueItem of tmpQueue)
1123
+ {
1124
+ if (tmpQueueItem.Type === TRANSACTION_COMPLETE_CALLBACK_TYPE)
1125
+ {
1126
+ if (typeof tmpQueueItem.Data !== 'function')
1127
+ {
1128
+ this.log.error(`PICT View Metatemplate Helper eventTransactionAsyncOperationComplete transaction callback was not a function.`);
1129
+ continue;
1130
+ }
1131
+ try
1132
+ {
1133
+ tmpQueueItem.Data();
1134
+ }
1135
+ catch (pError)
1136
+ {
1137
+ this.log.error(`PICT View Metatemplate Helper eventTransactionAsyncOperationComplete transaction callback error: ${pError}`, { Stack: pError.stack });
1138
+ }
1139
+ }
1140
+ }
1141
+ }
1142
+ return tmpMarkedOperationCount > 0;
1143
+ }
1144
+
1145
+ /**
1146
+ * @param {string} pTransactionGUID - The transaction GUID.
1147
+ *
1148
+ * @return {boolean} - Returns true if the transaction was found and able to be finalized, otherwise false.
1149
+ */
1150
+ finalizeTransaction(pTransactionGUID)
1044
1151
  {
1045
- return this.pict.providers.DynamicInputEvents.inputEventTabular(this, pGroupIndex, pInputIndex, pRowIndex, pEvent);
1152
+ this.pict.TransactionTracking.pushToTransactionQueue(pTransactionGUID, null, READY_TO_FINALIZE_TYPE);
1153
+
1154
+ const tmpQueue = this.pict.TransactionTracking.checkTransactionQueue(pTransactionGUID);
1155
+ let tmpPendingAsyncOperationCount = 0;
1156
+ for (const tmpQueueItem of tmpQueue)
1157
+ {
1158
+ if (tmpQueueItem.Type === PENDING_ASYNC_OPERATION_TYPE)
1159
+ {
1160
+ ++tmpPendingAsyncOperationCount;
1161
+ }
1162
+ }
1163
+ if (tmpPendingAsyncOperationCount > 0)
1164
+ {
1165
+ this.pict.log.info(`PICT View Metatemplate Helper finalizeTransaction ${pTransactionGUID} is waiting on ${tmpPendingAsyncOperationCount} pending async operations.`);
1166
+ return false;
1167
+ }
1168
+ for (const tmpQueueItem of tmpQueue)
1169
+ {
1170
+ if (tmpQueueItem.Type === TRANSACTION_COMPLETE_CALLBACK_TYPE)
1171
+ {
1172
+ if (typeof tmpQueueItem.Data !== 'function')
1173
+ {
1174
+ this.log.error(`PICT View Metatemplate Helper eventTransactionAsyncOperationComplete transaction callback was not a function.`);
1175
+ continue;
1176
+ }
1177
+ try
1178
+ {
1179
+ tmpQueueItem.Data();
1180
+ }
1181
+ catch (pError)
1182
+ {
1183
+ this.log.error(`PICT View Metatemplate Helper eventTransactionAsyncOperationComplete transaction callback error: ${pError}`, { Stack: pError.stack });
1184
+ }
1185
+ }
1186
+ }
1187
+ return true;
1188
+ }
1189
+
1190
+ /**
1191
+ * @param {string} pTransactionGUID - The transaction GUID.
1192
+ * @param {Function} fCallback - The callback to call when the transaction is complete.
1193
+ */
1194
+ registerOnTransactionCompleteCallback(pTransactionGUID, fCallback)
1195
+ {
1196
+ const tmpQueue = this.pict.TransactionTracking.checkTransactionQueue(pTransactionGUID);
1197
+ let tmpFinalized = false;
1198
+ for (const tmpQueueItem of tmpQueue)
1199
+ {
1200
+ if (tmpQueueItem.Type === READY_TO_FINALIZE_TYPE)
1201
+ {
1202
+ tmpFinalized = true;
1203
+ break;
1204
+ }
1205
+ }
1206
+ if (tmpFinalized)
1207
+ {
1208
+ fCallback();
1209
+ }
1210
+ else
1211
+ {
1212
+ this.pict.TransactionTracking.pushToTransactionQueue(pTransactionGUID, fCallback, TRANSACTION_COMPLETE_CALLBACK_TYPE);
1213
+ }
1046
1214
  }
1047
1215
 
1048
1216
  /**
@@ -1050,9 +1218,11 @@ class PictViewDynamicForm extends libPictViewClass
1050
1218
  * @param {number} pGroupIndex - The index of the group.
1051
1219
  * @param {string} pEvent - The input event string.
1052
1220
  * @param {Object} pCompletedHashes - the hashes that have already signaled the event
1221
+ * @param {string} [pTransactionGUID] - The transaction GUID.
1053
1222
  */
1054
- groupInputEvent(pGroupIndex, pEvent, pCompletedHashes)
1223
+ groupInputEvent(pGroupIndex, pEvent, pCompletedHashes, pTransactionGUID)
1055
1224
  {
1225
+ const tmpTransactionGUID = (pTransactionGUID && typeof(pTransactionGUID) === 'string') ? pTransactionGUID : this.fable.getUUID();
1056
1226
  const tmpGroup = this.getGroup(pGroupIndex);
1057
1227
 
1058
1228
  if (!tmpGroup)
@@ -1077,7 +1247,7 @@ class PictViewDynamicForm extends libPictViewClass
1077
1247
  if (!(tmpInputSignature in pCompletedHashes))
1078
1248
  {
1079
1249
  pCompletedHashes[tmpInputSignature] = true;
1080
- this.inputEventTabular(pGroupIndex, tmpInput.PictForm.InputIndex, i, pEvent);
1250
+ this.inputEventTabular(pGroupIndex, tmpInput.PictForm.InputIndex, i, pEvent, tmpTransactionGUID);
1081
1251
  }
1082
1252
  }
1083
1253
  }
@@ -1090,24 +1260,30 @@ class PictViewDynamicForm extends libPictViewClass
1090
1260
  if (!(tmpInputSignature in pCompletedHashes))
1091
1261
  {
1092
1262
  pCompletedHashes[tmpInputSignature] = true;
1093
- this.inputEvent(tmpInput.Hash, pEvent);
1263
+ this.inputEvent(tmpInput.Hash, pEvent, tmpTransactionGUID);
1094
1264
  }
1095
1265
  }
1096
1266
  }
1267
+ if (pTransactionGUID !== tmpTransactionGUID)
1268
+ {
1269
+ // We created a transaction, so finalize it.
1270
+ this.finalizeTransaction(tmpTransactionGUID);
1271
+ }
1097
1272
  }
1098
1273
 
1099
1274
  /**
1100
1275
  *
1101
1276
  * @param {string} pEvent - The input event string.
1102
1277
  * @param {Object} pCompletedHashes - the hashes that have already signaled the event
1278
+ * @param {string} [pTransactionGUID] - The transaction GUID.
1103
1279
  */
1104
- sectionInputEvent(pEvent, pCompletedHashes)
1280
+ sectionInputEvent(pEvent, pCompletedHashes, pTransactionGUID)
1105
1281
  {
1106
1282
  const tmpGroupCount = this.sectionDefinition.Groups.length;
1107
1283
 
1108
1284
  for (let i = 0; i < tmpGroupCount; i++)
1109
1285
  {
1110
- this.groupInputEvent(i, pEvent, pCompletedHashes);
1286
+ this.groupInputEvent(i, pEvent, pCompletedHashes, pTransactionGUID);
1111
1287
  }
1112
1288
  }
1113
1289
 
@@ -912,12 +912,16 @@ class PictFormMetacontroller extends libPictViewClass
912
912
  /**
913
913
  * Trigger an event on all inputs on all views.
914
914
  * @param {string} pEvent - The event to trigger
915
+ * @param {string} [pTransactionGUID] - (optional) The transaction GUID to use for the event.
915
916
  */
916
- triggerGlobalInputEvent(pEvent)
917
+ triggerGlobalInputEvent(pEvent, pTransactionGUID)
917
918
  {
919
+ const tmpTransactionGUID = (pTransactionGUID && typeof(pTransactionGUID) === 'string') ? pTransactionGUID : this.fable.getUUID();
918
920
  let tmpEvent = (typeof(pEvent) === 'string') ? pEvent : this.fable.getUUID();
919
921
  let tmpViewHashes = Object.keys(this.pict.views);
920
922
  let tmpCompletedHashes = {};
923
+ /** @type {import('./Pict-View-DynamicForm.js')} */
924
+ let tmpFinalizeView = null;
921
925
  // Filter the views based on the filter function and type
922
926
  for (let i = 0; i < tmpViewHashes.length; i++)
923
927
  {
@@ -925,9 +929,15 @@ class PictFormMetacontroller extends libPictViewClass
925
929
  let tmpView = this.pict.views[tmpViewHashes[i]];
926
930
  if (tmpView.isPictSectionForm)
927
931
  {
928
- tmpView.sectionInputEvent(tmpEvent, tmpCompletedHashes);
932
+ tmpFinalizeView = tmpView;
933
+ tmpView.sectionInputEvent(tmpEvent, tmpCompletedHashes, tmpTransactionGUID);
929
934
  }
930
935
  }
936
+ if (pTransactionGUID !== tmpTransactionGUID && tmpFinalizeView)
937
+ {
938
+ // If we created the transaction GUID, we need to finalize it
939
+ tmpFinalizeView.finalizeTransaction(tmpTransactionGUID);
940
+ }
931
941
  }
932
942
 
933
943
  /**
@@ -38,7 +38,16 @@ declare class PictDynamicFormsSolverBehaviors extends libPictProvider {
38
38
  generateHTMLHexColor(pRed: any, pGreen: any, pBlue: any): string;
39
39
  colorSectionBackground(pSectionHash: any, pColor: any, pApplyChange: any): boolean;
40
40
  colorGroupBackground(pSectionHash: any, pGroupHash: any, pColor: any, pApplyChange: any): boolean;
41
- colorInputBackground(pSectionHash: any, pInputHash: any, pColor: any, pApplyChange: any): boolean;
41
+ /**
42
+ * Colors an input background or its container with a HTML hex color (e.g. #FF0000 for red).
43
+ * @param {string} pSectionHash - The hash of the section containing the input.
44
+ * @param {string} pInputHash - The hash of the input to color.
45
+ * @param {string} pColor - The HTML hex color to apply (e.g. #FF0000 for red).
46
+ * @param {string} pApplyChange - If "0", the change will not be applied.
47
+ * @param {string} [pClassTarget] - Optional. If provided, the color will be applied to the closest element with this class instead of the input itself.
48
+ * @returns {boolean} - Returns true if the color was applied successfully or if the change was skipped for pApplyChange equal to "0", false otherwise.
49
+ */
50
+ colorInputBackground(pSectionHash: string, pInputHash: string, pColor: string, pApplyChange: string, pClassTarget?: string): boolean;
42
51
  logValues(...args: any[]): any;
43
52
  }
44
53
  declare namespace PictDynamicFormsSolverBehaviors {
@@ -1 +1 @@
1
- {"version":3,"file":"Pict-Provider-DynamicFormSolverBehaviors.d.ts","sourceRoot":"","sources":["../../../source/providers/Pict-Provider-DynamicFormSolverBehaviors.js"],"names":[],"mappings":";AAaA;;;;;GAKG;AACH;IAEC;;;;;OAKG;IACH,oBAJW,MAAM,YACN,MAAM,gBACN,MAAM,EAqBhB;IAbA,kBAAkB;IAClB,SADW,GAAG,CACF;IACZ,qFAAqF;IACrF,MADW,OAAO,MAAM,CAAC,GAAG;QAAE,WAAW,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,UAAU,CAAC,CAAA;KAAE,CACxE;IAIT,qBAAqB;IACrB,qBADW,MAAM,CAC4C;IAC7D,0BAAyD;IACzD,mBAA2H;IAK5H,2DAMC;IAJA,kBAAsD;IAMvD,kHAaC;IAED,iDAeC;IAED,gDAGC;IAED,gEAUC;IAGD,wCAiBC;IAED,wCAiBC;IAED,+DAGC;IAED,+EAUC;IAED,uDAiBC;IAED,uDAiBC;IAED,iEAqBC;IAED,mFA2BC;IAED,kGA0BC;IAED,kGAmCC;IAED,+BAWC;CACD;;;;;AArUD,kCAAkC;AAClC,6CADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAQ3B"}
1
+ {"version":3,"file":"Pict-Provider-DynamicFormSolverBehaviors.d.ts","sourceRoot":"","sources":["../../../source/providers/Pict-Provider-DynamicFormSolverBehaviors.js"],"names":[],"mappings":";AAaA;;;;;GAKG;AACH;IAEC;;;;;OAKG;IACH,oBAJW,MAAM,YACN,MAAM,gBACN,MAAM,EAqBhB;IAbA,kBAAkB;IAClB,SADW,GAAG,CACF;IACZ,qFAAqF;IACrF,MADW,OAAO,MAAM,CAAC,GAAG;QAAE,WAAW,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,UAAU,CAAC,CAAA;KAAE,CACxE;IAIT,qBAAqB;IACrB,qBADW,MAAM,CAC4C;IAC7D,0BAAyD;IACzD,mBAA2H;IAK5H,2DAMC;IAJA,kBAAsD;IAMvD,kHAaC;IAED,iDAeC;IAED,gDAGC;IAED,gEAUC;IAGD,wCAiBC;IAED,wCAiBC;IAED,+DAGC;IAED,+EAUC;IAED,uDAiBC;IAED,uDAiBC;IAED,iEAqBC;IAED,mFA2BC;IAED,kGA0BC;IAED;;;;;;;;OAQG;IACH,mCAPW,MAAM,cACN,MAAM,UACN,MAAM,gBACN,MAAM,iBACN,MAAM,GACJ,OAAO,CAuDnB;IAED,+BAWC;CACD;;;;;AAhWD,kCAAkC;AAClC,6CADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAQ3B"}
@@ -24,8 +24,9 @@ declare class PictDynamicInputEvents extends libPictProvider {
24
24
  * @param {Object} pView - The view object.
25
25
  * @param {string} pInputHash - The input hash.
26
26
  * @param {string} pEvent - The input event.
27
+ * @param {string} [pTransactionGUID] - (optional) The active transaction GUID.
27
28
  */
28
- inputEvent(pView: any, pInputHash: string, pEvent: string): void;
29
+ inputEvent(pView: any, pInputHash: string, pEvent: string, pTransactionGUID?: string): void;
29
30
  /**
30
31
  * Requests input data for a tabular record.
31
32
  *
@@ -43,8 +44,9 @@ declare class PictDynamicInputEvents extends libPictProvider {
43
44
  * @param {number} pInputIndex - The index of the input.
44
45
  * @param {number} pRowIndex - The index of the row.
45
46
  * @param {string} pEvent - The input event.
47
+ * @param {string} [pTransactionGUID] - (optional) The active transaction GUID.
46
48
  */
47
- inputEventTabular(pView: any, pGroupIndex: number, pInputIndex: number, pRowIndex: number, pEvent: string): void;
49
+ inputEventTabular(pView: any, pGroupIndex: number, pInputIndex: number, pRowIndex: number, pEvent: string, pTransactionGUID?: string): void;
48
50
  }
49
51
  declare namespace PictDynamicInputEvents {
50
52
  export { _DefaultProviderConfiguration as default_configuration };
@@ -1 +1 @@
1
- {"version":3,"file":"Pict-Provider-DynamicInputEvents.d.ts","sourceRoot":"","sources":["../../../source/providers/Pict-Provider-DynamicInputEvents.js"],"names":[],"mappings":";AAaA;;GAEG;AACH;IAEC;;;;;;OAMG;IACH,oBAJW,MAAM,YACN,MAAM,gBACN,MAAM,EAMhB;IAED;;;;;OAKG;IACH,yCAFW,MAAM,QAkChB;IAED;;;;;;OAMG;IACH,mCAHW,MAAM,UACN,MAAM,QAsChB;IAED;;;;;;;OAOG;IACH,+BALW,OAAO,gCAAgC,CAAC,eACxC,MAAM,eACN,MAAM,aACN,MAAM,QAyChB;IAED;;;;;;;;OAQG;IACH,2CALW,MAAM,eACN,MAAM,aACN,MAAM,UACN,MAAM,QAkChB;CACD;;;;;AA7MD,kCAAkC;AAClC,6CADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAS3B"}
1
+ {"version":3,"file":"Pict-Provider-DynamicInputEvents.d.ts","sourceRoot":"","sources":["../../../source/providers/Pict-Provider-DynamicInputEvents.js"],"names":[],"mappings":";AAaA;;GAEG;AACH;IAEC;;;;;;OAMG;IACH,oBAJW,MAAM,YACN,MAAM,gBACN,MAAM,EAMhB;IAED;;;;;OAKG;IACH,yCAFW,MAAM,QAkChB;IAED;;;;;;;OAOG;IACH,mCAJW,MAAM,UACN,MAAM,qBACN,MAAM,QAgDhB;IAED;;;;;;;OAOG;IACH,+BALW,OAAO,gCAAgC,CAAC,eACxC,MAAM,eACN,MAAM,aACN,MAAM,QAyChB;IAED;;;;;;;;;OASG;IACH,2CANW,MAAM,eACN,MAAM,aACN,MAAM,UACN,MAAM,qBACN,MAAM,QA4ChB;CACD;;;;;AAnOD,kCAAkC;AAClC,6CADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAS3B"}
@@ -13,9 +13,10 @@ declare class PictDynamicSolver extends libPictProvider {
13
13
  constructor(pFable: object, pOptions: object, pServiceHash: object);
14
14
  /** @type {import('pict')} */
15
15
  pict: import("pict");
16
- /** @type {import('pict') & { instantiateServiceProviderIfNotExists: (hash: string) => any }} */
16
+ /** @type {import('pict') & { instantiateServiceProviderIfNotExists: (hash: string) => any, ExpressionParser: any }} */
17
17
  fable: import("pict") & {
18
18
  instantiateServiceProviderIfNotExists: (hash: string) => any;
19
+ ExpressionParser: any;
19
20
  };
20
21
  /**
21
22
  * Checks the solver and returns the solver object if it passes the checks.
@@ -1 +1 @@
1
- {"version":3,"file":"Pict-Provider-DynamicSolver.d.ts","sourceRoot":"","sources":["../../../source/providers/Pict-Provider-DynamicSolver.js"],"names":[],"mappings":";AA8BA;;GAEG;AACH;IAEC;;;;;;OAMG;IACH,oBAJW,MAAM,YACN,MAAM,gBACN,MAAM,EAqChB;IA9BA,6BAA6B;IAC7B,MADW,OAAO,MAAM,CAAC,CAChB;IACT,gGAAgG;IAChG,OADW,OAAO,MAAM,CAAC,GAAG;QAAE,qCAAqC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,GAAG,CAAA;KAAE,CAClF;IA6BX;;;;;;;;;OASG;IACH,qBALW,MAAM,GAAC,MAAM,cACb,OAAO,aACP,MAAM,GACJ,MAAM,GAAC,SAAS,CA8B5B;IAED;;;;;;;OAOG;IACH,wDAFW,MAAM,QAyDhB;IAED;;;;;OAKG;IACH,gEAFW,MAAM,QA+BhB;IAED;;;;;OAKG;IACH,sDAFW,MAAM,QAwBhB;IAED;;;;;;;;OAQG;IACH,gCAJW,MAAM,yBAWhB;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,yBAFW,QAAM,MAAM,EAAE,QAiFxB;IADA;;;;;MAAuC;CAExC;;;;;AAhWD,kCAAkC;AAClC,6CADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAS3B"}
1
+ {"version":3,"file":"Pict-Provider-DynamicSolver.d.ts","sourceRoot":"","sources":["../../../source/providers/Pict-Provider-DynamicSolver.js"],"names":[],"mappings":";AA8BA;;GAEG;AACH;IAEC;;;;;;OAMG;IACH,oBAJW,MAAM,YACN,MAAM,gBACN,MAAM,EAqChB;IA9BA,6BAA6B;IAC7B,MADW,OAAO,MAAM,CAAC,CAChB;IACT,uHAAuH;IACvH,OADW,OAAO,MAAM,CAAC,GAAG;QAAE,qCAAqC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,GAAG,CAAC;QAAC,gBAAgB,EAAE,GAAG,CAAA;KAAE,CACzG;IA6BX;;;;;;;;;OASG;IACH,qBALW,MAAM,GAAC,MAAM,cACb,OAAO,aACP,MAAM,GACJ,MAAM,GAAC,SAAS,CA8B5B;IAED;;;;;;;OAOG;IACH,wDAFW,MAAM,QAyDhB;IAED;;;;;OAKG;IACH,gEAFW,MAAM,QA+BhB;IAED;;;;;OAKG;IACH,sDAFW,MAAM,QAwBhB;IAED;;;;;;;;OAQG;IACH,gCAJW,MAAM,yBAWhB;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,yBAFW,QAAM,MAAM,EAAE,QAiFxB;IADA;;;;;MAAuC;CAExC;;;;;AAhWD,kCAAkC;AAClC,6CADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAS3B"}