@aehrc/smart-forms-renderer 1.2.12 → 1.2.14

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 (61) hide show
  1. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.js +1 -1
  2. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.js.map +1 -1
  3. package/lib/components/FormComponents/GridGroup/GridGroup.js +1 -1
  4. package/lib/components/FormComponents/GroupItem/GroupItem.styles.js +1 -1
  5. package/lib/components/FormComponents/GroupItem/GroupItem.styles.js.map +1 -1
  6. package/lib/components/FormComponents/GroupItem/GroupItemView.js +2 -2
  7. package/lib/components/FormComponents/GroupItem/GroupItemView.js.map +1 -1
  8. package/lib/components/FormComponents/GroupItem/TabButtonsWrapper.js +1 -1
  9. package/lib/components/FormComponents/GroupItem/TabButtonsWrapper.js.map +1 -1
  10. package/lib/components/FormComponents/ItemParts/CheckboxSingle.js +2 -1
  11. package/lib/components/FormComponents/ItemParts/CheckboxSingle.js.map +1 -1
  12. package/lib/components/FormComponents/RepeatGroup/AddItemButton.js +1 -1
  13. package/lib/components/FormComponents/RepeatGroup/AddItemButton.js.map +1 -1
  14. package/lib/components/FormComponents/RepeatGroup/RepeatGroupView.js +1 -1
  15. package/lib/components/FormComponents/RepeatItem/AddItemButton.js +1 -1
  16. package/lib/components/FormComponents/RepeatItem/AddItemButton.js.map +1 -1
  17. package/lib/components/FormComponents/RepeatItem/RepeatItem.styles.js +2 -4
  18. package/lib/components/FormComponents/RepeatItem/RepeatItem.styles.js.map +1 -1
  19. package/lib/components/FormComponents/Tables/GroupTableView.js +1 -1
  20. package/lib/components/Renderer/FormBodySingleCollapsible.js +1 -1
  21. package/lib/components/Renderer/FormBodySingleCollapsible.js.map +1 -1
  22. package/lib/components/Tabs/FormBodyTabList.js +1 -1
  23. package/lib/components/Tabs/FormBodyTabList.js.map +1 -1
  24. package/lib/hooks/useCalculatedExpressionAnimating.d.ts +1 -0
  25. package/lib/hooks/useCalculatedExpressionAnimating.js +18 -0
  26. package/lib/hooks/useCalculatedExpressionAnimating.js.map +1 -0
  27. package/lib/hooks/useShowFeedback.d.ts +11 -0
  28. package/lib/hooks/useShowFeedback.js +33 -0
  29. package/lib/hooks/useShowFeedback.js.map +1 -0
  30. package/lib/interfaces/itemPath.interface.d.ts +31 -0
  31. package/lib/interfaces/itemPath.interface.js +2 -0
  32. package/lib/interfaces/itemPath.interface.js.map +1 -0
  33. package/lib/stores/rendererStylingStore.d.ts +144 -0
  34. package/lib/stores/rendererStylingStore.js +68 -0
  35. package/lib/stores/rendererStylingStore.js.map +1 -0
  36. package/lib/stories/storybookWrappers/InitialiseFormWrapperForStorybook.d.ts +2 -3
  37. package/lib/stories/storybookWrappers/InitialiseFormWrapperForStorybook.js +4 -25
  38. package/lib/stories/storybookWrappers/InitialiseFormWrapperForStorybook.js.map +1 -1
  39. package/lib/stories/storybookWrappers/index.js +1 -1
  40. package/lib/utils/calculatedExpression.js +10 -6
  41. package/lib/utils/calculatedExpression.js.map +1 -1
  42. package/lib/utils/itemPath.d.ts +57 -0
  43. package/lib/utils/itemPath.js +75 -0
  44. package/lib/utils/itemPath.js.map +1 -0
  45. package/lib/utils/questionnaireStoreUtils/addAdditionalVariables.js +1 -1
  46. package/lib/utils/questionnaireStoreUtils/addAdditionalVariables.js.map +1 -1
  47. package/package.json +1 -1
  48. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.tsx +1 -0
  49. package/src/components/FormComponents/GridGroup/GridGroup.tsx +1 -1
  50. package/src/components/FormComponents/GroupItem/GroupItem.styles.ts +1 -1
  51. package/src/components/FormComponents/GroupItem/GroupItemView.tsx +4 -0
  52. package/src/components/FormComponents/GroupItem/TabButtonsWrapper.tsx +1 -1
  53. package/src/components/FormComponents/ItemParts/CheckboxSingle.tsx +3 -0
  54. package/src/components/FormComponents/RepeatGroup/AddItemButton.tsx +1 -1
  55. package/src/components/FormComponents/RepeatGroup/RepeatGroupView.tsx +1 -1
  56. package/src/components/FormComponents/RepeatItem/AddItemButton.tsx +1 -1
  57. package/src/components/FormComponents/RepeatItem/RepeatItem.styles.tsx +2 -4
  58. package/src/components/FormComponents/Tables/GroupTableView.tsx +1 -1
  59. package/src/components/Renderer/FormBodySingleCollapsible.tsx +2 -0
  60. package/src/components/Tabs/FormBodyTabList.tsx +5 -1
  61. package/src/utils/calculatedExpression.ts +10 -11
@@ -373,10 +373,6 @@ function applyCalculatedExpressionValuesRecursive(
373
373
  let qrItem = qrItemOrItems;
374
374
  const childQItems = qItem.item;
375
375
  if (childQItems && childQItems.length > 0) {
376
- // If item.type is 'group', create empty group qrItem
377
- if (qItem.type === 'group') {
378
- qrItem = qrItemOrItems ?? structuredClone(createEmptyQrGroup(qItem));
379
- }
380
376
  const childQrItems = qrItem?.item ?? [];
381
377
 
382
378
  const indexMap = mapQItemsIndex(qItem);
@@ -395,13 +391,17 @@ function applyCalculatedExpressionValuesRecursive(
395
391
  // Update QR items in repeating group
396
392
  if (Array.isArray(updatedChildQRItemOrItems)) {
397
393
  if (updatedChildQRItemOrItems.length > 0) {
394
+ // Lazily initialise qrItem so all children are added to the same group object
395
+ if (!qrItem) {
396
+ qrItem = structuredClone(createEmptyQrGroup(qItem));
397
+ }
398
398
  updateQrItemsInGroup(
399
399
  null,
400
400
  {
401
401
  linkId: childQItem.linkId,
402
402
  qrItems: updatedChildQRItemOrItems
403
403
  },
404
- qrItem ?? structuredClone(createEmptyQrGroup(qItem)),
404
+ qrItem,
405
405
  indexMap
406
406
  );
407
407
  }
@@ -411,12 +411,11 @@ function applyCalculatedExpressionValuesRecursive(
411
411
  // Update QR items in non-repeating group
412
412
  const updatedChildQRItem = updatedChildQRItemOrItems;
413
413
  if (updatedChildQRItem) {
414
- updateQrItemsInGroup(
415
- updatedChildQRItem,
416
- null,
417
- qrItem ?? structuredClone(createEmptyQrGroup(qItem)),
418
- indexMap
419
- );
414
+ // Lazily initialise qrItem so all children are added to the same group object
415
+ if (!qrItem) {
416
+ qrItem = structuredClone(createEmptyQrGroup(qItem));
417
+ }
418
+ updateQrItemsInGroup(updatedChildQRItem, null, qrItem, indexMap);
420
419
  }
421
420
  }
422
421