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.
- package/fesm2022/{ngx-t-forms-api-endpoint-config.component-BAWiavFB.mjs → ngx-t-forms-api-endpoint-config.component-DLg5vzNJ.mjs} +6 -6
- package/fesm2022/{ngx-t-forms-api-endpoint-config.component-BAWiavFB.mjs.map → ngx-t-forms-api-endpoint-config.component-DLg5vzNJ.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-auto-complete-input-element.component-Cph2QuN3.mjs → ngx-t-forms-auto-complete-input-element.component-CQ9gB964.mjs} +28 -11
- package/fesm2022/ngx-t-forms-auto-complete-input-element.component-CQ9gB964.mjs.map +1 -0
- 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
- 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
- package/fesm2022/{ngx-t-forms-calculated-field-rules.component-CZ5c7fRi.mjs → ngx-t-forms-calculated-field-rules.component-KHUBx8wM.mjs} +2 -42
- package/fesm2022/ngx-t-forms-calculated-field-rules.component-KHUBx8wM.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-chip-options-creator-editor.component-aNd2SXIA.mjs → ngx-t-forms-chip-options-creator-editor.component-DAZVCoUZ.mjs} +2 -2
- 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
- package/fesm2022/{ngx-t-forms-conditional-display-config.component-yJ5IORsS.mjs → ngx-t-forms-conditional-display-config.component-p3dEGx1z.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-conditional-display-config.component-yJ5IORsS.mjs.map → ngx-t-forms-conditional-display-config.component-p3dEGx1z.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-config-mscoa-additional-inputs.component-B2U7LSRf.mjs → ngx-t-forms-config-mscoa-additional-inputs.component-CAk0k2YC.mjs} +2 -2
- 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
- package/fesm2022/{ngx-t-forms-data-source-picker.component-Bd1wm12Q.mjs → ngx-t-forms-data-source-picker.component-CUVjocuE.mjs} +6 -6
- package/fesm2022/{ngx-t-forms-data-source-picker.component-Bd1wm12Q.mjs.map → ngx-t-forms-data-source-picker.component-CUVjocuE.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-date-picker-input-element.component-BduBmu9K.mjs → ngx-t-forms-date-picker-input-element.component-lQfvlGfA.mjs} +2 -2
- 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
- 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
- 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
- package/fesm2022/ngx-t-forms-date-time-picker-input-element.component-Co0nzt6l.mjs +232 -0
- package/fesm2022/ngx-t-forms-date-time-picker-input-element.component-Co0nzt6l.mjs.map +1 -0
- 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
- 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
- package/fesm2022/{ngx-t-forms-document-picker.component-3mqXc4s6.mjs → ngx-t-forms-document-picker.component-umv9Z3rU.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-document-picker.component-3mqXc4s6.mjs.map → ngx-t-forms-document-picker.component-umv9Z3rU.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-editor-input-element.component-D_SjJtw9.mjs → ngx-t-forms-editor-input-element.component-BHq-LOhI.mjs} +3 -3
- 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
- package/fesm2022/{ngx-t-forms-file-upload-input-element.component-DZuAYjpr.mjs → ngx-t-forms-file-upload-input-element.component-DjVntIfw.mjs} +2 -2
- 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
- package/fesm2022/{ngx-t-forms-form-input-selector.component-B6FoYGy5.mjs → ngx-t-forms-form-input-selector.component-DX85MMcQ.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-form-input-selector.component-B6FoYGy5.mjs.map → ngx-t-forms-form-input-selector.component-DX85MMcQ.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-form-json-view.component-DsEizrc-.mjs → ngx-t-forms-form-json-view.component-f6QyPY6E.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-form-json-view.component-DsEizrc-.mjs.map → ngx-t-forms-form-json-view.component-f6QyPY6E.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-form-section-stepper.component-ZJDWyxa7.mjs → ngx-t-forms-form-section-stepper.component-ChaSUCrg.mjs} +4 -4
- package/fesm2022/{ngx-t-forms-form-section-stepper.component-ZJDWyxa7.mjs.map → ngx-t-forms-form-section-stepper.component-ChaSUCrg.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-forms-builder-menu.component-oVpP2Jgt.mjs → ngx-t-forms-forms-builder-menu.component-Qkw23Bzy.mjs} +4 -4
- package/fesm2022/{ngx-t-forms-forms-builder-menu.component-oVpP2Jgt.mjs.map → ngx-t-forms-forms-builder-menu.component-Qkw23Bzy.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-geo-location.component-Cml0Do4m.mjs → ngx-t-forms-geo-location.component-DqYEmeLs.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-geo-location.component-Cml0Do4m.mjs.map → ngx-t-forms-geo-location.component-DqYEmeLs.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-header-template-editor.component-NRiXTnwH.mjs → ngx-t-forms-header-template-editor.component-CIft152I.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-header-template-editor.component-NRiXTnwH.mjs.map → ngx-t-forms-header-template-editor.component-CIft152I.mjs.map} +1 -1
- 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
- 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
- package/fesm2022/ngx-t-forms-index-yasuBvXP.mjs +2 -0
- package/fesm2022/ngx-t-forms-index-yasuBvXP.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-input-custom.component-CTye_tsv.mjs +309 -0
- package/fesm2022/ngx-t-forms-input-custom.component-CTye_tsv.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-input-editor.component-zL4cp2gq.mjs → ngx-t-forms-input-editor.component-DbhnFkYQ.mjs} +3 -3
- package/fesm2022/{ngx-t-forms-input-editor.component-zL4cp2gq.mjs.map → ngx-t-forms-input-editor.component-DbhnFkYQ.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-map-mat-options-keys-0tNskyLE.mjs → ngx-t-forms-map-mat-options-keys-B49fcbzx.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-map-mat-options-keys-0tNskyLE.mjs.map → ngx-t-forms-map-mat-options-keys-B49fcbzx.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-mat-chip-list-editor.component-CGMhUIuc.mjs → ngx-t-forms-mat-chip-list-editor.component-C0iLh1ON.mjs} +2 -2
- 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
- package/fesm2022/{ngx-t-forms-missing-form-configs.component-BXiXHKG_.mjs → ngx-t-forms-missing-form-configs.component-BsX7Ezy-.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-missing-form-configs.component-BXiXHKG_.mjs.map → ngx-t-forms-missing-form-configs.component-BsX7Ezy-.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-mscoa-chart-toolbar.component-BVtVrTn1.mjs → ngx-t-forms-mscoa-chart-toolbar.component-D8GL9Aht.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-mscoa-chart-toolbar.component-BVtVrTn1.mjs.map → ngx-t-forms-mscoa-chart-toolbar.component-D8GL9Aht.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-mscoa-config.component-CmIR92zj.mjs → ngx-t-forms-mscoa-config.component-Sz8VZ-vc.mjs} +61 -12
- package/fesm2022/ngx-t-forms-mscoa-config.component-Sz8VZ-vc.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-mscoa-segment-config.component-CVTRW43v.mjs → ngx-t-forms-mscoa-segment-config.component-COepe5G2.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-mscoa-segment-config.component-CVTRW43v.mjs.map → ngx-t-forms-mscoa-segment-config.component-COepe5G2.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-multiple-input-input-element.component-CUgTJJRW.mjs → ngx-t-forms-multiple-input-input-element.component-DlgTjJpj.mjs} +4 -4
- 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
- package/fesm2022/{ngx-t-forms-ngx-t-forms-BA1CoCl_.mjs → ngx-t-forms-ngx-t-forms-B3WhBGlD.mjs} +10021 -99
- package/fesm2022/ngx-t-forms-ngx-t-forms-B3WhBGlD.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-paginated-selection-table-CdEJa3FZ.mjs → ngx-t-forms-paginated-selection-table-CILBCL4K.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-paginated-selection-table-CdEJa3FZ.mjs.map → ngx-t-forms-paginated-selection-table-CILBCL4K.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-payload-template-editor.component-CZoqYRKK.mjs → ngx-t-forms-payload-template-editor.component-C8OasgK7.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-payload-template-editor.component-CZoqYRKK.mjs.map → ngx-t-forms-payload-template-editor.component-C8OasgK7.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-pipeline-generator.component-LbAmKWNG.mjs → ngx-t-forms-pipeline-generator.component-_yowsgF6.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-pipeline-generator.component-LbAmKWNG.mjs.map → ngx-t-forms-pipeline-generator.component-_yowsgF6.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-quill-input.component-CKYNVDDV.mjs → ngx-t-forms-quill-input.component-BWq5cLY-.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-quill-input.component-CKYNVDDV.mjs.map → ngx-t-forms-quill-input.component-BWq5cLY-.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-record-list-manager.component-BNdEvWsZ.mjs → ngx-t-forms-record-list-manager.component-C-lAzlO-.mjs} +2 -2
- 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
- package/fesm2022/{ngx-t-forms-required-inputs.component-D_cQIScV.mjs → ngx-t-forms-required-inputs.component-8cQr2QWm.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-required-inputs.component-D_cQIScV.mjs.map → ngx-t-forms-required-inputs.component-8cQr2QWm.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-rest-api-call-setup.component-BhQmOVHN.mjs → ngx-t-forms-rest-api-call-setup.component-Bhj9jcQk.mjs} +197 -175
- package/fesm2022/ngx-t-forms-rest-api-call-setup.component-Bhj9jcQk.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-section-report.component-m2Z6qA3j.mjs → ngx-t-forms-section-report.component-CWCqrc7k.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-section-report.component-m2Z6qA3j.mjs.map → ngx-t-forms-section-report.component-CWCqrc7k.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-select-input-element.component-DH5knOzd.mjs → ngx-t-forms-select-input-element.component-BGD67Dnh.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-select-input-element.component-DH5knOzd.mjs.map → ngx-t-forms-select-input-element.component-BGD67Dnh.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-selection-options-editor.component-UBt2kiPk.mjs → ngx-t-forms-selection-options-editor.component-ClXaOeXt.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-selection-options-editor.component-UBt2kiPk.mjs.map → ngx-t-forms-selection-options-editor.component-ClXaOeXt.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-textarea-input-element.component-B9JLzhTh.mjs → ngx-t-forms-textarea-input-element.component-Z-wkFzgQ.mjs} +2 -2
- 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
- package/fesm2022/{ngx-t-forms-toggle-input-element.component-B9_03RoG.mjs → ngx-t-forms-toggle-input-element.component-CvR3-IjP.mjs} +2 -2
- 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
- package/fesm2022/{ngx-t-forms-token-text-input.component-BQADsnFn.mjs → ngx-t-forms-token-text-input.component-vnOkP_CV.mjs} +2 -2
- 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
- package/fesm2022/{ngx-t-forms-validators-config.component-qO6Y4x1v.mjs → ngx-t-forms-validators-config.component-DhuB7c63.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-validators-config.component-qO6Y4x1v.mjs.map → ngx-t-forms-validators-config.component-DhuB7c63.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-workflow-adjudication.component-SUbSx79R.mjs → ngx-t-forms-workflow-adjudication.component-Dc4r01D7.mjs} +3 -3
- package/fesm2022/{ngx-t-forms-workflow-adjudication.component-SUbSx79R.mjs.map → ngx-t-forms-workflow-adjudication.component-Dc4r01D7.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms.mjs +1 -1
- package/package.json +3 -3
- package/types/ngx-t-forms.d.ts +1754 -5
- package/fesm2022/ngx-t-forms-auto-complete-input-element.component-Cph2QuN3.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-calculated-field-rules.component-CZ5c7fRi.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-index-Cl4VG3Vd.mjs +0 -2
- package/fesm2022/ngx-t-forms-index-Cl4VG3Vd.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-input-custom.component-q8jPq7KI.mjs +0 -105
- package/fesm2022/ngx-t-forms-input-custom.component-q8jPq7KI.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mscoa-config.component-CmIR92zj.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-ngx-t-forms-BA1CoCl_.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-rest-api-call-setup.component-BhQmOVHN.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-t-forms-image-capture-input-element.component-IFval472.mjs","sources":["../../../projects/ngx-t-forms/src/lib/components/t-form-input/elements/file-upload-input-element/core/file-uploader/camera-functions.ts","../../../projects/ngx-t-forms/src/lib/components/t-form-input/elements/image-capture-input-element/core/camera-capture/camera-capture.component.ts","../../../projects/ngx-t-forms/src/lib/components/t-form-input/elements/image-capture-input-element/core/camera-capture/camera-capture.component.html","../../../projects/ngx-t-forms/src/lib/components/t-form-input/elements/image-capture-input-element/image-capture-input-element.component.ts","../../../projects/ngx-t-forms/src/lib/components/t-form-input/elements/image-capture-input-element/image-capture-input-element.component.html"],"sourcesContent":["// Image capture\r\n\r\nimport { AbstractControl, ValidationErrors } from \"@angular/forms\";\r\nimport { FileUploadInputValueInterface } from \"ngx-t-forms-types\";\r\n\r\n\r\nexport async function setupDevices(\r\n cameraCallback: (stream: MediaStream) => void\r\n): Promise<MediaStream | string | unknown | undefined> {\r\n // SSR guard (Trap 14): free helper has no DI context. Returning `undefined`\r\n // matches the existing \"no media device\" branch — caller contract preserved.\r\n if (typeof navigator === 'undefined') return undefined;\r\n\r\n if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {\r\n try {\r\n const stream = await navigator.mediaDevices.getUserMedia({\r\n video: true,\r\n });\r\n if (stream) {\r\n cameraCallback(stream);\r\n return stream;\r\n } else {\r\n return 'You have no output video device';\r\n }\r\n } catch (e) {\r\n return e;\r\n }\r\n }\r\n return undefined;\r\n}\r\n\r\n\r\nexport function fileUploaderValidator(control: AbstractControl): ValidationErrors | null {\r\n // Implement your validation logic here\r\n const file: FileUploadInputValueInterface= control.value;\r\n\r\n // Example validation: Check if file is provided\r\n if (!file || !file.base64) {\r\n return { requiredFile: 'You must upload a file.' };\r\n }\r\n\r\n // Add more validation logic as needed\r\n // ...\r\n\r\n return null; // Return null if no validation errors\r\n}","import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n ElementRef,\r\n PLATFORM_ID,\r\n computed,\r\n inject,\r\n input,\r\n viewChild,\r\n} from '@angular/core';\r\nimport { NgControl } from '@angular/forms';\r\nimport { isPlatformBrowser } from '@angular/common';\r\nimport { MatFormFieldControl } from '@angular/material/form-field';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatToolbarModule } from '@angular/material/toolbar';\r\nimport { MatButtonModule } from '@angular/material/button';\r\n\r\nimport { FileUploadInputValueInterface, IFileUploadInput, ITowerStepColumn } from 'ngx-t-forms-types';\r\n\r\nimport { setupDevices } from '../../../file-upload-input-element/core/file-uploader/camera-functions';\r\nimport { BaseCustomInput, BaseCustomInputConfig } from '../../../../../../services/core/t-input-controller/functions/baseCustomInput';\r\n\r\nconst customInputConfig: BaseCustomInputConfig = {\r\n controlType: 'app-camera-capture',\r\n nextId: 0,\r\n};\r\n\r\n@Component({\r\n selector: 'lib-camera-capture',\r\n templateUrl: './camera-capture.component.html',\r\n styleUrls: ['./camera-capture.component.scss'],\r\n imports: [MatIconModule, MatToolbarModule, MatButtonModule],\r\n providers: [{ provide: MatFormFieldControl, useExisting: CameraCaptureComponent }],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class CameraCaptureComponent extends BaseCustomInput<FileUploadInputValueInterface | object | null> {\r\n readonly inputConfig = input.required<ITowerStepColumn>();\r\n\r\n protected readonly video = viewChild.required<ElementRef<HTMLVideoElement>>('video');\r\n protected readonly canvas = viewChild.required<ElementRef<HTMLCanvasElement>>('canvas');\r\n\r\n /**\r\n * True when the descriptor marks the field `readonly` or `disabled`. Blocks the\r\n * capture/recapture actions so the camera honours the same `readonly || disabled`\r\n * contract as the reference text input.\r\n */\r\n protected readonly isReadOnly = computed<boolean>(() => {\r\n const cfg = this.inputConfig();\r\n return !!cfg?.readonly || !!cfg?.disabled;\r\n });\r\n\r\n protected readonly WIDTH = 640;\r\n protected readonly HEIGHT = 480;\r\n protected captures: string[] = [];\r\n protected isCaptured = false;\r\n protected videoMode = false;\r\n\r\n readonly #platformId = inject(PLATFORM_ID);\r\n\r\n constructor() {\r\n super(\r\n inject(NgControl, { optional: true, self: true }) as NgControl,\r\n inject<ElementRef<HTMLElement>>(ElementRef),\r\n customInputConfig,\r\n );\r\n }\r\n\r\n override get empty(): boolean {\r\n return !this.value;\r\n }\r\n\r\n override get shouldLabelFloat(): boolean {\r\n return this.focused || !this.empty;\r\n }\r\n\r\n protected recapture(): void {\r\n if (this.isReadOnly()) return;\r\n if (!isPlatformBrowser(this.#platformId)) return;\r\n const videoEl = this.video()?.nativeElement;\r\n if (!videoEl) return;\r\n videoEl.srcObject = null;\r\n this.isCaptured = false;\r\n setupDevices(this.setup);\r\n this.value = null;\r\n this.stateChanges.next();\r\n }\r\n\r\n protected readonly setup = (stream: MediaStream): void => {\r\n if (!isPlatformBrowser(this.#platformId)) return;\r\n const videoEl = this.video()?.nativeElement;\r\n if (!videoEl) return;\r\n try {\r\n videoEl.srcObject = stream;\r\n void videoEl.play();\r\n } catch {\r\n // Ignored: play() may reject if the element is detached or autoplay is blocked.\r\n }\r\n };\r\n\r\n protected touch(): void {\r\n this.markAsTouched();\r\n }\r\n\r\n protected capture(): void {\r\n if (this.isReadOnly()) return;\r\n if (!isPlatformBrowser(this.#platformId)) return;\r\n const videoEl = this.video()?.nativeElement;\r\n const canvasEl = this.canvas()?.nativeElement;\r\n if (!videoEl || !canvasEl) return;\r\n\r\n this.touch();\r\n this.drawImageToCanvas(videoEl);\r\n const fileType = (this.inputConfig() as IFileUploadInput | undefined)?.fileType;\r\n this.value = {\r\n fileName: new Date(),\r\n type: fileType,\r\n base64: canvasEl.toDataURL('image/png'),\r\n };\r\n\r\n this.captures.push(canvasEl.toDataURL('image/png'));\r\n this.isCaptured = true;\r\n this.stopVideo();\r\n this.onChange(this.value);\r\n this.stateChanges.next();\r\n }\r\n\r\n protected stopVideo(): void {\r\n if (!isPlatformBrowser(this.#platformId)) return;\r\n const videoEl = this.video()?.nativeElement;\r\n const src = videoEl?.srcObject;\r\n if (src && src instanceof MediaStream) {\r\n src.getTracks().forEach(track => track.stop());\r\n }\r\n }\r\n\r\n private drawImageToCanvas(image: HTMLVideoElement): void {\r\n if (!isPlatformBrowser(this.#platformId)) return;\r\n const canvasEl = this.canvas()?.nativeElement;\r\n const ctx = canvasEl?.getContext('2d');\r\n if (!ctx) return;\r\n ctx.drawImage(image, 0, 0, this.WIDTH, this.HEIGHT);\r\n }\r\n}\r\n","<br>\r\n<div class=\"video-container\">\r\n <video\r\n style=\"margin: auto;\"\r\n [style.display]=\"!isCaptured ? 'block' : 'none'\"\r\n #video\r\n id=\"video\"\r\n [width]=\"WIDTH\"\r\n [height]=\"HEIGHT\"\r\n autoplay\r\n ></video>\r\n <canvas\r\n [style.display]=\"isCaptured ? 'block' : 'none'\"\r\n #canvas\r\n id=\"canvas\"\r\n [width]=\"WIDTH\"\r\n [height]=\"HEIGHT\"\r\n ></canvas>\r\n</div>\r\n<mat-toolbar style=\"background: none;\">\r\n <span class=\"spacer\"></span>\r\n <button (click)=\"isCaptured ? recapture() : capture()\" [disabled]=\"isReadOnly()\" [color]=\"isCaptured?'primary':'warn'\" mat-icon-button>\r\n <mat-icon>\r\n photo_camera\r\n </mat-icon>\r\n\r\n </button>\r\n @if (!isCaptured) {\r\n <button (click)=\"stopVideo()\" mat-icon-button>\r\n <mat-icon>\r\n stop\r\n </mat-icon>\r\n\r\n </button>\r\n }\r\n <span class=\"spacer\"></span>\r\n</mat-toolbar>\r\n","import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core';\r\nimport { FormGroup, ReactiveFormsModule } from '@angular/forms';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport type { ITowerStepColumn } from 'ngx-t-forms-types';\r\nimport { TFormInputStatusComponent } from '../../../t-form-input-status/t-form-input-status.component';\r\nimport { CameraCaptureComponent } from './core/camera-capture/camera-capture.component';\r\nimport { getInputErrorMessage } from '../../../../services/core/t-input-controller/functions/inputErrorMessage';\r\n\r\n/** Wraps the camera-capture control inside a `mat-form-field`. */\r\n@Component({\r\n selector: 'lib-image-capture-input-element',\r\n templateUrl: './image-capture-input-element.component.html',\r\n styleUrl: './image-capture-input-element.component.css',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n imports: [\r\n ReactiveFormsModule,\r\n MatFormFieldModule,\r\n MatIconModule,\r\n MatButtonModule,\r\n MatTooltipModule,\r\n TFormInputStatusComponent,\r\n CameraCaptureComponent,\r\n ],\r\n})\r\nexport class ImageCaptureInputElementComponent {\r\n readonly inputConfig = input.required<ITowerStepColumn>();\r\n readonly formGroup = input.required<FormGroup>();\r\n readonly reload = output<void>();\r\n\r\n protected readonly errorMessage = computed(() =>\r\n getInputErrorMessage(this.inputConfig(), this.formGroup()),\r\n );\r\n}\r\n","<ng-container [formGroup]=\"formGroup()\">\r\n @if (inputConfig(); as inputConfig) {\r\n <mat-form-field [appearance]=\"inputConfig.appearance || 'fill'\" subscriptSizing=\"dynamic\">\r\n <mat-label>\r\n {{ inputConfig.label }}\r\n <lib-t-form-input-status [inputConfig]=\"inputConfig\"></lib-t-form-input-status>\r\n </mat-label>\r\n\r\n <lib-camera-capture\r\n [required]=\"inputConfig.required\"\r\n [inputConfig]=\"inputConfig\"\r\n [formControlName]=\"inputConfig.id\"\r\n ></lib-camera-capture>\r\n\r\n @if (inputConfig.hintLabel || inputConfig.temporaryHint) {\r\n <mat-hint class=\"inputHint\">\r\n {{ inputConfig.temporaryHint || inputConfig.hintLabel }}\r\n </mat-hint>\r\n }\r\n\r\n @if (!!errorMessage()) {\r\n <mat-error class=\"oneLineTextEllipsis\" matTooltipClass=\"errorToolTip\">{{ errorMessage() }}</mat-error>\r\n }\r\n\r\n @if (inputConfig.canReload?.canReload) {\r\n <button\r\n mat-icon-button\r\n style=\"margin-right: 4px;\"\r\n matTooltip=\"Click to refresh this field.\"\r\n class=\"input-sync-button\"\r\n (click)=\"inputConfig.canReload.emit()\"\r\n matSuffix\r\n >\r\n <mat-icon style=\"color: var(--mat-sys-primary)\">sync</mat-icon>\r\n </button>\r\n }\r\n\r\n @if (inputConfig.prefixIcon) {\r\n <mat-icon matPrefix>{{ inputConfig.prefixIcon }}</mat-icon>\r\n }\r\n\r\n @if (inputConfig.suffixIcon && inputConfig.id !== 'password') {\r\n <mat-icon matSuffix>{{ inputConfig.suffixIcon }}</mat-icon>\r\n }\r\n\r\n @if (inputConfig.prefixText) {\r\n <span matPrefix style=\"top: 0\">{{ inputConfig.prefixText }}</span>\r\n }\r\n @if (inputConfig.suffixText) {\r\n <span matSuffix style=\"padding-left: 5px\">{{ inputConfig.suffixText }}</span>\r\n }\r\n\r\n @if (inputConfig.maxLength && formGroup()) {\r\n <mat-hint align=\"end\">\r\n {{ (formGroup().controls[inputConfig.id]?.value?.length || 0) + '/' + inputConfig.maxLength }}\r\n </mat-hint>\r\n }\r\n </mat-form-field>\r\n }\r\n</ng-container>\r\n"],"names":["i1","i3","i2","i4"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAMO,eAAe,YAAY,CAChC,cAA6C,EAAA;;;IAI7C,IAAI,OAAO,SAAS,KAAK,WAAW;AAAE,QAAA,OAAO,SAAS;IAEtD,IAAI,SAAS,CAAC,YAAY,IAAI,SAAS,CAAC,YAAY,CAAC,YAAY,EAAE;AACjE,QAAA,IAAI;YACF,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,YAAY,CAAC,YAAY,CAAC;AACvD,gBAAA,KAAK,EAAE,IAAI;AACZ,aAAA,CAAC;YACF,IAAI,MAAM,EAAE;gBACV,cAAc,CAAC,MAAM,CAAC;AACtB,gBAAA,OAAO,MAAM;YACf;iBAAO;AACL,gBAAA,OAAO,iCAAiC;YAC1C;QACF;QAAE,OAAO,CAAC,EAAE;AACV,YAAA,OAAO,CAAC;QACV;IACF;AACA,IAAA,OAAO,SAAS;AAClB;AAGM,SAAU,qBAAqB,CAAC,OAAwB,EAAA;;AAE5D,IAAA,MAAM,IAAI,GAAiC,OAAO,CAAC,KAAK;;IAGxD,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;AACzB,QAAA,OAAO,EAAE,YAAY,EAAE,yBAAyB,EAAE;IACpD;;;IAKA,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A,UAAA,EAAA,CAAA;kBAf7C,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,iCAAiC,EAAA,eAAA,EAG1B,uBAAuB,CAAC,MAAM,EAAA,OAAA,EACtC;wBACP,mBAAmB;wBACnB,kBAAkB;wBAClB,aAAa;wBACb,eAAe;wBACf,gBAAgB;wBAChB,yBAAyB;wBACzB,sBAAsB;AACvB,qBAAA,EAAA,QAAA,EAAA,ksEAAA,EAAA,MAAA,EAAA,CAAA,oJAAA,CAAA,EAAA;;;;;"}
|
|
1
|
+
{"version":3,"file":"ngx-t-forms-image-capture-input-element.component-BmVXoC_z.mjs","sources":["../../../projects/ngx-t-forms/src/lib/components/t-form-input/elements/file-upload-input-element/core/file-uploader/camera-functions.ts","../../../projects/ngx-t-forms/src/lib/components/t-form-input/elements/image-capture-input-element/core/camera-capture/camera-capture.component.ts","../../../projects/ngx-t-forms/src/lib/components/t-form-input/elements/image-capture-input-element/core/camera-capture/camera-capture.component.html","../../../projects/ngx-t-forms/src/lib/components/t-form-input/elements/image-capture-input-element/image-capture-input-element.component.ts","../../../projects/ngx-t-forms/src/lib/components/t-form-input/elements/image-capture-input-element/image-capture-input-element.component.html"],"sourcesContent":["// Image capture\r\n\r\nimport { AbstractControl, ValidationErrors } from \"@angular/forms\";\r\nimport { FileUploadInputValueInterface } from \"ngx-t-forms-types\";\r\n\r\n\r\nexport async function setupDevices(\r\n cameraCallback: (stream: MediaStream) => void\r\n): Promise<MediaStream | string | unknown | undefined> {\r\n // SSR guard (Trap 14): free helper has no DI context. Returning `undefined`\r\n // matches the existing \"no media device\" branch — caller contract preserved.\r\n if (typeof navigator === 'undefined') return undefined;\r\n\r\n if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {\r\n try {\r\n const stream = await navigator.mediaDevices.getUserMedia({\r\n video: true,\r\n });\r\n if (stream) {\r\n cameraCallback(stream);\r\n return stream;\r\n } else {\r\n return 'You have no output video device';\r\n }\r\n } catch (e) {\r\n return e;\r\n }\r\n }\r\n return undefined;\r\n}\r\n\r\n\r\nexport function fileUploaderValidator(control: AbstractControl): ValidationErrors | null {\r\n // Implement your validation logic here\r\n const file: FileUploadInputValueInterface= control.value;\r\n\r\n // Example validation: Check if file is provided\r\n if (!file || !file.base64) {\r\n return { requiredFile: 'You must upload a file.' };\r\n }\r\n\r\n // Add more validation logic as needed\r\n // ...\r\n\r\n return null; // Return null if no validation errors\r\n}","import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n ElementRef,\r\n PLATFORM_ID,\r\n computed,\r\n inject,\r\n input,\r\n viewChild,\r\n} from '@angular/core';\r\nimport { NgControl } from '@angular/forms';\r\nimport { isPlatformBrowser } from '@angular/common';\r\nimport { MatFormFieldControl } from '@angular/material/form-field';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatToolbarModule } from '@angular/material/toolbar';\r\nimport { MatButtonModule } from '@angular/material/button';\r\n\r\nimport { FileUploadInputValueInterface, IFileUploadInput, ITowerStepColumn } from 'ngx-t-forms-types';\r\n\r\nimport { setupDevices } from '../../../file-upload-input-element/core/file-uploader/camera-functions';\r\nimport { BaseCustomInput, BaseCustomInputConfig } from '../../../../../../services/core/t-input-controller/functions/baseCustomInput';\r\n\r\nconst customInputConfig: BaseCustomInputConfig = {\r\n controlType: 'app-camera-capture',\r\n nextId: 0,\r\n};\r\n\r\n@Component({\r\n selector: 'lib-camera-capture',\r\n templateUrl: './camera-capture.component.html',\r\n styleUrls: ['./camera-capture.component.scss'],\r\n imports: [MatIconModule, MatToolbarModule, MatButtonModule],\r\n providers: [{ provide: MatFormFieldControl, useExisting: CameraCaptureComponent }],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class CameraCaptureComponent extends BaseCustomInput<FileUploadInputValueInterface | object | null> {\r\n readonly inputConfig = input.required<ITowerStepColumn>();\r\n\r\n protected readonly video = viewChild.required<ElementRef<HTMLVideoElement>>('video');\r\n protected readonly canvas = viewChild.required<ElementRef<HTMLCanvasElement>>('canvas');\r\n\r\n /**\r\n * True when the descriptor marks the field `readonly` or `disabled`. Blocks the\r\n * capture/recapture actions so the camera honours the same `readonly || disabled`\r\n * contract as the reference text input.\r\n */\r\n protected readonly isReadOnly = computed<boolean>(() => {\r\n const cfg = this.inputConfig();\r\n return !!cfg?.readonly || !!cfg?.disabled;\r\n });\r\n\r\n protected readonly WIDTH = 640;\r\n protected readonly HEIGHT = 480;\r\n protected captures: string[] = [];\r\n protected isCaptured = false;\r\n protected videoMode = false;\r\n\r\n readonly #platformId = inject(PLATFORM_ID);\r\n\r\n constructor() {\r\n super(\r\n inject(NgControl, { optional: true, self: true }) as NgControl,\r\n inject<ElementRef<HTMLElement>>(ElementRef),\r\n customInputConfig,\r\n );\r\n }\r\n\r\n override get empty(): boolean {\r\n return !this.value;\r\n }\r\n\r\n override get shouldLabelFloat(): boolean {\r\n return this.focused || !this.empty;\r\n }\r\n\r\n protected recapture(): void {\r\n if (this.isReadOnly()) return;\r\n if (!isPlatformBrowser(this.#platformId)) return;\r\n const videoEl = this.video()?.nativeElement;\r\n if (!videoEl) return;\r\n videoEl.srcObject = null;\r\n this.isCaptured = false;\r\n setupDevices(this.setup);\r\n this.value = null;\r\n this.stateChanges.next();\r\n }\r\n\r\n protected readonly setup = (stream: MediaStream): void => {\r\n if (!isPlatformBrowser(this.#platformId)) return;\r\n const videoEl = this.video()?.nativeElement;\r\n if (!videoEl) return;\r\n try {\r\n videoEl.srcObject = stream;\r\n void videoEl.play();\r\n } catch {\r\n // Ignored: play() may reject if the element is detached or autoplay is blocked.\r\n }\r\n };\r\n\r\n protected touch(): void {\r\n this.markAsTouched();\r\n }\r\n\r\n protected capture(): void {\r\n if (this.isReadOnly()) return;\r\n if (!isPlatformBrowser(this.#platformId)) return;\r\n const videoEl = this.video()?.nativeElement;\r\n const canvasEl = this.canvas()?.nativeElement;\r\n if (!videoEl || !canvasEl) return;\r\n\r\n this.touch();\r\n this.drawImageToCanvas(videoEl);\r\n const fileType = (this.inputConfig() as IFileUploadInput | undefined)?.fileType;\r\n this.value = {\r\n fileName: new Date(),\r\n type: fileType,\r\n base64: canvasEl.toDataURL('image/png'),\r\n };\r\n\r\n this.captures.push(canvasEl.toDataURL('image/png'));\r\n this.isCaptured = true;\r\n this.stopVideo();\r\n this.onChange(this.value);\r\n this.stateChanges.next();\r\n }\r\n\r\n protected stopVideo(): void {\r\n if (!isPlatformBrowser(this.#platformId)) return;\r\n const videoEl = this.video()?.nativeElement;\r\n const src = videoEl?.srcObject;\r\n if (src && src instanceof MediaStream) {\r\n src.getTracks().forEach(track => track.stop());\r\n }\r\n }\r\n\r\n private drawImageToCanvas(image: HTMLVideoElement): void {\r\n if (!isPlatformBrowser(this.#platformId)) return;\r\n const canvasEl = this.canvas()?.nativeElement;\r\n const ctx = canvasEl?.getContext('2d');\r\n if (!ctx) return;\r\n ctx.drawImage(image, 0, 0, this.WIDTH, this.HEIGHT);\r\n }\r\n}\r\n","<br>\r\n<div class=\"video-container\">\r\n <video\r\n style=\"margin: auto;\"\r\n [style.display]=\"!isCaptured ? 'block' : 'none'\"\r\n #video\r\n id=\"video\"\r\n [width]=\"WIDTH\"\r\n [height]=\"HEIGHT\"\r\n autoplay\r\n ></video>\r\n <canvas\r\n [style.display]=\"isCaptured ? 'block' : 'none'\"\r\n #canvas\r\n id=\"canvas\"\r\n [width]=\"WIDTH\"\r\n [height]=\"HEIGHT\"\r\n ></canvas>\r\n</div>\r\n<mat-toolbar style=\"background: none;\">\r\n <span class=\"spacer\"></span>\r\n <button (click)=\"isCaptured ? recapture() : capture()\" [disabled]=\"isReadOnly()\" [color]=\"isCaptured?'primary':'warn'\" mat-icon-button>\r\n <mat-icon>\r\n photo_camera\r\n </mat-icon>\r\n\r\n </button>\r\n @if (!isCaptured) {\r\n <button (click)=\"stopVideo()\" mat-icon-button>\r\n <mat-icon>\r\n stop\r\n </mat-icon>\r\n\r\n </button>\r\n }\r\n <span class=\"spacer\"></span>\r\n</mat-toolbar>\r\n","import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core';\r\nimport { FormGroup, ReactiveFormsModule } from '@angular/forms';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport type { ITowerStepColumn } from 'ngx-t-forms-types';\r\nimport { TFormInputStatusComponent } from '../../../t-form-input-status/t-form-input-status.component';\r\nimport { CameraCaptureComponent } from './core/camera-capture/camera-capture.component';\r\nimport { getInputErrorMessage } from '../../../../services/core/t-input-controller/functions/inputErrorMessage';\r\n\r\n/** Wraps the camera-capture control inside a `mat-form-field`. */\r\n@Component({\r\n selector: 'lib-image-capture-input-element',\r\n templateUrl: './image-capture-input-element.component.html',\r\n styleUrl: './image-capture-input-element.component.css',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n imports: [\r\n ReactiveFormsModule,\r\n MatFormFieldModule,\r\n MatIconModule,\r\n MatButtonModule,\r\n MatTooltipModule,\r\n TFormInputStatusComponent,\r\n CameraCaptureComponent,\r\n ],\r\n})\r\nexport class ImageCaptureInputElementComponent {\r\n readonly inputConfig = input.required<ITowerStepColumn>();\r\n readonly formGroup = input.required<FormGroup>();\r\n readonly reload = output<void>();\r\n\r\n protected readonly errorMessage = computed(() =>\r\n getInputErrorMessage(this.inputConfig(), this.formGroup()),\r\n );\r\n}\r\n","<ng-container [formGroup]=\"formGroup()\">\r\n @if (inputConfig(); as inputConfig) {\r\n <mat-form-field [appearance]=\"inputConfig.appearance || 'fill'\" subscriptSizing=\"dynamic\">\r\n <mat-label>\r\n {{ inputConfig.label }}\r\n <lib-t-form-input-status [inputConfig]=\"inputConfig\"></lib-t-form-input-status>\r\n </mat-label>\r\n\r\n <lib-camera-capture\r\n [required]=\"inputConfig.required\"\r\n [inputConfig]=\"inputConfig\"\r\n [formControlName]=\"inputConfig.id\"\r\n ></lib-camera-capture>\r\n\r\n @if (inputConfig.hintLabel || inputConfig.temporaryHint) {\r\n <mat-hint class=\"inputHint\">\r\n {{ inputConfig.temporaryHint || inputConfig.hintLabel }}\r\n </mat-hint>\r\n }\r\n\r\n @if (!!errorMessage()) {\r\n <mat-error class=\"oneLineTextEllipsis\" matTooltipClass=\"errorToolTip\">{{ errorMessage() }}</mat-error>\r\n }\r\n\r\n @if (inputConfig.canReload?.canReload) {\r\n <button\r\n mat-icon-button\r\n style=\"margin-right: 4px;\"\r\n matTooltip=\"Click to refresh this field.\"\r\n class=\"input-sync-button\"\r\n (click)=\"inputConfig.canReload.emit()\"\r\n matSuffix\r\n >\r\n <mat-icon style=\"color: var(--mat-sys-primary)\">sync</mat-icon>\r\n </button>\r\n }\r\n\r\n @if (inputConfig.prefixIcon) {\r\n <mat-icon matPrefix>{{ inputConfig.prefixIcon }}</mat-icon>\r\n }\r\n\r\n @if (inputConfig.suffixIcon && inputConfig.id !== 'password') {\r\n <mat-icon matSuffix>{{ inputConfig.suffixIcon }}</mat-icon>\r\n }\r\n\r\n @if (inputConfig.prefixText) {\r\n <span matPrefix style=\"top: 0\">{{ inputConfig.prefixText }}</span>\r\n }\r\n @if (inputConfig.suffixText) {\r\n <span matSuffix style=\"padding-left: 5px\">{{ inputConfig.suffixText }}</span>\r\n }\r\n\r\n @if (inputConfig.maxLength && formGroup()) {\r\n <mat-hint align=\"end\">\r\n {{ (formGroup().controls[inputConfig.id]?.value?.length || 0) + '/' + inputConfig.maxLength }}\r\n </mat-hint>\r\n }\r\n </mat-form-field>\r\n }\r\n</ng-container>\r\n"],"names":["i1","i3","i2","i4"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAMO,eAAe,YAAY,CAChC,cAA6C,EAAA;;;IAI7C,IAAI,OAAO,SAAS,KAAK,WAAW;AAAE,QAAA,OAAO,SAAS;IAEtD,IAAI,SAAS,CAAC,YAAY,IAAI,SAAS,CAAC,YAAY,CAAC,YAAY,EAAE;AACjE,QAAA,IAAI;YACF,MAAM,MAAM,G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AA,EAAA,IAAA,EACf,gBAAgB,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,UAAA,EAAA,QAAA,EAAA,cAAA,EAAA,MAAA,EAAA,CAAA,oBAAA,EAAA,4BAAA,EAAA,oBAAA,EAAA,qBAAA,EAAA,qBAAA,EAAA,yBAAA,EAAA,YAAA,EAAA,iBAAA,CAAA,EAAA,QAAA,EAAA,CAAA,YAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAChB,yBAAyB,6FACzB,sBAAsB,EAAA,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,CAAA,aAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;4FAGb,iCAAiC,EAAA,UAAA,EAAA,CAAA;kBAf7C,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,iCAAiC,EAAA,eAAA,EAG1B,uBAAuB,CAAC,MAAM,EAAA,OAAA,EACtC;wBACP,mBAAmB;wBACnB,kBAAkB;wBAClB,aAAa;wBACb,eAAe;wBACf,gBAAgB;wBAChB,yBAAyB;wBACzB,sBAAsB;AACvB,qBAAA,EAAA,QAAA,EAAA,ksEAAA,EAAA,MAAA,EAAA,CAAA,oJAAA,CAAA,EAAA;;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { S as DialogTemplateComponent, U as FormBuilderComponent, V as FormsComponent, W as MscoaFormInputComponent, X as SignatureInputElementComponent, T as TDynamicDataEditComponent, c as TDynamicDataViewComponent, Y as TFormInputComponent, Z as UserFormStepperComponent, $ as ValidationExpressioCreatorComponent, a0 as getSignatureImage, t as testAgainstItem } from './ngx-t-forms-ngx-t-forms-B3WhBGlD.mjs';
|
|
2
|
+
//# sourceMappingURL=ngx-t-forms-index-yasuBvXP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngx-t-forms-index-yasuBvXP.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, DestroyRef, viewChild, forwardRef, Input, Optional, Self, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
4
|
+
import { MatFormFieldControl } from '@angular/material/form-field';
|
|
5
|
+
import * as i2 from '@angular/material/input';
|
|
6
|
+
import { MatInputModule } from '@angular/material/input';
|
|
7
|
+
import { InputTypes } from 'ngx-t-forms-types';
|
|
8
|
+
import { Subject, debounceTime } from 'rxjs';
|
|
9
|
+
import { B as BaseCustomInput } from './ngx-t-forms-ngx-t-forms-B3WhBGlD.mjs';
|
|
10
|
+
import * as i1 from '@angular/forms';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @file The presentation half of what a column's `type` promises.
|
|
14
|
+
*
|
|
15
|
+
* **The gap this closes.** `inputTypeValidators.ts` made `tel` / `url` / `color`
|
|
16
|
+
* mean something to the form control. This file makes them mean something to the
|
|
17
|
+
* person filling the form in: the right on-screen keyboard, and a phone number
|
|
18
|
+
* that reads as a phone number.
|
|
19
|
+
*
|
|
20
|
+
* Before this, `type: 'tel'` reached the DOM as `<input type="tel">` and nothing
|
|
21
|
+
* else — no `inputmode`, so a phone field opened the full alphabetic keyboard on
|
|
22
|
+
* a handset, and `0821234567` stayed an undifferentiated run of ten digits.
|
|
23
|
+
*
|
|
24
|
+
* Pure functions with no Angular or DOM dependency, so they are equally usable
|
|
25
|
+
* from a component, a renderer, or a test.
|
|
26
|
+
*/
|
|
27
|
+
/** Digits in the last group of a formatted phone number. */
|
|
28
|
+
const TEL_TAIL_GROUP = 4;
|
|
29
|
+
/** Digits in every group before the last. */
|
|
30
|
+
const TEL_GROUP = 3;
|
|
31
|
+
/** Below this, the number is too short to group meaningfully; above it, E.164 says it is not a number. */
|
|
32
|
+
const TEL_MIN_DIGITS = 7;
|
|
33
|
+
const TEL_MAX_DIGITS = 15;
|
|
34
|
+
/**
|
|
35
|
+
* ITU-T E.164 country calling codes that are one or two digits long. Every code
|
|
36
|
+
* not listed here is three digits.
|
|
37
|
+
*
|
|
38
|
+
* Spelled out rather than inferred because the length of a calling code is not
|
|
39
|
+
* derivable from its value — `27` is South Africa but `271` is nothing, while
|
|
40
|
+
* `26` is nothing and `263` is Zimbabwe. Splitting on the wrong boundary is what
|
|
41
|
+
* turns `+27 82 123 4567` into the unreadable `+2 782 123 4567`.
|
|
42
|
+
*/
|
|
43
|
+
const ONE_DIGIT_CODES = new Set(['1', '7']);
|
|
44
|
+
const TWO_DIGIT_CODES = new Set([
|
|
45
|
+
'20', '27',
|
|
46
|
+
'30', '31', '32', '33', '34', '36', '39',
|
|
47
|
+
'40', '41', '43', '44', '45', '46', '47', '48', '49',
|
|
48
|
+
'51', '52', '53', '54', '55', '56', '57', '58',
|
|
49
|
+
'60', '61', '62', '63', '64', '65', '66',
|
|
50
|
+
'81', '82', '84', '86',
|
|
51
|
+
'90', '91', '92', '93', '94', '95', '98',
|
|
52
|
+
]);
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
// Keyboard hint
|
|
55
|
+
// ---------------------------------------------------------------------------
|
|
56
|
+
/**
|
|
57
|
+
* The `inputmode` a declared column type implies, or `null` when the type
|
|
58
|
+
* implies no particular keyboard.
|
|
59
|
+
*
|
|
60
|
+
* `type` alone already picks the keyboard on most desktop browsers, but on a
|
|
61
|
+
* handset it is `inputmode` that decides — which is why a `tel` column opened
|
|
62
|
+
* the alphabetic keyboard. Temporal types are left alone: they render a native
|
|
63
|
+
* picker, and forcing a keyboard mode onto one only fights it.
|
|
64
|
+
*
|
|
65
|
+
* @param type - The column's declared `type`, in any casing, possibly absent.
|
|
66
|
+
* @returns The `inputmode` attribute value, or `null` to leave it unset.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* resolveInputMode(InputTypes.Tel); // 'tel'
|
|
70
|
+
* resolveInputMode(InputTypes.Text); // null
|
|
71
|
+
*/
|
|
72
|
+
function resolveInputMode(type) {
|
|
73
|
+
switch (typeof type === 'string' ? type.toLowerCase() : '') {
|
|
74
|
+
case InputTypes.Tel:
|
|
75
|
+
return 'tel';
|
|
76
|
+
case InputTypes.Email:
|
|
77
|
+
return 'email';
|
|
78
|
+
case InputTypes.Url:
|
|
79
|
+
return 'url';
|
|
80
|
+
case InputTypes.Number:
|
|
81
|
+
return 'decimal';
|
|
82
|
+
case InputTypes.Search:
|
|
83
|
+
return 'search';
|
|
84
|
+
default:
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
// Phone number formatting
|
|
90
|
+
// ---------------------------------------------------------------------------
|
|
91
|
+
/**
|
|
92
|
+
* Groups a complete phone number for display: `0821234567` → `082 123 4567`,
|
|
93
|
+
* `+27821234567` → `+27 82 123 4567`.
|
|
94
|
+
*
|
|
95
|
+
* **Why grouping runs on a finished number, not on every keystroke.** Groups are
|
|
96
|
+
* measured from the right, so the boundaries only settle once the last digit is
|
|
97
|
+
* in. Applied live, the same rule would reflow the field under the caret on
|
|
98
|
+
* every press — `082 1234` becoming `0 821 2345` becoming `08 212 3456` — and
|
|
99
|
+
* `InputCustomComponent` deliberately never rewrites the DOM mid-keystroke
|
|
100
|
+
* (doing so used to drop characters during fast typing). Callers apply this on
|
|
101
|
+
* blur and on external writes, where the value is whole and the caret is gone.
|
|
102
|
+
*
|
|
103
|
+
* Right-to-left grouping is what makes one rule fit both plans: a 9-digit South
|
|
104
|
+
* African subscriber number lands on `82 123 4567` and a 10-digit North American
|
|
105
|
+
* one on `555 123 4567`, with no per-country national format to maintain.
|
|
106
|
+
*
|
|
107
|
+
* **Fail-open.** Anything that is not a recognisable phone number — free text, a
|
|
108
|
+
* digit count outside E.164's range, an incomplete entry — is returned exactly
|
|
109
|
+
* as given. This never destroys what someone typed; rejecting it is
|
|
110
|
+
* `inputTypeValidators.ts`'s job, and it reports on the original text.
|
|
111
|
+
*
|
|
112
|
+
* @param raw - The value as typed or stored.
|
|
113
|
+
* @returns The grouped number, or `raw` unchanged when it cannot be read as one.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* formatTelForDisplay('0821234567'); // '082 123 4567'
|
|
117
|
+
* formatTelForDisplay('+27821234567'); // '+27 82 123 4567'
|
|
118
|
+
* formatTelForDisplay('call me'); // 'call me'
|
|
119
|
+
*/
|
|
120
|
+
function formatTelForDisplay(raw) {
|
|
121
|
+
const trimmed = raw.trim();
|
|
122
|
+
if (trimmed === '')
|
|
123
|
+
return raw;
|
|
124
|
+
const international = trimmed.startsWith('+');
|
|
125
|
+
const digits = trimmed.replace(/\D/g, '');
|
|
126
|
+
// Any letter, or a stray `+` past the first character, means this is not a
|
|
127
|
+
// phone number we can safely rewrite.
|
|
128
|
+
if (/[^\d\s().+-]/.test(trimmed) || trimmed.indexOf('+', 1) !== -1)
|
|
129
|
+
return raw;
|
|
130
|
+
if (digits.length < TEL_MIN_DIGITS || digits.length > TEL_MAX_DIGITS)
|
|
131
|
+
return raw;
|
|
132
|
+
if (!international)
|
|
133
|
+
return groupFromRight(digits);
|
|
134
|
+
const codeLength = callingCodeLength(digits);
|
|
135
|
+
const national = digits.slice(codeLength);
|
|
136
|
+
if (national === '')
|
|
137
|
+
return raw;
|
|
138
|
+
return `+${digits.slice(0, codeLength)} ${groupFromRight(national)}`;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* How many leading digits of an international number form its calling code.
|
|
142
|
+
* Falls back to three, the length of every code outside {@link ONE_DIGIT_CODES}
|
|
143
|
+
* and {@link TWO_DIGIT_CODES}.
|
|
144
|
+
*/
|
|
145
|
+
function callingCodeLength(digits) {
|
|
146
|
+
if (ONE_DIGIT_CODES.has(digits.slice(0, 1)))
|
|
147
|
+
return 1;
|
|
148
|
+
if (TWO_DIGIT_CODES.has(digits.slice(0, 2)))
|
|
149
|
+
return 2;
|
|
150
|
+
return 3;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Splits digits into a final group of {@link TEL_TAIL_GROUP} preceded by groups
|
|
154
|
+
* of {@link TEL_GROUP}, measured from the right so the leading group absorbs the
|
|
155
|
+
* remainder: `821234567` → `82 123 4567`.
|
|
156
|
+
*/
|
|
157
|
+
function groupFromRight(digits) {
|
|
158
|
+
if (digits.length <= TEL_TAIL_GROUP)
|
|
159
|
+
return digits;
|
|
160
|
+
const groups = [digits.slice(-TEL_TAIL_GROUP)];
|
|
161
|
+
let head = digits.slice(0, -TEL_TAIL_GROUP);
|
|
162
|
+
while (head.length > TEL_GROUP) {
|
|
163
|
+
groups.unshift(head.slice(-TEL_GROUP));
|
|
164
|
+
head = head.slice(0, -TEL_GROUP);
|
|
165
|
+
}
|
|
166
|
+
groups.unshift(head);
|
|
167
|
+
return groups.join(' ');
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const customInputConfig = {
|
|
171
|
+
controlType: 'lib-input-custom',
|
|
172
|
+
nextId: 0,
|
|
173
|
+
};
|
|
174
|
+
class InputCustomComponent extends BaseCustomInput {
|
|
175
|
+
#destroyRef;
|
|
176
|
+
#debounceTimeMs;
|
|
177
|
+
#valueSubject;
|
|
178
|
+
constructor(ngControl, elementRef) {
|
|
179
|
+
super(ngControl, elementRef, customInputConfig);
|
|
180
|
+
this.#destroyRef = inject(DestroyRef);
|
|
181
|
+
this.#debounceTimeMs = 300;
|
|
182
|
+
this.#valueSubject = new Subject();
|
|
183
|
+
// The native input is left uncontrolled while the user types: binding the
|
|
184
|
+
// (debounced, therefore lagging) model to `[value]` made Angular overwrite the
|
|
185
|
+
// DOM mid-keystroke and drop characters during fast typing. We instead push the
|
|
186
|
+
// model to the DOM only on external writes (writeValue) — never while typing.
|
|
187
|
+
// TS `private` (not ES `#private`): Angular signal queries cannot sit on an ES-private field.
|
|
188
|
+
this.inputEl = viewChild('inputEl', ...(ngDevMode ? [{ debugName: "inputEl" }] : /* istanbul ignore next */ []));
|
|
189
|
+
}
|
|
190
|
+
get empty() {
|
|
191
|
+
const n = this.value;
|
|
192
|
+
// Check for null, undefined, or empty string, but allow 0
|
|
193
|
+
return n === null || n === undefined || n === '';
|
|
194
|
+
}
|
|
195
|
+
get shouldLabelFloat() {
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* The on-screen keyboard the bound column's `type` implies, or `null` to leave
|
|
200
|
+
* `inputmode` unset. A getter rather than a signal because `inputConfig` is a
|
|
201
|
+
* setter-free classic `@Input()` (see its comment above) — the lookup is a
|
|
202
|
+
* single switch, so re-reading it per change detection costs nothing.
|
|
203
|
+
*/
|
|
204
|
+
get inputMode() {
|
|
205
|
+
return resolveInputMode(this.inputConfig?.type);
|
|
206
|
+
}
|
|
207
|
+
ngOnInit() {
|
|
208
|
+
this.#valueSubject
|
|
209
|
+
.pipe(debounceTime(this.#debounceTimeMs), takeUntilDestroyed(this.#destroyRef))
|
|
210
|
+
.subscribe((next) => {
|
|
211
|
+
// The base `value` setter guards on equality and fires onChange + stateChanges.
|
|
212
|
+
// Only the (heavier) form propagation + validation is debounced — never the display.
|
|
213
|
+
this.value = next;
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
ngAfterViewInit() {
|
|
217
|
+
// Reflect any value the form set before the view existed (initial bind / patch).
|
|
218
|
+
this.#syncInputFromModel();
|
|
219
|
+
}
|
|
220
|
+
writeValue(value) {
|
|
221
|
+
super.writeValue(value);
|
|
222
|
+
// External model change (patchValue / reset) — push it to the DOM. This never
|
|
223
|
+
// runs in response to the user's own typing, so it can't clobber the cursor.
|
|
224
|
+
this.#syncInputFromModel();
|
|
225
|
+
}
|
|
226
|
+
onInputChange($event) {
|
|
227
|
+
const next = $event.target?.value ?? '';
|
|
228
|
+
this.#valueSubject.next(next);
|
|
229
|
+
}
|
|
230
|
+
#syncInputFromModel() {
|
|
231
|
+
const el = this.inputEl()?.nativeElement;
|
|
232
|
+
if (!el) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
const v = this.value;
|
|
236
|
+
// Grouped for display only. The model keeps whatever the consumer patched in,
|
|
237
|
+
// so simply loading a form never rewrites stored data — only the user's own
|
|
238
|
+
// blur does that.
|
|
239
|
+
el.value = v === null || v === undefined ? '' : this.#forDisplay(String(v));
|
|
240
|
+
}
|
|
241
|
+
/** Applies the declared type's display format, if it has one. */
|
|
242
|
+
#forDisplay(value) {
|
|
243
|
+
return this.inputConfig?.type === InputTypes.Tel ? formatTelForDisplay(value) : value;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Groups the typed phone number once the field is left, and commits the grouped
|
|
247
|
+
* text as the value so what is stored matches what is shown.
|
|
248
|
+
*
|
|
249
|
+
* Runs on blur rather than on input because the grouping is measured from the
|
|
250
|
+
* right — applied per keystroke it would reflow the text under the caret, and
|
|
251
|
+
* this component deliberately never rewrites the DOM while the user types.
|
|
252
|
+
*
|
|
253
|
+
* The formatted text re-enters `#valueSubject` as well as being set directly:
|
|
254
|
+
* a keystroke from the last 300ms may still be in flight, and re-entering the
|
|
255
|
+
* debounce supersedes it rather than letting it land afterwards and leave the
|
|
256
|
+
* model holding the ungrouped text. The direct write keeps the control correct
|
|
257
|
+
* in the meantime; the base setter's equality guard makes the later duplicate a
|
|
258
|
+
* no-op.
|
|
259
|
+
*/
|
|
260
|
+
#applyDisplayFormatOnBlur() {
|
|
261
|
+
const el = this.inputEl()?.nativeElement;
|
|
262
|
+
if (!el || this.inputConfig?.type !== InputTypes.Tel) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const formatted = formatTelForDisplay(el.value);
|
|
266
|
+
if (formatted === el.value) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
el.value = formatted;
|
|
270
|
+
this.value = formatted;
|
|
271
|
+
this.#valueSubject.next(formatted);
|
|
272
|
+
}
|
|
273
|
+
onInputBlur($event) {
|
|
274
|
+
this.#applyDisplayFormatOnBlur();
|
|
275
|
+
this.touched = true; // Mark as touched on blur
|
|
276
|
+
this.onTouched();
|
|
277
|
+
this.blur.emit($event);
|
|
278
|
+
}
|
|
279
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: InputCustomComponent, deps: [{ token: i1.NgControl, optional: true, self: true }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
280
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: InputCustomComponent, isStandalone: true, selector: "lib-input-custom", inputs: { inputConfig: "inputConfig" }, host: { properties: { "class.floating": "shouldLabelFloat", "id": "id" } }, providers: [
|
|
281
|
+
{
|
|
282
|
+
provide: MatFormFieldControl,
|
|
283
|
+
//:Note
|
|
284
|
+
useExisting: forwardRef(() => InputCustomComponent),
|
|
285
|
+
},
|
|
286
|
+
], viewQueries: [{ propertyName: "inputEl", first: true, predicate: ["inputEl"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@if (inputConfig) {\r\n <input matInput\r\n #inputEl\r\n [readonly]=\"inputConfig.readonly || inputConfig.disabled\"\r\n (blur)=\"onInputBlur($event)\"\r\n [pattern]=\"inputConfig.pattern || ''\"\r\n [required]=\"inputConfig.required\"\r\n [attr.maxlength]=\"inputConfig.maxLength\"\r\n [type]=\"inputConfig.type || 'text'\"\n [attr.inputmode]=\"inputMode\"\r\n (input)=\"onInputChange($event)\"\r\n [attr.minlength]=\"inputConfig.minLength\"\r\n [autocomplete]=\"inputConfig.autocomplete\"\r\n [min]=\"inputConfig.min\"\r\n [max]=\"inputConfig.max\" />\r\n}\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
287
|
+
}
|
|
288
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: InputCustomComponent, decorators: [{
|
|
289
|
+
type: Component,
|
|
290
|
+
args: [{ selector: 'lib-input-custom', imports: [MatInputModule], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: {
|
|
291
|
+
'[class.floating]': 'shouldLabelFloat',
|
|
292
|
+
'[id]': 'id',
|
|
293
|
+
}, providers: [
|
|
294
|
+
{
|
|
295
|
+
provide: MatFormFieldControl,
|
|
296
|
+
//:Note
|
|
297
|
+
useExisting: forwardRef(() => InputCustomComponent),
|
|
298
|
+
},
|
|
299
|
+
], template: "@if (inputConfig) {\r\n <input matInput\r\n #inputEl\r\n [readonly]=\"inputConfig.readonly || inputConfig.disabled\"\r\n (blur)=\"onInputBlur($event)\"\r\n [pattern]=\"inputConfig.pattern || ''\"\r\n [required]=\"inputConfig.required\"\r\n [attr.maxlength]=\"inputConfig.maxLength\"\r\n [type]=\"inputConfig.type || 'text'\"\n [attr.inputmode]=\"inputMode\"\r\n (input)=\"onInputChange($event)\"\r\n [attr.minlength]=\"inputConfig.minLength\"\r\n [autocomplete]=\"inputConfig.autocomplete\"\r\n [min]=\"inputConfig.min\"\r\n [max]=\"inputConfig.max\" />\r\n}\r\n" }]
|
|
300
|
+
}], ctorParameters: () => [{ type: i1.NgControl, decorators: [{
|
|
301
|
+
type: Optional
|
|
302
|
+
}, {
|
|
303
|
+
type: Self
|
|
304
|
+
}] }, { type: i0.ElementRef }], propDecorators: { inputConfig: [{
|
|
305
|
+
type: Input
|
|
306
|
+
}], inputEl: [{ type: i0.ViewChild, args: ['inputEl', { isSignal: true }] }] } });
|
|
307
|
+
|
|
308
|
+
export { InputCustomComponent };
|
|
309
|
+
//# sourceMappingURL=ngx-t-forms-input-custom.component-CTye_tsv.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngx-t-forms-input-custom.component-CTye_tsv.mjs","sources":["../../../projects/ngx-t-forms/src/lib/shared/functions/inputTypePresentation.ts","../../../projects/ngx-t-forms/src/lib/components/t-form-input/elements/basic-input-input-element/core/input-custom/input-custom.component.ts","../../../projects/ngx-t-forms/src/lib/components/t-form-input/elements/basic-input-input-element/core/input-custom/input-custom.component.html"],"sourcesContent":["/**\n * @file The presentation half of what a column's `type` promises.\n *\n * **The gap this closes.** `inputTypeValidators.ts` made `tel` / `url` / `color`\n * mean something to the form control. This file makes them mean something to the\n * person filling the form in: the right on-screen keyboard, and a phone number\n * that reads as a phone number.\n *\n * Before this, `type: 'tel'` reached the DOM as `<input type=\"tel\">` and nothing\n * else — no `inputmode`, so a phone field opened the full alphabetic keyboard on\n * a handset, and `0821234567` stayed an undifferentiated run of ten digits.\n *\n * Pure functions with no Angular or DOM dependency, so they are equally usable\n * from a component, a renderer, or a test.\n */\nimport { InputTypes } from 'ngx-t-forms-types';\n\n/**\n * The `inputmode` values a browser understands. Narrower than the HTML spec's\n * full list — only the modes a declared {@link InputTypes} can imply.\n */\nexport type InputMode = 'tel' | 'email' | 'url' | 'decimal' | 'search';\n\n/** Digits in the last group of a formatted phone number. */\nconst TEL_TAIL_GROUP = 4;\n/** Digits in every group before the last. */\nconst TEL_GROUP = 3;\n/** Below this, the number is too short to group meaningfully; above it, E.164 says it is not a number. */\nconst TEL_MIN_DIGITS = 7;\nconst TEL_MAX_DIGITS = 15;\n\n/**\n * ITU-T E.164 country calling codes that are one or two digits long. Every code\n * not listed here is three digits.\n *\n * Spelled out rather than inferred because the length of a calling code is not\n * derivable from its value — `27` is South Africa but `271` is nothing, while\n * `26` is nothing and `263` is Zimbabwe. Splitting on the wrong boundary is what\n * turns `+27 82 123 4567` into the unreadable `+2 782 123 4567`.\n */\nconst ONE_DIGIT_CODES: ReadonlySet<string> = new Set(['1', '7']);\nconst TWO_DIGIT_CODES: ReadonlySet<string> = new Set([\n '20', '27',\n '30', '31', '32', '33', '34', '36', '39',\n '40', '41', '43', '44', '45', '46', '47', '48', '49',\n '51', '52', '53', '54', '55', '56', '57', '58',\n '60', '61', '62', '63', '64', '65', '66',\n '81', '82', '84', '86',\n '90', '91', '92', '93', '94', '95', '98',\n]);\n\n// ---------------------------------------------------------------------------\n// Keyboard hint\n// ---------------------------------------------------------------------------\n\n/**\n * The `inputmode` a declared column type implies, or `null` when the type\n * implies no particular keyboard.\n *\n * `type` alone already picks the keyboard on most desktop browsers, but on a\n * handset it is `inputmode` that decides — which is why a `tel` column opened\n * the alphabetic keyboard. Temporal types are left alone: they render a native\n * picker, and forcing a keyboard mode onto one only fights it.\n *\n * @param type - The column's declared `type`, in any casing, possibly absent.\n * @returns The `inputmode` attribute value, or `null` to leave it unset.\n *\n * @example\n * resolveInputMode(InputTypes.Tel); // 'tel'\n * resolveInputMode(InputTypes.Text); // null\n */\nexport function resolveInputMode(type: string | undefined): InputMode | null {\n switch (typeof type === 'string' ? type.toLowerCase() : '') {\n case InputTypes.Tel:\n return 'tel';\n case InputTypes.Email:\n return 'email';\n case InputTypes.Url:\n return 'url';\n case InputTypes.Number:\n return 'decimal';\n case InputTypes.Search:\n return 'search';\n default:\n return null;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Phone number formatting\n// ---------------------------------------------------------------------------\n\n/**\n * Groups a complete phone number for display: `0821234567` → `082 123 4567`,\n * `+27821234567` → `+27 82 123 4567`.\n *\n * **Why grouping runs on a finished number, not on every keystroke.** Groups are\n * measured from the right, so the boundaries only settle once the last digit is\n * in. Applied live, the same rule would reflow the field under the caret on\n * every press — `082 1234` becoming `0 821 2345` becoming `08 212 3456` — and\n * `InputCustomComponent` deliberately never rewrites the DOM mid-keystroke\n * (doing so used to drop characters during fast typing). Callers apply this on\n * blur and on external writes, where the value is whole and the caret is gone.\n *\n * Right-to-left grouping is what makes one rule fit both plans: a 9-digit South\n * African subscriber number lands on `82 123 4567` and a 10-digit North American\n * one on `555 123 4567`, with no per-country national format to maintain.\n *\n * **Fail-open.** Anything that is not a recognisable phone number — free text, a\n * digit count outside E.164's range, an incomplete entry — is returned exactly\n * as given. This never destroys what someone typed; rejecting it is\n * `inputTypeValidators.ts`'s job, and it reports on the original text.\n *\n * @param raw - The value as typed or stored.\n * @returns The grouped number, or `raw` unchanged when it cannot be read as one.\n *\n * @example\n * formatTelForDisplay('0821234567'); // '082 123 4567'\n * formatTelForDisplay('+27821234567'); // '+27 82 123 4567'\n * formatTelForDisplay('call me'); // 'call me'\n */\nexport function formatTelForDisplay(raw: string): string {\n const trimmed = raw.trim();\n if (trimmed === '') return raw;\n\n const international = trimmed.startsWith('+');\n const digits = trimmed.replace(/\\D/g, '');\n\n // Any letter, or a stray `+` past the first character, means this is not a\n // phone number we can safely rewrite.\n if (/[^\\d\\s().+-]/.test(trimmed) || trimmed.indexOf('+', 1) !== -1) return raw;\n if (digits.length < TEL_MIN_DIGITS || digits.length > TEL_MAX_DIGITS) return raw;\n\n if (!international) return groupFromRight(digits);\n\n const codeLength = callingCodeLength(digits);\n const national = digits.slice(codeLength);\n if (national === '') return raw;\n return `+${digits.slice(0, codeLength)} ${groupFromRight(national)}`;\n}\n\n/**\n * How many leading digits of an international number form its calling code.\n * Falls back to three, the length of every code outside {@link ONE_DIGIT_CODES}\n * and {@link TWO_DIGIT_CODES}.\n */\nfunction callingCodeLength(digits: string): number {\n if (ONE_DIGIT_CODES.has(digits.slice(0, 1))) return 1;\n if (TWO_DIGIT_CODES.has(digits.slice(0, 2))) return 2;\n return 3;\n}\n\n/**\n * Splits digits into a final group of {@link TEL_TAIL_GROUP} preceded by groups\n * of {@link TEL_GROUP}, measured from the right so the leading group absorbs the\n * remainder: `821234567` → `82 123 4567`.\n */\nfunction groupFromRight(digits: string): string {\n if (digits.length <= TEL_TAIL_GROUP) return digits;\n\n const groups: string[] = [digits.slice(-TEL_TAIL_GROUP)];\n let head = digits.slice(0, -TEL_TAIL_GROUP);\n while (head.length > TEL_GROUP) {\n groups.unshift(head.slice(-TEL_GROUP));\n head = head.slice(0, -TEL_GROUP);\n }\n groups.unshift(head);\n return groups.join(' ');\n}\n","import {\r\n AfterViewInit,\r\n ChangeDetectionStrategy,\r\n Component,\r\n DestroyRef,\r\n ElementRef,\r\n Input,\r\n OnInit,\r\n Optional,\r\n Self,\r\n ViewEncapsulation,\r\n forwardRef,\r\n inject,\r\n viewChild,\r\n} from '@angular/core';\r\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\r\nimport { NgControl } from '@angular/forms';\r\nimport { MatFormFieldControl } from '@angular/material/form-field';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { InputTypes, ITowerStepColumn } from 'ngx-t-forms-types';\r\nimport { Subject, debounceTime } from 'rxjs';\r\n\r\nimport {\r\n BaseCustomInput,\r\n BaseCustomInputConfig,\r\n} from '../../../../../../services/core/t-input-controller/functions/baseCustomInput';\r\nimport {\r\n formatTelForDisplay,\r\n resolveInputMode,\r\n} from '../../../../../../shared/functions/inputTypePresentation';\r\nimport type { InputMode } from '../../../../../../shared/functions/inputTypePresentation';\r\n\r\nconst customInputConfig: BaseCustomInputConfig = {\r\n controlType: 'lib-input-custom',\r\n nextId: 0,\r\n};\r\n\r\n@Component({\r\n selector: 'lib-input-custom',\r\n imports: [MatInputModule],\r\n templateUrl: './input-custom.component.html',\r\n styleUrl: './input-custom.component.css',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.Emulated,\r\n host: {\r\n '[class.floating]': 'shouldLabelFloat',\r\n '[id]': 'id',\r\n },\r\n providers: [\r\n {\r\n provide: MatFormFieldControl,\r\n //:Note\r\n useExisting: forwardRef(() => InputCustomComponent),\r\n },\r\n ],\r\n})\r\nexport class InputCustomComponent\r\n extends BaseCustomInput<string | number | Date>\r\n implements OnInit, AfterViewInit\r\n{\r\n // Kept as @Input() because BaseCustomInput exposes `required`/`disabled`/`placeholder`\r\n // as setter-backed @Input()s tied to MatFormFieldControl `stateChanges`. Keeping\r\n // `inputConfig` as a classic @Input keeps the imperative-setter ergonomic consistent\r\n // with the base class and avoids mixing signal + setter inputs on one component.\r\n @Input() inputConfig!: ITowerStepColumn;\r\n\r\n readonly #destroyRef = inject(DestroyRef);\r\n readonly #debounceTimeMs = 300;\r\n readonly #valueSubject = new Subject<string>();\r\n\r\n // The native input is left uncontrolled while the user types: binding the\r\n // (debounced, therefore lagging) model to `[value]` made Angular overwrite the\r\n // DOM mid-keystroke and drop characters during fast typing. We instead push the\r\n // model to the DOM only on external writes (writeValue) — never while typing.\r\n // TS `private` (not ES `#private`): Angular signal queries cannot sit on an ES-private field.\r\n private readonly inputEl = viewChild<ElementRef<HTMLInputElement>>('inputEl');\r\n\r\n constructor(\r\n @Optional() @Self() ngControl: NgControl,\r\n elementRef: ElementRef<HTMLElement>,\r\n ) {\r\n super(ngControl, elementRef, customInputConfig);\r\n }\r\n\r\n override get empty(): boolean {\r\n const n = this.value;\r\n // Check for null, undefined, or empty string, but allow 0\r\n return n === null || n === undefined || n === '';\r\n }\r\n\r\n override get shouldLabelFloat(): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * The on-screen keyboard the bound column's `type` implies, or `null` to leave\r\n * `inputmode` unset. A getter rather than a signal because `inputConfig` is a\r\n * setter-free classic `@Input()` (see its comment above) — the lookup is a\r\n * single switch, so re-reading it per change detection costs nothing.\r\n */\r\n protected get inputMode(): InputMode | null {\r\n return resolveInputMode(this.inputConfig?.type);\r\n }\r\n\r\n ngOnInit(): void {\r\n this.#valueSubject\r\n .pipe(debounceTime(this.#debounceTimeMs), takeUntilDestroyed(this.#destroyRef))\r\n .subscribe((next) => {\r\n // The base `value` setter guards on equality and fires onChange + stateChanges.\r\n // Only the (heavier) form propagation + validation is debounced — never the display.\r\n this.value = next;\r\n });\r\n }\r\n\r\n ngAfterViewInit(): void {\r\n // Reflect any value the form set before the view existed (initial bind / patch).\r\n this.#syncInputFromModel();\r\n }\r\n\r\n override writeValue(value: string | number | Date): void {\r\n super.writeValue(value);\r\n // External model change (patchValue / reset) — push it to the DOM. This never\r\n // runs in response to the user's own typing, so it can't clobber the cursor.\r\n this.#syncInputFromModel();\r\n }\r\n\r\n protected onInputChange($event: Event): void {\r\n const next = ($event.target as HTMLInputElement | null)?.value ?? '';\r\n this.#valueSubject.next(next);\r\n }\r\n\r\n #syncInputFromModel(): void {\r\n const el = this.inputEl()?.nativeElement;\r\n if (!el) {\r\n return;\r\n }\r\n const v = this.value;\r\n // Grouped for display only. The model keeps whatever the consumer patched in,\r\n // so simply loading a form never rewrites stored data — only the user's own\r\n // blur does that.\r\n el.value = v === null || v === undefined ? '' : this.#forDisplay(String(v));\r\n }\r\n\r\n /** Applies the declared type's display format, if it has one. */\r\n #forDisplay(value: string): string {\r\n return this.inputConfig?.type === InputTypes.Tel ? formatTelForDisplay(value) : value;\r\n }\r\n\r\n /**\r\n * Groups the typed phone number once the field is left, and commits the grouped\r\n * text as the value so what is stored matches what is shown.\r\n *\r\n * Runs on blur rather than on input because the grouping is measured from the\r\n * right — applied per keystroke it would reflow the text under the caret, and\r\n * this component deliberately never rewrites the DOM while the user types.\r\n *\r\n * The formatted text re-enters `#valueSubject` as well as being set directly:\r\n * a keystroke from the last 300ms may still be in flight, and re-entering the\r\n * debounce supersedes it rather than letting it land afterwards and leave the\r\n * model holding the ungrouped text. The direct write keeps the control correct\r\n * in the meantime; the base setter's equality guard makes the later duplicate a\r\n * no-op.\r\n */\r\n #applyDisplayFormatOnBlur(): void {\r\n const el = this.inputEl()?.nativeElement;\r\n if (!el || this.inputConfig?.type !== InputTypes.Tel) {\r\n return;\r\n }\r\n const formatted = formatTelForDisplay(el.value);\r\n if (formatted === el.value) {\r\n return;\r\n }\r\n el.value = formatted;\r\n this.value = formatted;\r\n this.#valueSubject.next(formatted);\r\n }\r\n\r\n protected onInputBlur($event: FocusEvent): void {\r\n this.#applyDisplayFormatOnBlur();\r\n this.touched = true; // Mark as touched on blur\r\n this.onTouched();\r\n this.blur.emit($event);\r\n }\r\n}\r\n","@if (inputConfig) {\r\n <input matInput\r\n #inputEl\r\n [readonly]=\"inputConfig.readonly || inputConfig.disabled\"\r\n (blur)=\"onInputBlur($event)\"\r\n [pattern]=\"inputConfig.pattern || ''\"\r\n [required]=\"inputConfig.required\"\r\n [attr.maxlength]=\"inputConfig.maxLength\"\r\n [type]=\"inputConfig.type || 'text'\"\n [attr.inputmode]=\"inputMode\"\r\n (input)=\"onInputChange($event)\"\r\n [attr.minlength]=\"inputConfig.minLength\"\r\n [autocomplete]=\"inputConfig.autocomplete\"\r\n [min]=\"inputConfig.min\"\r\n [max]=\"inputConfig.max\" />\r\n}\r\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;;;;;AAcG;AASH;AACA,MAAM,cAAc,GAAG,CAAC;AACxB;AACA,MAAM,SAAS,GAAG,CAAC;AACnB;AACA,MAAM,cAAc,GAAG,CAAC;AACxB,MAAM,cAAc,GAAG,EAAE;AAEzB;;;;;;;;AAQG;AACH,MAAM,eAAe,GAAwB,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAChE,MAAM,eAAe,GAAwB,IAAI,GAAG,CAAC;AACnD,IAAA,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;AACxC,IAAA,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;AACpD,IAAA,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IAC9C,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE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,QAAA,EAAA,EAAA,EAAA,QAAA,ECtDH,4lBAgBA,yDDuBY,cAAc,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,QAAA,EAAA,QAAA,EAAA,yHAAA,EAAA,MAAA,EAAA,CAAA,UAAA,EAAA,IAAA,EAAA,aAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,EAAA,mBAAA,EAAA,kBAAA,EAAA,OAAA,EAAA,UAAA,EAAA,qBAAA,CAAA,EAAA,QAAA,EAAA,CAAA,UAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;4FAiBb,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAnBhC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,kBAAkB,EAAA,OAAA,EACnB,CAAC,cAAc,CAAC,EAAA,eAAA,EAGR,uBAAuB,CAAC,MAAM,EAAA,aAAA,EAChC,iBAAiB,CAAC,QAAQ,EAAA,IAAA,EACnC;AACJ,wBAAA,kBAAkB,EAAE,kBAAkB;AACtC,wBAAA,MAAM,EAAE,IAAI;qBACb,EAAA,SAAA,EACU;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,mBAAmB;;AAE5B,4BAAA,WAAW,EAAE,UAAU,CAAC,0BAA0B,CAAC;AACpD,yBAAA;AACF,qBAAA,EAAA,QAAA,EAAA,4lBAAA,EAAA;;0BAwBE;;0BAAY;;sBAdd;uDAWkE,SAAS,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;;;"}
|
|
@@ -14,7 +14,7 @@ import { DragDropModule } from '@angular/cdk/drag-drop';
|
|
|
14
14
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
15
15
|
import * as i6 from '@angular/material/list';
|
|
16
16
|
import { MatListModule } from '@angular/material/list';
|
|
17
|
-
import { F as FormsStoreService, b as getInputIcon, T as TDynamicDataEditComponent, c as TDynamicDataViewComponent } from './ngx-t-forms-ngx-t-forms-
|
|
17
|
+
import { F as FormsStoreService, b as getInputIcon, T as TDynamicDataEditComponent, c as TDynamicDataViewComponent } from './ngx-t-forms-ngx-t-forms-B3WhBGlD.mjs';
|
|
18
18
|
import { DefaultInputConfig } from 'ngx-t-forms-types';
|
|
19
19
|
import { take, tap } from 'rxjs';
|
|
20
20
|
import * as i5 from '@angular/material/expansion';
|
|
@@ -24,7 +24,7 @@ import { MatTooltipModule } from '@angular/material/tooltip';
|
|
|
24
24
|
import * as i4 from '@angular/material/progress-spinner';
|
|
25
25
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
26
26
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
27
|
-
import './ngx-t-forms-index-
|
|
27
|
+
import './ngx-t-forms-index-yasuBvXP.mjs';
|
|
28
28
|
|
|
29
29
|
class DefaultElementComponent {
|
|
30
30
|
constructor() {
|
|
@@ -186,4 +186,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
186
186
|
}] });
|
|
187
187
|
|
|
188
188
|
export { InputEditorComponent };
|
|
189
|
-
//# sourceMappingURL=ngx-t-forms-input-editor.component-
|
|
189
|
+
//# sourceMappingURL=ngx-t-forms-input-editor.component-DbhnFkYQ.mjs.map
|