ngx-t-forms 3.1.8 → 3.1.9
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-B4a-L4Eq.mjs → ngx-t-forms-api-endpoint-config.component-BbS1dY0l.mjs} +10 -10
- package/fesm2022/ngx-t-forms-api-endpoint-config.component-BbS1dY0l.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-auto-complete-input-element.component-DqRunUz4.mjs → ngx-t-forms-auto-complete-input-element.component-B8eluIrh.mjs} +8 -8
- package/fesm2022/{ngx-t-forms-auto-complete-input-element.component-DqRunUz4.mjs.map → ngx-t-forms-auto-complete-input-element.component-B8eluIrh.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-autofillToken-D-BYfzxR.mjs +189 -0
- package/fesm2022/ngx-t-forms-autofillToken-D-BYfzxR.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-basic-input-input-element.component-t8bTUgZ1.mjs → ngx-t-forms-basic-input-input-element.component-SSLXyCz9.mjs} +6 -6
- package/fesm2022/{ngx-t-forms-basic-input-input-element.component-t8bTUgZ1.mjs.map → ngx-t-forms-basic-input-input-element.component-SSLXyCz9.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-calculated-field-rules.component-PcjMdAKu.mjs → ngx-t-forms-calculated-field-rules.component-Cn_rxXMX.mjs} +7 -7
- package/fesm2022/{ngx-t-forms-calculated-field-rules.component-PcjMdAKu.mjs.map → ngx-t-forms-calculated-field-rules.component-Cn_rxXMX.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-chip-options-creator-editor.component-Ca4rim_J.mjs → ngx-t-forms-chip-options-creator-editor.component-CGm5tgsp.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-chip-options-creator-editor.component-Ca4rim_J.mjs.map → ngx-t-forms-chip-options-creator-editor.component-CGm5tgsp.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-clamp-probe.directive-DMUdeVrM.mjs +99 -0
- package/fesm2022/ngx-t-forms-clamp-probe.directive-DMUdeVrM.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-conditional-display-config.component-Di7p76_n.mjs → ngx-t-forms-conditional-display-config.component-DIMIWTKj.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-conditional-display-config.component-Di7p76_n.mjs.map → ngx-t-forms-conditional-display-config.component-DIMIWTKj.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-config-mscoa-additional-inputs.component-CXMmDwKS.mjs → ngx-t-forms-config-mscoa-additional-inputs.component-DKb3E9gA.mjs} +4 -4
- package/fesm2022/{ngx-t-forms-config-mscoa-additional-inputs.component-CXMmDwKS.mjs.map → ngx-t-forms-config-mscoa-additional-inputs.component-DKb3E9gA.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-data-source-picker.component-DioXvLi3.mjs → ngx-t-forms-data-source-picker.component-BG_sr5VH.mjs} +8 -8
- package/fesm2022/{ngx-t-forms-data-source-picker.component-DioXvLi3.mjs.map → ngx-t-forms-data-source-picker.component-BG_sr5VH.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-date-picker-input-element.component-h0S6qZDT.mjs → ngx-t-forms-date-picker-input-element.component-vUlUuzJ0.mjs} +8 -8
- package/fesm2022/{ngx-t-forms-date-picker-input-element.component-h0S6qZDT.mjs.map → ngx-t-forms-date-picker-input-element.component-vUlUuzJ0.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-date-range-picker-input-element.component-8c1ErbgP.mjs → ngx-t-forms-date-range-picker-input-element.component-YVE_s-7Y.mjs} +5 -5
- package/fesm2022/{ngx-t-forms-date-range-picker-input-element.component-8c1ErbgP.mjs.map → ngx-t-forms-date-range-picker-input-element.component-YVE_s-7Y.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-date-time-picker-input-element.component-BgjGlXeq.mjs → ngx-t-forms-date-time-picker-input-element.component-BlOS8NdF.mjs} +8 -8
- package/fesm2022/{ngx-t-forms-date-time-picker-input-element.component-BgjGlXeq.mjs.map → ngx-t-forms-date-time-picker-input-element.component-BlOS8NdF.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-document-list-label-config-editor.component-u2UUPdAo.mjs +623 -0
- package/fesm2022/ngx-t-forms-document-list-label-config-editor.component-u2UUPdAo.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-document-picker.component-DYpsBHxT.mjs → ngx-t-forms-document-picker.component-DOYyRgh4.mjs} +41 -11
- package/fesm2022/{ngx-t-forms-document-picker.component-DYpsBHxT.mjs.map → ngx-t-forms-document-picker.component-DOYyRgh4.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-editor-input-element.component-CzNSb79n.mjs → ngx-t-forms-editor-input-element.component-BvZPNjQX.mjs} +5 -5
- package/fesm2022/{ngx-t-forms-editor-input-element.component-CzNSb79n.mjs.map → ngx-t-forms-editor-input-element.component-BvZPNjQX.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-file-upload-input-element.component-FPxHxAwF.mjs → ngx-t-forms-file-upload-input-element.component-CONELqoi.mjs} +8 -8
- package/fesm2022/{ngx-t-forms-file-upload-input-element.component-FPxHxAwF.mjs.map → ngx-t-forms-file-upload-input-element.component-CONELqoi.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-form-copy-lint.component-TCSe-27-.mjs +248 -0
- package/fesm2022/ngx-t-forms-form-copy-lint.component-TCSe-27-.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-form-input-selector.component-B3ES53R-.mjs → ngx-t-forms-form-input-selector.component-Bdkuzw0R.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-form-input-selector.component-B3ES53R-.mjs.map → ngx-t-forms-form-input-selector.component-Bdkuzw0R.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-form-json-view.component-Cu_ZEw1V.mjs → ngx-t-forms-form-json-view.component-CDcbgWgN.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-form-json-view.component-Cu_ZEw1V.mjs.map → ngx-t-forms-form-json-view.component-CDcbgWgN.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-form-section-stepper.component-DmTGnRgi.mjs → ngx-t-forms-form-section-stepper.component-CqLSI8zP.mjs} +7 -7
- package/fesm2022/{ngx-t-forms-form-section-stepper.component-DmTGnRgi.mjs.map → ngx-t-forms-form-section-stepper.component-CqLSI8zP.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-forms-builder-menu.component-6m2BM9e9.mjs → ngx-t-forms-forms-builder-menu.component-DFCVe_Fq.mjs} +185 -15
- package/fesm2022/ngx-t-forms-forms-builder-menu.component-DFCVe_Fq.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-forms-native-date-adapter-CCJT5ep1.mjs → ngx-t-forms-forms-native-date-adapter-h6fClNMS.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-forms-native-date-adapter-CCJT5ep1.mjs.map → ngx-t-forms-forms-native-date-adapter-h6fClNMS.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-geo-location.component-DgXSaH0t.mjs → ngx-t-forms-geo-location.component-DA3ATrvw.mjs} +7 -7
- package/fesm2022/{ngx-t-forms-geo-location.component-DgXSaH0t.mjs.map → ngx-t-forms-geo-location.component-DA3ATrvw.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-header-template-editor.component-NJLm6jkA.mjs → ngx-t-forms-header-template-editor.component-B9Cj8dOI.mjs} +13 -5
- package/fesm2022/ngx-t-forms-header-template-editor.component-B9Cj8dOI.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-image-capture-input-element.component-iqPS9cPK.mjs → ngx-t-forms-image-capture-input-element.component-C9oz_ZjA.mjs} +7 -7
- package/fesm2022/{ngx-t-forms-image-capture-input-element.component-iqPS9cPK.mjs.map → ngx-t-forms-image-capture-input-element.component-C9oz_ZjA.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-index-CSXX8RTm.mjs +2 -0
- package/fesm2022/ngx-t-forms-index-CSXX8RTm.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-input-custom.component-BOy_3JqU.mjs → ngx-t-forms-input-custom.component-CqIr5wpy.mjs} +91 -25
- package/fesm2022/ngx-t-forms-input-custom.component-CqIr5wpy.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-input-editor.component-IUrZNmA5.mjs → ngx-t-forms-input-editor.component-DU2sgo4i.mjs} +9 -9
- package/fesm2022/{ngx-t-forms-input-editor.component-IUrZNmA5.mjs.map → ngx-t-forms-input-editor.component-DU2sgo4i.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-map-mat-options-keys-CtTAw9jk.mjs → ngx-t-forms-map-mat-options-keys-WfFq_0tS.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-map-mat-options-keys-CtTAw9jk.mjs.map → ngx-t-forms-map-mat-options-keys-WfFq_0tS.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-mat-chip-list-editor.component-C9bxVpQ1.mjs → ngx-t-forms-mat-chip-list-editor.component-CKnvqeix.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-mat-chip-list-editor.component-C9bxVpQ1.mjs.map → ngx-t-forms-mat-chip-list-editor.component-CKnvqeix.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-missing-form-configs.component-BpiCchqY.mjs → ngx-t-forms-missing-form-configs.component-B5dDbmpj.mjs} +4 -4
- package/fesm2022/{ngx-t-forms-missing-form-configs.component-BpiCchqY.mjs.map → ngx-t-forms-missing-form-configs.component-B5dDbmpj.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-mscoa-chart-toolbar.component-97tHCSyK.mjs +37 -0
- package/fesm2022/ngx-t-forms-mscoa-chart-toolbar.component-97tHCSyK.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-mscoa-config.component-soUwIbVA.mjs → ngx-t-forms-mscoa-config.component-BtLd7F2n.mjs} +10 -10
- package/fesm2022/{ngx-t-forms-mscoa-config.component-soUwIbVA.mjs.map → ngx-t-forms-mscoa-config.component-BtLd7F2n.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-mscoa-error-display.component-BDPi6w2E.mjs → ngx-t-forms-mscoa-error-display.component-Bmt1vboD.mjs} +4 -4
- package/fesm2022/{ngx-t-forms-mscoa-error-display.component-BDPi6w2E.mjs.map → ngx-t-forms-mscoa-error-display.component-Bmt1vboD.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-mscoa-segment-config.component--3DvQm1K.mjs → ngx-t-forms-mscoa-segment-config.component-DrzpixbK.mjs} +9 -9
- package/fesm2022/{ngx-t-forms-mscoa-segment-config.component--3DvQm1K.mjs.map → ngx-t-forms-mscoa-segment-config.component-DrzpixbK.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-mscoa-temporary-hint.component-g7DosiVb.mjs → ngx-t-forms-mscoa-temporary-hint.component-B1Z-IXSL.mjs} +3 -3
- package/fesm2022/{ngx-t-forms-mscoa-temporary-hint.component-g7DosiVb.mjs.map → ngx-t-forms-mscoa-temporary-hint.component-B1Z-IXSL.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-multiple-input-input-element.component-ddpips7E.mjs +3592 -0
- package/fesm2022/ngx-t-forms-multiple-input-input-element.component-ddpips7E.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-ngx-t-forms-CaVyRedJ.mjs → ngx-t-forms-ngx-t-forms-C1kZpYIM.mjs} +9303 -2202
- package/fesm2022/ngx-t-forms-ngx-t-forms-C1kZpYIM.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-paginated-selection-table-B7TyhJnh.mjs +596 -0
- package/fesm2022/ngx-t-forms-paginated-selection-table-B7TyhJnh.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-payload-template-editor.component-CVj-G4MC.mjs → ngx-t-forms-payload-template-editor.component-DVL4aBuG.mjs} +13 -5
- package/fesm2022/ngx-t-forms-payload-template-editor.component-DVL4aBuG.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-pipeline-generator.component-BMyZKOXv.mjs → ngx-t-forms-pipeline-generator.component-DpqipW6G.mjs} +15 -15
- package/fesm2022/{ngx-t-forms-pipeline-generator.component-BMyZKOXv.mjs.map → ngx-t-forms-pipeline-generator.component-DpqipW6G.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-quill-input.component-oUnmMDGi.mjs → ngx-t-forms-quill-input.component-x9CHGOJy.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-quill-input.component-oUnmMDGi.mjs.map → ngx-t-forms-quill-input.component-x9CHGOJy.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-record-list-manager.component-CdQU6loA.mjs → ngx-t-forms-record-list-manager.component-BGg86NER.mjs} +7 -7
- package/fesm2022/{ngx-t-forms-record-list-manager.component-CdQU6loA.mjs.map → ngx-t-forms-record-list-manager.component-BGg86NER.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-required-inputs.component-CI9nLVXe.mjs +281 -0
- package/fesm2022/ngx-t-forms-required-inputs.component-CI9nLVXe.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-rest-api-call-setup.component-B5w1Lvfo.mjs → ngx-t-forms-rest-api-call-setup.component-B4LzPwxg.mjs} +5 -5
- package/fesm2022/{ngx-t-forms-rest-api-call-setup.component-B5w1Lvfo.mjs.map → ngx-t-forms-rest-api-call-setup.component-B4LzPwxg.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-section-report.component-CocLNrN5.mjs → ngx-t-forms-section-report.component-BS2CV_xl.mjs} +4 -4
- package/fesm2022/{ngx-t-forms-section-report.component-CocLNrN5.mjs.map → ngx-t-forms-section-report.component-BS2CV_xl.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-select-input-element.component-C5qjqCXW.mjs +281 -0
- package/fesm2022/ngx-t-forms-select-input-element.component-C5qjqCXW.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-selection-options-editor.component-CBdC0WCz.mjs → ngx-t-forms-selection-options-editor.component-B6sYvtcj.mjs} +6 -6
- package/fesm2022/{ngx-t-forms-selection-options-editor.component-CBdC0WCz.mjs.map → ngx-t-forms-selection-options-editor.component-B6sYvtcj.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-t-workflow-picker.component-D0ttyEex.mjs → ngx-t-forms-t-workflow-picker.component-xDbl63v1.mjs} +3 -3
- package/fesm2022/{ngx-t-forms-t-workflow-picker.component-D0ttyEex.mjs.map → ngx-t-forms-t-workflow-picker.component-xDbl63v1.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-textarea-input-element.component-GXiLEsTp.mjs → ngx-t-forms-textarea-input-element.component-ri0r0ujE.mjs} +77 -11
- package/fesm2022/ngx-t-forms-textarea-input-element.component-ri0r0ujE.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-toggle-input-element.component-CXUqCipx.mjs +124 -0
- package/fesm2022/ngx-t-forms-toggle-input-element.component-CXUqCipx.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-token-text-input.component-BMzPBtY_.mjs → ngx-t-forms-token-text-input.component-BWmoGQfi.mjs} +4 -4
- package/fesm2022/{ngx-t-forms-token-text-input.component-BMzPBtY_.mjs.map → ngx-t-forms-token-text-input.component-BWmoGQfi.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-validators-config.component-DWDBsV6a.mjs → ngx-t-forms-validators-config.component-DEm9M5s9.mjs} +5 -5
- package/fesm2022/{ngx-t-forms-validators-config.component-DWDBsV6a.mjs.map → ngx-t-forms-validators-config.component-DEm9M5s9.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-workflow-adjudication.component-DxObFakZ.mjs → ngx-t-forms-workflow-adjudication.component-BOC9Z40E.mjs} +28 -26
- package/fesm2022/ngx-t-forms-workflow-adjudication.component-BOC9Z40E.mjs.map +1 -0
- package/fesm2022/ngx-t-forms.mjs +1 -1
- package/package.json +2 -2
- package/types/ngx-t-forms.d.ts +2370 -38
- package/fesm2022/ngx-t-forms-api-endpoint-config.component-B4a-L4Eq.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-document-list-label-config-editor.component-BhVM8PFR.mjs +0 -373
- package/fesm2022/ngx-t-forms-document-list-label-config-editor.component-BhVM8PFR.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-forms-builder-menu.component-6m2BM9e9.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-header-template-editor.component-NJLm6jkA.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-index-zLon09cE.mjs +0 -2
- package/fesm2022/ngx-t-forms-index-zLon09cE.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-input-custom.component-BOy_3JqU.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mscoa-chart-toolbar.component-CjUf0zTA.mjs +0 -38
- package/fesm2022/ngx-t-forms-mscoa-chart-toolbar.component-CjUf0zTA.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-multiple-input-input-element.component-BZxpJRxJ.mjs +0 -2472
- package/fesm2022/ngx-t-forms-multiple-input-input-element.component-BZxpJRxJ.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-ngx-t-forms-CaVyRedJ.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-paginated-selection-table-DzZE-Zde.mjs +0 -557
- package/fesm2022/ngx-t-forms-paginated-selection-table-DzZE-Zde.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-payload-template-editor.component-CVj-G4MC.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-required-inputs.component-BtfEsmva.mjs +0 -271
- package/fesm2022/ngx-t-forms-required-inputs.component-BtfEsmva.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-select-input-element.component-B03O4cAK.mjs +0 -160
- package/fesm2022/ngx-t-forms-select-input-element.component-B03O4cAK.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-textarea-input-element.component-GXiLEsTp.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-toggle-input-element.component-WErP0SsA.mjs +0 -93
- package/fesm2022/ngx-t-forms-toggle-input-element.component-WErP0SsA.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-workflow-adjudication.component-DxObFakZ.mjs.map +0 -1
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, computed, signal, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/material/button';
|
|
4
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
5
|
+
import * as i3 from '@angular/material/icon';
|
|
6
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
7
|
+
import { F as FormsStoreService } from './ngx-t-forms-ngx-t-forms-C1kZpYIM.mjs';
|
|
8
|
+
|
|
9
|
+
const FIELD_NAMES = {
|
|
10
|
+
section: 'Section title',
|
|
11
|
+
label: 'Label',
|
|
12
|
+
hint: 'Hint',
|
|
13
|
+
description: 'Description',
|
|
14
|
+
placeholder: 'Placeholder',
|
|
15
|
+
tour: 'Help text',
|
|
16
|
+
};
|
|
17
|
+
/** Placeholder values authors leave behind while drafting. */
|
|
18
|
+
const PLACEHOLDER_TEXT = new Set([
|
|
19
|
+
'help', 'todo', 'tbd', 'tba', 'description', 'hint', 'label', 'text', 'placeholder',
|
|
20
|
+
'lorem ipsum', 'xxx', 'test', 'n/a', '...', '…', '-',
|
|
21
|
+
]);
|
|
22
|
+
/**
|
|
23
|
+
* The placeholder words that are never a real field or section name. Words such
|
|
24
|
+
* as "Description", "Text" or "Label" are legitimate names, so names are only
|
|
25
|
+
* checked against this narrower set.
|
|
26
|
+
*/
|
|
27
|
+
const PLACEHOLDER_NAMES = new Set(['help', 'todo', 'tbd', 'tba', 'lorem ipsum', 'xxx', '...', '…', '-']);
|
|
28
|
+
/** Words that never end a finished sentence. */
|
|
29
|
+
const DANGLING_END_WORDS = new Set([
|
|
30
|
+
'a', 'an', 'the', 'and', 'or', 'but', 'of', 'to', 'for', 'with', 'from', 'by', 'in', 'on',
|
|
31
|
+
'at', 'that', 'which', 'who', 'whose', 'your', 'our', 'their', 'its', 'is', 'are', 'was',
|
|
32
|
+
'were', 'be', 'if', 'as', 'than', 'because', 'when', 'where',
|
|
33
|
+
]);
|
|
34
|
+
/** Words a title-case label capitalises but sentence case keeps lowercase. */
|
|
35
|
+
const MINOR_WORDS = new Set([
|
|
36
|
+
'a', 'an', 'the', 'and', 'or', 'but', 'nor', 'of', 'to', 'for', 'with', 'from', 'by', 'in',
|
|
37
|
+
'on', 'at', 'as', 'per', 'via',
|
|
38
|
+
]);
|
|
39
|
+
/** Splits text into word tokens (letters, digits and inner apostrophes). */
|
|
40
|
+
function wordsOf(text) {
|
|
41
|
+
return text.match(/[\p{L}\p{N}]+(?:['’][\p{L}]+)?/gu) ?? [];
|
|
42
|
+
}
|
|
43
|
+
const isAllCaps = (word) => word.length > 1 && word === word.toUpperCase() && /\p{L}/u.test(word);
|
|
44
|
+
const isCapitalised = (word) => /^\p{Lu}/u.test(word);
|
|
45
|
+
/**
|
|
46
|
+
* `title` when two or more ordinary words are capitalised ("Extend The
|
|
47
|
+
* Submission Date"), `sentence` when only the first is, `null` when the label
|
|
48
|
+
* is too short or mixed to say. Acronyms are ignored either way.
|
|
49
|
+
*/
|
|
50
|
+
function casingStyle(label) {
|
|
51
|
+
const words = wordsOf(label).filter((word) => !isAllCaps(word) && !/\d/.test(word));
|
|
52
|
+
if (words.length < 3)
|
|
53
|
+
return null;
|
|
54
|
+
const rest = words.slice(1);
|
|
55
|
+
const capitalised = rest.filter(isCapitalised).length;
|
|
56
|
+
if (capitalised === 0)
|
|
57
|
+
return 'sentence';
|
|
58
|
+
const ordinary = rest.filter((word) => !MINOR_WORDS.has(word.toLowerCase()));
|
|
59
|
+
if (ordinary.length > 0 && ordinary.every(isCapitalised))
|
|
60
|
+
return 'title';
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
/** Returns the repeated word when the text contains one twice in a row ("the the"). */
|
|
64
|
+
function duplicateWord(text) {
|
|
65
|
+
const match = /\b([\p{L}]{2,})\s+\1\b/iu.exec(text);
|
|
66
|
+
return match?.[1] ?? null;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* True when prose stops mid-sentence: it ends on a connective ("…for the"), or
|
|
70
|
+
* opens a relative clause it never finishes ("Related to the project that your
|
|
71
|
+
* organization").
|
|
72
|
+
*/
|
|
73
|
+
function looksUnfinished(text) {
|
|
74
|
+
const trimmed = text.trim();
|
|
75
|
+
if (/[.!?:)\]"'”’]$/u.test(trimmed))
|
|
76
|
+
return false;
|
|
77
|
+
const words = wordsOf(trimmed).map((word) => word.toLowerCase());
|
|
78
|
+
if (words.length < 3)
|
|
79
|
+
return false;
|
|
80
|
+
const last = words[words.length - 1];
|
|
81
|
+
if (last !== undefined && DANGLING_END_WORDS.has(last))
|
|
82
|
+
return true;
|
|
83
|
+
let clause = -1;
|
|
84
|
+
words.forEach((word, index) => {
|
|
85
|
+
if (word === 'that' || word === 'which' || word === 'who')
|
|
86
|
+
clause = index;
|
|
87
|
+
});
|
|
88
|
+
return clause > 0 && words.length - clause - 1 <= 2;
|
|
89
|
+
}
|
|
90
|
+
const textOf = (record, key) => {
|
|
91
|
+
const value = record[key];
|
|
92
|
+
return typeof value === 'string' ? value : undefined;
|
|
93
|
+
};
|
|
94
|
+
/** Every piece of authored copy in the form, flattened (sub-row fields included). */
|
|
95
|
+
function collectCopy(slides) {
|
|
96
|
+
const entries = [];
|
|
97
|
+
const visit = (raw, topLevelId) => {
|
|
98
|
+
if (!raw || typeof raw !== 'object')
|
|
99
|
+
return;
|
|
100
|
+
const record = raw;
|
|
101
|
+
const label = textOf(record, 'label') ?? '';
|
|
102
|
+
const owner = label.trim() || textOf(record, 'formControlName') || 'Untitled field';
|
|
103
|
+
const push = (field, key) => {
|
|
104
|
+
const text = textOf(record, key);
|
|
105
|
+
if (text !== undefined)
|
|
106
|
+
entries.push({ owner, inputId: topLevelId, field, text });
|
|
107
|
+
};
|
|
108
|
+
push('label', 'label');
|
|
109
|
+
push('hint', 'hintLabel');
|
|
110
|
+
push('description', 'description');
|
|
111
|
+
push('placeholder', 'placeholder');
|
|
112
|
+
push('tour', 'tourContent');
|
|
113
|
+
const children = record['formInputs'];
|
|
114
|
+
if (Array.isArray(children))
|
|
115
|
+
children.forEach((child) => visit(child, undefined));
|
|
116
|
+
};
|
|
117
|
+
for (const slide of slides) {
|
|
118
|
+
entries.push({ owner: slide.label || 'Untitled section', field: 'section', text: slide.label ?? '' });
|
|
119
|
+
for (const column of slide.columns ?? []) {
|
|
120
|
+
const id = column.id;
|
|
121
|
+
visit(column, typeof id === 'string' ? id : undefined);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return entries;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Lints the authored copy of a form for the slips that reach end users
|
|
128
|
+
* unedited: placeholder text ("help"), labels starting lowercase, title-case
|
|
129
|
+
* labels in a sentence-case form (or the reverse), an acronym spelled two ways
|
|
130
|
+
* ("SCM" / "Scm"), doubled words, and help or description text that stops
|
|
131
|
+
* mid-sentence.
|
|
132
|
+
*
|
|
133
|
+
* Advisory only: the builder lists these for the author and never blocks a
|
|
134
|
+
* save, because a form can be correct and still trip a heuristic.
|
|
135
|
+
*/
|
|
136
|
+
function lintFormCopy(slides) {
|
|
137
|
+
const entries = collectCopy(slides);
|
|
138
|
+
const warnings = [];
|
|
139
|
+
const add = (entry, message) => {
|
|
140
|
+
warnings.push({
|
|
141
|
+
key: `${entry.inputId ?? entry.owner}|${entry.field}|${warnings.length}`,
|
|
142
|
+
inputId: entry.inputId,
|
|
143
|
+
owner: entry.owner,
|
|
144
|
+
field: entry.field,
|
|
145
|
+
message: `${FIELD_NAMES[entry.field]}: ${message}`,
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
const names = entries.filter((entry) => entry.field === 'label' || entry.field === 'section');
|
|
149
|
+
const styles = names.map((entry) => casingStyle(entry.text));
|
|
150
|
+
const titleCount = styles.filter((style) => style === 'title').length;
|
|
151
|
+
const sentenceCount = styles.filter((style) => style === 'sentence').length;
|
|
152
|
+
const minority = titleCount > 0 && sentenceCount > 0
|
|
153
|
+
? (titleCount <= sentenceCount ? 'title' : 'sentence')
|
|
154
|
+
: null;
|
|
155
|
+
// Every spelling of each word across labels, to catch "SCM" next to "Scm".
|
|
156
|
+
const spellings = new Map();
|
|
157
|
+
for (const entry of names) {
|
|
158
|
+
for (const word of wordsOf(entry.text)) {
|
|
159
|
+
const key = word.toLowerCase();
|
|
160
|
+
const set = spellings.get(key) ?? new Set();
|
|
161
|
+
set.add(word);
|
|
162
|
+
spellings.set(key, set);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
entries.forEach((entry) => {
|
|
166
|
+
const text = entry.text.trim();
|
|
167
|
+
const isName = entry.field === 'label' || entry.field === 'section';
|
|
168
|
+
if (!text) {
|
|
169
|
+
if (entry.field === 'tour' || entry.field === 'description' || entry.field === 'hint') {
|
|
170
|
+
add(entry, 'is empty; remove it or write the sentence it should say.');
|
|
171
|
+
}
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if ((isName ? PLACEHOLDER_NAMES : PLACEHOLDER_TEXT).has(text.toLowerCase())) {
|
|
175
|
+
add(entry, `"${text}" looks like placeholder text.`);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const doubled = duplicateWord(text);
|
|
179
|
+
if (doubled)
|
|
180
|
+
add(entry, `"${doubled}" is repeated.`);
|
|
181
|
+
if (isName) {
|
|
182
|
+
const first = wordsOf(text)[0];
|
|
183
|
+
if (first && /^\p{Ll}/u.test(first)) {
|
|
184
|
+
add(entry, `"${text}" starts with a lowercase letter.`);
|
|
185
|
+
}
|
|
186
|
+
const style = casingStyle(text);
|
|
187
|
+
if (minority !== null && style === minority) {
|
|
188
|
+
add(entry, minority === 'title'
|
|
189
|
+
? `"${text}" uses Title Case; most names in this form use sentence case.`
|
|
190
|
+
: `"${text}" uses sentence case; most names in this form use Title Case.`);
|
|
191
|
+
}
|
|
192
|
+
for (const word of wordsOf(text)) {
|
|
193
|
+
const variants = spellings.get(word.toLowerCase());
|
|
194
|
+
const acronym = variants ? [...variants].find(isAllCaps) : undefined;
|
|
195
|
+
// Only a capitalised spelling ("Scm") is suspect: a lowercase word such
|
|
196
|
+
// as "it" next to the acronym "IT" is usually a different word.
|
|
197
|
+
if (acronym && word !== acronym && isCapitalised(word) && !isAllCaps(word)) {
|
|
198
|
+
add(entry, `"${word}" is written "${acronym}" elsewhere in this form.`);
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if (entry.field !== 'placeholder' && looksUnfinished(text)) {
|
|
205
|
+
add(entry, `"${text}" reads like an unfinished sentence.`);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
return warnings;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/** Per-instance suffix so two builders on one page never share an id. */
|
|
212
|
+
let nextFormCopyLintId = 0;
|
|
213
|
+
/**
|
|
214
|
+
* Non-blocking copy check for the form author. Lists wording slips that would
|
|
215
|
+
* otherwise reach the people filling the form in unedited: placeholder text
|
|
216
|
+
* such as "help", mixed Title Case and sentence case, an acronym spelled two
|
|
217
|
+
* ways, doubled words, and help or description text that stops mid-sentence.
|
|
218
|
+
*
|
|
219
|
+
* It never affects saving. Renders nothing when the copy is clean; otherwise a
|
|
220
|
+
* collapsed disclosure the author can open, with an "Edit" jump per field.
|
|
221
|
+
*/
|
|
222
|
+
class FormCopyLintComponent {
|
|
223
|
+
constructor() {
|
|
224
|
+
this.#store = inject(FormsStoreService);
|
|
225
|
+
/** Copy suggestions for the form currently in the builder. */
|
|
226
|
+
this.warnings = computed(() => lintFormCopy(this.#store.formBuilderSignalSelectors.selectFormSlides()), ...(ngDevMode ? [{ debugName: "warnings" }] : /* istanbul ignore next */ []));
|
|
227
|
+
/** DOM id of the disclosure's title, unique per instance. */
|
|
228
|
+
this.titleId = `lib-form-copy-lint-title-${nextFormCopyLintId}`;
|
|
229
|
+
/** DOM id of the suggestion list, unique per instance. */
|
|
230
|
+
this.listId = `lib-form-copy-lint-list-${nextFormCopyLintId++}`;
|
|
231
|
+
/** Whether the suggestion list is expanded. */
|
|
232
|
+
this.expanded = signal(false, ...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
233
|
+
}
|
|
234
|
+
#store;
|
|
235
|
+
/** Opens the element editor on the field a suggestion is about. */
|
|
236
|
+
editInput(inputId) {
|
|
237
|
+
this.#store.actions.setInputInEditId({ inputInEdit: inputId });
|
|
238
|
+
}
|
|
239
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: FormCopyLintComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
240
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: FormCopyLintComponent, isStandalone: true, selector: "lib-form-copy-lint", ngImport: i0, template: "@if (warnings().length > 0) {\n<section class=\"copy-lint\" [attr.aria-labelledby]=\"titleId\">\n <button mat-button type=\"button\" class=\"copy-lint__toggle\"\n [attr.aria-expanded]=\"expanded()\" [attr.aria-controls]=\"expanded() ? listId : null\"\n (click)=\"expanded.set(!expanded())\">\n <mat-icon aria-hidden=\"true\">spellcheck</mat-icon>\n <span [id]=\"titleId\">\n {{ warnings().length }} copy {{ warnings().length === 1 ? 'suggestion' : 'suggestions' }}\n </span>\n <mat-icon aria-hidden=\"true\" class=\"copy-lint__chevron\" [class.copy-lint__chevron--open]=\"expanded()\">expand_more</mat-icon>\n </button>\n <p class=\"copy-lint__note\">Suggestions only. They never block saving.</p>\n\n @if (expanded()) {\n <ul class=\"copy-lint__list\" [id]=\"listId\">\n @for (warning of warnings(); track warning.key) {\n <li class=\"copy-lint__item\">\n <div class=\"copy-lint__text\">\n <span class=\"copy-lint__owner\">{{ warning.owner }}</span>\n <span class=\"copy-lint__message\">{{ warning.message }}</span>\n </div>\n @if (warning.inputId; as inputId) {\n <button mat-button type=\"button\" class=\"copy-lint__edit\"\n [attr.aria-label]=\"'Edit ' + warning.owner\"\n (click)=\"editInput(inputId)\">Edit</button>\n }\n </li>\n }\n </ul>\n }\n</section>\n}\n", styles: [":host{display:block;margin:8px 0 16px}.copy-lint{padding:8px 0}.copy-lint__toggle{color:var(--lib-forms-on-surface, var(--mat-sys-on-surface))}.copy-lint__toggle mat-icon:first-child{color:var(--lib-forms-primary, var(--mat-sys-primary))}.copy-lint__chevron{transition:transform .28s cubic-bezier(.2,0,0,1)}.copy-lint__chevron--open{transform:rotate(180deg)}.copy-lint__note{margin:0 0 4px 16px;font-size:.75rem;line-height:1rem;color:var(--lib-forms-on-surface-variant, var(--mat-sys-on-surface-variant))}.copy-lint__list{list-style:none;margin:0;padding:0 0 0 16px;display:flex;flex-direction:column;gap:12px}.copy-lint__item{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.copy-lint__text{display:flex;flex-direction:column;gap:2px;min-width:0}.copy-lint__owner{font-size:.875rem;font-weight:500;color:var(--lib-forms-on-surface, var(--mat-sys-on-surface));overflow-wrap:anywhere}.copy-lint__message{font-size:.875rem;line-height:1.25rem;color:var(--lib-forms-on-surface-variant, var(--mat-sys-on-surface-variant));overflow-wrap:anywhere}.copy-lint__edit{flex:0 0 auto}.copy-lint__toggle:focus-visible,.copy-lint__edit:focus-visible{outline:2px solid var(--lib-forms-primary, var(--mat-sys-primary));outline-offset:2px}@media(prefers-reduced-motion:reduce){.copy-lint__chevron{transition:none}}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
241
|
+
}
|
|
242
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: FormCopyLintComponent, decorators: [{
|
|
243
|
+
type: Component,
|
|
244
|
+
args: [{ selector: 'lib-form-copy-lint', imports: [MatButtonModule, MatIconModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (warnings().length > 0) {\n<section class=\"copy-lint\" [attr.aria-labelledby]=\"titleId\">\n <button mat-button type=\"button\" class=\"copy-lint__toggle\"\n [attr.aria-expanded]=\"expanded()\" [attr.aria-controls]=\"expanded() ? listId : null\"\n (click)=\"expanded.set(!expanded())\">\n <mat-icon aria-hidden=\"true\">spellcheck</mat-icon>\n <span [id]=\"titleId\">\n {{ warnings().length }} copy {{ warnings().length === 1 ? 'suggestion' : 'suggestions' }}\n </span>\n <mat-icon aria-hidden=\"true\" class=\"copy-lint__chevron\" [class.copy-lint__chevron--open]=\"expanded()\">expand_more</mat-icon>\n </button>\n <p class=\"copy-lint__note\">Suggestions only. They never block saving.</p>\n\n @if (expanded()) {\n <ul class=\"copy-lint__list\" [id]=\"listId\">\n @for (warning of warnings(); track warning.key) {\n <li class=\"copy-lint__item\">\n <div class=\"copy-lint__text\">\n <span class=\"copy-lint__owner\">{{ warning.owner }}</span>\n <span class=\"copy-lint__message\">{{ warning.message }}</span>\n </div>\n @if (warning.inputId; as inputId) {\n <button mat-button type=\"button\" class=\"copy-lint__edit\"\n [attr.aria-label]=\"'Edit ' + warning.owner\"\n (click)=\"editInput(inputId)\">Edit</button>\n }\n </li>\n }\n </ul>\n }\n</section>\n}\n", styles: [":host{display:block;margin:8px 0 16px}.copy-lint{padding:8px 0}.copy-lint__toggle{color:var(--lib-forms-on-surface, var(--mat-sys-on-surface))}.copy-lint__toggle mat-icon:first-child{color:var(--lib-forms-primary, var(--mat-sys-primary))}.copy-lint__chevron{transition:transform .28s cubic-bezier(.2,0,0,1)}.copy-lint__chevron--open{transform:rotate(180deg)}.copy-lint__note{margin:0 0 4px 16px;font-size:.75rem;line-height:1rem;color:var(--lib-forms-on-surface-variant, var(--mat-sys-on-surface-variant))}.copy-lint__list{list-style:none;margin:0;padding:0 0 0 16px;display:flex;flex-direction:column;gap:12px}.copy-lint__item{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.copy-lint__text{display:flex;flex-direction:column;gap:2px;min-width:0}.copy-lint__owner{font-size:.875rem;font-weight:500;color:var(--lib-forms-on-surface, var(--mat-sys-on-surface));overflow-wrap:anywhere}.copy-lint__message{font-size:.875rem;line-height:1.25rem;color:var(--lib-forms-on-surface-variant, var(--mat-sys-on-surface-variant));overflow-wrap:anywhere}.copy-lint__edit{flex:0 0 auto}.copy-lint__toggle:focus-visible,.copy-lint__edit:focus-visible{outline:2px solid var(--lib-forms-primary, var(--mat-sys-primary));outline-offset:2px}@media(prefers-reduced-motion:reduce){.copy-lint__chevron{transition:none}}\n"] }]
|
|
245
|
+
}] });
|
|
246
|
+
|
|
247
|
+
export { FormCopyLintComponent };
|
|
248
|
+
//# sourceMappingURL=ngx-t-forms-form-copy-lint.component-TCSe-27-.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngx-t-forms-form-copy-lint.component-TCSe-27-.mjs","sources":["../../../projects/ngx-t-forms/src/lib/components/form-builder/elements/form-copy-lint/form-copy-lint.ts","../../../projects/ngx-t-forms/src/lib/components/form-builder/elements/form-copy-lint/form-copy-lint.component.ts","../../../projects/ngx-t-forms/src/lib/components/form-builder/elements/form-copy-lint/form-copy-lint.component.html"],"sourcesContent":["import type { FormSlideInterface } from 'ngx-t-forms-types';\n\n/** Which authored text a copy warning is about. */\nexport type FormCopyField = 'section' | 'label' | 'hint' | 'description' | 'placeholder' | 'tour';\n\n/** One non-blocking suggestion about authored form copy. */\nexport interface FormCopyWarning {\n /** Stable key for `@for` tracking. */\n readonly key: string;\n /** Input id to open in the element editor; absent for section titles and sub-row fields. */\n readonly inputId?: string;\n /** Human name of the thing the text belongs to (its label, or the section name). */\n readonly owner: string;\n /** Which authored text the warning is about. */\n readonly field: FormCopyField;\n /** Sentence-case explanation shown to the form author. */\n readonly message: string;\n}\n\nconst FIELD_NAMES: Record<FormCopyField, string> = {\n section: 'Section title',\n label: 'Label',\n hint: 'Hint',\n description: 'Description',\n placeholder: 'Placeholder',\n tour: 'Help text',\n};\n\n/** Placeholder values authors leave behind while drafting. */\nconst PLACEHOLDER_TEXT = new Set([\n 'help', 'todo', 'tbd', 'tba', 'description', 'hint', 'label', 'text', 'placeholder',\n 'lorem ipsum', 'xxx', 'test', 'n/a', '...', '…', '-',\n]);\n\n/**\n * The placeholder words that are never a real field or section name. Words such\n * as \"Description\", \"Text\" or \"Label\" are legitimate names, so names are only\n * checked against this narrower set.\n */\nconst PLACEHOLDER_NAMES = new Set(['help', 'todo', 'tbd', 'tba', 'lorem ipsum', 'xxx', '...', '…', '-']);\n\n/** Words that never end a finished sentence. */\nconst DANGLING_END_WORDS = new Set([\n 'a', 'an', 'the', 'and', 'or', 'but', 'of', 'to', 'for', 'with', 'from', 'by', 'in', 'on',\n 'at', 'that', 'which', 'who', 'whose', 'your', 'our', 'their', 'its', 'is', 'are', 'was',\n 'were', 'be', 'if', 'as', 'than', 'because', 'when', 'where',\n]);\n\n/** Words a title-case label capitalises but sentence case keeps lowercase. */\nconst MINOR_WORDS = new Set([\n 'a', 'an', 'the', 'and', 'or', 'but', 'nor', 'of', 'to', 'for', 'with', 'from', 'by', 'in',\n 'on', 'at', 'as', 'per', 'via',\n]);\n\n/** Splits text into word tokens (letters, digits and inner apostrophes). */\nfunction wordsOf(text: string): string[] {\n return text.match(/[\\p{L}\\p{N}]+(?:['’][\\p{L}]+)?/gu) ?? [];\n}\n\nconst isAllCaps = (word: string): boolean => word.length > 1 && word === word.toUpperCase() && /\\p{L}/u.test(word);\nconst isCapitalised = (word: string): boolean => /^\\p{Lu}/u.test(word);\n\n/**\n * `title` when two or more ordinary words are capitalised (\"Extend The\n * Submission Date\"), `sentence` when only the first is, `null` when the label\n * is too short or mixed to say. Acronyms are ignored either way.\n */\nfunction casingStyle(label: string): 'title' | 'sentence' | null {\n const words = wordsOf(label).filter((word) => !isAllCaps(word) && !/\\d/.test(word));\n if (words.length < 3) return null;\n const rest = words.slice(1);\n const capitalised = rest.filter(isCapitalised).length;\n if (capitalised === 0) return 'sentence';\n const ordinary = rest.filter((word) => !MINOR_WORDS.has(word.toLowerCase()));\n if (ordinary.length > 0 && ordinary.every(isCapitalised)) return 'title';\n return null;\n}\n\n/** Returns the repeated word when the text contains one twice in a row (\"the the\"). */\nfunction duplicateWord(text: string): string | null {\n const match = /\\b([\\p{L}]{2,})\\s+\\1\\b/iu.exec(text);\n return match?.[1] ?? null;\n}\n\n/**\n * True when prose stops mid-sentence: it ends on a connective (\"…for the\"), or\n * opens a relative clause it never finishes (\"Related to the project that your\n * organization\").\n */\nfunction looksUnfinished(text: string): boolean {\n const trimmed = text.trim();\n if (/[.!?:)\\]\"'”’]$/u.test(trimmed)) return false;\n const words = wordsOf(trimmed).map((word) => word.toLowerCase());\n if (words.length < 3) return false;\n const last = words[words.length - 1];\n if (last !== undefined && DANGLING_END_WORDS.has(last)) return true;\n let clause = -1;\n words.forEach((word, index) => {\n if (word === 'that' || word === 'which' || word === 'who') clause = index;\n });\n return clause > 0 && words.length - clause - 1 <= 2;\n}\n\ninterface CopyEntry {\n readonly owner: string;\n readonly inputId?: string;\n readonly field: FormCopyField;\n readonly text: string;\n}\n\nconst textOf = (record: Record<string, unknown>, key: string): string | undefined => {\n const value = record[key];\n return typeof value === 'string' ? value : undefined;\n};\n\n/** Every piece of authored copy in the form, flattened (sub-row fields included). */\nfunction collectCopy(slides: readonly FormSlideInterface[]): CopyEntry[] {\n const entries: CopyEntry[] = [];\n const visit = (raw: unknown, topLevelId: string | undefined): void => {\n if (!raw || typeof raw !== 'object') return;\n const record = raw as Record<string, unknown>;\n const label = textOf(record, 'label') ?? '';\n const owner = label.trim() || textOf(record, 'formControlName') || 'Untitled field';\n const push = (field: FormCopyField, key: string): void => {\n const text = textOf(record, key);\n if (text !== undefined) entries.push({ owner, inputId: topLevelId, field, text });\n };\n push('label', 'label');\n push('hint', 'hintLabel');\n push('description', 'description');\n push('placeholder', 'placeholder');\n push('tour', 'tourContent');\n const children = record['formInputs'];\n if (Array.isArray(children)) children.forEach((child) => visit(child, undefined));\n };\n for (const slide of slides) {\n entries.push({ owner: slide.label || 'Untitled section', field: 'section', text: slide.label ?? '' });\n for (const column of slide.columns ?? []) {\n const id = (column as { id?: unknown }).id;\n visit(column, typeof id === 'string' ? id : undefined);\n }\n }\n return entries;\n}\n\n/**\n * Lints the authored copy of a form for the slips that reach end users\n * unedited: placeholder text (\"help\"), labels starting lowercase, title-case\n * labels in a sentence-case form (or the reverse), an acronym spelled two ways\n * (\"SCM\" / \"Scm\"), doubled words, and help or description text that stops\n * mid-sentence.\n *\n * Advisory only: the builder lists these for the author and never blocks a\n * save, because a form can be correct and still trip a heuristic.\n */\nexport function lintFormCopy(slides: readonly FormSlideInterface[]): FormCopyWarning[] {\n const entries = collectCopy(slides);\n const warnings: FormCopyWarning[] = [];\n const add = (entry: CopyEntry, message: string): void => {\n warnings.push({\n key: `${entry.inputId ?? entry.owner}|${entry.field}|${warnings.length}`,\n inputId: entry.inputId,\n owner: entry.owner,\n field: entry.field,\n message: `${FIELD_NAMES[entry.field]}: ${message}`,\n });\n };\n\n const names = entries.filter((entry) => entry.field === 'label' || entry.field === 'section');\n const styles = names.map((entry) => casingStyle(entry.text));\n const titleCount = styles.filter((style) => style === 'title').length;\n const sentenceCount = styles.filter((style) => style === 'sentence').length;\n const minority = titleCount > 0 && sentenceCount > 0\n ? (titleCount <= sentenceCount ? 'title' : 'sentence')\n : null;\n\n // Every spelling of each word across labels, to catch \"SCM\" next to \"Scm\".\n const spellings = new Map<string, Set<string>>();\n for (const entry of names) {\n for (const word of wordsOf(entry.text)) {\n const key = word.toLowerCase();\n const set = spellings.get(key) ?? new Set<string>();\n set.add(word);\n spellings.set(key, set);\n }\n }\n\n entries.forEach((entry) => {\n const text = entry.text.trim();\n const isName = entry.field === 'label' || entry.field === 'section';\n\n if (!text) {\n if (entry.field === 'tour' || entry.field === 'description' || entry.field === 'hint') {\n add(entry, 'is empty; remove it or write the sentence it should say.');\n }\n return;\n }\n if ((isName ? PLACEHOLDER_NAMES : PLACEHOLDER_TEXT).has(text.toLowerCase())) {\n add(entry, `\"${text}\" looks like placeholder text.`);\n return;\n }\n\n const doubled = duplicateWord(text);\n if (doubled) add(entry, `\"${doubled}\" is repeated.`);\n\n if (isName) {\n const first = wordsOf(text)[0];\n if (first && /^\\p{Ll}/u.test(first)) {\n add(entry, `\"${text}\" starts with a lowercase letter.`);\n }\n const style = casingStyle(text);\n if (minority !== null && style === minority) {\n add(entry, minority === 'title'\n ? `\"${text}\" uses Title Case; most names in this form use sentence case.`\n : `\"${text}\" uses sentence case; most names in this form use Title Case.`);\n }\n for (const word of wordsOf(text)) {\n const variants = spellings.get(word.toLowerCase());\n const acronym = variants ? [...variants].find(isAllCaps) : undefined;\n // Only a capitalised spelling (\"Scm\") is suspect: a lowercase word such\n // as \"it\" next to the acronym \"IT\" is usually a different word.\n if (acronym && word !== acronym && isCapitalised(word) && !isAllCaps(word)) {\n add(entry, `\"${word}\" is written \"${acronym}\" elsewhere in this form.`);\n break;\n }\n }\n return;\n }\n\n if (entry.field !== 'placeholder' && looksUnfinished(text)) {\n add(entry, `\"${text}\" reads like an unfinished sentence.`);\n }\n });\n\n return warnings;\n}\n","import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatIconModule } from '@angular/material/icon';\n\nimport { FormsStoreService } from '../../../forms/store/forms-store.service';\nimport { lintFormCopy, type FormCopyWarning } from './form-copy-lint';\n\n/** Per-instance suffix so two builders on one page never share an id. */\nlet nextFormCopyLintId = 0;\n\n/**\n * Non-blocking copy check for the form author. Lists wording slips that would\n * otherwise reach the people filling the form in unedited: placeholder text\n * such as \"help\", mixed Title Case and sentence case, an acronym spelled two\n * ways, doubled words, and help or description text that stops mid-sentence.\n *\n * It never affects saving. Renders nothing when the copy is clean; otherwise a\n * collapsed disclosure the author can open, with an \"Edit\" jump per field.\n */\n@Component({\n selector: 'lib-form-copy-lint',\n imports: [MatButtonModule, MatIconModule],\n templateUrl: './form-copy-lint.component.html',\n styleUrl: './form-copy-lint.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class FormCopyLintComponent {\n readonly #store = inject(FormsStoreService);\n\n /** Copy suggestions for the form currently in the builder. */\n protected readonly warnings = computed<FormCopyWarning[]>(() =>\n lintFormCopy(this.#store.formBuilderSignalSelectors.selectFormSlides()),\n );\n\n /** DOM id of the disclosure's title, unique per instance. */\n protected readonly titleId = `lib-form-copy-lint-title-${nextFormCopyLintId}`;\n\n /** DOM id of the suggestion list, unique per instance. */\n protected readonly listId = `lib-form-copy-lint-list-${nextFormCopyLintId++}`;\n\n /** Whether the suggestion list is expanded. */\n protected readonly expanded = signal<boolean>(false);\n\n /** Opens the element editor on the field a suggestion is about. */\n protected editInput(inputId: string): void {\n this.#store.actions.setInputInEditId({ inputInEdit: inputId });\n }\n}\n","@if (warnings().length > 0) {\n<section class=\"copy-lint\" [attr.aria-labelledby]=\"titleId\">\n <button mat-button type=\"button\" class=\"copy-lint__toggle\"\n [attr.aria-expanded]=\"expanded()\" [attr.aria-controls]=\"expanded() ? listId : null\"\n (click)=\"expanded.set(!expanded())\">\n <mat-icon aria-hidden=\"true\">spellcheck</mat-icon>\n <span [id]=\"titleId\">\n {{ warnings().length }} copy {{ warnings().length === 1 ? 'suggestion' : 'suggestions' }}\n </span>\n <mat-icon aria-hidden=\"true\" class=\"copy-lint__chevron\" [class.copy-lint__chevron--open]=\"expanded()\">expand_more</mat-icon>\n </button>\n <p class=\"copy-lint__note\">Suggestions only. They never block saving.</p>\n\n @if (expanded()) {\n <ul class=\"copy-lint__list\" [id]=\"listId\">\n @for (warning of warnings(); track warning.key) {\n <li class=\"copy-lint__item\">\n <div class=\"copy-lint__text\">\n <span class=\"copy-lint__owner\">{{ warning.owner }}</span>\n <span class=\"copy-lint__message\">{{ warning.message }}</span>\n </div>\n @if (warning.inputId; as inputId) {\n <button mat-button type=\"button\" class=\"copy-lint__edit\"\n [attr.aria-label]=\"'Edit ' + warning.owner\"\n (click)=\"editInput(inputId)\">Edit</button>\n }\n </li>\n }\n </ul>\n }\n</section>\n}\n"],"names":["i2"],"mappings":";;;;;;;;AAmBA,MAAM,WAAW,GAAkC;AACjD,IAAA,OAAO,EAAE,eAAe;AACxB,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,WAAW,EAAE,aAAa;AAC1B,IAAA,WAAW,EAAE,aAAa;AAC1B,IAAA,IAAI,EAAE,WAAW;CAClB;AAED;AACA,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;AAC/B,IAAA,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa;IACnF,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG;AACrD,CAAA,CAAC;AAEF;;;;AAIG;AACH,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAExG;AACA,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IACjC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IACzF,IAAI,EAAE,MAAM,EAAE,OAAO,E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CAAA,EAAA,MAAA,EAAA,CAAA,izCAAA,CAAA,EAAA;;;;;"}
|
|
@@ -6,7 +6,7 @@ import * as i6 from '@angular/material/list';
|
|
|
6
6
|
import { MatListModule } from '@angular/material/list';
|
|
7
7
|
import * as i7 from '@angular/material/core';
|
|
8
8
|
import { MatRippleModule } from '@angular/material/core';
|
|
9
|
-
import {
|
|
9
|
+
import { d as getInputIcon, E as EmptyStateComponent } from './ngx-t-forms-ngx-t-forms-C1kZpYIM.mjs';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Single-select list that lets a user pick one form input by id. Child of
|
|
@@ -82,4 +82,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
82
82
|
}], propDecorators: { errors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], formInputs: [{ type: i0.Input, args: [{ isSignal: true, alias: "formInputs", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], change: [{ type: i0.Output, args: ["change"] }] } });
|
|
83
83
|
|
|
84
84
|
export { FormInputSelectorComponent };
|
|
85
|
-
//# sourceMappingURL=ngx-t-forms-form-input-selector.component-
|
|
85
|
+
//# sourceMappingURL=ngx-t-forms-form-input-selector.component-Bdkuzw0R.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-t-forms-form-input-selector.component-B3ES53R-.mjs","sources":["../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/form-input-selector/form-input-selector.component.ts","../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/form-input-selector/form-input-selector.component.html"],"sourcesContent":["import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n ViewEncapsulation,\r\n computed,\r\n input,\r\n output,\r\n} from '@angular/core';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatListModule } from '@angular/material/list';\r\nimport { MatRippleModule } from '@angular/material/core';\r\nimport type { FormColumnInputs } from 'ngx-t-forms-types';\r\nimport { getInputIcon } from '../../../../shared/functions/getInputIcon';\r\nimport type { IConfigElementError } from '../../t-dynamic-data-edit.component';\r\nimport { EmptyStateComponent } from '../_shared/empty-state/empty-state.component';\r\n\r\n/** A form input decorated with the derived view-model fields the list renders. */\r\ninterface FormInputOption {\r\n readonly input: FormColumnInputs;\r\n readonly id: string;\r\n readonly label: string;\r\n readonly icon: string;\r\n readonly dataType: string;\r\n readonly isSubItem: boolean;\r\n readonly selected: boolean;\r\n readonly ariaLabel: string;\r\n}\r\n\r\n/**\r\n * Single-select list that lets a user pick one form input by id. Child of\r\n * `t-dynamic-data-edit`, which supplies the field label, hint, and validation\r\n * errors — so this component owns only the selectable list content.\r\n *\r\n * Selecting an already-selected input deselects it (emits `undefined`). While a\r\n * value is set the list collapses to the selected-only view.\r\n */\r\n@Component({\r\n selector: 'lib-form-input-selector',\r\n imports: [MatIconModule, MatListModule, MatRippleModule, EmptyStateComponent],\r\n templateUrl: './form-input-selector.component.html',\r\n styleUrl: './form-input-selector.component.css',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.Emulated,\r\n host: {\r\n 'class': 'lib-form-input-selector',\r\n '[attr.id]': 'id()',\r\n },\r\n})\r\nexport class FormInputSelectorComponent {\r\n /**\r\n * Validation errors passed down by the parent editor. Retained on the contract\r\n * (the parent binds `[errors]`) but not rendered here — `t-dynamic-data-edit`\r\n * owns error display, so rendering them again would double them.\r\n */\r\n readonly errors = input<IConfigElementError[] | undefined>([]);\r\n\r\n /** Currently selected input id, or `undefined` when nothing is selected. */\r\n readonly value = input<string | undefined>(undefined);\r\n\r\n /** Available form inputs to choose from. */\r\n readonly formInputs = input<readonly FormColumnInputs[]>([]);\r\n\r\n /** Disable user interaction. */\r\n readonly disabled = input<boolean>(false);\r\n\r\n /** Optional id attribute supplied by the parent editor. */\r\n readonly id = input<string | undefined>(undefined);\r\n\r\n /** Emits the chosen input id, or `undefined` when the selection is cleared. */\r\n readonly change = output<string | undefined>();\r\n\r\n /**\r\n * The list to render: the selected-only view once a value is set, otherwise\r\n * every available input. Each entry carries its derived icon, sub-item flag,\r\n * and accessible label.\r\n */\r\n protected readonly options = computed<readonly FormInputOption[]>(() => {\r\n const value = this.value();\r\n const inputs = this.formInputs();\r\n const selected = value === undefined ? undefined : inputs.find((item) => item.id === value);\r\n const source = selected ? [selected] : inputs;\r\n return source.map((item) => this.#toOption(item, item.id === value));\r\n });\r\n\r\n /** Toggle selection: re-selecting the current value clears it. */\r\n protected select(id: string): void {\r\n if (this.disabled()) {\r\n return;\r\n }\r\n this.change.emit(this.value() === id ? undefined : id);\r\n }\r\n\r\n #toOption(item: FormColumnInputs, selected: boolean): FormInputOption {\r\n const isSubItem = Boolean(item.multipleInputInEditId);\r\n const dataType = item.dataType ?? '';\r\n const kind = isSubItem ? 'Sub-item input' : 'Primary input';\r\n const dataTypeLabel = dataType ? `, ${dataType}` : '';\r\n return {\r\n input: item,\r\n id: item.id,\r\n label: item.label,\r\n icon: getInputIcon(item.element),\r\n dataType,\r\n isSubItem,\r\n selected,\r\n ariaLabel: `${item.label}. ${kind}${dataTypeLabel}.${selected ? ' Selected.' : ''}`,\r\n };\r\n }\r\n}\r\n","@if (options().length) {\r\n<mat-nav-list class=\"lib-form-input-selector__list\" role=\"listbox\" aria-label=\"Form input selector\">\r\n @for (option of options(); track option.id) {\r\n <mat-list-item\r\n class=\"lib-form-input-selector__item\"\r\n matRipple\r\n [disabled]=\"disabled()\"\r\n [activated]=\"option.selected\"\r\n [attr.aria-selected]=\"option.selected\"\r\n [attr.aria-label]=\"option.ariaLabel\"\r\n (click)=\"select(option.id)\">\r\n <mat-icon matListItemAvatar class=\"lib-form-input-selector__avatar\" aria-hidden=\"true\">\r\n {{ option.icon }}\r\n </mat-icon>\r\n <span matListItemTitle class=\"lib-form-input-selector__title\">{{ option.label }}</span>\r\n <span matListItemLine class=\"lib-form-input-selector__meta-text\">\r\n @if (option.isSubItem) {\r\n <span>Sub-item</span>\r\n }\r\n @if (option.dataType) {\r\n <span>{{ option.dataType }}</span>\r\n }\r\n @if (option.selected) {\r\n <span class=\"lib-form-input-selector__selected-hint\">Selected</span>\r\n }\r\n </span>\r\n <mat-icon\r\n matListItemMeta\r\n class=\"lib-form-input-selector__indicator\"\r\n [class.lib-form-input-selector__indicator--on]=\"option.selected\"\r\n aria-hidden=\"true\">\r\n {{ option.selected ? 'check_circle' : 'radio_button_unchecked' }}\r\n </mat-icon>\r\n </mat-list-item>\r\n }\r\n</mat-nav-list>\r\n} @else {\r\n<lib-empty-state icon=\"search_off\" message=\"No form inputs found\" />\r\n}\r\n"],"names":["i2","i3"],"mappings":";;;;;;;;;;AA4BA;;;;;;;AAOG;MAaU,0BAA0B,CAAA;AAZvC,IAAA,WAAA,GAAA;AAaE;;;;AAIG;AACM,QAAA,IAAA,CAAA,MAAM,GAAG,KAAK,CAAoC,EAAE,6EAAC;;AAGrD,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAqB,SAAS,4EAAC;;AAG5C,QAAA,IAAA,CAAA,UAAU,GAAG,KAAK,CAA8B,EAAE,iFAAC;;AAGnD,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,+EAAC;;AAGhC,QAAA,IAAA,CAAA,EAAE,GAAG,KAAK,CAAqB,SAAS,yEAAC;;QAGzC,IAAA,CAAA,MAAM,GAAG,MAAM,EAAsB;AAE9C;;;;AAIG;AACgB,QAAA,IAAA,CAAA,OAAO,GAAG,QAAQ,CAA6B,MAAK;AACrE,YAAA,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE;AAC1B,YAAA,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE;YAChC,MAAM,QAAQ,GAAG,KAAK,KAAK,SAAS,GAAG,SAAS,GAAG,M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AAA;;4FAUjE,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBAZtC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,yBAAyB,WAC1B,CAAC,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,mBAAmB,CAAC,EAAA,eAAA,EAG5D,uBAAuB,CAAC,MAAM,iBAChC,iBAAiB,CAAC,QAAQ,EAAA,IAAA,EACnC;AACJ,wBAAA,OAAO,EAAE,yBAAyB;AAClC,wBAAA,WAAW,EAAE,MAAM;AACpB,qBAAA,EAAA,QAAA,EAAA,kgDAAA,EAAA,MAAA,EAAA,CAAA,kwDAAA,CAAA,EAAA;;;;;"}
|
|
1
|
+
{"version":3,"file":"ngx-t-forms-form-input-selector.component-Bdkuzw0R.mjs","sources":["../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/form-input-selector/form-input-selector.component.ts","../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/form-input-selector/form-input-selector.component.html"],"sourcesContent":["import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n ViewEncapsulation,\r\n computed,\r\n input,\r\n output,\r\n} from '@angular/core';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatListModule } from '@angular/material/list';\r\nimport { MatRippleModule } from '@angular/material/core';\r\nimport type { FormColumnInputs } from 'ngx-t-forms-types';\r\nimport { getInputIcon } from '../../../../shared/functions/getInputIcon';\r\nimport type { IConfigElementError } from '../../t-dynamic-data-edit.component';\r\nimport { EmptyStateComponent } from '../_shared/empty-state/empty-state.component';\r\n\r\n/** A form input decorated with the derived view-model fields the list renders. */\r\ninterface FormInputOption {\r\n readonly input: FormColumnInputs;\r\n readonly id: string;\r\n readonly label: string;\r\n readonly icon: string;\r\n readonly dataType: string;\r\n readonly isSubItem: boolean;\r\n readonly selected: boolean;\r\n readonly ariaLabel: string;\r\n}\r\n\r\n/**\r\n * Single-select list that lets a user pick one form input by id. Child of\r\n * `t-dynamic-data-edit`, which supplies the field label, hint, and validation\r\n * errors — so this component owns only the selectable list content.\r\n *\r\n * Selecting an already-selected input deselects it (emits `undefined`). While a\r\n * value is set the list collapses to the selected-only view.\r\n */\r\n@Component({\r\n selector: 'lib-form-input-selector',\r\n imports: [MatIconModule, MatListModule, MatRippleModule, EmptyStateComponent],\r\n templateUrl: './form-input-selector.component.html',\r\n styleUrl: './form-input-selector.component.css',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.Emulated,\r\n host: {\r\n 'class': 'lib-form-input-selector',\r\n '[attr.id]': 'id()',\r\n },\r\n})\r\nexport class FormInputSelectorComponent {\r\n /**\r\n * Validation errors passed down by the parent editor. Retained on the contract\r\n * (the parent binds `[errors]`) but not rendered here — `t-dynamic-data-edit`\r\n * owns error display, so rendering them again would double them.\r\n */\r\n readonly errors = input<IConfigElementError[] | undefined>([]);\r\n\r\n /** Currently selected input id, or `undefined` when nothing is selected. */\r\n readonly value = input<string | undefined>(undefined);\r\n\r\n /** Available form inputs to choose from. */\r\n readonly formInputs = input<readonly FormColumnInputs[]>([]);\r\n\r\n /** Disable user interaction. */\r\n readonly disabled = input<boolean>(false);\r\n\r\n /** Optional id attribute supplied by the parent editor. */\r\n readonly id = input<string | undefined>(undefined);\r\n\r\n /** Emits the chosen input id, or `undefined` when the selection is cleared. */\r\n readonly change = output<string | undefined>();\r\n\r\n /**\r\n * The list to render: the selected-only view once a value is set, otherwise\r\n * every available input. Each entry carries its derived icon, sub-item flag,\r\n * and accessible label.\r\n */\r\n protected readonly options = computed<readonly FormInputOption[]>(() => {\r\n const value = this.value();\r\n const inputs = this.formInputs();\r\n const selected = value === undefined ? undefined : inputs.find((item) => item.id === value);\r\n const source = selected ? [selected] : inputs;\r\n return source.map((item) => this.#toOption(item, item.id === value));\r\n });\r\n\r\n /** Toggle selection: re-selecting the current value clears it. */\r\n protected select(id: string): void {\r\n if (this.disabled()) {\r\n return;\r\n }\r\n this.change.emit(this.value() === id ? undefined : id);\r\n }\r\n\r\n #toOption(item: FormColumnInputs, selected: boolean): FormInputOption {\r\n const isSubItem = Boolean(item.multipleInputInEditId);\r\n const dataType = item.dataType ?? '';\r\n const kind = isSubItem ? 'Sub-item input' : 'Primary input';\r\n const dataTypeLabel = dataType ? `, ${dataType}` : '';\r\n return {\r\n input: item,\r\n id: item.id,\r\n label: item.label,\r\n icon: getInputIcon(item.element),\r\n dataType,\r\n isSubItem,\r\n selected,\r\n ariaLabel: `${item.label}. ${kind}${dataTypeLabel}.${selected ? ' Selected.' : ''}`,\r\n };\r\n }\r\n}\r\n","@if (options().length) {\r\n<mat-nav-list class=\"lib-form-input-selector__list\" role=\"listbox\" aria-label=\"Form input selector\">\r\n @for (option of options(); track option.id) {\r\n <mat-list-item\r\n class=\"lib-form-input-selector__item\"\r\n matRipple\r\n [disabled]=\"disabled()\"\r\n [activated]=\"option.selected\"\r\n [attr.aria-selected]=\"option.selected\"\r\n [attr.aria-label]=\"option.ariaLabel\"\r\n (click)=\"select(option.id)\">\r\n <mat-icon matListItemAvatar class=\"lib-form-input-selector__avatar\" aria-hidden=\"true\">\r\n {{ option.icon }}\r\n </mat-icon>\r\n <span matListItemTitle class=\"lib-form-input-selector__title\">{{ option.label }}</span>\r\n <span matListItemLine class=\"lib-form-input-selector__meta-text\">\r\n @if (option.isSubItem) {\r\n <span>Sub-item</span>\r\n }\r\n @if (option.dataType) {\r\n <span>{{ option.dataType }}</span>\r\n }\r\n @if (option.selected) {\r\n <span class=\"lib-form-input-selector__selected-hint\">Selected</span>\r\n }\r\n </span>\r\n <mat-icon\r\n matListItemMeta\r\n class=\"lib-form-input-selector__indicator\"\r\n [class.lib-form-input-selector__indicator--on]=\"option.selected\"\r\n aria-hidden=\"true\">\r\n {{ option.selected ? 'check_circle' : 'radio_button_unchecked' }}\r\n </mat-icon>\r\n </mat-list-item>\r\n }\r\n</mat-nav-list>\r\n} @else {\r\n<lib-empty-state icon=\"search_off\" message=\"No form inputs found\" />\r\n}\r\n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 from '@angular/core';
|
|
3
3
|
import { inject, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
|
-
import { F as FormsStoreService,
|
|
4
|
+
import { F as FormsStoreService, f as TDynamicDataViewComponent } from './ngx-t-forms-ngx-t-forms-C1kZpYIM.mjs';
|
|
5
5
|
import { map } from 'rxjs';
|
|
6
6
|
|
|
7
7
|
class FormJsonViewComponent {
|
|
@@ -19,4 +19,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
19
19
|
}] });
|
|
20
20
|
|
|
21
21
|
export { FormJsonViewComponent };
|
|
22
|
-
//# sourceMappingURL=ngx-t-forms-form-json-view.component-
|
|
22
|
+
//# sourceMappingURL=ngx-t-forms-form-json-view.component-CDcbgWgN.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-t-forms-form-json-view.component-
|
|
1
|
+
{"version":3,"file":"ngx-t-forms-form-json-view.component-CDcbgWgN.mjs","sources":["../../../projects/ngx-t-forms/src/lib/components/form-builder/elements/form-json-view/form-json-view.component.ts","../../../projects/ngx-t-forms/src/lib/components/form-builder/elements/form-json-view/form-json-view.component.html"],"sourcesContent":["import { AsyncPipe } from '@angular/common';\r\nimport { ChangeDetectionStrategy, Component, inject } from '@angular/core';\r\n\r\nimport { FormsStoreService } from '../../../forms/store/forms-store.service';\r\nimport { TDynamicDataViewComponent } from '../../../t-dynamic-data-view/t-dynamic-data-view.component';\r\n\r\nimport { map } from 'rxjs';\r\n\r\n@Component({\r\n selector: 'lib-form-json-view',\r\n imports: [AsyncPipe, TDynamicDataViewComponent],\r\n templateUrl: './form-json-view.component.html',\r\n styleUrl: './form-json-view.component.scss',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class FormJsonViewComponent {\r\n readonly #store = inject(FormsStoreService);\r\n\r\n protected readonly form$ = this.#store.selectors.selectFormInEdit$.pipe(\r\n map((form) => form?.form),\r\n );\r\n}\r\n","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