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
|
@@ -1,2472 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, output, inject, DestroyRef, ViewContainerRef, Injector, signal, computed, viewChild, ElementRef, effect, afterNextRender, ViewEncapsulation, ChangeDetectionStrategy, Component, PLATFORM_ID, ErrorHandler, Injectable, untracked } from '@angular/core';
|
|
3
|
-
import * as i1$3 from '@angular/forms';
|
|
4
|
-
import { NgControl, ReactiveFormsModule } from '@angular/forms';
|
|
5
|
-
import * as i2$1 from '@angular/material/form-field';
|
|
6
|
-
import { MatFormFieldControl, MatFormFieldModule } from '@angular/material/form-field';
|
|
7
|
-
import * as i3 from '@angular/material/icon';
|
|
8
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
9
|
-
import * as i2 from '@angular/material/button';
|
|
10
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
11
|
-
import * as i5$1 from '@angular/material/tooltip';
|
|
12
|
-
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
13
|
-
import { a8 as injectFormsLocalization, c as TDynamicDataViewComponent, $ as TFormInputComponent, aa as LIBRARY_CURRENCY_DEFAULTS, ab as calculateListOveralFunctions, ac as roundValueByRule, ad as childRoundingRule, ae as multipleInputRowIdKey, af as SPREADSHEET_WRITER, ag as TFormImportController, ah as buildImportTemplate, ai as optionInputKind, aj as normaliseOptionText, ak as SPREADSHEET_PARSER, al as describeImportColumns, am as TEMPLATE_GUIDE_SHEET, an as isMultiSelectInput, ao as applyOptionChoice, B as BaseCustomInput, ap as injectCurrencyRoundingDefaults, _ as _isEqual, a4 as getInputErrorMessage, a5 as TFormInputStatusComponent } from './ngx-t-forms-ngx-t-forms-CaVyRedJ.mjs';
|
|
14
|
-
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
|
15
|
-
import * as i5 from '@angular/material/table';
|
|
16
|
-
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
|
|
17
|
-
import * as i1$2 from '@angular/material/dialog';
|
|
18
|
-
import { MatDialog, MAT_DIALOG_DATA, MatDialogRef, MatDialogModule } from '@angular/material/dialog';
|
|
19
|
-
import * as i6 from '@angular/material/menu';
|
|
20
|
-
import { MatMenuModule } from '@angular/material/menu';
|
|
21
|
-
import { DocumentLitsLabelConfigInterfaceValueType, InputDataTypes, MultipleInputAvailableOperations, CalculationFunctions } from 'ngx-t-forms-types';
|
|
22
|
-
import { CdkConnectedOverlay } from '@angular/cdk/overlay';
|
|
23
|
-
import * as i4 from '@angular/material/chips';
|
|
24
|
-
import { MatChipsModule } from '@angular/material/chips';
|
|
25
|
-
import * as i3$1 from '@angular/material/paginator';
|
|
26
|
-
import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
|
|
27
|
-
import * as i1 from '@angular/material/progress-bar';
|
|
28
|
-
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
29
|
-
import * as i4$1 from '@angular/material/progress-spinner';
|
|
30
|
-
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
31
|
-
import * as i3$2 from '@angular/common';
|
|
32
|
-
import { CommonModule, DOCUMENT, isPlatformBrowser, NgTemplateOutlet } from '@angular/common';
|
|
33
|
-
import * as i3$3 from '@angular/material/card';
|
|
34
|
-
import { MatCardModule } from '@angular/material/card';
|
|
35
|
-
import { MatDividerModule } from '@angular/material/divider';
|
|
36
|
-
import * as i1$1 from '@angular/cdk/drag-drop';
|
|
37
|
-
import { DragDropModule } from '@angular/cdk/drag-drop';
|
|
38
|
-
import { Subject, timer, tap, takeUntil } from 'rxjs';
|
|
39
|
-
import { v4 } from 'uuid';
|
|
40
|
-
import * as i6$1 from '@angular/material/list';
|
|
41
|
-
|
|
42
|
-
class ColorScale {
|
|
43
|
-
constructor(min, max, colorStops, alpha = 1) {
|
|
44
|
-
validateMinMaxValues(min, max);
|
|
45
|
-
validateColorStops(colorStops);
|
|
46
|
-
validateAlphaValue(alpha);
|
|
47
|
-
this.min = min;
|
|
48
|
-
this.max = max;
|
|
49
|
-
this.alpha = alpha;
|
|
50
|
-
this.colorStops = colorStops.map((colorStop) => hexToColor(colorStop, alpha));
|
|
51
|
-
}
|
|
52
|
-
getColor(value) {
|
|
53
|
-
const numOfColorStops = this.colorStops.length;
|
|
54
|
-
if (value < this.min)
|
|
55
|
-
return this.colorStops[0];
|
|
56
|
-
if (value > this.max)
|
|
57
|
-
return this.colorStops[numOfColorStops - 1];
|
|
58
|
-
const range = this.max - this.min;
|
|
59
|
-
let weight = (value - this.min) / range;
|
|
60
|
-
const colorStopIndex = Math.max(Math.ceil(weight * (numOfColorStops - 1)), 1);
|
|
61
|
-
const minColor = this.colorStops[colorStopIndex - 1];
|
|
62
|
-
const maxColor = this.colorStops[colorStopIndex];
|
|
63
|
-
if (maxColor === undefined)
|
|
64
|
-
return minColor;
|
|
65
|
-
if (minColor === undefined)
|
|
66
|
-
return maxColor;
|
|
67
|
-
weight = weight * (numOfColorStops - 1) - (colorStopIndex - 1);
|
|
68
|
-
const r = Math.floor(weight * maxColor.r + (1 - weight) * minColor.r);
|
|
69
|
-
const g = Math.floor(weight * maxColor.g + (1 - weight) * minColor.g);
|
|
70
|
-
const b = Math.floor(weight * maxColor.b + (1 - weight) * minColor.b);
|
|
71
|
-
return new Color(r, g, b, this.alpha);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
function validateMinMaxValues(min, max) {
|
|
75
|
-
if (min > max) {
|
|
76
|
-
throw new Error('The minimum value must be less than the maximum value.');
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
function validateColorStops(colorStops) {
|
|
80
|
-
if (colorStops.length < 2) {
|
|
81
|
-
throw new Error('At least two colors must be provided.');
|
|
82
|
-
}
|
|
83
|
-
colorStops.forEach((str) => {
|
|
84
|
-
if (!isValidHexColor(str)) {
|
|
85
|
-
throw new Error(`${str} is not a valid hex color.`);
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
function validateAlphaValue(alpha) {
|
|
90
|
-
if (alpha < 0 || alpha > 1) {
|
|
91
|
-
throw new Error('The alpha value must be between 0 and 1.');
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
function hexToColor(hex, alpha) {
|
|
95
|
-
if (isValid3DigitHexColor(hex)) {
|
|
96
|
-
hex = convertTo6DigitHexColor(hex);
|
|
97
|
-
}
|
|
98
|
-
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
99
|
-
if (!!result?.[1] && !!result?.[2] && !!result?.[3]) {
|
|
100
|
-
return new Color(parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16), alpha);
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
throw new Error(`${hex} is not a valid hex color.`);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
function isValidHexColor(colorString) {
|
|
107
|
-
return (isValid3DigitHexColor(colorString) || isValid6DigitHexColor(colorString));
|
|
108
|
-
}
|
|
109
|
-
function isValid3DigitHexColor(colorString) {
|
|
110
|
-
const hexColorRegex = /^#(?:[0-9a-fA-F]{3})$/;
|
|
111
|
-
return colorString.match(hexColorRegex);
|
|
112
|
-
}
|
|
113
|
-
function isValid6DigitHexColor(colorString) {
|
|
114
|
-
const hexColorRegex = /^#(?:[0-9a-fA-F]{6})$/;
|
|
115
|
-
return colorString.match(hexColorRegex);
|
|
116
|
-
}
|
|
117
|
-
function convertTo6DigitHexColor(threeDigitHex) {
|
|
118
|
-
return threeDigitHex
|
|
119
|
-
.substring(1)
|
|
120
|
-
.split('')
|
|
121
|
-
.map((char) => {
|
|
122
|
-
return char + char;
|
|
123
|
-
})
|
|
124
|
-
.join('');
|
|
125
|
-
}
|
|
126
|
-
function componentToHex(c) {
|
|
127
|
-
const hex = c.toString(16);
|
|
128
|
-
return hex.length === 1 ? '0' + hex : hex;
|
|
129
|
-
}
|
|
130
|
-
function rgbaToHex(color) {
|
|
131
|
-
const r = Math.floor(color.r * color.a);
|
|
132
|
-
const g = Math.floor(color.g * color.a);
|
|
133
|
-
const b = Math.floor(color.b * color.a);
|
|
134
|
-
return `#${componentToHex(r)}${componentToHex(g)}${componentToHex(b)}`;
|
|
135
|
-
}
|
|
136
|
-
class Color {
|
|
137
|
-
constructor(r, g, b, a = 1) {
|
|
138
|
-
validateAlphaValue(a);
|
|
139
|
-
this.r = r;
|
|
140
|
-
this.g = g;
|
|
141
|
-
this.b = b;
|
|
142
|
-
this.a = a;
|
|
143
|
-
}
|
|
144
|
-
toRGBString() {
|
|
145
|
-
return `rgb(${Math.floor(this.r * this.a)},${Math.floor(this.g * this.a)},${Math.floor(this.b * this.a)})`;
|
|
146
|
-
}
|
|
147
|
-
toRGBAString() {
|
|
148
|
-
return `rgba(${this.r},${this.g},${this.b},${this.a})`;
|
|
149
|
-
}
|
|
150
|
-
toHexString() {
|
|
151
|
-
return rgbaToHex(this);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
156
|
-
function configureCols(inputConfig, tempLabels) {
|
|
157
|
-
try {
|
|
158
|
-
const labelInputs = (inputConfig?.formInputs || []).filter(input => input.showAsLabel || tempLabels.includes(input.formControlName));
|
|
159
|
-
const cols = [];
|
|
160
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
161
|
-
const colConfigs = {};
|
|
162
|
-
for (let index = 0; index < (labelInputs).length; index++) {
|
|
163
|
-
const c = labelInputs[index];
|
|
164
|
-
const col = { ...c };
|
|
165
|
-
cols.push(`${inputConfig.id}.${col.id}`);
|
|
166
|
-
if (!col.id) {
|
|
167
|
-
continue;
|
|
168
|
-
}
|
|
169
|
-
colConfigs[`${inputConfig.id}.${col.id}`] = {
|
|
170
|
-
property: `${inputConfig.id}.${col.id}`,
|
|
171
|
-
formControlName: col.formControlName,
|
|
172
|
-
label: col.label,
|
|
173
|
-
dataType: getDataType(col),
|
|
174
|
-
pipe: col.pipe
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
//add remove section config
|
|
178
|
-
cols.push('itemRemovalButton');
|
|
179
|
-
colConfigs['itemRemovalButton'] = {
|
|
180
|
-
property: 'itemRemovalButton',
|
|
181
|
-
label: '',
|
|
182
|
-
type: 'removal',
|
|
183
|
-
};
|
|
184
|
-
// end
|
|
185
|
-
return {
|
|
186
|
-
displayedColumnsInOrder: cols.filter((c) => !!c),
|
|
187
|
-
columnsConfig: colConfigs
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
catch (error) {
|
|
191
|
-
const message = error instanceof Error ? error.message : 'Failed to configure columns';
|
|
192
|
-
throw new Error(message);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
function getDataType(input) {
|
|
196
|
-
try {
|
|
197
|
-
if (input.pipe?.pipeType) {
|
|
198
|
-
return input.pipe.pipeType;
|
|
199
|
-
}
|
|
200
|
-
const inputDataType = input.dataType;
|
|
201
|
-
switch (inputDataType) {
|
|
202
|
-
case InputDataTypes.Number:
|
|
203
|
-
return DocumentLitsLabelConfigInterfaceValueType.number;
|
|
204
|
-
case InputDataTypes.Date:
|
|
205
|
-
return DocumentLitsLabelConfigInterfaceValueType.date;
|
|
206
|
-
case InputDataTypes.Array:
|
|
207
|
-
return InputDataTypes.Array;
|
|
208
|
-
case InputDataTypes.Boolean:
|
|
209
|
-
return InputDataTypes.Boolean;
|
|
210
|
-
case InputDataTypes.Object:
|
|
211
|
-
return InputDataTypes.Object;
|
|
212
|
-
default:
|
|
213
|
-
return DocumentLitsLabelConfigInterfaceValueType.string;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
catch (error) {
|
|
217
|
-
const msg = error instanceof Error ? error.message : 'Failed to get data type';
|
|
218
|
-
throw new Error(msg);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Relative-age labels for the table's "opened" column.
|
|
224
|
-
*
|
|
225
|
-
* A long list is edited row by row, and the single question the author keeps asking is *have I
|
|
226
|
-
* already been in this one?* The column answers it in the smallest amount of ink that can:
|
|
227
|
-
* a two-or-three character token in the row, and the full sentence in its tooltip.
|
|
228
|
-
*
|
|
229
|
-
* Pure and Angular-free so the thresholds can be tested directly — the component only supplies
|
|
230
|
-
* the elapsed milliseconds.
|
|
231
|
-
*/
|
|
232
|
-
const SECOND = 1000;
|
|
233
|
-
const MINUTE = 60 * SECOND;
|
|
234
|
-
const HOUR = 60 * MINUTE;
|
|
235
|
-
const DAY = 24 * HOUR;
|
|
236
|
-
const WEEK = 7 * DAY;
|
|
237
|
-
const YEAR = 365 * DAY;
|
|
238
|
-
/**
|
|
239
|
-
* Anything fresher than this reads as "now". A whole minute exactly, so the minutes branch below
|
|
240
|
-
* can never produce a bare `0m` — the first token after "now" is always `1m`.
|
|
241
|
-
*/
|
|
242
|
-
const JUST_NOW = MINUTE;
|
|
243
|
-
/** `1 minute` / `4 minutes` — the tooltip is a sentence, so it agrees in number. */
|
|
244
|
-
function plural(count, unit) {
|
|
245
|
-
return `${count} ${unit}${count === 1 ? '' : 's'} ago`;
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Formats how long ago a row was opened.
|
|
249
|
-
*
|
|
250
|
-
* @param elapsedMs milliseconds since the row was last opened. A negative value (a clock that
|
|
251
|
-
* moved backwards) is treated as zero rather than rendering a future age.
|
|
252
|
-
*
|
|
253
|
-
* @example
|
|
254
|
-
* openedAgo(0); // { short: 'now', long: 'Opened just now' }
|
|
255
|
-
* openedAgo(7 * 60_000); // { short: '7m', long: 'Opened 7 minutes ago' }
|
|
256
|
-
*/
|
|
257
|
-
function openedAgo(elapsedMs) {
|
|
258
|
-
const elapsed = Number.isFinite(elapsedMs) ? Math.max(elapsedMs, 0) : 0;
|
|
259
|
-
if (elapsed < JUST_NOW) {
|
|
260
|
-
return { short: 'now', long: 'Opened just now' };
|
|
261
|
-
}
|
|
262
|
-
if (elapsed < HOUR) {
|
|
263
|
-
const minutes = Math.floor(elapsed / MINUTE);
|
|
264
|
-
return { short: `${minutes}m`, long: `Opened ${plural(minutes, 'minute')}` };
|
|
265
|
-
}
|
|
266
|
-
if (elapsed < DAY) {
|
|
267
|
-
const hours = Math.floor(elapsed / HOUR);
|
|
268
|
-
return { short: `${hours}h`, long: `Opened ${plural(hours, 'hour')}` };
|
|
269
|
-
}
|
|
270
|
-
if (elapsed < WEEK) {
|
|
271
|
-
const days = Math.floor(elapsed / DAY);
|
|
272
|
-
return { short: `${days}d`, long: `Opened ${plural(days, 'day')}` };
|
|
273
|
-
}
|
|
274
|
-
if (elapsed < YEAR) {
|
|
275
|
-
const weeks = Math.floor(elapsed / WEEK);
|
|
276
|
-
return { short: `${weeks}w`, long: `Opened ${plural(weeks, 'week')}` };
|
|
277
|
-
}
|
|
278
|
-
const years = Math.floor(elapsed / YEAR);
|
|
279
|
-
return { short: `${years}y`, long: `Opened ${plural(years, 'year')}` };
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/** Column key `configureCols` appends for the row-actions cell. */
|
|
283
|
-
const ACTIONS_COLUMN = 'itemRemovalButton';
|
|
284
|
-
/**
|
|
285
|
-
* Column key for the leading row-number column. Data columns are always `${parentId}.${inputId}`,
|
|
286
|
-
* so a key with no dot in it can never collide with one.
|
|
287
|
-
*/
|
|
288
|
-
const INDEX_COLUMN = 'mitRowNumber';
|
|
289
|
-
/** Column key for the trailing "last opened" column. Same collision argument as {@link INDEX_COLUMN}. */
|
|
290
|
-
const OPENED_COLUMN = 'mitLastOpened';
|
|
291
|
-
/**
|
|
292
|
-
* How often the relative "opened" labels are re-rendered. Half a minute keeps `now` -> `1m` honest
|
|
293
|
-
* without the table repainting for no reason; the interval only runs once a row has been opened.
|
|
294
|
-
*/
|
|
295
|
-
const OPENED_TICK_MS = 30_000;
|
|
296
|
-
/** Row key marking a calculation (total / average / …) row appended by `getCaluculatedTableData`. */
|
|
297
|
-
const CALCULATION_KEY = 'SYSTEM_KEY_PROPERTY_FOR_MULTIPLE_INPUTS_CALCULATION_FUNCTION';
|
|
298
|
-
/** Row key a host may set to flag the row currently open in the editor. */
|
|
299
|
-
const IN_EDIT_KEY = 'SYSTEM_KEY_IN_EDIT';
|
|
300
|
-
/** Page sizes offered by the paginator. */
|
|
301
|
-
const PAGE_SIZE_OPTIONS = [5, 10, 25, 50];
|
|
302
|
-
/** Rows per page before the user picks otherwise. */
|
|
303
|
-
const DEFAULT_PAGE_SIZE = 10;
|
|
304
|
-
/**
|
|
305
|
-
* The paginator is only worth its space once the rows outgrow the smallest page. Below this the
|
|
306
|
-
* table shows everything and the toolbar count is the whole story.
|
|
307
|
-
*/
|
|
308
|
-
const PAGINATION_THRESHOLD = PAGE_SIZE_OPTIONS[0];
|
|
309
|
-
/** Two-step delete: the row is removed this long after arming unless the user cancels. */
|
|
310
|
-
const DELETE_COUNTDOWN_MS = 3000;
|
|
311
|
-
/**
|
|
312
|
-
* Read-only table of a multiple-input field's rows, with per-row actions.
|
|
313
|
-
*
|
|
314
|
-
* Columns come from the field's `showAsLabel` inner inputs plus any the user toggles on from the
|
|
315
|
-
* toolbar's column chooser. Rows page client-side through the shared `MatTableDataSource`, the
|
|
316
|
-
* actions column stays pinned to the right edge when the table overflows, and the whole table can
|
|
317
|
-
* be opened full screen. Full screen is a full-viewport Material dialog rather than the Fullscreen
|
|
318
|
-
* API: this table's menus, tooltips and the paginator's page-size select all live in the CDK
|
|
319
|
-
* overlay container, which native full screen (and top-layer popovers) would paint over.
|
|
320
|
-
*
|
|
321
|
-
* Two columns are the view's own rather than the field's: a leading row number, pinned to the
|
|
322
|
-
* start so a row keeps its identity while a wide table scrolls, and a trailing "opened" age that
|
|
323
|
-
* appears once the author has opened their first row — in a seventy-row list, knowing which rows
|
|
324
|
-
* you have already been into is most of the navigation problem.
|
|
325
|
-
*
|
|
326
|
-
* Editing, duplicating and deleting are delegated to the parent through outputs — this component
|
|
327
|
-
* owns no row state beyond which rows the author has opened in this session.
|
|
328
|
-
*
|
|
329
|
-
* @example
|
|
330
|
-
* <lib-multiple-input-table-view
|
|
331
|
-
* [inputConfig]="inputConfig()"
|
|
332
|
-
* [dataSource]="dataSource"
|
|
333
|
-
* (onEditItem)="editRow($event)"
|
|
334
|
-
* (onDeleteItem)="removeRow($event)"
|
|
335
|
-
* />
|
|
336
|
-
*/
|
|
337
|
-
class MultipleInputTableViewComponent {
|
|
338
|
-
#destroyRef;
|
|
339
|
-
#dialog;
|
|
340
|
-
#viewContainerRef;
|
|
341
|
-
#injector;
|
|
342
|
-
// ── Columns ─────────────────────────────────────────────────────────────────
|
|
343
|
-
/** Inner inputs the user has switched on from the column chooser, by `formControlName`. */
|
|
344
|
-
#tempLabels;
|
|
345
|
-
#dialogRef;
|
|
346
|
-
constructor() {
|
|
347
|
-
/** The multiple-input field whose rows are shown. Drives columns, permissions and labels. */
|
|
348
|
-
this.inputConfig = input(undefined, ...(ngDevMode ? [{ debugName: "inputConfig" }] : /* istanbul ignore next */ []));
|
|
349
|
-
/** Shared data source; the parent owns its `data`, this view owns its `paginator`. */
|
|
350
|
-
this.dataSource = input(new MatTableDataSource(), ...(ngDevMode ? [{ debugName: "dataSource" }] : /* istanbul ignore next */ []));
|
|
351
|
-
/** Row the parent is currently applying an action to (kept for the parent's bookkeeping). */
|
|
352
|
-
this.applyOptionsTo = input(undefined, ...(ngDevMode ? [{ debugName: "applyOptionsTo" }] : /* istanbul ignore next */ []));
|
|
353
|
-
/** Parent form group, used to spot the row currently open in the editor. */
|
|
354
|
-
this.formGroup = input(null, ...(ngDevMode ? [{ debugName: "formGroup" }] : /* istanbul ignore next */ []));
|
|
355
|
-
/** Emits the id of the row to open in the editor. */
|
|
356
|
-
this.onEditItem = output();
|
|
357
|
-
/** Emits the row to delete once its countdown has run out. */
|
|
358
|
-
this.onDeleteItem = output();
|
|
359
|
-
/** Emits the id of the row to duplicate. */
|
|
360
|
-
this.onCopy = output();
|
|
361
|
-
/** Emits the row whose action menu was opened, so the parent can target it. */
|
|
362
|
-
this.onApplyOptionsTo = output();
|
|
363
|
-
/** Reserved for the parent's label toggle; never emitted by this view. */
|
|
364
|
-
this.showItemAsLabel = output();
|
|
365
|
-
this.#destroyRef = inject(DestroyRef);
|
|
366
|
-
this.#dialog = inject(MatDialog);
|
|
367
|
-
this.#viewContainerRef = inject(ViewContainerRef);
|
|
368
|
-
this.#injector = inject(Injector);
|
|
369
|
-
/** The consumer's localization, handed to `formatData` so a cell follows the organisation. */
|
|
370
|
-
this.l10n = injectFormsLocalization();
|
|
371
|
-
// ── Columns ─────────────────────────────────────────────────────────────────
|
|
372
|
-
/** Inner inputs the user has switched on from the column chooser, by `formControlName`. */
|
|
373
|
-
this.#tempLabels = signal([], ...(ngDevMode ? [{ debugName: "#tempLabels" }] : /* istanbul ignore next */ []));
|
|
374
|
-
this.colConfig = computed(() => {
|
|
375
|
-
const cfg = this.inputConfig();
|
|
376
|
-
if (!cfg) {
|
|
377
|
-
return {
|
|
378
|
-
columnsConfig: {},
|
|
379
|
-
displayedColumnsInOrder: [],
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
return configureCols(cfg, [...this.#tempLabels()]);
|
|
383
|
-
}, ...(ngDevMode ? [{ debugName: "colConfig" }] : /* istanbul ignore next */ []));
|
|
384
|
-
this.columnsConfig = computed(() => this.colConfig().columnsConfig, ...(ngDevMode ? [{ debugName: "columnsConfig" }] : /* istanbul ignore next */ []));
|
|
385
|
-
/**
|
|
386
|
-
* Render order: the row number, then the field's own columns, then — once anything has been
|
|
387
|
-
* opened — the "opened" column immediately before the actions column. Both of those are
|
|
388
|
-
* `stickyEnd`, and Material requires pinned columns to be contiguous at the end.
|
|
389
|
-
*/
|
|
390
|
-
this.displayedColumnsInOrderSig = computed(() => {
|
|
391
|
-
const base = this.colConfig().displayedColumnsInOrder;
|
|
392
|
-
if (!this.anyRowOpened()) {
|
|
393
|
-
return [INDEX_COLUMN, ...base];
|
|
394
|
-
}
|
|
395
|
-
// `configureCols` always appends the actions column last; guard anyway, so a future column
|
|
396
|
-
// order cannot silently break the sticky group.
|
|
397
|
-
const insertAt = base[base.length - 1] === ACTIONS_COLUMN ? base.length - 1 : base.length;
|
|
398
|
-
return [INDEX_COLUMN, ...base.slice(0, insertAt), OPENED_COLUMN, ...base.slice(insertAt)];
|
|
399
|
-
}, ...(ngDevMode ? [{ debugName: "displayedColumnsInOrderSig" }] : /* istanbul ignore next */ []));
|
|
400
|
-
this.allPossibleLabels = computed(() => {
|
|
401
|
-
const cfg = this.inputConfig();
|
|
402
|
-
const displayed = this.displayedColumnsInOrderSig();
|
|
403
|
-
return (cfg?.formInputs?.map((inp) => ({
|
|
404
|
-
label: inp.label,
|
|
405
|
-
selected: displayed.includes(`${cfg?.id}.${inp.id}`),
|
|
406
|
-
formControlName: inp.formControlName,
|
|
407
|
-
})) || []);
|
|
408
|
-
}, ...(ngDevMode ? [{ debugName: "allPossibleLabels" }] : /* istanbul ignore next */ []));
|
|
409
|
-
// ── Permissions ─────────────────────────────────────────────────────────────
|
|
410
|
-
this.userCanEdit = computed(() => {
|
|
411
|
-
const cfg = this.inputConfig();
|
|
412
|
-
if (!cfg)
|
|
413
|
-
return false;
|
|
414
|
-
if (!cfg.multipleInputAvailableOperations)
|
|
415
|
-
return true;
|
|
416
|
-
return cfg.multipleInputAvailableOperations.includes(MultipleInputAvailableOperations.Update);
|
|
417
|
-
}, ...(ngDevMode ? [{ debugName: "userCanEdit" }] : /* istanbul ignore next */ []));
|
|
418
|
-
this.userCanRemove = computed(() => {
|
|
419
|
-
const cfg = this.inputConfig();
|
|
420
|
-
if (!cfg)
|
|
421
|
-
return false;
|
|
422
|
-
if (!cfg.multipleInputAvailableOperations)
|
|
423
|
-
return true;
|
|
424
|
-
return cfg.multipleInputAvailableOperations.includes(MultipleInputAvailableOperations.Remove);
|
|
425
|
-
}, ...(ngDevMode ? [{ debugName: "userCanRemove" }] : /* istanbul ignore next */ []));
|
|
426
|
-
this.userCanAdd = computed(() => {
|
|
427
|
-
const cfg = this.inputConfig();
|
|
428
|
-
if (!cfg)
|
|
429
|
-
return false;
|
|
430
|
-
if (!cfg.multipleInputAvailableOperations)
|
|
431
|
-
return true;
|
|
432
|
-
return cfg.multipleInputAvailableOperations.includes(MultipleInputAvailableOperations.Add);
|
|
433
|
-
}, ...(ngDevMode ? [{ debugName: "userCanAdd" }] : /* istanbul ignore next */ []));
|
|
434
|
-
this.userCanApplyOptionsTo = computed(() => {
|
|
435
|
-
return this.userCanEdit() || this.userCanRemove() || this.userCanAdd();
|
|
436
|
-
}, ...(ngDevMode ? [{ debugName: "userCanApplyOptionsTo" }] : /* istanbul ignore next */ []));
|
|
437
|
-
/** A read-only or disabled field shows its rows but offers no actions at all. */
|
|
438
|
-
this.isEditable = computed(() => {
|
|
439
|
-
const cfg = this.inputConfig();
|
|
440
|
-
return !!cfg && !cfg.readonly && !cfg.disabled;
|
|
441
|
-
}, ...(ngDevMode ? [{ debugName: "isEditable" }] : /* istanbul ignore next */ []));
|
|
442
|
-
this.showRowActions = computed(() => this.isEditable() && this.userCanApplyOptionsTo(), ...(ngDevMode ? [{ debugName: "showRowActions" }] : /* istanbul ignore next */ []));
|
|
443
|
-
/** Edit is the everyday action, so it gets its own button instead of hiding in the menu. */
|
|
444
|
-
this.showRowEdit = computed(() => this.isEditable() && this.userCanEdit(), ...(ngDevMode ? [{ debugName: "showRowEdit" }] : /* istanbul ignore next */ []));
|
|
445
|
-
/** The overflow menu holds duplicate and delete; it is dropped when neither is allowed. */
|
|
446
|
-
this.showRowMenu = computed(() => this.isEditable() && (this.userCanAdd() || this.userCanRemove()), ...(ngDevMode ? [{ debugName: "showRowMenu" }] : /* istanbul ignore next */ []));
|
|
447
|
-
// ── Pagination ──────────────────────────────────────────────────────────────
|
|
448
|
-
this.pageSizeOptions = PAGE_SIZE_OPTIONS;
|
|
449
|
-
this.pageIndex = signal(0, ...(ngDevMode ? [{ debugName: "pageIndex" }] : /* istanbul ignore next */ []));
|
|
450
|
-
this.pageSize = signal(DEFAULT_PAGE_SIZE, ...(ngDevMode ? [{ debugName: "pageSize" }] : /* istanbul ignore next */ []));
|
|
451
|
-
/**
|
|
452
|
-
* The live paginator. It is re-created when the table moves between its inline slot and the
|
|
453
|
-
* full-screen dialog, so it is read reactively rather than captured once.
|
|
454
|
-
*/
|
|
455
|
-
this.paginator = viewChild(MatPaginator, ...(ngDevMode ? [{ debugName: "paginator" }] : /* istanbul ignore next */ []));
|
|
456
|
-
// ── Full screen ─────────────────────────────────────────────────────────────
|
|
457
|
-
this.fullscreen = signal(false, ...(ngDevMode ? [{ debugName: "fullscreen" }] : /* istanbul ignore next */ []));
|
|
458
|
-
/**
|
|
459
|
-
* Height the inline slot keeps while the table is in the dialog, so the surrounding form does not
|
|
460
|
-
* collapse and the page does not jump when full screen is left.
|
|
461
|
-
*/
|
|
462
|
-
this.reservedHeight = signal(null, ...(ngDevMode ? [{ debugName: "reservedHeight" }] : /* istanbul ignore next */ []));
|
|
463
|
-
this.shellTemplate = viewChild('shell', ...(ngDevMode ? [{ debugName: "shellTemplate" }] : /* istanbul ignore next */ []));
|
|
464
|
-
this.inlineHost = viewChild('inlineHost', ...(ngDevMode ? [{ debugName: "inlineHost" }] : /* istanbul ignore next */ []));
|
|
465
|
-
// `read: ElementRef` — the ref sits on a `mat-icon-button`, which would otherwise resolve to
|
|
466
|
-
// the button component rather than its element.
|
|
467
|
-
this.fullscreenToggle = viewChild('fullscreenToggle', { ...(ngDevMode ? { debugName: "fullscreenToggle" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
468
|
-
// ── Refresh ─────────────────────────────────────────────────────────────────
|
|
469
|
-
/**
|
|
470
|
-
* The host may offer a reload of the field's data. It used to hang off the form field as a
|
|
471
|
-
* `matSuffix`, which both floated it away from the table it refreshes and stole the width the
|
|
472
|
-
* table needed; it belongs with the table's own chrome.
|
|
473
|
-
*/
|
|
474
|
-
this.canReload = computed(() => !!this.inputConfig()?.canReload?.canReload, ...(ngDevMode ? [{ debugName: "canReload" }] : /* istanbul ignore next */ []));
|
|
475
|
-
// ── "Opened" tracking ───────────────────────────────────────────────────────
|
|
476
|
-
/*
|
|
477
|
-
* A long list is edited row by row, and the question the author keeps asking is "have I already
|
|
478
|
-
* been in this one?". Every open stamps the row, and the column reports the age of that stamp.
|
|
479
|
-
*
|
|
480
|
-
* In memory, deliberately: LIB-05 forbids the library reaching for `localStorage`, and the state
|
|
481
|
-
* answers a question about THIS editing session anyway. It costs one Map and one interval.
|
|
482
|
-
*/
|
|
483
|
-
/** When each row was last opened, by row id. */
|
|
484
|
-
this.#openedAt = signal(new Map(), ...(ngDevMode ? [{ debugName: "#openedAt" }] : /* istanbul ignore next */ []));
|
|
485
|
-
/** The clock the relative labels render against. Ticks only while something has been opened. */
|
|
486
|
-
this.#nowMs = signal(Date.now(), ...(ngDevMode ? [{ debugName: "#nowMs" }] : /* istanbul ignore next */ []));
|
|
487
|
-
/** The column materialises on the first open, so an untouched table carries no extra ink. */
|
|
488
|
-
this.anyRowOpened = computed(() => this.#openedAt().size > 0, ...(ngDevMode ? [{ debugName: "anyRowOpened" }] : /* istanbul ignore next */ []));
|
|
489
|
-
// ── Two-step delete ─────────────────────────────────────────────────────────
|
|
490
|
-
this.#armedDeletions = {};
|
|
491
|
-
this.#deletionTimers = {};
|
|
492
|
-
this.#countDownDate = new Date();
|
|
493
|
-
// ── Structured-value popover ────────────────────────────────────────────────
|
|
494
|
-
this.overlayOpen = signal(false, ...(ngDevMode ? [{ debugName: "overlayOpen" }] : /* istanbul ignore next */ []));
|
|
495
|
-
this.overlayData = signal(null, ...(ngDevMode ? [{ debugName: "overlayData" }] : /* istanbul ignore next */ []));
|
|
496
|
-
this.overlayOrigin = signal(null, ...(ngDevMode ? [{ debugName: "overlayOrigin" }] : /* istanbul ignore next */ []));
|
|
497
|
-
// The data source pages whatever paginator is currently rendered — inline, in the dialog, or
|
|
498
|
-
// none while the rows fit on one page.
|
|
499
|
-
effect(() => {
|
|
500
|
-
const ds = this.dataSource();
|
|
501
|
-
const paginator = this.paginator() ?? null;
|
|
502
|
-
if (ds && ds.paginator !== paginator) {
|
|
503
|
-
ds.paginator = paginator;
|
|
504
|
-
}
|
|
505
|
-
});
|
|
506
|
-
}
|
|
507
|
-
ngOnDestroy() {
|
|
508
|
-
// An armed delete must not fire from a component that no longer exists.
|
|
509
|
-
for (const handle of Object.values(this.#deletionTimers)) {
|
|
510
|
-
clearTimeout(handle);
|
|
511
|
-
}
|
|
512
|
-
this.#deletionTimers = {};
|
|
513
|
-
if (this.#openedTicker !== undefined) {
|
|
514
|
-
clearInterval(this.#openedTicker);
|
|
515
|
-
this.#openedTicker = undefined;
|
|
516
|
-
}
|
|
517
|
-
this.#dialogRef?.close();
|
|
518
|
-
}
|
|
519
|
-
// ── Column helpers (template) ───────────────────────────────────────────────
|
|
520
|
-
isActionsColumn(col) {
|
|
521
|
-
return col === ACTIONS_COLUMN;
|
|
522
|
-
}
|
|
523
|
-
isIndexColumn(col) {
|
|
524
|
-
return col === INDEX_COLUMN;
|
|
525
|
-
}
|
|
526
|
-
isOpenedColumn(col) {
|
|
527
|
-
return col === OPENED_COLUMN;
|
|
528
|
-
}
|
|
529
|
-
columnLabel(col) {
|
|
530
|
-
if (this.isActionsColumn(col)) {
|
|
531
|
-
return this.showRowActions() ? 'Actions' : '';
|
|
532
|
-
}
|
|
533
|
-
if (this.isOpenedColumn(col)) {
|
|
534
|
-
return 'Opened';
|
|
535
|
-
}
|
|
536
|
-
return this.columnsConfig()[col]?.label ?? '';
|
|
537
|
-
}
|
|
538
|
-
columnDataType(col) {
|
|
539
|
-
return this.columnsConfig()[col]?.dataType;
|
|
540
|
-
}
|
|
541
|
-
/** The sub-column's number pipe, so a cell rounds and formats at the precision it is stored at. */
|
|
542
|
-
columnPipe(col) {
|
|
543
|
-
return this.columnsConfig()[col]?.pipe;
|
|
544
|
-
}
|
|
545
|
-
isNumericColumn(col) {
|
|
546
|
-
const type = this.columnDataType(col);
|
|
547
|
-
return type === 'number' || type === 'currency' || type === 'percent';
|
|
548
|
-
}
|
|
549
|
-
isStructuredColumn(col) {
|
|
550
|
-
const type = this.columnDataType(col);
|
|
551
|
-
return type === 'array' || type === 'object';
|
|
552
|
-
}
|
|
553
|
-
// ── Row helpers (template) ──────────────────────────────────────────────────
|
|
554
|
-
isCalculationRow(row) {
|
|
555
|
-
return !!row[CALCULATION_KEY];
|
|
556
|
-
}
|
|
557
|
-
rowIsFlaggedInEdit(row) {
|
|
558
|
-
return !!row[IN_EDIT_KEY];
|
|
559
|
-
}
|
|
560
|
-
rowHasActions(row) {
|
|
561
|
-
// `row[''] !== 'true'` is a legacy host marker for rows that must not be acted on.
|
|
562
|
-
return this.showRowActions() && !this.isCalculationRow(row) && row[''] !== 'true';
|
|
563
|
-
}
|
|
564
|
-
/** A calculation row is labelled unless it is the one the editor currently has open. */
|
|
565
|
-
showsCalculationLabel(row) {
|
|
566
|
-
if (!this.isCalculationRow(row))
|
|
567
|
-
return false;
|
|
568
|
-
const inEditId = this.inputConfig()?.multipleInputInEditId;
|
|
569
|
-
return inEditId ? inEditId !== row['id'] : !row['id'];
|
|
570
|
-
}
|
|
571
|
-
/**
|
|
572
|
-
* The row's position in the whole list rather than in the page: the page offset plus the index
|
|
573
|
-
* Material hands the cell. A calculation row is a total, not an entry, so it carries no number.
|
|
574
|
-
*/
|
|
575
|
-
rowNumber(row, indexInPage) {
|
|
576
|
-
if (this.isCalculationRow(row)) {
|
|
577
|
-
return '';
|
|
578
|
-
}
|
|
579
|
-
// Without a paginator every row is rendered, and a stale `pageIndex` from a larger data set
|
|
580
|
-
// would otherwise offset the numbering.
|
|
581
|
-
const offset = this.showPaginator() ? this.pageIndex() * this.pageSize() : 0;
|
|
582
|
-
return String(offset + indexInPage + 1);
|
|
583
|
-
}
|
|
584
|
-
totalRows() {
|
|
585
|
-
return this.dataSource()?.data.length ?? 0;
|
|
586
|
-
}
|
|
587
|
-
isEmpty() {
|
|
588
|
-
return this.totalRows() === 0;
|
|
589
|
-
}
|
|
590
|
-
showPaginator() {
|
|
591
|
-
return this.totalRows() > PAGINATION_THRESHOLD;
|
|
592
|
-
}
|
|
593
|
-
/** "3 items" — calculation rows are totals, not items, so they are left out of the count. */
|
|
594
|
-
rowSummary() {
|
|
595
|
-
const count = (this.dataSource()?.data ?? []).filter((row) => !this.isCalculationRow(row)).length;
|
|
596
|
-
return `${count} ${count === 1 ? 'item' : 'items'}`;
|
|
597
|
-
}
|
|
598
|
-
reload() {
|
|
599
|
-
this.inputConfig()?.canReload?.emit();
|
|
600
|
-
}
|
|
601
|
-
// ── "Opened" tracking ───────────────────────────────────────────────────────
|
|
602
|
-
/*
|
|
603
|
-
* A long list is edited row by row, and the question the author keeps asking is "have I already
|
|
604
|
-
* been in this one?". Every open stamps the row, and the column reports the age of that stamp.
|
|
605
|
-
*
|
|
606
|
-
* In memory, deliberately: LIB-05 forbids the library reaching for `localStorage`, and the state
|
|
607
|
-
* answers a question about THIS editing session anyway. It costs one Map and one interval.
|
|
608
|
-
*/
|
|
609
|
-
/** When each row was last opened, by row id. */
|
|
610
|
-
#openedAt;
|
|
611
|
-
/** The clock the relative labels render against. Ticks only while something has been opened. */
|
|
612
|
-
#nowMs;
|
|
613
|
-
#openedTicker;
|
|
614
|
-
/** Column token for a row that has been opened, `''` for one that has not. */
|
|
615
|
-
openedShort(row) {
|
|
616
|
-
const at = this.#openedAtFor(row);
|
|
617
|
-
return at === undefined ? '' : openedAgo(this.#nowMs() - at).short;
|
|
618
|
-
}
|
|
619
|
-
/** The same age as a sentence, for the cell's tooltip. */
|
|
620
|
-
openedLong(row) {
|
|
621
|
-
const at = this.#openedAtFor(row);
|
|
622
|
-
return at === undefined ? '' : openedAgo(this.#nowMs() - at).long;
|
|
623
|
-
}
|
|
624
|
-
#openedAtFor(row) {
|
|
625
|
-
const id = this.#rowId(row);
|
|
626
|
-
return id ? this.#openedAt().get(id) : undefined;
|
|
627
|
-
}
|
|
628
|
-
/**
|
|
629
|
-
* Stamps a row as opened. Every open re-stamps it, so the column reads as "what I touched last"
|
|
630
|
-
* rather than "what I touched first".
|
|
631
|
-
*/
|
|
632
|
-
#markOpened(row) {
|
|
633
|
-
const id = this.#rowId(row);
|
|
634
|
-
if (!id) {
|
|
635
|
-
return;
|
|
636
|
-
}
|
|
637
|
-
const next = new Map(this.#openedAt());
|
|
638
|
-
next.set(id, Date.now());
|
|
639
|
-
this.#openedAt.set(next);
|
|
640
|
-
this.#startOpenedTicker();
|
|
641
|
-
}
|
|
642
|
-
/** One interval for the whole table, started on the first open and stopped with the component. */
|
|
643
|
-
#startOpenedTicker() {
|
|
644
|
-
if (this.#openedTicker !== undefined) {
|
|
645
|
-
return;
|
|
646
|
-
}
|
|
647
|
-
this.#nowMs.set(Date.now());
|
|
648
|
-
this.#openedTicker = setInterval(() => this.#nowMs.set(Date.now()), OPENED_TICK_MS);
|
|
649
|
-
}
|
|
650
|
-
onPage(event) {
|
|
651
|
-
this.pageIndex.set(event.pageIndex);
|
|
652
|
-
this.pageSize.set(event.pageSize);
|
|
653
|
-
}
|
|
654
|
-
// ── Full screen ─────────────────────────────────────────────────────────────
|
|
655
|
-
toggleFullscreen() {
|
|
656
|
-
if (this.fullscreen()) {
|
|
657
|
-
this.#dialogRef?.close();
|
|
658
|
-
return;
|
|
659
|
-
}
|
|
660
|
-
const shell = this.shellTemplate();
|
|
661
|
-
if (!shell)
|
|
662
|
-
return;
|
|
663
|
-
this.reservedHeight.set(this.inlineHost()?.nativeElement.offsetHeight ?? null);
|
|
664
|
-
this.fullscreen.set(true);
|
|
665
|
-
const label = this.inputConfig()?.label;
|
|
666
|
-
const ref = this.#dialog.open(shell, {
|
|
667
|
-
viewContainerRef: this.#viewContainerRef,
|
|
668
|
-
width: 'calc(100vw - 3rem)',
|
|
669
|
-
height: 'calc(100vh - 3rem)',
|
|
670
|
-
maxWidth: '100vw',
|
|
671
|
-
maxHeight: '100vh',
|
|
672
|
-
panelClass: 'lib-multiple-input-table-view__dialog',
|
|
673
|
-
ariaLabel: label ? `${label} full screen` : 'Table full screen',
|
|
674
|
-
autoFocus: 'dialog',
|
|
675
|
-
// The inline toggle is re-created after the dialog closes, so focus is restored by hand.
|
|
676
|
-
restoreFocus: false,
|
|
677
|
-
});
|
|
678
|
-
this.#dialogRef = ref;
|
|
679
|
-
ref
|
|
680
|
-
.afterClosed()
|
|
681
|
-
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
682
|
-
.subscribe(() => {
|
|
683
|
-
if (this.#dialogRef === ref)
|
|
684
|
-
this.#dialogRef = undefined;
|
|
685
|
-
this.fullscreen.set(false);
|
|
686
|
-
this.reservedHeight.set(null);
|
|
687
|
-
afterNextRender(() => this.fullscreenToggle()?.nativeElement.focus({ preventScroll: true }), { injector: this.#injector });
|
|
688
|
-
});
|
|
689
|
-
}
|
|
690
|
-
/** The editor opens in the form behind the dialog, so leave full screen before handing over. */
|
|
691
|
-
#leaveFullscreen() {
|
|
692
|
-
this.#dialogRef?.close();
|
|
693
|
-
}
|
|
694
|
-
// ── Actions ─────────────────────────────────────────────────────────────────
|
|
695
|
-
#rowId(row) {
|
|
696
|
-
return row[`${this.inputConfig()?.id}.id`];
|
|
697
|
-
}
|
|
698
|
-
applyOptionsToFn(item) {
|
|
699
|
-
this.onApplyOptionsTo.emit(item);
|
|
700
|
-
}
|
|
701
|
-
editItem(row) {
|
|
702
|
-
this.#markOpened(row);
|
|
703
|
-
this.#leaveFullscreen();
|
|
704
|
-
this.onEditItem.emit(this.#rowId(row));
|
|
705
|
-
}
|
|
706
|
-
copy(row) {
|
|
707
|
-
this.#leaveFullscreen();
|
|
708
|
-
this.onCopy.emit(this.#rowId(row));
|
|
709
|
-
}
|
|
710
|
-
// ── Two-step delete ─────────────────────────────────────────────────────────
|
|
711
|
-
#armedDeletions;
|
|
712
|
-
#deletionTimers;
|
|
713
|
-
#countDownDate;
|
|
714
|
-
isAboutToDeleteRow(row) {
|
|
715
|
-
return !!this.#armedDeletions[this.#rowId(row)];
|
|
716
|
-
}
|
|
717
|
-
getCountdownSeconds() {
|
|
718
|
-
const now = new Date();
|
|
719
|
-
const timeElapsed = (now.getTime() - this.#countDownDate.getTime()) / 1000;
|
|
720
|
-
return Math.min(Math.round((timeElapsed / (DELETE_COUNTDOWN_MS / 1000)) * 100), 100);
|
|
721
|
-
}
|
|
722
|
-
secondsCountDown() {
|
|
723
|
-
const total = DELETE_COUNTDOWN_MS / 1000;
|
|
724
|
-
return (total - (this.getCountdownSeconds() / 100) * total).toFixed(1);
|
|
725
|
-
}
|
|
726
|
-
multipleInputRemoveItem(event, row) {
|
|
727
|
-
const rowId = this.#rowId(row);
|
|
728
|
-
if (this.#armedDeletions[rowId]) {
|
|
729
|
-
const handle = this.#deletionTimers[rowId];
|
|
730
|
-
if (handle) {
|
|
731
|
-
clearTimeout(handle);
|
|
732
|
-
delete this.#deletionTimers[rowId];
|
|
733
|
-
}
|
|
734
|
-
delete this.#armedDeletions[rowId];
|
|
735
|
-
}
|
|
736
|
-
else {
|
|
737
|
-
this.#armedDeletions[rowId] = true;
|
|
738
|
-
this.#countDownDate = new Date();
|
|
739
|
-
this.#deletionTimers[rowId] = setTimeout(() => {
|
|
740
|
-
if (this.#armedDeletions[rowId]) {
|
|
741
|
-
this.onDeleteItem.emit(row);
|
|
742
|
-
delete this.#armedDeletions[rowId];
|
|
743
|
-
delete this.#deletionTimers[rowId];
|
|
744
|
-
}
|
|
745
|
-
}, DELETE_COUNTDOWN_MS);
|
|
746
|
-
}
|
|
747
|
-
event.preventDefault();
|
|
748
|
-
event.stopPropagation();
|
|
749
|
-
}
|
|
750
|
-
// ── Cell presentation ───────────────────────────────────────────────────────
|
|
751
|
-
returnBackground(row, columnsConfig) {
|
|
752
|
-
let background = '';
|
|
753
|
-
const ds = this.dataSource();
|
|
754
|
-
if (ds
|
|
755
|
-
? ds.data.length > 1
|
|
756
|
-
? columnsConfig?.['colorScale']
|
|
757
|
-
: false
|
|
758
|
-
: false) {
|
|
759
|
-
const inputCfg = this.inputConfig();
|
|
760
|
-
const colKey = columnsConfig?.['key'] ?? '';
|
|
761
|
-
const point = Number(row[colKey]);
|
|
762
|
-
const inputIsGrouped = inputCfg.groupBy;
|
|
763
|
-
const groupKey = inputCfg.groupBy?.[0] || '';
|
|
764
|
-
const dataSet = inputIsGrouped
|
|
765
|
-
? ds?.data.filter((s) => s[groupKey] === row[groupKey])
|
|
766
|
-
: new Array(ds?.data || []);
|
|
767
|
-
const arrayValues = dataSet?.map((vr) => Number(vr[colKey])) || [];
|
|
768
|
-
const max = Math.max(...arrayValues);
|
|
769
|
-
const min = Math.min(...arrayValues);
|
|
770
|
-
const hasNun = isNaN(max) || isNaN(min);
|
|
771
|
-
if (!hasNun && Number(max) !== Number(min)) {
|
|
772
|
-
const colorScale = new ColorScale(min, max, ['#2fdf75', '#FFA500', '#ff4961'], 0.8);
|
|
773
|
-
const color = colorScale.getColor(point)?.toRGBAString();
|
|
774
|
-
background = color ?? '';
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
return background;
|
|
778
|
-
}
|
|
779
|
-
hasTopBorder(row) {
|
|
780
|
-
const inputCfg = this.inputConfig();
|
|
781
|
-
const inputIsGrouped = inputCfg?.groupBy;
|
|
782
|
-
const ds = this.dataSource();
|
|
783
|
-
if (inputIsGrouped && ds) {
|
|
784
|
-
const indexOfRow = ds.data.indexOf(row);
|
|
785
|
-
const rowIsFirstInTable = indexOfRow === 0;
|
|
786
|
-
if (!inputCfg.groupBy) {
|
|
787
|
-
return false;
|
|
788
|
-
}
|
|
789
|
-
const groupKey = inputCfg.groupBy?.[0] ?? '';
|
|
790
|
-
const isFirstInGroup = rowIsFirstInTable
|
|
791
|
-
? true
|
|
792
|
-
: ds.data[indexOfRow - 1][groupKey] !==
|
|
793
|
-
row[groupKey];
|
|
794
|
-
return isFirstInGroup;
|
|
795
|
-
}
|
|
796
|
-
else {
|
|
797
|
-
return false;
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
getCalculationFunction(row) {
|
|
801
|
-
const func = row[CALCULATION_KEY];
|
|
802
|
-
switch (func) {
|
|
803
|
-
case CalculationFunctions.Sum:
|
|
804
|
-
return 'TOTAL';
|
|
805
|
-
case CalculationFunctions.Avg:
|
|
806
|
-
return 'AVERAGE';
|
|
807
|
-
case CalculationFunctions.Max:
|
|
808
|
-
return 'MAX';
|
|
809
|
-
case CalculationFunctions.Min:
|
|
810
|
-
return 'MIN';
|
|
811
|
-
default:
|
|
812
|
-
return func;
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
// ── Column chooser ──────────────────────────────────────────────────────────
|
|
816
|
-
toggleTempLabel(event, label) {
|
|
817
|
-
this.#tempLabels.update((labels) => labels.includes(label) ? labels.filter((l) => l !== label) : [...labels, label]);
|
|
818
|
-
// Keep the menu open so several columns can be toggled in one go.
|
|
819
|
-
event.stopPropagation();
|
|
820
|
-
event.preventDefault();
|
|
821
|
-
}
|
|
822
|
-
/** Column keys in display order — the removal column is always last. */
|
|
823
|
-
get displayedColumnsInOrder() {
|
|
824
|
-
return this.displayedColumnsInOrderSig();
|
|
825
|
-
}
|
|
826
|
-
rowIsInEdit(row) {
|
|
827
|
-
const cfg = this.inputConfig();
|
|
828
|
-
const fg = this.formGroup();
|
|
829
|
-
return (!!cfg?.formIsOpen &&
|
|
830
|
-
fg?.controls[`${cfg?.id}.id`]?.value === row[`${cfg?.id}.id`]);
|
|
831
|
-
}
|
|
832
|
-
openDataOverlay(event, data) {
|
|
833
|
-
event.stopPropagation();
|
|
834
|
-
this.overlayOrigin.set(event.currentTarget);
|
|
835
|
-
this.overlayData.set(data);
|
|
836
|
-
this.overlayOpen.set(true);
|
|
837
|
-
}
|
|
838
|
-
closeDataOverlay() {
|
|
839
|
-
this.overlayOpen.set(false);
|
|
840
|
-
this.overlayData.set(null);
|
|
841
|
-
this.overlayOrigin.set(null);
|
|
842
|
-
}
|
|
843
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: MultipleInputTableViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
844
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: MultipleInputTableViewComponent, isStandalone: true, selector: "lib-multiple-input-table-view", inputs: { inputConfig: { classPropertyName: "inputConfig", publicName: "inputConfig", isSignal: true, isRequired: false, transformFunction: null }, dataSource: { classPropertyName: "dataSource", publicName: "dataSource", isSignal: true, isRequired: false, transformFunction: null }, applyOptionsTo: { classPropertyName: "applyOptionsTo", publicName: "applyOptionsTo", isSignal: true, isRequired: false, transformFunction: null }, formGroup: { classPropertyName: "formGroup", publicName: "formGroup", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onEditItem: "onEditItem", onDeleteItem: "onDeleteItem", onCopy: "onCopy", onApplyOptionsTo: "onApplyOptionsTo", showItemAsLabel: "showItemAsLabel" }, host: { properties: { "class.lib-multiple-input-table-view--fullscreen": "fullscreen()" }, classAttribute: "lib-multiple-input-table-view" }, viewQueries: [{ propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true, isSignal: true }, { propertyName: "shellTemplate", first: true, predicate: ["shell"], descendants: true, isSignal: true }, { propertyName: "inlineHost", first: true, predicate: ["inlineHost"], descendants: true, isSignal: true }, { propertyName: "fullscreenToggle", first: true, predicate: ["fullscreenToggle"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: "@defer (on viewport) {\n <!--\n The table shell is a template so the same markup renders in two places: inline in the form,\n or inside the full-screen dialog. Only one instance exists at a time \u2014 the inline slot empties\n while the dialog is open \u2014 so the shared data source always pages through a single paginator.\n -->\n <ng-template #shell>\n <section class=\"mit-shell\" [class.mit-shell--fullscreen]=\"fullscreen()\">\n <header class=\"mit-toolbar\">\n <div class=\"mit-toolbar__lead\">\n @if (fullscreen()) {\n <h2 class=\"mit-toolbar__title\">{{ inputConfig()?.label }}</h2>\n }\n <span class=\"mit-toolbar__summary\">{{ rowSummary() }}</span>\n </div>\n <div class=\"mit-toolbar__actions\">\n @if (canReload()) {\n <button\n type=\"button\"\n mat-icon-button\n class=\"mit-icon-button mit-reload\"\n matTooltip=\"Refresh this list\"\n aria-label=\"Refresh this list\"\n (click)=\"reload()\"\n >\n <mat-icon>sync</mat-icon>\n </button>\n }\n @if (allPossibleLabels().length > 0) {\n <button\n type=\"button\"\n mat-icon-button\n class=\"mit-icon-button mit-columns-trigger\"\n matTooltip=\"Choose columns\"\n aria-label=\"Choose columns\"\n [matMenuTriggerFor]=\"colOptions\"\n >\n <mat-icon>view_column</mat-icon>\n </button>\n }\n <button\n #fullscreenToggle\n type=\"button\"\n mat-icon-button\n class=\"mit-icon-button mit-fullscreen-toggle\"\n [matTooltip]=\"fullscreen() ? 'Exit full screen' : 'Full screen'\"\n [attr.aria-label]=\"fullscreen() ? 'Exit full screen' : 'Full screen'\"\n [attr.aria-pressed]=\"fullscreen()\"\n (click)=\"toggleFullscreen()\"\n >\n <mat-icon>{{ fullscreen() ? 'fullscreen_exit' : 'fullscreen' }}</mat-icon>\n </button>\n </div>\n </header>\n\n @if (displayedColumnsInOrder.length === 0) {\n <div class=\"mit-state\">No columns</div>\n }\n\n <div class=\"mit-scroll\">\n <table mat-table [dataSource]=\"dataSource() ?? []\" class=\"mit-table\">\n @for (col of displayedColumnsInOrder; track col) {\n <!--\n The row number is pinned to the start and the \"opened\" age and actions to the end, so\n a row keeps its identity and stays actionable however far a wide table is scrolled.\n Material needs each pinned group contiguous at its edge, which is why the \"opened\"\n column is inserted before the actions column rather than appended after it.\n -->\n <ng-container\n [matColumnDef]=\"col\"\n [sticky]=\"isIndexColumn(col)\"\n [stickyEnd]=\"isActionsColumn(col) || isOpenedColumn(col)\"\n >\n <th\n mat-header-cell\n *matHeaderCellDef\n scope=\"col\"\n [attr.aria-label]=\"isIndexColumn(col) ? 'Row number' : null\"\n [class.mit-th--index]=\"isIndexColumn(col)\"\n [class.mit-th--opened]=\"isOpenedColumn(col)\"\n [class.mit-th--numeric]=\"isNumericColumn(col)\"\n [class.mit-th--actions]=\"isActionsColumn(col)\"\n >\n @if (isIndexColumn(col)) {\n <span class=\"mit-th-hash\" aria-hidden=\"true\">#</span>\n } @else {\n <span class=\"mit-th-label\">{{ columnLabel(col) }}</span>\n }\n </th>\n <td\n mat-cell\n *matCellDef=\"let row; let rowIndex = index\"\n [class.mit-td--calc]=\"isCalculationRow(row)\"\n [class.mit-td--index]=\"isIndexColumn(col)\"\n [class.mit-td--opened]=\"isOpenedColumn(col)\"\n [class.mit-td--actions]=\"isActionsColumn(col)\"\n [class.mit-td--numeric]=\"isNumericColumn(col)\"\n [style.background]=\"returnBackground(row, columnsConfig()[col])\"\n >\n @if (isIndexColumn(col)) {\n <span class=\"mit-index\">{{ rowNumber(row, rowIndex) }}</span>\n } @else if (isOpenedColumn(col)) {\n <!-- Blank for a row nobody has been into: the column is a record of what the\n author touched, so an empty cell is the honest reading of \"not yet\". -->\n @let opened = openedShort(row);\n @if (opened) {\n <span class=\"mit-opened\" [matTooltip]=\"openedLong(row)\">{{ opened }}</span>\n }\n } @else if (isActionsColumn(col)) {\n <div class=\"mit-actions\">\n @if (showsCalculationLabel(row)) {\n <span class=\"mit-calc-label\">{{ getCalculationFunction(row) }}</span>\n }\n @if (rowIsFlaggedInEdit(row)) {\n <mat-chip class=\"mit-chip\">In {{ inputConfig()?.readonly ? 'View' : 'Edit' }}</mat-chip>\n }\n @if (rowHasActions(row)) {\n @if (showRowEdit()) {\n <button\n type=\"button\"\n mat-icon-button\n class=\"mit-icon-button mit-row-edit\"\n [class.mit-icon-button--active]=\"rowIsInEdit(row)\"\n matTooltip=\"Edit\"\n aria-label=\"Edit row\"\n (click)=\"editItem(row)\"\n >\n <mat-icon>edit</mat-icon>\n </button>\n }\n @if (showRowMenu()) {\n <button\n type=\"button\"\n mat-icon-button\n class=\"mit-icon-button mit-row-trigger\"\n [class.mit-icon-button--active]=\"t.menuOpen\"\n matTooltip=\"More actions\"\n aria-label=\"More row actions\"\n [matMenuTriggerFor]=\"rowOptions\"\n [matMenuTriggerData]=\"{ row: row }\"\n #t=\"matMenuTrigger\"\n (click)=\"applyOptionsToFn(row)\"\n >\n <mat-icon>{{ t.menuOpen ? 'close' : 'more_horiz' }}</mat-icon>\n </button>\n }\n }\n </div>\n } @else if (isStructuredColumn(col)) {\n <button\n type=\"button\"\n mat-icon-button\n class=\"mit-icon-button mit-data-button\"\n matTooltip=\"View data\"\n aria-label=\"View data\"\n (click)=\"openDataOverlay($event, row[col])\"\n >\n <mat-icon>data_object</mat-icon>\n </button>\n } @else {\n @let text = row[col] | formatData: columnDataType(col) : columnPipe(col) : l10n();\n <span class=\"mit-cell-text\" [attr.title]=\"text\">{{ text }}</span>\n }\n </td>\n </ng-container>\n }\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumnsInOrder; sticky: true\"></tr>\n <tr\n mat-row\n *matRowDef=\"let row; columns: displayedColumnsInOrder\"\n class=\"mit-row\"\n [class.mit-row--group-start]=\"hasTopBorder(row)\"\n [class.mit-row--calc]=\"isCalculationRow(row)\"\n [class.mit-row--in-edit]=\"rowIsInEdit(row)\"\n ></tr>\n </table>\n\n @if (isEmpty()) {\n <div class=\"mit-empty\">\n <strong class=\"mit-empty-title\">No items yet</strong>\n <p class=\"mit-empty-text\">\n Use the add button below to create a row. Each saved entry appears here.\n </p>\n </div>\n }\n </div>\n\n @if (showPaginator()) {\n <mat-paginator\n class=\"mit-paginator\"\n [pageIndex]=\"pageIndex()\"\n [pageSize]=\"pageSize()\"\n [pageSizeOptions]=\"pageSizeOptions\"\n showFirstLastButtons\n aria-label=\"Table pagination\"\n (page)=\"onPage($event)\"\n />\n }\n </section>\n </ng-template>\n\n <div class=\"mit-inline\" #inlineHost [style.min-height.px]=\"reservedHeight()\">\n @if (!fullscreen()) {\n <ng-container [ngTemplateOutlet]=\"shell\" />\n }\n </div>\n} @placeholder {\n <div class=\"mit-placeholder\">\n <mat-spinner diameter=\"32\" />\n </div>\n}\n\n<!--\n Structured (array / object) cell values open in a CDK overlay anchored to the button that was\n clicked. An overlay, rather than a fixed-position panel, so it stacks correctly above the\n full-screen dialog and is never clipped by a transformed ancestor.\n-->\n@if (overlayOrigin(); as origin) {\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"origin\"\n [cdkConnectedOverlayOpen]=\"overlayOpen()\"\n [cdkConnectedOverlayHasBackdrop]=\"true\"\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n [cdkConnectedOverlayPush]=\"true\"\n (backdropClick)=\"closeDataOverlay()\"\n (detach)=\"closeDataOverlay()\"\n >\n <div class=\"mit-data-panel\" role=\"dialog\" aria-label=\"Cell data\">\n <div class=\"mit-data-panel__header\">\n <span class=\"mit-data-panel__title\">Data</span>\n <button\n type=\"button\"\n mat-icon-button\n class=\"mit-icon-button mit-data-close\"\n aria-label=\"Close\"\n (click)=\"closeDataOverlay()\"\n >\n <mat-icon>close</mat-icon>\n </button>\n </div>\n <div class=\"mit-data-panel__body\">\n <lib-t-dynamic-data-view [data]=\"overlayData()\" />\n </div>\n </div>\n </ng-template>\n}\n\n<mat-menu #colOptions=\"matMenu\">\n <ng-template matMenuContent>\n @for (label of allPossibleLabels(); track label.formControlName) {\n <button\n mat-menu-item\n role=\"menuitemcheckbox\"\n [attr.aria-checked]=\"label.selected\"\n (click)=\"toggleTempLabel($event, label.formControlName)\"\n >\n <mat-icon>{{ label.selected ? 'check_box' : 'check_box_outline_blank' }}</mat-icon>\n {{ label.label }}\n </button>\n }\n </ng-template>\n</mat-menu>\n\n<mat-menu #rowOptions=\"matMenu\">\n <ng-template matMenuContent let-row=\"row\">\n @if (isEditable()) {\n @if (userCanAdd()) {\n <button mat-menu-item (click)=\"copy(row)\">\n <mat-icon>content_copy</mat-icon>\n <div class=\"option-text\">\n <div class=\"option-main-text\">Duplicate</div>\n <div class=\"option-sub-text\">Create a copy with the same values</div>\n </div>\n </button>\n }\n\n @if (userCanRemove()) {\n @if (isAboutToDeleteRow(row)) {\n <button mat-menu-item (click)=\"multipleInputRemoveItem($event, row)\">\n <mat-icon color=\"accent\">cancel</mat-icon>\n <div class=\"option-text\">\n <div class=\"option-main-text option-main-text--cancel\">Cancel Deletion</div>\n <div class=\"option-sub-text\">Auto-deleting in {{ secondsCountDown() }} seconds...</div>\n </div>\n </button>\n <div class=\"deletion-progress-container\">\n <mat-progress-bar color=\"warn\" mode=\"determinate\" [value]=\"getCountdownSeconds()\"></mat-progress-bar>\n @if (getCountdownSeconds() > 75) {\n <div class=\"deletion-message\">Deleting soon...</div>\n }\n </div>\n } @else {\n <button mat-menu-item (click)=\"multipleInputRemoveItem($event, row)\">\n <mat-icon color=\"warn\">delete_outline</mat-icon>\n <div class=\"option-text\">\n <div class=\"option-main-text\">Delete</div>\n <div class=\"option-sub-text\">Removes after 3 seconds. Click again to cancel</div>\n </div>\n </button>\n }\n }\n }\n </ng-template>\n</mat-menu>\n", styles: [":host{display:block}.mit-inline{display:block}.mit-shell{display:flex;flex-direction:column;background:var(--lib-forms-surface);border:1px solid color-mix(in srgb,var(--lib-forms-outline) 10%,transparent);border-radius:var(--lib-forms-radius-md);box-shadow:var(--lib-forms-shadow-resting);overflow:hidden}.mit-shell--fullscreen{height:100%;box-sizing:border-box;padding:1.25rem 1.5rem .5rem;border:none;border-radius:0;box-shadow:none}.mit-toolbar{display:flex;align-items:center;justify-content:space-between;gap:.75rem;padding:.375rem .375rem .375rem .75rem}.mit-shell--fullscreen .mit-toolbar{padding:0 0 1.25rem}.mit-toolbar__lead{display:flex;align-items:center;gap:.75rem;min-width:0}.mit-toolbar__title{margin:0;font-size:1.25rem;font-weight:500;letter-spacing:-.01em;color:var(--lib-forms-on-surface);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mit-toolbar__summary{display:inline-flex;align-items:center;height:1.375rem;padding:0 .5625rem;border-radius:var(--lib-forms-radius-pill);background:color-mix(in srgb,var(--lib-forms-primary) 10%,transparent);color:var(--lib-forms-primary);font-size:.625rem;font-weight:600;letter-spacing:.14em;text-transform:uppercase;white-space:nowrap}.mit-toolbar__actions{display:flex;align-items:center;gap:.125rem;flex-shrink:0}.mit-icon-button.mat-mdc-icon-button{--mdc-icon-button-state-layer-size: 1.75rem;--mdc-icon-button-icon-size: 1rem;width:1.75rem;height:1.75rem;padding:.375rem;border-radius:50%;color:var(--lib-forms-on-surface-variant);transition:color var(--lib-forms-duration-hover) var(--lib-forms-easing),background-color var(--lib-forms-duration-hover) var(--lib-forms-easing),box-shadow var(--lib-forms-duration-hover) var(--lib-forms-easing)}.mit-icon-button.mat-mdc-icon-button .mat-icon{font-size:1rem;width:1rem;height:1rem;line-height:1rem}.mit-icon-button.mat-mdc-icon-button:hover,.mit-icon-button.mat-mdc-icon-button:focus-visible{color:var(--lib-forms-primary);background-color:color-mix(in srgb,var(--lib-forms-primary) 10%,transparent)}.mit-icon-button.mat-mdc-icon-button:focus-visible{outline:3px solid color-mix(in srgb,var(--lib-forms-primary) 14%,transparent);outline-offset:1px}.mit-icon-button--active.mat-mdc-icon-button{color:var(--lib-forms-primary);background-color:color-mix(in srgb,var(--lib-forms-primary) 14%,transparent)}.mit-row-edit.mat-mdc-icon-button{color:var(--lib-forms-primary)}.mit-row-edit.mat-mdc-icon-button:hover,.mit-row-edit.mat-mdc-icon-button:focus-visible{background-color:color-mix(in srgb,var(--lib-forms-primary) 14%,transparent);box-shadow:var(--lib-forms-shadow-edge)}.mit-scroll{width:100%;overflow:auto;overscroll-behavior-x:contain;scrollbar-width:thin}.mit-shell--fullscreen .mit-scroll{flex:1 1 auto;min-height:0;border-radius:var(--lib-forms-radius-sm);border:1px solid color-mix(in srgb,var(--lib-forms-outline) 10%,transparent)}.mit-table{--mat-table-row-item-outline-width: 0;--mat-table-background-color: transparent;--mat-table-header-container-height: 1.875rem;--mat-table-row-item-container-height: 2rem;width:100%;background:transparent}.mit-table .mat-mdc-header-row{--mit-row-bg: color-mix(in srgb, var(--lib-forms-primary) 5%, var(--lib-forms-surface));height:1.875rem;background:var(--mit-row-bg)}.mit-table .mat-mdc-header-cell{padding:0 .625rem;white-space:nowrap;background:var(--mit-row-bg)}.mit-th-label{font-size:.625rem;font-weight:600;letter-spacing:.14em;text-transform:uppercase;color:var(--lib-forms-on-surface-variant)}.mit-th--numeric,.mit-th--actions{text-align:right}.mit-table .mat-mdc-row{--mit-row-bg: var(--lib-forms-surface);height:2rem;background:var(--mit-row-bg);transition:background-color var(--lib-forms-duration-hover) var(--lib-forms-easing)}.mit-table .mat-mdc-row:nth-child(2n){--mit-row-bg: var(--lib-forms-surface-container-low)}.mit-table .mat-mdc-row:hover{--mit-row-bg: color-mix(in srgb, var(--lib-forms-primary) 7%, var(--lib-forms-surface))}.mit-table .mit-row--in-edit,.mit-table .mit-row--in-edit:hover{--mit-row-bg: color-mix(in srgb, var(--lib-forms-primary) 11%, var(--lib-forms-surface))}.mit-table .mit-row--in-edit .mat-mdc-cell:first-child{box-shadow:inset 3px 0 0 var(--lib-forms-primary)}.mit-table .mit-row--calc,.mit-table .mit-row--calc:hover{--mit-row-bg: var(--lib-forms-surface-container-high)}.mit-table .mit-td--calc{font-weight:600}.mit-table .mat-mdc-cell{padding:0 .625rem;font-size:.8125rem;line-height:1.3;color:var(--lib-forms-on-surface);vertical-align:middle}.mit-cell-text{display:block;max-width:18rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mit-shell--fullscreen .mit-cell-text{max-width:40rem}.mit-table .mat-mdc-header-cell:not(.mit-th--index):not(.mit-th--opened):not(.mit-th--actions),.mit-table .mat-mdc-cell:not(.mit-td--index):not(.mit-td--opened):not(.mit-td--actions){min-width:6rem}.mit-td--numeric{text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}.mit-table .mit-row--group-start .mat-mdc-cell{border-top:2px solid var(--lib-forms-outline-variant)}.mit-table .mat-column-itemRemovalButton{width:1%;white-space:nowrap;background:var(--mit-row-bg)}.mit-table .mat-column-itemRemovalButton.mat-mdc-table-sticky{box-shadow:-10px 0 14px -12px color-mix(in srgb,var(--lib-forms-shadow-color) 22%,transparent)}.mit-table .mit-th--index,.mit-table .mit-td--index{width:1%;padding:0 .5rem 0 .625rem;text-align:right;white-space:nowrap;background:var(--mit-row-bg)}.mit-th-hash{font-size:.625rem;font-weight:600;color:var(--lib-forms-on-surface-variant)}.mit-index{font-size:.6875rem;font-variant-numeric:tabular-nums;color:color-mix(in srgb,var(--lib-forms-on-surface-variant) 65%,transparent)}.mit-table .mit-th--opened,.mit-table .mit-td--opened{width:1%;padding:0 .625rem;text-align:right;white-space:nowrap;background:var(--mit-row-bg)}.mit-opened{font-size:.6875rem;font-variant-numeric:tabular-nums;color:color-mix(in srgb,var(--lib-forms-on-surface-variant) 75%,transparent)}.mit-table .mit-th--opened.mat-mdc-table-sticky,.mit-table .mit-td--opened.mat-mdc-table-sticky{box-shadow:-10px 0 14px -12px color-mix(in srgb,var(--lib-forms-shadow-color) 22%,transparent)}.mit-table .mit-th--opened.mat-mdc-table-sticky+.mat-column-itemRemovalButton.mat-mdc-table-sticky,.mit-table .mit-td--opened.mat-mdc-table-sticky+.mat-column-itemRemovalButton.mat-mdc-table-sticky{box-shadow:none}.mit-actions{display:flex;align-items:center;justify-content:flex-end;gap:.125rem;min-height:1.625rem}.mit-calc-label{font-size:.625rem;font-weight:600;letter-spacing:.14em;text-transform:uppercase;color:var(--lib-forms-on-surface-variant)}.mit-chip{--mdc-chip-container-height: 1.375rem;font-size:.625rem}.mit-paginator{--mat-paginator-container-size: 2.5rem;--mat-paginator-container-text-size: .6875rem;--mat-paginator-select-trigger-text-size: .6875rem;--mat-paginator-touch-target-display: none;--mat-paginator-form-field-container-height: 1.75rem;--mat-paginator-form-field-container-vertical-padding: .125rem;--mat-paginator-container-background-color: transparent;--mat-paginator-container-text-color: var(--lib-forms-on-surface-variant);background:var(--lib-forms-surface-container-low)}.mit-shell--fullscreen .mit-paginator{flex:0 0 auto;margin-top:.5rem;border-radius:var(--lib-forms-radius-sm)}.mit-state{display:flex;justify-content:center;padding:1rem;font-size:.8125rem;color:var(--lib-forms-on-surface-variant);opacity:.7}.mit-empty{display:flex;flex-direction:column;align-items:center;text-align:center;gap:.375rem;padding:2.5rem 2rem;color:var(--lib-forms-on-surface-variant)}.mit-empty-title{font-size:.9375rem;font-weight:500;color:var(--lib-forms-on-surface)}.mit-empty-text{margin:0;max-width:24rem;font-size:.8125rem;line-height:1.5}.mit-placeholder{display:flex;justify-content:center;align-items:center;padding:2rem}.mit-data-panel{display:flex;flex-direction:column;min-width:280px;max-width:min(380px,calc(100vw - 16px));max-height:60vh;overflow:hidden;background:var(--lib-forms-surface);border:1px solid color-mix(in srgb,var(--lib-forms-outline) 15%,transparent);border-radius:var(--lib-forms-radius-lg);box-shadow:var(--lib-forms-shadow-floating);animation:mit-fade-in var(--lib-forms-duration) var(--lib-forms-easing)}.mit-data-panel__header{display:flex;align-items:center;justify-content:space-between;gap:.5rem;padding:.5rem .5rem .25rem 1rem;flex-shrink:0}.mit-data-panel__title{font-size:.625rem;font-weight:600;letter-spacing:.14em;text-transform:uppercase;color:var(--lib-forms-on-surface-variant)}.mit-data-panel__body{flex:1;overflow:auto;padding:.25rem 1rem 1rem}@keyframes mit-fade-in{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.mit-data-panel{animation:none}}.option-text{display:flex;flex-direction:column;margin-left:.5rem}.option-main-text{font-size:.875rem;font-weight:500;margin-bottom:2px;line-height:normal}.option-main-text--cancel{color:var(--lib-forms-primary)}.option-sub-text{font-size:.75rem;color:var(--lib-forms-on-surface-variant);font-weight:400;line-height:1.2}.deletion-progress-container{position:relative;padding:0 1rem .5rem}.deletion-message{position:absolute;right:1rem;top:2px;font-size:.6875rem;color:var(--sem-error);font-weight:500;line-height:1.6;animation:mit-pulse 1s infinite}@keyframes mit-pulse{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}@media(max-width:600px){.option-sub-text{max-width:180px;white-space:normal}}\n"], dependencies: [{ kind: "directive", type: CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation", "cdkConnectedOverlayUsePopover", "cdkConnectedOverlayMatchWidth", "cdkConnectedOverlay"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatChipsModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i6.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i6.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i6.MatMenuContent, selector: "ng-template[matMenuContent]" }, { kind: "ngmodule", type: MatPaginatorModule }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i4$1.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "component", type: TDynamicDataViewComponent, selector: "lib-t-dynamic-data-view", inputs: ["data"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, deferBlockDependencies: [() => [import('@angular/common').then(m => m.NgTemplateOutlet), i2.MatIconButton, i4.MatChip, i3.MatIcon, i6.MatMenuTrigger, i3$1.MatPaginator, i5.MatTable, i5.MatHeaderCellDef, i5.MatHeaderRowDef, i5.MatColumnDef, i5.MatCellDef, i5.MatRowDef, i5.MatHeaderCell, i5.MatCell, i5.MatHeaderRow, i5.MatRow, i5$1.MatTooltip, import('./ngx-t-forms-ngx-t-forms-CaVyRedJ.mjs').then(function (n) { return n.bG; }).then(m => m.FormatDataPipe)]] }); }
|
|
845
|
-
}
|
|
846
|
-
i0.ɵɵngDeclareClassMetadataAsync({ minVersion: "18.0.0", version: "21.2.12", ngImport: i0, type: MultipleInputTableViewComponent, resolveDeferredDeps: () => [import('@angular/common').then(m => m.NgTemplateOutlet), import('./ngx-t-forms-ngx-t-forms-CaVyRedJ.mjs').then(function (n) { return n.bG; }).then(m => m.FormatDataPipe)], resolveMetadata: (NgTemplateOutlet, FormatDataPipe) => ({ decorators: [{
|
|
847
|
-
type: Component,
|
|
848
|
-
args: [{ selector: 'lib-multiple-input-table-view', imports: [
|
|
849
|
-
CdkConnectedOverlay,
|
|
850
|
-
NgTemplateOutlet,
|
|
851
|
-
MatButtonModule,
|
|
852
|
-
MatChipsModule,
|
|
853
|
-
MatIconModule,
|
|
854
|
-
MatMenuModule,
|
|
855
|
-
MatPaginatorModule,
|
|
856
|
-
MatProgressBarModule,
|
|
857
|
-
MatProgressSpinnerModule,
|
|
858
|
-
MatTableModule,
|
|
859
|
-
MatTooltipModule,
|
|
860
|
-
FormatDataPipe,
|
|
861
|
-
TDynamicDataViewComponent,
|
|
862
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: {
|
|
863
|
-
'class': 'lib-multiple-input-table-view',
|
|
864
|
-
'[class.lib-multiple-input-table-view--fullscreen]': 'fullscreen()',
|
|
865
|
-
}, template: "@defer (on viewport) {\n <!--\n The table shell is a template so the same markup renders in two places: inline in the form,\n or inside the full-screen dialog. Only one instance exists at a time \u2014 the inline slot empties\n while the dialog is open \u2014 so the shared data source always pages through a single paginator.\n -->\n <ng-template #shell>\n <section class=\"mit-shell\" [class.mit-shell--fullscreen]=\"fullscreen()\">\n <header class=\"mit-toolbar\">\n <div class=\"mit-toolbar__lead\">\n @if (fullscreen()) {\n <h2 class=\"mit-toolbar__title\">{{ inputConfig()?.label }}</h2>\n }\n <span class=\"mit-toolbar__summary\">{{ rowSummary() }}</span>\n </div>\n <div class=\"mit-toolbar__actions\">\n @if (canReload()) {\n <button\n type=\"button\"\n mat-icon-button\n class=\"mit-icon-button mit-reload\"\n matTooltip=\"Refresh this list\"\n aria-label=\"Refresh this list\"\n (click)=\"reload()\"\n >\n <mat-icon>sync</mat-icon>\n </button>\n }\n @if (allPossibleLabels().length > 0) {\n <button\n type=\"button\"\n mat-icon-button\n class=\"mit-icon-button mit-columns-trigger\"\n matTooltip=\"Choose columns\"\n aria-label=\"Choose columns\"\n [matMenuTriggerFor]=\"colOptions\"\n >\n <mat-icon>view_column</mat-icon>\n </button>\n }\n <button\n #fullscreenToggle\n type=\"button\"\n mat-icon-button\n class=\"mit-icon-button mit-fullscreen-toggle\"\n [matTooltip]=\"fullscreen() ? 'Exit full screen' : 'Full screen'\"\n [attr.aria-label]=\"fullscreen() ? 'Exit full screen' : 'Full screen'\"\n [attr.aria-pressed]=\"fullscreen()\"\n (click)=\"toggleFullscreen()\"\n >\n <mat-icon>{{ fullscreen() ? 'fullscreen_exit' : 'fullscreen' }}</mat-icon>\n </button>\n </div>\n </header>\n\n @if (displayedColumnsInOrder.length === 0) {\n <div class=\"mit-state\">No columns</div>\n }\n\n <div class=\"mit-scroll\">\n <table mat-table [dataSource]=\"dataSource() ?? []\" class=\"mit-table\">\n @for (col of displayedColumnsInOrder; track col) {\n <!--\n The row number is pinned to the start and the \"opened\" age and actions to the end, so\n a row keeps its identity and stays actionable however far a wide table is scrolled.\n Material needs each pinned group contiguous at its edge, which is why the \"opened\"\n column is inserted before the actions column rather than appended after it.\n -->\n <ng-container\n [matColumnDef]=\"col\"\n [sticky]=\"isIndexColumn(col)\"\n [stickyEnd]=\"isActionsColumn(col) || isOpenedColumn(col)\"\n >\n <th\n mat-header-cell\n *matHeaderCellDef\n scope=\"col\"\n [attr.aria-label]=\"isIndexColumn(col) ? 'Row number' : null\"\n [class.mit-th--index]=\"isIndexColumn(col)\"\n [class.mit-th--opened]=\"isOpenedColumn(col)\"\n [class.mit-th--numeric]=\"isNumericColumn(col)\"\n [class.mit-th--actions]=\"isActionsColumn(col)\"\n >\n @if (isIndexColumn(col)) {\n <span class=\"mit-th-hash\" aria-hidden=\"true\">#</span>\n } @else {\n <span class=\"mit-th-label\">{{ columnLabel(col) }}</span>\n }\n </th>\n <td\n mat-cell\n *matCellDef=\"let row; let rowIndex = index\"\n [class.mit-td--calc]=\"isCalculationRow(row)\"\n [class.mit-td--index]=\"isIndexColumn(col)\"\n [class.mit-td--opened]=\"isOpenedColumn(col)\"\n [class.mit-td--actions]=\"isActionsColumn(col)\"\n [class.mit-td--numeric]=\"isNumericColumn(col)\"\n [style.background]=\"returnBackground(row, columnsConfig()[col])\"\n >\n @if (isIndexColumn(col)) {\n <span class=\"mit-index\">{{ rowNumber(row, rowIndex) }}</span>\n } @else if (isOpenedColumn(col)) {\n <!-- Blank for a row nobody has been into: the column is a record of what the\n author touched, so an empty cell is the honest reading of \"not yet\". -->\n @let opened = openedShort(row);\n @if (opened) {\n <span class=\"mit-opened\" [matTooltip]=\"openedLong(row)\">{{ opened }}</span>\n }\n } @else if (isActionsColumn(col)) {\n <div class=\"mit-actions\">\n @if (showsCalculationLabel(row)) {\n <span class=\"mit-calc-label\">{{ getCalculationFunction(row) }}</span>\n }\n @if (rowIsFlaggedInEdit(row)) {\n <mat-chip class=\"mit-chip\">In {{ inputConfig()?.readonly ? 'View' : 'Edit' }}</mat-chip>\n }\n @if (rowHasActions(row)) {\n @if (showRowEdit()) {\n <button\n type=\"button\"\n mat-icon-button\n class=\"mit-icon-button mit-row-edit\"\n [class.mit-icon-button--active]=\"rowIsInEdit(row)\"\n matTooltip=\"Edit\"\n aria-label=\"Edit row\"\n (click)=\"editItem(row)\"\n >\n <mat-icon>edit</mat-icon>\n </button>\n }\n @if (showRowMenu()) {\n <button\n type=\"button\"\n mat-icon-button\n class=\"mit-icon-button mit-row-trigger\"\n [class.mit-icon-button--active]=\"t.menuOpen\"\n matTooltip=\"More actions\"\n aria-label=\"More row actions\"\n [matMenuTriggerFor]=\"rowOptions\"\n [matMenuTriggerData]=\"{ row: row }\"\n #t=\"matMenuTrigger\"\n (click)=\"applyOptionsToFn(row)\"\n >\n <mat-icon>{{ t.menuOpen ? 'close' : 'more_horiz' }}</mat-icon>\n </button>\n }\n }\n </div>\n } @else if (isStructuredColumn(col)) {\n <button\n type=\"button\"\n mat-icon-button\n class=\"mit-icon-button mit-data-button\"\n matTooltip=\"View data\"\n aria-label=\"View data\"\n (click)=\"openDataOverlay($event, row[col])\"\n >\n <mat-icon>data_object</mat-icon>\n </button>\n } @else {\n @let text = row[col] | formatData: columnDataType(col) : columnPipe(col) : l10n();\n <span class=\"mit-cell-text\" [attr.title]=\"text\">{{ text }}</span>\n }\n </td>\n </ng-container>\n }\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumnsInOrder; sticky: true\"></tr>\n <tr\n mat-row\n *matRowDef=\"let row; columns: displayedColumnsInOrder\"\n class=\"mit-row\"\n [class.mit-row--group-start]=\"hasTopBorder(row)\"\n [class.mit-row--calc]=\"isCalculationRow(row)\"\n [class.mit-row--in-edit]=\"rowIsInEdit(row)\"\n ></tr>\n </table>\n\n @if (isEmpty()) {\n <div class=\"mit-empty\">\n <strong class=\"mit-empty-title\">No items yet</strong>\n <p class=\"mit-empty-text\">\n Use the add button below to create a row. Each saved entry appears here.\n </p>\n </div>\n }\n </div>\n\n @if (showPaginator()) {\n <mat-paginator\n class=\"mit-paginator\"\n [pageIndex]=\"pageIndex()\"\n [pageSize]=\"pageSize()\"\n [pageSizeOptions]=\"pageSizeOptions\"\n showFirstLastButtons\n aria-label=\"Table pagination\"\n (page)=\"onPage($event)\"\n />\n }\n </section>\n </ng-template>\n\n <div class=\"mit-inline\" #inlineHost [style.min-height.px]=\"reservedHeight()\">\n @if (!fullscreen()) {\n <ng-container [ngTemplateOutlet]=\"shell\" />\n }\n </div>\n} @placeholder {\n <div class=\"mit-placeholder\">\n <mat-spinner diameter=\"32\" />\n </div>\n}\n\n<!--\n Structured (array / object) cell values open in a CDK overlay anchored to the button that was\n clicked. An overlay, rather than a fixed-position panel, so it stacks correctly above the\n full-screen dialog and is never clipped by a transformed ancestor.\n-->\n@if (overlayOrigin(); as origin) {\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"origin\"\n [cdkConnectedOverlayOpen]=\"overlayOpen()\"\n [cdkConnectedOverlayHasBackdrop]=\"true\"\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n [cdkConnectedOverlayPush]=\"true\"\n (backdropClick)=\"closeDataOverlay()\"\n (detach)=\"closeDataOverlay()\"\n >\n <div class=\"mit-data-panel\" role=\"dialog\" aria-label=\"Cell data\">\n <div class=\"mit-data-panel__header\">\n <span class=\"mit-data-panel__title\">Data</span>\n <button\n type=\"button\"\n mat-icon-button\n class=\"mit-icon-button mit-data-close\"\n aria-label=\"Close\"\n (click)=\"closeDataOverlay()\"\n >\n <mat-icon>close</mat-icon>\n </button>\n </div>\n <div class=\"mit-data-panel__body\">\n <lib-t-dynamic-data-view [data]=\"overlayData()\" />\n </div>\n </div>\n </ng-template>\n}\n\n<mat-menu #colOptions=\"matMenu\">\n <ng-template matMenuContent>\n @for (label of allPossibleLabels(); track label.formControlName) {\n <button\n mat-menu-item\n role=\"menuitemcheckbox\"\n [attr.aria-checked]=\"label.selected\"\n (click)=\"toggleTempLabel($event, label.formControlName)\"\n >\n <mat-icon>{{ label.selected ? 'check_box' : 'check_box_outline_blank' }}</mat-icon>\n {{ label.label }}\n </button>\n }\n </ng-template>\n</mat-menu>\n\n<mat-menu #rowOptions=\"matMenu\">\n <ng-template matMenuContent let-row=\"row\">\n @if (isEditable()) {\n @if (userCanAdd()) {\n <button mat-menu-item (click)=\"copy(row)\">\n <mat-icon>content_copy</mat-icon>\n <div class=\"option-text\">\n <div class=\"option-main-text\">Duplicate</div>\n <div class=\"option-sub-text\">Create a copy with the same values</div>\n </div>\n </button>\n }\n\n @if (userCanRemove()) {\n @if (isAboutToDeleteRow(row)) {\n <button mat-menu-item (click)=\"multipleInputRemoveItem($event, row)\">\n <mat-icon color=\"accent\">cancel</mat-icon>\n <div class=\"option-text\">\n <div class=\"option-main-text option-main-text--cancel\">Cancel Deletion</div>\n <div class=\"option-sub-text\">Auto-deleting in {{ secondsCountDown() }} seconds...</div>\n </div>\n </button>\n <div class=\"deletion-progress-container\">\n <mat-progress-bar color=\"warn\" mode=\"determinate\" [value]=\"getCountdownSeconds()\"></mat-progress-bar>\n @if (getCountdownSeconds() > 75) {\n <div class=\"deletion-message\">Deleting soon...</div>\n }\n </div>\n } @else {\n <button mat-menu-item (click)=\"multipleInputRemoveItem($event, row)\">\n <mat-icon color=\"warn\">delete_outline</mat-icon>\n <div class=\"option-text\">\n <div class=\"option-main-text\">Delete</div>\n <div class=\"option-sub-text\">Removes after 3 seconds. Click again to cancel</div>\n </div>\n </button>\n }\n }\n }\n </ng-template>\n</mat-menu>\n", styles: [":host{display:block}.mit-inline{display:block}.mit-shell{display:flex;flex-direction:column;background:var(--lib-forms-surface);border:1px solid color-mix(in srgb,var(--lib-forms-outline) 10%,transparent);border-radius:var(--lib-forms-radius-md);box-shadow:var(--lib-forms-shadow-resting);overflow:hidden}.mit-shell--fullscreen{height:100%;box-sizing:border-box;padding:1.25rem 1.5rem .5rem;border:none;border-radius:0;box-shadow:none}.mit-toolbar{display:flex;align-items:center;justify-content:space-between;gap:.75rem;padding:.375rem .375rem .375rem .75rem}.mit-shell--fullscreen .mit-toolbar{padding:0 0 1.25rem}.mit-toolbar__lead{display:flex;align-items:center;gap:.75rem;min-width:0}.mit-toolbar__title{margin:0;font-size:1.25rem;font-weight:500;letter-spacing:-.01em;color:var(--lib-forms-on-surface);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mit-toolbar__summary{display:inline-flex;align-items:center;height:1.375rem;padding:0 .5625rem;border-radius:var(--lib-forms-radius-pill);background:color-mix(in srgb,var(--lib-forms-primary) 10%,transparent);color:var(--lib-forms-primary);font-size:.625rem;font-weight:600;letter-spacing:.14em;text-transform:uppercase;white-space:nowrap}.mit-toolbar__actions{display:flex;align-items:center;gap:.125rem;flex-shrink:0}.mit-icon-button.mat-mdc-icon-button{--mdc-icon-button-state-layer-size: 1.75rem;--mdc-icon-button-icon-size: 1rem;width:1.75rem;height:1.75rem;padding:.375rem;border-radius:50%;color:var(--lib-forms-on-surface-variant);transition:color var(--lib-forms-duration-hover) var(--lib-forms-easing),background-color var(--lib-forms-duration-hover) var(--lib-forms-easing),box-shadow var(--lib-forms-duration-hover) var(--lib-forms-easing)}.mit-icon-button.mat-mdc-icon-button .mat-icon{font-size:1rem;width:1rem;height:1rem;line-height:1rem}.mit-icon-button.mat-mdc-icon-button:hover,.mit-icon-button.mat-mdc-icon-button:focus-visible{color:var(--lib-forms-primary);background-color:color-mix(in srgb,var(--lib-forms-primary) 10%,transparent)}.mit-icon-button.mat-mdc-icon-button:focus-visible{outline:3px solid color-mix(in srgb,var(--lib-forms-primary) 14%,transparent);outline-offset:1px}.mit-icon-button--active.mat-mdc-icon-button{color:var(--lib-forms-primary);background-color:color-mix(in srgb,var(--lib-forms-primary) 14%,transparent)}.mit-row-edit.mat-mdc-icon-button{color:var(--lib-forms-primary)}.mit-row-edit.mat-mdc-icon-button:hover,.mit-row-edit.mat-mdc-icon-button:focus-visible{background-color:color-mix(in srgb,var(--lib-forms-primary) 14%,transparent);box-shadow:var(--lib-forms-shadow-edge)}.mit-scroll{width:100%;overflow:auto;overscroll-behavior-x:contain;scrollbar-width:thin}.mit-shell--fullscreen .mit-scroll{flex:1 1 auto;min-height:0;border-radius:var(--lib-forms-radius-sm);border:1px solid color-mix(in srgb,var(--lib-forms-outline) 10%,transparent)}.mit-table{--mat-table-row-item-outline-width: 0;--mat-table-background-color: transparent;--mat-table-header-container-height: 1.875rem;--mat-table-row-item-container-height: 2rem;width:100%;background:transparent}.mit-table .mat-mdc-header-row{--mit-row-bg: color-mix(in srgb, var(--lib-forms-primary) 5%, var(--lib-forms-surface));height:1.875rem;background:var(--mit-row-bg)}.mit-table .mat-mdc-header-cell{padding:0 .625rem;white-space:nowrap;background:var(--mit-row-bg)}.mit-th-label{font-size:.625rem;font-weight:600;letter-spacing:.14em;text-transform:uppercase;color:var(--lib-forms-on-surface-variant)}.mit-th--numeric,.mit-th--actions{text-align:right}.mit-table .mat-mdc-row{--mit-row-bg: var(--lib-forms-surface);height:2rem;background:var(--mit-row-bg);transition:background-color var(--lib-forms-duration-hover) var(--lib-forms-easing)}.mit-table .mat-mdc-row:nth-child(2n){--mit-row-bg: var(--lib-forms-surface-container-low)}.mit-table .mat-mdc-row:hover{--mit-row-bg: color-mix(in srgb, var(--lib-forms-primary) 7%, var(--lib-forms-surface))}.mit-table .mit-row--in-edit,.mit-table .mit-row--in-edit:hover{--mit-row-bg: color-mix(in srgb, var(--lib-forms-primary) 11%, var(--lib-forms-surface))}.mit-table .mit-row--in-edit .mat-mdc-cell:first-child{box-shadow:inset 3px 0 0 var(--lib-forms-primary)}.mit-table .mit-row--calc,.mit-table .mit-row--calc:hover{--mit-row-bg: var(--lib-forms-surface-container-high)}.mit-table .mit-td--calc{font-weight:600}.mit-table .mat-mdc-cell{padding:0 .625rem;font-size:.8125rem;line-height:1.3;color:var(--lib-forms-on-surface);vertical-align:middle}.mit-cell-text{display:block;max-width:18rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mit-shell--fullscreen .mit-cell-text{max-width:40rem}.mit-table .mat-mdc-header-cell:not(.mit-th--index):not(.mit-th--opened):not(.mit-th--actions),.mit-table .mat-mdc-cell:not(.mit-td--index):not(.mit-td--opened):not(.mit-td--actions){min-width:6rem}.mit-td--numeric{text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}.mit-table .mit-row--group-start .mat-mdc-cell{border-top:2px solid var(--lib-forms-outline-variant)}.mit-table .mat-column-itemRemovalButton{width:1%;white-space:nowrap;background:var(--mit-row-bg)}.mit-table .mat-column-itemRemovalButton.mat-mdc-table-sticky{box-shadow:-10px 0 14px -12px color-mix(in srgb,var(--lib-forms-shadow-color) 22%,transparent)}.mit-table .mit-th--index,.mit-table .mit-td--index{width:1%;padding:0 .5rem 0 .625rem;text-align:right;white-space:nowrap;background:var(--mit-row-bg)}.mit-th-hash{font-size:.625rem;font-weight:600;color:var(--lib-forms-on-surface-variant)}.mit-index{font-size:.6875rem;font-variant-numeric:tabular-nums;color:color-mix(in srgb,var(--lib-forms-on-surface-variant) 65%,transparent)}.mit-table .mit-th--opened,.mit-table .mit-td--opened{width:1%;padding:0 .625rem;text-align:right;white-space:nowrap;background:var(--mit-row-bg)}.mit-opened{font-size:.6875rem;font-variant-numeric:tabular-nums;color:color-mix(in srgb,var(--lib-forms-on-surface-variant) 75%,transparent)}.mit-table .mit-th--opened.mat-mdc-table-sticky,.mit-table .mit-td--opened.mat-mdc-table-sticky{box-shadow:-10px 0 14px -12px color-mix(in srgb,var(--lib-forms-shadow-color) 22%,transparent)}.mit-table .mit-th--opened.mat-mdc-table-sticky+.mat-column-itemRemovalButton.mat-mdc-table-sticky,.mit-table .mit-td--opened.mat-mdc-table-sticky+.mat-column-itemRemovalButton.mat-mdc-table-sticky{box-shadow:none}.mit-actions{display:flex;align-items:center;justify-content:flex-end;gap:.125rem;min-height:1.625rem}.mit-calc-label{font-size:.625rem;font-weight:600;letter-spacing:.14em;text-transform:uppercase;color:var(--lib-forms-on-surface-variant)}.mit-chip{--mdc-chip-container-height: 1.375rem;font-size:.625rem}.mit-paginator{--mat-paginator-container-size: 2.5rem;--mat-paginator-container-text-size: .6875rem;--mat-paginator-select-trigger-text-size: .6875rem;--mat-paginator-touch-target-display: none;--mat-paginator-form-field-container-height: 1.75rem;--mat-paginator-form-field-container-vertical-padding: .125rem;--mat-paginator-container-background-color: transparent;--mat-paginator-container-text-color: var(--lib-forms-on-surface-variant);background:var(--lib-forms-surface-container-low)}.mit-shell--fullscreen .mit-paginator{flex:0 0 auto;margin-top:.5rem;border-radius:var(--lib-forms-radius-sm)}.mit-state{display:flex;justify-content:center;padding:1rem;font-size:.8125rem;color:var(--lib-forms-on-surface-variant);opacity:.7}.mit-empty{display:flex;flex-direction:column;align-items:center;text-align:center;gap:.375rem;padding:2.5rem 2rem;color:var(--lib-forms-on-surface-variant)}.mit-empty-title{font-size:.9375rem;font-weight:500;color:var(--lib-forms-on-surface)}.mit-empty-text{margin:0;max-width:24rem;font-size:.8125rem;line-height:1.5}.mit-placeholder{display:flex;justify-content:center;align-items:center;padding:2rem}.mit-data-panel{display:flex;flex-direction:column;min-width:280px;max-width:min(380px,calc(100vw - 16px));max-height:60vh;overflow:hidden;background:var(--lib-forms-surface);border:1px solid color-mix(in srgb,var(--lib-forms-outline) 15%,transparent);border-radius:var(--lib-forms-radius-lg);box-shadow:var(--lib-forms-shadow-floating);animation:mit-fade-in var(--lib-forms-duration) var(--lib-forms-easing)}.mit-data-panel__header{display:flex;align-items:center;justify-content:space-between;gap:.5rem;padding:.5rem .5rem .25rem 1rem;flex-shrink:0}.mit-data-panel__title{font-size:.625rem;font-weight:600;letter-spacing:.14em;text-transform:uppercase;color:var(--lib-forms-on-surface-variant)}.mit-data-panel__body{flex:1;overflow:auto;padding:.25rem 1rem 1rem}@keyframes mit-fade-in{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.mit-data-panel{animation:none}}.option-text{display:flex;flex-direction:column;margin-left:.5rem}.option-main-text{font-size:.875rem;font-weight:500;margin-bottom:2px;line-height:normal}.option-main-text--cancel{color:var(--lib-forms-primary)}.option-sub-text{font-size:.75rem;color:var(--lib-forms-on-surface-variant);font-weight:400;line-height:1.2}.deletion-progress-container{position:relative;padding:0 1rem .5rem}.deletion-message{position:absolute;right:1rem;top:2px;font-size:.6875rem;color:var(--sem-error);font-weight:500;line-height:1.6;animation:mit-pulse 1s infinite}@keyframes mit-pulse{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}@media(max-width:600px){.option-sub-text{max-width:180px;white-space:normal}}\n"] }]
|
|
866
|
-
}], ctorParameters: () => [], propDecorators: { inputConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputConfig", required: false }] }], dataSource: [{ type: i0.Input, args: [{ isSignal: true, alias: "dataSource", required: false }] }], applyOptionsTo: [{ type: i0.Input, args: [{ isSignal: true, alias: "applyOptionsTo", required: false }] }], formGroup: [{ type: i0.Input, args: [{ isSignal: true, alias: "formGroup", required: false }] }], onEditItem: [{ type: i0.Output, args: ["onEditItem"] }], onDeleteItem: [{ type: i0.Output, args: ["onDeleteItem"] }], onCopy: [{ type: i0.Output, args: ["onCopy"] }], onApplyOptionsTo: [{ type: i0.Output, args: ["onApplyOptionsTo"] }], showItemAsLabel: [{ type: i0.Output, args: ["showItemAsLabel"] }], paginator: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MatPaginator), { isSignal: true }] }], shellTemplate: [{ type: i0.ViewChild, args: ['shell', { isSignal: true }] }], inlineHost: [{ type: i0.ViewChild, args: ['inlineHost', { isSignal: true }] }], fullscreenToggle: [{ type: i0.ViewChild, args: ['fullscreenToggle', { ...{ read: ElementRef }, isSignal: true }] }] } }) });
|
|
867
|
-
|
|
868
|
-
class MultipleInputTableEditComponent {
|
|
869
|
-
constructor() {
|
|
870
|
-
this.InputComponent = TFormInputComponent;
|
|
871
|
-
this.inputConfig = input.required(...(ngDevMode ? [{ debugName: "inputConfig" }] : /* istanbul ignore next */ []));
|
|
872
|
-
this.editorMode = input(false, ...(ngDevMode ? [{ debugName: "editorMode" }] : /* istanbul ignore next */ []));
|
|
873
|
-
this.formGroup = input(null, ...(ngDevMode ? [{ debugName: "formGroup" }] : /* istanbul ignore next */ []));
|
|
874
|
-
this.formBuilderFunctions = input(undefined, ...(ngDevMode ? [{ debugName: "formBuilderFunctions" }] : /* istanbul ignore next */ []));
|
|
875
|
-
this.onSaveMultipleInputForm = output();
|
|
876
|
-
this.editMultipleInput = output();
|
|
877
|
-
this.deleteInput = output();
|
|
878
|
-
this.showItemAsLabel = output();
|
|
879
|
-
this.addFunction = output();
|
|
880
|
-
this.reorderItems = output();
|
|
881
|
-
this.calculationFunctions = Object.values(CalculationFunctions);
|
|
882
|
-
this.activeInput = '';
|
|
883
|
-
this.dragging = false;
|
|
884
|
-
this.overId = null;
|
|
885
|
-
this.areYouSure = false;
|
|
886
|
-
this.countdownSeconds = {};
|
|
887
|
-
this.innerInputs = computed(() => {
|
|
888
|
-
const cfg = this.inputConfig();
|
|
889
|
-
return (cfg?.formInputs?.map((input) => ({
|
|
890
|
-
...input,
|
|
891
|
-
originalId: input.id,
|
|
892
|
-
id: `${cfg?.id}.${input.id}`,
|
|
893
|
-
})) || []);
|
|
894
|
-
}, ...(ngDevMode ? [{ debugName: "innerInputs" }] : /* istanbul ignore next */ []));
|
|
895
|
-
this.rowInUpdate = computed(() => {
|
|
896
|
-
const cfg = this.inputConfig();
|
|
897
|
-
const fg = this.formGroup();
|
|
898
|
-
return !!cfg?.formIsOpen && !!fg?.controls[`${cfg?.id}.id`]?.value;
|
|
899
|
-
}, ...(ngDevMode ? [{ debugName: "rowInUpdate" }] : /* istanbul ignore next */ []));
|
|
900
|
-
this.formInvalid = computed(() => {
|
|
901
|
-
const cfg = this.inputConfig();
|
|
902
|
-
const fg = this.formGroup();
|
|
903
|
-
const allControls = [];
|
|
904
|
-
cfg?.formInputs?.forEach((input) => {
|
|
905
|
-
const control = fg?.controls[`${cfg?.id}.${input.id}`];
|
|
906
|
-
if (control) {
|
|
907
|
-
allControls.push(control);
|
|
908
|
-
}
|
|
909
|
-
});
|
|
910
|
-
return allControls.some((control) => control?.invalid || !control);
|
|
911
|
-
}, ...(ngDevMode ? [{ debugName: "formInvalid" }] : /* istanbul ignore next */ []));
|
|
912
|
-
this.#destroyRef = inject(DestroyRef);
|
|
913
|
-
}
|
|
914
|
-
#destroyRef;
|
|
915
|
-
ngOnDestroy() {
|
|
916
|
-
Object.values(this.countdownSeconds).forEach(({ stop$ }) => stop$.complete());
|
|
917
|
-
}
|
|
918
|
-
saveMultipleInputForm() {
|
|
919
|
-
this.onSaveMultipleInputForm.emit();
|
|
920
|
-
}
|
|
921
|
-
inputWillBeRemovedIn(id) {
|
|
922
|
-
return this.countdownSeconds[id]?.count;
|
|
923
|
-
}
|
|
924
|
-
removeInput(item) {
|
|
925
|
-
if (this.countdownSeconds[item.id]) {
|
|
926
|
-
this.stopDeletion(item.id);
|
|
927
|
-
return;
|
|
928
|
-
}
|
|
929
|
-
this.countdownSeconds[item.id] = {
|
|
930
|
-
count: 5,
|
|
931
|
-
stop$: new Subject(),
|
|
932
|
-
};
|
|
933
|
-
const countdown$ = timer(0, 1000).pipe(tap((secondsElapsed) => {
|
|
934
|
-
const data = this.countdownSeconds[item.id];
|
|
935
|
-
if (!data) {
|
|
936
|
-
return;
|
|
937
|
-
}
|
|
938
|
-
const remainingTime = 5 - secondsElapsed;
|
|
939
|
-
if (remainingTime <= 0) {
|
|
940
|
-
this.formDeleteInput(item);
|
|
941
|
-
this.stopDeletion(item.id);
|
|
942
|
-
}
|
|
943
|
-
else {
|
|
944
|
-
data.count = remainingTime;
|
|
945
|
-
}
|
|
946
|
-
}), takeUntil(this.countdownSeconds[item.id].stop$), takeUntilDestroyed(this.#destroyRef));
|
|
947
|
-
countdown$.subscribe({
|
|
948
|
-
complete: () => { },
|
|
949
|
-
});
|
|
950
|
-
}
|
|
951
|
-
stopDeletion(id) {
|
|
952
|
-
if (this.countdownSeconds[id]) {
|
|
953
|
-
this.countdownSeconds[id]?.stop$.next();
|
|
954
|
-
delete this.countdownSeconds[id];
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
formDeleteInput(item) {
|
|
958
|
-
this.deleteInput.emit(item);
|
|
959
|
-
}
|
|
960
|
-
dropItems(event) {
|
|
961
|
-
this.reorderItems.emit(event);
|
|
962
|
-
}
|
|
963
|
-
editInput(input) {
|
|
964
|
-
this.editMultipleInput.emit(input);
|
|
965
|
-
}
|
|
966
|
-
toggleLabel(item) {
|
|
967
|
-
this.showItemAsLabel.emit(item);
|
|
968
|
-
}
|
|
969
|
-
toggleFunction(func, _inputId) {
|
|
970
|
-
const addFunction = {
|
|
971
|
-
id: v4(),
|
|
972
|
-
inputId: this.activeInput,
|
|
973
|
-
func,
|
|
974
|
-
};
|
|
975
|
-
this.addFunction.emit(addFunction);
|
|
976
|
-
}
|
|
977
|
-
selectedFunction(func) {
|
|
978
|
-
return this.inputConfig()?.calculateListFunctions?.find((f) => f.inputId === this.activeInput && f.func === func);
|
|
979
|
-
}
|
|
980
|
-
closeMultipleInput() {
|
|
981
|
-
if (this.areYouSure) {
|
|
982
|
-
this.formBuilderFunctions()?.multipleInputToggleForm(this.inputConfig().id, false);
|
|
983
|
-
this.areYouSure = false;
|
|
984
|
-
return;
|
|
985
|
-
}
|
|
986
|
-
this.areYouSure = true;
|
|
987
|
-
}
|
|
988
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: MultipleInputTableEditComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
989
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: MultipleInputTableEditComponent, isStandalone: true, selector: "lib-multiple-input-table-edit", inputs: { inputConfig: { classPropertyName: "inputConfig", publicName: "inputConfig", isSignal: true, isRequired: true, transformFunction: null }, editorMode: { classPropertyName: "editorMode", publicName: "editorMode", isSignal: true, isRequired: false, transformFunction: null }, formGroup: { classPropertyName: "formGroup", publicName: "formGroup", isSignal: true, isRequired: false, transformFunction: null }, formBuilderFunctions: { classPropertyName: "formBuilderFunctions", publicName: "formBuilderFunctions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onSaveMultipleInputForm: "onSaveMultipleInputForm", editMultipleInput: "editMultipleInput", deleteInput: "deleteInput", showItemAsLabel: "showItemAsLabel", addFunction: "addFunction", reorderItems: "reorderItems" }, ngImport: i0, template: "<mat-card appearance=\"outlined\" class=\"edit-card mat-elevation-z4\">\r\n <mat-card-content>\r\n <div class=\"list row\" (cdkDropListDropped)=\"dropItems($event)\"\r\n [cdkDropListData]=\"innerInputs()\" cdkDropList #InputList=\"cdkDropList\">\r\n @for (innerInput of innerInputs(); track innerInput.id) {\r\n <ng-container>\r\n @if (editorMode()) {\r\n @if (!!formGroup()) {\r\n <mat-card (mouseover)=\"activeInput = innerInput.id\" cdkDrag\r\n (cdkDragStarted)=\"dragging = true\" (cdkDragReleased)=\"dragging = false\"\r\n [class.inputCardElevated]=\"activeInput === innerInput.id\"\r\n [class.inputCard]=\"activeInput !== innerInput.id\"\r\n [class]=\"'col-md-' + (dragging ? '12' : innerInput.colSize)\" class=\"box\">\r\n <ng-container *ngComponentOutlet=\"InputComponent;\r\n inputs: {\r\n inputConfig: innerInput,\r\n formGroup: formGroup(),\r\n formBuilderFunctions: formBuilderFunctions(),\r\n }\">\r\n </ng-container>\r\n @if (activeInput === innerInput.id) {\r\n <mat-card-actions class=\"input-actions\">\r\n <span class=\"spacer\"></span>\r\n <button [matTooltip]=\"'Edit Input: ' + innerInput.label\"\r\n (click)=\"editInput(innerInput)\" mat-icon-button>\r\n <mat-icon>edit</mat-icon>\r\n </button>\r\n @if (!!inputWillBeRemovedIn(innerInput.id)) {\r\n <button (mouseover)=\"overId = innerInput.id\" (mouseout)=\"overId = null\"\r\n (click)=\"removeInput(innerInput)\" color=\"warn\" mat-stroked-button>\r\n <div class=\"countdown-button\">\r\n <mat-progress-spinner class=\"cancelProgress\" color=\"primary\"\r\n [value]=\"((inputWillBeRemovedIn(innerInput.id) || 0) / 5) * 100\">\r\n </mat-progress-spinner>\r\n {{ overId === innerInput.id ? 'Click to cancel' : 'Deleting in' }}\r\n {{ inputWillBeRemovedIn(innerInput.id) }}\r\n </div>\r\n </button>\r\n } @else if (inputConfig().systemDefault !== true && innerInput.systemDefault !== true) {\r\n <button [matTooltip]=\"'Delete input ' + innerInput.label\"\r\n (click)=\"removeInput(innerInput)\" mat-icon-button>\r\n <mat-icon>delete</mat-icon>\r\n </button>\r\n }\r\n <span class=\"action-divider\"></span>\r\n @if (!!innerInput.showAsLabel && innerInput.dataType === 'number' || !!innerInput.showAsLabel && innerInput.type === 'number') {\r\n <button\r\n [matMenuTriggerFor]=\"calculationMenu\"\r\n [matMenuTriggerData]=\"{inputId:innerInput.originalId || innerInput.id}\"\r\n [matTooltip]=\"'calculate sum,avg,min,max'\"\r\n mat-icon-button>\r\n <mat-icon>calculate</mat-icon>\r\n </button>\r\n }\r\n <button [color]=\"innerInput.showAsLabel ? 'primary' : ''\"\r\n (click)=\"toggleLabel(innerInput)\"\r\n [matTooltip]=\"innerInput.showAsLabel ? 'Hide as label' : 'Show as label'\"\r\n mat-icon-button>\r\n <mat-icon>label</mat-icon>\r\n </button>\r\n <span class=\"spacer\"></span>\r\n </mat-card-actions>\r\n }\r\n </mat-card>\r\n }\r\n } @else {\r\n <div [class]=\"'col-md-' + (dragging ? '12' : innerInput.colSize)\" class=\"box\">\r\n <ng-container *ngComponentOutlet=\"InputComponent;\r\n inputs: {\r\n inputConfig: innerInput,\r\n formGroup: formGroup(),\r\n formBuilderFunctions: formBuilderFunctions(),\r\n }\">\r\n </ng-container>\r\n </div>\r\n }\r\n </ng-container>\r\n }\r\n @if (!!editorMode() && innerInputs().length === 0) {\r\n <div class=\"tree-instructions\">\r\n <mat-icon class=\"info-icon\" color=\"primary\">info</mat-icon>\r\n <span>\r\n <strong>Add Form Input</strong>\r\n <br>\r\n Manage your list by adding, editing, or removing items. Each item is customizable through a form.\r\n </span>\r\n </div>\r\n }\r\n </div>\r\n </mat-card-content>\r\n @if (innerInputs().length !== 0) {\r\n <mat-divider></mat-divider>\r\n <mat-card-actions align=\"end\" class=\"edit-card-actions\">\r\n <button [color]=\"areYouSure ? 'warn' : ''\"\r\n [class.confirm-leave]=\"areYouSure\" mat-button\r\n (click)=\"closeMultipleInput()\">\r\n {{ areYouSure ? \"leave without saving\" : \"cancel\" }}\r\n </button>\r\n @if (!inputConfig().readonly) {\r\n <button [disabled]=\"!!formInvalid()\" class=\"save-button\" color=\"primary\"\r\n (click)=\"saveMultipleInputForm()\" mat-raised-button>\r\n {{ rowInUpdate() ? \"Update\" : \"Save\" }}\r\n </button>\r\n }\r\n </mat-card-actions>\r\n }\r\n</mat-card>\r\n\r\n\r\n<mat-menu #calculationMenu=\"matMenu\">\r\n <ng-template matMenuContent let-inputId=\"sectionId\">\r\n @for (func of calculationFunctions; track func) {\r\n <button (click)=\"toggleFunction(func, inputId)\" mat-menu-item>\r\n {{ func }}\r\n @if (selectedFunction(func)) {\r\n <mat-icon color=\"primary\">check_circle</mat-icon>\r\n }\r\n </button>\r\n }\r\n </ng-template>\r\n</mat-menu>\r\n", styles: [".edit-card{margin-top:.5rem;background:var(--mat-sys-surface-container, #f3edf7);border-radius:12px}.inputCardElevated{background:var(--mat-sys-surface, #fef7ff);box-shadow:var(--mdc-elevated-card-container-elevation);transition:box-shadow .3s cubic-bezier(.16,1,.3,1)}.inputCard{box-shadow:none;transition:box-shadow .3s cubic-bezier(.16,1,.3,1)}.list{min-height:60px}.box{padding:.25rem;cursor:move}.input-actions{display:flex;align-items:center;gap:.125rem}.action-divider{width:1px;align-self:stretch;margin:.25rem;background:color-mix(in srgb,var(--mat-sys-outline, #79747e) 25%,transparent)}.countdown-button{display:flex;align-items:center}.cdk-drag-preview{box-sizing:border-box;border:none;border-radius:8px;box-shadow:0 5px 5px -3px color-mix(in srgb,var(--mat-sys-shadow, #000) 20%,transparent),0 8px 10px 1px color-mix(in srgb,var(--mat-sys-shadow, #000) 14%,transparent),0 3px 14px 2px color-mix(in srgb,var(--mat-sys-shadow, #000) 12%,transparent)}.cdk-drag-placeholder{opacity:0}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.box:last-child{border:none}.list.cdk-drop-list-dragging .box:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}.cancelProgress{height:24px!important;width:24px!important;margin-right:.3125rem}.edit-card-actions{gap:.5rem;padding:.5rem .75rem .75rem}.confirm-leave{text-decoration:underline}.save-button{min-width:10em}.tree-instructions{display:flex;align-items:center;gap:.5rem;padding:.75rem;background:color-mix(in srgb,var(--mat-sys-primary, #6750a4) 6%,transparent);border:1px solid color-mix(in srgb,var(--mat-sys-primary, #6750a4) 14%,transparent);border-radius:8px;margin-bottom:1rem;font-size:.8125rem;color:var(--mat-sys-on-surface-variant, #49454f)}.info-icon{min-width:38px!important;display:block;margin-top:4px;margin-bottom:auto}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3$2.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i1$1.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer", "cdkDropListHasAnchor"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i1$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.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: "component", type: i2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatCardModule }, { kind: "component", type: i3$3.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i3$3.MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { kind: "directive", type: i3$3.MatCardContent, selector: "mat-card-content" }, { kind: "ngmodule", type: MatDividerModule }, { kind: "component", type: i6$1.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i6.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i6.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i6.MatMenuContent, selector: "ng-template[matMenuContent]" }, { kind: "directive", type: i6.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i4$1.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i5$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
990
|
-
}
|
|
991
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: MultipleInputTableEditComponent, decorators: [{
|
|
992
|
-
type: Component,
|
|
993
|
-
args: [{ selector: 'lib-multiple-input-table-edit', imports: [
|
|
994
|
-
CommonModule,
|
|
995
|
-
DragDropModule,
|
|
996
|
-
MatButtonModule,
|
|
997
|
-
MatCardModule,
|
|
998
|
-
MatDividerModule,
|
|
999
|
-
MatIconModule,
|
|
1000
|
-
MatMenuModule,
|
|
1001
|
-
MatProgressSpinnerModule,
|
|
1002
|
-
MatTooltipModule,
|
|
1003
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, template: "<mat-card appearance=\"outlined\" class=\"edit-card mat-elevation-z4\">\r\n <mat-card-content>\r\n <div class=\"list row\" (cdkDropListDropped)=\"dropItems($event)\"\r\n [cdkDropListData]=\"innerInputs()\" cdkDropList #InputList=\"cdkDropList\">\r\n @for (innerInput of innerInputs(); track innerInput.id) {\r\n <ng-container>\r\n @if (editorMode()) {\r\n @if (!!formGroup()) {\r\n <mat-card (mouseover)=\"activeInput = innerInput.id\" cdkDrag\r\n (cdkDragStarted)=\"dragging = true\" (cdkDragReleased)=\"dragging = false\"\r\n [class.inputCardElevated]=\"activeInput === innerInput.id\"\r\n [class.inputCard]=\"activeInput !== innerInput.id\"\r\n [class]=\"'col-md-' + (dragging ? '12' : innerInput.colSize)\" class=\"box\">\r\n <ng-container *ngComponentOutlet=\"InputComponent;\r\n inputs: {\r\n inputConfig: innerInput,\r\n formGroup: formGroup(),\r\n formBuilderFunctions: formBuilderFunctions(),\r\n }\">\r\n </ng-container>\r\n @if (activeInput === innerInput.id) {\r\n <mat-card-actions class=\"input-actions\">\r\n <span class=\"spacer\"></span>\r\n <button [matTooltip]=\"'Edit Input: ' + innerInput.label\"\r\n (click)=\"editInput(innerInput)\" mat-icon-button>\r\n <mat-icon>edit</mat-icon>\r\n </button>\r\n @if (!!inputWillBeRemovedIn(innerInput.id)) {\r\n <button (mouseover)=\"overId = innerInput.id\" (mouseout)=\"overId = null\"\r\n (click)=\"removeInput(innerInput)\" color=\"warn\" mat-stroked-button>\r\n <div class=\"countdown-button\">\r\n <mat-progress-spinner class=\"cancelProgress\" color=\"primary\"\r\n [value]=\"((inputWillBeRemovedIn(innerInput.id) || 0) / 5) * 100\">\r\n </mat-progress-spinner>\r\n {{ overId === innerInput.id ? 'Click to cancel' : 'Deleting in' }}\r\n {{ inputWillBeRemovedIn(innerInput.id) }}\r\n </div>\r\n </button>\r\n } @else if (inputConfig().systemDefault !== true && innerInput.systemDefault !== true) {\r\n <button [matTooltip]=\"'Delete input ' + innerInput.label\"\r\n (click)=\"removeInput(innerInput)\" mat-icon-button>\r\n <mat-icon>delete</mat-icon>\r\n </button>\r\n }\r\n <span class=\"action-divider\"></span>\r\n @if (!!innerInput.showAsLabel && innerInput.dataType === 'number' || !!innerInput.showAsLabel && innerInput.type === 'number') {\r\n <button\r\n [matMenuTriggerFor]=\"calculationMenu\"\r\n [matMenuTriggerData]=\"{inputId:innerInput.originalId || innerInput.id}\"\r\n [matTooltip]=\"'calculate sum,avg,min,max'\"\r\n mat-icon-button>\r\n <mat-icon>calculate</mat-icon>\r\n </button>\r\n }\r\n <button [color]=\"innerInput.showAsLabel ? 'primary' : ''\"\r\n (click)=\"toggleLabel(innerInput)\"\r\n [matTooltip]=\"innerInput.showAsLabel ? 'Hide as label' : 'Show as label'\"\r\n mat-icon-button>\r\n <mat-icon>label</mat-icon>\r\n </button>\r\n <span class=\"spacer\"></span>\r\n </mat-card-actions>\r\n }\r\n </mat-card>\r\n }\r\n } @else {\r\n <div [class]=\"'col-md-' + (dragging ? '12' : innerInput.colSize)\" class=\"box\">\r\n <ng-container *ngComponentOutlet=\"InputComponent;\r\n inputs: {\r\n inputConfig: innerInput,\r\n formGroup: formGroup(),\r\n formBuilderFunctions: formBuilderFunctions(),\r\n }\">\r\n </ng-container>\r\n </div>\r\n }\r\n </ng-container>\r\n }\r\n @if (!!editorMode() && innerInputs().length === 0) {\r\n <div class=\"tree-instructions\">\r\n <mat-icon class=\"info-icon\" color=\"primary\">info</mat-icon>\r\n <span>\r\n <strong>Add Form Input</strong>\r\n <br>\r\n Manage your list by adding, editing, or removing items. Each item is customizable through a form.\r\n </span>\r\n </div>\r\n }\r\n </div>\r\n </mat-card-content>\r\n @if (innerInputs().length !== 0) {\r\n <mat-divider></mat-divider>\r\n <mat-card-actions align=\"end\" class=\"edit-card-actions\">\r\n <button [color]=\"areYouSure ? 'warn' : ''\"\r\n [class.confirm-leave]=\"areYouSure\" mat-button\r\n (click)=\"closeMultipleInput()\">\r\n {{ areYouSure ? \"leave without saving\" : \"cancel\" }}\r\n </button>\r\n @if (!inputConfig().readonly) {\r\n <button [disabled]=\"!!formInvalid()\" class=\"save-button\" color=\"primary\"\r\n (click)=\"saveMultipleInputForm()\" mat-raised-button>\r\n {{ rowInUpdate() ? \"Update\" : \"Save\" }}\r\n </button>\r\n }\r\n </mat-card-actions>\r\n }\r\n</mat-card>\r\n\r\n\r\n<mat-menu #calculationMenu=\"matMenu\">\r\n <ng-template matMenuContent let-inputId=\"sectionId\">\r\n @for (func of calculationFunctions; track func) {\r\n <button (click)=\"toggleFunction(func, inputId)\" mat-menu-item>\r\n {{ func }}\r\n @if (selectedFunction(func)) {\r\n <mat-icon color=\"primary\">check_circle</mat-icon>\r\n }\r\n </button>\r\n }\r\n </ng-template>\r\n</mat-menu>\r\n", styles: [".edit-card{margin-top:.5rem;background:var(--mat-sys-surface-container, #f3edf7);border-radius:12px}.inputCardElevated{background:var(--mat-sys-surface, #fef7ff);box-shadow:var(--mdc-elevated-card-container-elevation);transition:box-shadow .3s cubic-bezier(.16,1,.3,1)}.inputCard{box-shadow:none;transition:box-shadow .3s cubic-bezier(.16,1,.3,1)}.list{min-height:60px}.box{padding:.25rem;cursor:move}.input-actions{display:flex;align-items:center;gap:.125rem}.action-divider{width:1px;align-self:stretch;margin:.25rem;background:color-mix(in srgb,var(--mat-sys-outline, #79747e) 25%,transparent)}.countdown-button{display:flex;align-items:center}.cdk-drag-preview{box-sizing:border-box;border:none;border-radius:8px;box-shadow:0 5px 5px -3px color-mix(in srgb,var(--mat-sys-shadow, #000) 20%,transparent),0 8px 10px 1px color-mix(in srgb,var(--mat-sys-shadow, #000) 14%,transparent),0 3px 14px 2px color-mix(in srgb,var(--mat-sys-shadow, #000) 12%,transparent)}.cdk-drag-placeholder{opacity:0}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.box:last-child{border:none}.list.cdk-drop-list-dragging .box:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}.cancelProgress{height:24px!important;width:24px!important;margin-right:.3125rem}.edit-card-actions{gap:.5rem;padding:.5rem .75rem .75rem}.confirm-leave{text-decoration:underline}.save-button{min-width:10em}.tree-instructions{display:flex;align-items:center;gap:.5rem;padding:.75rem;background:color-mix(in srgb,var(--mat-sys-primary, #6750a4) 6%,transparent);border:1px solid color-mix(in srgb,var(--mat-sys-primary, #6750a4) 14%,transparent);border-radius:8px;margin-bottom:1rem;font-size:.8125rem;color:var(--mat-sys-on-surface-variant, #49454f)}.info-icon{min-width:38px!important;display:block;margin-top:4px;margin-bottom:auto}\n"] }]
|
|
1004
|
-
}], propDecorators: { inputConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputConfig", required: true }] }], editorMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "editorMode", required: false }] }], formGroup: [{ type: i0.Input, args: [{ isSignal: true, alias: "formGroup", required: false }] }], formBuilderFunctions: [{ type: i0.Input, args: [{ isSignal: true, alias: "formBuilderFunctions", required: false }] }], onSaveMultipleInputForm: [{ type: i0.Output, args: ["onSaveMultipleInputForm"] }], editMultipleInput: [{ type: i0.Output, args: ["editMultipleInput"] }], deleteInput: [{ type: i0.Output, args: ["deleteInput"] }], showItemAsLabel: [{ type: i0.Output, args: ["showItemAsLabel"] }], addFunction: [{ type: i0.Output, args: ["addFunction"] }], reorderItems: [{ type: i0.Output, args: ["reorderItems"] }] } });
|
|
1005
|
-
|
|
1006
|
-
/**
|
|
1007
|
-
* Appends one summary row per list function (total, average, …) to `data`.
|
|
1008
|
-
*
|
|
1009
|
-
* Each aggregate is rounded with the rule of the sub-column it summarises
|
|
1010
|
-
* (`numberRounding.ts`), so a column of cents never shows a total of
|
|
1011
|
-
* `0.30000000000000004` and the summary row agrees with the rows above it.
|
|
1012
|
-
* A column without a rule keeps the raw aggregate, as before. `currencyDefaults`
|
|
1013
|
-
* is the consumer's currency, for a sub-column that names none.
|
|
1014
|
-
*/
|
|
1015
|
-
function getCaluculatedTableData(inputConfig, data, currencyDefaults = LIBRARY_CURRENCY_DEFAULTS) {
|
|
1016
|
-
try {
|
|
1017
|
-
if (!Array.isArray(data) || !inputConfig)
|
|
1018
|
-
return data;
|
|
1019
|
-
const input = inputConfig;
|
|
1020
|
-
const funcs = (input?.calculateListFunctions || []);
|
|
1021
|
-
const allUniqueFunctionNames = [
|
|
1022
|
-
...new Set(funcs.map((f) => f.func)),
|
|
1023
|
-
];
|
|
1024
|
-
const calculatedData = allUniqueFunctionNames.map((func) => {
|
|
1025
|
-
const newCalculatedData = {
|
|
1026
|
-
SYSTEM_KEY_PROPERTY_FOR_MULTIPLE_INPUTS_CALCULATION_FUNCTION: func,
|
|
1027
|
-
};
|
|
1028
|
-
funcs.filter((f) => f.func === func).forEach((f) => {
|
|
1029
|
-
const arrayValues = data.map((d) => Number(d[f.inputId]));
|
|
1030
|
-
const aggregate = calculateListOveralFunctions(func, arrayValues);
|
|
1031
|
-
newCalculatedData[f.inputId] = roundValueByRule(aggregate, childRoundingRule(input, f.inputId, currencyDefaults));
|
|
1032
|
-
});
|
|
1033
|
-
return newCalculatedData;
|
|
1034
|
-
});
|
|
1035
|
-
return [...data, ...calculatedData];
|
|
1036
|
-
}
|
|
1037
|
-
catch (error) {
|
|
1038
|
-
return data;
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
|
-
/**
|
|
1043
|
-
* Pure helpers behind the multiple-input spreadsheet import.
|
|
1044
|
-
*
|
|
1045
|
-
* Two concerns, both Angular-free so they can be tested directly:
|
|
1046
|
-
*
|
|
1047
|
-
* 1. {@link mapSpreadsheetRows} — matches a sheet's headers to the columns a
|
|
1048
|
-
* field expects (see `describeImportColumns` in the import controller's
|
|
1049
|
-
* `importTemplate.ts`, which also builds the template those columns are
|
|
1050
|
-
* offered in) and re-keys the rows by `formControlName`, the shape
|
|
1051
|
-
* `TFormImportController` validates.
|
|
1052
|
-
* 2. {@link coerceImportedRow} + {@link toMultipleInputRow} — turn a settled,
|
|
1053
|
-
* valid row into the composite-keyed record the table stores, with cells
|
|
1054
|
-
* coerced to the child's declared data type.
|
|
1055
|
-
*/
|
|
1056
|
-
/** Header comparison key: trimmed and case-folded. */
|
|
1057
|
-
const normalise = (header) => header.trim().toLowerCase();
|
|
1058
|
-
const isBlank = (value) => value === null || value === undefined || (typeof value === 'string' && value.trim() === '');
|
|
1059
|
-
const hasUsableId = (candidate) => candidate !== undefined &&
|
|
1060
|
-
candidate !== null &&
|
|
1061
|
-
!(typeof candidate === 'string' && candidate.trim().length === 0);
|
|
1062
|
-
/**
|
|
1063
|
-
* Matches a sheet's headers to `columns` and re-keys every row by column key.
|
|
1064
|
-
*
|
|
1065
|
-
* A header is claimed by the first column it matches — by exact key, then by
|
|
1066
|
-
* key or alias case-insensitively — and never by a second one. Headers that
|
|
1067
|
-
* claim nothing are reported as ignored rather than carried along, so an `id`
|
|
1068
|
-
* column or a bulk template's `$index` can never leak into a row. Cells that are
|
|
1069
|
-
* `null` / `undefined` are omitted (the field keeps its default); empty strings
|
|
1070
|
-
* are passed through, exactly as the bulk import receives them. A row whose
|
|
1071
|
-
* every mapped cell is blank is dropped.
|
|
1072
|
-
*/
|
|
1073
|
-
function mapSpreadsheetRows(columns, rawRows) {
|
|
1074
|
-
const headers = [...new Set(rawRows.flatMap((row) => (row && typeof row === 'object' ? Object.keys(row) : [])))];
|
|
1075
|
-
const headerByNorm = new Map();
|
|
1076
|
-
for (const header of headers) {
|
|
1077
|
-
const key = normalise(header);
|
|
1078
|
-
if (key && !headerByNorm.has(key))
|
|
1079
|
-
headerByNorm.set(key, header);
|
|
1080
|
-
}
|
|
1081
|
-
const claimed = new Set();
|
|
1082
|
-
const headerFor = new Map();
|
|
1083
|
-
for (const column of columns) {
|
|
1084
|
-
if (!column.importable)
|
|
1085
|
-
continue;
|
|
1086
|
-
let header;
|
|
1087
|
-
if (headers.includes(column.key) && !claimed.has(column.key)) {
|
|
1088
|
-
header = column.key;
|
|
1089
|
-
}
|
|
1090
|
-
else {
|
|
1091
|
-
for (const candidate of [column.key, ...column.aliases]) {
|
|
1092
|
-
const found = headerByNorm.get(normalise(candidate));
|
|
1093
|
-
if (found && !claimed.has(found)) {
|
|
1094
|
-
header = found;
|
|
1095
|
-
break;
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
|
-
}
|
|
1099
|
-
if (header) {
|
|
1100
|
-
claimed.add(header);
|
|
1101
|
-
headerFor.set(column.key, header);
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
const rows = [];
|
|
1105
|
-
for (const raw of rawRows) {
|
|
1106
|
-
if (!raw || typeof raw !== 'object')
|
|
1107
|
-
continue;
|
|
1108
|
-
const row = {};
|
|
1109
|
-
let hasValue = false;
|
|
1110
|
-
for (const [key, header] of headerFor) {
|
|
1111
|
-
const value = raw[header];
|
|
1112
|
-
if (value === null || value === undefined)
|
|
1113
|
-
continue;
|
|
1114
|
-
if (!isBlank(value))
|
|
1115
|
-
hasValue = true;
|
|
1116
|
-
row[key] = value;
|
|
1117
|
-
}
|
|
1118
|
-
if (hasValue)
|
|
1119
|
-
rows.push(row);
|
|
1120
|
-
}
|
|
1121
|
-
return {
|
|
1122
|
-
rows,
|
|
1123
|
-
matched: [...headerFor.keys()],
|
|
1124
|
-
ignored: headers.filter((header) => !claimed.has(header)),
|
|
1125
|
-
missingRequired: columns
|
|
1126
|
-
.filter((column) => column.importable && column.required && !headerFor.has(column.key))
|
|
1127
|
-
.map((column) => column.label),
|
|
1128
|
-
};
|
|
1129
|
-
}
|
|
1130
|
-
/**
|
|
1131
|
-
* Coerces one settled cell to the child's declared data type.
|
|
1132
|
-
*
|
|
1133
|
-
* Spreadsheet cells arrive as text; the form stores what its own inputs would
|
|
1134
|
-
* have produced — a number input a number, a toggle a boolean, a structured
|
|
1135
|
-
* input a parsed object. Anything that does not parse is returned unchanged
|
|
1136
|
-
* rather than blanked, and dates are left as the tower settled them (the
|
|
1137
|
-
* tower already accepts the string forms an export produces).
|
|
1138
|
-
*/
|
|
1139
|
-
function coerceCell(value, dataType) {
|
|
1140
|
-
if (value === null || value === undefined)
|
|
1141
|
-
return value;
|
|
1142
|
-
switch (dataType) {
|
|
1143
|
-
case InputDataTypes.Number: {
|
|
1144
|
-
if (typeof value !== 'string')
|
|
1145
|
-
return value;
|
|
1146
|
-
const text = value.trim();
|
|
1147
|
-
if (text === '')
|
|
1148
|
-
return value;
|
|
1149
|
-
const parsed = Number(text);
|
|
1150
|
-
return Number.isFinite(parsed) ? parsed : value;
|
|
1151
|
-
}
|
|
1152
|
-
case InputDataTypes.Boolean: {
|
|
1153
|
-
if (typeof value === 'boolean')
|
|
1154
|
-
return value;
|
|
1155
|
-
if (typeof value === 'number')
|
|
1156
|
-
return value !== 0;
|
|
1157
|
-
if (typeof value !== 'string')
|
|
1158
|
-
return value;
|
|
1159
|
-
const text = value.trim().toLowerCase();
|
|
1160
|
-
if (['true', 'yes', 'y', '1'].includes(text))
|
|
1161
|
-
return true;
|
|
1162
|
-
if (['false', 'no', 'n', '0'].includes(text))
|
|
1163
|
-
return false;
|
|
1164
|
-
return value;
|
|
1165
|
-
}
|
|
1166
|
-
case InputDataTypes.Array:
|
|
1167
|
-
case InputDataTypes.Object: {
|
|
1168
|
-
if (typeof value !== 'string')
|
|
1169
|
-
return value;
|
|
1170
|
-
const text = value.trim();
|
|
1171
|
-
const looksStructured = (text.startsWith('[') && text.endsWith(']')) || (text.startsWith('{') && text.endsWith('}'));
|
|
1172
|
-
if (!looksStructured)
|
|
1173
|
-
return value;
|
|
1174
|
-
try {
|
|
1175
|
-
return JSON.parse(text);
|
|
1176
|
-
}
|
|
1177
|
-
catch {
|
|
1178
|
-
return value;
|
|
1179
|
-
}
|
|
1180
|
-
}
|
|
1181
|
-
default:
|
|
1182
|
-
return value;
|
|
1183
|
-
}
|
|
1184
|
-
}
|
|
1185
|
-
/** Applies {@link coerceCell} to every cell of a settled row, by the matching child's `dataType`. */
|
|
1186
|
-
function coerceImportedRow(input, settled) {
|
|
1187
|
-
const byKey = childrenByFormControlName(input);
|
|
1188
|
-
const out = {};
|
|
1189
|
-
for (const [key, value] of Object.entries(settled)) {
|
|
1190
|
-
out[key] = coerceCell(value, byKey.get(key)?.dataType);
|
|
1191
|
-
}
|
|
1192
|
-
return out;
|
|
1193
|
-
}
|
|
1194
|
-
/**
|
|
1195
|
-
* Converts a settled row (keyed by child `formControlName`, plus `id`) into the
|
|
1196
|
-
* composite-keyed record the multiple-input table stores:
|
|
1197
|
-
* `{ "<inputId>.id": …, "<inputId>.<childId>": … }` — the same rewrite the tower
|
|
1198
|
-
* applies in `initializeFormValues`. A key that matches no child is kept
|
|
1199
|
-
* verbatim so nothing the tower produced is silently lost; a row without a
|
|
1200
|
-
* usable id is given a fresh one.
|
|
1201
|
-
*/
|
|
1202
|
-
function toMultipleInputRow(input, settled) {
|
|
1203
|
-
const byKey = childrenByFormControlName(input);
|
|
1204
|
-
const row = {};
|
|
1205
|
-
for (const [key, value] of Object.entries(settled)) {
|
|
1206
|
-
if (key === 'id')
|
|
1207
|
-
continue;
|
|
1208
|
-
const child = byKey.get(key);
|
|
1209
|
-
row[child ? `${input.id}.${child.id}` : key] = value;
|
|
1210
|
-
}
|
|
1211
|
-
const id = settled['id'];
|
|
1212
|
-
row[multipleInputRowIdKey(input.id)] = hasUsableId(id) ? id : v4();
|
|
1213
|
-
return row;
|
|
1214
|
-
}
|
|
1215
|
-
function childrenByFormControlName(input) {
|
|
1216
|
-
return new Map((input.formInputs ?? [])
|
|
1217
|
-
.filter((child) => !!child?.formControlName && !!child.id)
|
|
1218
|
-
.map((child) => [child.formControlName, child]));
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1221
|
-
/** Type offered to the browser when the writer reported none. */
|
|
1222
|
-
const FALLBACK_MIME_TYPE = 'application/octet-stream';
|
|
1223
|
-
/**
|
|
1224
|
-
* Offers the import template of a multiple-input field for download.
|
|
1225
|
-
*
|
|
1226
|
-
* Builds the template the library defines for the field (a data sheet with
|
|
1227
|
-
* the headers the import matches, a `Guide` sheet, and an `Options` sheet
|
|
1228
|
-
* listing the allowed options of its choice columns), has the host's writer
|
|
1229
|
-
* serialise it, and hands the file to the browser. The option lists are
|
|
1230
|
-
* loaded through {@link TFormImportController.loadMultipleInputOptions} — a
|
|
1231
|
-
* settled headless row — so a fetched list is spelled out, not just named;
|
|
1232
|
-
* when that load fails the template still downloads without the fetched
|
|
1233
|
-
* lists, and the failure goes to the application's `ErrorHandler`. Only
|
|
1234
|
-
* reachable when the host bound a writer through
|
|
1235
|
-
* `withSpreadsheetImport(parser, { writer })`; the add-row menu and the import
|
|
1236
|
-
* dialog both ask {@link available} before offering the download. Config-free,
|
|
1237
|
-
* so root-provided.
|
|
1238
|
-
*/
|
|
1239
|
-
class SpreadsheetTemplateService {
|
|
1240
|
-
#writer = inject(SPREADSHEET_WRITER, { optional: true });
|
|
1241
|
-
#platformId = inject(PLATFORM_ID);
|
|
1242
|
-
#document = inject(DOCUMENT);
|
|
1243
|
-
#importCtrl = inject(TFormImportController);
|
|
1244
|
-
#errorHandler = inject(ErrorHandler);
|
|
1245
|
-
/** Whether the host bound a writer, so a template can be offered at all. */
|
|
1246
|
-
get available() {
|
|
1247
|
-
return this.#writer !== null;
|
|
1248
|
-
}
|
|
1249
|
-
/**
|
|
1250
|
-
* Builds the template for `input` — its option lists loaded — has the
|
|
1251
|
-
* writer serialise it and offers the file for download. Rejects with the
|
|
1252
|
-
* writer's error verbatim (its message is meant for the user) and does
|
|
1253
|
-
* nothing outside a browser.
|
|
1254
|
-
*/
|
|
1255
|
-
async download(input) {
|
|
1256
|
-
if (!this.#writer) {
|
|
1257
|
-
throw new Error('No spreadsheet writer is bound — pass one to withSpreadsheetImport().');
|
|
1258
|
-
}
|
|
1259
|
-
if (!isPlatformBrowser(this.#platformId))
|
|
1260
|
-
return;
|
|
1261
|
-
const options = await this.#loadOptions(input);
|
|
1262
|
-
const file = await this.#writer(buildImportTemplate(input, { options }));
|
|
1263
|
-
saveFile(this.#document, file);
|
|
1264
|
-
}
|
|
1265
|
-
/**
|
|
1266
|
-
* The field's option lists, or `undefined` when they could not be loaded —
|
|
1267
|
-
* reported, not swallowed, and the template goes out without them.
|
|
1268
|
-
*/
|
|
1269
|
-
async #loadOptions(input) {
|
|
1270
|
-
try {
|
|
1271
|
-
return await this.#importCtrl.loadMultipleInputOptions(input);
|
|
1272
|
-
}
|
|
1273
|
-
catch (error) {
|
|
1274
|
-
this.#errorHandler.handleError(error);
|
|
1275
|
-
return undefined;
|
|
1276
|
-
}
|
|
1277
|
-
}
|
|
1278
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: SpreadsheetTemplateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1279
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: SpreadsheetTemplateService, providedIn: 'root' }); }
|
|
1280
|
-
}
|
|
1281
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: SpreadsheetTemplateService, decorators: [{
|
|
1282
|
-
type: Injectable,
|
|
1283
|
-
args: [{ providedIn: 'root' }]
|
|
1284
|
-
}] });
|
|
1285
|
-
/** Hands `file` to the browser as a download, through a transient anchor. */
|
|
1286
|
-
function saveFile(document, file) {
|
|
1287
|
-
const win = document.defaultView;
|
|
1288
|
-
if (!win)
|
|
1289
|
-
return;
|
|
1290
|
-
const blob = new Blob([file.data], { type: file.mimeType || FALLBACK_MIME_TYPE });
|
|
1291
|
-
const url = win.URL.createObjectURL(blob);
|
|
1292
|
-
const link = document.createElement('a');
|
|
1293
|
-
link.href = url;
|
|
1294
|
-
link.download = file.fileName;
|
|
1295
|
-
link.rel = 'noopener';
|
|
1296
|
-
document.body.appendChild(link);
|
|
1297
|
-
link.click();
|
|
1298
|
-
link.remove();
|
|
1299
|
-
win.URL.revokeObjectURL(url);
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
/** Error key prefix of a choice cell whose text fits several options; shown as a picker, not as an error. */
|
|
1303
|
-
const AMBIGUOUS_OPTION_KEY = 'ambiguousOption:';
|
|
1304
|
-
/** Longest cell text rendered before it is cut with an ellipsis. */
|
|
1305
|
-
const MAX_CELL_TEXT = 80;
|
|
1306
|
-
/** Short, user-facing wording for the validator keys the tower reports. */
|
|
1307
|
-
const ERROR_LABELS = {
|
|
1308
|
-
required: 'Required',
|
|
1309
|
-
min: 'Too low',
|
|
1310
|
-
max: 'Too high',
|
|
1311
|
-
minlength: 'Too short',
|
|
1312
|
-
maxlength: 'Too long',
|
|
1313
|
-
pattern: 'Wrong format',
|
|
1314
|
-
email: 'Not an email',
|
|
1315
|
-
invalidDate: 'Not a date',
|
|
1316
|
-
invalidOption: 'Not an option',
|
|
1317
|
-
ambiguousOption: 'Several matches',
|
|
1318
|
-
documentLookupFailed: 'Could not look up the transaction',
|
|
1319
|
-
invalidRichText: 'Not a rich-text document',
|
|
1320
|
-
};
|
|
1321
|
-
/** `'required.min'` → `'Required, Too low'`. Unknown keys are shown as they are. */
|
|
1322
|
-
function formatErrorKeys(keys) {
|
|
1323
|
-
return keys
|
|
1324
|
-
.split('.')
|
|
1325
|
-
.filter(Boolean)
|
|
1326
|
-
.map((key) => {
|
|
1327
|
-
const [head, ...rest] = key.split(':');
|
|
1328
|
-
const label = ERROR_LABELS[head ?? ''] ?? key;
|
|
1329
|
-
return rest.length ? `${label} (${rest.join(':')})` : label;
|
|
1330
|
-
})
|
|
1331
|
-
.join(', ');
|
|
1332
|
-
}
|
|
1333
|
-
/** The cell's error caption with the tie's own keys dropped — the picker answers those. */
|
|
1334
|
-
function plainCellError(state, key) {
|
|
1335
|
-
const others = (state.colErrors?.[key] ?? '')
|
|
1336
|
-
.split('.')
|
|
1337
|
-
.filter((k) => k && !k.startsWith(AMBIGUOUS_OPTION_KEY))
|
|
1338
|
-
.join('.');
|
|
1339
|
-
return others ? formatErrorKeys(others) : undefined;
|
|
1340
|
-
}
|
|
1341
|
-
/** `true` while a row waits on the user to settle a choice cell (its only route out of `invalid` is a pick). */
|
|
1342
|
-
function awaitsPick(state) {
|
|
1343
|
-
return state.status === 'invalid' && Object.values(state.optionChoices ?? {}).some((choices) => choices.length > 0);
|
|
1344
|
-
}
|
|
1345
|
-
/** How the row reads in the review: a repeat of an earlier row, a pick to make, or its status. */
|
|
1346
|
-
function reviewStatus(state) {
|
|
1347
|
-
if (state.duplicateOf !== undefined)
|
|
1348
|
-
return 'duplicate';
|
|
1349
|
-
return awaitsPick(state) ? 'choice' : state.status;
|
|
1350
|
-
}
|
|
1351
|
-
/** Keys of the children whose cell the import may rewrite — it accepts the option as the user sees it. */
|
|
1352
|
-
function choiceKeys(input) {
|
|
1353
|
-
return new Set((input.formInputs ?? [])
|
|
1354
|
-
.filter((child) => !!child?.formControlName && optionInputKind(child) !== undefined)
|
|
1355
|
-
.map((child) => child.formControlName));
|
|
1356
|
-
}
|
|
1357
|
-
/** The field's children by id, as columns — overridable validations are reported by input id. */
|
|
1358
|
-
function childrenById(input) {
|
|
1359
|
-
return new Map((input.formInputs ?? [])
|
|
1360
|
-
.filter((child) => !!child?.id && !!child.formControlName)
|
|
1361
|
-
.map((child) => [child.id, { key: child.formControlName, label: child.label || child.formControlName }]));
|
|
1362
|
-
}
|
|
1363
|
-
/**
|
|
1364
|
-
* A cell as one line of text: a linked transaction by its reference, a list
|
|
1365
|
-
* of primitives joined, a list of rows by its size, any other object as JSON.
|
|
1366
|
-
*/
|
|
1367
|
-
function cellText(value) {
|
|
1368
|
-
const text = plainText(value);
|
|
1369
|
-
return text.length > MAX_CELL_TEXT ? `${text.slice(0, MAX_CELL_TEXT - 1)}…` : text;
|
|
1370
|
-
}
|
|
1371
|
-
/**
|
|
1372
|
-
* What the sheet said for a choice cell, when it differs from the value the
|
|
1373
|
-
* import stored — a sheet that said "Acme Ltd" reads back as `sup-1`, which is
|
|
1374
|
-
* right but not what the user recognises, so both are shown.
|
|
1375
|
-
*/
|
|
1376
|
-
function typedText(state, key) {
|
|
1377
|
-
const typed = state.originalData?.[key];
|
|
1378
|
-
if (typed === null || typed === undefined || typeof typed === 'object')
|
|
1379
|
-
return undefined;
|
|
1380
|
-
const text = String(typed).trim();
|
|
1381
|
-
if (!text)
|
|
1382
|
-
return undefined;
|
|
1383
|
-
const stored = state.settledValue?.[key];
|
|
1384
|
-
if (stored === null || stored === undefined)
|
|
1385
|
-
return undefined;
|
|
1386
|
-
return normaliseOptionText(text) === normaliseOptionText(plainText(stored)) ? undefined : text;
|
|
1387
|
-
}
|
|
1388
|
-
/** One review cell: the settled text, what was typed, the caption, the picker. */
|
|
1389
|
-
function buildCell(state, column, isChoice) {
|
|
1390
|
-
const source = state.settledValue ?? state.originalData;
|
|
1391
|
-
const base = { key: column.key, label: column.label, text: cellText(source?.[column.key]) };
|
|
1392
|
-
const typed = isChoice ? typedText(state, column.key) : undefined;
|
|
1393
|
-
const withTyped = typed ? { ...base, typed } : base;
|
|
1394
|
-
const choices = state.optionChoices?.[column.key];
|
|
1395
|
-
if (choices?.length) {
|
|
1396
|
-
const error = plainCellError(state, column.key);
|
|
1397
|
-
return { ...withTyped, ...(error ? { error } : {}), choices: choices.map(tellApart) };
|
|
1398
|
-
}
|
|
1399
|
-
const errorKeys = state.colErrors?.[column.key];
|
|
1400
|
-
return errorKeys ? { ...withTyped, error: formatErrorKeys(errorKeys) } : withTyped;
|
|
1401
|
-
}
|
|
1402
|
-
/**
|
|
1403
|
-
* Everything wrong with a row, as a flat list addressed to the place it has
|
|
1404
|
-
* to be fixed: a failure of the row itself first, then each column's errors
|
|
1405
|
-
* (a tie as "pick one in the cell"), then the overridable warnings.
|
|
1406
|
-
*/
|
|
1407
|
-
function rowIssues(state, columns, children) {
|
|
1408
|
-
const issues = [];
|
|
1409
|
-
if (state.errorMessage)
|
|
1410
|
-
issues.push({ key: '', column: 'Row', message: state.errorMessage, kind: 'error' });
|
|
1411
|
-
for (const [key, keys] of Object.entries(state.colErrors ?? {})) {
|
|
1412
|
-
if (!keys)
|
|
1413
|
-
continue;
|
|
1414
|
-
const column = columns.find((c) => c.key === key)?.label ?? key;
|
|
1415
|
-
issues.push({ key, column, message: issueMessage(keys), kind: 'error' });
|
|
1416
|
-
}
|
|
1417
|
-
for (const [inputId, messages] of Object.entries(state.overridableErrors ?? {})) {
|
|
1418
|
-
const child = children.get(inputId);
|
|
1419
|
-
for (const message of messages) {
|
|
1420
|
-
issues.push({ key: child?.key ?? inputId, column: child?.label ?? inputId, message, kind: 'warning' });
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
return issues;
|
|
1424
|
-
}
|
|
1425
|
-
/**
|
|
1426
|
-
* Makes a choice's candidates tell apart in a picker: two candidates that read
|
|
1427
|
-
* the same (two options labelled "Beta") show their stored value as well.
|
|
1428
|
-
*/
|
|
1429
|
-
function tellApart(choice) {
|
|
1430
|
-
const labels = choice.candidates.map((candidate) => normaliseOptionText(candidate.label));
|
|
1431
|
-
return {
|
|
1432
|
-
text: choice.text,
|
|
1433
|
-
candidates: choice.candidates.map((candidate, index) => {
|
|
1434
|
-
const clashes = labels.some((label, other) => other !== index && label === labels[index]);
|
|
1435
|
-
const label = clashes ? `${candidate.label} (${String(candidate.value)})` : candidate.label;
|
|
1436
|
-
return { value: candidate.value, label: label.length > MAX_CELL_TEXT ? `${label.slice(0, MAX_CELL_TEXT - 1)}…` : label };
|
|
1437
|
-
}),
|
|
1438
|
-
};
|
|
1439
|
-
}
|
|
1440
|
-
/** A column's error keys in words, the tie spelled out as the pick it waits for. */
|
|
1441
|
-
function issueMessage(keys) {
|
|
1442
|
-
const parts = keys.split('.').filter(Boolean);
|
|
1443
|
-
const ties = parts.filter((k) => k.startsWith(AMBIGUOUS_OPTION_KEY)).map((k) => k.slice(AMBIGUOUS_OPTION_KEY.length));
|
|
1444
|
-
const rest = parts.filter((k) => !k.startsWith(AMBIGUOUS_OPTION_KEY));
|
|
1445
|
-
const out = [];
|
|
1446
|
-
if (ties.length)
|
|
1447
|
-
out.push(`Several matches for ${ties.map((tie) => `“${tie}”`).join(', ')} — pick one in the cell`);
|
|
1448
|
-
if (rest.length)
|
|
1449
|
-
out.push(formatErrorKeys(rest.join('.')));
|
|
1450
|
-
return out.join('. ');
|
|
1451
|
-
}
|
|
1452
|
-
function plainText(value) {
|
|
1453
|
-
if (value === null || value === undefined)
|
|
1454
|
-
return '';
|
|
1455
|
-
if (value instanceof Date)
|
|
1456
|
-
return Number.isNaN(value.getTime()) ? '' : value.toISOString().slice(0, 10);
|
|
1457
|
-
if (Array.isArray(value)) {
|
|
1458
|
-
if (value.every((entry) => entry === null || typeof entry !== 'object')) {
|
|
1459
|
-
return value.map((entry) => plainText(entry)).filter(Boolean).join(', ');
|
|
1460
|
-
}
|
|
1461
|
-
return `${value.length} ${value.length === 1 ? 'row' : 'rows'}`;
|
|
1462
|
-
}
|
|
1463
|
-
if (typeof value === 'object') {
|
|
1464
|
-
const linked = documentText(value);
|
|
1465
|
-
if (linked !== undefined)
|
|
1466
|
-
return linked;
|
|
1467
|
-
try {
|
|
1468
|
-
return JSON.stringify(value);
|
|
1469
|
-
}
|
|
1470
|
-
catch {
|
|
1471
|
-
return '';
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
return String(value);
|
|
1475
|
-
}
|
|
1476
|
-
/** A stored transaction link as the picker shows it: its reference, else its label, else its identifier. */
|
|
1477
|
-
function documentText(value) {
|
|
1478
|
-
if (typeof value['id'] !== 'string' || typeof value['workflowId'] !== 'string')
|
|
1479
|
-
return undefined;
|
|
1480
|
-
const reference = value['reference'];
|
|
1481
|
-
const label = value['label'];
|
|
1482
|
-
if (typeof reference === 'string' && reference.trim())
|
|
1483
|
-
return reference;
|
|
1484
|
-
if (typeof label === 'string' && label.trim())
|
|
1485
|
-
return label;
|
|
1486
|
-
return value['id'];
|
|
1487
|
-
}
|
|
1488
|
-
|
|
1489
|
-
/** The width the dialog opens at — and returns to when full screen is left. */
|
|
1490
|
-
const MULTIPLE_INPUT_IMPORT_DIALOG_WIDTH = 'min(72rem, 94vw)';
|
|
1491
|
-
/** Panel class carried while the dialog fills the viewport. */
|
|
1492
|
-
const FULLSCREEN_PANEL_CLASS = 'lib-multiple-input-import-dialog__panel--fullscreen';
|
|
1493
|
-
/** Chip label + icon per row status. Colour is never the only signal (GDP §2c). */
|
|
1494
|
-
const STATUS_META = {
|
|
1495
|
-
pending: { label: 'Queued', icon: 'schedule' },
|
|
1496
|
-
processing: { label: 'Checking', icon: 'hourglass_top' },
|
|
1497
|
-
valid: { label: 'Ready', icon: 'check_circle' },
|
|
1498
|
-
overridable: { label: 'Needs attention', icon: 'flag' },
|
|
1499
|
-
invalid: { label: 'Invalid', icon: 'error' },
|
|
1500
|
-
error: { label: 'Failed', icon: 'report' },
|
|
1501
|
-
duplicate: { label: 'Duplicate', icon: 'content_copy' },
|
|
1502
|
-
choice: { label: 'Pick a match', icon: 'rule' },
|
|
1503
|
-
};
|
|
1504
|
-
/** How a row never checked reads once the run was stopped. */
|
|
1505
|
-
const NOT_CHECKED = { label: 'Not checked', icon: 'block' };
|
|
1506
|
-
/** Statuses that still want something from the user before the row can be added. */
|
|
1507
|
-
const ATTENTION_STATUSES = new Set(['choice', 'overridable', 'invalid', 'error']);
|
|
1508
|
-
const EMPTY_PROGRESS = {
|
|
1509
|
-
total: 0,
|
|
1510
|
-
pending: 0,
|
|
1511
|
-
processing: 0,
|
|
1512
|
-
complete: 0,
|
|
1513
|
-
valid: 0,
|
|
1514
|
-
overridable: 0,
|
|
1515
|
-
invalid: 0,
|
|
1516
|
-
error: 0,
|
|
1517
|
-
duplicate: 0,
|
|
1518
|
-
rows: [],
|
|
1519
|
-
};
|
|
1520
|
-
/**
|
|
1521
|
-
* Modal that fills a multiple-input table from a spreadsheet.
|
|
1522
|
-
*
|
|
1523
|
-
* One dense surface, three steps. The setup: the file (a picker, a sheet
|
|
1524
|
-
* chooser when the workbook has several), the template to download when the
|
|
1525
|
-
* host bound a writer — otherwise the list of columns — and the columns a
|
|
1526
|
-
* row must be unique on, so a row repeating an earlier one is set aside as a
|
|
1527
|
-
* duplicate. Once rows are being checked, the setup folds into a single strip
|
|
1528
|
-
* so the review owns the dialog; either half re-opens on a click. A run can
|
|
1529
|
-
* be paused, resumed and stopped; rows a stopped run never reached read
|
|
1530
|
-
* *Not checked*, and what did settle can still be added.
|
|
1531
|
-
*
|
|
1532
|
-
* The review is a data-mapping tool, not a log: one line per row so a long
|
|
1533
|
-
* sheet is scanned at once, with a verdict pill, the counts by outcome, a
|
|
1534
|
-
* filter to the rows that still need the user, a filter that hides the
|
|
1535
|
-
* duplicates, and a column chooser that can narrow the table to the columns
|
|
1536
|
-
* something failed on. Every cell shows the value the row will carry; a
|
|
1537
|
-
* choice cell whose text was matched to an option also says what was typed;
|
|
1538
|
-
* a text that fits several options gets a picker in place, and a pick
|
|
1539
|
-
* re-checks that row alone. A row opens into a panel listing every issue in
|
|
1540
|
-
* words, against its column.
|
|
1541
|
-
*
|
|
1542
|
-
* Only rows that settle `valid` are added — the same bar the row editor's
|
|
1543
|
-
* Save button applies — so the dialog never puts a row in the table that the
|
|
1544
|
-
* form would have refused. The parser comes from {@link SPREADSHEET_PARSER};
|
|
1545
|
-
* this component is only reachable when one is bound. Internal to the
|
|
1546
|
-
* multiple-input element; not part of the public API.
|
|
1547
|
-
*/
|
|
1548
|
-
class MultipleInputImportDialogComponent {
|
|
1549
|
-
constructor() {
|
|
1550
|
-
this.#platformId = inject(PLATFORM_ID);
|
|
1551
|
-
this.#host = inject(ElementRef);
|
|
1552
|
-
this.#data = inject(MAT_DIALOG_DATA);
|
|
1553
|
-
this.#dialogRef = inject(MatDialogRef);
|
|
1554
|
-
this.#parser = inject(SPREADSHEET_PARSER);
|
|
1555
|
-
this.#importCtrl = inject(TFormImportController);
|
|
1556
|
-
this.#templates = inject(SpreadsheetTemplateService);
|
|
1557
|
-
/** The columns the sheet should carry — frozen for the dialog's lifetime. */
|
|
1558
|
-
this.columns = describeImportColumns(this.#data.input);
|
|
1559
|
-
/** The field's label, for the subtitle. */
|
|
1560
|
-
this.fieldLabel = this.#data.input.label || this.#data.input.formControlName || 'this list';
|
|
1561
|
-
/** File types offered by the picker. The host's parser decides what it actually reads. */
|
|
1562
|
-
this.accept = '.xlsx,.xlsm,.xls,.csv';
|
|
1563
|
-
/**
|
|
1564
|
-
* Whether a template can be downloaded (the host bound a writer). When it
|
|
1565
|
-
* can, the template stands in for the column list: the workbook carries the
|
|
1566
|
-
* headers and a guide, so there is nothing left to read off the dialog.
|
|
1567
|
-
*/
|
|
1568
|
-
this.canDownloadTemplate = this.#templates.available;
|
|
1569
|
-
/** Name of the template's guide sheet, for the wording beside the download. */
|
|
1570
|
-
this.guideSheet = TEMPLATE_GUIDE_SHEET;
|
|
1571
|
-
/** The columns a row may be required to be unique on: the field's own importable children. */
|
|
1572
|
-
this.keyOptions = (() => {
|
|
1573
|
-
const children = new Set([...childrenById(this.#data.input).values()].map((child) => child.key));
|
|
1574
|
-
return this.columns.filter((column) => column.importable && children.has(column.key)).map(({ key, label }) => ({ key, label }));
|
|
1575
|
-
})();
|
|
1576
|
-
this.#choiceKeys = choiceKeys(this.#data.input);
|
|
1577
|
-
this.#children = childrenById(this.#data.input);
|
|
1578
|
-
this.stage = signal('idle', ...(ngDevMode ? [{ debugName: "stage" }] : /* istanbul ignore next */ []));
|
|
1579
|
-
this.fileName = signal(undefined, ...(ngDevMode ? [{ debugName: "fileName" }] : /* istanbul ignore next */ []));
|
|
1580
|
-
this.error = signal(undefined, ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
1581
|
-
this.sheets = signal([], ...(ngDevMode ? [{ debugName: "sheets" }] : /* istanbul ignore next */ []));
|
|
1582
|
-
this.activeSheet = signal(undefined, ...(ngDevMode ? [{ debugName: "activeSheet" }] : /* istanbul ignore next */ []));
|
|
1583
|
-
this.mapping = signal(undefined, ...(ngDevMode ? [{ debugName: "mapping" }] : /* istanbul ignore next */ []));
|
|
1584
|
-
this.downloadingTemplate = signal(false, ...(ngDevMode ? [{ debugName: "downloadingTemplate" }] : /* istanbul ignore next */ []));
|
|
1585
|
-
this.templateError = signal(undefined, ...(ngDevMode ? [{ debugName: "templateError" }] : /* istanbul ignore next */ []));
|
|
1586
|
-
/** Children a row must be unique on; a row repeating an earlier row's values on all of them is set aside. */
|
|
1587
|
-
this.distinctKeys = signal([], ...(ngDevMode ? [{ debugName: "distinctKeys" }] : /* istanbul ignore next */ []));
|
|
1588
|
-
/** Whether the setup is shown in full, or folded into the strip. */
|
|
1589
|
-
this.setupOpen = signal(true, ...(ngDevMode ? [{ debugName: "setupOpen" }] : /* istanbul ignore next */ []));
|
|
1590
|
-
/** True while the dialog fills the viewport. */
|
|
1591
|
-
this.isFullscreen = signal(false, ...(ngDevMode ? [{ debugName: "isFullscreen" }] : /* istanbul ignore next */ []));
|
|
1592
|
-
/** True once a run was stopped with rows never checked. */
|
|
1593
|
-
this.stopped = signal(false, ...(ngDevMode ? [{ debugName: "stopped" }] : /* istanbul ignore next */ []));
|
|
1594
|
-
/** Rows being re-checked after an option pick; their pickers and the add button wait. */
|
|
1595
|
-
this.rechecking = signal(new Set(), ...(ngDevMode ? [{ debugName: "rechecking" }] : /* istanbul ignore next */ []));
|
|
1596
|
-
/** True while the table is narrowed to the rows that still need the user. */
|
|
1597
|
-
this.onlyAttention = signal(false, ...(ngDevMode ? [{ debugName: "onlyAttention" }] : /* istanbul ignore next */ []));
|
|
1598
|
-
/** True while the table hides the rows set aside as duplicates. */
|
|
1599
|
-
this.hideDuplicates = signal(false, ...(ngDevMode ? [{ debugName: "hideDuplicates" }] : /* istanbul ignore next */ []));
|
|
1600
|
-
/** Column keys the user has hidden to get the ones that matter side by side. */
|
|
1601
|
-
this.hiddenColumns = signal(new Set(), ...(ngDevMode ? [{ debugName: "hiddenColumns" }] : /* istanbul ignore next */ []));
|
|
1602
|
-
/** The one row whose detail panel is open, by index; `null` when none is. */
|
|
1603
|
-
this.expandedRow = signal(null, ...(ngDevMode ? [{ debugName: "expandedRow" }] : /* istanbul ignore next */ []));
|
|
1604
|
-
/** Live per-row states from the controller; only read while a run belongs to this dialog. */
|
|
1605
|
-
this.progress = toSignal(this.#importCtrl.progress$, { initialValue: EMPTY_PROGRESS });
|
|
1606
|
-
/** Where the controller's run stands — drives the pause / resume / stop controls. */
|
|
1607
|
-
this.runState = toSignal(this.#importCtrl.runState$, { initialValue: 'idle' });
|
|
1608
|
-
this.paused = computed(() => this.runState() === 'paused', ...(ngDevMode ? [{ debugName: "paused" }] : /* istanbul ignore next */ []));
|
|
1609
|
-
/** Reading the file or validating its rows — the picker and the sheet chooser wait. */
|
|
1610
|
-
this.busy = computed(() => this.stage() === 'reading' || this.stage() === 'validating', ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
1611
|
-
this.progressPct = computed(() => {
|
|
1612
|
-
const p = this.progress();
|
|
1613
|
-
return p.total ? Math.round(((p.complete + p.error) / p.total) * 100) : 0;
|
|
1614
|
-
}, ...(ngDevMode ? [{ debugName: "progressPct" }] : /* istanbul ignore next */ []));
|
|
1615
|
-
/** Row states of the current run, or none until the sheet has been mapped. */
|
|
1616
|
-
this.#states = computed(() => this.stage() === 'validating' || this.stage() === 'reviewed' ? this.progress().rows : [], ...(ngDevMode ? [{ debugName: "#states" }] : /* istanbul ignore next */ []));
|
|
1617
|
-
this.stats = computed(() => {
|
|
1618
|
-
let ready = 0;
|
|
1619
|
-
let duplicates = 0;
|
|
1620
|
-
let picking = 0;
|
|
1621
|
-
let overridable = 0;
|
|
1622
|
-
let blocked = 0;
|
|
1623
|
-
let failed = 0;
|
|
1624
|
-
let queued = 0;
|
|
1625
|
-
for (const state of this.#states()) {
|
|
1626
|
-
switch (reviewStatus(state)) {
|
|
1627
|
-
case 'valid':
|
|
1628
|
-
ready++;
|
|
1629
|
-
break;
|
|
1630
|
-
case 'duplicate':
|
|
1631
|
-
duplicates++;
|
|
1632
|
-
break;
|
|
1633
|
-
case 'choice':
|
|
1634
|
-
picking++;
|
|
1635
|
-
break;
|
|
1636
|
-
case 'overridable':
|
|
1637
|
-
overridable++;
|
|
1638
|
-
break;
|
|
1639
|
-
case 'invalid':
|
|
1640
|
-
blocked++;
|
|
1641
|
-
break;
|
|
1642
|
-
case 'error':
|
|
1643
|
-
failed++;
|
|
1644
|
-
break;
|
|
1645
|
-
default:
|
|
1646
|
-
queued++;
|
|
1647
|
-
}
|
|
1648
|
-
}
|
|
1649
|
-
return {
|
|
1650
|
-
total: this.#states().length,
|
|
1651
|
-
ready,
|
|
1652
|
-
duplicates,
|
|
1653
|
-
picking,
|
|
1654
|
-
overridable,
|
|
1655
|
-
blocked,
|
|
1656
|
-
failed,
|
|
1657
|
-
queued,
|
|
1658
|
-
needsAttention: picking + overridable + blocked + failed,
|
|
1659
|
-
};
|
|
1660
|
-
}, ...(ngDevMode ? [{ debugName: "stats" }] : /* istanbul ignore next */ []));
|
|
1661
|
-
/** Columns in the review: those a header fed, plus any that carry an error somewhere. */
|
|
1662
|
-
this.reviewColumns = computed(() => {
|
|
1663
|
-
const matched = new Set(this.mapping()?.matched ?? []);
|
|
1664
|
-
const withErrors = new Set(this.#states().flatMap((s) => Object.keys(s.colErrors ?? {})));
|
|
1665
|
-
return this.columns.filter((c) => matched.has(c.key) || withErrors.has(c.key));
|
|
1666
|
-
}, ...(ngDevMode ? [{ debugName: "reviewColumns" }] : /* istanbul ignore next */ []));
|
|
1667
|
-
/** The review columns the user has not hidden. */
|
|
1668
|
-
this.visibleColumns = computed(() => {
|
|
1669
|
-
const hidden = this.hiddenColumns();
|
|
1670
|
-
return this.reviewColumns().filter((column) => !hidden.has(column.key));
|
|
1671
|
-
}, ...(ngDevMode ? [{ debugName: "visibleColumns" }] : /* istanbul ignore next */ []));
|
|
1672
|
-
this.hiddenCount = computed(() => this.reviewColumns().length - this.visibleColumns().length, ...(ngDevMode ? [{ debugName: "hiddenCount" }] : /* istanbul ignore next */ []));
|
|
1673
|
-
this.reviewRows = computed(() => {
|
|
1674
|
-
const columns = this.visibleColumns();
|
|
1675
|
-
const stopped = this.stopped();
|
|
1676
|
-
return this.#states().map((state) => {
|
|
1677
|
-
const status = reviewStatus(state);
|
|
1678
|
-
const meta = status === 'pending' && stopped ? NOT_CHECKED : STATUS_META[status];
|
|
1679
|
-
return {
|
|
1680
|
-
index: state.rowIndex,
|
|
1681
|
-
status,
|
|
1682
|
-
label: meta.label,
|
|
1683
|
-
icon: meta.icon,
|
|
1684
|
-
held: status !== 'valid' && status !== 'pending' && status !== 'processing',
|
|
1685
|
-
cells: columns.map((column) => buildCell(state, column, this.#choiceKeys.has(column.key))),
|
|
1686
|
-
issues: rowIssues(state, this.columns, this.#children),
|
|
1687
|
-
...(state.duplicateOf === undefined ? {} : { duplicateOf: state.duplicateOf }),
|
|
1688
|
-
...(state.errorMessage ? { systemError: state.errorMessage } : {}),
|
|
1689
|
-
};
|
|
1690
|
-
});
|
|
1691
|
-
}, ...(ngDevMode ? [{ debugName: "reviewRows" }] : /* istanbul ignore next */ []));
|
|
1692
|
-
/** How many rows each column failed on — shown in the column chooser. */
|
|
1693
|
-
this.columnIssueCounts = computed(() => {
|
|
1694
|
-
const counts = new Map();
|
|
1695
|
-
for (const row of this.reviewRows()) {
|
|
1696
|
-
for (const key of new Set(row.issues.map((issue) => issue.key).filter(Boolean))) {
|
|
1697
|
-
counts.set(key, (counts.get(key) ?? 0) + 1);
|
|
1698
|
-
}
|
|
1699
|
-
}
|
|
1700
|
-
return counts;
|
|
1701
|
-
}, ...(ngDevMode ? [{ debugName: "columnIssueCounts" }] : /* istanbul ignore next */ []));
|
|
1702
|
-
/** The rows the table shows: every row, narrowed by whichever filters are on. */
|
|
1703
|
-
this.visibleRows = computed(() => {
|
|
1704
|
-
let rows = this.reviewRows();
|
|
1705
|
-
if (this.onlyAttention())
|
|
1706
|
-
rows = rows.filter((row) => ATTENTION_STATUSES.has(row.status));
|
|
1707
|
-
if (this.hideDuplicates())
|
|
1708
|
-
rows = rows.filter((row) => row.status !== 'duplicate');
|
|
1709
|
-
return rows;
|
|
1710
|
-
}, ...(ngDevMode ? [{ debugName: "visibleRows" }] : /* istanbul ignore next */ []));
|
|
1711
|
-
this.verdict = computed(() => {
|
|
1712
|
-
if (this.stage() === 'validating') {
|
|
1713
|
-
const state = this.runState();
|
|
1714
|
-
if (state === 'paused')
|
|
1715
|
-
return { kind: 'paused', icon: 'pause_circle', text: `Paused at ${this.progressPct()}%` };
|
|
1716
|
-
if (state === 'stopping')
|
|
1717
|
-
return { kind: 'busy', icon: 'hourglass_top', text: 'Stopping…' };
|
|
1718
|
-
return { kind: 'busy', icon: 'hourglass_top', text: `${this.progressPct()}%` };
|
|
1719
|
-
}
|
|
1720
|
-
const { needsAttention, queued } = this.stats();
|
|
1721
|
-
if (this.stopped() && queued > 0) {
|
|
1722
|
-
return { kind: 'stopped', icon: 'block', text: `Stopped — ${queued} not checked` };
|
|
1723
|
-
}
|
|
1724
|
-
if (needsAttention > 0) {
|
|
1725
|
-
return { kind: 'warn', icon: 'warning_amber', text: `${needsAttention} ${needsAttention === 1 ? 'needs' : 'need'} you` };
|
|
1726
|
-
}
|
|
1727
|
-
return { kind: 'ok', icon: 'check_circle', text: 'Ready' };
|
|
1728
|
-
}, ...(ngDevMode ? [{ debugName: "verdict" }] : /* istanbul ignore next */ []));
|
|
1729
|
-
/** The rows that can be added: settled with no error of any kind, and not a repeat of an earlier row. */
|
|
1730
|
-
this.#ready = computed(() => this.#states()
|
|
1731
|
-
.filter((s) => reviewStatus(s) === 'valid' && !!s.settledValue)
|
|
1732
|
-
.map((s) => s.settledValue), ...(ngDevMode ? [{ debugName: "#ready" }] : /* istanbul ignore next */ []));
|
|
1733
|
-
this.canAdd = computed(() => this.stage() === 'reviewed' && this.rechecking().size === 0 && this.#ready().length > 0, ...(ngDevMode ? [{ debugName: "canAdd" }] : /* istanbul ignore next */ []));
|
|
1734
|
-
this.addLabel = computed(() => {
|
|
1735
|
-
if (this.stage() !== 'reviewed' && this.stage() !== 'validating')
|
|
1736
|
-
return 'Add rows';
|
|
1737
|
-
const { ready, picking } = this.stats();
|
|
1738
|
-
if (ready > 0)
|
|
1739
|
-
return ready === 1 ? 'Add 1 row' : `Add ${ready} rows`;
|
|
1740
|
-
if (picking > 0)
|
|
1741
|
-
return picking === 1 ? 'Pick 1 match to continue' : `Pick ${picking} matches to continue`;
|
|
1742
|
-
return 'Nothing to add';
|
|
1743
|
-
}, ...(ngDevMode ? [{ debugName: "addLabel" }] : /* istanbul ignore next */ []));
|
|
1744
|
-
this.summary = computed(() => {
|
|
1745
|
-
const p = this.progress();
|
|
1746
|
-
const stage = this.stage();
|
|
1747
|
-
if (stage === 'validating') {
|
|
1748
|
-
const checked = p.complete + p.error;
|
|
1749
|
-
return this.paused()
|
|
1750
|
-
? `Paused — ${checked} of ${p.total} ${p.total === 1 ? 'row' : 'rows'} checked.`
|
|
1751
|
-
: `Checking row ${Math.min(checked + 1, p.total)} of ${p.total}…`;
|
|
1752
|
-
}
|
|
1753
|
-
if (stage !== 'reviewed')
|
|
1754
|
-
return '';
|
|
1755
|
-
const { total, ready, picking, duplicates, queued } = this.stats();
|
|
1756
|
-
const held = total - ready - picking - duplicates - queued;
|
|
1757
|
-
const existing = this.#data.existingRowCount;
|
|
1758
|
-
const parts = [`${ready} of ${total} ${total === 1 ? 'row' : 'rows'} can be added`];
|
|
1759
|
-
if (picking > 0)
|
|
1760
|
-
parts.push(`${picking} ${picking === 1 ? 'needs' : 'need'} a match picked`);
|
|
1761
|
-
if (duplicates > 0)
|
|
1762
|
-
parts.push(`${duplicates} ${duplicates === 1 ? 'repeats' : 'repeat'} an earlier row and will be left out`);
|
|
1763
|
-
if (held > 0)
|
|
1764
|
-
parts.push(`${held} ${held === 1 ? 'needs' : 'need'} attention and will be left out`);
|
|
1765
|
-
if (queued > 0)
|
|
1766
|
-
parts.push(`${queued} ${queued === 1 ? 'was' : 'were'} not checked — the run was stopped`);
|
|
1767
|
-
if (ready > 0 && existing > 0)
|
|
1768
|
-
parts.push(`the table already holds ${existing}`);
|
|
1769
|
-
return `${parts.join(' · ')}.`;
|
|
1770
|
-
}, ...(ngDevMode ? [{ debugName: "summary" }] : /* istanbul ignore next */ []));
|
|
1771
|
-
}
|
|
1772
|
-
#platformId;
|
|
1773
|
-
#host;
|
|
1774
|
-
#data;
|
|
1775
|
-
#dialogRef;
|
|
1776
|
-
#parser;
|
|
1777
|
-
#importCtrl;
|
|
1778
|
-
#templates;
|
|
1779
|
-
#choiceKeys;
|
|
1780
|
-
#children;
|
|
1781
|
-
/** Row states of the current run, or none until the sheet has been mapped. */
|
|
1782
|
-
#states;
|
|
1783
|
-
/** The rows that can be added: settled with no error of any kind, and not a repeat of an earlier row. */
|
|
1784
|
-
#ready;
|
|
1785
|
-
/** Tooltip for an expected column: what to type, and whether it is required. */
|
|
1786
|
-
columnTooltip(column) {
|
|
1787
|
-
if (!column.importable)
|
|
1788
|
-
return `${column.label} cannot be imported from a cell — add it in the row editor.`;
|
|
1789
|
-
return `${column.label} — ${column.required ? 'required' : 'optional'}. ${column.hint}`;
|
|
1790
|
-
}
|
|
1791
|
-
/** Downloads the field's import template; the writer's failure is shown beside the button. */
|
|
1792
|
-
async downloadTemplate() {
|
|
1793
|
-
if (!this.canDownloadTemplate || this.downloadingTemplate())
|
|
1794
|
-
return;
|
|
1795
|
-
this.templateError.set(undefined);
|
|
1796
|
-
this.downloadingTemplate.set(true);
|
|
1797
|
-
try {
|
|
1798
|
-
await this.#templates.download(this.#data.input);
|
|
1799
|
-
}
|
|
1800
|
-
catch (e) {
|
|
1801
|
-
this.templateError.set(messageOf(e, 'The template could not be created.'));
|
|
1802
|
-
}
|
|
1803
|
-
finally {
|
|
1804
|
-
this.downloadingTemplate.set(false);
|
|
1805
|
-
}
|
|
1806
|
-
}
|
|
1807
|
-
/** Opens the native picker. The input is cleared so choosing the same file again still fires `(change)`. */
|
|
1808
|
-
openFilePicker(uploader) {
|
|
1809
|
-
if (this.busy())
|
|
1810
|
-
return;
|
|
1811
|
-
uploader.value = '';
|
|
1812
|
-
uploader.click();
|
|
1813
|
-
}
|
|
1814
|
-
/** Reads the picked file. */
|
|
1815
|
-
async onFileSelected(event) {
|
|
1816
|
-
const target = event.target instanceof HTMLInputElement ? event.target : null;
|
|
1817
|
-
const file = target?.files?.[0];
|
|
1818
|
-
if (target)
|
|
1819
|
-
target.value = '';
|
|
1820
|
-
if (!file || this.busy())
|
|
1821
|
-
return;
|
|
1822
|
-
await this.#load(file);
|
|
1823
|
-
}
|
|
1824
|
-
/** Switches to another sheet of the loaded workbook and validates it. */
|
|
1825
|
-
async chooseSheet(sheet) {
|
|
1826
|
-
if (this.busy() || sheet.name === this.activeSheet())
|
|
1827
|
-
return;
|
|
1828
|
-
await this.#useSheet(sheet);
|
|
1829
|
-
}
|
|
1830
|
-
/** True when rows must be unique on this child. */
|
|
1831
|
-
isKey(key) {
|
|
1832
|
-
return this.distinctKeys().includes(key);
|
|
1833
|
-
}
|
|
1834
|
-
/**
|
|
1835
|
-
* Adds or removes a child from the unique keys. Rows already checked are
|
|
1836
|
-
* checked again with the new keys, so the duplicates change in place.
|
|
1837
|
-
*/
|
|
1838
|
-
async toggleKey(key) {
|
|
1839
|
-
if (this.busy())
|
|
1840
|
-
return;
|
|
1841
|
-
this.distinctKeys.update((keys) => (keys.includes(key) ? keys.filter((k) => k !== key) : [...keys, key]));
|
|
1842
|
-
const rows = this.mapping()?.rows;
|
|
1843
|
-
if (this.stage() === 'reviewed' && rows?.length)
|
|
1844
|
-
await this.#run(rows);
|
|
1845
|
-
}
|
|
1846
|
-
/** Unfolds the setup strip back into the setup section. */
|
|
1847
|
-
openSetup() {
|
|
1848
|
-
this.setupOpen.set(true);
|
|
1849
|
-
}
|
|
1850
|
-
/** Holds the run after the row being checked; the queue waits for {@link resumeRun}. */
|
|
1851
|
-
pauseRun() {
|
|
1852
|
-
if (this.stage() === 'validating')
|
|
1853
|
-
this.#importCtrl.pause();
|
|
1854
|
-
}
|
|
1855
|
-
resumeRun() {
|
|
1856
|
-
if (this.stage() === 'validating')
|
|
1857
|
-
this.#importCtrl.resume();
|
|
1858
|
-
}
|
|
1859
|
-
/** Ends the run after the row being checked; rows never reached read *Not checked*. */
|
|
1860
|
-
stopRun() {
|
|
1861
|
-
if (this.stage() === 'validating')
|
|
1862
|
-
this.#importCtrl.stop();
|
|
1863
|
-
}
|
|
1864
|
-
/** Checks every mapped row again — the way out of a stopped run. */
|
|
1865
|
-
async checkAgain() {
|
|
1866
|
-
const rows = this.mapping()?.rows;
|
|
1867
|
-
if (this.busy() || !rows?.length)
|
|
1868
|
-
return;
|
|
1869
|
-
await this.#run(rows);
|
|
1870
|
-
}
|
|
1871
|
-
/**
|
|
1872
|
-
* Toggles the dialog between its opening size and the full viewport. Done
|
|
1873
|
-
* through the dialog reference, so the overlay pane itself resizes; the
|
|
1874
|
-
* host attribute lets the content grow into the space.
|
|
1875
|
-
*/
|
|
1876
|
-
toggleFullscreen() {
|
|
1877
|
-
const next = !this.isFullscreen();
|
|
1878
|
-
this.isFullscreen.set(next);
|
|
1879
|
-
if (next) {
|
|
1880
|
-
this.#dialogRef.updateSize('100vw', '100vh');
|
|
1881
|
-
this.#dialogRef.addPanelClass(FULLSCREEN_PANEL_CLASS);
|
|
1882
|
-
}
|
|
1883
|
-
else {
|
|
1884
|
-
this.#dialogRef.updateSize(MULTIPLE_INPUT_IMPORT_DIALOG_WIDTH, '');
|
|
1885
|
-
this.#dialogRef.removePanelClass(FULLSCREEN_PANEL_CLASS);
|
|
1886
|
-
}
|
|
1887
|
-
}
|
|
1888
|
-
/** Narrows the table to the rows that still need the user, and back again. */
|
|
1889
|
-
toggleAttentionFilter() {
|
|
1890
|
-
this.onlyAttention.update((only) => !only);
|
|
1891
|
-
}
|
|
1892
|
-
/** Hides the rows set aside as duplicates — the rows that will be added are what is left — and back again. */
|
|
1893
|
-
toggleHideDuplicates() {
|
|
1894
|
-
this.hideDuplicates.update((hide) => !hide);
|
|
1895
|
-
}
|
|
1896
|
-
/** Shows or hides one column of the review. */
|
|
1897
|
-
toggleColumn(key) {
|
|
1898
|
-
this.hiddenColumns.update((hidden) => {
|
|
1899
|
-
const next = new Set(hidden);
|
|
1900
|
-
if (!next.delete(key))
|
|
1901
|
-
next.add(key);
|
|
1902
|
-
return next;
|
|
1903
|
-
});
|
|
1904
|
-
}
|
|
1905
|
-
/** Brings every column back into view. */
|
|
1906
|
-
showAllColumns() {
|
|
1907
|
-
this.hiddenColumns.set(new Set());
|
|
1908
|
-
}
|
|
1909
|
-
/**
|
|
1910
|
-
* Hides every column nothing failed on, so the columns that need mapping sit
|
|
1911
|
-
* side by side. A no-op when nothing failed, so it can never blank the table.
|
|
1912
|
-
*/
|
|
1913
|
-
showOnlyIssueColumns() {
|
|
1914
|
-
const counts = this.columnIssueCounts();
|
|
1915
|
-
if (counts.size === 0)
|
|
1916
|
-
return;
|
|
1917
|
-
this.hiddenColumns.set(new Set(this.reviewColumns().map((column) => column.key).filter((key) => !counts.has(key))));
|
|
1918
|
-
}
|
|
1919
|
-
isColumnVisible(key) {
|
|
1920
|
-
return !this.hiddenColumns().has(key);
|
|
1921
|
-
}
|
|
1922
|
-
/** Opens the row's detail panel, closing whichever was open; a second click closes it. */
|
|
1923
|
-
toggleRow(index) {
|
|
1924
|
-
this.expandedRow.set(this.expandedRow() === index ? null : index);
|
|
1925
|
-
}
|
|
1926
|
-
isRowOpen(index) {
|
|
1927
|
-
return this.expandedRow() === index;
|
|
1928
|
-
}
|
|
1929
|
-
/**
|
|
1930
|
-
* Opens the row a duplicate repeats and scrolls it into view — clearing the
|
|
1931
|
-
* attention filter first, since the original is a ready row that filter hides.
|
|
1932
|
-
*/
|
|
1933
|
-
jumpToRow(index) {
|
|
1934
|
-
this.onlyAttention.set(false);
|
|
1935
|
-
this.expandedRow.set(index);
|
|
1936
|
-
if (!isPlatformBrowser(this.#platformId))
|
|
1937
|
-
return;
|
|
1938
|
-
setTimeout(() => {
|
|
1939
|
-
this.#host.nativeElement.querySelector(`#mii-row-${index}`)?.scrollIntoView?.({ behavior: 'smooth', block: 'center' });
|
|
1940
|
-
});
|
|
1941
|
-
}
|
|
1942
|
-
/**
|
|
1943
|
-
* Applies the user's pick for a choice cell whose text fits several options
|
|
1944
|
-
* and re-checks that row alone. The pick goes into the row's raw data under
|
|
1945
|
-
* the column's key — the whole cell of a single select, the one matching
|
|
1946
|
-
* entry of a multi-select — so the re-run resolves it by stored value while
|
|
1947
|
-
* every other row stands.
|
|
1948
|
-
*/
|
|
1949
|
-
async pickOption(rowIndex, cell, choice, event) {
|
|
1950
|
-
const select = event.target instanceof HTMLSelectElement ? event.target : null;
|
|
1951
|
-
const candidate = select && select.value !== '' ? choice.candidates[Number(select.value)] : undefined;
|
|
1952
|
-
const state = this.#states().find((s) => s.rowIndex === rowIndex);
|
|
1953
|
-
if (!candidate || !state || this.rechecking().has(rowIndex))
|
|
1954
|
-
return;
|
|
1955
|
-
const child = (this.#data.input.formInputs ?? []).find((c) => c?.formControlName === cell.key);
|
|
1956
|
-
const multi = !!child && isMultiSelectInput(child);
|
|
1957
|
-
const row = applyOptionChoice(state.originalData, cell.key, choice.text, candidate.value, multi);
|
|
1958
|
-
this.error.set(undefined);
|
|
1959
|
-
this.rechecking.update((set) => new Set([...set, rowIndex]));
|
|
1960
|
-
try {
|
|
1961
|
-
await this.#importCtrl.rerunMultipleInputRow(rowIndex, row);
|
|
1962
|
-
}
|
|
1963
|
-
catch (e) {
|
|
1964
|
-
this.error.set(messageOf(e, 'The row could not be re-checked.'));
|
|
1965
|
-
}
|
|
1966
|
-
finally {
|
|
1967
|
-
this.rechecking.update((set) => {
|
|
1968
|
-
const next = new Set(set);
|
|
1969
|
-
next.delete(rowIndex);
|
|
1970
|
-
return next;
|
|
1971
|
-
});
|
|
1972
|
-
}
|
|
1973
|
-
}
|
|
1974
|
-
cancel() {
|
|
1975
|
-
if (this.busy())
|
|
1976
|
-
return;
|
|
1977
|
-
this.#dialogRef.close(undefined);
|
|
1978
|
-
}
|
|
1979
|
-
add() {
|
|
1980
|
-
if (!this.canAdd())
|
|
1981
|
-
return;
|
|
1982
|
-
this.#dialogRef.close(this.#ready());
|
|
1983
|
-
}
|
|
1984
|
-
async #load(file) {
|
|
1985
|
-
if (!isPlatformBrowser(this.#platformId))
|
|
1986
|
-
return;
|
|
1987
|
-
this.error.set(undefined);
|
|
1988
|
-
this.mapping.set(undefined);
|
|
1989
|
-
this.sheets.set([]);
|
|
1990
|
-
this.activeSheet.set(undefined);
|
|
1991
|
-
this.fileName.set(file.name);
|
|
1992
|
-
this.stage.set('reading');
|
|
1993
|
-
let sheets;
|
|
1994
|
-
try {
|
|
1995
|
-
const data = await readAsArrayBuffer(file);
|
|
1996
|
-
sheets = await this.#parser({ fileName: file.name, mimeType: file.type || '', data });
|
|
1997
|
-
}
|
|
1998
|
-
catch (e) {
|
|
1999
|
-
this.#fail(messageOf(e, 'Could not read the spreadsheet.'));
|
|
2000
|
-
return;
|
|
2001
|
-
}
|
|
2002
|
-
const usable = (sheets ?? []).filter((sheet) => !!sheet && Array.isArray(sheet.rows));
|
|
2003
|
-
if (usable.length === 0) {
|
|
2004
|
-
this.#fail('The spreadsheet has no sheets.');
|
|
2005
|
-
return;
|
|
2006
|
-
}
|
|
2007
|
-
this.sheets.set(usable);
|
|
2008
|
-
await this.#useSheet(this.#preferredSheet(usable));
|
|
2009
|
-
}
|
|
2010
|
-
/**
|
|
2011
|
-
* The sheet named after the field's `formControlName` when there is one —
|
|
2012
|
-
* the template's data sheet, or a bulk-import template's detail sheet —
|
|
2013
|
-
* otherwise the first.
|
|
2014
|
-
*/
|
|
2015
|
-
#preferredSheet(sheets) {
|
|
2016
|
-
const wanted = (this.#data.input.formControlName ?? '').trim().toLowerCase();
|
|
2017
|
-
const first = sheets[0];
|
|
2018
|
-
if (!wanted)
|
|
2019
|
-
return first;
|
|
2020
|
-
return sheets.find((sheet) => sheet.name.trim().toLowerCase() === wanted) ?? first;
|
|
2021
|
-
}
|
|
2022
|
-
async #useSheet(sheet) {
|
|
2023
|
-
this.error.set(undefined);
|
|
2024
|
-
this.activeSheet.set(sheet.name);
|
|
2025
|
-
const mapping = mapSpreadsheetRows(this.columns, sheet.rows);
|
|
2026
|
-
this.mapping.set(mapping);
|
|
2027
|
-
if (mapping.rows.length === 0) {
|
|
2028
|
-
this.#fail(sheet.rows.length === 0
|
|
2029
|
-
? `"${sheet.name}" has no rows below its headers.`
|
|
2030
|
-
: mapping.matched.length === 0
|
|
2031
|
-
? `No header in "${sheet.name}" matches a column of ${this.fieldLabel}.`
|
|
2032
|
-
: `"${sheet.name}" has no rows with a value in a recognised column.`);
|
|
2033
|
-
return;
|
|
2034
|
-
}
|
|
2035
|
-
await this.#run(mapping.rows);
|
|
2036
|
-
}
|
|
2037
|
-
/** Checks the mapped rows with the current unique keys; the setup folds into its strip meanwhile. */
|
|
2038
|
-
async #run(rows) {
|
|
2039
|
-
this.error.set(undefined);
|
|
2040
|
-
this.stage.set('validating');
|
|
2041
|
-
this.stopped.set(false);
|
|
2042
|
-
this.setupOpen.set(false);
|
|
2043
|
-
this.expandedRow.set(null);
|
|
2044
|
-
this.onlyAttention.set(false);
|
|
2045
|
-
this.hideDuplicates.set(false);
|
|
2046
|
-
this.hiddenColumns.set(new Set());
|
|
2047
|
-
this.#importCtrl.reset();
|
|
2048
|
-
try {
|
|
2049
|
-
await this.#importCtrl.runMultipleInputImport(this.#data.input, rows, { distinctKeys: this.distinctKeys() });
|
|
2050
|
-
}
|
|
2051
|
-
catch (e) {
|
|
2052
|
-
this.#fail(messageOf(e, 'The rows could not be checked.'));
|
|
2053
|
-
return;
|
|
2054
|
-
}
|
|
2055
|
-
// Rows still pending once the run has ended were never reached: the run was stopped.
|
|
2056
|
-
this.stopped.set(this.progress().pending > 0);
|
|
2057
|
-
this.stage.set('reviewed');
|
|
2058
|
-
}
|
|
2059
|
-
#fail(message) {
|
|
2060
|
-
this.error.set(message);
|
|
2061
|
-
this.stage.set('idle');
|
|
2062
|
-
this.setupOpen.set(true);
|
|
2063
|
-
}
|
|
2064
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: MultipleInputImportDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2065
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: MultipleInputImportDialogComponent, isStandalone: true, selector: "lib-multiple-input-import-dialog", host: { properties: { "attr.data-stage": "stage()", "attr.data-fullscreen": "isFullscreen() ? \"true\" : null" }, classAttribute: "lib-multiple-input-import-dialog" }, ngImport: i0, template: "<div mat-dialog-title class=\"mii__header\">\n <div class=\"mii__heading\">\n <span class=\"mii__title\">Import rows from a spreadsheet</span>\n <span class=\"mii__subtitle\">\n {{ fieldLabel }} \u00B7 every row is checked the way the form checks it, and only rows that pass are added.\n </span>\n </div>\n <button\n type=\"button\"\n mat-icon-button\n class=\"mii__fullscreen\"\n [matTooltip]=\"isFullscreen() ? 'Exit full screen' : 'Full screen'\"\n matTooltipPosition=\"left\"\n [attr.aria-label]=\"isFullscreen() ? 'Exit full screen' : 'Enter full screen'\"\n [attr.aria-pressed]=\"isFullscreen()\"\n (click)=\"toggleFullscreen()\"\n >\n <mat-icon aria-hidden=\"true\">{{ isFullscreen() ? 'fullscreen_exit' : 'fullscreen' }}</mat-icon>\n </button>\n</div>\n\n<mat-dialog-content class=\"mii__content\">\n <!-- The native input stays in the tree for keyboard and assistive access; the pick zone and the strip both open it. -->\n <input\n #uploader\n type=\"file\"\n class=\"mii-upload-input\"\n [accept]=\"accept\"\n [disabled]=\"busy()\"\n (change)=\"onFileSelected($event)\"\n aria-label=\"Choose a spreadsheet file\"\n />\n\n <ng-template #sheetChips>\n @for (sheet of sheets(); track sheet.name) {\n <button\n type=\"button\"\n class=\"mii-sheet\"\n [class.mii-sheet--active]=\"sheet.name === activeSheet()\"\n [attr.aria-pressed]=\"sheet.name === activeSheet()\"\n [disabled]=\"busy()\"\n (click)=\"chooseSheet(sheet)\"\n >\n {{ sheet.name }}\n </button>\n }\n </ng-template>\n\n @if (setupOpen()) {\n <!-- 1 \u00B7 Setup: the file and the template on one line; the sheet and the unique keys as aligned rows -->\n <section class=\"mii-section mii-setup\" aria-labelledby=\"mii-setup-label\">\n <span class=\"mii-section__label\" id=\"mii-setup-label\">Setup</span>\n\n <div class=\"mii-setup__row\">\n <button type=\"button\" class=\"mii-pick\" [class.mii-pick--busy]=\"busy()\" [disabled]=\"busy()\" (click)=\"openFilePicker(uploader)\">\n <mat-icon class=\"mii-pick__icon\" aria-hidden=\"true\">upload_file</mat-icon>\n <span class=\"mii-pick__text\">\n @if (fileName(); as name) {\n <span class=\"mii-pick__name\">{{ name }}</span>\n <span class=\"mii-pick__hint\">Choose another file to start over</span>\n } @else {\n <span class=\"mii-pick__name\">Choose a file</span>\n <span class=\"mii-pick__hint\">A workbook or CSV, with the headers in row 1</span>\n }\n </span>\n </button>\n\n @if (canDownloadTemplate) {\n <div class=\"mii-template\">\n <button\n type=\"button\"\n mat-stroked-button\n class=\"mii-template__button\"\n [disabled]=\"downloadingTemplate()\"\n (click)=\"downloadTemplate()\"\n >\n <mat-icon aria-hidden=\"true\">download</mat-icon>\n Download template\n </button>\n <span class=\"mii-template__hint\">\n Its first sheet carries the headers to fill in; the {{ guideSheet }} sheet says what goes in each column.\n Other columns are ignored.\n </span>\n </div>\n }\n </div>\n\n @if (templateError(); as message) {\n <p class=\"mii-alert mii-alert--error mii-template__error\" role=\"alert\">\n <mat-icon aria-hidden=\"true\">error</mat-icon>\n <span>{{ message }}</span>\n </p>\n }\n\n @if (!canDownloadTemplate) {\n <ul class=\"mii-columns\" aria-label=\"Columns the sheet should carry\" aria-describedby=\"mii-columns-hint\">\n @for (column of columns; track column.key) {\n <li\n class=\"mii-column\"\n [class.mii-column--required]=\"column.required && column.importable\"\n [class.mii-column--skipped]=\"!column.importable\"\n [matTooltip]=\"columnTooltip(column)\"\n >\n <span class=\"mii-column__key\">{{ column.key }}</span>\n @if (column.label !== column.key) {\n <span class=\"mii-column__label\">{{ column.label }}</span>\n }\n @if (column.required && column.importable) {\n <span class=\"mii-column__flag\">required</span>\n } @else if (!column.importable) {\n <span class=\"mii-column__flag\">not importable</span>\n }\n </li>\n }\n </ul>\n <p class=\"mii-section__hint\" id=\"mii-columns-hint\">\n Row 1 holds the headers. A header may be the column name above or the field's label; other columns are ignored.\n </p>\n }\n\n @if (sheets().length > 1 || keyOptions.length > 0) {\n <dl class=\"mii-fields\">\n @if (sheets().length > 1) {\n <div class=\"mii-field\">\n <dt class=\"mii-field__label\">Sheet</dt>\n <dd class=\"mii-field__value\" role=\"group\" aria-label=\"Sheet to import\">\n <ng-container *ngTemplateOutlet=\"sheetChips\" />\n </dd>\n </div>\n }\n @if (keyOptions.length > 0) {\n <div class=\"mii-field\">\n <dt class=\"mii-field__label\">Unique keys</dt>\n <dd class=\"mii-field__value\" role=\"group\" aria-label=\"Unique keys\" aria-describedby=\"mii-keys-hint\">\n @for (option of keyOptions; track option.key) {\n <button\n type=\"button\"\n class=\"mii-sheet mii-key\"\n [class.mii-sheet--active]=\"isKey(option.key)\"\n [attr.aria-pressed]=\"isKey(option.key)\"\n [disabled]=\"busy()\"\n (click)=\"toggleKey(option.key)\"\n >\n <mat-icon aria-hidden=\"true\">{{ isKey(option.key) ? 'check' : 'add' }}</mat-icon>\n {{ option.label }}\n </button>\n }\n <span class=\"mii-field__hint\" id=\"mii-keys-hint\">\n A row repeating an earlier row on every chosen column is set aside as a duplicate.\n </span>\n </dd>\n </div>\n }\n </dl>\n }\n </section>\n } @else {\n <!-- Once rows are being checked the setup folds into one line so the review owns the dialog. -->\n <div class=\"mii-strip\" role=\"group\" aria-label=\"Import setup\">\n <button type=\"button\" class=\"mii-strip__item\" aria-expanded=\"false\" (click)=\"openSetup()\">\n <mat-icon aria-hidden=\"true\">description</mat-icon>\n <span class=\"mii-strip__label\">File</span>\n <span class=\"mii-strip__value\">{{ fileName() }}</span>\n <mat-icon aria-hidden=\"true\" class=\"mii-strip__chevron\">expand_more</mat-icon>\n </button>\n @if (sheets().length > 1) {\n <div class=\"mii-sheets\" role=\"group\" aria-label=\"Sheet to import\">\n <span class=\"mii-sheets__label\">Sheet</span>\n <ng-container *ngTemplateOutlet=\"sheetChips\" />\n </div>\n }\n @if (keyOptions.length > 0) {\n <button type=\"button\" class=\"mii-strip__item\" aria-expanded=\"false\" (click)=\"openSetup()\">\n <mat-icon aria-hidden=\"true\">key</mat-icon>\n <span class=\"mii-strip__label\">Unique keys</span>\n <span class=\"mii-strip__value\">\n {{ distinctKeys().length ? distinctKeys().length + ' chosen' : 'None' }}\n </span>\n <mat-icon aria-hidden=\"true\" class=\"mii-strip__chevron\">expand_more</mat-icon>\n </button>\n }\n <span class=\"mii-strip__spacer\"></span>\n @if (canDownloadTemplate) {\n <button type=\"button\" class=\"mii-tool\" [disabled]=\"downloadingTemplate()\" (click)=\"downloadTemplate()\">\n <mat-icon aria-hidden=\"true\">download</mat-icon>\n <span>Template</span>\n </button>\n }\n <button type=\"button\" class=\"mii-tool mii-tool--reupload\" [disabled]=\"busy()\" (click)=\"openFilePicker(uploader)\">\n <mat-icon aria-hidden=\"true\">refresh</mat-icon>\n <span>Re-upload</span>\n </button>\n </div>\n @if (templateError(); as message) {\n <p class=\"mii-alert mii-alert--error mii-template__error\" role=\"alert\">\n <mat-icon aria-hidden=\"true\">error</mat-icon>\n <span>{{ message }}</span>\n </p>\n }\n }\n\n @if (error(); as message) {\n <p class=\"mii-alert mii-alert--error\" role=\"alert\">\n <mat-icon aria-hidden=\"true\">error</mat-icon>\n <span>{{ message }}</span>\n </p>\n }\n\n @if (mapping(); as m) {\n @if (m.missingRequired.length > 0) {\n <p class=\"mii-alert mii-alert--warn\" role=\"status\">\n <mat-icon aria-hidden=\"true\">warning</mat-icon>\n <span>\n No column for the required {{ m.missingRequired.length === 1 ? 'field' : 'fields' }}\n {{ m.missingRequired.join(', ') }}. Rows will not pass until the sheet carries\n {{ m.missingRequired.length === 1 ? 'it' : 'them' }}.\n </span>\n </p>\n }\n @if (m.ignored.length > 0) {\n <p class=\"mii-note\" role=\"status\">\n Ignored {{ m.ignored.length === 1 ? 'column' : 'columns' }}: {{ m.ignored.join(', ') }}\n </p>\n }\n }\n\n <!-- 2 \u00B7 Review -->\n @if (stage() === 'validating' || stage() === 'reviewed') {\n <section class=\"mii-section mii-section--review\" aria-labelledby=\"mii-review-label\">\n <span class=\"mii-section__label\" id=\"mii-review-label\">Review</span>\n\n @let s = stats();\n <!-- One compact bar: verdict, summary, counts by outcome, run and table controls -->\n <div class=\"mii-toolbar\">\n <div class=\"mii-toolbar__verdict\">\n @let v = verdict();\n <span class=\"mii-pill\" [attr.data-kind]=\"v.kind\">\n <mat-icon aria-hidden=\"true\">{{ v.icon }}</mat-icon>\n <span>{{ v.text }}</span>\n </span>\n <span class=\"mii-summary\" role=\"status\" aria-live=\"polite\">{{ summary() }}</span>\n </div>\n\n <div class=\"mii-toolbar__stats\" aria-label=\"Rows by outcome\">\n <span class=\"mii-status mii-status--count\" data-status=\"valid\" matTooltip=\"Rows that will be added\">\n <mat-icon aria-hidden=\"true\">check_circle</mat-icon><span>{{ s.ready }}</span>\n </span>\n @if (s.duplicates > 0) {\n <span class=\"mii-status mii-status--count\" data-status=\"duplicate\" matTooltip=\"Rows that repeat an earlier row \u2014 left out\">\n <mat-icon aria-hidden=\"true\">content_copy</mat-icon><span>{{ s.duplicates }}</span>\n </span>\n }\n @if (s.picking > 0) {\n <span class=\"mii-status mii-status--count\" data-status=\"choice\" matTooltip=\"Rows waiting on a match you pick\">\n <mat-icon aria-hidden=\"true\">rule</mat-icon><span>{{ s.picking }}</span>\n </span>\n }\n @if (s.overridable > 0) {\n <span class=\"mii-status mii-status--count\" data-status=\"overridable\" matTooltip=\"Rows with a warning to review\">\n <mat-icon aria-hidden=\"true\">flag</mat-icon><span>{{ s.overridable }}</span>\n </span>\n }\n @if (s.blocked > 0) {\n <span class=\"mii-status mii-status--count\" data-status=\"invalid\" matTooltip=\"Rows the sheet has to fix\">\n <mat-icon aria-hidden=\"true\">error</mat-icon><span>{{ s.blocked }}</span>\n </span>\n }\n @if (s.failed > 0) {\n <span class=\"mii-status mii-status--count\" data-status=\"error\" matTooltip=\"Rows that failed to check\">\n <mat-icon aria-hidden=\"true\">report</mat-icon><span>{{ s.failed }}</span>\n </span>\n }\n @if (s.queued > 0) {\n <span class=\"mii-status mii-status--count\" data-status=\"pending\" [matTooltip]=\"stopped() ? 'Rows never checked \u2014 the run was stopped' : 'Rows still queued'\">\n <mat-icon aria-hidden=\"true\">{{ stopped() ? 'block' : 'schedule' }}</mat-icon><span>{{ s.queued }}</span>\n </span>\n }\n </div>\n\n <div class=\"mii-toolbar__tools\">\n @if (stage() === 'validating') {\n <!-- The run itself: hold it between rows, or end it and keep what settled -->\n @if (paused()) {\n <button type=\"button\" class=\"mii-tool mii-tool--pause mii-tool--on\" matTooltip=\"Carry on checking the remaining rows\" (click)=\"resumeRun()\">\n <mat-icon aria-hidden=\"true\">play_arrow</mat-icon>\n <span>Resume</span>\n </button>\n } @else {\n <button type=\"button\" class=\"mii-tool mii-tool--pause\" [disabled]=\"runState() !== 'running'\" matTooltip=\"Hold the run after the row being checked\" (click)=\"pauseRun()\">\n <mat-icon aria-hidden=\"true\">pause</mat-icon>\n <span>Pause</span>\n </button>\n }\n <button type=\"button\" class=\"mii-tool mii-tool--stop\" [disabled]=\"runState() === 'stopping'\" matTooltip=\"End the run \u2014 rows checked so far stay; the rest are left unchecked\" (click)=\"stopRun()\">\n <mat-icon aria-hidden=\"true\">stop</mat-icon>\n <span>{{ runState() === 'stopping' ? 'Stopping\u2026' : 'Stop' }}</span>\n </button>\n } @else if (stopped()) {\n <button type=\"button\" class=\"mii-tool mii-tool--again\" matTooltip=\"Check every row again from the start\" (click)=\"checkAgain()\">\n <mat-icon aria-hidden=\"true\">replay</mat-icon>\n <span>Check again</span>\n </button>\n }\n @if (s.needsAttention > 0) {\n <button\n type=\"button\"\n class=\"mii-tool mii-tool--attention\"\n [class.mii-tool--on]=\"onlyAttention()\"\n [attr.aria-pressed]=\"onlyAttention()\"\n [matTooltip]=\"onlyAttention() ? 'Show every row again' : 'Hide the rows that are already ready'\"\n (click)=\"toggleAttentionFilter()\"\n >\n <mat-icon aria-hidden=\"true\">filter_alt</mat-icon>\n <span>{{ onlyAttention() ? 'Needs me' : 'All rows' }}</span>\n </button>\n }\n @if (s.duplicates > 0) {\n <button\n type=\"button\"\n class=\"mii-tool mii-tool--duplicates\"\n [class.mii-tool--on]=\"hideDuplicates()\"\n [attr.aria-pressed]=\"hideDuplicates()\"\n [matTooltip]=\"hideDuplicates() ? 'Show the duplicate rows again' : 'Hide the duplicate rows \u2014 what is left is what gets added'\"\n (click)=\"toggleHideDuplicates()\"\n >\n <mat-icon aria-hidden=\"true\">content_copy</mat-icon>\n <span>{{ hideDuplicates() ? 'Duplicates hidden' : 'Hide duplicates' }}</span>\n </button>\n }\n <button\n type=\"button\"\n class=\"mii-tool mii-tool--columns\"\n [class.mii-tool--on]=\"hiddenCount() > 0\"\n [matMenuTriggerFor]=\"columnMenu\"\n matTooltip=\"Choose which columns the table shows\"\n aria-label=\"Choose columns\"\n >\n <mat-icon aria-hidden=\"true\">view_column</mat-icon>\n <span>{{ hiddenCount() > 0 ? hiddenCount() + ' hidden' : 'Columns' }}</span>\n </button>\n </div>\n </div>\n\n <mat-menu #columnMenu=\"matMenu\">\n <button type=\"button\" mat-menu-item class=\"mii-col-menu__all\" (click)=\"showAllColumns()\">\n <mat-icon aria-hidden=\"true\">select_all</mat-icon>\n <span>Show all columns</span>\n </button>\n <button type=\"button\" mat-menu-item class=\"mii-col-menu__issues\" [disabled]=\"columnIssueCounts().size === 0\" (click)=\"showOnlyIssueColumns()\">\n <mat-icon aria-hidden=\"true\">filter_alt</mat-icon>\n <span>Only columns with issues</span>\n </button>\n @for (column of reviewColumns(); track column.key) {\n <button type=\"button\" mat-menu-item class=\"mii-col-menu__item\" (click)=\"toggleColumn(column.key); $event.stopPropagation()\">\n <mat-icon aria-hidden=\"true\">{{ isColumnVisible(column.key) ? 'check_box' : 'check_box_outline_blank' }}</mat-icon>\n <span>{{ column.label }}</span>\n @if (columnIssueCounts().get(column.key); as count) {\n <span class=\"mii-col-menu__count\"> ({{ count }})</span>\n }\n </button>\n }\n </mat-menu>\n\n @if (stage() === 'validating') {\n <mat-progress-bar class=\"mii-progress\" mode=\"determinate\" [value]=\"progressPct()\" aria-label=\"Validation progress\" />\n }\n\n <!-- The one thing the reviewer can fix here and now, spelled out -->\n @if (stage() === 'reviewed' && s.picking > 0) {\n <p class=\"mii-guide\" role=\"status\">\n <mat-icon aria-hidden=\"true\">rule</mat-icon>\n <span>\n <strong>{{ s.picking }} {{ s.picking === 1 ? 'row matches' : 'rows match' }} more than one option.</strong>\n Pick the one you meant in the amber cell \u2014 that row is re-checked on its own.\n </span>\n </p>\n }\n\n <div class=\"mii-scroll\">\n <table class=\"mii-table\">\n <thead>\n <tr>\n <th scope=\"col\" class=\"mii-th mii-th--expand\">\n <span class=\"mii-sr-only\">Details</span>\n </th>\n <th scope=\"col\" class=\"mii-th mii-th--index\">\n <span aria-hidden=\"true\">#</span>\n <span class=\"mii-sr-only\">Row</span>\n </th>\n <th scope=\"col\" class=\"mii-th\">Status</th>\n @for (column of visibleColumns(); track column.key) {\n <th scope=\"col\" class=\"mii-th\">{{ column.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of visibleRows(); track row.index) {\n <tr\n class=\"mii-row\"\n [class.mii-row--held]=\"row.held\"\n [class.mii-row--open]=\"isRowOpen(row.index)\"\n [attr.data-status]=\"row.status\"\n [attr.id]=\"'mii-row-' + row.index\"\n >\n <td class=\"mii-td mii-td--expand\">\n <button\n type=\"button\"\n class=\"mii-expand\"\n [class.mii-expand--open]=\"isRowOpen(row.index)\"\n [attr.aria-expanded]=\"isRowOpen(row.index)\"\n [attr.aria-label]=\"(isRowOpen(row.index) ? 'Hide' : 'Show') + ' details for row ' + (row.index + 1)\"\n (click)=\"toggleRow(row.index)\"\n >\n <mat-icon aria-hidden=\"true\">chevron_right</mat-icon>\n </button>\n </td>\n <td class=\"mii-td mii-td--index\">{{ row.index + 1 }}</td>\n <td class=\"mii-td mii-td--status\">\n <span class=\"mii-status-cell\">\n <span class=\"mii-status\" [attr.data-status]=\"row.status\">\n <mat-icon aria-hidden=\"true\">{{ rechecking().has(row.index) ? 'hourglass_top' : row.icon }}</mat-icon>\n <span>{{ rechecking().has(row.index) ? 'Checking' : row.label }}</span>\n </span>\n @if (row.issues.length > 0) {\n <span class=\"mii-badge\" [matTooltip]=\"row.issues.length + (row.issues.length === 1 ? ' issue' : ' issues') + ' \u2014 open the row to see them'\">\n {{ row.issues.length }}\n </span>\n }\n </span>\n </td>\n @for (cell of row.cells; track cell.key) {\n <td class=\"mii-td\" [class.mii-td--error]=\"!!cell.error\" [class.mii-td--choice]=\"!!cell.choices\">\n @if (cell.choices; as choices) {\n <!--\n The text fits several options. The pick is the whole\n cell of a single select, or the one matching entry of a\n multi-select; the row is re-checked as soon as it lands.\n -->\n <div class=\"mii-choice\" role=\"group\" [attr.aria-label]=\"'Pick a match for ' + cell.label\">\n @for (choice of choices; track choice.text) {\n <label class=\"mii-choice__item\">\n <span class=\"mii-choice__text\">\u201C{{ choice.text }}\u201D</span>\n <span class=\"mii-choice__field\">\n <select\n class=\"mii-choice__select\"\n [disabled]=\"rechecking().has(row.index)\"\n (change)=\"pickOption(row.index, cell, choice, $event)\"\n >\n <option value=\"\" selected disabled>{{ choice.candidates.length }} matches \u2014 pick one</option>\n @for (candidate of choice.candidates; track $index) {\n <option [value]=\"$index\">{{ candidate.label }}</option>\n }\n </select>\n <mat-icon class=\"mii-choice__chevron\" aria-hidden=\"true\">expand_more</mat-icon>\n </span>\n </label>\n }\n </div>\n } @else {\n <span class=\"mii-cell-line\">\n @if (cell.text) {\n <span class=\"mii-cell\" [attr.title]=\"cell.text\">{{ cell.text }}</span>\n } @else {\n <span class=\"mii-cell mii-cell--empty\" aria-hidden=\"true\">\u2014</span>\n }\n @if (cell.typed; as typed) {\n <!-- The import swapped what was typed for the option's stored value -->\n <mat-icon\n class=\"mii-cell__swap\"\n [matTooltip]=\"'Typed as \u201C' + typed + '\u201D \u2014 matched to ' + cell.text\"\n [attr.aria-label]=\"'Typed as ' + typed + ', matched to ' + cell.text\"\n >swap_horiz</mat-icon>\n }\n </span>\n }\n @if (cell.error) {\n <span class=\"mii-cell-error\">\n <mat-icon aria-hidden=\"true\">error</mat-icon>\n <span>{{ cell.error }}</span>\n </span>\n }\n </td>\n }\n </tr>\n @if (isRowOpen(row.index)) {\n <!-- Detail panel: everything about one row, in one place -->\n <tr class=\"mii-detail-row\">\n <td class=\"mii-td mii-td--detail\" [attr.colspan]=\"visibleColumns().length + 3\">\n <div class=\"mii-detail\">\n <div class=\"mii-detail__head\">\n <span class=\"mii-detail__title\">Row {{ row.index + 1 }}</span>\n <span class=\"mii-status\" [attr.data-status]=\"row.status\">\n <mat-icon aria-hidden=\"true\">{{ row.icon }}</mat-icon>\n <span>{{ row.label }}</span>\n </span>\n <span class=\"mii-detail__spacer\"></span>\n <button type=\"button\" class=\"mii-detail__close\" aria-label=\"Hide row details\" (click)=\"toggleRow(row.index)\">\n <mat-icon aria-hidden=\"true\">close</mat-icon>\n </button>\n </div>\n\n @if (row.systemError; as sys) {\n <p class=\"mii-detail__line mii-detail__line--sys\">\n <mat-icon aria-hidden=\"true\">bug_report</mat-icon>\n <span>{{ sys }}</span>\n </p>\n }\n\n @if (row.duplicateOf !== undefined) {\n <p class=\"mii-detail__line mii-detail__dup\">\n <mat-icon aria-hidden=\"true\">content_copy</mat-icon>\n <span>\n Same record as row {{ row.duplicateOf + 1 }} \u2014 left out.\n <button type=\"button\" class=\"mii-detail__link\" (click)=\"jumpToRow(row.duplicateOf)\">\n Go to row {{ row.duplicateOf + 1 }}\n </button>\n </span>\n </p>\n }\n\n @if (row.status === 'pending' && stopped()) {\n <p class=\"mii-detail__line mii-detail__dup\">\n <mat-icon aria-hidden=\"true\">block</mat-icon>\n <span>The run was stopped before this row was checked.</span>\n </p>\n } @else if (row.issues.length > 0) {\n <span class=\"mii-detail__label\">\n {{ row.issues.length }} {{ row.issues.length === 1 ? 'issue' : 'issues' }}\n </span>\n <ul class=\"mii-issues\">\n @for (issue of row.issues; track $index) {\n <li class=\"mii-issue\" [attr.data-kind]=\"issue.kind\">\n <mat-icon aria-hidden=\"true\">{{ issue.kind === 'warning' ? 'flag' : 'error_outline' }}</mat-icon>\n <span class=\"mii-issue__column\">{{ issue.column }}</span>\n <span class=\"mii-issue__message\">{{ issue.message }}</span>\n </li>\n }\n </ul>\n } @else if (!row.systemError && row.duplicateOf === undefined) {\n <p class=\"mii-detail__line mii-detail__clean\">\n <mat-icon aria-hidden=\"true\">check_circle</mat-icon>\n <span>Nothing wrong with this row \u2014 it will be added as shown.</span>\n </p>\n }\n </div>\n </td>\n </tr>\n }\n }\n </tbody>\n </table>\n\n @if (visibleRows().length === 0 && reviewRows().length > 0) {\n <p class=\"mii-empty\">No rows match the filters \u2014 everything else is ready.</p>\n }\n </div>\n </section>\n }\n</mat-dialog-content>\n\n<mat-dialog-actions class=\"mii__actions\">\n <button type=\"button\" mat-button class=\"mii__cancel\" [disabled]=\"busy()\" (click)=\"cancel()\">Cancel</button>\n <button type=\"button\" mat-flat-button color=\"primary\" class=\"mii__add\" [disabled]=\"!canAdd()\" (click)=\"add()\">\n {{ addLabel() }}\n </button>\n</mat-dialog-actions>\n", styles: [":host{--mii-outline-08: color-mix(in srgb, var(--lib-forms-outline) 8%, transparent);--mii-outline-12: color-mix(in srgb, var(--lib-forms-outline) 12%, transparent);--mii-outline-20: color-mix(in srgb, var(--lib-forms-outline) 20%, transparent);--mii-primary-06: color-mix(in srgb, var(--lib-forms-primary) 6%, transparent);--mii-primary-10: color-mix(in srgb, var(--lib-forms-primary) 10%, transparent);--mii-primary-14: color-mix(in srgb, var(--lib-forms-primary) 14%, transparent);--mii-primary-25: color-mix(in srgb, var(--lib-forms-primary) 25%, transparent);--mii-amber-06: color-mix(in srgb, var(--sem-amber) 6%, transparent);--mii-held: color-mix(in srgb, var(--lib-forms-on-surface-variant) 4%, transparent);--mii-control-height: 2rem;display:block;color:var(--lib-forms-on-surface)}:host([data-fullscreen=\"true\"]){display:flex;flex-direction:column;height:100%;min-height:0}:host([data-fullscreen=\"true\"]) .mii__content{flex:1 1 auto;max-height:none;min-height:0}:host([data-fullscreen=\"true\"]) .mii-section--review{flex:1 1 auto;min-height:0}:host([data-fullscreen=\"true\"]) .mii-scroll{flex:1 1 auto;max-height:none;min-height:0}.mii__header{display:flex;align-items:flex-start;gap:1rem;margin:0;padding:1.5rem 2rem 0}.mii__header:before{display:none}.mii__heading{display:flex;flex:1 1 auto;flex-direction:column;gap:.25rem;min-width:0}.mii__title{font-size:1.125rem;font-weight:500;letter-spacing:-.01em;line-height:1.3;color:var(--lib-forms-on-surface)}.mii__subtitle{font-size:.8125rem;line-height:1.5;color:var(--lib-forms-on-surface-variant)}.mii__fullscreen{flex-shrink:0;margin:-.5rem -.5rem 0 0;color:var(--lib-forms-on-surface-variant)}.mii__content{display:flex;flex-direction:column;gap:1.25rem;padding:1.25rem 2rem .5rem;max-height:82vh}.mii-section{display:flex;flex-direction:column;gap:.625rem}.mii-section__label{font-size:.625rem;font-weight:600;letter-spacing:.14em;text-transform:uppercase;color:var(--lib-forms-on-surface-variant)}.mii-section__hint{margin:0;font-size:.75rem;line-height:1.5;color:var(--lib-forms-on-surface-variant)}.mii-setup__row{display:flex;flex-wrap:wrap;align-items:stretch;gap:.75rem}.mii-upload-input{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.mii-pick{display:flex;flex:1 1 22rem;align-items:center;gap:.75rem;min-width:0;padding:.5rem .875rem;border:1px dashed var(--mii-outline-20);border-radius:var(--lib-forms-radius-md);background:var(--lib-forms-surface);font:inherit;text-align:left;color:var(--lib-forms-on-surface-variant);cursor:pointer;transition:border-color var(--lib-forms-duration) var(--lib-forms-easing),background-color var(--lib-forms-duration) var(--lib-forms-easing),color var(--lib-forms-duration) var(--lib-forms-easing)}.mii-pick:hover,.mii-pick:focus-visible{border-color:var(--lib-forms-primary);background:var(--mii-primary-06);color:var(--lib-forms-primary)}.mii-pick:focus-visible{outline:none;border-style:solid;box-shadow:0 0 0 3px var(--mii-primary-14)}.mii-pick--busy,.mii-pick:disabled{cursor:progress;opacity:.7}.mii-pick__icon{flex-shrink:0;font-size:1.25rem;width:1.25rem;height:1.25rem}.mii-pick__text{display:flex;flex-wrap:wrap;align-items:baseline;gap:.125rem .75rem;min-width:0}.mii-pick__name{font-size:.875rem;font-weight:500;color:var(--lib-forms-on-surface);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}.mii-pick__hint{font-size:.75rem}.mii-template{display:flex;flex:1 1 22rem;align-items:center;gap:.75rem;min-width:0;padding:.375rem .875rem .375rem .375rem;border:1px solid var(--mii-outline-12);border-radius:var(--lib-forms-radius-md);background:var(--lib-forms-surface-container-low)}.mii-template__button{flex-shrink:0}.mii-template__hint{min-width:0;font-size:.75rem;line-height:1.4;color:var(--lib-forms-on-surface-variant)}.mii-columns{display:flex;flex-wrap:wrap;gap:.375rem;margin:0;padding:0;list-style:none}.mii-column{display:inline-flex;align-items:baseline;gap:.375rem;padding:.25rem .625rem;border:1px solid var(--mii-outline-20);border-radius:var(--lib-forms-radius-pill);background:var(--lib-forms-surface-container-low);font-size:.75rem;line-height:1.2;color:var(--lib-forms-on-surface);transition:border-color var(--lib-forms-duration-hover) var(--lib-forms-easing),background-color var(--lib-forms-duration-hover) var(--lib-forms-easing)}.mii-column:hover{border-color:color-mix(in srgb,var(--lib-forms-primary) 40%,transparent);background:var(--mii-primary-06)}.mii-column--required{border-color:color-mix(in srgb,var(--lib-forms-primary) 30%,transparent)}.mii-column--skipped{color:var(--lib-forms-on-surface-variant);border-style:dashed}.mii-column__key{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.6875rem}.mii-column__label{font-size:.6875rem;color:var(--lib-forms-on-surface-variant)}.mii-column__flag{font-size:.5625rem;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--lib-forms-primary)}.mii-column--skipped .mii-column__flag{color:var(--lib-forms-on-surface-variant)}.mii-fields{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:.5rem 1rem;margin:0}.mii-field{display:contents}.mii-field__label{padding-top:.3125rem;font-size:.75rem;line-height:1.4;white-space:nowrap;color:var(--lib-forms-on-surface-variant)}.mii-field__value{display:flex;flex-wrap:wrap;align-items:center;gap:.375rem;margin:0;min-width:0}.mii-field__hint{flex-basis:100%;font-size:.6875rem;line-height:1.4;color:var(--lib-forms-on-surface-variant)}.mii-sheets{display:flex;flex-wrap:wrap;align-items:center;gap:.375rem}.mii-sheets__label{margin-right:.125rem;font-size:.75rem;color:var(--lib-forms-on-surface-variant)}.mii-sheet{display:inline-flex;align-items:center;gap:.25rem;min-height:1.75rem;padding:.1875rem .625rem;border:1px solid var(--mii-outline-20);border-radius:var(--lib-forms-radius-pill);background:var(--lib-forms-surface);font:inherit;font-size:.75rem;font-weight:500;color:var(--lib-forms-on-surface-variant);cursor:pointer;transition:border-color var(--lib-forms-duration-hover) var(--lib-forms-easing),background-color var(--lib-forms-duration-hover) var(--lib-forms-easing),color var(--lib-forms-duration-hover) var(--lib-forms-easing)}.mii-sheet mat-icon{font-size:.875rem;width:.875rem;height:.875rem}.mii-sheet:hover,.mii-sheet:focus-visible{border-color:color-mix(in srgb,var(--lib-forms-primary) 40%,transparent);background:var(--mii-primary-06);color:var(--lib-forms-primary)}.mii-sheet:focus-visible{outline:3px solid var(--mii-primary-25);outline-offset:1px}.mii-sheet--active{border-color:var(--lib-forms-primary);background:var(--mii-primary-10);color:var(--lib-forms-primary)}.mii-sheet:disabled{cursor:default;opacity:.6}.mii-strip{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem .75rem;padding:.375rem .625rem;border:1px solid var(--mii-outline-08);border-radius:var(--lib-forms-radius-md);background:var(--lib-forms-surface-container-low)}.mii-strip__item{display:inline-flex;align-items:center;gap:.375rem;min-width:0;min-height:var(--mii-control-height);padding:.25rem .5rem;border:0;border-radius:var(--lib-forms-radius-sm);background:transparent;font:inherit;font-size:.75rem;color:var(--lib-forms-on-surface);cursor:pointer;transition:background-color var(--lib-forms-duration-hover) var(--lib-forms-easing)}.mii-strip__item:hover,.mii-strip__item:focus-visible{background:var(--mii-primary-06)}.mii-strip__item:focus-visible{outline:3px solid var(--mii-primary-14);outline-offset:2px}.mii-strip__item mat-icon{flex-shrink:0;font-size:1rem;width:1rem;height:1rem;color:var(--lib-forms-on-surface-variant)}.mii-strip__label{font-size:.625rem;font-weight:600;letter-spacing:.14em;text-transform:uppercase;color:var(--lib-forms-on-surface-variant)}.mii-strip__value{max-width:18rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}.mii-strip__chevron{opacity:.6}.mii-strip__spacer{flex:1 1 auto}.mii-alert{display:flex;align-items:flex-start;gap:.5rem;margin:0;padding:.5rem .75rem;border-radius:var(--lib-forms-radius-sm);font-size:.75rem;line-height:1.5}.mii-alert mat-icon{flex-shrink:0;font-size:1rem;width:1rem;height:1rem;margin-top:.0625rem}.mii-alert--error{color:var(--sem-error);background:var(--sem-error-surface)}.mii-alert--warn{color:var(--sem-amber);background:var(--sem-amber-surface)}.mii-note{margin:0;font-size:.6875rem;line-height:1.5;color:var(--lib-forms-on-surface-variant)}.mii-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem 1rem}.mii-toolbar__verdict{display:flex;flex:1 1 22rem;align-items:center;gap:.625rem;min-width:0}.mii-toolbar__stats{display:flex;flex-wrap:wrap;align-items:center;gap:.25rem}.mii-toolbar__tools{display:flex;flex-wrap:wrap;align-items:center;gap:.25rem;margin-left:auto}.mii-summary{margin:0;min-width:0;font-size:.8125rem;line-height:1.4;color:var(--lib-forms-on-surface)}.mii-pill{display:inline-flex;flex-shrink:0;align-items:center;gap:.375rem;padding:.25rem .625rem;border:1px solid transparent;border-radius:var(--lib-forms-radius-pill);font-size:.6875rem;font-weight:600;letter-spacing:.08em;text-transform:uppercase;white-space:nowrap;line-height:1;color:var(--sem-slate);background:var(--sem-slate-surface);border-color:color-mix(in srgb,var(--sem-slate) 30%,transparent);transition:color var(--lib-forms-duration) var(--lib-forms-easing),background-color var(--lib-forms-duration) var(--lib-forms-easing),border-color var(--lib-forms-duration) var(--lib-forms-easing)}.mii-pill mat-icon{font-size:.875rem;width:.875rem;height:.875rem}.mii-pill[data-kind=ok]{color:var(--sem-emerald);background:var(--sem-emerald-surface);border-color:color-mix(in srgb,var(--sem-emerald) 30%,transparent)}.mii-pill[data-kind=warn],.mii-pill[data-kind=paused]{color:var(--sem-amber);background:var(--sem-amber-surface);border-color:color-mix(in srgb,var(--sem-amber) 30%,transparent)}.mii-tool{display:inline-flex;align-items:center;gap:.3125rem;min-height:1.75rem;padding:.1875rem .625rem;border:1px solid var(--mii-outline-20);border-radius:var(--lib-forms-radius-pill);background:transparent;font:inherit;font-size:.6875rem;font-weight:500;white-space:nowrap;color:var(--lib-forms-on-surface-variant);cursor:pointer;transition:border-color var(--lib-forms-duration-hover) var(--lib-forms-easing),background-color var(--lib-forms-duration-hover) var(--lib-forms-easing),color var(--lib-forms-duration-hover) var(--lib-forms-easing)}.mii-tool mat-icon{font-size:.875rem;width:.875rem;height:.875rem}.mii-tool:hover,.mii-tool:focus-visible{border-color:color-mix(in srgb,var(--lib-forms-primary) 40%,transparent);background:var(--mii-primary-06);color:var(--lib-forms-primary)}.mii-tool:focus-visible{outline:3px solid var(--mii-primary-25);outline-offset:1px}.mii-tool--on{border-color:var(--lib-forms-primary);background:var(--mii-primary-10);color:var(--lib-forms-primary)}.mii-tool:disabled{cursor:default;opacity:.4;pointer-events:none}.mii-col-menu__count{color:var(--lib-forms-on-surface-variant)}.mii-guide{display:flex;align-items:flex-start;gap:.5rem;margin:0;padding:.5rem .75rem;border-radius:var(--lib-forms-radius-sm);font-size:.75rem;line-height:1.5;color:var(--sem-amber);background:var(--sem-amber-surface)}.mii-guide mat-icon{flex-shrink:0;font-size:1rem;width:1rem;height:1rem;margin-top:.0625rem}.mii-guide strong{font-weight:600}.mii-progress{--mdc-linear-progress-track-height: .25rem;--mdc-linear-progress-active-indicator-height: .25rem;border-radius:var(--lib-forms-radius-pill);overflow:hidden}.mii-scroll{max-height:56vh;overflow:auto;border:1px solid var(--mii-outline-12);border-radius:var(--lib-forms-radius-md);background:var(--lib-forms-surface)}.mii-table{width:100%;border-collapse:separate;border-spacing:0;font-size:.75rem}.mii-th{position:sticky;top:0;z-index:1;padding:.5rem .75rem;text-align:left;font-size:.625rem;font-weight:600;letter-spacing:.14em;text-transform:uppercase;white-space:nowrap;color:var(--lib-forms-on-surface-variant);background:var(--lib-forms-surface-container-low)}.mii-th--expand{width:2rem;padding-right:0}.mii-th--index{width:2.25rem;text-align:right}.mii-td{height:2rem;padding:.25rem .75rem;vertical-align:middle;white-space:nowrap;color:var(--lib-forms-on-surface);transition:background-color var(--lib-forms-duration-hover) var(--lib-forms-easing)}.mii-td--expand{padding-right:0}.mii-td--index{text-align:right;font-variant-numeric:tabular-nums;color:var(--lib-forms-on-surface-variant)}.mii-status-cell{display:inline-flex;align-items:center;gap:.375rem}.mii-row:hover .mii-td{background:var(--mii-primary-06)}.mii-row--held .mii-td{background:var(--mii-held)}.mii-row[data-status=choice] .mii-td,.mii-row[data-status=overridable] .mii-td{background:var(--mii-amber-06)}.mii-row[data-status=duplicate] .mii-td{color:var(--lib-forms-on-surface-variant)}.mii-row--open .mii-td{background:var(--mii-primary-06)}.mii-expand{display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:0;border:0;border-radius:var(--lib-forms-radius-pill);background:transparent;color:var(--lib-forms-on-surface-variant);cursor:pointer;transition:background-color var(--lib-forms-duration-hover) var(--lib-forms-easing),color var(--lib-forms-duration-hover) var(--lib-forms-easing)}.mii-expand mat-icon{font-size:1.125rem;width:1.125rem;height:1.125rem;transition:transform var(--lib-forms-duration) var(--lib-forms-easing)}.mii-expand:hover,.mii-expand:focus-visible{background:var(--mii-primary-10);color:var(--lib-forms-primary)}.mii-expand:focus-visible{outline:3px solid var(--mii-primary-25);outline-offset:1px}.mii-expand--open mat-icon{transform:rotate(90deg)}.mii-badge{display:inline-flex;align-items:center;justify-content:center;min-width:1.125rem;height:1.125rem;padding:0 .3125rem;border-radius:var(--lib-forms-radius-pill);font-size:.625rem;font-weight:600;font-variant-numeric:tabular-nums;color:var(--lib-forms-on-surface-variant);background:var(--lib-forms-surface-container-high)}.mii-cell-line{display:inline-flex;align-items:center;gap:.3125rem;max-width:100%}.mii-cell{display:inline-block;max-width:16rem;overflow:hidden;text-overflow:ellipsis;vertical-align:bottom}.mii-cell--empty{color:var(--lib-forms-on-surface-variant)}.mii-cell__swap{flex-shrink:0;font-size:.875rem;width:.875rem;height:.875rem;color:var(--lib-forms-primary);cursor:help}.mii-cell-error{display:flex;align-items:center;gap:.25rem;margin-top:.125rem;font-size:.6875rem;font-weight:500;color:var(--sem-red)}.mii-cell-error mat-icon{font-size:.875rem;width:.875rem;height:.875rem}.mii-td--choice{white-space:normal;vertical-align:top}.mii-choice{display:flex;flex-direction:column;gap:.5rem;min-width:13rem}.mii-choice__item{display:flex;flex-direction:column;gap:.25rem}.mii-choice__text{font-size:.6875rem;color:var(--lib-forms-on-surface-variant)}.mii-choice__field{position:relative;display:block}.mii-choice__select{width:100%;min-height:var(--mii-control-height);padding:.25rem 2rem .25rem .625rem;border:1px solid var(--mii-outline-20);border-radius:var(--lib-forms-radius-md);background:var(--lib-forms-surface);font:inherit;font-size:.75rem;color:var(--lib-forms-on-surface);appearance:none;cursor:pointer;transition:border-color var(--lib-forms-duration-hover) var(--lib-forms-easing),box-shadow var(--lib-forms-duration-hover) var(--lib-forms-easing)}.mii-choice__select:hover{border-color:color-mix(in srgb,var(--lib-forms-primary) 40%,transparent)}.mii-choice__select:focus-visible{outline:none;border-color:var(--lib-forms-primary);box-shadow:0 0 0 3px var(--mii-primary-14)}.mii-choice__select:disabled{cursor:progress;opacity:.6}.mii-choice__chevron{position:absolute;top:50%;right:.5rem;width:1rem;height:1rem;font-size:1rem;transform:translateY(-50%);pointer-events:none;color:var(--lib-forms-on-surface-variant)}.mii-td--choice .mii-cell-error{margin-top:.375rem}.mii-status{display:inline-flex;align-items:center;gap:.3125rem;padding:.1875rem .5rem;border:1px solid transparent;border-radius:var(--lib-forms-radius-pill);font-size:.625rem;font-weight:600;letter-spacing:.08em;text-transform:uppercase;white-space:nowrap;line-height:1;color:var(--sem-slate);background:var(--sem-slate-surface);border-color:color-mix(in srgb,var(--sem-slate) 30%,transparent);transition:color var(--lib-forms-duration) var(--lib-forms-easing),background-color var(--lib-forms-duration) var(--lib-forms-easing),border-color var(--lib-forms-duration) var(--lib-forms-easing)}.mii-status mat-icon{font-size:.875rem;width:.875rem;height:.875rem}.mii-status--count{font-variant-numeric:tabular-nums}.mii-status[data-status=valid]{color:var(--sem-emerald);background:var(--sem-emerald-surface);border-color:color-mix(in srgb,var(--sem-emerald) 30%,transparent)}.mii-status[data-status=overridable],.mii-status[data-status=choice]{color:var(--sem-amber);background:var(--sem-amber-surface);border-color:color-mix(in srgb,var(--sem-amber) 30%,transparent)}.mii-status[data-status=invalid]{color:var(--sem-red);background:var(--sem-red-surface);border-color:color-mix(in srgb,var(--sem-red) 30%,transparent)}.mii-status[data-status=error]{color:var(--sem-rust);background:var(--sem-rust-surface);border-color:color-mix(in srgb,var(--sem-rust) 30%,transparent)}.mii-status[data-status=duplicate]{color:var(--sem-slate);background:var(--sem-slate-surface);border-color:color-mix(in srgb,var(--sem-slate) 30%,transparent)}.mii-td--detail{height:auto;padding:0 .75rem .75rem 2.75rem;white-space:normal}.mii-detail{display:flex;flex-direction:column;gap:.5rem;padding:.75rem 1rem;border:1px solid var(--mii-outline-12);border-radius:var(--lib-forms-radius-md);background:var(--lib-forms-surface-container-low)}.mii-detail__head{display:flex;align-items:center;gap:.625rem}.mii-detail__title{font-size:.875rem;font-weight:500;color:var(--lib-forms-on-surface)}.mii-detail__spacer{flex:1 1 auto}.mii-detail__close{display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:0;border:0;border-radius:var(--lib-forms-radius-pill);background:transparent;color:var(--lib-forms-on-surface-variant);cursor:pointer;transition:background-color var(--lib-forms-duration-hover) var(--lib-forms-easing)}.mii-detail__close mat-icon{font-size:1rem;width:1rem;height:1rem}.mii-detail__close:hover,.mii-detail__close:focus-visible{background:var(--mii-primary-10);color:var(--lib-forms-primary)}.mii-detail__close:focus-visible{outline:3px solid var(--mii-primary-25);outline-offset:1px}.mii-detail__label{font-size:.625rem;font-weight:600;letter-spacing:.14em;text-transform:uppercase;color:var(--lib-forms-on-surface-variant)}.mii-detail__line{display:flex;align-items:flex-start;gap:.375rem;margin:0;font-size:.75rem;line-height:1.5;color:var(--lib-forms-on-surface)}.mii-detail__line mat-icon{flex-shrink:0;font-size:.875rem;width:.875rem;height:.875rem;margin-top:.125rem}.mii-detail__line--sys{color:var(--sem-rust)}.mii-detail__dup{color:var(--lib-forms-on-surface-variant)}.mii-detail__clean{color:var(--sem-emerald)}.mii-detail__link{padding:0;border:0;background:transparent;font:inherit;font-weight:500;color:var(--lib-forms-primary);text-decoration:underline;text-underline-offset:.2em;cursor:pointer}.mii-detail__link:focus-visible{outline:3px solid var(--mii-primary-25);outline-offset:2px;border-radius:var(--lib-forms-radius-sm)}.mii-issues{display:flex;flex-direction:column;gap:.25rem;margin:0;padding:0;list-style:none}.mii-issue{display:grid;grid-template-columns:.875rem minmax(6rem,max-content) 1fr;align-items:start;gap:.25rem .625rem;font-size:.75rem;line-height:1.5}.mii-issue mat-icon{font-size:.875rem;width:.875rem;height:.875rem;margin-top:.125rem;color:var(--sem-red)}.mii-issue[data-kind=warning] mat-icon{color:var(--sem-amber)}.mii-issue__column{font-weight:500;color:var(--lib-forms-on-surface)}.mii-issue__message{color:var(--lib-forms-on-surface-variant)}.mii-empty{margin:0;padding:1.5rem;text-align:center;font-size:.875rem;color:var(--lib-forms-on-surface-variant)}.mii__actions{display:flex;justify-content:flex-end;gap:.75rem;padding:.75rem 2rem 1.5rem}.mii-sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}@media(max-width:40rem){.mii__header,.mii__content,.mii__actions{padding-left:1rem;padding-right:1rem}.mii-fields{grid-template-columns:minmax(0,1fr)}.mii-field__label{padding-top:0}.mii-toolbar__tools{margin-left:0}}@media(prefers-reduced-motion:reduce){.mii-column,.mii-pick,.mii-sheet,.mii-strip__item,.mii-tool,.mii-pill,.mii-td,.mii-expand,.mii-expand mat-icon,.mii-detail__close,.mii-choice__select,.mii-status{transition:none}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i1$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.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: "component", type: i2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i6.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i6.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i6.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i5$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2066
|
-
}
|
|
2067
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: MultipleInputImportDialogComponent, decorators: [{
|
|
2068
|
-
type: Component,
|
|
2069
|
-
args: [{ selector: 'lib-multiple-input-import-dialog', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: {
|
|
2070
|
-
'class': 'lib-multiple-input-import-dialog',
|
|
2071
|
-
'[attr.data-stage]': 'stage()',
|
|
2072
|
-
'[attr.data-fullscreen]': 'isFullscreen() ? "true" : null',
|
|
2073
|
-
}, imports: [NgTemplateOutlet, MatDialogModule, MatButtonModule, MatIconModule, MatMenuModule, MatProgressBarModule, MatTooltipModule], template: "<div mat-dialog-title class=\"mii__header\">\n <div class=\"mii__heading\">\n <span class=\"mii__title\">Import rows from a spreadsheet</span>\n <span class=\"mii__subtitle\">\n {{ fieldLabel }} \u00B7 every row is checked the way the form checks it, and only rows that pass are added.\n </span>\n </div>\n <button\n type=\"button\"\n mat-icon-button\n class=\"mii__fullscreen\"\n [matTooltip]=\"isFullscreen() ? 'Exit full screen' : 'Full screen'\"\n matTooltipPosition=\"left\"\n [attr.aria-label]=\"isFullscreen() ? 'Exit full screen' : 'Enter full screen'\"\n [attr.aria-pressed]=\"isFullscreen()\"\n (click)=\"toggleFullscreen()\"\n >\n <mat-icon aria-hidden=\"true\">{{ isFullscreen() ? 'fullscreen_exit' : 'fullscreen' }}</mat-icon>\n </button>\n</div>\n\n<mat-dialog-content class=\"mii__content\">\n <!-- The native input stays in the tree for keyboard and assistive access; the pick zone and the strip both open it. -->\n <input\n #uploader\n type=\"file\"\n class=\"mii-upload-input\"\n [accept]=\"accept\"\n [disabled]=\"busy()\"\n (change)=\"onFileSelected($event)\"\n aria-label=\"Choose a spreadsheet file\"\n />\n\n <ng-template #sheetChips>\n @for (sheet of sheets(); track sheet.name) {\n <button\n type=\"button\"\n class=\"mii-sheet\"\n [class.mii-sheet--active]=\"sheet.name === activeSheet()\"\n [attr.aria-pressed]=\"sheet.name === activeSheet()\"\n [disabled]=\"busy()\"\n (click)=\"chooseSheet(sheet)\"\n >\n {{ sheet.name }}\n </button>\n }\n </ng-template>\n\n @if (setupOpen()) {\n <!-- 1 \u00B7 Setup: the file and the template on one line; the sheet and the unique keys as aligned rows -->\n <section class=\"mii-section mii-setup\" aria-labelledby=\"mii-setup-label\">\n <span class=\"mii-section__label\" id=\"mii-setup-label\">Setup</span>\n\n <div class=\"mii-setup__row\">\n <button type=\"button\" class=\"mii-pick\" [class.mii-pick--busy]=\"busy()\" [disabled]=\"busy()\" (click)=\"openFilePicker(uploader)\">\n <mat-icon class=\"mii-pick__icon\" aria-hidden=\"true\">upload_file</mat-icon>\n <span class=\"mii-pick__text\">\n @if (fileName(); as name) {\n <span class=\"mii-pick__name\">{{ name }}</span>\n <span class=\"mii-pick__hint\">Choose another file to start over</span>\n } @else {\n <span class=\"mii-pick__name\">Choose a file</span>\n <span class=\"mii-pick__hint\">A workbook or CSV, with the headers in row 1</span>\n }\n </span>\n </button>\n\n @if (canDownloadTemplate) {\n <div class=\"mii-template\">\n <button\n type=\"button\"\n mat-stroked-button\n class=\"mii-template__button\"\n [disabled]=\"downloadingTemplate()\"\n (click)=\"downloadTemplate()\"\n >\n <mat-icon aria-hidden=\"true\">download</mat-icon>\n Download template\n </button>\n <span class=\"mii-template__hint\">\n Its first sheet carries the headers to fill in; the {{ guideSheet }} sheet says what goes in each column.\n Other columns are ignored.\n </span>\n </div>\n }\n </div>\n\n @if (templateError(); as message) {\n <p class=\"mii-alert mii-alert--error mii-template__error\" role=\"alert\">\n <mat-icon aria-hidden=\"true\">error</mat-icon>\n <span>{{ message }}</span>\n </p>\n }\n\n @if (!canDownloadTemplate) {\n <ul class=\"mii-columns\" aria-label=\"Columns the sheet should carry\" aria-describedby=\"mii-columns-hint\">\n @for (column of columns; track column.key) {\n <li\n class=\"mii-column\"\n [class.mii-column--required]=\"column.required && column.importable\"\n [class.mii-column--skipped]=\"!column.importable\"\n [matTooltip]=\"columnTooltip(column)\"\n >\n <span class=\"mii-column__key\">{{ column.key }}</span>\n @if (column.label !== column.key) {\n <span class=\"mii-column__label\">{{ column.label }}</span>\n }\n @if (column.required && column.importable) {\n <span class=\"mii-column__flag\">required</span>\n } @else if (!column.importable) {\n <span class=\"mii-column__flag\">not importable</span>\n }\n </li>\n }\n </ul>\n <p class=\"mii-section__hint\" id=\"mii-columns-hint\">\n Row 1 holds the headers. A header may be the column name above or the field's label; other columns are ignored.\n </p>\n }\n\n @if (sheets().length > 1 || keyOptions.length > 0) {\n <dl class=\"mii-fields\">\n @if (sheets().length > 1) {\n <div class=\"mii-field\">\n <dt class=\"mii-field__label\">Sheet</dt>\n <dd class=\"mii-field__value\" role=\"group\" aria-label=\"Sheet to import\">\n <ng-container *ngTemplateOutlet=\"sheetChips\" />\n </dd>\n </div>\n }\n @if (keyOptions.length > 0) {\n <div class=\"mii-field\">\n <dt class=\"mii-field__label\">Unique keys</dt>\n <dd class=\"mii-field__value\" role=\"group\" aria-label=\"Unique keys\" aria-describedby=\"mii-keys-hint\">\n @for (option of keyOptions; track option.key) {\n <button\n type=\"button\"\n class=\"mii-sheet mii-key\"\n [class.mii-sheet--active]=\"isKey(option.key)\"\n [attr.aria-pressed]=\"isKey(option.key)\"\n [disabled]=\"busy()\"\n (click)=\"toggleKey(option.key)\"\n >\n <mat-icon aria-hidden=\"true\">{{ isKey(option.key) ? 'check' : 'add' }}</mat-icon>\n {{ option.label }}\n </button>\n }\n <span class=\"mii-field__hint\" id=\"mii-keys-hint\">\n A row repeating an earlier row on every chosen column is set aside as a duplicate.\n </span>\n </dd>\n </div>\n }\n </dl>\n }\n </section>\n } @else {\n <!-- Once rows are being checked the setup folds into one line so the review owns the dialog. -->\n <div class=\"mii-strip\" role=\"group\" aria-label=\"Import setup\">\n <button type=\"button\" class=\"mii-strip__item\" aria-expanded=\"false\" (click)=\"openSetup()\">\n <mat-icon aria-hidden=\"true\">description</mat-icon>\n <span class=\"mii-strip__label\">File</span>\n <span class=\"mii-strip__value\">{{ fileName() }}</span>\n <mat-icon aria-hidden=\"true\" class=\"mii-strip__chevron\">expand_more</mat-icon>\n </button>\n @if (sheets().length > 1) {\n <div class=\"mii-sheets\" role=\"group\" aria-label=\"Sheet to import\">\n <span class=\"mii-sheets__label\">Sheet</span>\n <ng-container *ngTemplateOutlet=\"sheetChips\" />\n </div>\n }\n @if (keyOptions.length > 0) {\n <button type=\"button\" class=\"mii-strip__item\" aria-expanded=\"false\" (click)=\"openSetup()\">\n <mat-icon aria-hidden=\"true\">key</mat-icon>\n <span class=\"mii-strip__label\">Unique keys</span>\n <span class=\"mii-strip__value\">\n {{ distinctKeys().length ? distinctKeys().length + ' chosen' : 'None' }}\n </span>\n <mat-icon aria-hidden=\"true\" class=\"mii-strip__chevron\">expand_more</mat-icon>\n </button>\n }\n <span class=\"mii-strip__spacer\"></span>\n @if (canDownloadTemplate) {\n <button type=\"button\" class=\"mii-tool\" [disabled]=\"downloadingTemplate()\" (click)=\"downloadTemplate()\">\n <mat-icon aria-hidden=\"true\">download</mat-icon>\n <span>Template</span>\n </button>\n }\n <button type=\"button\" class=\"mii-tool mii-tool--reupload\" [disabled]=\"busy()\" (click)=\"openFilePicker(uploader)\">\n <mat-icon aria-hidden=\"true\">refresh</mat-icon>\n <span>Re-upload</span>\n </button>\n </div>\n @if (templateError(); as message) {\n <p class=\"mii-alert mii-alert--error mii-template__error\" role=\"alert\">\n <mat-icon aria-hidden=\"true\">error</mat-icon>\n <span>{{ message }}</span>\n </p>\n }\n }\n\n @if (error(); as message) {\n <p class=\"mii-alert mii-alert--error\" role=\"alert\">\n <mat-icon aria-hidden=\"true\">error</mat-icon>\n <span>{{ message }}</span>\n </p>\n }\n\n @if (mapping(); as m) {\n @if (m.missingRequired.length > 0) {\n <p class=\"mii-alert mii-alert--warn\" role=\"status\">\n <mat-icon aria-hidden=\"true\">warning</mat-icon>\n <span>\n No column for the required {{ m.missingRequired.length === 1 ? 'field' : 'fields' }}\n {{ m.missingRequired.join(', ') }}. Rows will not pass until the sheet carries\n {{ m.missingRequired.length === 1 ? 'it' : 'them' }}.\n </span>\n </p>\n }\n @if (m.ignored.length > 0) {\n <p class=\"mii-note\" role=\"status\">\n Ignored {{ m.ignored.length === 1 ? 'column' : 'columns' }}: {{ m.ignored.join(', ') }}\n </p>\n }\n }\n\n <!-- 2 \u00B7 Review -->\n @if (stage() === 'validating' || stage() === 'reviewed') {\n <section class=\"mii-section mii-section--review\" aria-labelledby=\"mii-review-label\">\n <span class=\"mii-section__label\" id=\"mii-review-label\">Review</span>\n\n @let s = stats();\n <!-- One compact bar: verdict, summary, counts by outcome, run and table controls -->\n <div class=\"mii-toolbar\">\n <div class=\"mii-toolbar__verdict\">\n @let v = verdict();\n <span class=\"mii-pill\" [attr.data-kind]=\"v.kind\">\n <mat-icon aria-hidden=\"true\">{{ v.icon }}</mat-icon>\n <span>{{ v.text }}</span>\n </span>\n <span class=\"mii-summary\" role=\"status\" aria-live=\"polite\">{{ summary() }}</span>\n </div>\n\n <div class=\"mii-toolbar__stats\" aria-label=\"Rows by outcome\">\n <span class=\"mii-status mii-status--count\" data-status=\"valid\" matTooltip=\"Rows that will be added\">\n <mat-icon aria-hidden=\"true\">check_circle</mat-icon><span>{{ s.ready }}</span>\n </span>\n @if (s.duplicates > 0) {\n <span class=\"mii-status mii-status--count\" data-status=\"duplicate\" matTooltip=\"Rows that repeat an earlier row \u2014 left out\">\n <mat-icon aria-hidden=\"true\">content_copy</mat-icon><span>{{ s.duplicates }}</span>\n </span>\n }\n @if (s.picking > 0) {\n <span class=\"mii-status mii-status--count\" data-status=\"choice\" matTooltip=\"Rows waiting on a match you pick\">\n <mat-icon aria-hidden=\"true\">rule</mat-icon><span>{{ s.picking }}</span>\n </span>\n }\n @if (s.overridable > 0) {\n <span class=\"mii-status mii-status--count\" data-status=\"overridable\" matTooltip=\"Rows with a warning to review\">\n <mat-icon aria-hidden=\"true\">flag</mat-icon><span>{{ s.overridable }}</span>\n </span>\n }\n @if (s.blocked > 0) {\n <span class=\"mii-status mii-status--count\" data-status=\"invalid\" matTooltip=\"Rows the sheet has to fix\">\n <mat-icon aria-hidden=\"true\">error</mat-icon><span>{{ s.blocked }}</span>\n </span>\n }\n @if (s.failed > 0) {\n <span class=\"mii-status mii-status--count\" data-status=\"error\" matTooltip=\"Rows that failed to check\">\n <mat-icon aria-hidden=\"true\">report</mat-icon><span>{{ s.failed }}</span>\n </span>\n }\n @if (s.queued > 0) {\n <span class=\"mii-status mii-status--count\" data-status=\"pending\" [matTooltip]=\"stopped() ? 'Rows never checked \u2014 the run was stopped' : 'Rows still queued'\">\n <mat-icon aria-hidden=\"true\">{{ stopped() ? 'block' : 'schedule' }}</mat-icon><span>{{ s.queued }}</span>\n </span>\n }\n </div>\n\n <div class=\"mii-toolbar__tools\">\n @if (stage() === 'validating') {\n <!-- The run itself: hold it between rows, or end it and keep what settled -->\n @if (paused()) {\n <button type=\"button\" class=\"mii-tool mii-tool--pause mii-tool--on\" matTooltip=\"Carry on checking the remaining rows\" (click)=\"resumeRun()\">\n <mat-icon aria-hidden=\"true\">play_arrow</mat-icon>\n <span>Resume</span>\n </button>\n } @else {\n <button type=\"button\" class=\"mii-tool mii-tool--pause\" [disabled]=\"runState() !== 'running'\" matTooltip=\"Hold the run after the row being checked\" (click)=\"pauseRun()\">\n <mat-icon aria-hidden=\"true\">pause</mat-icon>\n <span>Pause</span>\n </button>\n }\n <button type=\"button\" class=\"mii-tool mii-tool--stop\" [disabled]=\"runState() === 'stopping'\" matTooltip=\"End the run \u2014 rows checked so far stay; the rest are left unchecked\" (click)=\"stopRun()\">\n <mat-icon aria-hidden=\"true\">stop</mat-icon>\n <span>{{ runState() === 'stopping' ? 'Stopping\u2026' : 'Stop' }}</span>\n </button>\n } @else if (stopped()) {\n <button type=\"button\" class=\"mii-tool mii-tool--again\" matTooltip=\"Check every row again from the start\" (click)=\"checkAgain()\">\n <mat-icon aria-hidden=\"true\">replay</mat-icon>\n <span>Check again</span>\n </button>\n }\n @if (s.needsAttention > 0) {\n <button\n type=\"button\"\n class=\"mii-tool mii-tool--attention\"\n [class.mii-tool--on]=\"onlyAttention()\"\n [attr.aria-pressed]=\"onlyAttention()\"\n [matTooltip]=\"onlyAttention() ? 'Show every row again' : 'Hide the rows that are already ready'\"\n (click)=\"toggleAttentionFilter()\"\n >\n <mat-icon aria-hidden=\"true\">filter_alt</mat-icon>\n <span>{{ onlyAttention() ? 'Needs me' : 'All rows' }}</span>\n </button>\n }\n @if (s.duplicates > 0) {\n <button\n type=\"button\"\n class=\"mii-tool mii-tool--duplicates\"\n [class.mii-tool--on]=\"hideDuplicates()\"\n [attr.aria-pressed]=\"hideDuplicates()\"\n [matTooltip]=\"hideDuplicates() ? 'Show the duplicate rows again' : 'Hide the duplicate rows \u2014 what is left is what gets added'\"\n (click)=\"toggleHideDuplicates()\"\n >\n <mat-icon aria-hidden=\"true\">content_copy</mat-icon>\n <span>{{ hideDuplicates() ? 'Duplicates hidden' : 'Hide duplicates' }}</span>\n </button>\n }\n <button\n type=\"button\"\n class=\"mii-tool mii-tool--columns\"\n [class.mii-tool--on]=\"hiddenCount() > 0\"\n [matMenuTriggerFor]=\"columnMenu\"\n matTooltip=\"Choose which columns the table shows\"\n aria-label=\"Choose columns\"\n >\n <mat-icon aria-hidden=\"true\">view_column</mat-icon>\n <span>{{ hiddenCount() > 0 ? hiddenCount() + ' hidden' : 'Columns' }}</span>\n </button>\n </div>\n </div>\n\n <mat-menu #columnMenu=\"matMenu\">\n <button type=\"button\" mat-menu-item class=\"mii-col-menu__all\" (click)=\"showAllColumns()\">\n <mat-icon aria-hidden=\"true\">select_all</mat-icon>\n <span>Show all columns</span>\n </button>\n <button type=\"button\" mat-menu-item class=\"mii-col-menu__issues\" [disabled]=\"columnIssueCounts().size === 0\" (click)=\"showOnlyIssueColumns()\">\n <mat-icon aria-hidden=\"true\">filter_alt</mat-icon>\n <span>Only columns with issues</span>\n </button>\n @for (column of reviewColumns(); track column.key) {\n <button type=\"button\" mat-menu-item class=\"mii-col-menu__item\" (click)=\"toggleColumn(column.key); $event.stopPropagation()\">\n <mat-icon aria-hidden=\"true\">{{ isColumnVisible(column.key) ? 'check_box' : 'check_box_outline_blank' }}</mat-icon>\n <span>{{ column.label }}</span>\n @if (columnIssueCounts().get(column.key); as count) {\n <span class=\"mii-col-menu__count\"> ({{ count }})</span>\n }\n </button>\n }\n </mat-menu>\n\n @if (stage() === 'validating') {\n <mat-progress-bar class=\"mii-progress\" mode=\"determinate\" [value]=\"progressPct()\" aria-label=\"Validation progress\" />\n }\n\n <!-- The one thing the reviewer can fix here and now, spelled out -->\n @if (stage() === 'reviewed' && s.picking > 0) {\n <p class=\"mii-guide\" role=\"status\">\n <mat-icon aria-hidden=\"true\">rule</mat-icon>\n <span>\n <strong>{{ s.picking }} {{ s.picking === 1 ? 'row matches' : 'rows match' }} more than one option.</strong>\n Pick the one you meant in the amber cell \u2014 that row is re-checked on its own.\n </span>\n </p>\n }\n\n <div class=\"mii-scroll\">\n <table class=\"mii-table\">\n <thead>\n <tr>\n <th scope=\"col\" class=\"mii-th mii-th--expand\">\n <span class=\"mii-sr-only\">Details</span>\n </th>\n <th scope=\"col\" class=\"mii-th mii-th--index\">\n <span aria-hidden=\"true\">#</span>\n <span class=\"mii-sr-only\">Row</span>\n </th>\n <th scope=\"col\" class=\"mii-th\">Status</th>\n @for (column of visibleColumns(); track column.key) {\n <th scope=\"col\" class=\"mii-th\">{{ column.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of visibleRows(); track row.index) {\n <tr\n class=\"mii-row\"\n [class.mii-row--held]=\"row.held\"\n [class.mii-row--open]=\"isRowOpen(row.index)\"\n [attr.data-status]=\"row.status\"\n [attr.id]=\"'mii-row-' + row.index\"\n >\n <td class=\"mii-td mii-td--expand\">\n <button\n type=\"button\"\n class=\"mii-expand\"\n [class.mii-expand--open]=\"isRowOpen(row.index)\"\n [attr.aria-expanded]=\"isRowOpen(row.index)\"\n [attr.aria-label]=\"(isRowOpen(row.index) ? 'Hide' : 'Show') + ' details for row ' + (row.index + 1)\"\n (click)=\"toggleRow(row.index)\"\n >\n <mat-icon aria-hidden=\"true\">chevron_right</mat-icon>\n </button>\n </td>\n <td class=\"mii-td mii-td--index\">{{ row.index + 1 }}</td>\n <td class=\"mii-td mii-td--status\">\n <span class=\"mii-status-cell\">\n <span class=\"mii-status\" [attr.data-status]=\"row.status\">\n <mat-icon aria-hidden=\"true\">{{ rechecking().has(row.index) ? 'hourglass_top' : row.icon }}</mat-icon>\n <span>{{ rechecking().has(row.index) ? 'Checking' : row.label }}</span>\n </span>\n @if (row.issues.length > 0) {\n <span class=\"mii-badge\" [matTooltip]=\"row.issues.length + (row.issues.length === 1 ? ' issue' : ' issues') + ' \u2014 open the row to see them'\">\n {{ row.issues.length }}\n </span>\n }\n </span>\n </td>\n @for (cell of row.cells; track cell.key) {\n <td class=\"mii-td\" [class.mii-td--error]=\"!!cell.error\" [class.mii-td--choice]=\"!!cell.choices\">\n @if (cell.choices; as choices) {\n <!--\n The text fits several options. The pick is the whole\n cell of a single select, or the one matching entry of a\n multi-select; the row is re-checked as soon as it lands.\n -->\n <div class=\"mii-choice\" role=\"group\" [attr.aria-label]=\"'Pick a match for ' + cell.label\">\n @for (choice of choices; track choice.text) {\n <label class=\"mii-choice__item\">\n <span class=\"mii-choice__text\">\u201C{{ choice.text }}\u201D</span>\n <span class=\"mii-choice__field\">\n <select\n class=\"mii-choice__select\"\n [disabled]=\"rechecking().has(row.index)\"\n (change)=\"pickOption(row.index, cell, choice, $event)\"\n >\n <option value=\"\" selected disabled>{{ choice.candidates.length }} matches \u2014 pick one</option>\n @for (candidate of choice.candidates; track $index) {\n <option [value]=\"$index\">{{ candidate.label }}</option>\n }\n </select>\n <mat-icon class=\"mii-choice__chevron\" aria-hidden=\"true\">expand_more</mat-icon>\n </span>\n </label>\n }\n </div>\n } @else {\n <span class=\"mii-cell-line\">\n @if (cell.text) {\n <span class=\"mii-cell\" [attr.title]=\"cell.text\">{{ cell.text }}</span>\n } @else {\n <span class=\"mii-cell mii-cell--empty\" aria-hidden=\"true\">\u2014</span>\n }\n @if (cell.typed; as typed) {\n <!-- The import swapped what was typed for the option's stored value -->\n <mat-icon\n class=\"mii-cell__swap\"\n [matTooltip]=\"'Typed as \u201C' + typed + '\u201D \u2014 matched to ' + cell.text\"\n [attr.aria-label]=\"'Typed as ' + typed + ', matched to ' + cell.text\"\n >swap_horiz</mat-icon>\n }\n </span>\n }\n @if (cell.error) {\n <span class=\"mii-cell-error\">\n <mat-icon aria-hidden=\"true\">error</mat-icon>\n <span>{{ cell.error }}</span>\n </span>\n }\n </td>\n }\n </tr>\n @if (isRowOpen(row.index)) {\n <!-- Detail panel: everything about one row, in one place -->\n <tr class=\"mii-detail-row\">\n <td class=\"mii-td mii-td--detail\" [attr.colspan]=\"visibleColumns().length + 3\">\n <div class=\"mii-detail\">\n <div class=\"mii-detail__head\">\n <span class=\"mii-detail__title\">Row {{ row.index + 1 }}</span>\n <span class=\"mii-status\" [attr.data-status]=\"row.status\">\n <mat-icon aria-hidden=\"true\">{{ row.icon }}</mat-icon>\n <span>{{ row.label }}</span>\n </span>\n <span class=\"mii-detail__spacer\"></span>\n <button type=\"button\" class=\"mii-detail__close\" aria-label=\"Hide row details\" (click)=\"toggleRow(row.index)\">\n <mat-icon aria-hidden=\"true\">close</mat-icon>\n </button>\n </div>\n\n @if (row.systemError; as sys) {\n <p class=\"mii-detail__line mii-detail__line--sys\">\n <mat-icon aria-hidden=\"true\">bug_report</mat-icon>\n <span>{{ sys }}</span>\n </p>\n }\n\n @if (row.duplicateOf !== undefined) {\n <p class=\"mii-detail__line mii-detail__dup\">\n <mat-icon aria-hidden=\"true\">content_copy</mat-icon>\n <span>\n Same record as row {{ row.duplicateOf + 1 }} \u2014 left out.\n <button type=\"button\" class=\"mii-detail__link\" (click)=\"jumpToRow(row.duplicateOf)\">\n Go to row {{ row.duplicateOf + 1 }}\n </button>\n </span>\n </p>\n }\n\n @if (row.status === 'pending' && stopped()) {\n <p class=\"mii-detail__line mii-detail__dup\">\n <mat-icon aria-hidden=\"true\">block</mat-icon>\n <span>The run was stopped before this row was checked.</span>\n </p>\n } @else if (row.issues.length > 0) {\n <span class=\"mii-detail__label\">\n {{ row.issues.length }} {{ row.issues.length === 1 ? 'issue' : 'issues' }}\n </span>\n <ul class=\"mii-issues\">\n @for (issue of row.issues; track $index) {\n <li class=\"mii-issue\" [attr.data-kind]=\"issue.kind\">\n <mat-icon aria-hidden=\"true\">{{ issue.kind === 'warning' ? 'flag' : 'error_outline' }}</mat-icon>\n <span class=\"mii-issue__column\">{{ issue.column }}</span>\n <span class=\"mii-issue__message\">{{ issue.message }}</span>\n </li>\n }\n </ul>\n } @else if (!row.systemError && row.duplicateOf === undefined) {\n <p class=\"mii-detail__line mii-detail__clean\">\n <mat-icon aria-hidden=\"true\">check_circle</mat-icon>\n <span>Nothing wrong with this row \u2014 it will be added as shown.</span>\n </p>\n }\n </div>\n </td>\n </tr>\n }\n }\n </tbody>\n </table>\n\n @if (visibleRows().length === 0 && reviewRows().length > 0) {\n <p class=\"mii-empty\">No rows match the filters \u2014 everything else is ready.</p>\n }\n </div>\n </section>\n }\n</mat-dialog-content>\n\n<mat-dialog-actions class=\"mii__actions\">\n <button type=\"button\" mat-button class=\"mii__cancel\" [disabled]=\"busy()\" (click)=\"cancel()\">Cancel</button>\n <button type=\"button\" mat-flat-button color=\"primary\" class=\"mii__add\" [disabled]=\"!canAdd()\" (click)=\"add()\">\n {{ addLabel() }}\n </button>\n</mat-dialog-actions>\n", styles: [":host{--mii-outline-08: color-mix(in srgb, var(--lib-forms-outline) 8%, transparent);--mii-outline-12: color-mix(in srgb, var(--lib-forms-outline) 12%, transparent);--mii-outline-20: color-mix(in srgb, var(--lib-forms-outline) 20%, transparent);--mii-primary-06: color-mix(in srgb, var(--lib-forms-primary) 6%, transparent);--mii-primary-10: color-mix(in srgb, var(--lib-forms-primary) 10%, transparent);--mii-primary-14: color-mix(in srgb, var(--lib-forms-primary) 14%, transparent);--mii-primary-25: color-mix(in srgb, var(--lib-forms-primary) 25%, transparent);--mii-amber-06: color-mix(in srgb, var(--sem-amber) 6%, transparent);--mii-held: color-mix(in srgb, var(--lib-forms-on-surface-variant) 4%, transparent);--mii-control-height: 2rem;display:block;color:var(--lib-forms-on-surface)}:host([data-fullscreen=\"true\"]){display:flex;flex-direction:column;height:100%;min-height:0}:host([data-fullscreen=\"true\"]) .mii__content{flex:1 1 auto;max-height:none;min-height:0}:host([data-fullscreen=\"true\"]) .mii-section--review{flex:1 1 auto;min-height:0}:host([data-fullscreen=\"true\"]) .mii-scroll{flex:1 1 auto;max-height:none;min-height:0}.mii__header{display:flex;align-items:flex-start;gap:1rem;margin:0;padding:1.5rem 2rem 0}.mii__header:before{display:none}.mii__heading{display:flex;flex:1 1 auto;flex-direction:column;gap:.25rem;min-width:0}.mii__title{font-size:1.125rem;font-weight:500;letter-spacing:-.01em;line-height:1.3;color:var(--lib-forms-on-surface)}.mii__subtitle{font-size:.8125rem;line-height:1.5;color:var(--lib-forms-on-surface-variant)}.mii__fullscreen{flex-shrink:0;margin:-.5rem -.5rem 0 0;color:var(--lib-forms-on-surface-variant)}.mii__content{display:flex;flex-direction:column;gap:1.25rem;padding:1.25rem 2rem .5rem;max-height:82vh}.mii-section{display:flex;flex-direction:column;gap:.625rem}.mii-section__label{font-size:.625rem;font-weight:600;letter-spacing:.14em;text-transform:uppercase;color:var(--lib-forms-on-surface-variant)}.mii-section__hint{margin:0;font-size:.75rem;line-height:1.5;color:var(--lib-forms-on-surface-variant)}.mii-setup__row{display:flex;flex-wrap:wrap;align-items:stretch;gap:.75rem}.mii-upload-input{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.mii-pick{display:flex;flex:1 1 22rem;align-items:center;gap:.75rem;min-width:0;padding:.5rem .875rem;border:1px dashed var(--mii-outline-20);border-radius:var(--lib-forms-radius-md);background:var(--lib-forms-surface);font:inherit;text-align:left;color:var(--lib-forms-on-surface-variant);cursor:pointer;transition:border-color var(--lib-forms-duration) var(--lib-forms-easing),background-color var(--lib-forms-duration) var(--lib-forms-easing),color var(--lib-forms-duration) var(--lib-forms-easing)}.mii-pick:hover,.mii-pick:focus-visible{border-color:var(--lib-forms-primary);background:var(--mii-primary-06);color:var(--lib-forms-primary)}.mii-pick:focus-visible{outline:none;border-style:solid;box-shadow:0 0 0 3px var(--mii-primary-14)}.mii-pick--busy,.mii-pick:disabled{cursor:progress;opacity:.7}.mii-pick__icon{flex-shrink:0;font-size:1.25rem;width:1.25rem;height:1.25rem}.mii-pick__text{display:flex;flex-wrap:wrap;align-items:baseline;gap:.125rem .75rem;min-width:0}.mii-pick__name{font-size:.875rem;font-weight:500;color:var(--lib-forms-on-surface);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}.mii-pick__hint{font-size:.75rem}.mii-template{display:flex;flex:1 1 22rem;align-items:center;gap:.75rem;min-width:0;padding:.375rem .875rem .375rem .375rem;border:1px solid var(--mii-outline-12);border-radius:var(--lib-forms-radius-md);background:var(--lib-forms-surface-container-low)}.mii-template__button{flex-shrink:0}.mii-template__hint{min-width:0;font-size:.75rem;line-height:1.4;color:var(--lib-forms-on-surface-variant)}.mii-columns{display:flex;flex-wrap:wrap;gap:.375rem;margin:0;padding:0;list-style:none}.mii-column{display:inline-flex;align-items:baseline;gap:.375rem;padding:.25rem .625rem;border:1px solid var(--mii-outline-20);border-radius:var(--lib-forms-radius-pill);background:var(--lib-forms-surface-container-low);font-size:.75rem;line-height:1.2;color:var(--lib-forms-on-surface);transition:border-color var(--lib-forms-duration-hover) var(--lib-forms-easing),background-color var(--lib-forms-duration-hover) var(--lib-forms-easing)}.mii-column:hover{border-color:color-mix(in srgb,var(--lib-forms-primary) 40%,transparent);background:var(--mii-primary-06)}.mii-column--required{border-color:color-mix(in srgb,var(--lib-forms-primary) 30%,transparent)}.mii-column--skipped{color:var(--lib-forms-on-surface-variant);border-style:dashed}.mii-column__key{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.6875rem}.mii-column__label{font-size:.6875rem;color:var(--lib-forms-on-surface-variant)}.mii-column__flag{font-size:.5625rem;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--lib-forms-primary)}.mii-column--skipped .mii-column__flag{color:var(--lib-forms-on-surface-variant)}.mii-fields{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:.5rem 1rem;margin:0}.mii-field{display:contents}.mii-field__label{padding-top:.3125rem;font-size:.75rem;line-height:1.4;white-space:nowrap;color:var(--lib-forms-on-surface-variant)}.mii-field__value{display:flex;flex-wrap:wrap;align-items:center;gap:.375rem;margin:0;min-width:0}.mii-field__hint{flex-basis:100%;font-size:.6875rem;line-height:1.4;color:var(--lib-forms-on-surface-variant)}.mii-sheets{display:flex;flex-wrap:wrap;align-items:center;gap:.375rem}.mii-sheets__label{margin-right:.125rem;font-size:.75rem;color:var(--lib-forms-on-surface-variant)}.mii-sheet{display:inline-flex;align-items:center;gap:.25rem;min-height:1.75rem;padding:.1875rem .625rem;border:1px solid var(--mii-outline-20);border-radius:var(--lib-forms-radius-pill);background:var(--lib-forms-surface);font:inherit;font-size:.75rem;font-weight:500;color:var(--lib-forms-on-surface-variant);cursor:pointer;transition:border-color var(--lib-forms-duration-hover) var(--lib-forms-easing),background-color var(--lib-forms-duration-hover) var(--lib-forms-easing),color var(--lib-forms-duration-hover) var(--lib-forms-easing)}.mii-sheet mat-icon{font-size:.875rem;width:.875rem;height:.875rem}.mii-sheet:hover,.mii-sheet:focus-visible{border-color:color-mix(in srgb,var(--lib-forms-primary) 40%,transparent);background:var(--mii-primary-06);color:var(--lib-forms-primary)}.mii-sheet:focus-visible{outline:3px solid var(--mii-primary-25);outline-offset:1px}.mii-sheet--active{border-color:var(--lib-forms-primary);background:var(--mii-primary-10);color:var(--lib-forms-primary)}.mii-sheet:disabled{cursor:default;opacity:.6}.mii-strip{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem .75rem;padding:.375rem .625rem;border:1px solid var(--mii-outline-08);border-radius:var(--lib-forms-radius-md);background:var(--lib-forms-surface-container-low)}.mii-strip__item{display:inline-flex;align-items:center;gap:.375rem;min-width:0;min-height:var(--mii-control-height);padding:.25rem .5rem;border:0;border-radius:var(--lib-forms-radius-sm);background:transparent;font:inherit;font-size:.75rem;color:var(--lib-forms-on-surface);cursor:pointer;transition:background-color var(--lib-forms-duration-hover) var(--lib-forms-easing)}.mii-strip__item:hover,.mii-strip__item:focus-visible{background:var(--mii-primary-06)}.mii-strip__item:focus-visible{outline:3px solid var(--mii-primary-14);outline-offset:2px}.mii-strip__item mat-icon{flex-shrink:0;font-size:1rem;width:1rem;height:1rem;color:var(--lib-forms-on-surface-variant)}.mii-strip__label{font-size:.625rem;font-weight:600;letter-spacing:.14em;text-transform:uppercase;color:var(--lib-forms-on-surface-variant)}.mii-strip__value{max-width:18rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}.mii-strip__chevron{opacity:.6}.mii-strip__spacer{flex:1 1 auto}.mii-alert{display:flex;align-items:flex-start;gap:.5rem;margin:0;padding:.5rem .75rem;border-radius:var(--lib-forms-radius-sm);font-size:.75rem;line-height:1.5}.mii-alert mat-icon{flex-shrink:0;font-size:1rem;width:1rem;height:1rem;margin-top:.0625rem}.mii-alert--error{color:var(--sem-error);background:var(--sem-error-surface)}.mii-alert--warn{color:var(--sem-amber);background:var(--sem-amber-surface)}.mii-note{margin:0;font-size:.6875rem;line-height:1.5;color:var(--lib-forms-on-surface-variant)}.mii-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem 1rem}.mii-toolbar__verdict{display:flex;flex:1 1 22rem;align-items:center;gap:.625rem;min-width:0}.mii-toolbar__stats{display:flex;flex-wrap:wrap;align-items:center;gap:.25rem}.mii-toolbar__tools{display:flex;flex-wrap:wrap;align-items:center;gap:.25rem;margin-left:auto}.mii-summary{margin:0;min-width:0;font-size:.8125rem;line-height:1.4;color:var(--lib-forms-on-surface)}.mii-pill{display:inline-flex;flex-shrink:0;align-items:center;gap:.375rem;padding:.25rem .625rem;border:1px solid transparent;border-radius:var(--lib-forms-radius-pill);font-size:.6875rem;font-weight:600;letter-spacing:.08em;text-transform:uppercase;white-space:nowrap;line-height:1;color:var(--sem-slate);background:var(--sem-slate-surface);border-color:color-mix(in srgb,var(--sem-slate) 30%,transparent);transition:color var(--lib-forms-duration) var(--lib-forms-easing),background-color var(--lib-forms-duration) var(--lib-forms-easing),border-color var(--lib-forms-duration) var(--lib-forms-easing)}.mii-pill mat-icon{font-size:.875rem;width:.875rem;height:.875rem}.mii-pill[data-kind=ok]{color:var(--sem-emerald);background:var(--sem-emerald-surface);border-color:color-mix(in srgb,var(--sem-emerald) 30%,transparent)}.mii-pill[data-kind=warn],.mii-pill[data-kind=paused]{color:var(--sem-amber);background:var(--sem-amber-surface);border-color:color-mix(in srgb,var(--sem-amber) 30%,transparent)}.mii-tool{display:inline-flex;align-items:center;gap:.3125rem;min-height:1.75rem;padding:.1875rem .625rem;border:1px solid var(--mii-outline-20);border-radius:var(--lib-forms-radius-pill);background:transparent;font:inherit;font-size:.6875rem;font-weight:500;white-space:nowrap;color:var(--lib-forms-on-surface-variant);cursor:pointer;transition:border-color var(--lib-forms-duration-hover) var(--lib-forms-easing),background-color var(--lib-forms-duration-hover) var(--lib-forms-easing),color var(--lib-forms-duration-hover) var(--lib-forms-easing)}.mii-tool mat-icon{font-size:.875rem;width:.875rem;height:.875rem}.mii-tool:hover,.mii-tool:focus-visible{border-color:color-mix(in srgb,var(--lib-forms-primary) 40%,transparent);background:var(--mii-primary-06);color:var(--lib-forms-primary)}.mii-tool:focus-visible{outline:3px solid var(--mii-primary-25);outline-offset:1px}.mii-tool--on{border-color:var(--lib-forms-primary);background:var(--mii-primary-10);color:var(--lib-forms-primary)}.mii-tool:disabled{cursor:default;opacity:.4;pointer-events:none}.mii-col-menu__count{color:var(--lib-forms-on-surface-variant)}.mii-guide{display:flex;align-items:flex-start;gap:.5rem;margin:0;padding:.5rem .75rem;border-radius:var(--lib-forms-radius-sm);font-size:.75rem;line-height:1.5;color:var(--sem-amber);background:var(--sem-amber-surface)}.mii-guide mat-icon{flex-shrink:0;font-size:1rem;width:1rem;height:1rem;margin-top:.0625rem}.mii-guide strong{font-weight:600}.mii-progress{--mdc-linear-progress-track-height: .25rem;--mdc-linear-progress-active-indicator-height: .25rem;border-radius:var(--lib-forms-radius-pill);overflow:hidden}.mii-scroll{max-height:56vh;overflow:auto;border:1px solid var(--mii-outline-12);border-radius:var(--lib-forms-radius-md);background:var(--lib-forms-surface)}.mii-table{width:100%;border-collapse:separate;border-spacing:0;font-size:.75rem}.mii-th{position:sticky;top:0;z-index:1;padding:.5rem .75rem;text-align:left;font-size:.625rem;font-weight:600;letter-spacing:.14em;text-transform:uppercase;white-space:nowrap;color:var(--lib-forms-on-surface-variant);background:var(--lib-forms-surface-container-low)}.mii-th--expand{width:2rem;padding-right:0}.mii-th--index{width:2.25rem;text-align:right}.mii-td{height:2rem;padding:.25rem .75rem;vertical-align:middle;white-space:nowrap;color:var(--lib-forms-on-surface);transition:background-color var(--lib-forms-duration-hover) var(--lib-forms-easing)}.mii-td--expand{padding-right:0}.mii-td--index{text-align:right;font-variant-numeric:tabular-nums;color:var(--lib-forms-on-surface-variant)}.mii-status-cell{display:inline-flex;align-items:center;gap:.375rem}.mii-row:hover .mii-td{background:var(--mii-primary-06)}.mii-row--held .mii-td{background:var(--mii-held)}.mii-row[data-status=choice] .mii-td,.mii-row[data-status=overridable] .mii-td{background:var(--mii-amber-06)}.mii-row[data-status=duplicate] .mii-td{color:var(--lib-forms-on-surface-variant)}.mii-row--open .mii-td{background:var(--mii-primary-06)}.mii-expand{display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:0;border:0;border-radius:var(--lib-forms-radius-pill);background:transparent;color:var(--lib-forms-on-surface-variant);cursor:pointer;transition:background-color var(--lib-forms-duration-hover) var(--lib-forms-easing),color var(--lib-forms-duration-hover) var(--lib-forms-easing)}.mii-expand mat-icon{font-size:1.125rem;width:1.125rem;height:1.125rem;transition:transform var(--lib-forms-duration) var(--lib-forms-easing)}.mii-expand:hover,.mii-expand:focus-visible{background:var(--mii-primary-10);color:var(--lib-forms-primary)}.mii-expand:focus-visible{outline:3px solid var(--mii-primary-25);outline-offset:1px}.mii-expand--open mat-icon{transform:rotate(90deg)}.mii-badge{display:inline-flex;align-items:center;justify-content:center;min-width:1.125rem;height:1.125rem;padding:0 .3125rem;border-radius:var(--lib-forms-radius-pill);font-size:.625rem;font-weight:600;font-variant-numeric:tabular-nums;color:var(--lib-forms-on-surface-variant);background:var(--lib-forms-surface-container-high)}.mii-cell-line{display:inline-flex;align-items:center;gap:.3125rem;max-width:100%}.mii-cell{display:inline-block;max-width:16rem;overflow:hidden;text-overflow:ellipsis;vertical-align:bottom}.mii-cell--empty{color:var(--lib-forms-on-surface-variant)}.mii-cell__swap{flex-shrink:0;font-size:.875rem;width:.875rem;height:.875rem;color:var(--lib-forms-primary);cursor:help}.mii-cell-error{display:flex;align-items:center;gap:.25rem;margin-top:.125rem;font-size:.6875rem;font-weight:500;color:var(--sem-red)}.mii-cell-error mat-icon{font-size:.875rem;width:.875rem;height:.875rem}.mii-td--choice{white-space:normal;vertical-align:top}.mii-choice{display:flex;flex-direction:column;gap:.5rem;min-width:13rem}.mii-choice__item{display:flex;flex-direction:column;gap:.25rem}.mii-choice__text{font-size:.6875rem;color:var(--lib-forms-on-surface-variant)}.mii-choice__field{position:relative;display:block}.mii-choice__select{width:100%;min-height:var(--mii-control-height);padding:.25rem 2rem .25rem .625rem;border:1px solid var(--mii-outline-20);border-radius:var(--lib-forms-radius-md);background:var(--lib-forms-surface);font:inherit;font-size:.75rem;color:var(--lib-forms-on-surface);appearance:none;cursor:pointer;transition:border-color var(--lib-forms-duration-hover) var(--lib-forms-easing),box-shadow var(--lib-forms-duration-hover) var(--lib-forms-easing)}.mii-choice__select:hover{border-color:color-mix(in srgb,var(--lib-forms-primary) 40%,transparent)}.mii-choice__select:focus-visible{outline:none;border-color:var(--lib-forms-primary);box-shadow:0 0 0 3px var(--mii-primary-14)}.mii-choice__select:disabled{cursor:progress;opacity:.6}.mii-choice__chevron{position:absolute;top:50%;right:.5rem;width:1rem;height:1rem;font-size:1rem;transform:translateY(-50%);pointer-events:none;color:var(--lib-forms-on-surface-variant)}.mii-td--choice .mii-cell-error{margin-top:.375rem}.mii-status{display:inline-flex;align-items:center;gap:.3125rem;padding:.1875rem .5rem;border:1px solid transparent;border-radius:var(--lib-forms-radius-pill);font-size:.625rem;font-weight:600;letter-spacing:.08em;text-transform:uppercase;white-space:nowrap;line-height:1;color:var(--sem-slate);background:var(--sem-slate-surface);border-color:color-mix(in srgb,var(--sem-slate) 30%,transparent);transition:color var(--lib-forms-duration) var(--lib-forms-easing),background-color var(--lib-forms-duration) var(--lib-forms-easing),border-color var(--lib-forms-duration) var(--lib-forms-easing)}.mii-status mat-icon{font-size:.875rem;width:.875rem;height:.875rem}.mii-status--count{font-variant-numeric:tabular-nums}.mii-status[data-status=valid]{color:var(--sem-emerald);background:var(--sem-emerald-surface);border-color:color-mix(in srgb,var(--sem-emerald) 30%,transparent)}.mii-status[data-status=overridable],.mii-status[data-status=choice]{color:var(--sem-amber);background:var(--sem-amber-surface);border-color:color-mix(in srgb,var(--sem-amber) 30%,transparent)}.mii-status[data-status=invalid]{color:var(--sem-red);background:var(--sem-red-surface);border-color:color-mix(in srgb,var(--sem-red) 30%,transparent)}.mii-status[data-status=error]{color:var(--sem-rust);background:var(--sem-rust-surface);border-color:color-mix(in srgb,var(--sem-rust) 30%,transparent)}.mii-status[data-status=duplicate]{color:var(--sem-slate);background:var(--sem-slate-surface);border-color:color-mix(in srgb,var(--sem-slate) 30%,transparent)}.mii-td--detail{height:auto;padding:0 .75rem .75rem 2.75rem;white-space:normal}.mii-detail{display:flex;flex-direction:column;gap:.5rem;padding:.75rem 1rem;border:1px solid var(--mii-outline-12);border-radius:var(--lib-forms-radius-md);background:var(--lib-forms-surface-container-low)}.mii-detail__head{display:flex;align-items:center;gap:.625rem}.mii-detail__title{font-size:.875rem;font-weight:500;color:var(--lib-forms-on-surface)}.mii-detail__spacer{flex:1 1 auto}.mii-detail__close{display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:0;border:0;border-radius:var(--lib-forms-radius-pill);background:transparent;color:var(--lib-forms-on-surface-variant);cursor:pointer;transition:background-color var(--lib-forms-duration-hover) var(--lib-forms-easing)}.mii-detail__close mat-icon{font-size:1rem;width:1rem;height:1rem}.mii-detail__close:hover,.mii-detail__close:focus-visible{background:var(--mii-primary-10);color:var(--lib-forms-primary)}.mii-detail__close:focus-visible{outline:3px solid var(--mii-primary-25);outline-offset:1px}.mii-detail__label{font-size:.625rem;font-weight:600;letter-spacing:.14em;text-transform:uppercase;color:var(--lib-forms-on-surface-variant)}.mii-detail__line{display:flex;align-items:flex-start;gap:.375rem;margin:0;font-size:.75rem;line-height:1.5;color:var(--lib-forms-on-surface)}.mii-detail__line mat-icon{flex-shrink:0;font-size:.875rem;width:.875rem;height:.875rem;margin-top:.125rem}.mii-detail__line--sys{color:var(--sem-rust)}.mii-detail__dup{color:var(--lib-forms-on-surface-variant)}.mii-detail__clean{color:var(--sem-emerald)}.mii-detail__link{padding:0;border:0;background:transparent;font:inherit;font-weight:500;color:var(--lib-forms-primary);text-decoration:underline;text-underline-offset:.2em;cursor:pointer}.mii-detail__link:focus-visible{outline:3px solid var(--mii-primary-25);outline-offset:2px;border-radius:var(--lib-forms-radius-sm)}.mii-issues{display:flex;flex-direction:column;gap:.25rem;margin:0;padding:0;list-style:none}.mii-issue{display:grid;grid-template-columns:.875rem minmax(6rem,max-content) 1fr;align-items:start;gap:.25rem .625rem;font-size:.75rem;line-height:1.5}.mii-issue mat-icon{font-size:.875rem;width:.875rem;height:.875rem;margin-top:.125rem;color:var(--sem-red)}.mii-issue[data-kind=warning] mat-icon{color:var(--sem-amber)}.mii-issue__column{font-weight:500;color:var(--lib-forms-on-surface)}.mii-issue__message{color:var(--lib-forms-on-surface-variant)}.mii-empty{margin:0;padding:1.5rem;text-align:center;font-size:.875rem;color:var(--lib-forms-on-surface-variant)}.mii__actions{display:flex;justify-content:flex-end;gap:.75rem;padding:.75rem 2rem 1.5rem}.mii-sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}@media(max-width:40rem){.mii__header,.mii__content,.mii__actions{padding-left:1rem;padding-right:1rem}.mii-fields{grid-template-columns:minmax(0,1fr)}.mii-field__label{padding-top:0}.mii-toolbar__tools{margin-left:0}}@media(prefers-reduced-motion:reduce){.mii-column,.mii-pick,.mii-sheet,.mii-strip__item,.mii-tool,.mii-pill,.mii-td,.mii-expand,.mii-expand mat-icon,.mii-detail__close,.mii-choice__select,.mii-status{transition:none}}\n"] }]
|
|
2074
|
-
}] });
|
|
2075
|
-
/** Reads a file's bytes through `FileReader`, the API the rest of the library already relies on. */
|
|
2076
|
-
function readAsArrayBuffer(file) {
|
|
2077
|
-
return new Promise((resolve, reject) => {
|
|
2078
|
-
const reader = new FileReader();
|
|
2079
|
-
reader.onload = () => {
|
|
2080
|
-
const result = reader.result;
|
|
2081
|
-
if (result instanceof ArrayBuffer)
|
|
2082
|
-
resolve(result);
|
|
2083
|
-
else
|
|
2084
|
-
reject(new Error('Could not read the file.'));
|
|
2085
|
-
};
|
|
2086
|
-
reader.onerror = () => reject(reader.error ?? new Error('Could not read the file.'));
|
|
2087
|
-
reader.readAsArrayBuffer(file);
|
|
2088
|
-
});
|
|
2089
|
-
}
|
|
2090
|
-
function messageOf(error, fallback) {
|
|
2091
|
-
return error instanceof Error && error.message ? error.message : fallback;
|
|
2092
|
-
}
|
|
2093
|
-
|
|
2094
|
-
const customInputConfig = {
|
|
2095
|
-
controlType: 'app-multiple-input-table',
|
|
2096
|
-
nextId: 0,
|
|
2097
|
-
};
|
|
2098
|
-
class MultipleInputTableComponent extends BaseCustomInput {
|
|
2099
|
-
#destroyRef;
|
|
2100
|
-
#dialog;
|
|
2101
|
-
/** The host's spreadsheet parser, when it opted in through `withSpreadsheetImport()`. */
|
|
2102
|
-
#spreadsheetParser;
|
|
2103
|
-
#templates;
|
|
2104
|
-
#errorHandler;
|
|
2105
|
-
/** The consumer's currency defaults, so a summary row rounds like its column. */
|
|
2106
|
-
#currencyDefaults;
|
|
2107
|
-
constructor() {
|
|
2108
|
-
super(inject(NgControl, { self: true, optional: true }), inject(ElementRef), customInputConfig);
|
|
2109
|
-
this.editorMode = input(false, ...(ngDevMode ? [{ debugName: "editorMode" }] : /* istanbul ignore next */ []));
|
|
2110
|
-
this.formGroup = input.required(...(ngDevMode ? [{ debugName: "formGroup" }] : /* istanbul ignore next */ []));
|
|
2111
|
-
this.inputConfig = input.required(...(ngDevMode ? [{ debugName: "inputConfig" }] : /* istanbul ignore next */ []));
|
|
2112
|
-
this.formBuilderFunctions = input(undefined, ...(ngDevMode ? [{ debugName: "formBuilderFunctions" }] : /* istanbul ignore next */ []));
|
|
2113
|
-
this.#destroyRef = inject(DestroyRef);
|
|
2114
|
-
this.#dialog = inject(MatDialog);
|
|
2115
|
-
/** The host's spreadsheet parser, when it opted in through `withSpreadsheetImport()`. */
|
|
2116
|
-
this.#spreadsheetParser = inject(SPREADSHEET_PARSER, { optional: true });
|
|
2117
|
-
this.#templates = inject(SpreadsheetTemplateService);
|
|
2118
|
-
this.#errorHandler = inject(ErrorHandler);
|
|
2119
|
-
/** The consumer's currency defaults, so a summary row rounds like its column. */
|
|
2120
|
-
this.#currencyDefaults = injectCurrencyRoundingDefaults();
|
|
2121
|
-
this.rowInViewOnly = undefined;
|
|
2122
|
-
this.listenToValueChanges();
|
|
2123
|
-
}
|
|
2124
|
-
/**
|
|
2125
|
-
* Manages custom validation errors on the form control.
|
|
2126
|
-
* Intended to be called from the ngDoCheck lifecycle hook.
|
|
2127
|
-
* This function handles both the 'required' error and the new
|
|
2128
|
-
* 'multipleInputListMissingSomeFields' custom error.
|
|
2129
|
-
*/
|
|
2130
|
-
checkValidationsAnErrors() {
|
|
2131
|
-
const control = this.ngControl?.control;
|
|
2132
|
-
// 1. Early exit if there's no form control to work with.
|
|
2133
|
-
if (!control) {
|
|
2134
|
-
return;
|
|
2135
|
-
}
|
|
2136
|
-
// --- DEFINE THE DESIRED ERROR STATE ---
|
|
2137
|
-
// 2. Determine if the custom "multiple fields" error should exist.
|
|
2138
|
-
const missingFields = this.#missingRequiredFields();
|
|
2139
|
-
// 3. Determine if the standard 'required' error should exist.
|
|
2140
|
-
const shouldHaveRequiredError = this.required && this._isNilOrEmpty(this.value);
|
|
2141
|
-
// --- APPLY THE ERROR STATE TO THE CONTROL ---
|
|
2142
|
-
// 4. Preserve other errors that might be on the control (e.g., minlength, pattern).
|
|
2143
|
-
const newErrors = { ...control.errors };
|
|
2144
|
-
delete newErrors['required'];
|
|
2145
|
-
delete newErrors['multipleInputListMissingSomeFields'];
|
|
2146
|
-
// 5. Add our managed errors back if their conditions are met.
|
|
2147
|
-
if (shouldHaveRequiredError) {
|
|
2148
|
-
newErrors['required'] = true;
|
|
2149
|
-
}
|
|
2150
|
-
if (missingFields.length > 0) {
|
|
2151
|
-
// `missing` names the offending rows/fields so the rendered message can
|
|
2152
|
-
// tell the user exactly what to fix — see inputErrorMessage.ts.
|
|
2153
|
-
newErrors['multipleInputListMissingSomeFields'] = { value: true, missing: missingFields };
|
|
2154
|
-
}
|
|
2155
|
-
// 6. Finalize the error object. If no errors, it must be null.
|
|
2156
|
-
const finalErrors = Object.keys(newErrors).length > 0 ? newErrors : null;
|
|
2157
|
-
// 7. IMPORTANT: Only update the control if the errors have actually changed.
|
|
2158
|
-
// This prevents infinite loops within ngDoCheck. A simple stringify is a
|
|
2159
|
-
// dependency-free way to compare the error objects.
|
|
2160
|
-
if (JSON.stringify(control.errors) !== JSON.stringify(finalErrors)) {
|
|
2161
|
-
control.setErrors(finalErrors);
|
|
2162
|
-
}
|
|
2163
|
-
}
|
|
2164
|
-
get empty() {
|
|
2165
|
-
return !this.value;
|
|
2166
|
-
}
|
|
2167
|
-
get shouldLabelFloat() {
|
|
2168
|
-
return this.focused || !this.empty;
|
|
2169
|
-
}
|
|
2170
|
-
get errorState() {
|
|
2171
|
-
// 1. Check for standard validation errors from Angular's Forms API.
|
|
2172
|
-
const hasStandardError = !!this.ngControl?.errors;
|
|
2173
|
-
// 2. Check for custom validation errors specific to 'IMultiple' type.
|
|
2174
|
-
const hasCustomError = this.#missingRequiredFields().length > 0;
|
|
2175
|
-
// 3. The final error state is true if *any* validation fails,
|
|
2176
|
-
// AND the control has been "touched" by the user.
|
|
2177
|
-
return (hasStandardError || hasCustomError) && this.touched;
|
|
2178
|
-
}
|
|
2179
|
-
_isNilOrEmpty(value) {
|
|
2180
|
-
return value === null || value === undefined || value === '';
|
|
2181
|
-
}
|
|
2182
|
-
/**
|
|
2183
|
-
* Rows (1-based, in value order) whose required child inputs are empty,
|
|
2184
|
-
* each with the labels of the inputs still missing. Drives both `errorState`
|
|
2185
|
-
* and the `multipleInputListMissingSomeFields` error payload.
|
|
2186
|
-
*/
|
|
2187
|
-
#missingRequiredFields() {
|
|
2188
|
-
const formInputs = this.inputConfig()?.formInputs;
|
|
2189
|
-
if (!Array.isArray(formInputs) || !Array.isArray(this.value))
|
|
2190
|
-
return [];
|
|
2191
|
-
const requiredFields = formInputs.filter(i => i.required);
|
|
2192
|
-
if (requiredFields.length === 0)
|
|
2193
|
-
return [];
|
|
2194
|
-
const configId = this.inputConfig().id;
|
|
2195
|
-
const missing = [];
|
|
2196
|
-
this.value.forEach((item, index) => {
|
|
2197
|
-
const fields = requiredFields
|
|
2198
|
-
.filter(f => this._isNilOrEmpty(item?.[`${configId}.${f.id}`]))
|
|
2199
|
-
.map(f => f.label || f.id);
|
|
2200
|
-
if (fields.length > 0) {
|
|
2201
|
-
missing.push({ row: index + 1, fields });
|
|
2202
|
-
}
|
|
2203
|
-
});
|
|
2204
|
-
return missing;
|
|
2205
|
-
}
|
|
2206
|
-
listenToValueChanges() {
|
|
2207
|
-
this.stateChanges
|
|
2208
|
-
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
2209
|
-
.subscribe(() => {
|
|
2210
|
-
this.checkItemList();
|
|
2211
|
-
});
|
|
2212
|
-
}
|
|
2213
|
-
checkItemList() {
|
|
2214
|
-
try {
|
|
2215
|
-
if (this.value) {
|
|
2216
|
-
const config = this.inputConfig();
|
|
2217
|
-
const TableData = (config.groupBy?.length ?? 0) > 0
|
|
2218
|
-
? addGroups(this.value, config.groupBy)
|
|
2219
|
-
: this.value;
|
|
2220
|
-
const data = getCaluculatedTableData(config, TableData, untracked(this.#currencyDefaults));
|
|
2221
|
-
if (!this.dataSource) {
|
|
2222
|
-
this.dataSource = new MatTableDataSource(data);
|
|
2223
|
-
this.dataSource;
|
|
2224
|
-
}
|
|
2225
|
-
else {
|
|
2226
|
-
this.dataSource.data = data;
|
|
2227
|
-
}
|
|
2228
|
-
}
|
|
2229
|
-
return true;
|
|
2230
|
-
}
|
|
2231
|
-
catch {
|
|
2232
|
-
return false;
|
|
2233
|
-
}
|
|
2234
|
-
}
|
|
2235
|
-
multipleInputRemoveItem(item) {
|
|
2236
|
-
if (!item)
|
|
2237
|
-
return;
|
|
2238
|
-
if (!this.value)
|
|
2239
|
-
return;
|
|
2240
|
-
this.value = this.value.filter((i) => !_isEqual(i, item));
|
|
2241
|
-
this.applyOptionsTo = undefined;
|
|
2242
|
-
this.onChange(this.value);
|
|
2243
|
-
this.stateChanges.next();
|
|
2244
|
-
}
|
|
2245
|
-
generateMultipleInputForm() {
|
|
2246
|
-
const id = this.inputConfig()?.id;
|
|
2247
|
-
if (!id)
|
|
2248
|
-
return;
|
|
2249
|
-
this.formBuilderFunctions()?.multipleInputToggleForm(id, true);
|
|
2250
|
-
}
|
|
2251
|
-
editRow(rowId) {
|
|
2252
|
-
if (!rowId) {
|
|
2253
|
-
throw new Error('Row id not provided');
|
|
2254
|
-
}
|
|
2255
|
-
const config = this.inputConfig();
|
|
2256
|
-
const fbf = this.formBuilderFunctions();
|
|
2257
|
-
if (!fbf || !config)
|
|
2258
|
-
return;
|
|
2259
|
-
fbf.multipleInputEditRow(config.id, rowId);
|
|
2260
|
-
// if( !this.inputConfig?.multipleInputController){
|
|
2261
|
-
// return
|
|
2262
|
-
// }
|
|
2263
|
-
// this.inputConfig.multipleInputInEditId = this.applyOptionsTo.id;
|
|
2264
|
-
// this.inputConfig.applyMultipleInputValuesToForm(
|
|
2265
|
-
// this.applyOptionsTo
|
|
2266
|
-
// );
|
|
2267
|
-
}
|
|
2268
|
-
copy(rowId) {
|
|
2269
|
-
const config = this.inputConfig();
|
|
2270
|
-
const fbf = this.formBuilderFunctions();
|
|
2271
|
-
if (!fbf || !config)
|
|
2272
|
-
return;
|
|
2273
|
-
fbf.multipleInputDuplicateRow(config.id, rowId);
|
|
2274
|
-
// this.generateMultipleInputForm();
|
|
2275
|
-
// this.inputConfig?.applyMultipleInputValuesToForm(
|
|
2276
|
-
// this.applyOptionsTo
|
|
2277
|
-
// );
|
|
2278
|
-
// this.applyOptionsTo = undefined;
|
|
2279
|
-
}
|
|
2280
|
-
get handleLabel() {
|
|
2281
|
-
return this.inputConfig()?.handleLabel;
|
|
2282
|
-
}
|
|
2283
|
-
handleIcon() {
|
|
2284
|
-
// NOTE(phase-4): `handleIcon` is declared on `IBasicFormInput` but not on `IMultiple` directly;
|
|
2285
|
-
// narrow through `ITowerStepColumn` (which extends FormColumnInputs) and provide a string fallback.
|
|
2286
|
-
const cfg = this.inputConfig();
|
|
2287
|
-
return cfg?.handleIcon || 'add';
|
|
2288
|
-
}
|
|
2289
|
-
saveMultipleInputForm() {
|
|
2290
|
-
this.formBuilderFunctions()?.multipleInputSaveForm(this.inputConfig().id);
|
|
2291
|
-
// const value: any = this.inputConfig?.multipleInputFormValue();
|
|
2292
|
-
// value['id'] = uuidv4();
|
|
2293
|
-
// if (!this.inputConfig) {
|
|
2294
|
-
// return
|
|
2295
|
-
// }
|
|
2296
|
-
// const previousValue = this.value
|
|
2297
|
-
// if (!previousValue) {
|
|
2298
|
-
// this.value = [value];
|
|
2299
|
-
// this.inputConfig.multipleInputController = undefined;
|
|
2300
|
-
// } else {
|
|
2301
|
-
// if (this.inputConfig?.multipleInputInEditId) {
|
|
2302
|
-
// let inEdit = previousValue.find(
|
|
2303
|
-
// (i: { id: any }) =>
|
|
2304
|
-
// i.id === this.inputConfig?.multipleInputInEditId
|
|
2305
|
-
// );
|
|
2306
|
-
// Object.keys(inEdit).every((s) => {
|
|
2307
|
-
// s;
|
|
2308
|
-
// inEdit[s] = value[s];
|
|
2309
|
-
// return !!inEdit[s];
|
|
2310
|
-
// });
|
|
2311
|
-
// this.value = [...previousValue],
|
|
2312
|
-
// this.inputConfig.multipleInputController = undefined;
|
|
2313
|
-
// } else {
|
|
2314
|
-
// this.value = [...previousValue, value];
|
|
2315
|
-
// this.inputConfig.multipleInputController = undefined;
|
|
2316
|
-
// }
|
|
2317
|
-
// }
|
|
2318
|
-
// this.onChange(this.value);
|
|
2319
|
-
// this.stateChanges.next();
|
|
2320
|
-
// this.checkItemList(this.value || []);
|
|
2321
|
-
// return
|
|
2322
|
-
}
|
|
2323
|
-
editInput(input) {
|
|
2324
|
-
const fbf = this.formBuilderFunctions();
|
|
2325
|
-
if (typeof fbf?.editInput !== 'function') {
|
|
2326
|
-
throw new Error('editInput function not defined in formBuilderFunctions');
|
|
2327
|
-
}
|
|
2328
|
-
fbf.editInput(input);
|
|
2329
|
-
}
|
|
2330
|
-
deleteItemInput(input) {
|
|
2331
|
-
this.formBuilderFunctions()?.deleteInput(input);
|
|
2332
|
-
}
|
|
2333
|
-
showItemAsLabel(input) {
|
|
2334
|
-
this.formBuilderFunctions()?.multipleInputToggleLabel(input);
|
|
2335
|
-
}
|
|
2336
|
-
addFunction(func) {
|
|
2337
|
-
this.formBuilderFunctions()?.addFunction(func, this.inputConfig()?.id);
|
|
2338
|
-
}
|
|
2339
|
-
// `FormBuilderFunctions.reorderItems` is now generic over the row shape; the
|
|
2340
|
-
// container/data slots stay `unknown` (opaque drag payload).
|
|
2341
|
-
reorderItems(event) {
|
|
2342
|
-
const config = this.inputConfig();
|
|
2343
|
-
const fbf = this.formBuilderFunctions();
|
|
2344
|
-
if (!fbf || !config)
|
|
2345
|
-
return;
|
|
2346
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Phase-4 TODO: deduplicate @angular/cdk peer dep in typings package; CdkDragDrop types are nominally distinct across copies.
|
|
2347
|
-
fbf.reorderItems(event, config.id);
|
|
2348
|
-
}
|
|
2349
|
-
/**
|
|
2350
|
-
* Whether the add button carries its menu (with "Import from spreadsheet"):
|
|
2351
|
-
* the host bound a parser and the field allows adding rows. The template
|
|
2352
|
-
* additionally hides the whole add-row bar for readonly / disabled /
|
|
2353
|
-
* open-form fields.
|
|
2354
|
-
*/
|
|
2355
|
-
get canImportRows() {
|
|
2356
|
-
return this.#spreadsheetParser !== null && this.canAddRecords;
|
|
2357
|
-
}
|
|
2358
|
-
/**
|
|
2359
|
-
* Whether the menu also offers "Download import template": the host bound a
|
|
2360
|
-
* writer beside its parser. Never true without the import itself.
|
|
2361
|
-
*/
|
|
2362
|
-
get canDownloadTemplate() {
|
|
2363
|
-
return this.canImportRows && this.#templates.available;
|
|
2364
|
-
}
|
|
2365
|
-
/**
|
|
2366
|
-
* Downloads the import template for this field: a workbook with the headers
|
|
2367
|
-
* the import matches and a guide to each column. The writer's failure, if
|
|
2368
|
-
* any, goes to the app's `ErrorHandler` — the menu has no surface of its own.
|
|
2369
|
-
*/
|
|
2370
|
-
downloadImportTemplate() {
|
|
2371
|
-
const config = this.inputConfig();
|
|
2372
|
-
if (!this.canDownloadTemplate || !config)
|
|
2373
|
-
return;
|
|
2374
|
-
void this.#templates.download(config).catch((error) => this.#errorHandler.handleError(error));
|
|
2375
|
-
}
|
|
2376
|
-
/**
|
|
2377
|
-
* Opens the spreadsheet import for this field and appends the rows that
|
|
2378
|
-
* validate. Each row is checked by the same per-row tower the bulk import
|
|
2379
|
-
* uses for this field's sub-rows; only rows that settle valid come back.
|
|
2380
|
-
*/
|
|
2381
|
-
importRowsFromSpreadsheet() {
|
|
2382
|
-
const config = this.inputConfig();
|
|
2383
|
-
if (!this.canImportRows || !config)
|
|
2384
|
-
return;
|
|
2385
|
-
this.#dialog
|
|
2386
|
-
.open(MultipleInputImportDialogComponent, {
|
|
2387
|
-
data: { input: config, existingRowCount: this.value?.length ?? 0 },
|
|
2388
|
-
width: MULTIPLE_INPUT_IMPORT_DIALOG_WIDTH,
|
|
2389
|
-
// The pane may grow to the whole viewport: the dialog's full-screen toggle resizes it.
|
|
2390
|
-
maxWidth: '100vw',
|
|
2391
|
-
maxHeight: '100vh',
|
|
2392
|
-
autoFocus: 'first-tabbable',
|
|
2393
|
-
restoreFocus: true,
|
|
2394
|
-
// The dialog owns its own close paths; a stray Escape mid-validation
|
|
2395
|
-
// must not orphan a running session.
|
|
2396
|
-
disableClose: true,
|
|
2397
|
-
panelClass: 'lib-multiple-input-import-dialog__panel',
|
|
2398
|
-
})
|
|
2399
|
-
.afterClosed()
|
|
2400
|
-
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
2401
|
-
.subscribe((rows) => this.#appendImportedRows(rows));
|
|
2402
|
-
}
|
|
2403
|
-
/**
|
|
2404
|
-
* Appends settled rows (keyed by child `formControlName`) to the value in the
|
|
2405
|
-
* composite shape the table stores, cells coerced to the child's data type.
|
|
2406
|
-
* Goes through the same value path as delete, so the tower sees one change.
|
|
2407
|
-
*/
|
|
2408
|
-
#appendImportedRows(rows) {
|
|
2409
|
-
if (!rows?.length)
|
|
2410
|
-
return;
|
|
2411
|
-
const config = this.inputConfig();
|
|
2412
|
-
const converted = rows.map((row) => toMultipleInputRow(config, coerceImportedRow(config, row)));
|
|
2413
|
-
this.value = [...(this.value ?? []), ...converted];
|
|
2414
|
-
this.markAsTouched();
|
|
2415
|
-
}
|
|
2416
|
-
get parentFormGroup() {
|
|
2417
|
-
return this.ngControl?.control?.parent;
|
|
2418
|
-
}
|
|
2419
|
-
get canAddRecords() {
|
|
2420
|
-
const config = this.inputConfig();
|
|
2421
|
-
if (!config)
|
|
2422
|
-
return false;
|
|
2423
|
-
//NOTE: Temporary backward compatibility for older versions of the config that might not have the new property
|
|
2424
|
-
if (!config.multipleInputAvailableOperations)
|
|
2425
|
-
return true;
|
|
2426
|
-
return config.multipleInputAvailableOperations?.includes(MultipleInputAvailableOperations.Add);
|
|
2427
|
-
}
|
|
2428
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: MultipleInputTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2429
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: MultipleInputTableComponent, isStandalone: true, selector: "lib-multiple-input-table", inputs: { editorMode: { classPropertyName: "editorMode", publicName: "editorMode", isSignal: true, isRequired: false, transformFunction: null }, formGroup: { classPropertyName: "formGroup", publicName: "formGroup", isSignal: true, isRequired: true, transformFunction: null }, inputConfig: { classPropertyName: "inputConfig", publicName: "inputConfig", isSignal: true, isRequired: true, transformFunction: null }, formBuilderFunctions: { classPropertyName: "formBuilderFunctions", publicName: "formBuilderFunctions", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: MatFormFieldControl, useExisting: MultipleInputTableComponent }], usesInheritance: true, ngImport: i0, template: "<lib-multiple-input-table-view\n [inputConfig]=\"inputConfig()\"\n [dataSource]=\"dataSource\"\n [applyOptionsTo]=\"applyOptionsTo\"\n [formGroup]=\"parentFormGroup\"\n (onEditItem)=\"editRow($event)\"\n (showItemAsLabel)=\"showItemAsLabel(inputConfig())\"\n (onDeleteItem)=\"multipleInputRemoveItem(applyOptionsTo)\"\n (onCopy)=\"copy($event)\"\n (onApplyOptionsTo)=\"applyOptionsTo = $event\"\n></lib-multiple-input-table-view>\n\n@if (!!inputConfig().formIsOpen || !!rowInViewOnly) {\n <lib-multiple-input-table-edit\n [editorMode]=\"editorMode()\"\n (editMultipleInput)=\"editInput($event)\"\n (deleteInput)=\"deleteItemInput($event)\"\n (addFunction)=\"addFunction($event)\"\n (showItemAsLabel)=\"showItemAsLabel($event)\"\n (onSaveMultipleInputForm)=\"saveMultipleInputForm()\"\n (reorderItems)=\"reorderItems($event)\"\n [formBuilderFunctions]=\"formBuilderFunctions()\"\n [formGroup]=\"parentFormGroup\"\n [inputConfig]=\"inputConfig()\"\n ></lib-multiple-input-table-edit>\n}\n\n@if (!inputConfig().readonly && !inputConfig().disabled && !inputConfig().formIsOpen && canAddRecords) {\n <section class=\"add-row-bar\">\n <!--\n One dashed pill. The add button is the everyday action; once the host has\n bound a spreadsheet parser a narrow chevron segment joins it, opening the\n menu of other ways to add rows. Without a parser the pill is exactly the\n add button it always was.\n -->\n <div class=\"add-row-group\" [class.add-row-group--split]=\"canImportRows\">\n <button class=\"add-row-button\" (click)=\"generateMultipleInputForm()\" mat-stroked-button>\n <mat-icon class=\"add-row-icon\">{{ handleIcon() }}</mat-icon>\n <span class=\"add-row-label\">{{ handleLabel }}</span>\n </button>\n @if (canImportRows) {\n <button\n type=\"button\"\n class=\"add-row-more\"\n mat-stroked-button\n aria-label=\"More ways to add rows\"\n [attr.aria-expanded]=\"addRowMenuTrigger.menuOpen\"\n [matMenuTriggerFor]=\"addRowMenu\"\n #addRowMenuTrigger=\"matMenuTrigger\"\n >\n <mat-icon class=\"add-row-more-icon\">arrow_drop_down</mat-icon>\n </button>\n }\n </div>\n </section>\n}\n\n<mat-menu #addRowMenu=\"matMenu\">\n <ng-template matMenuContent>\n <button\n type=\"button\"\n mat-menu-item\n class=\"add-row-menu-item add-row-menu-item--import\"\n (click)=\"importRowsFromSpreadsheet()\"\n >\n <mat-icon>upload_file</mat-icon>\n <div class=\"add-row-menu__text\">\n <div class=\"add-row-menu__main\">Import from spreadsheet</div>\n <div class=\"add-row-menu__sub\">Check the rows of a workbook and add the ones that pass</div>\n </div>\n </button>\n @if (canDownloadTemplate) {\n <button\n type=\"button\"\n mat-menu-item\n class=\"add-row-menu-item add-row-menu-item--template\"\n (click)=\"downloadImportTemplate()\"\n >\n <mat-icon>download</mat-icon>\n <div class=\"add-row-menu__text\">\n <div class=\"add-row-menu__main\">Download import template</div>\n <div class=\"add-row-menu__sub\">A workbook with the headers to fill in and a guide to each column</div>\n </div>\n </button>\n }\n </ng-template>\n</mat-menu>\n", styles: [".table-container{position:relative;max-height:400px;overflow:auto}table{width:100%}.add-row-bar{margin-top:.5rem}.add-row-group{display:flex;align-items:stretch;width:100%}.add-row-button{flex:1 1 auto;width:100%;min-height:2.25rem;display:inline-flex;align-items:center;justify-content:center;gap:.375rem;border:1px dashed color-mix(in srgb,var(--mat-sys-outline, #79747e) 60%,transparent);border-radius:8px;color:var(--mat-sys-on-surface-variant, #49454f);background:transparent;font-size:.8125rem;font-weight:500;letter-spacing:.01em;transition:border-color .3s cubic-bezier(.16,1,.3,1),color .3s cubic-bezier(.16,1,.3,1),background .3s cubic-bezier(.16,1,.3,1)}.add-row-button:hover{border-color:var(--mat-sys-primary, #6750a4);color:var(--mat-sys-primary, #6750a4);background:color-mix(in srgb,var(--mat-sys-primary, #6750a4) 6%,transparent)}.add-row-button:focus-visible{border-style:solid;border-color:var(--mat-sys-primary, #6750a4);box-shadow:0 0 0 2px color-mix(in srgb,var(--mat-sys-primary, #6750a4) 25%,transparent)}.add-row-group--split .add-row-button{border-top-right-radius:0;border-bottom-right-radius:0;border-right:none}.add-row-more{flex:0 0 auto;width:2.25rem;min-width:0;min-height:2.25rem;padding:0;display:inline-flex;align-items:center;justify-content:center;border:1px dashed color-mix(in srgb,var(--lib-forms-outline) 60%,transparent);border-left:1px solid color-mix(in srgb,var(--lib-forms-outline) 40%,transparent);border-radius:0 var(--lib-forms-radius-sm) var(--lib-forms-radius-sm) 0;color:var(--lib-forms-on-surface-variant);background:transparent;transition:border-color var(--lib-forms-duration-hover) var(--lib-forms-easing),color var(--lib-forms-duration-hover) var(--lib-forms-easing),background var(--lib-forms-duration-hover) var(--lib-forms-easing)}.add-row-more:hover,.add-row-more[aria-expanded=true]{border-color:var(--lib-forms-primary);color:var(--lib-forms-primary);background:color-mix(in srgb,var(--lib-forms-primary) 6%,transparent)}.add-row-more:focus-visible{border-style:solid;border-color:var(--lib-forms-primary);box-shadow:0 0 0 2px color-mix(in srgb,var(--lib-forms-primary) 25%,transparent)}.add-row-more-icon{margin:0;font-size:1.25rem;width:1.25rem;height:1.25rem;line-height:1.25rem}.add-row-icon{font-size:1.125rem;width:1.125rem;height:1.125rem;line-height:1.125rem}.add-row-label{line-height:1}.add-row-menu__text{display:flex;flex-direction:column;margin-left:.5rem}.add-row-menu__main{font-size:.875rem;font-weight:500;margin-bottom:2px;line-height:normal}.add-row-menu__sub{font-size:.75rem;font-weight:400;line-height:1.2;color:var(--lib-forms-on-surface-variant)}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.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"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i6.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i6.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i6.MatMenuContent, selector: "ng-template[matMenuContent]" }, { kind: "directive", type: i6.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "component", type: MultipleInputTableEditComponent, selector: "lib-multiple-input-table-edit", inputs: ["inputConfig", "editorMode", "formGroup", "formBuilderFunctions"], outputs: ["onSaveMultipleInputForm", "editMultipleInput", "deleteInput", "showItemAsLabel", "addFunction", "reorderItems"] }, { kind: "component", type: MultipleInputTableViewComponent, selector: "lib-multiple-input-table-view", inputs: ["inputConfig", "dataSource", "applyOptionsTo", "formGroup"], outputs: ["onEditItem", "onDeleteItem", "onCopy", "onApplyOptionsTo", "showItemAsLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2430
|
-
}
|
|
2431
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: MultipleInputTableComponent, decorators: [{
|
|
2432
|
-
type: Component,
|
|
2433
|
-
args: [{ selector: 'lib-multiple-input-table', imports: [
|
|
2434
|
-
MatButtonModule,
|
|
2435
|
-
MatIconModule,
|
|
2436
|
-
MatMenuModule,
|
|
2437
|
-
MultipleInputTableEditComponent,
|
|
2438
|
-
MultipleInputTableViewComponent,
|
|
2439
|
-
], providers: [{ provide: MatFormFieldControl, useExisting: MultipleInputTableComponent }], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, template: "<lib-multiple-input-table-view\n [inputConfig]=\"inputConfig()\"\n [dataSource]=\"dataSource\"\n [applyOptionsTo]=\"applyOptionsTo\"\n [formGroup]=\"parentFormGroup\"\n (onEditItem)=\"editRow($event)\"\n (showItemAsLabel)=\"showItemAsLabel(inputConfig())\"\n (onDeleteItem)=\"multipleInputRemoveItem(applyOptionsTo)\"\n (onCopy)=\"copy($event)\"\n (onApplyOptionsTo)=\"applyOptionsTo = $event\"\n></lib-multiple-input-table-view>\n\n@if (!!inputConfig().formIsOpen || !!rowInViewOnly) {\n <lib-multiple-input-table-edit\n [editorMode]=\"editorMode()\"\n (editMultipleInput)=\"editInput($event)\"\n (deleteInput)=\"deleteItemInput($event)\"\n (addFunction)=\"addFunction($event)\"\n (showItemAsLabel)=\"showItemAsLabel($event)\"\n (onSaveMultipleInputForm)=\"saveMultipleInputForm()\"\n (reorderItems)=\"reorderItems($event)\"\n [formBuilderFunctions]=\"formBuilderFunctions()\"\n [formGroup]=\"parentFormGroup\"\n [inputConfig]=\"inputConfig()\"\n ></lib-multiple-input-table-edit>\n}\n\n@if (!inputConfig().readonly && !inputConfig().disabled && !inputConfig().formIsOpen && canAddRecords) {\n <section class=\"add-row-bar\">\n <!--\n One dashed pill. The add button is the everyday action; once the host has\n bound a spreadsheet parser a narrow chevron segment joins it, opening the\n menu of other ways to add rows. Without a parser the pill is exactly the\n add button it always was.\n -->\n <div class=\"add-row-group\" [class.add-row-group--split]=\"canImportRows\">\n <button class=\"add-row-button\" (click)=\"generateMultipleInputForm()\" mat-stroked-button>\n <mat-icon class=\"add-row-icon\">{{ handleIcon() }}</mat-icon>\n <span class=\"add-row-label\">{{ handleLabel }}</span>\n </button>\n @if (canImportRows) {\n <button\n type=\"button\"\n class=\"add-row-more\"\n mat-stroked-button\n aria-label=\"More ways to add rows\"\n [attr.aria-expanded]=\"addRowMenuTrigger.menuOpen\"\n [matMenuTriggerFor]=\"addRowMenu\"\n #addRowMenuTrigger=\"matMenuTrigger\"\n >\n <mat-icon class=\"add-row-more-icon\">arrow_drop_down</mat-icon>\n </button>\n }\n </div>\n </section>\n}\n\n<mat-menu #addRowMenu=\"matMenu\">\n <ng-template matMenuContent>\n <button\n type=\"button\"\n mat-menu-item\n class=\"add-row-menu-item add-row-menu-item--import\"\n (click)=\"importRowsFromSpreadsheet()\"\n >\n <mat-icon>upload_file</mat-icon>\n <div class=\"add-row-menu__text\">\n <div class=\"add-row-menu__main\">Import from spreadsheet</div>\n <div class=\"add-row-menu__sub\">Check the rows of a workbook and add the ones that pass</div>\n </div>\n </button>\n @if (canDownloadTemplate) {\n <button\n type=\"button\"\n mat-menu-item\n class=\"add-row-menu-item add-row-menu-item--template\"\n (click)=\"downloadImportTemplate()\"\n >\n <mat-icon>download</mat-icon>\n <div class=\"add-row-menu__text\">\n <div class=\"add-row-menu__main\">Download import template</div>\n <div class=\"add-row-menu__sub\">A workbook with the headers to fill in and a guide to each column</div>\n </div>\n </button>\n }\n </ng-template>\n</mat-menu>\n", styles: [".table-container{position:relative;max-height:400px;overflow:auto}table{width:100%}.add-row-bar{margin-top:.5rem}.add-row-group{display:flex;align-items:stretch;width:100%}.add-row-button{flex:1 1 auto;width:100%;min-height:2.25rem;display:inline-flex;align-items:center;justify-content:center;gap:.375rem;border:1px dashed color-mix(in srgb,var(--mat-sys-outline, #79747e) 60%,transparent);border-radius:8px;color:var(--mat-sys-on-surface-variant, #49454f);background:transparent;font-size:.8125rem;font-weight:500;letter-spacing:.01em;transition:border-color .3s cubic-bezier(.16,1,.3,1),color .3s cubic-bezier(.16,1,.3,1),background .3s cubic-bezier(.16,1,.3,1)}.add-row-button:hover{border-color:var(--mat-sys-primary, #6750a4);color:var(--mat-sys-primary, #6750a4);background:color-mix(in srgb,var(--mat-sys-primary, #6750a4) 6%,transparent)}.add-row-button:focus-visible{border-style:solid;border-color:var(--mat-sys-primary, #6750a4);box-shadow:0 0 0 2px color-mix(in srgb,var(--mat-sys-primary, #6750a4) 25%,transparent)}.add-row-group--split .add-row-button{border-top-right-radius:0;border-bottom-right-radius:0;border-right:none}.add-row-more{flex:0 0 auto;width:2.25rem;min-width:0;min-height:2.25rem;padding:0;display:inline-flex;align-items:center;justify-content:center;border:1px dashed color-mix(in srgb,var(--lib-forms-outline) 60%,transparent);border-left:1px solid color-mix(in srgb,var(--lib-forms-outline) 40%,transparent);border-radius:0 var(--lib-forms-radius-sm) var(--lib-forms-radius-sm) 0;color:var(--lib-forms-on-surface-variant);background:transparent;transition:border-color var(--lib-forms-duration-hover) var(--lib-forms-easing),color var(--lib-forms-duration-hover) var(--lib-forms-easing),background var(--lib-forms-duration-hover) var(--lib-forms-easing)}.add-row-more:hover,.add-row-more[aria-expanded=true]{border-color:var(--lib-forms-primary);color:var(--lib-forms-primary);background:color-mix(in srgb,var(--lib-forms-primary) 6%,transparent)}.add-row-more:focus-visible{border-style:solid;border-color:var(--lib-forms-primary);box-shadow:0 0 0 2px color-mix(in srgb,var(--lib-forms-primary) 25%,transparent)}.add-row-more-icon{margin:0;font-size:1.25rem;width:1.25rem;height:1.25rem;line-height:1.25rem}.add-row-icon{font-size:1.125rem;width:1.125rem;height:1.125rem;line-height:1.125rem}.add-row-label{line-height:1}.add-row-menu__text{display:flex;flex-direction:column;margin-left:.5rem}.add-row-menu__main{font-size:.875rem;font-weight:500;margin-bottom:2px;line-height:normal}.add-row-menu__sub{font-size:.75rem;font-weight:400;line-height:1.2;color:var(--lib-forms-on-surface-variant)}\n"] }]
|
|
2440
|
-
}], ctorParameters: () => [], propDecorators: { editorMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "editorMode", required: false }] }], formGroup: [{ type: i0.Input, args: [{ isSignal: true, alias: "formGroup", required: true }] }], inputConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputConfig", required: true }] }], formBuilderFunctions: [{ type: i0.Input, args: [{ isSignal: true, alias: "formBuilderFunctions", required: false }] }] } });
|
|
2441
|
-
function addGroups(tableValue, groupBy) {
|
|
2442
|
-
throw new Error('Function not implemented.');
|
|
2443
|
-
}
|
|
2444
|
-
|
|
2445
|
-
/** Wraps a multi-row input table inside a `mat-form-field`. */
|
|
2446
|
-
class MultipleInputInputElementComponent {
|
|
2447
|
-
constructor() {
|
|
2448
|
-
this.inputConfig = input.required(...(ngDevMode ? [{ debugName: "inputConfig" }] : /* istanbul ignore next */ []));
|
|
2449
|
-
this.formGroup = input.required(...(ngDevMode ? [{ debugName: "formGroup" }] : /* istanbul ignore next */ []));
|
|
2450
|
-
this.editorMode = input(false, ...(ngDevMode ? [{ debugName: "editorMode" }] : /* istanbul ignore next */ []));
|
|
2451
|
-
this.formBuilderFunctions = input(undefined, ...(ngDevMode ? [{ debugName: "formBuilderFunctions" }] : /* istanbul ignore next */ []));
|
|
2452
|
-
this.reload = output();
|
|
2453
|
-
this.errorMessage = computed(() => getInputErrorMessage(this.inputConfig(), this.formGroup()), ...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
|
|
2454
|
-
}
|
|
2455
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: MultipleInputInputElementComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2456
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: MultipleInputInputElementComponent, isStandalone: true, selector: "lib-multiple-input-input-element", inputs: { inputConfig: { classPropertyName: "inputConfig", publicName: "inputConfig", isSignal: true, isRequired: true, transformFunction: null }, formGroup: { classPropertyName: "formGroup", publicName: "formGroup", isSignal: true, isRequired: true, transformFunction: null }, editorMode: { classPropertyName: "editorMode", publicName: "editorMode", isSignal: true, isRequired: false, transformFunction: null }, formBuilderFunctions: { classPropertyName: "formBuilderFunctions", publicName: "formBuilderFunctions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { reload: "reload" }, ngImport: i0, template: "<form [formGroup]=\"formGroup()\">\r\n @if (inputConfig(); as inputConfig) {\r\n <mat-form-field\r\n class=\"multiple-input-field\"\r\n [appearance]=\"inputConfig.appearance || 'fill'\"\r\n subscriptSizing=\"dynamic\"\r\n floatLabel=\"always\"\r\n >\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 @if (inputConfig.id) {\r\n <lib-multiple-input-table\r\n [editorMode]=\"editorMode()\"\r\n [required]=\"inputConfig.required\"\r\n [formGroup]=\"formGroup()\"\r\n [formBuilderFunctions]=\"formBuilderFunctions()\"\r\n [formControlName]=\"inputConfig.id\"\r\n [inputConfig]=\"inputConfig\"\r\n ></lib-multiple-input-table>\r\n }\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.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 class=\"affix-text\" matPrefix>{{ inputConfig.prefixText }}</span>\r\n }\r\n @if (inputConfig.suffixText) {\r\n <span class=\"affix-text affix-text--suffix\" matSuffix>{{ 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</form>\r\n", styles: [":host{display:block}.multiple-input-field{width:100%}.affix-text{top:0;color:var(--mat-sys-on-surface-variant, #49454f);font-size:.8125rem}.affix-text--suffix{padding-left:.3125rem}:host ::ng-deep .multiple-input-field .mat-mdc-form-field-flex{padding-left:.5rem;padding-right:.5rem}:host ::ng-deep .multiple-input-field .mat-mdc-form-field-infix{width:100%;min-height:0;padding-top:1.5rem;padding-bottom:.5rem}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$3.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1$3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2$1.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i2$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "component", type: TFormInputStatusComponent, selector: "lib-t-form-input-status", inputs: ["inputConfig"] }, { kind: "component", type: MultipleInputTableComponent, selector: "lib-multiple-input-table", inputs: ["editorMode", "formGroup", "inputConfig", "formBuilderFunctions"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2457
|
-
}
|
|
2458
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: MultipleInputInputElementComponent, decorators: [{
|
|
2459
|
-
type: Component,
|
|
2460
|
-
args: [{ selector: 'lib-multiple-input-input-element', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
2461
|
-
ReactiveFormsModule,
|
|
2462
|
-
MatFormFieldModule,
|
|
2463
|
-
MatIconModule,
|
|
2464
|
-
MatButtonModule,
|
|
2465
|
-
MatTooltipModule,
|
|
2466
|
-
TFormInputStatusComponent,
|
|
2467
|
-
MultipleInputTableComponent,
|
|
2468
|
-
], template: "<form [formGroup]=\"formGroup()\">\r\n @if (inputConfig(); as inputConfig) {\r\n <mat-form-field\r\n class=\"multiple-input-field\"\r\n [appearance]=\"inputConfig.appearance || 'fill'\"\r\n subscriptSizing=\"dynamic\"\r\n floatLabel=\"always\"\r\n >\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 @if (inputConfig.id) {\r\n <lib-multiple-input-table\r\n [editorMode]=\"editorMode()\"\r\n [required]=\"inputConfig.required\"\r\n [formGroup]=\"formGroup()\"\r\n [formBuilderFunctions]=\"formBuilderFunctions()\"\r\n [formControlName]=\"inputConfig.id\"\r\n [inputConfig]=\"inputConfig\"\r\n ></lib-multiple-input-table>\r\n }\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.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 class=\"affix-text\" matPrefix>{{ inputConfig.prefixText }}</span>\r\n }\r\n @if (inputConfig.suffixText) {\r\n <span class=\"affix-text affix-text--suffix\" matSuffix>{{ 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</form>\r\n", styles: [":host{display:block}.multiple-input-field{width:100%}.affix-text{top:0;color:var(--mat-sys-on-surface-variant, #49454f);font-size:.8125rem}.affix-text--suffix{padding-left:.3125rem}:host ::ng-deep .multiple-input-field .mat-mdc-form-field-flex{padding-left:.5rem;padding-right:.5rem}:host ::ng-deep .multiple-input-field .mat-mdc-form-field-infix{width:100%;min-height:0;padding-top:1.5rem;padding-bottom:.5rem}\n"] }]
|
|
2469
|
-
}], propDecorators: { inputConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputConfig", required: true }] }], formGroup: [{ type: i0.Input, args: [{ isSignal: true, alias: "formGroup", required: true }] }], editorMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "editorMode", required: false }] }], formBuilderFunctions: [{ type: i0.Input, args: [{ isSignal: true, alias: "formBuilderFunctions", required: false }] }], reload: [{ type: i0.Output, args: ["reload"] }] } });
|
|
2470
|
-
|
|
2471
|
-
export { MultipleInputInputElementComponent };
|
|
2472
|
-
//# sourceMappingURL=ngx-t-forms-multiple-input-input-element.component-BZxpJRxJ.mjs.map
|