ngx-t-forms 3.1.3 → 3.1.5

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 (108) hide show
  1. package/fesm2022/{ngx-t-forms-api-endpoint-config.component-BAWiavFB.mjs → ngx-t-forms-api-endpoint-config.component-DLg5vzNJ.mjs} +6 -6
  2. package/fesm2022/{ngx-t-forms-api-endpoint-config.component-BAWiavFB.mjs.map → ngx-t-forms-api-endpoint-config.component-DLg5vzNJ.mjs.map} +1 -1
  3. package/fesm2022/{ngx-t-forms-auto-complete-input-element.component-Cph2QuN3.mjs → ngx-t-forms-auto-complete-input-element.component-CQ9gB964.mjs} +28 -11
  4. package/fesm2022/ngx-t-forms-auto-complete-input-element.component-CQ9gB964.mjs.map +1 -0
  5. package/fesm2022/{ngx-t-forms-basic-input-input-element.component-o6l7xW3J.mjs → ngx-t-forms-basic-input-input-element.component-B-J4qO_Z.mjs} +3 -3
  6. package/fesm2022/{ngx-t-forms-basic-input-input-element.component-o6l7xW3J.mjs.map → ngx-t-forms-basic-input-input-element.component-B-J4qO_Z.mjs.map} +1 -1
  7. package/fesm2022/{ngx-t-forms-calculated-field-rules.component-CZ5c7fRi.mjs → ngx-t-forms-calculated-field-rules.component-KHUBx8wM.mjs} +2 -42
  8. package/fesm2022/ngx-t-forms-calculated-field-rules.component-KHUBx8wM.mjs.map +1 -0
  9. package/fesm2022/{ngx-t-forms-chip-options-creator-editor.component-aNd2SXIA.mjs → ngx-t-forms-chip-options-creator-editor.component-DAZVCoUZ.mjs} +2 -2
  10. package/fesm2022/{ngx-t-forms-chip-options-creator-editor.component-aNd2SXIA.mjs.map → ngx-t-forms-chip-options-creator-editor.component-DAZVCoUZ.mjs.map} +1 -1
  11. package/fesm2022/{ngx-t-forms-conditional-display-config.component-yJ5IORsS.mjs → ngx-t-forms-conditional-display-config.component-p3dEGx1z.mjs} +2 -2
  12. package/fesm2022/{ngx-t-forms-conditional-display-config.component-yJ5IORsS.mjs.map → ngx-t-forms-conditional-display-config.component-p3dEGx1z.mjs.map} +1 -1
  13. package/fesm2022/{ngx-t-forms-config-mscoa-additional-inputs.component-B2U7LSRf.mjs → ngx-t-forms-config-mscoa-additional-inputs.component-CAk0k2YC.mjs} +2 -2
  14. package/fesm2022/{ngx-t-forms-config-mscoa-additional-inputs.component-B2U7LSRf.mjs.map → ngx-t-forms-config-mscoa-additional-inputs.component-CAk0k2YC.mjs.map} +1 -1
  15. package/fesm2022/{ngx-t-forms-data-source-picker.component-Bd1wm12Q.mjs → ngx-t-forms-data-source-picker.component-CUVjocuE.mjs} +6 -6
  16. package/fesm2022/{ngx-t-forms-data-source-picker.component-Bd1wm12Q.mjs.map → ngx-t-forms-data-source-picker.component-CUVjocuE.mjs.map} +1 -1
  17. package/fesm2022/{ngx-t-forms-date-picker-input-element.component-BduBmu9K.mjs → ngx-t-forms-date-picker-input-element.component-lQfvlGfA.mjs} +2 -2
  18. package/fesm2022/{ngx-t-forms-date-picker-input-element.component-BduBmu9K.mjs.map → ngx-t-forms-date-picker-input-element.component-lQfvlGfA.mjs.map} +1 -1
  19. package/fesm2022/{ngx-t-forms-date-range-picker-input-element.component-CATduVDL.mjs → ngx-t-forms-date-range-picker-input-element.component-7t9Ib-35.mjs} +2 -2
  20. package/fesm2022/{ngx-t-forms-date-range-picker-input-element.component-CATduVDL.mjs.map → ngx-t-forms-date-range-picker-input-element.component-7t9Ib-35.mjs.map} +1 -1
  21. package/fesm2022/ngx-t-forms-date-time-picker-input-element.component-Co0nzt6l.mjs +232 -0
  22. package/fesm2022/ngx-t-forms-date-time-picker-input-element.component-Co0nzt6l.mjs.map +1 -0
  23. package/fesm2022/{ngx-t-forms-document-list-label-config-editor.component-BU0QJYNH.mjs → ngx-t-forms-document-list-label-config-editor.component-xQuX0E3x.mjs} +3 -3
  24. package/fesm2022/{ngx-t-forms-document-list-label-config-editor.component-BU0QJYNH.mjs.map → ngx-t-forms-document-list-label-config-editor.component-xQuX0E3x.mjs.map} +1 -1
  25. package/fesm2022/{ngx-t-forms-document-picker.component-3mqXc4s6.mjs → ngx-t-forms-document-picker.component-umv9Z3rU.mjs} +2 -2
  26. package/fesm2022/{ngx-t-forms-document-picker.component-3mqXc4s6.mjs.map → ngx-t-forms-document-picker.component-umv9Z3rU.mjs.map} +1 -1
  27. package/fesm2022/{ngx-t-forms-editor-input-element.component-D_SjJtw9.mjs → ngx-t-forms-editor-input-element.component-BHq-LOhI.mjs} +3 -3
  28. package/fesm2022/{ngx-t-forms-editor-input-element.component-D_SjJtw9.mjs.map → ngx-t-forms-editor-input-element.component-BHq-LOhI.mjs.map} +1 -1
  29. package/fesm2022/{ngx-t-forms-file-upload-input-element.component-DZuAYjpr.mjs → ngx-t-forms-file-upload-input-element.component-DjVntIfw.mjs} +2 -2
  30. package/fesm2022/{ngx-t-forms-file-upload-input-element.component-DZuAYjpr.mjs.map → ngx-t-forms-file-upload-input-element.component-DjVntIfw.mjs.map} +1 -1
  31. package/fesm2022/{ngx-t-forms-form-input-selector.component-B6FoYGy5.mjs → ngx-t-forms-form-input-selector.component-DX85MMcQ.mjs} +2 -2
  32. package/fesm2022/{ngx-t-forms-form-input-selector.component-B6FoYGy5.mjs.map → ngx-t-forms-form-input-selector.component-DX85MMcQ.mjs.map} +1 -1
  33. package/fesm2022/{ngx-t-forms-form-json-view.component-DsEizrc-.mjs → ngx-t-forms-form-json-view.component-f6QyPY6E.mjs} +2 -2
  34. package/fesm2022/{ngx-t-forms-form-json-view.component-DsEizrc-.mjs.map → ngx-t-forms-form-json-view.component-f6QyPY6E.mjs.map} +1 -1
  35. package/fesm2022/{ngx-t-forms-form-section-stepper.component-ZJDWyxa7.mjs → ngx-t-forms-form-section-stepper.component-ChaSUCrg.mjs} +4 -4
  36. package/fesm2022/{ngx-t-forms-form-section-stepper.component-ZJDWyxa7.mjs.map → ngx-t-forms-form-section-stepper.component-ChaSUCrg.mjs.map} +1 -1
  37. package/fesm2022/{ngx-t-forms-forms-builder-menu.component-oVpP2Jgt.mjs → ngx-t-forms-forms-builder-menu.component-Qkw23Bzy.mjs} +4 -4
  38. package/fesm2022/{ngx-t-forms-forms-builder-menu.component-oVpP2Jgt.mjs.map → ngx-t-forms-forms-builder-menu.component-Qkw23Bzy.mjs.map} +1 -1
  39. package/fesm2022/{ngx-t-forms-geo-location.component-Cml0Do4m.mjs → ngx-t-forms-geo-location.component-DqYEmeLs.mjs} +2 -2
  40. package/fesm2022/{ngx-t-forms-geo-location.component-Cml0Do4m.mjs.map → ngx-t-forms-geo-location.component-DqYEmeLs.mjs.map} +1 -1
  41. package/fesm2022/{ngx-t-forms-header-template-editor.component-NRiXTnwH.mjs → ngx-t-forms-header-template-editor.component-CIft152I.mjs} +2 -2
  42. package/fesm2022/{ngx-t-forms-header-template-editor.component-NRiXTnwH.mjs.map → ngx-t-forms-header-template-editor.component-CIft152I.mjs.map} +1 -1
  43. package/fesm2022/{ngx-t-forms-image-capture-input-element.component-IFval472.mjs → ngx-t-forms-image-capture-input-element.component-BmVXoC_z.mjs} +2 -2
  44. package/fesm2022/{ngx-t-forms-image-capture-input-element.component-IFval472.mjs.map → ngx-t-forms-image-capture-input-element.component-BmVXoC_z.mjs.map} +1 -1
  45. package/fesm2022/ngx-t-forms-index-yasuBvXP.mjs +2 -0
  46. package/fesm2022/ngx-t-forms-index-yasuBvXP.mjs.map +1 -0
  47. package/fesm2022/ngx-t-forms-input-custom.component-CTye_tsv.mjs +309 -0
  48. package/fesm2022/ngx-t-forms-input-custom.component-CTye_tsv.mjs.map +1 -0
  49. package/fesm2022/{ngx-t-forms-input-editor.component-zL4cp2gq.mjs → ngx-t-forms-input-editor.component-DbhnFkYQ.mjs} +3 -3
  50. package/fesm2022/{ngx-t-forms-input-editor.component-zL4cp2gq.mjs.map → ngx-t-forms-input-editor.component-DbhnFkYQ.mjs.map} +1 -1
  51. package/fesm2022/{ngx-t-forms-map-mat-options-keys-0tNskyLE.mjs → ngx-t-forms-map-mat-options-keys-B49fcbzx.mjs} +2 -2
  52. package/fesm2022/{ngx-t-forms-map-mat-options-keys-0tNskyLE.mjs.map → ngx-t-forms-map-mat-options-keys-B49fcbzx.mjs.map} +1 -1
  53. package/fesm2022/{ngx-t-forms-mat-chip-list-editor.component-CGMhUIuc.mjs → ngx-t-forms-mat-chip-list-editor.component-C0iLh1ON.mjs} +2 -2
  54. package/fesm2022/{ngx-t-forms-mat-chip-list-editor.component-CGMhUIuc.mjs.map → ngx-t-forms-mat-chip-list-editor.component-C0iLh1ON.mjs.map} +1 -1
  55. package/fesm2022/{ngx-t-forms-missing-form-configs.component-BXiXHKG_.mjs → ngx-t-forms-missing-form-configs.component-BsX7Ezy-.mjs} +2 -2
  56. package/fesm2022/{ngx-t-forms-missing-form-configs.component-BXiXHKG_.mjs.map → ngx-t-forms-missing-form-configs.component-BsX7Ezy-.mjs.map} +1 -1
  57. package/fesm2022/{ngx-t-forms-mscoa-chart-toolbar.component-BVtVrTn1.mjs → ngx-t-forms-mscoa-chart-toolbar.component-D8GL9Aht.mjs} +2 -2
  58. package/fesm2022/{ngx-t-forms-mscoa-chart-toolbar.component-BVtVrTn1.mjs.map → ngx-t-forms-mscoa-chart-toolbar.component-D8GL9Aht.mjs.map} +1 -1
  59. package/fesm2022/{ngx-t-forms-mscoa-config.component-CmIR92zj.mjs → ngx-t-forms-mscoa-config.component-Sz8VZ-vc.mjs} +61 -12
  60. package/fesm2022/ngx-t-forms-mscoa-config.component-Sz8VZ-vc.mjs.map +1 -0
  61. package/fesm2022/{ngx-t-forms-mscoa-segment-config.component-CVTRW43v.mjs → ngx-t-forms-mscoa-segment-config.component-COepe5G2.mjs} +2 -2
  62. package/fesm2022/{ngx-t-forms-mscoa-segment-config.component-CVTRW43v.mjs.map → ngx-t-forms-mscoa-segment-config.component-COepe5G2.mjs.map} +1 -1
  63. package/fesm2022/{ngx-t-forms-multiple-input-input-element.component-CUgTJJRW.mjs → ngx-t-forms-multiple-input-input-element.component-DlgTjJpj.mjs} +4 -4
  64. package/fesm2022/{ngx-t-forms-multiple-input-input-element.component-CUgTJJRW.mjs.map → ngx-t-forms-multiple-input-input-element.component-DlgTjJpj.mjs.map} +1 -1
  65. package/fesm2022/{ngx-t-forms-ngx-t-forms-BA1CoCl_.mjs → ngx-t-forms-ngx-t-forms-B3WhBGlD.mjs} +10021 -99
  66. package/fesm2022/ngx-t-forms-ngx-t-forms-B3WhBGlD.mjs.map +1 -0
  67. package/fesm2022/{ngx-t-forms-paginated-selection-table-CdEJa3FZ.mjs → ngx-t-forms-paginated-selection-table-CILBCL4K.mjs} +2 -2
  68. package/fesm2022/{ngx-t-forms-paginated-selection-table-CdEJa3FZ.mjs.map → ngx-t-forms-paginated-selection-table-CILBCL4K.mjs.map} +1 -1
  69. package/fesm2022/{ngx-t-forms-payload-template-editor.component-CZoqYRKK.mjs → ngx-t-forms-payload-template-editor.component-C8OasgK7.mjs} +2 -2
  70. package/fesm2022/{ngx-t-forms-payload-template-editor.component-CZoqYRKK.mjs.map → ngx-t-forms-payload-template-editor.component-C8OasgK7.mjs.map} +1 -1
  71. package/fesm2022/{ngx-t-forms-pipeline-generator.component-LbAmKWNG.mjs → ngx-t-forms-pipeline-generator.component-_yowsgF6.mjs} +2 -2
  72. package/fesm2022/{ngx-t-forms-pipeline-generator.component-LbAmKWNG.mjs.map → ngx-t-forms-pipeline-generator.component-_yowsgF6.mjs.map} +1 -1
  73. package/fesm2022/{ngx-t-forms-quill-input.component-CKYNVDDV.mjs → ngx-t-forms-quill-input.component-BWq5cLY-.mjs} +2 -2
  74. package/fesm2022/{ngx-t-forms-quill-input.component-CKYNVDDV.mjs.map → ngx-t-forms-quill-input.component-BWq5cLY-.mjs.map} +1 -1
  75. package/fesm2022/{ngx-t-forms-record-list-manager.component-BNdEvWsZ.mjs → ngx-t-forms-record-list-manager.component-C-lAzlO-.mjs} +2 -2
  76. package/fesm2022/{ngx-t-forms-record-list-manager.component-BNdEvWsZ.mjs.map → ngx-t-forms-record-list-manager.component-C-lAzlO-.mjs.map} +1 -1
  77. package/fesm2022/{ngx-t-forms-required-inputs.component-D_cQIScV.mjs → ngx-t-forms-required-inputs.component-8cQr2QWm.mjs} +2 -2
  78. package/fesm2022/{ngx-t-forms-required-inputs.component-D_cQIScV.mjs.map → ngx-t-forms-required-inputs.component-8cQr2QWm.mjs.map} +1 -1
  79. package/fesm2022/{ngx-t-forms-rest-api-call-setup.component-BhQmOVHN.mjs → ngx-t-forms-rest-api-call-setup.component-Bhj9jcQk.mjs} +197 -175
  80. package/fesm2022/ngx-t-forms-rest-api-call-setup.component-Bhj9jcQk.mjs.map +1 -0
  81. package/fesm2022/{ngx-t-forms-section-report.component-m2Z6qA3j.mjs → ngx-t-forms-section-report.component-CWCqrc7k.mjs} +2 -2
  82. package/fesm2022/{ngx-t-forms-section-report.component-m2Z6qA3j.mjs.map → ngx-t-forms-section-report.component-CWCqrc7k.mjs.map} +1 -1
  83. package/fesm2022/{ngx-t-forms-select-input-element.component-DH5knOzd.mjs → ngx-t-forms-select-input-element.component-BGD67Dnh.mjs} +2 -2
  84. package/fesm2022/{ngx-t-forms-select-input-element.component-DH5knOzd.mjs.map → ngx-t-forms-select-input-element.component-BGD67Dnh.mjs.map} +1 -1
  85. package/fesm2022/{ngx-t-forms-selection-options-editor.component-UBt2kiPk.mjs → ngx-t-forms-selection-options-editor.component-ClXaOeXt.mjs} +2 -2
  86. package/fesm2022/{ngx-t-forms-selection-options-editor.component-UBt2kiPk.mjs.map → ngx-t-forms-selection-options-editor.component-ClXaOeXt.mjs.map} +1 -1
  87. package/fesm2022/{ngx-t-forms-textarea-input-element.component-B9JLzhTh.mjs → ngx-t-forms-textarea-input-element.component-Z-wkFzgQ.mjs} +2 -2
  88. package/fesm2022/{ngx-t-forms-textarea-input-element.component-B9JLzhTh.mjs.map → ngx-t-forms-textarea-input-element.component-Z-wkFzgQ.mjs.map} +1 -1
  89. package/fesm2022/{ngx-t-forms-toggle-input-element.component-B9_03RoG.mjs → ngx-t-forms-toggle-input-element.component-CvR3-IjP.mjs} +2 -2
  90. package/fesm2022/{ngx-t-forms-toggle-input-element.component-B9_03RoG.mjs.map → ngx-t-forms-toggle-input-element.component-CvR3-IjP.mjs.map} +1 -1
  91. package/fesm2022/{ngx-t-forms-token-text-input.component-BQADsnFn.mjs → ngx-t-forms-token-text-input.component-vnOkP_CV.mjs} +2 -2
  92. package/fesm2022/{ngx-t-forms-token-text-input.component-BQADsnFn.mjs.map → ngx-t-forms-token-text-input.component-vnOkP_CV.mjs.map} +1 -1
  93. package/fesm2022/{ngx-t-forms-validators-config.component-qO6Y4x1v.mjs → ngx-t-forms-validators-config.component-DhuB7c63.mjs} +2 -2
  94. package/fesm2022/{ngx-t-forms-validators-config.component-qO6Y4x1v.mjs.map → ngx-t-forms-validators-config.component-DhuB7c63.mjs.map} +1 -1
  95. package/fesm2022/{ngx-t-forms-workflow-adjudication.component-SUbSx79R.mjs → ngx-t-forms-workflow-adjudication.component-Dc4r01D7.mjs} +3 -3
  96. package/fesm2022/{ngx-t-forms-workflow-adjudication.component-SUbSx79R.mjs.map → ngx-t-forms-workflow-adjudication.component-Dc4r01D7.mjs.map} +1 -1
  97. package/fesm2022/ngx-t-forms.mjs +1 -1
  98. package/package.json +3 -3
  99. package/types/ngx-t-forms.d.ts +1754 -5
  100. package/fesm2022/ngx-t-forms-auto-complete-input-element.component-Cph2QuN3.mjs.map +0 -1
  101. package/fesm2022/ngx-t-forms-calculated-field-rules.component-CZ5c7fRi.mjs.map +0 -1
  102. package/fesm2022/ngx-t-forms-index-Cl4VG3Vd.mjs +0 -2
  103. package/fesm2022/ngx-t-forms-index-Cl4VG3Vd.mjs.map +0 -1
  104. package/fesm2022/ngx-t-forms-input-custom.component-q8jPq7KI.mjs +0 -105
  105. package/fesm2022/ngx-t-forms-input-custom.component-q8jPq7KI.mjs.map +0 -1
  106. package/fesm2022/ngx-t-forms-mscoa-config.component-CmIR92zj.mjs.map +0 -1
  107. package/fesm2022/ngx-t-forms-ngx-t-forms-BA1CoCl_.mjs.map +0 -1
  108. package/fesm2022/ngx-t-forms-rest-api-call-setup.component-BhQmOVHN.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngx-t-forms-calculated-field-rules.component-KHUBx8wM.mjs","sources":["../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/calculated-field-rules/math-preview.component.ts","../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/calculated-field-rules/calculated-field-rules.component.ts","../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/calculated-field-rules/calculated-field-rules.component.html"],"sourcesContent":["import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n ElementRef,\r\n PLATFORM_ID,\r\n ViewEncapsulation,\r\n computed,\r\n effect,\r\n inject,\r\n input,\r\n} from '@angular/core';\r\nimport { isPlatformBrowser } from '@angular/common';\r\nimport katex from 'katex';\r\n\r\nimport { parseInfixFormula } from '../../../../shared/functions/formula/parse-infix-formula';\r\n\r\n/**\r\n * Read-only \"natural maths\" preview of a strictly-infix expression.\r\n *\r\n * It parses the expression with mathjs and renders the result as MathML via\r\n * KaTeX (no stylesheet required — the browser draws the glyphs natively). The\r\n * expression itself is never modified, so what is previewed is exactly what\r\n * `math.evaluate` will later consume.\r\n *\r\n * Internal to `t-dynamic-data-edit` — not part of the library's public surface.\r\n */\r\n@Component({\r\n selector: 'lib-math-preview',\r\n template: '',\r\n styleUrl: './math-preview.component.scss',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.Emulated,\r\n host: {\r\n 'class': 'lib-math-preview',\r\n '[attr.data-state]': 'state()',\r\n },\r\n})\r\nexport class MathPreviewComponent {\r\n /** Strictly-infix expression to render (mathjs syntax, e.g. `((a+2)/(b-1))*2`). */\r\n readonly expression = input<string>('');\r\n\r\n /** Text shown when there is nothing to preview. */\r\n readonly placeholder = input<string>('Nothing to preview yet');\r\n\r\n /** `'empty'` when no expression is set, otherwise `'rendered'`. */\r\n protected readonly state = computed<'empty' | 'rendered'>(() =>\r\n this.expression().trim() ? 'rendered' : 'empty',\r\n );\r\n\r\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\r\n readonly #isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\r\n\r\n constructor() {\r\n effect(() => {\r\n const expression = this.expression().trim();\r\n const placeholder = this.placeholder();\r\n const element = this.#host.nativeElement;\r\n\r\n // On the server KaTeX has no DOM to render into — fall back to plain text.\r\n if (!this.#isBrowser) {\r\n element.textContent = expression || placeholder;\r\n return;\r\n }\r\n if (!expression) {\r\n element.textContent = placeholder;\r\n return;\r\n }\r\n\r\n const { tex } = parseInfixFormula(expression);\r\n if (tex == null) {\r\n // Mid-edit / not yet valid: show the raw infix until it parses cleanly.\r\n element.textContent = expression;\r\n return;\r\n }\r\n katex.render(tex, element, {\r\n output: 'mathml',\r\n throwOnError: false,\r\n displayMode: true,\r\n });\r\n });\r\n }\r\n}\r\n","import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n ElementRef,\r\n Input,\r\n OnDestroy,\r\n ViewEncapsulation,\r\n computed,\r\n inject,\r\n input,\r\n output,\r\n signal,\r\n viewChild,\r\n} from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { FormsModule, NgControl } from '@angular/forms';\r\nimport { MatSelectChange, MatSelectModule } from '@angular/material/select';\r\nimport { MatFormFieldControl, MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatCardModule } from '@angular/material/card';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatChipsModule } from '@angular/material/chips';\r\nimport { OverlayModule } from '@angular/cdk/overlay';\r\nimport { Subject } from 'rxjs';\r\nimport { v4 as uuidv4 } from 'uuid';\r\n\r\nimport {\r\n CalculatedFieldRules,\r\n CalculationFunctions,\r\n FormColumnInputs,\r\n TableConfigurationsInterface,\r\n calculationVariableInterface,\r\n} from 'ngx-t-forms-types';\r\n\r\nimport type { IConfigElementError } from '../../t-dynamic-data-edit.component';\r\nimport { _isEqual } from '../../../../shared/functions/isEqual';\r\nimport { MathPreviewComponent } from './math-preview.component';\r\nimport { parseInfixFormula } from '../../../../shared/functions/formula/parse-infix-formula';\r\n\r\n/** Escapes a string for safe inclusion as a literal inside a `RegExp`. */\r\nfunction escapeRegExp(value: string): string {\r\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\r\n}\r\n\r\n/** One selectable rounding strategy shown as a chip option. */\r\ninterface RoundingOption {\r\n readonly value: 'FLOOR' | 'CEIL' | 'ROUND';\r\n readonly label: string;\r\n}\r\n\r\n/** One operator-palette button: the glyph shown, the infix token it inserts. */\r\ninterface OperatorKey {\r\n /** Glyph rendered on the button. */\r\n readonly label: string;\r\n /** Strictly-infix token inserted into the equation (mathjs syntax). */\r\n readonly token: string;\r\n /** Characters to step the caret back after insertion (e.g. land inside `()`). */\r\n readonly caretBack: number;\r\n /** Accessible name for the button. */\r\n readonly aria: string;\r\n}\r\n\r\n/** Live syntactic state of the equation, surfaced to the user as plain guidance. */\r\ninterface FormulaStatus {\r\n readonly kind: 'empty' | 'valid' | 'invalid';\r\n readonly message: string;\r\n}\r\n\r\n// ControlValueAccessor write callback. Angular types the registered change\r\n// handler as `(value: any) => void`; the alias keeps that `any` contained to one\r\n// place rather than repeating an eslint-disable on every reference.\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Angular CVA mandates an untyped change callback.\r\ntype CvaChange = (value: any) => void;\r\n\r\n/**\r\n * Internal calculated-field-rules editor implementing\r\n * `MatFormFieldControl<CalculatedFieldRules | undefined>` and\r\n * `ControlValueAccessor`.\r\n *\r\n * Rendered by `t-dynamic-data-edit`, which supplies the surrounding field label,\r\n * hint, and validation errors — so this component owns only its two modes: a\r\n * read-only formula summary (view) and a sectioned editor (edit) for the\r\n * formula, its variables, the optional formula source link, and the rounding\r\n * settings.\r\n *\r\n * NOTE: `MatFormFieldControl<T>` and `ControlValueAccessor` mandate plain\r\n * mutable `value` / `placeholder` / `required` / `disabled` / `id` members,\r\n * `@Input()` decorators on them, the `focused` / `touched` / `stateChanges` /\r\n * `onChange` / `onTouched` members, and the `useExisting` provider. These are\r\n * framework wiring, not defects — the CLAUDE.md bans on `@Input()` /\r\n * `useExisting` do not apply to MatFormFieldControl integration. Genuinely\r\n * internal state is signal-based.\r\n */\r\n@Component({\r\n selector: 'lib-calculated-field-rules',\r\n templateUrl: './calculated-field-rules.component.html',\r\n styleUrls: ['./calculated-field-rules.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.Emulated,\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n MathPreviewComponent,\r\n OverlayModule,\r\n MatFormFieldModule,\r\n MatInputModule,\r\n MatSelectModule,\r\n MatIconModule,\r\n MatCardModule,\r\n MatButtonModule,\r\n MatChipsModule,\r\n ],\r\n providers: [{ provide: MatFormFieldControl, useExisting: CalculatedFieldRulesComponent }],\r\n host: {\r\n 'class': 'lib-calculated-field-rules',\r\n '[attr.aria-describedby]': 'describedBy',\r\n },\r\n})\r\nexport class CalculatedFieldRulesComponent\r\n implements OnDestroy, MatFormFieldControl<CalculatedFieldRules | undefined>\r\n{\r\n static nextId = 0;\r\n\r\n // #region MatFormFieldControl framework members (plain mutable — not signals)\r\n @Input() placeholder = '';\r\n @Input() required = false;\r\n @Input() disabled = false;\r\n\r\n readonly stateChanges = new Subject<void>();\r\n readonly controlType = 'app-calculated-field-rules';\r\n readonly id = `app-calculated-field-rules-${CalculatedFieldRulesComponent.nextId++}`;\r\n\r\n focused = false;\r\n touched = false;\r\n describedBy = '';\r\n // #endregion\r\n\r\n // #region Non-MFC inputs / outputs (contract preserved exactly)\r\n /** Owning input definition; supplies table mode and the formula-source map. */\r\n readonly mapToData = input<FormColumnInputs | undefined>(undefined);\r\n /** All form inputs available to bind as calculation variables. */\r\n readonly formInputs = input<Array<FormColumnInputs>>([]);\r\n /** Validation errors surfaced by the parent for error-state derivation. */\r\n readonly errors = input<IConfigElementError[] | undefined>([]);\r\n\r\n /** Retained on the contract; reserved for path-scoped value emission. */\r\n readonly valueChange2dWithPath = output<unknown>();\r\n /** Emits the persisted rules whenever the editor commits a new value. */\r\n readonly valueChanged = output<CalculatedFieldRules | null>();\r\n // #endregion\r\n\r\n // #region Internal signal state\r\n /** Whether the editor card is open (edit mode) versus the summary (view). */\r\n protected readonly isEditing = signal(false);\r\n /** Working copy edited in the card; committed to `value` on save. */\r\n protected readonly tempValue = signal<CalculatedFieldRules>({} as CalculatedFieldRules);\r\n\r\n /** Whether the inline `$` field-picker is open. */\r\n protected readonly pickerOpen = signal(false);\r\n /** Text typed after `$`, used to filter the field-picker. */\r\n protected readonly pickerQuery = signal('');\r\n /** Keyboard-highlighted result in the field-picker. */\r\n protected readonly pickerActiveIndex = signal(0);\r\n\r\n /** Index of the `$` that opened the picker, and the caret at that moment. */\r\n #dollarIndex = -1;\r\n #cursorPosition = 0;\r\n // #endregion\r\n\r\n protected readonly roundingType: readonly RoundingOption[] = [\r\n { value: 'ROUND', label: 'Nearest' },\r\n { value: 'FLOOR', label: 'Round down' },\r\n { value: 'CEIL', label: 'Round up' },\r\n ];\r\n\r\n /** Operator palette inserted into the equation; glyphs are friendly, tokens are infix. */\r\n protected readonly operatorKeys: readonly OperatorKey[] = [\r\n { label: '+', token: ' + ', caretBack: 0, aria: 'Add' },\r\n { label: '−', token: ' - ', caretBack: 0, aria: 'Subtract' },\r\n { label: '×', token: ' * ', caretBack: 0, aria: 'Multiply' },\r\n { label: '÷', token: ' / ', caretBack: 0, aria: 'Divide' },\r\n { label: '( )', token: '()', caretBack: 1, aria: 'Brackets' },\r\n { label: 'xⁿ', token: '^', caretBack: 0, aria: 'Power' },\r\n ];\r\n\r\n /** The equation textarea, used for caret-aware token insertion. */\r\n protected readonly formulaInputRef =\r\n viewChild<ElementRef<HTMLTextAreaElement>>('formulaInput');\r\n\r\n /** Live, non-technical validity of the working equation (drives the preview banner). */\r\n protected readonly formulaStatus = computed<FormulaStatus>(() => {\r\n const formula = (this.tempValue().formula ?? '').trim();\r\n if (!formula) {\r\n return { kind: 'empty', message: 'Start building your equation below.' };\r\n }\r\n const { error } = parseInfixFormula(formula);\r\n return error\r\n ? { kind: 'invalid', message: error }\r\n : { kind: 'valid', message: 'This equation is valid.' };\r\n });\r\n\r\n /** Number-typed inputs that may back a calculation variable. */\r\n protected readonly cachedNumberInputs = computed<FormColumnInputs[]>(() =>\r\n this.formInputs().filter(\r\n (input) => input.dataType === 'number' || input.type === 'number',\r\n ),\r\n );\r\n\r\n /** Field-picker results: number inputs filtered by the text typed after `$`. */\r\n protected readonly pickerResults = computed<FormColumnInputs[]>(() => {\r\n const query = this.pickerQuery().trim().toLowerCase();\r\n const inputs = this.cachedNumberInputs();\r\n if (!query) {\r\n return inputs;\r\n }\r\n return inputs.filter(\r\n (input) =>\r\n input.label?.toLowerCase().includes(query) ||\r\n input.formControlName?.toLowerCase().includes(query),\r\n );\r\n });\r\n\r\n /** Every calculation function offered as a list-aggregation chip. */\r\n protected readonly allCalculationFunction = computed<CalculationFunctions[]>(() =>\r\n Object.values(CalculationFunctions),\r\n );\r\n\r\n /** True when this editor targets a table column rather than a scalar input. */\r\n protected readonly tableMode = computed<boolean>(() => !!this.mapToData()?.tableConfig);\r\n\r\n /** Table configuration when in table mode. */\r\n protected readonly tableConfig = computed<TableConfigurationsInterface | undefined>(\r\n () => this.mapToData()?.tableConfig,\r\n );\r\n\r\n readonly ngControl = inject(NgControl, { self: true, optional: true });\r\n readonly #elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\r\n\r\n constructor() {\r\n if (this.ngControl != null) {\r\n this.ngControl.valueAccessor = this;\r\n }\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.stateChanges.next();\r\n this.stateChanges.complete();\r\n }\r\n\r\n // #region Value accessor & MatFormFieldControl logic\r\n\r\n #value: CalculatedFieldRules | undefined;\r\n\r\n @Input()\r\n get value(): CalculatedFieldRules | undefined {\r\n return this.#value;\r\n }\r\n set value(val: CalculatedFieldRules | undefined) {\r\n if (_isEqual(this.#value, val)) {\r\n return;\r\n }\r\n this.#value = val ? { ...val } : undefined;\r\n this.stateChanges.next();\r\n this.valueChanged.emit(this.#value ?? null);\r\n this.onChange(this.#value);\r\n }\r\n\r\n // MatFormFieldControl reads these as plain getters during its own change\r\n // detection, so they stay getters rather than `computed()` signals.\r\n get empty(): boolean {\r\n return !this.#value;\r\n }\r\n\r\n get shouldLabelFloat(): boolean {\r\n return this.focused || !this.empty;\r\n }\r\n\r\n get errorState(): boolean {\r\n const hasCustomError = (this.errors() ?? []).length > 0;\r\n const hasControlError = this.ngControl?.control?.errors != null;\r\n return (\r\n (this.touched && (hasControlError || hasCustomError)) ||\r\n (this.required && !this.#value)\r\n );\r\n }\r\n\r\n // ControlValueAccessor — Angular registers an untyped change callback.\r\n onChange: CvaChange = () => {};\r\n onTouched: () => void = () => {};\r\n\r\n writeValue(value: CalculatedFieldRules): void {\r\n this.value = value;\r\n }\r\n\r\n registerOnChange(fn: CvaChange): void {\r\n this.onChange = fn;\r\n }\r\n\r\n registerOnTouched(fn: () => void): void {\r\n this.onTouched = fn;\r\n }\r\n\r\n setDisabledState(isDisabled: boolean): void {\r\n this.disabled = isDisabled;\r\n this.stateChanges.next();\r\n }\r\n\r\n setDescribedByIds(ids: string[]): void {\r\n const controlElement = this.#elementRef.nativeElement.querySelector(\r\n '.app-calculated-field-rules',\r\n );\r\n controlElement?.setAttribute('aria-describedby', ids.join(' '));\r\n this.describedBy = ids.join(' ');\r\n this.stateChanges.next();\r\n }\r\n\r\n onContainerClick(): void {\r\n if (!this.focused) {\r\n this.focused = true;\r\n this.stateChanges.next();\r\n }\r\n this.markAsTouched();\r\n }\r\n\r\n markAsTouched(): void {\r\n if (!this.touched) {\r\n this.onTouched();\r\n this.touched = true;\r\n this.stateChanges.next();\r\n }\r\n }\r\n\r\n // #endregion\r\n\r\n // #region Edit-mode lifecycle\r\n\r\n protected startEdit(): void {\r\n this.tempValue.set(\r\n this.#value ? structuredClone(this.#value) : ({} as CalculatedFieldRules),\r\n );\r\n this.isEditing.set(true);\r\n this.markAsTouched();\r\n }\r\n\r\n protected saveEdit(): void {\r\n this.value = this.tempValue();\r\n this.isEditing.set(false);\r\n }\r\n\r\n protected cancelEdit(): void {\r\n this.isEditing.set(false);\r\n this.tempValue.set({} as CalculatedFieldRules);\r\n }\r\n\r\n // #endregion\r\n\r\n // #region Formula / variable editing (operates on tempValue)\r\n\r\n protected checkIfInputCanBeLinkedToCalVariable(\r\n currentInput: FormColumnInputs | undefined,\r\n inputToDisable: {\r\n formControlName: unknown;\r\n parentInput?: unknown;\r\n multipleInputInEditId?: unknown;\r\n },\r\n ): boolean {\r\n if (!currentInput) {\r\n return false;\r\n }\r\n if (currentInput.formControlName === inputToDisable.formControlName) {\r\n return true;\r\n }\r\n if (!currentInput.multipleInputInEditId) {\r\n return !!inputToDisable.parentInput || !!inputToDisable.multipleInputInEditId;\r\n }\r\n return false;\r\n }\r\n\r\n protected linkFormulaSource(event: MatSelectChange): void {\r\n // Resetting formula to undefined intentionally during edit; persisted value\r\n // re-validates on save.\r\n this.tempValue.update((current) => ({\r\n ...current,\r\n formControlWithFormula: event.value,\r\n formula: '',\r\n }));\r\n }\r\n\r\n protected removeVariable(variableId: string): void {\r\n const current = this.tempValue();\r\n const variables = current.variables ?? [];\r\n const target = variables.find((v) => v.id === variableId);\r\n let formula = current.formula ?? '';\r\n if (target?.variable) {\r\n formula = formula\r\n .replace(new RegExp(`\\\\b${escapeRegExp(target.variable)}\\\\b`, 'g'), '')\r\n .replace(/\\s{2,}/g, ' ')\r\n .trim();\r\n }\r\n this.tempValue.set({\r\n ...current,\r\n variables: variables.filter((v) => v.id !== variableId),\r\n formula,\r\n });\r\n }\r\n\r\n protected appendVariableToFormula(variableName: string): void {\r\n // A variable carries no spacing of its own, so pad it only where it would\r\n // otherwise fuse with an adjacent token (e.g. `ab` instead of `a b`).\r\n const { before, after } = this.#caretSlices();\r\n const lead = before.length > 0 && !/[\\s(]$/.test(before) ? ' ' : '';\r\n const trail = after.length > 0 && !/^[\\s)]/.test(after) ? ' ' : '';\r\n this.insertToken(`${lead}${variableName}${trail}`, trail ? 1 : 0);\r\n }\r\n\r\n protected setFormula(formula: string): void {\r\n this.tempValue.update((current) => ({ ...current, formula }));\r\n }\r\n\r\n /**\r\n * Inserts an infix token at the caret (or appends it when the textarea is not\r\n * focused), then restores the caret just after the insertion. Used by both the\r\n * operator palette and the variable chips so the equation reads naturally while\r\n * staying strictly infix.\r\n */\r\n protected insertToken(token: string, caretBack = 0): void {\r\n const element = this.formulaInputRef()?.nativeElement;\r\n const { before, after } = this.#caretSlices();\r\n const next = before + token + after;\r\n\r\n this.setFormula(next);\r\n\r\n if (!element) {\r\n return;\r\n }\r\n const caret = before.length + token.length - caretBack;\r\n // Restore focus + caret after Angular has written the new value back to the DOM.\r\n setTimeout(() => {\r\n element.focus();\r\n element.setSelectionRange(caret, caret);\r\n });\r\n }\r\n\r\n /** The formula split around the current caret/selection (end-of-string when unfocused). */\r\n #caretSlices(): { before: string; after: string } {\r\n const current = this.tempValue().formula ?? '';\r\n const element = this.formulaInputRef()?.nativeElement;\r\n const start = element?.selectionStart ?? current.length;\r\n const end = element?.selectionEnd ?? current.length;\r\n return { before: current.slice(0, start), after: current.slice(end) };\r\n }\r\n\r\n protected setDecimalPlaces(value: number | string | null): void {\r\n const parsed =\r\n value === null || value === '' ? undefined : Number(value);\r\n this.tempValue.update((current) => ({\r\n ...current,\r\n decimalPlaces: parsed !== undefined && Number.isFinite(parsed) ? parsed : undefined,\r\n }));\r\n }\r\n\r\n protected setRoundingMode(mode: 'FLOOR' | 'CEIL' | 'ROUND'): void {\r\n this.tempValue.update((current) => ({ ...current, roundingMode: mode }));\r\n }\r\n\r\n /** Friendly label for a stored rounding mode, used in the read-only summary. */\r\n protected roundingLabel(mode: 'FLOOR' | 'CEIL' | 'ROUND' | undefined): string {\r\n return this.roundingType.find((option) => option.value === mode)?.label ?? 'nearest';\r\n }\r\n\r\n // #endregion\r\n\r\n // #region Inline `$` field-picker & variable binding\r\n\r\n /** Formula text changed: persist it and re-evaluate whether the `$` picker should show. */\r\n protected onFormulaChange(value: string): void {\r\n this.setFormula(value);\r\n this.#syncPicker();\r\n }\r\n\r\n /** Caret moved (click / arrow keys / focus): re-evaluate the `$` picker against the new caret. */\r\n protected onFormulaCaret(): void {\r\n this.#syncPicker();\r\n }\r\n\r\n /** Closes the picker shortly after blur, leaving time for a result click to register. */\r\n protected onFormulaBlur(): void {\r\n setTimeout(() => this.closePicker(), 150);\r\n }\r\n\r\n /** Keyboard control for the open picker: navigate, select, dismiss. */\r\n protected onFormulaKeydown(event: KeyboardEvent): void {\r\n if (!this.pickerOpen()) {\r\n return;\r\n }\r\n const results = this.pickerResults();\r\n switch (event.key) {\r\n case 'ArrowDown':\r\n event.preventDefault();\r\n this.pickerActiveIndex.update((i) => Math.min(i + 1, results.length - 1));\r\n break;\r\n case 'ArrowUp':\r\n event.preventDefault();\r\n this.pickerActiveIndex.update((i) => Math.max(i - 1, 0));\r\n break;\r\n case 'Enter': {\r\n const item = results[this.pickerActiveIndex()];\r\n if (item) {\r\n event.preventDefault();\r\n this.selectField(item);\r\n }\r\n break;\r\n }\r\n case 'Escape':\r\n event.preventDefault();\r\n this.closePicker();\r\n break;\r\n }\r\n }\r\n\r\n protected closePicker(): void {\r\n this.pickerOpen.set(false);\r\n this.pickerActiveIndex.set(0);\r\n this.#dollarIndex = -1;\r\n }\r\n\r\n /**\r\n * Binds a form field to a calculation variable and drops its short token into\r\n * the equation. Reuses an existing scalar binding for the same field; otherwise\r\n * mints the next free short name (a, b, c, …). When opened from `$`, the typed\r\n * `$query` is replaced in place; otherwise the token is appended.\r\n */\r\n protected selectField(input: FormColumnInputs): void {\r\n const current = this.tempValue();\r\n const variables = current.variables ?? [];\r\n const existing = variables.find(\r\n (v) => v.formControlName === input.formControlName && !v.function && !v.parentInputId,\r\n );\r\n const token = existing ? existing.variable : this.#nextShortName();\r\n const nextVars = existing ? variables : [...variables, this.#makeVariable(input, token)];\r\n\r\n const formula = current.formula ?? '';\r\n let nextFormula: string;\r\n let caret: number;\r\n if (this.pickerOpen() && this.#dollarIndex >= 0) {\r\n const before = formula.slice(0, this.#dollarIndex);\r\n const after = formula.slice(this.#cursorPosition);\r\n const lead = before.length > 0 && !/[\\s(]$/.test(before) ? ' ' : '';\r\n const insert = `${lead}${token} `;\r\n nextFormula = before + insert + after;\r\n caret = (before + insert).length;\r\n } else {\r\n const lead = formula.length > 0 && !/[\\s(]$/.test(formula) ? ' ' : '';\r\n nextFormula = `${formula}${lead}${token} `;\r\n caret = nextFormula.length;\r\n }\r\n\r\n this.tempValue.set({ ...current, formula: nextFormula, variables: nextVars });\r\n this.closePicker();\r\n\r\n const element = this.formulaInputRef()?.nativeElement;\r\n if (element) {\r\n setTimeout(() => {\r\n element.focus();\r\n element.setSelectionRange(caret, caret);\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Renames a variable's short token, updating every whole-word occurrence in the\r\n * formula. An empty name is ignored so the token never desyncs from the formula\r\n * (the field repopulates with the current name on the next render).\r\n */\r\n protected setVariableShortName(id: string, rawName: string): void {\r\n const name = rawName.trim();\r\n const current = this.tempValue();\r\n const variables = current.variables ?? [];\r\n const target = variables.find((v) => v.id === id);\r\n if (!target || !name || name === target.variable) {\r\n return;\r\n }\r\n const formula = target.variable\r\n ? (current.formula ?? '').replace(\r\n new RegExp(`\\\\b${escapeRegExp(target.variable)}\\\\b`, 'g'),\r\n name,\r\n )\r\n : (current.formula ?? '');\r\n this.tempValue.set({\r\n ...current,\r\n formula,\r\n variables: variables.map((v) => (v.id === id ? { ...v, variable: name } : v)),\r\n });\r\n }\r\n\r\n /** Toggles a list-aggregation function (sum/avg/…) on a sub-item variable. */\r\n protected setVariableFunction(id: string, func: CalculationFunctions): void {\r\n this.tempValue.update((current) => ({\r\n ...current,\r\n variables: (current.variables ?? []).map((v) => {\r\n if (v.id !== id) {\r\n return v;\r\n }\r\n if (v.function === func) {\r\n return {\r\n ...v,\r\n function: undefined,\r\n applyFunctionToCol: undefined,\r\n applyFunctionToLabel: undefined,\r\n };\r\n }\r\n return {\r\n ...v,\r\n function: func,\r\n applyFunctionToCol: v.formControlName,\r\n applyFunctionToLabel: v.label,\r\n };\r\n }),\r\n }));\r\n }\r\n\r\n /** Recomputes the picker visibility/query from the current formula and caret. */\r\n #syncPicker(): void {\r\n const element = this.formulaInputRef()?.nativeElement;\r\n if (!element) {\r\n this.closePicker();\r\n return;\r\n }\r\n const position = element.selectionStart ?? 0;\r\n this.#cursorPosition = position;\r\n const formula = this.tempValue().formula ?? '';\r\n const lastDollar = formula.slice(0, position).lastIndexOf('$');\r\n if (lastDollar === -1) {\r\n this.closePicker();\r\n return;\r\n }\r\n const query = formula.slice(lastDollar + 1, position);\r\n // Only a run of letters/digits/spaces keeps the picker open; anything else\r\n // (an operator, a newline) means the `$` was not a field trigger.\r\n if (!/^[a-zA-Z0-9 ]*$/.test(query)) {\r\n this.closePicker();\r\n return;\r\n }\r\n this.#dollarIndex = lastDollar;\r\n this.pickerQuery.set(query);\r\n this.pickerActiveIndex.set(0);\r\n this.pickerOpen.set(true);\r\n }\r\n\r\n /** Builds a calculation variable bound to a form field, carrying the list parent when present. */\r\n #makeVariable(input: FormColumnInputs, token: string): calculationVariableInterface {\r\n return {\r\n id: uuidv4(),\r\n variable: token,\r\n formControlName: input.formControlName,\r\n inputId: input.id,\r\n label: input.label,\r\n ...(input.multipleInputInEditId ? { parentInputId: input.multipleInputInEditId } : {}),\r\n } as calculationVariableInterface;\r\n }\r\n\r\n /** Next free single-letter token (a, b, c, …), skipping mathjs constants and falling back to v1, v2…. */\r\n #nextShortName(): string {\r\n const used = new Set((this.tempValue().variables ?? []).map((v) => v.variable));\r\n const reserved = new Set(['e', 'i']); // mathjs constants\r\n for (let code = 97; code <= 122; code++) {\r\n const char = String.fromCharCode(code);\r\n if (!used.has(char) && !reserved.has(char)) {\r\n return char;\r\n }\r\n }\r\n let n = 1;\r\n while (used.has(`v${n}`)) {\r\n n++;\r\n }\r\n return `v${n}`;\r\n }\r\n\r\n // #endregion\r\n}\r\n","<!-- View mode: read-only calculation summary -->\r\n@if (!isEditing()) {\r\n<div class=\"cfr-summary\">\r\n @if (!!value && !mapToData()?.id && !tableMode()) {\r\n <div class=\"cfr-hint\">\r\n <mat-icon class=\"cfr-hint__icon\" color=\"primary\">info</mat-icon>\r\n <span>Save the input first to enable calculated field configurations</span>\r\n </div>\r\n }\r\n\r\n <div class=\"cfr-formula-card\">\r\n <span class=\"cfr-section__label\">Calculation</span>\r\n <lib-math-preview class=\"cfr-formula-card__preview\" [expression]=\"value?.formula || ''\"\r\n placeholder=\"No calculation set up yet\" />\r\n @if (value?.decimalPlaces) {\r\n <div class=\"cfr-formula-card__meta\">\r\n <mat-icon class=\"cfr-formula-card__meta-icon\">tune</mat-icon>\r\n <span>Shown to {{ value?.decimalPlaces }} decimal place(s) · {{ value?.roundingMode ? roundingLabel(value?.roundingMode) : 'nearest' }}</span>\r\n </div>\r\n }\r\n </div>\r\n\r\n <button class=\"cfr-edit-trigger\" mat-stroked-button color=\"primary\" [disabled]=\"disabled\"\r\n (click)=\"startEdit()\">\r\n <mat-icon>edit</mat-icon>\r\n {{ !!value?.formula ? 'Edit calculation' : 'Set up calculation' }}\r\n </button>\r\n</div>\r\n}\r\n\r\n<!-- Edit mode: guided calculation builder -->\r\n@else {\r\n<mat-card appearance=\"outlined\" class=\"cfr-editor\">\r\n <header class=\"cfr-editor__head\">\r\n <h3 class=\"cfr-editor__title\">\r\n <mat-icon>functions</mat-icon>\r\n Build the calculation\r\n </h3>\r\n <p class=\"cfr-editor__subtitle\">\r\n Combine your form fields with operators to work out this value automatically.\r\n </p>\r\n </header>\r\n\r\n <!-- Live preview + validity -->\r\n <div class=\"cfr-preview\" [attr.data-state]=\"formulaStatus().kind\">\r\n <span class=\"cfr-section__label\">Live preview</span>\r\n <lib-math-preview class=\"cfr-preview__render\" [expression]=\"tempValue().formula || ''\"\r\n placeholder=\"Your equation will appear here\" />\r\n <p class=\"cfr-preview__status\">\r\n <mat-icon class=\"cfr-preview__status-icon\">\r\n {{ formulaStatus().kind === 'valid' ? 'check_circle' : formulaStatus().kind === 'invalid' ? 'error' : 'lightbulb' }}\r\n </mat-icon>\r\n <span>{{ formulaStatus().message }}</span>\r\n </p>\r\n </div>\r\n\r\n <section class=\"cfr-section\">\r\n <!-- Equation input + inline field-picker + operator keypad -->\r\n <div class=\"cfr-equation\">\r\n <div class=\"cfr-equation__field\">\r\n <mat-form-field class=\"cfr-field\" [subscriptSizing]=\"'dynamic'\" [floatLabel]=\"'always'\"\r\n appearance=\"outline\">\r\n <mat-label>Equation</mat-label>\r\n <textarea #formulaInput matInput [ngModel]=\"tempValue().formula\"\r\n (ngModelChange)=\"onFormulaChange($event)\" (keyup)=\"onFormulaCaret()\"\r\n (click)=\"onFormulaCaret()\" (focus)=\"onFormulaCaret()\"\r\n (keydown)=\"onFormulaKeydown($event)\" (blur)=\"onFormulaBlur()\"\r\n placeholder=\"e.g. (a + 2) / b\" rows=\"2\" spellcheck=\"false\" autocapitalize=\"off\"\r\n autocomplete=\"off\"></textarea>\r\n <mat-hint>Type <strong>$</strong> to add a form field, then join fields with the operator keys.</mat-hint>\r\n </mat-form-field>\r\n\r\n @if (pickerOpen()) {\r\n <div class=\"cfr-picker\" role=\"listbox\" aria-label=\"Form fields\">\r\n <div class=\"cfr-picker__head\">Insert a field</div>\r\n @if (pickerResults().length === 0) {\r\n <div class=\"cfr-picker__empty\">No matching number fields</div>\r\n } @else {\r\n @for (item of pickerResults(); track item.id; let idx = $index) {\r\n <button type=\"button\" role=\"option\" class=\"cfr-picker__item\"\r\n [class.cfr-picker__item--active]=\"idx === pickerActiveIndex()\"\r\n [attr.aria-selected]=\"idx === pickerActiveIndex()\"\r\n (mousedown)=\"$event.preventDefault()\" (click)=\"selectField(item)\">\r\n <mat-icon class=\"cfr-picker__icon\">{{ item.multipleInputInEditId ? 'format_list_numbered' : 'tag' }}</mat-icon>\r\n <span class=\"cfr-picker__label\">{{ item.label }}</span>\r\n <span class=\"cfr-picker__meta\">{{ item.formControlName }}</span>\r\n </button>\r\n }\r\n }\r\n </div>\r\n }\r\n </div>\r\n\r\n <div class=\"cfr-keypad\" role=\"group\" aria-label=\"Operators\">\r\n @for (key of operatorKeys; track key.token) {\r\n <button type=\"button\" class=\"cfr-key\" [attr.aria-label]=\"key.aria\"\r\n (click)=\"insertToken(key.token, key.caretBack)\">\r\n {{ key.label }}\r\n </button>\r\n }\r\n </div>\r\n </div>\r\n\r\n <!-- Optional equation source link -->\r\n @if (!!tempValue().getFormulaFromAFormInput) {\r\n <mat-form-field class=\"cfr-field\" [subscriptSizing]=\"'dynamic'\" [floatLabel]=\"'always'\"\r\n appearance=\"outline\">\r\n <mat-label>Equation source</mat-label>\r\n <mat-select [value]=\"tempValue().formControlWithFormula\"\r\n (selectionChange)=\"linkFormulaSource($event)\" placeholder=\"Select an input that holds a formula\">\r\n @for (input of formInputs(); track input.id) {\r\n <mat-option\r\n [disabled]=\"checkIfInputCanBeLinkedToCalVariable(mapToData(), input) || input.element !== 'select'\"\r\n [value]=\"input.formControlName\">\r\n {{ input.label }}\r\n </mat-option>\r\n }\r\n </mat-select>\r\n <mat-hint>Pull the equation from another input's value</mat-hint>\r\n </mat-form-field>\r\n }\r\n\r\n <!-- Bound fields legend -->\r\n <div class=\"cfr-variables\">\r\n <div class=\"cfr-block-head\">\r\n <span class=\"cfr-section__label\">Fields in this calculation</span>\r\n <span class=\"cfr-block-head__hint\">Rename a letter, or type $ above to add another</span>\r\n </div>\r\n\r\n @if ((tempValue().variables || []).length === 0) {\r\n <p class=\"cfr-variables__empty\">\r\n Type <strong>$</strong> in the equation above to add a form field — each becomes a short\r\n letter you can use in the equation.\r\n </p>\r\n } @else {\r\n <ul class=\"cfr-legend\">\r\n @for (variable of (tempValue().variables || []); track variable.id) {\r\n <li class=\"cfr-legend__row\">\r\n <div class=\"cfr-legend__main\">\r\n <input class=\"cfr-legend__token\" [ngModel]=\"variable.variable\"\r\n (ngModelChange)=\"setVariableShortName(variable.id, $event)\" aria-label=\"Short name\"\r\n maxlength=\"12\" spellcheck=\"false\" autocomplete=\"off\" autocapitalize=\"off\">\r\n <mat-icon class=\"cfr-legend__arrow\">arrow_right_alt</mat-icon>\r\n <button type=\"button\" class=\"cfr-legend__field\"\r\n [attr.aria-label]=\"'Insert ' + variable.label + ' into the equation'\"\r\n (click)=\"appendVariableToFormula(variable.variable)\">\r\n {{ variable.label }}\r\n </button>\r\n <button type=\"button\" class=\"cfr-legend__remove\"\r\n [attr.aria-label]=\"'Remove ' + variable.variable\"\r\n (click)=\"removeVariable(variable.id)\">\r\n <mat-icon>close</mat-icon>\r\n </button>\r\n </div>\r\n\r\n @if (variable.parentInputId) {\r\n <div class=\"cfr-legend__fns\" role=\"group\" aria-label=\"Combine list values with\">\r\n <span class=\"cfr-legend__fns-label\" aria-hidden=\"true\">ƒ</span>\r\n @for (func of allCalculationFunction(); track func) {\r\n <button type=\"button\" class=\"cfr-legend__fn\"\r\n [class.cfr-legend__fn--active]=\"variable.function === func\"\r\n (click)=\"setVariableFunction(variable.id, func)\">\r\n {{ func }}\r\n </button>\r\n }\r\n </div>\r\n }\r\n </li>\r\n }\r\n </ul>\r\n }\r\n </div>\r\n\r\n <!-- Result formatting -->\r\n <div class=\"cfr-rounding\">\r\n <div class=\"cfr-block-head\">\r\n <span class=\"cfr-section__label\">Result formatting</span>\r\n <span class=\"cfr-block-head__hint\">Optional — how the answer is rounded</span>\r\n </div>\r\n\r\n <div class=\"cfr-rounding__row\">\r\n <mat-form-field class=\"cfr-field cfr-rounding__decimals\" [subscriptSizing]=\"'dynamic'\"\r\n [floatLabel]=\"'always'\" appearance=\"outline\">\r\n <mat-label>Decimal places</mat-label>\r\n <input matInput [ngModel]=\"tempValue().decimalPlaces\"\r\n (ngModelChange)=\"setDecimalPlaces($event)\" placeholder=\"0\" type=\"number\" min=\"0\">\r\n </mat-form-field>\r\n\r\n @if (tempValue().decimalPlaces) {\r\n <div class=\"cfr-rounding__mode\">\r\n <label class=\"cfr-section__label\">Rounding</label>\r\n <mat-chip-listbox aria-label=\"Rounding method\">\r\n @for (type of roundingType; track type.value) {\r\n <mat-chip-option (click)=\"setRoundingMode(type.value)\"\r\n [selected]=\"tempValue().roundingMode === type.value\">\r\n {{ type.label }}\r\n </mat-chip-option>\r\n }\r\n </mat-chip-listbox>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n </section>\r\n\r\n <div class=\"cfr-editor__actions\">\r\n <button mat-button (click)=\"cancelEdit()\">Cancel</button>\r\n <button mat-flat-button color=\"primary\" [disabled]=\"formulaStatus().kind === 'invalid'\"\r\n (click)=\"saveEdit()\">\r\n Save calculation\r\n </button>\r\n </div>\r\n</mat-card>\r\n}\r\n\r\n<!-- Disabled overlay -->\r\n<ng-template cdkConnectedOverlay [cdkConnectedOverlayOpen]=\"disabled\">\r\n <div class=\"cfr-disabled-overlay\"></div>\r\n</ng-template>\r\n"],"names":["uuidv4","i4","i5","i6","i7","i9"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA;;;;;;;;;AASG;MAYU,oBAAoB,CAAA;AAYtB,IAAA,KAAK;AACL,IAAA,UAAU;AAEnB,IAAA,WAAA,GAAA;;AAbS,QAAA,IAAA,CAAA,UAAU,GAAG,KAAK,CAAS,EAAE,iFAAC;;AAG9B,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK,CAAS,wBAAwB,kFAAC;;QAG3C,IAAA,CAAA,KAAK,GAAG,QAAQ,CAAuB,MACxD,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,GAAG,UAAU,GAAG,OAAO,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,OAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAChD;AAEQ,QAAA,IAAA,CA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A,EAAA,MAAA,EAAA,CAAA,o5RAAA,CAAA,EAAA;;sBAQA;;sBACA;;sBACA;6eA6D4C,cAAc,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,KAAA,EAAA,CAAA;sBAkE1D;;;;;"}
@@ -6,7 +6,7 @@ import * as i4 from '@angular/material/chips';
6
6
  import { MatChipsModule } from '@angular/material/chips';
7
7
  import * as i3 from '@angular/material/icon';
8
8
  import { MatIconModule } from '@angular/material/icon';
9
- import { E as EmptyStateComponent } from './ngx-t-forms-ngx-t-forms-BA1CoCl_.mjs';
9
+ import { E as EmptyStateComponent } from './ngx-t-forms-ngx-t-forms-B3WhBGlD.mjs';
10
10
 
11
11
  /**
12
12
  * Internal chip-options creator editor: the user types free-text tokens that
@@ -94,4 +94,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
94
94
  }], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], errors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }] } });
95
95
 
96
96
  export { ChipOptionsCreatorEditorComponent };
97
- //# sourceMappingURL=ngx-t-forms-chip-options-creator-editor.component-aNd2SXIA.mjs.map
97
+ //# sourceMappingURL=ngx-t-forms-chip-options-creator-editor.component-DAZVCoUZ.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ngx-t-forms-chip-options-creator-editor.component-aNd2SXIA.mjs","sources":["../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/chip-options-creator-editor/chip-options-creator-editor.component.ts","../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/chip-options-creator-editor/chip-options-creator-editor.component.html"],"sourcesContent":["import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n ViewEncapsulation,\r\n computed,\r\n effect,\r\n inject,\r\n input,\r\n output,\r\n signal,\r\n} from '@angular/core';\r\nimport { LiveAnnouncer } from '@angular/cdk/a11y';\r\nimport { COMMA, ENTER } from '@angular/cdk/keycodes';\r\nimport { MatChipEditedEvent, MatChipInputEvent, MatChipsModule } from '@angular/material/chips';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport type { IConfigElementError } from '../../t-dynamic-data-edit.component';\r\nimport { EmptyStateComponent } from '../_shared/empty-state/empty-state.component';\r\n\r\n/**\r\n * Internal chip-options creator editor: the user types free-text tokens that\r\n * become removable, editable chips; the resulting `string[]` is emitted.\r\n *\r\n * Rendered by `t-dynamic-data-edit`'s non-control branch (it is NOT a\r\n * MatFormFieldControl), which already supplies the field label, hint, and\r\n * validation errors — so this component owns only the chip grid and its empty\r\n * state.\r\n */\r\n@Component({\r\n selector: 'lib-chip-options-creator-editor',\r\n imports: [MatChipsModule, MatIconModule, EmptyStateComponent],\r\n templateUrl: './chip-options-creator-editor.component.html',\r\n styleUrl: './chip-options-creator-editor.component.scss',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.Emulated,\r\n host: {\r\n 'class': 'lib-chip-options-creator-editor',\r\n '[attr.id]': 'id()',\r\n },\r\n})\r\nexport class ChipOptionsCreatorEditorComponent {\r\n /** Optional id attribute supplied by the parent editor. */\r\n readonly id = input<string | undefined>(undefined);\r\n /** Disables chip entry/edit/remove. */\r\n readonly disabled = input<boolean>(false);\r\n /** Whether a non-empty value is required (kept on the contract). */\r\n readonly required = input<boolean>(false);\r\n /** External validation errors (surfaced by the parent). */\r\n readonly errors = input<IConfigElementError[] | undefined>([]);\r\n /** The chip values to render. */\r\n readonly value = input<string[] | undefined>(undefined);\r\n /** Placeholder for the new-chip input. */\r\n readonly placeholder = input<string>('');\r\n\r\n /** Emits the full chip list whenever it changes. */\r\n readonly valueChange = output<string[] | undefined>();\r\n\r\n protected readonly separatorKeysCodes = [ENTER, COMMA] as const;\r\n\r\n /** Local working copy of the chip list; mirrors the `value` input. */\r\n readonly #internalValue = signal<readonly string[]>([]);\r\n /** Read-only accessor used by the template. */\r\n protected readonly currentValue = this.#internalValue.asReadonly();\r\n protected readonly isEmpty = computed(() => this.#internalValue().length === 0);\r\n\r\n readonly #announcer = inject(LiveAnnouncer);\r\n\r\n constructor() {\r\n // The parent drives the value declaratively via [value].\r\n effect(() => {\r\n this.#internalValue.set(this.value() ?? []);\r\n });\r\n }\r\n\r\n protected add(event: MatChipInputEvent): void {\r\n const value = (event.value || '').trim();\r\n event.chipInput?.clear();\r\n if (!value) {\r\n return;\r\n }\r\n const current = this.#internalValue();\r\n if (current.includes(value)) {\r\n this.#announcer.announce(`value ${value} already exists`);\r\n return;\r\n }\r\n this.#commit([...current, value]);\r\n }\r\n\r\n protected edit(segment: string, event: MatChipEditedEvent): void {\r\n const newValue = event.value.trim();\r\n if (!newValue) {\r\n this.remove(segment);\r\n return;\r\n }\r\n this.#commit(this.#internalValue().map((s) => (s === segment ? newValue : s)));\r\n }\r\n\r\n protected remove(segment: string): void {\r\n const current = this.#internalValue();\r\n if (!current.includes(segment)) {\r\n return;\r\n }\r\n this.#announcer.announce(`Removed ${segment}`);\r\n this.#commit(current.filter((s) => s !== segment));\r\n }\r\n\r\n #commit(next: readonly string[]): void {\r\n const snapshot = [...next];\r\n this.#internalValue.set(snapshot);\r\n this.valueChange.emit(snapshot);\r\n }\r\n}\r\n","@if (isEmpty()) {\r\n<lib-empty-state icon=\"label_off\" message=\"No options yet — type below to add one\" />\r\n}\r\n\r\n<mat-chip-grid\r\n #chipGrid\r\n class=\"lib-chip-options-creator-editor__grid\"\r\n [disabled]=\"disabled()\"\r\n aria-label=\"Chip options\">\r\n @for (segment of currentValue(); track $index) {\r\n <mat-chip-row\r\n class=\"lib-chip-options-creator-editor__chip\"\r\n [editable]=\"true\"\r\n [aria-description]=\"'press enter to edit ' + segment\"\r\n (edited)=\"edit(segment, $event)\"\r\n (removed)=\"remove(segment)\">\r\n {{ segment }}\r\n <button matChipRemove [attr.aria-label]=\"'remove ' + segment\">\r\n <mat-icon>cancel</mat-icon>\r\n </button>\r\n </mat-chip-row>\r\n }\r\n <input\r\n class=\"lib-chip-options-creator-editor__input\"\r\n [placeholder]=\"placeholder() || 'New selection...'\"\r\n [matChipInputFor]=\"chipGrid\"\r\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\r\n [matChipInputAddOnBlur]=\"true\"\r\n (matChipInputTokenEnd)=\"add($event)\" />\r\n</mat-chip-grid>\r\n"],"names":["i1"],"mappings":";;;;;;;;;;AAkBA;;;;;;;;AAQG;MAaU,iCAAiC,CAAA;;AAoBnC,IAAA,cAAc;AAKd,IAAA,UAAU;AAEnB,IAAA,WAAA,GAAA;;AAzBS,QAAA,IAAA,CAAA,EAAE,GAAG,KAAK,CAAqB,SAAS,yEAAC;;AAEzC,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,+EAAC;;AAEhC,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,+EAAC;;AAEhC,QAAA,IAAA,CAAA,MAAM,GAAG,KAAK,CAAoC,EAAE,6EAAC;;AAErD,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAuB,SAAS,4EAAC;;AAE9C,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK,CAAS,EAAE,kFAAC;;QAG/B,IAAA,CAAA,WAAW,GAAG,MAAM,EAAwB;AAElC,QAAA,IAAA,CAAA,kBAAkB,GAAG,CAAC,KAAK,EAAE,KAAK,CAAU;;AAGtD,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAoB,EAAE,qFAAC;;AAEpC,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI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s","sources":["../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/chip-options-creator-editor/chip-options-creator-editor.component.ts","../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/chip-options-creator-editor/chip-options-creator-editor.component.html"],"sourcesContent":["import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n ViewEncapsulation,\r\n computed,\r\n effect,\r\n inject,\r\n input,\r\n output,\r\n signal,\r\n} from '@angular/core';\r\nimport { LiveAnnouncer } from '@angular/cdk/a11y';\r\nimport { COMMA, ENTER } from '@angular/cdk/keycodes';\r\nimport { MatChipEditedEvent, MatChipInputEvent, MatChipsModule } from '@angular/material/chips';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport type { IConfigElementError } from '../../t-dynamic-data-edit.component';\r\nimport { EmptyStateComponent } from '../_shared/empty-state/empty-state.component';\r\n\r\n/**\r\n * Internal chip-options creator editor: the user types free-text tokens that\r\n * become removable, editable chips; the resulting `string[]` is emitted.\r\n *\r\n * Rendered by `t-dynamic-data-edit`'s non-control branch (it is NOT a\r\n * MatFormFieldControl), which already supplies the field label, hint, and\r\n * validation errors — so this component owns only the chip grid and its empty\r\n * state.\r\n */\r\n@Component({\r\n selector: 'lib-chip-options-creator-editor',\r\n imports: [MatChipsModule, MatIconModule, EmptyStateComponent],\r\n templateUrl: './chip-options-creator-editor.component.html',\r\n styleUrl: './chip-options-creator-editor.component.scss',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.Emulated,\r\n host: {\r\n 'class': 'lib-chip-options-creator-editor',\r\n '[attr.id]': 'id()',\r\n },\r\n})\r\nexport class ChipOptionsCreatorEditorComponent {\r\n /** Optional id attribute supplied by the parent editor. */\r\n readonly id = input<string | undefined>(undefined);\r\n /** Disables chip entry/edit/remove. */\r\n readonly disabled = input<boolean>(false);\r\n /** Whether a non-empty value is required (kept on the contract). */\r\n readonly required = input<boolean>(false);\r\n /** External validation errors (surfaced by the parent). */\r\n readonly errors = input<IConfigElementError[] | undefined>([]);\r\n /** The chip values to render. */\r\n readonly value = input<string[] | undefined>(undefined);\r\n /** Placeholder for the new-chip input. */\r\n readonly placeholder = input<string>('');\r\n\r\n /** Emits the full chip list whenever it changes. */\r\n readonly valueChange = output<string[] | undefined>();\r\n\r\n protected readonly separatorKeysCodes = [ENTER, COMMA] as const;\r\n\r\n /** Local working copy of the chip list; mirrors the `value` input. */\r\n readonly #internalValue = signal<readonly string[]>([]);\r\n /** Read-only accessor used by the template. */\r\n protected readonly currentValue = this.#internalValue.asReadonly();\r\n protected readonly isEmpty = computed(() => this.#internalValue().length === 0);\r\n\r\n readonly #announcer = inject(LiveAnnouncer);\r\n\r\n constructor() {\r\n // The parent drives the value declaratively via [value].\r\n effect(() => {\r\n this.#internalValue.set(this.value() ?? []);\r\n });\r\n }\r\n\r\n protected add(event: MatChipInputEvent): void {\r\n const value = (event.value || '').trim();\r\n event.chipInput?.clear();\r\n if (!value) {\r\n return;\r\n }\r\n const current = this.#internalValue();\r\n if (current.includes(value)) {\r\n this.#announcer.announce(`value ${value} already exists`);\r\n return;\r\n }\r\n this.#commit([...current, value]);\r\n }\r\n\r\n protected edit(segment: string, event: MatChipEditedEvent): void {\r\n const newValue = event.value.trim();\r\n if (!newValue) {\r\n this.remove(segment);\r\n return;\r\n }\r\n this.#commit(this.#internalValue().map((s) => (s === segment ? newValue : s)));\r\n }\r\n\r\n protected remove(segment: string): void {\r\n const current = this.#internalValue();\r\n if (!current.includes(segment)) {\r\n return;\r\n }\r\n this.#announcer.announce(`Removed ${segment}`);\r\n this.#commit(current.filter((s) => s !== segment));\r\n }\r\n\r\n #commit(next: readonly string[]): void {\r\n const snapshot = [...next];\r\n this.#internalValue.set(snapshot);\r\n this.valueChange.emit(snapshot);\r\n }\r\n}\r\n","@if (isEmpty()) {\r\n<lib-empty-state icon=\"label_off\" message=\"No options yet — type below to add one\" />\r\n}\r\n\r\n<mat-chip-grid\r\n #chipGrid\r\n class=\"lib-chip-options-creator-editor__grid\"\r\n [disabled]=\"disabled()\"\r\n aria-label=\"Chip options\">\r\n @for (segment of currentValue(); track $index) {\r\n <mat-chip-row\r\n class=\"lib-chip-options-creator-editor__chip\"\r\n [editable]=\"true\"\r\n [aria-description]=\"'press enter to edit ' + segment\"\r\n (edited)=\"edit(segment, $event)\"\r\n (removed)=\"remove(segment)\">\r\n {{ segment }}\r\n <button matChipRemove [attr.aria-label]=\"'remove ' + segment\">\r\n <mat-icon>cancel</mat-icon>\r\n </button>\r\n </mat-chip-row>\r\n }\r\n <input\r\n class=\"lib-chip-options-creator-editor__input\"\r\n [placeholder]=\"placeholder() || 'New selection...'\"\r\n [matChipInputFor]=\"chipGrid\"\r\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\r\n [matChipInputAddOnBlur]=\"true\"\r\n (matChipInputTokenEnd)=\"add($event)\" />\r\n</mat-chip-grid>\r\n"],"names":["i1"],"mappings":";;;;;;;;;;AAkBA;;;;;;;;AAQG;MAaU,iCAAiC,CAAA;;AAoBnC,IAAA,cAAc;AAKd,IAAA,UAAU;AAEnB,IAAA,WAAA,GAAA;;AAzBS,QAAA,IAAA,CAAA,EAAE,GAAG,KAAK,CAAqB,SAAS,yEAAC;;AAEzC,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,+EAAC;;AAEhC,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,+EAAC;;AAEhC,QAAA,IAAA,CAAA,MAAM,GAAG,KAAK,CAAoC,EAAE,6EAAC;;AAErD,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAuB,SAAS,4EAAC;;AAE9C,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK,CAAS,EAAE,kFAAC;;QAG/B,IAAA,CAAA,WAAW,GAAG,MAAM,EAAwB;AAElC,QAAA,IAAA,CAAA,kBAAkB,GAAG,CAAC,KAAK,EAAE,KAAK,CAAU;;AAGtD,QAAA,IAAA,CAAA,cAAc,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AA,EAAA;;;;;"}
@@ -14,7 +14,7 @@ import { MatCardModule } from '@angular/material/card';
14
14
  import * as i5 from '@angular/material/tooltip';
15
15
  import { MatTooltipModule } from '@angular/material/tooltip';
16
16
  import { Subject } from 'rxjs';
17
- import { P as PREDICATE_OPERATORS, r as referencedTokens, h as evaluatePredicate, p as parseConditions, i as emptyCondition, s as serializeConditions, j as deriveObservedInputs } from './ngx-t-forms-ngx-t-forms-BA1CoCl_.mjs';
17
+ import { P as PREDICATE_OPERATORS, r as referencedTokens, i as evaluatePredicate, h as parseConditions, j as emptyCondition, s as serializeConditions, k as deriveObservedInputs } from './ngx-t-forms-ngx-t-forms-B3WhBGlD.mjs';
18
18
 
19
19
  /**
20
20
  * Internal editor implementing `MatFormFieldControl<ConditionalInputRule[]>` for
@@ -510,4 +510,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
510
510
  }], mapToData: [{ type: i0.Input, args: [{ isSignal: true, alias: "mapToData", required: false }] }], formInputs: [{ type: i0.Input, args: [{ isSignal: true, alias: "formInputs", required: false }] }], valueChanged: [{ type: i0.Output, args: ["valueChanged"] }] } });
511
511
 
512
512
  export { ConditionalDisplayConfigComponent };
513
- //# sourceMappingURL=ngx-t-forms-conditional-display-config.component-yJ5IORsS.mjs.map
513
+ //# sourceMappingURL=ngx-t-forms-conditional-display-config.component-p3dEGx1z.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ngx-t-forms-conditional-display-config.component-yJ5IORsS.mjs","sources":["../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/conditional-display-config/conditional-display-config.component.ts","../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/conditional-display-config/conditional-display-config.component.html"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n Input,\n type OnChanges,\n type OnDestroy,\n type SimpleChanges,\n ViewEncapsulation,\n computed,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\n\nimport { v4 as uuidv4 } from 'uuid';\n\nimport type { ConditionalInputRule, FormColumnInputs } from 'ngx-t-forms-types';\nimport { CalculationFunctions, InputDataTypes, InputTypes } from 'ngx-t-forms-types';\n\nimport { CommonModule } from '@angular/common';\nimport { NgControl } from '@angular/forms';\nimport { MatFormFieldControl } from '@angular/material/form-field';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatButtonToggleModule } from '@angular/material/button-toggle';\nimport { MatCardModule } from '@angular/material/card';\nimport { MatTooltipModule } from '@angular/material/tooltip';\nimport { Subject } from 'rxjs';\n\nimport { evaluatePredicate } from '../../../../shared/functions/array-access/predicate-dsl';\nimport type { IConfigElementError } from '../../t-dynamic-data-edit.component';\nimport {\n type FieldBinding,\n PREDICATE_OPERATORS,\n type ValidatorCondition,\n type ValidatorConditionGroup,\n deriveObservedInputs,\n emptyCondition,\n parseConditions,\n referencedTokens,\n serializeConditions,\n} from '../validators-config/validator-condition';\n\n/** A selectable field in the condition builder's field/value dropdowns. */\ninterface FieldOption {\n readonly variable: string;\n readonly label: string;\n readonly isSelf: boolean;\n /** A multiple-input column (lives inside a repeatable group). */\n readonly isMultiple: boolean;\n /** Whether the field holds a numeric value (gates numeric aggregates). */\n readonly numeric: boolean;\n /** The input read at runtime: a primary input id, or a list sub-item id. */\n readonly inputId: string;\n /** Row-array container id, for multiple-input columns. */\n readonly parentInputId?: string;\n}\n\n/** A friendly aggregate choice shown for a referenced list field. */\ninterface AggregateOption {\n readonly value: CalculationFunctions;\n readonly label: string;\n}\n\n/**\n * Internal editor implementing `MatFormFieldControl<ConditionalInputRule[]>` for\n * authoring a form input's **conditional display** rule.\n *\n * ### Relationship to `validators-config`\n *\n * This is `validators-config` minus `message` and `canOverride`, and minus the\n * multi-rule chip list. It reuses that editor's condition model verbatim —\n * `parseConditions` / `serializeConditions` / `emptyCondition` /\n * `deriveObservedInputs` / `PREDICATE_OPERATORS` — so an author who has written\n * a validator already knows how to write a display rule, and the engine reads\n * both through the same `readDep` dependency model.\n *\n * The one thing that differs is **polarity**, and the copy in the template leans\n * on it hard because getting it backwards is the obvious authoring mistake:\n *\n * | | Expression `true` means |\n * |---|---|\n * | a validator | the entry is **invalid** |\n * | a display rule | the field is **shown** |\n *\n * ### Why exactly one rule\n *\n * `conditionalInputConfig` is an array, and the engine combines multiple rules\n * with AND. This editor deliberately authors a **single** rule: the guided\n * builder already composes many conditions with All/Any inside one expression,\n * so a second rule would add a second, less visible combination layer that means\n * something subtly different. Keeping it to one makes the AND-across-rules\n * semantics unreachable through the UI — it exists only for hand-authored\n * configuration.\n *\n * ### Committing\n *\n * Unlike the validator editor there is no draft/Save cycle: with one rule and no\n * message to compose, every change commits immediately. A half-built condition\n * serialises to an empty expression, which the engine treats as *no rule* — so\n * an incomplete edit leaves the field visible rather than making it vanish\n * mid-authoring.\n *\n * NOTE: `MatFormFieldControl<T>` mandates plain mutable `value` / `disabled` /\n * `required` / `placeholder` / `id` members, `@Input()` decorators, the\n * `focused` / `touched` / `stateChanges` members, and the `useExisting`\n * provider. These are framework wiring, not defects — the CLAUDE.md bans on\n * `@Input()` / `useExisting` do not apply to MatFormFieldControl integration.\n */\n@Component({\n selector: 'lib-conditional-display-config',\n templateUrl: './conditional-display-config.component.html',\n styleUrls: ['./conditional-display-config.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.Emulated,\n imports: [\n CommonModule,\n MatIconModule,\n MatButtonModule,\n MatButtonToggleModule,\n MatCardModule,\n MatTooltipModule,\n ],\n providers: [{ provide: MatFormFieldControl, useExisting: ConditionalDisplayConfigComponent }],\n host: {\n 'class': 'lib-conditional-display-config',\n '[attr.id]': 'id',\n },\n})\nexport class ConditionalDisplayConfigComponent\n implements MatFormFieldControl<ConditionalInputRule[]>, OnChanges, OnDestroy {\n static nextId = 0;\n\n /** Emits whenever a piece of `MatFormFieldControl` state changes. */\n readonly stateChanges = new Subject<void>();\n readonly controlType = 'lib-conditional-display-config';\n\n id = `lib-conditional-display-config-${ConditionalDisplayConfigComponent.nextId++}`;\n placeholder = '';\n focused = false;\n touched = false;\n required = false;\n describedBy = '';\n autofilled: boolean | undefined = undefined;\n userAriaDescribedBy: string | undefined = undefined;\n disableAutomaticLabeling: boolean | undefined = undefined;\n\n /** Whether the editor is inert. Kept as `@Input()` for the MFC contract. */\n @Input() disabled = false;\n /** Current rule list. Kept as `@Input()` for the MFC contract. */\n @Input() value: ConditionalInputRule[] = [];\n /** Validation errors surfaced by the parent for error-state derivation. */\n @Input() errors: IConfigElementError[] | undefined = [];\n\n /** The input that owns this rule (for multiple-input scopes + self-labelling). */\n readonly mapToData = input<FormColumnInputs | undefined>(undefined);\n /** Available form inputs offered as variables. */\n readonly formInputs = input<Array<FormColumnInputs>>([]);\n\n /** Emits the full rule list whenever it changes. */\n readonly valueChanged = output<ConditionalInputRule[]>();\n\n /** Operator choices shared with the validator + array-access builders. */\n protected readonly operators = PREDICATE_OPERATORS;\n\n /** Aggregate choices for a list field, with non-technical labels. */\n protected readonly aggregates: readonly AggregateOption[] = [\n { value: CalculationFunctions.Sum, label: 'total' },\n { value: CalculationFunctions.Avg, label: 'average' },\n { value: CalculationFunctions.Min, label: 'lowest' },\n { value: CalculationFunctions.Max, label: 'highest' },\n { value: CalculationFunctions.Count, label: 'count' },\n ];\n\n readonly #elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n readonly ngControl = inject(NgControl, { self: true, optional: true });\n\n /** Guided builder model mirroring the current expression. */\n readonly #group = signal<ValidatorConditionGroup>({ connector: '&&', conditions: [] });\n protected readonly group = this.#group.asReadonly();\n\n /** Whether the rule is being edited as a raw expression instead of guided rows. */\n readonly #raw = signal(false);\n protected readonly raw = this.#raw.asReadonly();\n\n /** The live expression text. Mirrors `value[0].expression`. */\n readonly #expression = signal('');\n protected readonly expression = this.#expression.asReadonly();\n\n /** Chosen aggregate per referenced list variable (keyed by variable name). */\n readonly #functions = signal<Record<string, CalculationFunctions>>({});\n\n /**\n * The list this editor last emitted. Used to tell an incoming `value` binding\n * that is genuinely new (a different input opened for editing) from the echo\n * of our own commit — re-seeding on the echo would rebuild the guided model\n * from the serialised text on every keystroke and fight the user's edit.\n */\n #lastCommitted: ConditionalInputRule[] | undefined;\n\n /**\n * Fields the builder can reference: every primary input plus every\n * multiple-input column. `inputId` resolves to the composite id for a sub-row\n * field, which is exactly the key the engine's visibility map uses — the same\n * resolution the validator editor already relies on.\n */\n protected readonly fieldOptions = computed<readonly FieldOption[]>(() => {\n const self = this.mapToData();\n const selfId = self?.id;\n const options: FieldOption[] = [];\n for (const input of this.formInputs()) {\n if (!input.formControlName) continue;\n const group = input.multipleInputInEditId;\n options.push({\n variable: input.formControlName,\n label: input.label || input.formControlName,\n isSelf: input.id === selfId,\n isMultiple: !!group,\n numeric: this.#isNumeric(input),\n inputId: group ? input.id : (input.originalId ?? input.id),\n parentInputId: group,\n });\n }\n return options;\n });\n\n /**\n * Primary (scalar) fields, minus this input itself.\n *\n * A display rule that references its own field can never fire: the engine's\n * self-edge guard resolves the owning input to `undefined` BEFORE the\n * visibility gate (it has to, or evaluating `vis(X)` would recurse into\n * `vis(X)`). Offering it would let an author build a rule that silently never\n * matches, so it is not offered.\n */\n protected readonly directFields = computed<readonly FieldOption[]>(() =>\n this.fieldOptions().filter((f) => !f.isMultiple && !f.isSelf),\n );\n\n /** Multiple-input columns, for the second dropdown group. */\n protected readonly listFields = computed<readonly FieldOption[]>(() =>\n this.fieldOptions().filter((f) => f.isMultiple && !f.isSelf),\n );\n\n /** Field option keyed by its expression variable, for operand lookups. */\n readonly #fieldByVariable = computed<ReadonlyMap<string, FieldOption>>(\n () => new Map(this.fieldOptions().map((f) => [f.variable, f])),\n );\n\n /** Multiple-input columns actually referenced by the current expression. */\n protected readonly referencedListFields = computed<readonly FieldOption[]>(() => {\n const tokens = referencedTokens(this.#expression());\n return this.listFields().filter((f) => tokens.has(f.variable));\n });\n\n /**\n * Multiple-input variables that MUST be aggregated: a list column compared\n * against a non-list operand has to be reduced to a single value. In raw mode\n * operand pairing cannot be analysed, so every referenced list column counts.\n */\n protected readonly requiredAggregateVariables = computed<ReadonlySet<string>>(() => {\n if (this.#raw()) {\n return new Set(this.referencedListFields().map((f) => f.variable));\n }\n const byVariable = this.#fieldByVariable();\n const required = new Set<string>();\n for (const cond of this.#group().conditions) {\n const left = byVariable.get(cond.field);\n const right = cond.compareTo === 'field' ? byVariable.get(cond.value) : undefined;\n const leftMultiple = !!left?.isMultiple;\n const rightMultiple = !!right?.isMultiple;\n if (leftMultiple && !rightMultiple) required.add(cond.field);\n if (rightMultiple && !leftMultiple && right) required.add(right.variable);\n }\n return required;\n });\n\n /** Aggregates offered for a field: numeric columns get all, others only count. */\n protected aggregatesFor(field: FieldOption): readonly AggregateOption[] {\n return field.numeric\n ? this.aggregates\n : this.aggregates.filter((a) => a.value === CalculationFunctions.Count);\n }\n\n /** Whether a referenced list column is required to have an aggregate. */\n protected isAggregateRequired(variable: string): boolean {\n return this.requiredAggregateVariables().has(variable);\n }\n\n /** Human-readable syntax error for the raw editor, or `null` when valid/empty. */\n protected readonly syntaxError = computed<string | null>(() => {\n const expression = this.#expression();\n if (expression.trim() === '') return null;\n try {\n evaluatePredicate(expression, {});\n return null;\n } catch (error: unknown) {\n return error instanceof Error ? error.message : 'The expression syntax is invalid.';\n }\n });\n\n /** Whether the current expression can be edited in the guided builder. */\n protected readonly canUseGuided = computed<boolean>(\n () => parseConditions(this.#expression(), this.#fieldNameSet()) !== null,\n );\n\n /** Whether a rule is in force right now. */\n protected readonly hasRule = computed<boolean>(() => this.#expression().trim() !== '');\n\n /**\n * Whether the guided builder currently holds a condition that will be DROPPED\n * on serialisation — no field chosen, or a field-vs-field comparison with no\n * right-hand field. The template surfaces this as a one-line pending hint,\n * because the alternative is a silently inert rule: the author adds a row,\n * assumes the field is now conditional, and nothing tells them it is not.\n *\n * A typed value of `''` is NOT incomplete — `x === \"\"` is the legitimate\n * \"while the field is empty\" rule.\n */\n protected readonly hasIncompleteCondition = computed<boolean>(() => {\n if (this.#raw()) return false;\n return this.#group().conditions.some(\n (cond) =>\n cond.field.trim() === '' ||\n (cond.compareTo === 'field' && cond.value.trim() === ''),\n );\n });\n\n // MatFormFieldControl reads these as plain getters during its own change\n // detection, so they stay getters rather than `computed()` signals.\n\n get empty(): boolean {\n return !this.#currentRule();\n }\n\n get shouldLabelFloat(): boolean {\n return this.focused || !this.empty;\n }\n\n get errorState(): boolean {\n const ngControlError = this.ngControl?.errors != null;\n const externalError = (this.errors?.length ?? 0) > 0 && this.touched;\n return ngControlError || externalError;\n }\n\n setDescribedByIds(ids: string[]): void {\n this.describedBy = ids.join(' ');\n const el = this.#elementRef.nativeElement;\n const controlElement = el.querySelector('.lib-conditional-display-config__body');\n controlElement?.setAttribute('aria-describedby', this.describedBy);\n this.stateChanges.next();\n }\n\n onContainerClick(): void {\n this.markAsTouched();\n this.stateChanges.next();\n }\n\n onTouched: () => void = () => { };\n\n markAsTouched(): void {\n if (!this.touched) {\n this.touched = true;\n this.onTouched();\n this.stateChanges.next();\n }\n }\n\n /** Tear down the MFC state stream so subscribers do not leak. */\n ngOnDestroy(): void {\n this.stateChanges.complete();\n }\n\n /**\n * Seeds the guided builder from the bound `value`.\n *\n * Runs in `ngOnChanges`, not from the template and not from a `value` setter,\n * for two reasons:\n *\n * - **Signal writes.** Seeding writes `#group` / `#raw` / `#expression`.\n * Doing that from a template getter throws NG0600 (writing to signals while\n * Angular renders).\n * - **Binding order.** The host template binds `[value]` *before*\n * `[formInputs]`, and parsing an expression into guided rows needs the field\n * list to recognise its variable names. A `value` setter would parse against\n * an empty field set and drop every rule into Advanced mode. `ngOnChanges`\n * runs after the whole binding pass, so both are present.\n */\n ngOnChanges(changes: SimpleChanges): void {\n if (!changes['value']) return;\n if (this.value === this.#lastCommitted) return; // our own echo\n this.#seed();\n }\n\n #seed(): void {\n const rule = this.#currentRule();\n const expression = rule?.expression ?? '';\n this.#expression.set(expression);\n this.#functions.set(this.#functionsFromRule(rule));\n const parsed = parseConditions(expression, this.#fieldNameSet());\n if (parsed) {\n this.#group.set(parsed);\n this.#raw.set(false);\n } else if (expression.trim() !== '') {\n // An expression the guided builder cannot represent (grouping, mixed\n // connectors, negation) opens in Advanced and round-trips unchanged.\n this.#raw.set(true);\n } else {\n this.#group.set({ connector: '&&', conditions: [] });\n this.#raw.set(false);\n }\n }\n\n // ---- guided condition builder ------------------------------------------\n\n /** Switch the All/Any connector joining the conditions. */\n protected setConnector(connector: '&&' | '||'): void {\n this.#applyGroup({ ...this.#group(), connector });\n }\n\n /**\n * Append a fresh, **field-less** condition.\n *\n * The validator editor defaults the field to the input being validated, which\n * is nearly always what its author wants. Here the owning field is explicitly\n * excluded (a rule cannot observe itself), so any default would be an\n * arbitrary pick — and it would not be inert. `serializeConditions` treats a\n * typed value of `''` as complete, because `x === \"\"` is a legitimate \"is\n * empty\" rule, so a pre-filled field would turn a single click on \"Add\n * condition\" into a live rule that starts hiding the field. Leaving the field\n * unset serialises to nothing, so the rule only exists once the author has\n * actually said what it is about.\n */\n protected addCondition(): void {\n const group = this.#group();\n this.#applyGroup({\n ...group,\n conditions: [...group.conditions, emptyCondition('')],\n });\n }\n\n /** Apply a partial change to the condition at `index`. */\n protected updateCondition(index: number, patch: Partial<ValidatorCondition>): void {\n const group = this.#group();\n const conditions = group.conditions.map((c, i) => (i === index ? { ...c, ...patch } : c));\n this.#applyGroup({ ...group, conditions });\n }\n\n /** Flip a condition between comparing to a typed value and another field. */\n protected toggleCompareTo(index: number): void {\n const condition = this.#group().conditions[index];\n if (!condition) return;\n if (condition.compareTo === 'value') {\n const field = this.fieldOptions().find((f) => f.variable !== condition.field && !f.isSelf);\n this.updateCondition(index, { compareTo: 'field', value: field?.variable ?? '' });\n } else {\n this.updateCondition(index, { compareTo: 'value', value: '' });\n }\n }\n\n /** Remove the condition at `index`. */\n protected removeCondition(index: number): void {\n const group = this.#group();\n this.#applyGroup({ ...group, conditions: group.conditions.filter((_, i) => i !== index) });\n }\n\n /**\n * Choose (or clear, by re-clicking) the aggregate that reduces a referenced\n * list field to a single value.\n */\n protected setFunction(variable: string, fn: CalculationFunctions): void {\n this.#functions.update((current) => {\n const next = { ...current };\n if (next[variable] === fn) {\n delete next[variable];\n } else {\n next[variable] = fn;\n }\n return next;\n });\n // The expression text is unchanged, but the observed deps now carry the\n // aggregate — re-commit so inputsObservedForChanges reflects the choice.\n this.#commitExpression(this.#expression());\n }\n\n /** The aggregate currently chosen for a list variable, if any. */\n protected currentFunction(variable: string): CalculationFunctions | undefined {\n return this.#functions()[variable];\n }\n\n /** Replace the raw expression as the user types. */\n protected onExpressionInput(event: Event): void {\n this.#commitExpression((event.target as HTMLTextAreaElement).value);\n }\n\n /** Switch to the raw expression editor. */\n protected useRaw(): void {\n this.#raw.set(true);\n }\n\n /** Switch back to the guided builder, reparsing the current expression. */\n protected useGuided(): void {\n const parsed = parseConditions(this.#expression(), this.#fieldNameSet());\n if (!parsed) return;\n this.#group.set(parsed);\n this.#raw.set(false);\n }\n\n /**\n * Remove the rule entirely — the field becomes unconditionally visible again.\n *\n * Commits an empty array rather than a rule with a blank expression, so the\n * engine builds no visibility signal at all for this input and the form pays\n * nothing for a rule that no longer exists.\n */\n protected clearRule(): void {\n this.#group.set({ connector: '&&', conditions: [] });\n this.#functions.set({});\n this.#expression.set('');\n this.#raw.set(false);\n this.#commit([]);\n }\n\n /** Read the value-event target as a string. */\n protected inputValue(event: Event): string {\n return (event.target as HTMLInputElement | HTMLSelectElement).value;\n }\n\n // ---- internal ----------------------------------------------------------\n\n /** The single rule this editor owns, if one is bound. */\n #currentRule(): ConditionalInputRule | undefined {\n return this.value?.[0];\n }\n\n /** Set of field variable names the builder recognises (for parsing). */\n #fieldNameSet(): ReadonlySet<string> {\n return new Set(this.fieldOptions().map((f) => f.variable));\n }\n\n /** Whether an input carries a numeric data type. */\n #isNumeric(input: FormColumnInputs): boolean {\n return input.dataType === InputDataTypes.Number || input.type === InputTypes.Number;\n }\n\n /** Recover the per-variable aggregate choices from a rule's observed inputs. */\n #functionsFromRule(rule: ConditionalInputRule | undefined): Record<string, CalculationFunctions> {\n const map: Record<string, CalculationFunctions> = {};\n for (const observed of rule?.inputsObservedForChanges ?? []) {\n if (observed.function) map[observed.variable] = observed.function;\n }\n return map;\n }\n\n /** Store a builder change: update the model, then serialise + commit. */\n #applyGroup(next: ValidatorConditionGroup): void {\n this.#group.set(next);\n this.#commitExpression(serializeConditions(next));\n }\n\n /**\n * Write an expression onto the rule, re-deriving its observed-input deps.\n *\n * An expression that serialises to nothing means the author has not finished —\n * commit an empty list so the engine treats the input as unconditional. A\n * half-built rule must never hide the field it is being written on.\n */\n #commitExpression(expression: string): void {\n this.#expression.set(expression);\n if (expression.trim() === '') {\n this.#commit([]);\n return;\n }\n const fields: readonly FieldBinding[] = this.fieldOptions();\n const existing = this.#currentRule();\n const rule: ConditionalInputRule = {\n // Preserve every legacy descriptive field an older form may carry; the\n // engine ignores them, but an external consumer still renders them.\n ...existing,\n id: existing?.id ?? uuidv4(),\n expression,\n inputsObservedForChanges: deriveObservedInputs(expression, fields, this.#functions()),\n };\n this.#commit([rule]);\n }\n\n /** Single mutation path: store the new list and notify the parent. */\n #commit(next: ConditionalInputRule[]): void {\n this.#lastCommitted = next;\n this.value = next;\n this.markAsTouched();\n this.stateChanges.next();\n this.valueChanged.emit([...next]);\n }\n}\n","<section class=\"lib-conditional-display-config__body\">\n @if (!hasRule()) {\n <p class=\"lib-conditional-display-config__hint\">\n Appears only while a condition you define is true. Leave empty to always show.\n </p>\n }\n\n <div class=\"lib-conditional-display-config__condition-head\">\n <span class=\"lib-conditional-display-config__f-label\">Show this field when</span>\n @if (!raw() && group().conditions.length > 1) {\n <mat-button-toggle-group\n class=\"lib-conditional-display-config__seg\"\n [value]=\"group().connector\"\n hideSingleSelectionIndicator\n (change)=\"setConnector($event.value)\"\n aria-label=\"Combine conditions\"\n >\n <mat-button-toggle value=\"&&\">All</mat-button-toggle>\n <mat-button-toggle value=\"||\">Any</mat-button-toggle>\n </mat-button-toggle-group>\n }\n </div>\n\n @if (raw()) {\n <textarea\n class=\"lib-conditional-display-config__control lib-conditional-display-config__textarea lib-conditional-display-config__mono\"\n rows=\"2\"\n [value]=\"expression()\"\n [disabled]=\"disabled\"\n (input)=\"onExpressionInput($event)\"\n aria-label=\"Visibility expression\"\n placeholder='e.g. contactMethod === \"phone\"'\n ></textarea>\n @if (syntaxError(); as error) {\n <p class=\"lib-conditional-display-config__error\">\n <mat-icon class=\"lib-conditional-display-config__error-icon\">error_outline</mat-icon>\n <span>{{ error }}</span>\n </p>\n } @else {\n <p class=\"lib-conditional-display-config__sub-hint\">\n True = shown. Use field names with <code>===</code>, <code>&gt;</code>, <code>includes</code> …\n </p>\n }\n } @else {\n\n @if (fieldOptions().length === 0) {\n <p class=\"lib-conditional-display-config__sub-hint\">\n No other fields available yet — switch to Advanced to type an expression.\n </p>\n }\n\n @for (cond of group().conditions; track $index; let first = $first) {\n @if (!first) {\n <span class=\"lib-conditional-display-config__connector\" aria-hidden=\"true\">\n {{ group().connector === '&&' ? 'and' : 'or' }}\n </span>\n }\n <div class=\"lib-conditional-display-config__cond\">\n <label class=\"lib-conditional-display-config__field\">\n <span class=\"lib-conditional-display-config__f-label\">Field</span>\n <select\n class=\"lib-conditional-display-config__control\"\n [class.lib-conditional-display-config__control--invalid]=\"!cond.field\"\n [disabled]=\"disabled\"\n (change)=\"updateCondition($index, { field: inputValue($event) })\"\n >\n <option value=\"\" disabled [selected]=\"!cond.field\">Choose…</option>\n @if (directFields().length) {\n <optgroup label=\"Fields\">\n @for (f of directFields(); track f.variable) {\n <option [value]=\"f.variable\" [selected]=\"f.variable === cond.field\">{{ f.label }}</option>\n }\n </optgroup>\n }\n @if (listFields().length) {\n <optgroup label=\"List fields\">\n @for (f of listFields(); track f.variable) {\n <option [value]=\"f.variable\" [selected]=\"f.variable === cond.field\">{{ f.label }}</option>\n }\n </optgroup>\n }\n </select>\n </label>\n\n <label class=\"lib-conditional-display-config__field\">\n <span class=\"lib-conditional-display-config__f-label\">Condition</span>\n <select\n class=\"lib-conditional-display-config__control\"\n [disabled]=\"disabled\"\n (change)=\"updateCondition($index, { operator: inputValue($event) })\"\n >\n @for (op of operators; track op.value) {\n <option [value]=\"op.value\" [selected]=\"op.value === cond.operator\">{{ op.label }}</option>\n }\n </select>\n </label>\n\n <div class=\"lib-conditional-display-config__field lib-conditional-display-config__field--value\">\n <span class=\"lib-conditional-display-config__f-label\">\n {{ cond.compareTo === 'field' ? 'Other field' : 'Value' }}\n </span>\n <div class=\"lib-conditional-display-config__value\">\n @if (cond.compareTo === 'field') {\n <select\n class=\"lib-conditional-display-config__control\"\n [class.lib-conditional-display-config__control--invalid]=\"!cond.value\"\n [disabled]=\"disabled\"\n (change)=\"updateCondition($index, { value: inputValue($event) })\"\n >\n <option value=\"\" disabled [selected]=\"!cond.value\">Choose…</option>\n @if (directFields().length) {\n <optgroup label=\"Fields\">\n @for (f of directFields(); track f.variable) {\n <option [value]=\"f.variable\" [selected]=\"f.variable === cond.value\">{{ f.label }}</option>\n }\n </optgroup>\n }\n @if (listFields().length) {\n <optgroup label=\"List fields\">\n @for (f of listFields(); track f.variable) {\n <option [value]=\"f.variable\" [selected]=\"f.variable === cond.value\">{{ f.label }}</option>\n }\n </optgroup>\n }\n </select>\n } @else {\n <input\n class=\"lib-conditional-display-config__control\"\n [value]=\"cond.value\"\n [disabled]=\"disabled\"\n (input)=\"updateCondition($index, { value: inputValue($event) })\"\n placeholder=\"leave empty for “is empty”\"\n />\n }\n <button\n type=\"button\"\n class=\"lib-conditional-display-config__icon-btn\"\n [disabled]=\"disabled\"\n (click)=\"toggleCompareTo($index)\"\n [attr.aria-label]=\"\n cond.compareTo === 'field' ? 'Compare to a typed value' : 'Compare to another field'\n \"\n [matTooltip]=\"\n cond.compareTo === 'field' ? 'Compare to a typed value' : 'Compare to another field'\n \"\n >\n <mat-icon>{{ cond.compareTo === 'field' ? 'edit' : 'link' }}</mat-icon>\n </button>\n <button\n type=\"button\"\n class=\"lib-conditional-display-config__icon-btn\"\n [disabled]=\"disabled\"\n (click)=\"removeCondition($index)\"\n matTooltip=\"Remove condition\"\n aria-label=\"Remove condition\"\n >\n <mat-icon>close</mat-icon>\n </button>\n </div>\n </div>\n </div>\n }\n\n <button\n type=\"button\"\n class=\"lib-conditional-display-config__link\"\n [disabled]=\"disabled\"\n (click)=\"addCondition()\"\n >\n <mat-icon>add</mat-icon> Add condition\n </button>\n }\n\n @if (hasIncompleteCondition()) {\n <p class=\"lib-conditional-display-config__sub-hint lib-conditional-display-config__sub-hint--pending\">\n <mat-icon class=\"lib-conditional-display-config__pending-icon\">pending</mat-icon>\n <span>Unfinished conditions are ignored — pick a field to activate the rule.</span>\n </p>\n }\n\n @if (referencedListFields().length) {\n <div class=\"lib-conditional-display-config__lists\">\n <span class=\"lib-conditional-display-config__f-label\">Combine each list</span>\n @for (f of referencedListFields(); track f.variable) {\n <div\n class=\"lib-conditional-display-config__list-row\"\n [class.lib-conditional-display-config__list-row--unset]=\"\n isAggregateRequired(f.variable) && !currentFunction(f.variable)\n \"\n >\n <span class=\"lib-conditional-display-config__list-name\">{{ f.label }}</span>\n <div class=\"lib-conditional-display-config__agg\" role=\"group\" [attr.aria-label]=\"'Combine ' + f.label\">\n @for (agg of aggregatesFor(f); track agg.value) {\n <button\n type=\"button\"\n class=\"lib-conditional-display-config__agg-chip\"\n [class.lib-conditional-display-config__agg-chip--on]=\"currentFunction(f.variable) === agg.value\"\n [disabled]=\"disabled\"\n (click)=\"setFunction(f.variable, agg.value)\"\n >\n {{ agg.label }}\n </button>\n }\n </div>\n </div>\n }\n </div>\n }\n\n @if (hasRule()) {\n <p class=\"lib-conditional-display-config__summary\">\n While hidden, this field is removed from the form — nothing is submitted and\n its validation cannot block.\n </p>\n\n @if (!raw()) {\n <details class=\"lib-conditional-display-config__preview\">\n <summary class=\"lib-conditional-display-config__preview-summary\">Expression</summary>\n <code>{{ expression() }}</code>\n </details>\n }\n }\n\n <div class=\"lib-conditional-display-config__foot\">\n @if (raw()) {\n <button\n type=\"button\"\n class=\"lib-conditional-display-config__link\"\n [disabled]=\"!canUseGuided()\"\n [matTooltip]=\"canUseGuided() ? '' : 'This expression is too advanced for the guided builder'\"\n (click)=\"useGuided()\"\n >\n <mat-icon>view_module</mat-icon> Guided\n </button>\n } @else {\n <button type=\"button\" class=\"lib-conditional-display-config__link\" (click)=\"useRaw()\">\n <mat-icon>code</mat-icon> Advanced\n </button>\n }\n\n @if (hasRule()) {\n <button\n type=\"button\"\n class=\"lib-conditional-display-config__link lib-conditional-display-config__link--danger\"\n [disabled]=\"disabled\"\n matTooltip=\"Remove the rule — the field becomes always visible\"\n (click)=\"clearRule()\"\n >\n <mat-icon>visibility</mat-icon> Always show\n </button>\n }\n </div>\n</section>\n"],"names":["uuidv4","i1","i2","i3"],"mappings":";;;;;;;;;;;;;;;;;;AAkEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CG;MAqBU,iCAAiC,CAAA;AApB9C,IAAA,WAAA,GAAA;;AAyBW,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,OAAO,EAAQ;QAClC,IAAA,CAAA,WAAW,GAAG,gCAAgC;AAEvD,QAAA,IAAA,CAAA,EAAE,GAAG,CAAA,+BAAA,EAAkC,iCAAiC,CAAC,MAAM,EAAE,EAAE;QACnF,IAAA,CAAA,WAAW,GAAG,EAAE;QAChB,IAAA,CAAA,OAAO,GAAG,KAAK;QACf,IAAA,CAAA,OAAO,GAAG,KAAK;QACf,IAAA,CAAA,QAAQ,GAAG,KAAK;QAChB,IAAA,CAAA,WAAW,GAAG,EAAE;QAChB,IAAA,CAAA,UAAU,GAAwB,SAAS;QAC3C,IAAA,CAAA,mBAAmB,GAAuB,SAAS;QACnD,IAAA,CAAA,wBAAwB,GAAwB,SAAS;;QAGhD,IAAA,CAAA,QAAQ,GAAG,KAAK;;QAEhB,IAAA,CAAA,KAAK,GAA2B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,UAAA,EAAA,CAAA;kBApB7C,SAAS;+BACE,gCAAgC,EAAA,eAAA,EAGzB,uBAAuB,CAAC,MAAM,iBAChC,iBAAiB,CAAC,QAAQ,EAAA,OAAA,EAChC;wBACP,YAAY;wBACZ,aAAa;wBACb,eAAe;wBACf,qBAAqB;wBACrB,aAAa;wBACb,gBAAgB;qBACjB,EAAA,SAAA,EACU,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAA,iCAAmC,EAAE,CAAC,EAAA,IAAA,EACvF;AACJ,wBAAA,OAAO,EAAE,gCAAgC;AACzC,wBAAA,WAAW,EAAE,IAAI;AAClB,qBAAA,EAAA,QAAA,EAAA,44SAAA,EAAA,MAAA,EAAA,CAAA,igNAAA,CAAA,EAAA;;sBAqBA;;sBAEA;;sBAEA;;;;;"}
1
+ {"version":3,"file":"ngx-t-forms-conditional-display-config.component-p3dEGx1z.mjs","sources":["../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/conditional-display-config/conditional-display-config.component.ts","../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/conditional-display-config/conditional-display-config.component.html"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n Input,\n type OnChanges,\n type OnDestroy,\n type SimpleChanges,\n ViewEncapsulation,\n computed,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\n\nimport { v4 as uuidv4 } from 'uuid';\n\nimport type { ConditionalInputRule, FormColumnInputs } from 'ngx-t-forms-types';\nimport { CalculationFunctions, InputDataTypes, InputTypes } from 'ngx-t-forms-types';\n\nimport { CommonModule } from '@angular/common';\nimport { NgControl } from '@angular/forms';\nimport { MatFormFieldControl } from '@angular/material/form-field';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatButtonToggleModule } from '@angular/material/button-toggle';\nimport { MatCardModule } from '@angular/material/card';\nimport { MatTooltipModule } from '@angular/material/tooltip';\nimport { Subject } from 'rxjs';\n\nimport { evaluatePredicate } from '../../../../shared/functions/array-access/predicate-dsl';\nimport type { IConfigElementError } from '../../t-dynamic-data-edit.component';\nimport {\n type FieldBinding,\n PREDICATE_OPERATORS,\n type ValidatorCondition,\n type ValidatorConditionGroup,\n deriveObservedInputs,\n emptyCondition,\n parseConditions,\n referencedTokens,\n serializeConditions,\n} from '../validators-config/validator-condition';\n\n/** A selectable field in the condition builder's field/value dropdowns. */\ninterface FieldOption {\n readonly variable: string;\n readonly label: string;\n readonly isSelf: boolean;\n /** A multiple-input column (lives inside a repeatable group). */\n readonly isMultiple: boolean;\n /** Whether the field holds a numeric value (gates numeric aggregates). */\n readonly numeric: boolean;\n /** The input read at runtime: a primary input id, or a list sub-item id. */\n readonly inputId: string;\n /** Row-array container id, for multiple-input columns. */\n readonly parentInputId?: string;\n}\n\n/** A friendly aggregate choice shown for a referenced list field. */\ninterface AggregateOption {\n readonly value: CalculationFunctions;\n readonly label: string;\n}\n\n/**\n * Internal editor implementing `MatFormFieldControl<ConditionalInputRule[]>` for\n * authoring a form input's **conditional display** rule.\n *\n * ### Relationship to `validators-config`\n *\n * This is `validators-config` minus `message` and `canOverride`, and minus the\n * multi-rule chip list. It reuses that editor's condition model verbatim —\n * `parseConditions` / `serializeConditions` / `emptyCondition` /\n * `deriveObservedInputs` / `PREDICATE_OPERATORS` — so an author who has written\n * a validator already knows how to write a display rule, and the engine reads\n * both through the same `readDep` dependency model.\n *\n * The one thing that differs is **polarity**, and the copy in the template leans\n * on it hard because getting it backwards is the obvious authoring mistake:\n *\n * | | Expression `true` means |\n * |---|---|\n * | a validator | the entry is **invalid** |\n * | a display rule | the field is **shown** |\n *\n * ### Why exactly one rule\n *\n * `conditionalInputConfig` is an array, and the engine combines multiple rules\n * with AND. This editor deliberately authors a **single** rule: the guided\n * builder already composes many conditions with All/Any inside one expression,\n * so a second rule would add a second, less visible combination layer that means\n * something subtly different. Keeping it to one makes the AND-across-rules\n * semantics unreachable through the UI — it exists only for hand-authored\n * configuration.\n *\n * ### Committing\n *\n * Unlike the validator editor there is no draft/Save cycle: with one rule and no\n * message to compose, every change commits immediately. A half-built condition\n * serialises to an empty expression, which the engine treats as *no rule* — so\n * an incomplete edit leaves the field visible rather than making it vanish\n * mid-authoring.\n *\n * NOTE: `MatFormFieldControl<T>` mandates plain mutable `value` / `disabled` /\n * `required` / `placeholder` / `id` members, `@Input()` decorators, the\n * `focused` / `touched` / `stateChanges` members, and the `useExisting`\n * provider. These are framework wiring, not defects — the CLAUDE.md bans on\n * `@Input()` / `useExisting` do not apply to MatFormFieldControl integration.\n */\n@Component({\n selector: 'lib-conditional-display-config',\n templateUrl: './conditional-display-config.component.html',\n styleUrls: ['./conditional-display-config.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.Emulated,\n imports: [\n CommonModule,\n MatIconModule,\n MatButtonModule,\n MatButtonToggleModule,\n MatCardModule,\n MatTooltipModule,\n ],\n providers: [{ provide: MatFormFieldControl, useExisting: ConditionalDisplayConfigComponent }],\n host: {\n 'class': 'lib-conditional-display-config',\n '[attr.id]': 'id',\n },\n})\nexport class ConditionalDisplayConfigComponent\n implements MatFormFieldControl<ConditionalInputRule[]>, OnChanges, OnDestroy {\n static nextId = 0;\n\n /** Emits whenever a piece of `MatFormFieldControl` state changes. */\n readonly stateChanges = new Subject<void>();\n readonly controlType = 'lib-conditional-display-config';\n\n id = `lib-conditional-display-config-${ConditionalDisplayConfigComponent.nextId++}`;\n placeholder = '';\n focused = false;\n touched = false;\n required = false;\n describedBy = '';\n autofilled: boolean | undefined = undefined;\n userAriaDescribedBy: string | undefined = undefined;\n disableAutomaticLabeling: boolean | undefined = undefined;\n\n /** Whether the editor is inert. Kept as `@Input()` for the MFC contract. */\n @Input() disabled = false;\n /** Current rule list. Kept as `@Input()` for the MFC contract. */\n @Input() value: ConditionalInputRule[] = [];\n /** Validation errors surfaced by the parent for error-state derivation. */\n @Input() errors: IConfigElementError[] | undefined = [];\n\n /** The input that owns this rule (for multiple-input scopes + self-labelling). */\n readonly mapToData = input<FormColumnInputs | undefined>(undefined);\n /** Available form inputs offered as variables. */\n readonly formInputs = input<Array<FormColumnInputs>>([]);\n\n /** Emits the full rule list whenever it changes. */\n readonly valueChanged = output<ConditionalInputRule[]>();\n\n /** Operator choices shared with the validator + array-access builders. */\n protected readonly operators = PREDICATE_OPERATORS;\n\n /** Aggregate choices for a list field, with non-technical labels. */\n protected readonly aggregates: readonly AggregateOption[] = [\n { value: CalculationFunctions.Sum, label: 'total' },\n { value: CalculationFunctions.Avg, label: 'average' },\n { value: CalculationFunctions.Min, label: 'lowest' },\n { value: CalculationFunctions.Max, label: 'highest' },\n { value: CalculationFunctions.Count, label: 'count' },\n ];\n\n readonly #elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n readonly ngControl = inject(NgControl, { self: true, optional: true });\n\n /** Guided builder model mirroring the current expression. */\n readonly #group = signal<ValidatorConditionGroup>({ connector: '&&', conditions: [] });\n protected readonly group = this.#group.asReadonly();\n\n /** Whether the rule is being edited as a raw expression instead of guided rows. */\n readonly #raw = signal(false);\n protected readonly raw = this.#raw.asReadonly();\n\n /** The live expression text. Mirrors `value[0].expression`. */\n readonly #expression = signal('');\n protected readonly expression = this.#expression.asReadonly();\n\n /** Chosen aggregate per referenced list variable (keyed by variable name). */\n readonly #functions = signal<Record<string, CalculationFunctions>>({});\n\n /**\n * The list this editor last emitted. Used to tell an incoming `value` binding\n * that is genuinely new (a different input opened for editing) from the echo\n * of our own commit — re-seeding on the echo would rebuild the guided model\n * from the serialised text on every keystroke and fight the user's edit.\n */\n #lastCommitted: ConditionalInputRule[] | undefined;\n\n /**\n * Fields the builder can reference: every primary input plus every\n * multiple-input column. `inputId` resolves to the composite id for a sub-row\n * field, which is exactly the key the engine's visibility map uses — the same\n * resolution the validator editor already relies on.\n */\n protected readonly fieldOptions = computed<readonly FieldOption[]>(() => {\n const self = this.mapToData();\n const selfId = self?.id;\n const options: FieldOption[] = [];\n for (const input of this.formInputs()) {\n if (!input.formControlName) continue;\n const group = input.multipleInputInEditId;\n options.push({\n variable: input.formControlName,\n label: input.label || input.formControlName,\n isSelf: input.id === selfId,\n isMultiple: !!group,\n numeric: this.#isNumeric(input),\n inputId: group ? input.id : (input.originalId ?? input.id),\n parentInputId: group,\n });\n }\n return options;\n });\n\n /**\n * Primary (scalar) fields, minus this input itself.\n *\n * A display rule that references its own field can never fire: the engine's\n * self-edge guard resolves the owning input to `undefined` BEFORE the\n * visibility gate (it has to, or evaluating `vis(X)` would recurse into\n * `vis(X)`). Offering it would let an author build a rule that silently never\n * matches, so it is not offered.\n */\n protected readonly directFields = computed<readonly FieldOption[]>(() =>\n this.fieldOptions().filter((f) => !f.isMultiple && !f.isSelf),\n );\n\n /** Multiple-input columns, for the second dropdown group. */\n protected readonly listFields = computed<readonly FieldOption[]>(() =>\n this.fieldOptions().filter((f) => f.isMultiple && !f.isSelf),\n );\n\n /** Field option keyed by its expression variable, for operand lookups. */\n readonly #fieldByVariable = computed<ReadonlyMap<string, FieldOption>>(\n () => new Map(this.fieldOptions().map((f) => [f.variable, f])),\n );\n\n /** Multiple-input columns actually referenced by the current expression. */\n protected readonly referencedListFields = computed<readonly FieldOption[]>(() => {\n const tokens = referencedTokens(this.#expression());\n return this.listFields().filter((f) => tokens.has(f.variable));\n });\n\n /**\n * Multiple-input variables that MUST be aggregated: a list column compared\n * against a non-list operand has to be reduced to a single value. In raw mode\n * operand pairing cannot be analysed, so every referenced list column counts.\n */\n protected readonly requiredAggregateVariables = computed<ReadonlySet<string>>(() => {\n if (this.#raw()) {\n return new Set(this.referencedListFields().map((f) => f.variable));\n }\n const byVariable = this.#fieldByVariable();\n const required = new Set<string>();\n for (const cond of this.#group().conditions) {\n const left = byVariable.get(cond.field);\n const right = cond.compareTo === 'field' ? byVariable.get(cond.value) : undefined;\n const leftMultiple = !!left?.isMultiple;\n const rightMultiple = !!right?.isMultiple;\n if (leftMultiple && !rightMultiple) required.add(cond.field);\n if (rightMultiple && !leftMultiple && right) required.add(right.variable);\n }\n return required;\n });\n\n /** Aggregates offered for a field: numeric columns get all, others only count. */\n protected aggregatesFor(field: FieldOption): readonly AggregateOption[] {\n return field.numeric\n ? this.aggregates\n : this.aggregates.filter((a) => a.value === CalculationFunctions.Count);\n }\n\n /** Whether a referenced list column is required to have an aggregate. */\n protected isAggregateRequired(variable: string): boolean {\n return this.requiredAggregateVariables().has(variable);\n }\n\n /** Human-readable syntax error for the raw editor, or `null` when valid/empty. */\n protected readonly syntaxError = computed<string | null>(() => {\n const expression = this.#expression();\n if (expression.trim() === '') return null;\n try {\n evaluatePredicate(expression, {});\n return null;\n } catch (error: unknown) {\n return error instanceof Error ? error.message : 'The expression syntax is invalid.';\n }\n });\n\n /** Whether the current expression can be edited in the guided builder. */\n protected readonly canUseGuided = computed<boolean>(\n () => parseConditions(this.#expression(), this.#fieldNameSet()) !== null,\n );\n\n /** Whether a rule is in force right now. */\n protected readonly hasRule = computed<boolean>(() => this.#expression().trim() !== '');\n\n /**\n * Whether the guided builder currently holds a condition that will be DROPPED\n * on serialisation — no field chosen, or a field-vs-field comparison with no\n * right-hand field. The template surfaces this as a one-line pending hint,\n * because the alternative is a silently inert rule: the author adds a row,\n * assumes the field is now conditional, and nothing tells them it is not.\n *\n * A typed value of `''` is NOT incomplete — `x === \"\"` is the legitimate\n * \"while the field is empty\" rule.\n */\n protected readonly hasIncompleteCondition = computed<boolean>(() => {\n if (this.#raw()) return false;\n return this.#group().conditions.some(\n (cond) =>\n cond.field.trim() === '' ||\n (cond.compareTo === 'field' && cond.value.trim() === ''),\n );\n });\n\n // MatFormFieldControl reads these as plain getters during its own change\n // detection, so they stay getters rather than `computed()` signals.\n\n get empty(): boolean {\n return !this.#currentRule();\n }\n\n get shouldLabelFloat(): boolean {\n return this.focused || !this.empty;\n }\n\n get errorState(): boolean {\n const ngControlError = this.ngControl?.errors != null;\n const externalError = (this.errors?.length ?? 0) > 0 && this.touched;\n return ngControlError || externalError;\n }\n\n setDescribedByIds(ids: string[]): void {\n this.describedBy = ids.join(' ');\n const el = this.#elementRef.nativeElement;\n const controlElement = el.querySelector('.lib-conditional-display-config__body');\n controlElement?.setAttribute('aria-describedby', this.describedBy);\n this.stateChanges.next();\n }\n\n onContainerClick(): void {\n this.markAsTouched();\n this.stateChanges.next();\n }\n\n onTouched: () => void = () => { };\n\n markAsTouched(): void {\n if (!this.touched) {\n this.touched = true;\n this.onTouched();\n this.stateChanges.next();\n }\n }\n\n /** Tear down the MFC state stream so subscribers do not leak. */\n ngOnDestroy(): void {\n this.stateChanges.complete();\n }\n\n /**\n * Seeds the guided builder from the bound `value`.\n *\n * Runs in `ngOnChanges`, not from the template and not from a `value` setter,\n * for two reasons:\n *\n * - **Signal writes.** Seeding writes `#group` / `#raw` / `#expression`.\n * Doing that from a template getter throws NG0600 (writing to signals while\n * Angular renders).\n * - **Binding order.** The host template binds `[value]` *before*\n * `[formInputs]`, and parsing an expression into guided rows needs the field\n * list to recognise its variable names. A `value` setter would parse against\n * an empty field set and drop every rule into Advanced mode. `ngOnChanges`\n * runs after the whole binding pass, so both are present.\n */\n ngOnChanges(changes: SimpleChanges): void {\n if (!changes['value']) return;\n if (this.value === this.#lastCommitted) return; // our own echo\n this.#seed();\n }\n\n #seed(): void {\n const rule = this.#currentRule();\n const expression = rule?.expression ?? '';\n this.#expression.set(expression);\n this.#functions.set(this.#functionsFromRule(rule));\n const parsed = parseConditions(expression, this.#fieldNameSet());\n if (parsed) {\n this.#group.set(parsed);\n this.#raw.set(false);\n } else if (expression.trim() !== '') {\n // An expression the guided builder cannot represent (grouping, mixed\n // connectors, negation) opens in Advanced and round-trips unchanged.\n this.#raw.set(true);\n } else {\n this.#group.set({ connector: '&&', conditions: [] });\n this.#raw.set(false);\n }\n }\n\n // ---- guided condition builder ------------------------------------------\n\n /** Switch the All/Any connector joining the conditions. */\n protected setConnector(connector: '&&' | '||'): void {\n this.#applyGroup({ ...this.#group(), connector });\n }\n\n /**\n * Append a fresh, **field-less** condition.\n *\n * The validator editor defaults the field to the input being validated, which\n * is nearly always what its author wants. Here the owning field is explicitly\n * excluded (a rule cannot observe itself), so any default would be an\n * arbitrary pick — and it would not be inert. `serializeConditions` treats a\n * typed value of `''` as complete, because `x === \"\"` is a legitimate \"is\n * empty\" rule, so a pre-filled field would turn a single click on \"Add\n * condition\" into a live rule that starts hiding the field. Leaving the field\n * unset serialises to nothing, so the rule only exists once the author has\n * actually said what it is about.\n */\n protected addCondition(): void {\n const group = this.#group();\n this.#applyGroup({\n ...group,\n conditions: [...group.conditions, emptyCondition('')],\n });\n }\n\n /** Apply a partial change to the condition at `index`. */\n protected updateCondition(index: number, patch: Partial<ValidatorCondition>): void {\n const group = this.#group();\n const conditions = group.conditions.map((c, i) => (i === index ? { ...c, ...patch } : c));\n this.#applyGroup({ ...group, conditions });\n }\n\n /** Flip a condition between comparing to a typed value and another field. */\n protected toggleCompareTo(index: number): void {\n const condition = this.#group().conditions[index];\n if (!condition) return;\n if (condition.compareTo === 'value') {\n const field = this.fieldOptions().find((f) => f.variable !== condition.field && !f.isSelf);\n this.updateCondition(index, { compareTo: 'field', value: field?.variable ?? '' });\n } else {\n this.updateCondition(index, { compareTo: 'value', value: '' });\n }\n }\n\n /** Remove the condition at `index`. */\n protected removeCondition(index: number): void {\n const group = this.#group();\n this.#applyGroup({ ...group, conditions: group.conditions.filter((_, i) => i !== index) });\n }\n\n /**\n * Choose (or clear, by re-clicking) the aggregate that reduces a referenced\n * list field to a single value.\n */\n protected setFunction(variable: string, fn: CalculationFunctions): void {\n this.#functions.update((current) => {\n const next = { ...current };\n if (next[variable] === fn) {\n delete next[variable];\n } else {\n next[variable] = fn;\n }\n return next;\n });\n // The expression text is unchanged, but the observed deps now carry the\n // aggregate — re-commit so inputsObservedForChanges reflects the choice.\n this.#commitExpression(this.#expression());\n }\n\n /** The aggregate currently chosen for a list variable, if any. */\n protected currentFunction(variable: string): CalculationFunctions | undefined {\n return this.#functions()[variable];\n }\n\n /** Replace the raw expression as the user types. */\n protected onExpressionInput(event: Event): void {\n this.#commitExpression((event.target as HTMLTextAreaElement).value);\n }\n\n /** Switch to the raw expression editor. */\n protected useRaw(): void {\n this.#raw.set(true);\n }\n\n /** Switch back to the guided builder, reparsing the current expression. */\n protected useGuided(): void {\n const parsed = parseConditions(this.#expression(), this.#fieldNameSet());\n if (!parsed) return;\n this.#group.set(parsed);\n this.#raw.set(false);\n }\n\n /**\n * Remove the rule entirely — the field becomes unconditionally visible again.\n *\n * Commits an empty array rather than a rule with a blank expression, so the\n * engine builds no visibility signal at all for this input and the form pays\n * nothing for a rule that no longer exists.\n */\n protected clearRule(): void {\n this.#group.set({ connector: '&&', conditions: [] });\n this.#functions.set({});\n this.#expression.set('');\n this.#raw.set(false);\n this.#commit([]);\n }\n\n /** Read the value-event target as a string. */\n protected inputValue(event: Event): string {\n return (event.target as HTMLInputElement | HTMLSelectElement).value;\n }\n\n // ---- internal ----------------------------------------------------------\n\n /** The single rule this editor owns, if one is bound. */\n #currentRule(): ConditionalInputRule | undefined {\n return this.value?.[0];\n }\n\n /** Set of field variable names the builder recognises (for parsing). */\n #fieldNameSet(): ReadonlySet<string> {\n return new Set(this.fieldOptions().map((f) => f.variable));\n }\n\n /** Whether an input carries a numeric data type. */\n #isNumeric(input: FormColumnInputs): boolean {\n return input.dataType === InputDataTypes.Number || input.type === InputTypes.Number;\n }\n\n /** Recover the per-variable aggregate choices from a rule's observed inputs. */\n #functionsFromRule(rule: ConditionalInputRule | undefined): Record<string, CalculationFunctions> {\n const map: Record<string, CalculationFunctions> = {};\n for (const observed of rule?.inputsObservedForChanges ?? []) {\n if (observed.function) map[observed.variable] = observed.function;\n }\n return map;\n }\n\n /** Store a builder change: update the model, then serialise + commit. */\n #applyGroup(next: ValidatorConditionGroup): void {\n this.#group.set(next);\n this.#commitExpression(serializeConditions(next));\n }\n\n /**\n * Write an expression onto the rule, re-deriving its observed-input deps.\n *\n * An expression that serialises to nothing means the author has not finished —\n * commit an empty list so the engine treats the input as unconditional. A\n * half-built rule must never hide the field it is being written on.\n */\n #commitExpression(expression: string): void {\n this.#expression.set(expression);\n if (expression.trim() === '') {\n this.#commit([]);\n return;\n }\n const fields: readonly FieldBinding[] = this.fieldOptions();\n const existing = this.#currentRule();\n const rule: ConditionalInputRule = {\n // Preserve every legacy descriptive field an older form may carry; the\n // engine ignores them, but an external consumer still renders them.\n ...existing,\n id: existing?.id ?? uuidv4(),\n expression,\n inputsObservedForChanges: deriveObservedInputs(expression, fields, this.#functions()),\n };\n this.#commit([rule]);\n }\n\n /** Single mutation path: store the new list and notify the parent. */\n #commit(next: ConditionalInputRule[]): void {\n this.#lastCommitted = next;\n this.value = next;\n this.markAsTouched();\n this.stateChanges.next();\n this.valueChanged.emit([...next]);\n }\n}\n","<section class=\"lib-conditional-display-config__body\">\n @if (!hasRule()) {\n <p class=\"lib-conditional-display-config__hint\">\n Appears only while a condition you define is true. Leave empty to always show.\n </p>\n }\n\n <div class=\"lib-conditional-display-config__condition-head\">\n <span class=\"lib-conditional-display-config__f-label\">Show this field when</span>\n @if (!raw() && group().conditions.length > 1) {\n <mat-button-toggle-group\n class=\"lib-conditional-display-config__seg\"\n [value]=\"group().connector\"\n hideSingleSelectionIndicator\n (change)=\"setConnector($event.value)\"\n aria-label=\"Combine conditions\"\n >\n <mat-button-toggle value=\"&&\">All</mat-button-toggle>\n <mat-button-toggle value=\"||\">Any</mat-button-toggle>\n </mat-button-toggle-group>\n }\n </div>\n\n @if (raw()) {\n <textarea\n class=\"lib-conditional-display-config__control lib-conditional-display-config__textarea lib-conditional-display-config__mono\"\n rows=\"2\"\n [value]=\"expression()\"\n [disabled]=\"disabled\"\n (input)=\"onExpressionInput($event)\"\n aria-label=\"Visibility expression\"\n placeholder='e.g. contactMethod === \"phone\"'\n ></textarea>\n @if (syntaxError(); as error) {\n <p class=\"lib-conditional-display-config__error\">\n <mat-icon class=\"lib-conditional-display-config__error-icon\">error_outline</mat-icon>\n <span>{{ error }}</span>\n </p>\n } @else {\n <p class=\"lib-conditional-display-config__sub-hint\">\n True = shown. Use field names with <code>===</code>, <code>&gt;</code>, <code>includes</code> …\n </p>\n }\n } @else {\n\n @if (fieldOptions().length === 0) {\n <p class=\"lib-conditional-display-config__sub-hint\">\n No other fields available yet — switch to Advanced to type an expression.\n </p>\n }\n\n @for (cond of group().conditions; track $index; let first = $first) {\n @if (!first) {\n <span class=\"lib-conditional-display-config__connector\" aria-hidden=\"true\">\n {{ group().connector === '&&' ? 'and' : 'or' }}\n </span>\n }\n <div class=\"lib-conditional-display-config__cond\">\n <label class=\"lib-conditional-display-config__field\">\n <span class=\"lib-conditional-display-config__f-label\">Field</span>\n <select\n class=\"lib-conditional-display-config__control\"\n [class.lib-conditional-display-config__control--invalid]=\"!cond.field\"\n [disabled]=\"disabled\"\n (change)=\"updateCondition($index, { field: inputValue($event) })\"\n >\n <option value=\"\" disabled [selected]=\"!cond.field\">Choose…</option>\n @if (directFields().length) {\n <optgroup label=\"Fields\">\n @for (f of directFields(); track f.variable) {\n <option [value]=\"f.variable\" [selected]=\"f.variable === cond.field\">{{ f.label }}</option>\n }\n </optgroup>\n }\n @if (listFields().length) {\n <optgroup label=\"List fields\">\n @for (f of listFields(); track f.variable) {\n <option [value]=\"f.variable\" [selected]=\"f.variable === cond.field\">{{ f.label }}</option>\n }\n </optgroup>\n }\n </select>\n </label>\n\n <label class=\"lib-conditional-display-config__field\">\n <span class=\"lib-conditional-display-config__f-label\">Condition</span>\n <select\n class=\"lib-conditional-display-config__control\"\n [disabled]=\"disabled\"\n (change)=\"updateCondition($index, { operator: inputValue($event) })\"\n >\n @for (op of operators; track op.value) {\n <option [value]=\"op.value\" [selected]=\"op.value === cond.operator\">{{ op.label }}</option>\n }\n </select>\n </label>\n\n <div class=\"lib-conditional-display-config__field lib-conditional-display-config__field--value\">\n <span class=\"lib-conditional-display-config__f-label\">\n {{ cond.compareTo === 'field' ? 'Other field' : 'Value' }}\n </span>\n <div class=\"lib-conditional-display-config__value\">\n @if (cond.compareTo === 'field') {\n <select\n class=\"lib-conditional-display-config__control\"\n [class.lib-conditional-display-config__control--invalid]=\"!cond.value\"\n [disabled]=\"disabled\"\n (change)=\"updateCondition($index, { value: inputValue($event) })\"\n >\n <option value=\"\" disabled [selected]=\"!cond.value\">Choose…</option>\n @if (directFields().length) {\n <optgroup label=\"Fields\">\n @for (f of directFields(); track f.variable) {\n <option [value]=\"f.variable\" [selected]=\"f.variable === cond.value\">{{ f.label }}</option>\n }\n </optgroup>\n }\n @if (listFields().length) {\n <optgroup label=\"List fields\">\n @for (f of listFields(); track f.variable) {\n <option [value]=\"f.variable\" [selected]=\"f.variable === cond.value\">{{ f.label }}</option>\n }\n </optgroup>\n }\n </select>\n } @else {\n <input\n class=\"lib-conditional-display-config__control\"\n [value]=\"cond.value\"\n [disabled]=\"disabled\"\n (input)=\"updateCondition($index, { value: inputValue($event) })\"\n placeholder=\"leave empty for “is empty”\"\n />\n }\n <button\n type=\"button\"\n class=\"lib-conditional-display-config__icon-btn\"\n [disabled]=\"disabled\"\n (click)=\"toggleCompareTo($index)\"\n [attr.aria-label]=\"\n cond.compareTo === 'field' ? 'Compare to a typed value' : 'Compare to another field'\n \"\n [matTooltip]=\"\n cond.compareTo === 'field' ? 'Compare to a typed value' : 'Compare to another field'\n \"\n >\n <mat-icon>{{ cond.compareTo === 'field' ? 'edit' : 'link' }}</mat-icon>\n </button>\n <button\n type=\"button\"\n class=\"lib-conditional-display-config__icon-btn\"\n [disabled]=\"disabled\"\n (click)=\"removeCondition($index)\"\n matTooltip=\"Remove condition\"\n aria-label=\"Remove condition\"\n >\n <mat-icon>close</mat-icon>\n </button>\n </div>\n </div>\n </div>\n }\n\n <button\n type=\"button\"\n class=\"lib-conditional-display-config__link\"\n [disabled]=\"disabled\"\n (click)=\"addCondition()\"\n >\n <mat-icon>add</mat-icon> Add condition\n </button>\n }\n\n @if (hasIncompleteCondition()) {\n <p class=\"lib-conditional-display-config__sub-hint lib-conditional-display-config__sub-hint--pending\">\n <mat-icon class=\"lib-conditional-display-config__pending-icon\">pending</mat-icon>\n <span>Unfinished conditions are ignored — pick a field to activate the rule.</span>\n </p>\n }\n\n @if (referencedListFields().length) {\n <div class=\"lib-conditional-display-config__lists\">\n <span class=\"lib-conditional-display-config__f-label\">Combine each list</span>\n @for (f of referencedListFields(); track f.variable) {\n <div\n class=\"lib-conditional-display-config__list-row\"\n [class.lib-conditional-display-config__list-row--unset]=\"\n isAggregateRequired(f.variable) && !currentFunction(f.variable)\n \"\n >\n <span class=\"lib-conditional-display-config__list-name\">{{ f.label }}</span>\n <div class=\"lib-conditional-display-config__agg\" role=\"group\" [attr.aria-label]=\"'Combine ' + f.label\">\n @for (agg of aggregatesFor(f); track agg.value) {\n <button\n type=\"button\"\n class=\"lib-conditional-display-config__agg-chip\"\n [class.lib-conditional-display-config__agg-chip--on]=\"currentFunction(f.variable) === agg.value\"\n [disabled]=\"disabled\"\n (click)=\"setFunction(f.variable, agg.value)\"\n >\n {{ agg.label }}\n </button>\n }\n </div>\n </div>\n }\n </div>\n }\n\n @if (hasRule()) {\n <p class=\"lib-conditional-display-config__summary\">\n While hidden, this field is removed from the form — nothing is submitted and\n its validation cannot block.\n </p>\n\n @if (!raw()) {\n <details class=\"lib-conditional-display-config__preview\">\n <summary class=\"lib-conditional-display-config__preview-summary\">Expression</summary>\n <code>{{ expression() }}</code>\n </details>\n }\n }\n\n <div class=\"lib-conditional-display-config__foot\">\n @if (raw()) {\n <button\n type=\"button\"\n class=\"lib-conditional-display-config__link\"\n [disabled]=\"!canUseGuided()\"\n [matTooltip]=\"canUseGuided() ? '' : 'This expression is too advanced for the guided builder'\"\n (click)=\"useGuided()\"\n >\n <mat-icon>view_module</mat-icon> Guided\n </button>\n } @else {\n <button type=\"button\" class=\"lib-conditional-display-config__link\" (click)=\"useRaw()\">\n <mat-icon>code</mat-icon> Advanced\n </button>\n }\n\n @if (hasRule()) {\n <button\n type=\"button\"\n class=\"lib-conditional-display-config__link lib-conditional-display-config__link--danger\"\n [disabled]=\"disabled\"\n matTooltip=\"Remove the rule — the field becomes always visible\"\n (click)=\"clearRule()\"\n >\n <mat-icon>visibility</mat-icon> Always show\n </button>\n }\n </div>\n</section>\n"],"names":["uuidv4","i1","i2","i3"],"mappings":";;;;;;;;;;;;;;;;;;AAkEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CG;MAqBU,iCAAiC,CAAA;AApB9C,IAAA,WAAA,GAAA;;AAyBW,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,OAAO,EAAQ;QAClC,IAAA,CAAA,WAAW,GAAG,gCAAgC;AAEvD,QAAA,IAAA,CAAA,EAAE,GAAG,CAAA,+BAAA,EAAkC,iCAAiC,CAAC,MAAM,EAAE,EAAE;QACnF,IAAA,CAAA,WAAW,GAAG,EAAE;QAChB,IAAA,CAAA,OAAO,GAAG,KAAK;QACf,IAAA,CAAA,OAAO,GAAG,KAAK;QACf,IAAA,CAAA,QAAQ,GAAG,KAAK;QAChB,IAAA,CAAA,WAAW,GAAG,EAAE;QAChB,IAAA,CAAA,UAAU,GAAwB,SAAS;QAC3C,IAAA,CAAA,mBAAmB,GAAuB,SAAS;QACnD,IAAA,CAAA,wBAAwB,GAAwB,SAAS;;QAGhD,IAAA,CAAA,QAAQ,GAAG,KAAK;;QAEhB,IAAA,CAAA,KAAK,GAA2B,EAAE;;QAElC,IAAA,CAAA,MAAM,GAAsC,EAAE;;AAG9C,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAA+B,SAAS,gFAAC;;AAE1D,QAAA,IAAA,CAAA,UAAU,GAAG,KAAK,CAA0B,EAAE,iFAAC;;QAG/C,IAAA,CAAA,YAAY,GAAG,MAAM,EAA0B;;QAGrC,IAAA,CAAA,SAAS,GAAG,mBAAmB;;AAG/B,QAAA,IAAA,CAAA,UAAU,GAA+B;YAC1D,EAAE,KAAK,EAAE,oBAAoB,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE;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W,EAAE,IAAI;AAClB,qBAAA,EAAA,QAAA,EAAA,44SAAA,EAAA,MAAA,EAAA,CAAA,igNAAA,CAAA,EAAA;;sBAqBA;;sBAEA;;sBAEA;;;;;"}
@@ -11,7 +11,7 @@ import { MatSelectModule } from '@angular/material/select';
11
11
  import * as i8 from '@angular/material/toolbar';
12
12
  import { MatToolbarModule } from '@angular/material/toolbar';
13
13
  import { Subject, take, tap, catchError, of } from 'rxjs';
14
- import { E as EmptyStateComponent } from './ngx-t-forms-ngx-t-forms-BA1CoCl_.mjs';
14
+ import { E as EmptyStateComponent } from './ngx-t-forms-ngx-t-forms-B3WhBGlD.mjs';
15
15
 
16
16
  /**
17
17
  * Internal editor that links each configured form input to an MSCOA
@@ -192,4 +192,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
192
192
  }] } });
193
193
 
194
194
  export { ConfigMscoaAdditionalInputsComponent };
195
- //# sourceMappingURL=ngx-t-forms-config-mscoa-additional-inputs.component-B2U7LSRf.mjs.map
195
+ //# sourceMappingURL=ngx-t-forms-config-mscoa-additional-inputs.component-CAk0k2YC.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ngx-t-forms-config-mscoa-additional-inputs.component-B2U7LSRf.mjs","sources":["../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/config-mscoa-additional-inputs/config-mscoa-additional-inputs.component.ts","../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/config-mscoa-additional-inputs/config-mscoa-additional-inputs.component.html"],"sourcesContent":["import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n DestroyRef,\r\n Input,\r\n ViewEncapsulation,\r\n computed,\r\n inject,\r\n output,\r\n signal,\r\n} from '@angular/core';\r\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\r\nimport { NgControl } from '@angular/forms';\r\nimport { MatFormFieldControl, MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatListModule } from '@angular/material/list';\r\nimport { MatSelectModule } from '@angular/material/select';\r\nimport { MatToolbarModule } from '@angular/material/toolbar';\r\nimport { Subject, catchError, of, take, tap, type Observable } from 'rxjs';\r\n\r\nimport type { FormColumnInputs, IGetTreeResponse } from 'ngx-t-forms-types';\r\nimport { EmptyStateComponent } from '../_shared/empty-state/empty-state.component';\r\nimport type { IConfigElementError } from '../../t-dynamic-data-edit.component';\r\n\r\n/**\r\n * A configured form input paired with the MSCOA account-segment it links to.\r\n *\r\n * `segment` is `undefined` when the user selects \"None\" (i.e. the input is not\r\n * bound to any account segment).\r\n */\r\nexport interface ConfiguredMscoaInput extends FormColumnInputs {\r\n /** Selected account-segment key. `undefined` when the user picks \"None\". */\r\n segment: string | undefined;\r\n}\r\n\r\n/** A selectable account-segment option (plus the synthetic \"None\" entry). */\r\ninterface SegmentOption {\r\n readonly value: string | undefined;\r\n readonly label: string;\r\n}\r\n\r\n/**\r\n * Internal editor that links each configured form input to an MSCOA\r\n * account-segment, implementing `MatFormFieldControl<ConfiguredMscoaInput[]>`\r\n * for the dynamic-data-edit configuration surface.\r\n *\r\n * Rendered by `t-dynamic-data-edit`, which supplies the surrounding field label,\r\n * hint, and validation errors — so this component owns only the per-input\r\n * segment selectors and the empty-state hint.\r\n *\r\n * NOTE: `MatFormFieldControl<T>` mandates plain mutable `value` / `disabled` /\r\n * `required` / `placeholder` / `id` members, `@Input()` decorators, the\r\n * `focused` / `touched` / `stateChanges` members, and the `useExisting`\r\n * provider. These are framework wiring, not defects — the CLAUDE.md bans on\r\n * `@Input()` / `useExisting` do not apply to MatFormFieldControl integration.\r\n */\r\n@Component({\r\n selector: 'lib-config-mscoa-additional-inputs',\r\n imports: [\r\n MatListModule,\r\n MatToolbarModule,\r\n MatFormFieldModule,\r\n MatSelectModule,\r\n EmptyStateComponent,\r\n ],\r\n templateUrl: './config-mscoa-additional-inputs.component.html',\r\n styleUrls: ['./config-mscoa-additional-inputs.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.Emulated,\r\n providers: [\r\n { provide: MatFormFieldControl, useExisting: ConfigMscoaAdditionalInputsComponent },\r\n ],\r\n host: {\r\n 'class': 'lib-config-mscoa-additional-inputs',\r\n '[id]': 'id',\r\n '[attr.aria-describedby]': 'describedBy',\r\n },\r\n})\r\nexport class ConfigMscoaAdditionalInputsComponent\r\n implements MatFormFieldControl<ConfiguredMscoaInput[]>\r\n{\r\n static nextId = 0;\r\n\r\n // ---- MatFormFieldControl wiring (framework-mandated plain members) -------\r\n\r\n /** Emits whenever a piece of `MatFormFieldControl` state changes. */\r\n readonly stateChanges = new Subject<void>();\r\n readonly controlType = 'lib-config-mscoa-additional-inputs';\r\n\r\n id = `app-config-mscoa-additional-inputs-${ConfigMscoaAdditionalInputsComponent.nextId++}`;\r\n placeholder = '';\r\n focused = false;\r\n touched = false;\r\n describedBy = '';\r\n autofilled: boolean | undefined = undefined;\r\n userAriaDescribedBy: string | undefined = undefined;\r\n disableAutomaticLabeling: boolean | undefined = undefined;\r\n\r\n readonly ngControl = inject(NgControl, { self: true, optional: true });\r\n\r\n readonly #destroyRef = inject(DestroyRef);\r\n\r\n // ---- Public input/output contract ---------------------------------------\r\n\r\n /** Whether all segment selectors are inert. */\r\n @Input() disabled = false;\r\n\r\n /** Whether a value is required (drives the MFC error state). */\r\n @Input() required = false;\r\n\r\n /** Validation errors surfaced by the parent for error-state derivation. */\r\n @Input() errors: IConfigElementError[] | undefined = [];\r\n\r\n /** Data context; the add-input affordance is gated on `mapToData?.id`. */\r\n @Input() mapToData: FormColumnInputs | undefined = undefined;\r\n\r\n /**\r\n * One-shot stream of the MSCOA tree. The first emitted response's\r\n * `accountTreeKeys` populate the per-input segment options; later\r\n * assignments are ignored (the stream is consumed once).\r\n */\r\n @Input() set getMscoaTree(options$: Observable<IGetTreeResponse | undefined>) {\r\n if (!options$ || this.#mscoaInitiated) {\r\n return;\r\n }\r\n this.#mscoaInitiated = true;\r\n options$\r\n .pipe(\r\n take(1),\r\n tap((options) => this.#accountTreeKeys.set(options?.accountTreeKeys ?? [])),\r\n catchError(() => of(undefined)),\r\n takeUntilDestroyed(this.#destroyRef),\r\n )\r\n .subscribe();\r\n }\r\n\r\n /** Emits the full configured-input list whenever a segment changes. */\r\n readonly valueChanged = output<ConfiguredMscoaInput[]>();\r\n\r\n #mscoaInitiated = false;\r\n readonly #accountTreeKeys = signal<string[]>([]);\r\n readonly #value = signal<ConfiguredMscoaInput[]>([]);\r\n\r\n /** Currently hovered list row index, for hover affordances. */\r\n protected readonly hovered = signal<number | null>(null);\r\n\r\n /**\r\n * Segment options offered per input: every account-tree key plus a trailing\r\n * synthetic \"None\" entry that clears the binding.\r\n */\r\n protected readonly limitInputTo = computed<SegmentOption[]>(() => [\r\n ...this.#accountTreeKeys().map((key) => ({ value: key as string | undefined, label: key })),\r\n { value: undefined, label: 'None' },\r\n ]);\r\n\r\n /**\r\n * Whether the empty-state hint may render.\r\n *\r\n * A plain getter (not a `computed()`) because `mapToData` is a framework-style\r\n * mutable `@Input` rather than a signal — OnPush re-evaluates this binding\r\n * each change-detection pass.\r\n */\r\n protected get canAddInputs(): boolean {\r\n return !!this.mapToData?.id;\r\n }\r\n\r\n /** Configured inputs to render. */\r\n protected readonly inputs = this.#value.asReadonly();\r\n\r\n /** Current MatFormFieldControl value (the configured-input list). */\r\n @Input()\r\n get value(): ConfiguredMscoaInput[] {\r\n return this.#value();\r\n }\r\n set value(val: ConfiguredMscoaInput[]) {\r\n this.#value.set(val ?? []);\r\n this.stateChanges.next();\r\n }\r\n\r\n // ---- MatFormFieldControl framework getters ------------------------------\r\n\r\n get empty(): boolean {\r\n return this.#value().length === 0;\r\n }\r\n\r\n get shouldLabelFloat(): boolean {\r\n return this.focused || !this.empty;\r\n }\r\n\r\n get errorState(): boolean {\r\n const requiredUnset = this.empty && this.required;\r\n const ngControlError = this.ngControl?.errors != null;\r\n const externalError = (this.errors?.length ?? 0) > 0 && this.touched;\r\n return requiredUnset || ngControlError || externalError;\r\n }\r\n\r\n setDescribedByIds(ids: string[]): void {\r\n this.describedBy = ids.join(' ');\r\n this.stateChanges.next();\r\n }\r\n\r\n onContainerClick(): void {\r\n this.markAsTouched();\r\n this.stateChanges.next();\r\n }\r\n\r\n onTouched: () => void = () => {};\r\n\r\n markAsTouched(): void {\r\n if (!this.touched) {\r\n this.touched = true;\r\n this.onTouched();\r\n this.stateChanges.next();\r\n }\r\n }\r\n\r\n // ---- Behaviour ----------------------------------------------------------\r\n\r\n /**\r\n * Assigns the chosen account-segment to the input at `index` and emits the\r\n * updated list immediately. Selecting \"None\" (`undefined`) clears the binding.\r\n */\r\n inputSegmentChanged(\r\n event: { detail?: { value: string }; value?: string },\r\n index: number,\r\n ): void {\r\n const detailValue = event.detail?.value ?? event.value;\r\n const current = this.#value();\r\n const item = current[index];\r\n if (!item) {\r\n return;\r\n }\r\n const next = current.map((input, i) =>\r\n i === index\r\n ? { ...input, segment: detailValue === 'None' ? undefined : detailValue }\r\n : input,\r\n );\r\n this.#value.set(next);\r\n this.markAsTouched();\r\n this.stateChanges.next();\r\n this.valueChanged.emit(next);\r\n }\r\n}\r\n","@if (inputs().length > 0) {\r\n <mat-list class=\"lib-config-mscoa-additional-inputs__list\">\r\n <mat-toolbar class=\"lib-config-mscoa-additional-inputs__heading\">\r\n Additional inputs configuration\r\n </mat-toolbar>\r\n @for (input of inputs(); track input.id; let i = $index) {\r\n <mat-form-field\r\n class=\"lib-config-mscoa-additional-inputs__row\"\r\n appearance=\"outline\"\r\n subscriptSizing=\"dynamic\"\r\n (mouseover)=\"hovered.set(i)\"\r\n (mouseleave)=\"hovered.set(null)\">\r\n <mat-label>{{ input.label }}</mat-label>\r\n <mat-select\r\n matNativeControl\r\n [disabled]=\"disabled\"\r\n [value]=\"input.segment\"\r\n placeholder=\"select segment\"\r\n (selectionChange)=\"inputSegmentChanged($event, i)\">\r\n @for (segment of limitInputTo(); track segment.label) {\r\n <mat-option [value]=\"segment.value\">{{ segment.label }}</mat-option>\r\n }\r\n </mat-select>\r\n <mat-hint>Link formula to an input value</mat-hint>\r\n </mat-form-field>\r\n }\r\n </mat-list>\r\n} @else if (canAddInputs) {\r\n <lib-empty-state\r\n icon=\"info\"\r\n message=\"No input configuration available.\" />\r\n}\r\n"],"names":["i1","i3","i4"],"mappings":";;;;;;;;;;;;;;;AAwCA;;;;;;;;;;;;;;AAcG;MAuBU,oCAAoC,CAAA;AAtBjD,IAAA,WAAA,GAAA;;;AA8BW,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,OAAO,EAAQ;QAClC,IAAA,CAAA,WAAW,GAAG,oCAAoC;AAE3D,QAAA,IAAA,CAAA,EAAE,GAAG,CAAA,mCAAA,EAAsC,oCAAoC,CAAC,MAAM,EAAE,EAAE;QAC1F,IAAA,CAAA,WAAW,GAAG,EAAE;QAChB,IAAA,CAAA,OAAO,GAAG,KAAK;QACf,IAAA,CAAA,OAAO,GAAG,KAAK;QACf,IAAA,CAAA,WAAW,GAAG,EAAE;QAChB,IAAA,CAAA,UAAU,GAAwB,SAAS;QAC3C,IAAA,CAAA,mBAAmB,GAAuB,SAAS;QACnD,IAAA,CAAA,wBAAwB,GAAwB,SAAS;AAEhD,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAE7D,QAAA,IAAA,CAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;;;QAKhC,IAAA,CAAA,QAAQ,GAAG,KAAK;;QAGhB,IAAA,CAAA,QAAQ,GAAG,KAAK;;QAGhB,IAAA,CAAA,MAAM,GAAsC,EAAE;;QAG9C,IAAA,CAAA,SAAS,GAAiC,SAAS;;QAuBnD,IAAA,CAAA,YAAY,GAAG,MAAM,EAA0B;QAExD,IAAA,CAAA,eAAe,GAAG,KAAK;AACd,QAAA,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAW,EAAE,uFAAC;AACvC,QA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AE,OAAO,EAAE,mBAAmB,EAAE,WAAW,sCAAsC,EAAE;qBACpF,EAAA,IAAA,EACK;AACJ,wBAAA,OAAO,EAAE,oCAAoC;AAC7C,wBAAA,MAAM,EAAE,IAAI;AACZ,wBAAA,yBAAyB,EAAE,aAAa;AACzC,qBAAA,EAAA,QAAA,EAAA,0wCAAA,EAAA,MAAA,EAAA,CAAA,8KAAA,CAAA,EAAA;;sBA6BA;;sBAGA;;sBAGA;;sBAGA;;sBAOA;;sBAiDA;;;;;"}
1
+ {"version":3,"file":"ngx-t-forms-config-mscoa-additional-inputs.component-CAk0k2YC.mjs","sources":["../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/config-mscoa-additional-inputs/config-mscoa-additional-inputs.component.ts","../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/config-mscoa-additional-inputs/config-mscoa-additional-inputs.component.html"],"sourcesContent":["import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n DestroyRef,\r\n Input,\r\n ViewEncapsulation,\r\n computed,\r\n inject,\r\n output,\r\n signal,\r\n} from '@angular/core';\r\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\r\nimport { NgControl } from '@angular/forms';\r\nimport { MatFormFieldControl, MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatListModule } from '@angular/material/list';\r\nimport { MatSelectModule } from '@angular/material/select';\r\nimport { MatToolbarModule } from '@angular/material/toolbar';\r\nimport { Subject, catchError, of, take, tap, type Observable } from 'rxjs';\r\n\r\nimport type { FormColumnInputs, IGetTreeResponse } from 'ngx-t-forms-types';\r\nimport { EmptyStateComponent } from '../_shared/empty-state/empty-state.component';\r\nimport type { IConfigElementError } from '../../t-dynamic-data-edit.component';\r\n\r\n/**\r\n * A configured form input paired with the MSCOA account-segment it links to.\r\n *\r\n * `segment` is `undefined` when the user selects \"None\" (i.e. the input is not\r\n * bound to any account segment).\r\n */\r\nexport interface ConfiguredMscoaInput extends FormColumnInputs {\r\n /** Selected account-segment key. `undefined` when the user picks \"None\". */\r\n segment: string | undefined;\r\n}\r\n\r\n/** A selectable account-segment option (plus the synthetic \"None\" entry). */\r\ninterface SegmentOption {\r\n readonly value: string | undefined;\r\n readonly label: string;\r\n}\r\n\r\n/**\r\n * Internal editor that links each configured form input to an MSCOA\r\n * account-segment, implementing `MatFormFieldControl<ConfiguredMscoaInput[]>`\r\n * for the dynamic-data-edit configuration surface.\r\n *\r\n * Rendered by `t-dynamic-data-edit`, which supplies the surrounding field label,\r\n * hint, and validation errors — so this component owns only the per-input\r\n * segment selectors and the empty-state hint.\r\n *\r\n * NOTE: `MatFormFieldControl<T>` mandates plain mutable `value` / `disabled` /\r\n * `required` / `placeholder` / `id` members, `@Input()` decorators, the\r\n * `focused` / `touched` / `stateChanges` members, and the `useExisting`\r\n * provider. These are framework wiring, not defects — the CLAUDE.md bans on\r\n * `@Input()` / `useExisting` do not apply to MatFormFieldControl integration.\r\n */\r\n@Component({\r\n selector: 'lib-config-mscoa-additional-inputs',\r\n imports: [\r\n MatListModule,\r\n MatToolbarModule,\r\n MatFormFieldModule,\r\n MatSelectModule,\r\n EmptyStateComponent,\r\n ],\r\n templateUrl: './config-mscoa-additional-inputs.component.html',\r\n styleUrls: ['./config-mscoa-additional-inputs.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.Emulated,\r\n providers: [\r\n { provide: MatFormFieldControl, useExisting: ConfigMscoaAdditionalInputsComponent },\r\n ],\r\n host: {\r\n 'class': 'lib-config-mscoa-additional-inputs',\r\n '[id]': 'id',\r\n '[attr.aria-describedby]': 'describedBy',\r\n },\r\n})\r\nexport class ConfigMscoaAdditionalInputsComponent\r\n implements MatFormFieldControl<ConfiguredMscoaInput[]>\r\n{\r\n static nextId = 0;\r\n\r\n // ---- MatFormFieldControl wiring (framework-mandated plain members) -------\r\n\r\n /** Emits whenever a piece of `MatFormFieldControl` state changes. */\r\n readonly stateChanges = new Subject<void>();\r\n readonly controlType = 'lib-config-mscoa-additional-inputs';\r\n\r\n id = `app-config-mscoa-additional-inputs-${ConfigMscoaAdditionalInputsComponent.nextId++}`;\r\n placeholder = '';\r\n focused = false;\r\n touched = false;\r\n describedBy = '';\r\n autofilled: boolean | undefined = undefined;\r\n userAriaDescribedBy: string | undefined = undefined;\r\n disableAutomaticLabeling: boolean | undefined = undefined;\r\n\r\n readonly ngControl = inject(NgControl, { self: true, optional: true });\r\n\r\n readonly #destroyRef = inject(DestroyRef);\r\n\r\n // ---- Public input/output contract ---------------------------------------\r\n\r\n /** Whether all segment selectors are inert. */\r\n @Input() disabled = false;\r\n\r\n /** Whether a value is required (drives the MFC error state). */\r\n @Input() required = false;\r\n\r\n /** Validation errors surfaced by the parent for error-state derivation. */\r\n @Input() errors: IConfigElementError[] | undefined = [];\r\n\r\n /** Data context; the add-input affordance is gated on `mapToData?.id`. */\r\n @Input() mapToData: FormColumnInputs | undefined = undefined;\r\n\r\n /**\r\n * One-shot stream of the MSCOA tree. The first emitted response's\r\n * `accountTreeKeys` populate the per-input segment options; later\r\n * assignments are ignored (the stream is consumed once).\r\n */\r\n @Input() set getMscoaTree(options$: Observable<IGetTreeResponse | undefined>) {\r\n if (!options$ || this.#mscoaInitiated) {\r\n return;\r\n }\r\n this.#mscoaInitiated = true;\r\n options$\r\n .pipe(\r\n take(1),\r\n tap((options) => this.#accountTreeKeys.set(options?.accountTreeKeys ?? [])),\r\n catchError(() => of(undefined)),\r\n takeUntilDestroyed(this.#destroyRef),\r\n )\r\n .subscribe();\r\n }\r\n\r\n /** Emits the full configured-input list whenever a segment changes. */\r\n readonly valueChanged = output<ConfiguredMscoaInput[]>();\r\n\r\n #mscoaInitiated = false;\r\n readonly #accountTreeKeys = signal<string[]>([]);\r\n readonly #value = signal<ConfiguredMscoaInput[]>([]);\r\n\r\n /** Currently hovered list row index, for hover affordances. */\r\n protected readonly hovered = signal<number | null>(null);\r\n\r\n /**\r\n * Segment options offered per input: every account-tree key plus a trailing\r\n * synthetic \"None\" entry that clears the binding.\r\n */\r\n protected readonly limitInputTo = computed<SegmentOption[]>(() => [\r\n ...this.#accountTreeKeys().map((key) => ({ value: key as string | undefined, label: key })),\r\n { value: undefined, label: 'None' },\r\n ]);\r\n\r\n /**\r\n * Whether the empty-state hint may render.\r\n *\r\n * A plain getter (not a `computed()`) because `mapToData` is a framework-style\r\n * mutable `@Input` rather than a signal — OnPush re-evaluates this binding\r\n * each change-detection pass.\r\n */\r\n protected get canAddInputs(): boolean {\r\n return !!this.mapToData?.id;\r\n }\r\n\r\n /** Configured inputs to render. */\r\n protected readonly inputs = this.#value.asReadonly();\r\n\r\n /** Current MatFormFieldControl value (the configured-input list). */\r\n @Input()\r\n get value(): ConfiguredMscoaInput[] {\r\n return this.#value();\r\n }\r\n set value(val: ConfiguredMscoaInput[]) {\r\n this.#value.set(val ?? []);\r\n this.stateChanges.next();\r\n }\r\n\r\n // ---- MatFormFieldControl framework getters ------------------------------\r\n\r\n get empty(): boolean {\r\n return this.#value().length === 0;\r\n }\r\n\r\n get shouldLabelFloat(): boolean {\r\n return this.focused || !this.empty;\r\n }\r\n\r\n get errorState(): boolean {\r\n const requiredUnset = this.empty && this.required;\r\n const ngControlError = this.ngControl?.errors != null;\r\n const externalError = (this.errors?.length ?? 0) > 0 && this.touched;\r\n return requiredUnset || ngControlError || externalError;\r\n }\r\n\r\n setDescribedByIds(ids: string[]): void {\r\n this.describedBy = ids.join(' ');\r\n this.stateChanges.next();\r\n }\r\n\r\n onContainerClick(): void {\r\n this.markAsTouched();\r\n this.stateChanges.next();\r\n }\r\n\r\n onTouched: () => void = () => {};\r\n\r\n markAsTouched(): void {\r\n if (!this.touched) {\r\n this.touched = true;\r\n this.onTouched();\r\n this.stateChanges.next();\r\n }\r\n }\r\n\r\n // ---- Behaviour ----------------------------------------------------------\r\n\r\n /**\r\n * Assigns the chosen account-segment to the input at `index` and emits the\r\n * updated list immediately. Selecting \"None\" (`undefined`) clears the binding.\r\n */\r\n inputSegmentChanged(\r\n event: { detail?: { value: string }; value?: string },\r\n index: number,\r\n ): void {\r\n const detailValue = event.detail?.value ?? event.value;\r\n const current = this.#value();\r\n const item = current[index];\r\n if (!item) {\r\n return;\r\n }\r\n const next = current.map((input, i) =>\r\n i === index\r\n ? { ...input, segment: detailValue === 'None' ? undefined : detailValue }\r\n : input,\r\n );\r\n this.#value.set(next);\r\n this.markAsTouched();\r\n this.stateChanges.next();\r\n this.valueChanged.emit(next);\r\n }\r\n}\r\n","@if (inputs().length > 0) {\r\n <mat-list class=\"lib-config-mscoa-additional-inputs__list\">\r\n <mat-toolbar class=\"lib-config-mscoa-additional-inputs__heading\">\r\n Additional inputs configuration\r\n </mat-toolbar>\r\n @for (input of inputs(); track input.id; let i = $index) {\r\n <mat-form-field\r\n class=\"lib-config-mscoa-additional-inputs__row\"\r\n appearance=\"outline\"\r\n subscriptSizing=\"dynamic\"\r\n (mouseover)=\"hovered.set(i)\"\r\n (mouseleave)=\"hovered.set(null)\">\r\n <mat-label>{{ input.label }}</mat-label>\r\n <mat-select\r\n matNativeControl\r\n [disabled]=\"disabled\"\r\n [value]=\"input.segment\"\r\n placeholder=\"select segment\"\r\n (selectionChange)=\"inputSegmentChanged($event, i)\">\r\n @for (segment of limitInputTo(); track segment.label) {\r\n <mat-option [value]=\"segment.value\">{{ segment.label }}</mat-option>\r\n }\r\n </mat-select>\r\n <mat-hint>Link formula to an input value</mat-hint>\r\n </mat-form-field>\r\n }\r\n </mat-list>\r\n} @else if (canAddInputs) {\r\n <lib-empty-state\r\n icon=\"info\"\r\n message=\"No input configuration available.\" />\r\n}\r\n"],"names":["i1","i3","i4"],"mappings":";;;;;;;;;;;;;;;AAwCA;;;;;;;;;;;;;;AAcG;MAuBU,oCAAoC,CAAA;AAtBjD,IAAA,WAAA,GAAA;;;AA8BW,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,OAAO,EAAQ;QAClC,IAAA,CAAA,WAAW,GAAG,oCAAoC;AAE3D,QAAA,IAAA,CAAA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