ngx-t-forms 2.0.29 → 2.0.31
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-auto-complete-input-element.component-DCKuXHAW.mjs +104 -0
- package/fesm2022/ngx-t-forms-auto-complete-input-element.component-DCKuXHAW.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-basic-input-input-element.component-Ce4ipSUc.mjs +85 -0
- package/fesm2022/ngx-t-forms-basic-input-input-element.component-Ce4ipSUc.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-calculated-field-rules.component-C5TPddVe.mjs +643 -0
- package/fesm2022/ngx-t-forms-calculated-field-rules.component-C5TPddVe.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-chip-options-creator-editor.component-CICQaqz6.mjs +97 -0
- package/fesm2022/ngx-t-forms-chip-options-creator-editor.component-CICQaqz6.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-config-mscoa-additional-inputs.component-CzisLSIP.mjs +195 -0
- package/fesm2022/ngx-t-forms-config-mscoa-additional-inputs.component-CzisLSIP.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-data-source-picker.component-Dzz_o6fJ.mjs +261 -0
- package/fesm2022/ngx-t-forms-data-source-picker.component-Dzz_o6fJ.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-date-picker-input-element.component-CYUbVyzP.mjs +85 -0
- package/fesm2022/ngx-t-forms-date-picker-input-element.component-CYUbVyzP.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-date-range-picker-input-element.component-CmoquQGV.mjs +156 -0
- package/fesm2022/ngx-t-forms-date-range-picker-input-element.component-CmoquQGV.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-document-list-label-config-editor.component-CLUOXreG.mjs +368 -0
- package/fesm2022/ngx-t-forms-document-list-label-config-editor.component-CLUOXreG.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-document-picker.component-qObjcqhE.mjs +704 -0
- package/fesm2022/ngx-t-forms-document-picker.component-qObjcqhE.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-editor-input-element.component-BLXlfb6F.mjs +294 -0
- package/fesm2022/ngx-t-forms-editor-input-element.component-BLXlfb6F.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-editor-js-input.component-BQL0AH7H.mjs +240 -0
- package/fesm2022/ngx-t-forms-editor-js-input.component-BQL0AH7H.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-file-upload-input-element.component-C7mMeEjF.mjs +205 -0
- package/fesm2022/ngx-t-forms-file-upload-input-element.component-C7mMeEjF.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-form-input-selector.component-C9u8zq9B.mjs +86 -0
- package/fesm2022/ngx-t-forms-form-input-selector.component-C9u8zq9B.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-form-json-view.component-856Hx1Bg.mjs +22 -0
- package/fesm2022/ngx-t-forms-form-json-view.component-856Hx1Bg.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-form-payload-projection.component-CDkTuX9S.mjs +179 -0
- package/fesm2022/ngx-t-forms-form-payload-projection.component-CDkTuX9S.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-form-section-stepper.component-Bs50-nEB.mjs +319 -0
- package/fesm2022/ngx-t-forms-form-section-stepper.component-Bs50-nEB.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-forms-builder-menu.component-qrhM0jGL.mjs +379 -0
- package/fesm2022/ngx-t-forms-forms-builder-menu.component-qrhM0jGL.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-geo-location.component-Bosp1UzR.mjs +124 -0
- package/fesm2022/ngx-t-forms-geo-location.component-Bosp1UzR.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-getInputIcon-B4ADgevZ.mjs +31 -0
- package/fesm2022/ngx-t-forms-getInputIcon-B4ADgevZ.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-image-capture-input-element.component-C1g7Z0cK.mjs +180 -0
- package/fesm2022/ngx-t-forms-image-capture-input-element.component-C1g7Z0cK.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-index-dDSobs6A.mjs +2 -0
- package/fesm2022/ngx-t-forms-index-dDSobs6A.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-input-custom.component-BkbHFAyR.mjs +105 -0
- package/fesm2022/ngx-t-forms-input-custom.component-BkbHFAyR.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-input-editor.component-BPUOM9kQ.mjs +181 -0
- package/fesm2022/ngx-t-forms-input-editor.component-BPUOM9kQ.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-map-mat-options-keys-CbdW82su.mjs → ngx-t-forms-map-mat-options-keys-B6hJ7Io5.mjs} +12 -14
- package/fesm2022/ngx-t-forms-map-mat-options-keys-B6hJ7Io5.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-mat-chip-list-editor.component-c7uZT1sr.mjs +66 -0
- package/fesm2022/ngx-t-forms-mat-chip-list-editor.component-c7uZT1sr.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-mat-slider-editor.component-CTSBrM-j.mjs +211 -0
- package/fesm2022/ngx-t-forms-mat-slider-editor.component-CTSBrM-j.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-mat-slider-toggle-editor.component-CcYiwx-8.mjs +165 -0
- package/fesm2022/ngx-t-forms-mat-slider-toggle-editor.component-CcYiwx-8.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-missing-form-configs.component-DrnH8qdG.mjs +38 -0
- package/fesm2022/ngx-t-forms-missing-form-configs.component-DrnH8qdG.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-mscoa-chart-toolbar.component-C_abEBQ5.mjs +38 -0
- package/fesm2022/ngx-t-forms-mscoa-chart-toolbar.component-C_abEBQ5.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-mscoa-error-display.component-99DpVSy7.mjs +126 -0
- package/fesm2022/ngx-t-forms-mscoa-error-display.component-99DpVSy7.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-mscoa-segment-config.component-C0qsMfsq.mjs +336 -0
- package/fesm2022/ngx-t-forms-mscoa-segment-config.component-C0qsMfsq.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-mscoa-temporary-hint.component-B1Z-IXSL.mjs +74 -0
- package/fesm2022/ngx-t-forms-mscoa-temporary-hint.component-B1Z-IXSL.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-multiple-input-input-element.component-C7y1OGPx.mjs +905 -0
- package/fesm2022/ngx-t-forms-multiple-input-input-element.component-C7y1OGPx.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-ngx-t-forms-u_kigDid.mjs +19461 -0
- package/fesm2022/ngx-t-forms-ngx-t-forms-u_kigDid.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-paginated-selection-table-AQZSMmhr.mjs +555 -0
- package/fesm2022/ngx-t-forms-paginated-selection-table-AQZSMmhr.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-pipeline-generator.component-DmNSc5aw.mjs +748 -0
- package/fesm2022/ngx-t-forms-pipeline-generator.component-DmNSc5aw.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-record-list-manager.component-CUMMvMch.mjs +358 -0
- package/fesm2022/ngx-t-forms-record-list-manager.component-CUMMvMch.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-required-inputs.component-Ch2yNcIS.mjs +272 -0
- package/fesm2022/ngx-t-forms-required-inputs.component-Ch2yNcIS.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-rest-api-call-setup.component-C_aFtdvW.mjs +398 -0
- package/fesm2022/ngx-t-forms-rest-api-call-setup.component-C_aFtdvW.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-search-field.component-B2ZO7lqO.mjs +38 -0
- package/fesm2022/ngx-t-forms-search-field.component-B2ZO7lqO.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-section-report.component-BxOhR6C0.mjs +98 -0
- package/fesm2022/ngx-t-forms-section-report.component-BxOhR6C0.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-select-input-element.component-DbgZdNoe.mjs +150 -0
- package/fesm2022/ngx-t-forms-select-input-element.component-DbgZdNoe.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-selection-options-editor.component-Dhln81DL.mjs +169 -0
- package/fesm2022/ngx-t-forms-selection-options-editor.component-Dhln81DL.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-t-workflow-picker.component-leBokXvM.mjs +204 -0
- package/fesm2022/ngx-t-forms-t-workflow-picker.component-leBokXvM.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-textarea-input-element.component-BEbXJjFA.mjs +95 -0
- package/fesm2022/ngx-t-forms-textarea-input-element.component-BEbXJjFA.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-toggle-input-element.component-DDErRUJd.mjs +82 -0
- package/fesm2022/ngx-t-forms-toggle-input-element.component-DDErRUJd.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-validators-config.component-oGjQVGE2.mjs +733 -0
- package/fesm2022/ngx-t-forms-validators-config.component-oGjQVGE2.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-workflow-adjudication.component-CtU8dECN.mjs +1303 -0
- package/fesm2022/ngx-t-forms-workflow-adjudication.component-CtU8dECN.mjs.map +1 -0
- package/fesm2022/ngx-t-forms.mjs +2 -1
- package/fesm2022/ngx-t-forms.mjs.map +1 -1
- package/package.json +20 -18
- package/styles/_editor-mixins.scss +62 -0
- package/styles/_json-editor-syntax.scss +26 -0
- package/styles/_signature-pad.scss +26 -0
- package/styles/_tokens.scss +148 -0
- package/types/ngx-t-forms.d.ts +1767 -621
- package/fesm2022/ngx-t-forms-calculated-field-rules.component-D-SBMdYg.mjs +0 -313
- package/fesm2022/ngx-t-forms-calculated-field-rules.component-D-SBMdYg.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-chip-options-creator-editor.component-1cpszpPN.mjs +0 -191
- package/fesm2022/ngx-t-forms-chip-options-creator-editor.component-1cpszpPN.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-config-mscoa-additional-inputs.component-DFdAVWTg.mjs +0 -207
- package/fesm2022/ngx-t-forms-config-mscoa-additional-inputs.component-DFdAVWTg.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-data-source-picker.component-DxORinAD.mjs +0 -204
- package/fesm2022/ngx-t-forms-data-source-picker.component-DxORinAD.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-document-list-label-config-editor.component-DcWS1txl.mjs +0 -289
- package/fesm2022/ngx-t-forms-document-list-label-config-editor.component-DcWS1txl.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-form-input-selector.component-B2QEnvkq.mjs +0 -134
- package/fesm2022/ngx-t-forms-form-input-selector.component-B2QEnvkq.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-form-json-view.component-DePf44w6.mjs +0 -22
- package/fesm2022/ngx-t-forms-form-json-view.component-DePf44w6.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-form-section-stepper.component-BTkcSjg7.mjs +0 -270
- package/fesm2022/ngx-t-forms-form-section-stepper.component-BTkcSjg7.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-forms-builder-menu.component-Wamzf_sq.mjs +0 -345
- package/fesm2022/ngx-t-forms-forms-builder-menu.component-Wamzf_sq.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-input-editor.component-D4xHO76K.mjs +0 -147
- package/fesm2022/ngx-t-forms-input-editor.component-D4xHO76K.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-map-mat-options-keys-CbdW82su.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mat-chip-list-editor.component-DmTyO9Wi.mjs +0 -105
- package/fesm2022/ngx-t-forms-mat-chip-list-editor.component-DmTyO9Wi.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mat-slider-editor.component-DZ4TenrI.mjs +0 -109
- package/fesm2022/ngx-t-forms-mat-slider-editor.component-DZ4TenrI.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mat-slider-toggle-editor.component-DPyBYE4p.mjs +0 -155
- package/fesm2022/ngx-t-forms-mat-slider-toggle-editor.component-DPyBYE4p.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-missing-form-configs.component-BRmnwAK6.mjs +0 -28
- package/fesm2022/ngx-t-forms-missing-form-configs.component-BRmnwAK6.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mscoa-chart-toolbar.component-D_umeAPL.mjs +0 -43
- package/fesm2022/ngx-t-forms-mscoa-chart-toolbar.component-D_umeAPL.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mscoa-error-display.component-CSX2NCNU.mjs +0 -116
- package/fesm2022/ngx-t-forms-mscoa-error-display.component-CSX2NCNU.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mscoa-segment-config.component-B6IF8kGg.mjs +0 -296
- package/fesm2022/ngx-t-forms-mscoa-segment-config.component-B6IF8kGg.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mscoa-temporary-hint.component-BPkjsRmH.mjs +0 -83
- package/fesm2022/ngx-t-forms-mscoa-temporary-hint.component-BPkjsRmH.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-ngx-t-forms-D9qmig6g.mjs +0 -16844
- package/fesm2022/ngx-t-forms-ngx-t-forms-D9qmig6g.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-pipeline-generator.component-DBJEyCbd.mjs +0 -613
- package/fesm2022/ngx-t-forms-pipeline-generator.component-DBJEyCbd.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-record-list-manager.component-Dgs9lNSr.mjs +0 -269
- package/fesm2022/ngx-t-forms-record-list-manager.component-Dgs9lNSr.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-required-inputs.component-CSIJvSHq.mjs +0 -190
- package/fesm2022/ngx-t-forms-required-inputs.component-CSIJvSHq.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-rest-api-call-setup.component-CY-JSkGs.mjs +0 -291
- package/fesm2022/ngx-t-forms-rest-api-call-setup.component-CY-JSkGs.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-section-report.component-12-KdKT6.mjs +0 -156
- package/fesm2022/ngx-t-forms-section-report.component-12-KdKT6.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-selection-options-editor.component-Be3QAG_L.mjs +0 -186
- package/fesm2022/ngx-t-forms-selection-options-editor.component-Be3QAG_L.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-t-workflow-picker.component-a4f1r8gH.mjs +0 -187
- package/fesm2022/ngx-t-forms-t-workflow-picker.component-a4f1r8gH.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-validators-config.component-B3j9Dmgu.mjs +0 -215
- package/fesm2022/ngx-t-forms-validators-config.component-B3j9Dmgu.mjs.map +0 -1
|
@@ -0,0 +1,905 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, output, computed, ViewEncapsulation, ChangeDetectionStrategy, Component, inject, DestroyRef, ElementRef } from '@angular/core';
|
|
3
|
+
import * as i1$4 from '@angular/forms';
|
|
4
|
+
import { NgControl, ReactiveFormsModule } from '@angular/forms';
|
|
5
|
+
import * as i2 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 i1 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 { b as TDynamicDataViewComponent, r as TFormInputComponent, v as calculateListOveralFunctions, B as BaseCustomInput, _ as _isEqual, m as getInputErrorMessage, n as TFormInputStatusComponent } from './ngx-t-forms-ngx-t-forms-u_kigDid.mjs';
|
|
14
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
15
|
+
import * as i5 from '@angular/material/table';
|
|
16
|
+
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
|
|
17
|
+
import { DocumentLitsLabelConfigInterfaceValueType, InputDataTypes, MultipleInputAvailableOperations, CalculationFunctions } from 'ngx-t-forms-types';
|
|
18
|
+
import * as i1$1 from '@angular/material/chips';
|
|
19
|
+
import { MatChipsModule } from '@angular/material/chips';
|
|
20
|
+
import * as i6 from '@angular/material/menu';
|
|
21
|
+
import { MatMenuModule } from '@angular/material/menu';
|
|
22
|
+
import * as i1$2 from '@angular/material/progress-bar';
|
|
23
|
+
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
24
|
+
import * as i3$1 from '@angular/material/progress-spinner';
|
|
25
|
+
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
26
|
+
import * as i10 from '@angular/material/sort';
|
|
27
|
+
import { MatSortModule } from '@angular/material/sort';
|
|
28
|
+
import * as i3$2 from '@angular/common';
|
|
29
|
+
import { CommonModule } from '@angular/common';
|
|
30
|
+
import * as i3$3 from '@angular/material/card';
|
|
31
|
+
import { MatCardModule } from '@angular/material/card';
|
|
32
|
+
import { MatDividerModule } from '@angular/material/divider';
|
|
33
|
+
import * as i1$3 from '@angular/cdk/drag-drop';
|
|
34
|
+
import { DragDropModule } from '@angular/cdk/drag-drop';
|
|
35
|
+
import { Subject, timer, tap, takeUntil } from 'rxjs';
|
|
36
|
+
import { v4 } from 'uuid';
|
|
37
|
+
import * as i4 from '@angular/material/list';
|
|
38
|
+
|
|
39
|
+
class ColorScale {
|
|
40
|
+
constructor(min, max, colorStops, alpha = 1) {
|
|
41
|
+
validateMinMaxValues(min, max);
|
|
42
|
+
validateColorStops(colorStops);
|
|
43
|
+
validateAlphaValue(alpha);
|
|
44
|
+
this.min = min;
|
|
45
|
+
this.max = max;
|
|
46
|
+
this.alpha = alpha;
|
|
47
|
+
this.colorStops = colorStops.map((colorStop) => hexToColor(colorStop, alpha));
|
|
48
|
+
}
|
|
49
|
+
getColor(value) {
|
|
50
|
+
const numOfColorStops = this.colorStops.length;
|
|
51
|
+
if (value < this.min)
|
|
52
|
+
return this.colorStops[0];
|
|
53
|
+
if (value > this.max)
|
|
54
|
+
return this.colorStops[numOfColorStops - 1];
|
|
55
|
+
const range = this.max - this.min;
|
|
56
|
+
let weight = (value - this.min) / range;
|
|
57
|
+
const colorStopIndex = Math.max(Math.ceil(weight * (numOfColorStops - 1)), 1);
|
|
58
|
+
const minColor = this.colorStops[colorStopIndex - 1];
|
|
59
|
+
const maxColor = this.colorStops[colorStopIndex];
|
|
60
|
+
if (maxColor === undefined)
|
|
61
|
+
return minColor;
|
|
62
|
+
if (minColor === undefined)
|
|
63
|
+
return maxColor;
|
|
64
|
+
weight = weight * (numOfColorStops - 1) - (colorStopIndex - 1);
|
|
65
|
+
const r = Math.floor(weight * maxColor.r + (1 - weight) * minColor.r);
|
|
66
|
+
const g = Math.floor(weight * maxColor.g + (1 - weight) * minColor.g);
|
|
67
|
+
const b = Math.floor(weight * maxColor.b + (1 - weight) * minColor.b);
|
|
68
|
+
return new Color(r, g, b, this.alpha);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function validateMinMaxValues(min, max) {
|
|
72
|
+
if (min > max) {
|
|
73
|
+
throw new Error('The minimum value must be less than the maximum value.');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function validateColorStops(colorStops) {
|
|
77
|
+
if (colorStops.length < 2) {
|
|
78
|
+
throw new Error('At least two colors must be provided.');
|
|
79
|
+
}
|
|
80
|
+
colorStops.forEach((str) => {
|
|
81
|
+
if (!isValidHexColor(str)) {
|
|
82
|
+
throw new Error(`${str} is not a valid hex color.`);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function validateAlphaValue(alpha) {
|
|
87
|
+
if (alpha < 0 || alpha > 1) {
|
|
88
|
+
throw new Error('The alpha value must be between 0 and 1.');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function hexToColor(hex, alpha) {
|
|
92
|
+
if (isValid3DigitHexColor(hex)) {
|
|
93
|
+
hex = convertTo6DigitHexColor(hex);
|
|
94
|
+
}
|
|
95
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
96
|
+
if (!!result?.[1] && !!result?.[2] && !!result?.[3]) {
|
|
97
|
+
return new Color(parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16), alpha);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
throw new Error(`${hex} is not a valid hex color.`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function isValidHexColor(colorString) {
|
|
104
|
+
return (isValid3DigitHexColor(colorString) || isValid6DigitHexColor(colorString));
|
|
105
|
+
}
|
|
106
|
+
function isValid3DigitHexColor(colorString) {
|
|
107
|
+
const hexColorRegex = /^#(?:[0-9a-fA-F]{3})$/;
|
|
108
|
+
return colorString.match(hexColorRegex);
|
|
109
|
+
}
|
|
110
|
+
function isValid6DigitHexColor(colorString) {
|
|
111
|
+
const hexColorRegex = /^#(?:[0-9a-fA-F]{6})$/;
|
|
112
|
+
return colorString.match(hexColorRegex);
|
|
113
|
+
}
|
|
114
|
+
function convertTo6DigitHexColor(threeDigitHex) {
|
|
115
|
+
return threeDigitHex
|
|
116
|
+
.substring(1)
|
|
117
|
+
.split('')
|
|
118
|
+
.map((char) => {
|
|
119
|
+
return char + char;
|
|
120
|
+
})
|
|
121
|
+
.join('');
|
|
122
|
+
}
|
|
123
|
+
function componentToHex(c) {
|
|
124
|
+
const hex = c.toString(16);
|
|
125
|
+
return hex.length === 1 ? '0' + hex : hex;
|
|
126
|
+
}
|
|
127
|
+
function rgbaToHex(color) {
|
|
128
|
+
const r = Math.floor(color.r * color.a);
|
|
129
|
+
const g = Math.floor(color.g * color.a);
|
|
130
|
+
const b = Math.floor(color.b * color.a);
|
|
131
|
+
return `#${componentToHex(r)}${componentToHex(g)}${componentToHex(b)}`;
|
|
132
|
+
}
|
|
133
|
+
class Color {
|
|
134
|
+
constructor(r, g, b, a = 1) {
|
|
135
|
+
validateAlphaValue(a);
|
|
136
|
+
this.r = r;
|
|
137
|
+
this.g = g;
|
|
138
|
+
this.b = b;
|
|
139
|
+
this.a = a;
|
|
140
|
+
}
|
|
141
|
+
toRGBString() {
|
|
142
|
+
return `rgb(${Math.floor(this.r * this.a)},${Math.floor(this.g * this.a)},${Math.floor(this.b * this.a)})`;
|
|
143
|
+
}
|
|
144
|
+
toRGBAString() {
|
|
145
|
+
return `rgba(${this.r},${this.g},${this.b},${this.a})`;
|
|
146
|
+
}
|
|
147
|
+
toHexString() {
|
|
148
|
+
return rgbaToHex(this);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
153
|
+
function configureCols(inputConfig, tempLabels) {
|
|
154
|
+
try {
|
|
155
|
+
const labelInputs = (inputConfig?.formInputs || []).filter(input => input.showAsLabel || tempLabels.includes(input.formControlName));
|
|
156
|
+
const cols = [];
|
|
157
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
158
|
+
const colConfigs = {};
|
|
159
|
+
for (let index = 0; index < (labelInputs).length; index++) {
|
|
160
|
+
const c = labelInputs[index];
|
|
161
|
+
const col = { ...c };
|
|
162
|
+
cols.push(`${inputConfig.id}.${col.id}`);
|
|
163
|
+
if (!col.id) {
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
colConfigs[`${inputConfig.id}.${col.id}`] = {
|
|
167
|
+
property: `${inputConfig.id}.${col.id}`,
|
|
168
|
+
formControlName: col.formControlName,
|
|
169
|
+
label: col.label,
|
|
170
|
+
dataType: getDataType(col)
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
//add remove section config
|
|
174
|
+
cols.push('itemRemovalButton');
|
|
175
|
+
colConfigs['itemRemovalButton'] = {
|
|
176
|
+
property: 'itemRemovalButton',
|
|
177
|
+
label: '',
|
|
178
|
+
type: 'removal',
|
|
179
|
+
};
|
|
180
|
+
// end
|
|
181
|
+
return {
|
|
182
|
+
displayedColumnsInOrder: cols.filter((c) => !!c),
|
|
183
|
+
columnsConfig: colConfigs
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
const message = error instanceof Error ? error.message : 'Failed to configure columns';
|
|
188
|
+
throw new Error(message);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function getDataType(input) {
|
|
192
|
+
try {
|
|
193
|
+
if (input.pipe?.pipeType) {
|
|
194
|
+
return input.pipe.pipeType;
|
|
195
|
+
}
|
|
196
|
+
const inputDataType = input.dataType;
|
|
197
|
+
switch (inputDataType) {
|
|
198
|
+
case InputDataTypes.Number:
|
|
199
|
+
return DocumentLitsLabelConfigInterfaceValueType.number;
|
|
200
|
+
case InputDataTypes.Date:
|
|
201
|
+
return DocumentLitsLabelConfigInterfaceValueType.date;
|
|
202
|
+
case InputDataTypes.Array:
|
|
203
|
+
return InputDataTypes.Array;
|
|
204
|
+
case InputDataTypes.Boolean:
|
|
205
|
+
return InputDataTypes.Boolean;
|
|
206
|
+
case InputDataTypes.Object:
|
|
207
|
+
return InputDataTypes.Object;
|
|
208
|
+
default:
|
|
209
|
+
return DocumentLitsLabelConfigInterfaceValueType.string;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
catch (error) {
|
|
213
|
+
const msg = error instanceof Error ? error.message : 'Failed to get data type';
|
|
214
|
+
throw new Error(msg);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
class MultipleInputTableViewComponent {
|
|
219
|
+
constructor() {
|
|
220
|
+
this.inputConfig = input(undefined, ...(ngDevMode ? [{ debugName: "inputConfig" }] : /* istanbul ignore next */ []));
|
|
221
|
+
this.dataSource = input(new MatTableDataSource(), ...(ngDevMode ? [{ debugName: "dataSource" }] : /* istanbul ignore next */ []));
|
|
222
|
+
this.applyOptionsTo = input(undefined, ...(ngDevMode ? [{ debugName: "applyOptionsTo" }] : /* istanbul ignore next */ []));
|
|
223
|
+
this.formGroup = input(null, ...(ngDevMode ? [{ debugName: "formGroup" }] : /* istanbul ignore next */ []));
|
|
224
|
+
this.onEditItem = output();
|
|
225
|
+
this.onDeleteItem = output();
|
|
226
|
+
this.onCopy = output();
|
|
227
|
+
this.onApplyOptionsTo = output();
|
|
228
|
+
this.showItemAsLabel = output();
|
|
229
|
+
this.colConfig = computed(() => {
|
|
230
|
+
const cfg = this.inputConfig();
|
|
231
|
+
if (!cfg) {
|
|
232
|
+
return {
|
|
233
|
+
columnsConfig: {},
|
|
234
|
+
displayedColumnsInOrder: [],
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
return configureCols(cfg, this.tempLabels);
|
|
238
|
+
}, ...(ngDevMode ? [{ debugName: "colConfig" }] : /* istanbul ignore next */ []));
|
|
239
|
+
this.displayedColumnsInOrderSig = computed(() => this.colConfig().displayedColumnsInOrder, ...(ngDevMode ? [{ debugName: "displayedColumnsInOrderSig" }] : /* istanbul ignore next */ []));
|
|
240
|
+
this.allPossibleLabels = computed(() => {
|
|
241
|
+
const cfg = this.inputConfig();
|
|
242
|
+
const displayed = this.displayedColumnsInOrderSig();
|
|
243
|
+
return (cfg?.formInputs?.map((inp) => ({
|
|
244
|
+
label: inp.label,
|
|
245
|
+
selected: displayed.includes(`${cfg?.id}.${inp.id}`),
|
|
246
|
+
formControlName: inp.formControlName,
|
|
247
|
+
})) || []);
|
|
248
|
+
}, ...(ngDevMode ? [{ debugName: "allPossibleLabels" }] : /* istanbul ignore next */ []));
|
|
249
|
+
this.userCanEdit = computed(() => {
|
|
250
|
+
const cfg = this.inputConfig();
|
|
251
|
+
if (!cfg)
|
|
252
|
+
return false;
|
|
253
|
+
if (!cfg.multipleInputAvailableOperations)
|
|
254
|
+
return true;
|
|
255
|
+
return cfg.multipleInputAvailableOperations.includes(MultipleInputAvailableOperations.Update);
|
|
256
|
+
}, ...(ngDevMode ? [{ debugName: "userCanEdit" }] : /* istanbul ignore next */ []));
|
|
257
|
+
this.userCanRemove = computed(() => {
|
|
258
|
+
const cfg = this.inputConfig();
|
|
259
|
+
if (!cfg)
|
|
260
|
+
return false;
|
|
261
|
+
if (!cfg.multipleInputAvailableOperations)
|
|
262
|
+
return true;
|
|
263
|
+
return cfg.multipleInputAvailableOperations.includes(MultipleInputAvailableOperations.Remove);
|
|
264
|
+
}, ...(ngDevMode ? [{ debugName: "userCanRemove" }] : /* istanbul ignore next */ []));
|
|
265
|
+
this.userCanAdd = computed(() => {
|
|
266
|
+
const cfg = this.inputConfig();
|
|
267
|
+
if (!cfg)
|
|
268
|
+
return false;
|
|
269
|
+
if (!cfg.multipleInputAvailableOperations)
|
|
270
|
+
return true;
|
|
271
|
+
return cfg.multipleInputAvailableOperations.includes(MultipleInputAvailableOperations.Add);
|
|
272
|
+
}, ...(ngDevMode ? [{ debugName: "userCanAdd" }] : /* istanbul ignore next */ []));
|
|
273
|
+
this.userCanApplyOptionsTo = computed(() => {
|
|
274
|
+
return this.userCanEdit() || this.userCanRemove() || this.userCanAdd();
|
|
275
|
+
}, ...(ngDevMode ? [{ debugName: "userCanApplyOptionsTo" }] : /* istanbul ignore next */ []));
|
|
276
|
+
this.areYouSureYouWantToDeleteRow = {};
|
|
277
|
+
this.countDownDate = new Date();
|
|
278
|
+
this.deletionTimers = {};
|
|
279
|
+
this.tempLabels = [];
|
|
280
|
+
this.SYSTEM_KEY_IN_EDIT = null;
|
|
281
|
+
this.overlayOpen = false;
|
|
282
|
+
this.overlayData = null;
|
|
283
|
+
this.overlayPosition = { top: 0, left: 0 };
|
|
284
|
+
this.fullView = false;
|
|
285
|
+
}
|
|
286
|
+
applyOptionsToFn(item) {
|
|
287
|
+
this.onApplyOptionsTo.emit(item);
|
|
288
|
+
}
|
|
289
|
+
editItem(row) {
|
|
290
|
+
const rowId = row[`${this.inputConfig()?.id}.id`];
|
|
291
|
+
this.onEditItem.emit(rowId);
|
|
292
|
+
}
|
|
293
|
+
copy(row) {
|
|
294
|
+
const rowId = row[`${this.inputConfig()?.id}.id`];
|
|
295
|
+
this.onCopy.emit(rowId);
|
|
296
|
+
}
|
|
297
|
+
isAboutToDeleteRow(row) {
|
|
298
|
+
return !!this.areYouSureYouWantToDeleteRow[row[`${this.inputConfig()?.id}.id`]];
|
|
299
|
+
}
|
|
300
|
+
getCountdownSeconds() {
|
|
301
|
+
const now = new Date();
|
|
302
|
+
const timeElapsed = (now.getTime() - this.countDownDate.getTime()) / 1000;
|
|
303
|
+
const percentage = Math.min(Math.round((timeElapsed / 3) * 100), 100);
|
|
304
|
+
return percentage;
|
|
305
|
+
}
|
|
306
|
+
secondsCountDown() {
|
|
307
|
+
return (3 - ((this.getCountdownSeconds() / 100) * 3)).toFixed(1);
|
|
308
|
+
}
|
|
309
|
+
multipleInputRemoveItem(event, row) {
|
|
310
|
+
const rowId = row[`${this.inputConfig()?.id}.id`];
|
|
311
|
+
if (this.areYouSureYouWantToDeleteRow[rowId]) {
|
|
312
|
+
if (this.deletionTimers[rowId]) {
|
|
313
|
+
clearTimeout(this.deletionTimers[rowId]);
|
|
314
|
+
delete this.deletionTimers[rowId];
|
|
315
|
+
}
|
|
316
|
+
delete this.areYouSureYouWantToDeleteRow[rowId];
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
this.areYouSureYouWantToDeleteRow[rowId] = true;
|
|
320
|
+
this.countDownDate = new Date();
|
|
321
|
+
this.deletionTimers[rowId] = setTimeout(() => {
|
|
322
|
+
if (this.areYouSureYouWantToDeleteRow[rowId]) {
|
|
323
|
+
this.onDeleteItem.emit(row);
|
|
324
|
+
delete this.areYouSureYouWantToDeleteRow[rowId];
|
|
325
|
+
delete this.deletionTimers[rowId];
|
|
326
|
+
}
|
|
327
|
+
}, 3000);
|
|
328
|
+
}
|
|
329
|
+
event.preventDefault();
|
|
330
|
+
event.stopPropagation();
|
|
331
|
+
}
|
|
332
|
+
returnBackground(row, columnsConfig) {
|
|
333
|
+
let background = '';
|
|
334
|
+
const ds = this.dataSource();
|
|
335
|
+
if (ds
|
|
336
|
+
? ds.data.length > 1
|
|
337
|
+
? columnsConfig?.['colorScale']
|
|
338
|
+
: false
|
|
339
|
+
: false) {
|
|
340
|
+
const inputCfg = this.inputConfig();
|
|
341
|
+
const colKey = columnsConfig?.['key'] ?? '';
|
|
342
|
+
const point = Number(row[colKey]);
|
|
343
|
+
const inputIsGrouped = inputCfg.groupBy;
|
|
344
|
+
const groupKey = inputCfg.groupBy?.[0] || '';
|
|
345
|
+
const dataSet = inputIsGrouped
|
|
346
|
+
? ds.data.filter((s) => s[groupKey] === row[groupKey])
|
|
347
|
+
: new Array(ds.data);
|
|
348
|
+
const arrayValues = dataSet.map((vr) => Number(vr[colKey]));
|
|
349
|
+
const max = Math.max(...arrayValues);
|
|
350
|
+
const min = Math.min(...arrayValues);
|
|
351
|
+
const hasNun = isNaN(max) || isNaN(min);
|
|
352
|
+
if (!hasNun && Number(max) !== Number(min)) {
|
|
353
|
+
const colorScale = new ColorScale(min, max, ['#2fdf75', '#FFA500', '#ff4961'], 0.8);
|
|
354
|
+
const color = colorScale.getColor(point)?.toRGBAString();
|
|
355
|
+
background = color ?? '';
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return background;
|
|
359
|
+
}
|
|
360
|
+
hasTopBorder(row) {
|
|
361
|
+
const inputCfg = this.inputConfig();
|
|
362
|
+
const inputIsGrouped = inputCfg?.groupBy;
|
|
363
|
+
const ds = this.dataSource();
|
|
364
|
+
if (inputIsGrouped) {
|
|
365
|
+
const indexOfRow = ds.data.indexOf(row);
|
|
366
|
+
const rowIsFirstInTable = indexOfRow === 0;
|
|
367
|
+
if (!inputCfg.groupBy) {
|
|
368
|
+
return false;
|
|
369
|
+
}
|
|
370
|
+
const groupKey = inputCfg.groupBy?.[0] ?? '';
|
|
371
|
+
const isFirstInGroup = rowIsFirstInTable
|
|
372
|
+
? true
|
|
373
|
+
: ds.data[indexOfRow - 1][groupKey] !==
|
|
374
|
+
row[groupKey];
|
|
375
|
+
return isFirstInGroup;
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
return false;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
getCalculationFunction(row) {
|
|
382
|
+
const func = row['SYSTEM_KEY_PROPERTY_FOR_MULTIPLE_INPUTS_CALCULATION_FUNCTION'];
|
|
383
|
+
switch (func) {
|
|
384
|
+
case CalculationFunctions.Sum:
|
|
385
|
+
return 'TOTAL';
|
|
386
|
+
case CalculationFunctions.Avg:
|
|
387
|
+
return 'AVERAGE';
|
|
388
|
+
case CalculationFunctions.Max:
|
|
389
|
+
return 'MAX';
|
|
390
|
+
case CalculationFunctions.Min:
|
|
391
|
+
return 'MIN';
|
|
392
|
+
default:
|
|
393
|
+
return func;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
toggleTepLabel(event, label) {
|
|
397
|
+
if (this.tempLabels.includes(label)) {
|
|
398
|
+
this.tempLabels = this.tempLabels.filter((l) => l !== label);
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
this.tempLabels.push(label);
|
|
402
|
+
}
|
|
403
|
+
event.stopPropagation();
|
|
404
|
+
event.preventDefault();
|
|
405
|
+
}
|
|
406
|
+
get getColConfig() {
|
|
407
|
+
return this.colConfig();
|
|
408
|
+
}
|
|
409
|
+
get displayedColumnsInOrder() {
|
|
410
|
+
return this.displayedColumnsInOrderSig();
|
|
411
|
+
}
|
|
412
|
+
rowIsInEdit(row) {
|
|
413
|
+
const cfg = this.inputConfig();
|
|
414
|
+
const fg = this.formGroup();
|
|
415
|
+
return (!!cfg?.formIsOpen &&
|
|
416
|
+
fg?.controls[`${cfg?.id}.id`]?.value === row[`${cfg?.id}.id`]);
|
|
417
|
+
}
|
|
418
|
+
openDataOverlay(event, data) {
|
|
419
|
+
event.stopPropagation();
|
|
420
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
421
|
+
this.overlayData = data;
|
|
422
|
+
this.overlayPosition = { top: rect.bottom + 4, left: rect.left };
|
|
423
|
+
this.overlayOpen = true;
|
|
424
|
+
}
|
|
425
|
+
closeDataOverlay() {
|
|
426
|
+
this.overlayOpen = false;
|
|
427
|
+
this.overlayData = null;
|
|
428
|
+
}
|
|
429
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: MultipleInputTableViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
430
|
+
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" }, ngImport: i0, template: "@defer (on viewport) {\n\n @if (getColConfig.displayedColumnsInOrder.length === 0) {\n <div class=\"mit-state mit-state--inline\">No columns</div>\n }\n\n <div class=\"table-container\">\n\n <table mat-table [dataSource]=\"(dataSource() || [])\" class=\"mit-table\" matSort matSortActive=\"created\"\n matSortDisableClear matSortDirection=\"desc\">\n @for (col of (displayedColumnsInOrder || []); track col) {\n <ng-container [matColumnDef]=\"col\">\n <th mat-header-cell *matHeaderCellDef>\n <span class=\"mit-th-label\">\n {{ getColConfig.columnsConfig?.[col]?.[\"label\"] }}\n </span>\n @if ($last) {\n <button matTooltip=\"Show other values\" [matMenuTriggerFor]=\"colOptions\" [matMenuTriggerData]=\"{}\"\n class=\"mit-th-action\" mat-icon-button>\n <mat-icon>label</mat-icon>\n </button>\n }\n </th>\n <td [class.functionClass]=\"row['SYSTEM_KEY_PROPERTY_FOR_MULTIPLE_INPUTS_CALCULATION_FUNCTION']\"\n [style.background]=\"returnBackground(row, getColConfig.columnsConfig?.[col])\"\n mat-cell *matCellDef=\"let row\">\n @if (getColConfig.columnsConfig?.[col]?.['type'] === 'removal') {\n <div class=\"cellClass\">\n\n @if (!!row['SYSTEM_KEY_PROPERTY_FOR_MULTIPLE_INPUTS_CALCULATION_FUNCTION'] && !row['id'] && !inputConfig()?.multipleInputInEditId ||\n !!row['SYSTEM_KEY_PROPERTY_FOR_MULTIPLE_INPUTS_CALCULATION_FUNCTION'] && inputConfig()?.multipleInputInEditId &&\n inputConfig()?.multipleInputInEditId !== row['id']) {\n <div class=\"mit-fn-label\">\n <strong>{{ getCalculationFunction(row) }}</strong>\n </div>\n }\n @if (\n userCanApplyOptionsTo() &&\n !row['SYSTEM_KEY_PROPERTY_FOR_MULTIPLE_INPUTS_CALCULATION_FUNCTION'] &&\n row[''] !== 'true' && !inputConfig()?.readonly\n ) {\n <button mat-icon-button [color]=\"t.menuOpen ? 'primary' : 'basic'\" [matMenuTriggerFor]=\"rowOptions\" [matMenuTriggerData]=\"{row:row}\" #t=\"matMenuTrigger\"\n (click)=\"applyOptionsToFn(row)\"\n class=\"mit-row-trigger\">\n @if (rowIsInEdit(row)) {\n <mat-icon color=\"primary\">edit</mat-icon>\n } @else {\n <mat-icon>{{ t.menuOpen ? 'close' : 'more_horiz' }}</mat-icon>\n }\n </button>\n }\n\n @if (row['SYSTEM_KEY_IN_EDIT']) {\n <mat-chip>In {{ inputConfig()?.readonly ? 'View' : 'Edit' }}</mat-chip>\n }\n\n </div>\n }\n @if (getColConfig.columnsConfig && getColConfig.columnsConfig?.[col]?.type !== 'removal') {\n <div class=\"cellClass\">\n <span>\n @if (getColConfig.columnsConfig?.[col].dataType === 'array' || getColConfig.columnsConfig?.[col].dataType === 'object') {\n <button mat-icon-button class=\"mit-data-button\"\n matTooltip=\"View data\"\n (click)=\"openDataOverlay($event, row[col])\">\n <mat-icon class=\"mit-data-icon\">data_object</mat-icon>\n </button>\n } @else {\n {{ row[col] | formatData: getColConfig.columnsConfig?.[col].dataType }}\n }\n </span>\n </div>\n }\n </td>\n </ng-container>\n }\n\n\n <tr mat-header-row *matHeaderRowDef=\"getColConfig.displayedColumnsInOrder\"></tr>\n <tr [class.mit-group-start]=\"hasTopBorder(row)\" mat-row\n *matRowDef=\"let row; columns: getColConfig.displayedColumnsInOrder\"></tr>\n </table>\n\n @if (!(dataSource().data) || (dataSource().data).length === 0) {\n <div class=\"mit-empty\">\n <mat-icon class=\"mit-empty-icon\">list</mat-icon>\n <strong class=\"mit-empty-title\">No items yet</strong>\n <p class=\"mit-empty-text\">\n <strong>Click the add button</strong> to create a new row. You'll fill in details using a form, and each\n saved entry appears as a row here.\n </p>\n </div>\n }\n </div>\n} @placeholder {\n <div class=\"mit-placeholder\">\n <mat-spinner diameter=\"32\" />\n </div>\n}\n\n@if (overlayOpen) {\n <div class=\"data-overlay-backdrop\" (click)=\"closeDataOverlay()\"></div>\n <div class=\"data-overlay-panel\"\n [style.top.px]=\"overlayPosition.top\"\n [style.left.px]=\"overlayPosition.left\"\n (click)=\"$event.stopPropagation()\">\n <div class=\"data-overlay-header\">\n <span class=\"data-overlay-title\">\n <mat-icon class=\"data-overlay-title-icon\">data_object</mat-icon>\n Data\n </span>\n <button mat-icon-button class=\"mit-data-button\" (click)=\"closeDataOverlay()\">\n <mat-icon class=\"mit-data-icon\">close</mat-icon>\n </button>\n </div>\n <div class=\"data-overlay-body\">\n <lib-t-dynamic-data-view [data]=\"overlayData\" />\n </div>\n </div>\n}\n\n<mat-menu #colOptions=\"matMenu\">\n <ng-template matMenuContent>\n @for (label of allPossibleLabels(); track label.label) {\n <button mat-menu-item (click)=\"toggleTepLabel($event, label.formControlName);\">\n <mat-icon>{{ label.selected ? 'check_circle' : 'radio_button_unchecked' }}</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 (!inputConfig()?.readonly) {\n @if (userCanEdit()) {\n <button mat-menu-item (click)=\"editItem(row)\">\n <mat-icon>edit</mat-icon>\n <div class=\"option-text\">\n <div class=\"option-main-text\">Edit</div>\n <div class=\"option-sub-text\">\n {{ inputConfig()?.readonly ? 'View item properties' : 'Modify item properties' }}\n </div>\n </div>\n </button>\n }\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 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\">Will delete after 3 seconds (click to cancel)</div>\n </div>\n </button>\n }\n }\n }\n </ng-template>\n</mat-menu>\n", styles: [".table-container{max-width:100%!important;overflow:auto!important;border-radius:8px}.mit-table{width:100%;background:transparent}.mit-table .mat-mdc-header-cell,.mit-table .mat-mdc-cell{padding:0 .625rem;font-size:.8125rem}.mit-table .mat-mdc-header-row{min-height:2.25rem}.mit-table .mat-mdc-row{min-height:2.5rem;transition:background .2s cubic-bezier(.16,1,.3,1)}.mit-table .mat-mdc-row:hover{background:color-mix(in srgb,var(--mat-sys-primary, #6750a4) 5%,transparent)}.mit-th-label{text-align:start;line-height:normal;font-size:.6875rem;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--mat-sys-on-surface-variant, #49454f)}.mit-th-action{width:1.75rem;height:1.75rem;line-height:1.75rem;opacity:.55;transition:opacity .2s cubic-bezier(.16,1,.3,1)}.mit-th-action:hover{opacity:1}.cellClass{display:flex;align-items:center;min-height:2.5rem}.mit-group-start .mat-mdc-cell{border-top:2px solid var(--mat-sys-outline-variant, #cac4d0)}.functionClass{background:var(--mat-sys-surface-container, #f3edf7);font-weight:500}.mit-fn-label{width:100%;text-align:right;color:var(--mat-sys-on-surface-variant, #49454f);font-size:.6875rem;letter-spacing:.06em;text-transform:uppercase}.mit-row-trigger{margin-left:auto;margin-right:0;display:block}.mit-data-button{width:1.75rem;height:1.75rem;line-height:1.75rem}.mit-data-icon{font-size:1.125rem;width:1.125rem;height:1.125rem;line-height:1.125rem}.mit-state{display:flex;justify-content:center;padding:1rem;font-size:.8125rem;color:var(--mat-sys-on-surface-variant, #49454f);opacity:.7}.mit-empty{display:flex;flex-direction:column;align-items:center;text-align:center;gap:.375rem;padding:1.5rem 1.25rem;color:var(--mat-sys-on-surface-variant, #49454f)}.mit-empty-icon{font-size:1.75rem;width:1.75rem;height:1.75rem;line-height:1.75rem;opacity:.5}.mit-empty-title{font-size:.875rem;color:var(--mat-sys-on-surface, #1c1b1f)}.mit-empty-text{margin:0;max-width:22rem;font-size:.75rem;line-height:1.45;opacity:.85}.mit-placeholder{display:flex;justify-content:center;align-items:center;padding:2rem}.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(--mat-sys-primary, #6750a4)}.option-sub-text{font-size:.75rem;color:var(--mat-sys-on-surface-variant, #49454f);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(--mat-sys-error, #b3261e);font-weight:500;line-height:1.6;animation:pulse 1s infinite}button:has(+.deletion-progress-container){border-bottom:none!important;padding-bottom:4px!important}@keyframes pulse{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}@media(max-width:600px){.option-sub-text{max-width:180px;white-space:normal}}.data-overlay-backdrop{position:fixed;inset:0;z-index:999;background:transparent}.data-overlay-panel{position:fixed;z-index:1000;background:var(--mat-sys-surface, #fef7ff);border:1px solid color-mix(in srgb,var(--mat-sys-outline, #79747e) 15%,transparent);border-radius:12px;box-shadow:0 16px 56px color-mix(in srgb,var(--mat-sys-shadow, #000) 14%,transparent);min-width:280px;max-width:min(380px,calc(100vw - 16px));max-height:60vh;display:flex;flex-direction:column;overflow:hidden}.data-overlay-header{display:flex;align-items:center;justify-content:space-between;padding:.25rem .25rem .25rem .75rem;border-bottom:1px solid color-mix(in srgb,var(--mat-sys-outline, #79747e) 12%,transparent);flex-shrink:0}.data-overlay-title{font-size:.8125rem;font-weight:500;display:flex;align-items:center;color:var(--mat-sys-on-surface, #1c1b1f)}.data-overlay-title-icon{font-size:1rem;width:1rem;height:1rem;line-height:1rem;vertical-align:middle;margin-right:.25rem}.data-overlay-body{overflow:auto;padding:.25rem .5rem .5rem;flex:1}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.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: MatProgressBarModule }, { kind: "component", type: i1$2.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i3$1.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatSortModule }, { 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: [() => [i1.MatIconButton, i1$1.MatChip, i3.MatIcon, i6.MatMenuTrigger, i10.MatSort, 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-u_kigDid.mjs').then(function (n) { return n.an; }).then(m => m.FormatDataPipe)]] }); }
|
|
431
|
+
}
|
|
432
|
+
i0.ɵɵngDeclareClassMetadataAsync({ minVersion: "18.0.0", version: "21.2.12", ngImport: i0, type: MultipleInputTableViewComponent, resolveDeferredDeps: () => [import('./ngx-t-forms-ngx-t-forms-u_kigDid.mjs').then(function (n) { return n.an; }).then(m => m.FormatDataPipe)], resolveMetadata: FormatDataPipe => ({ decorators: [{
|
|
433
|
+
type: Component,
|
|
434
|
+
args: [{ selector: 'lib-multiple-input-table-view', imports: [
|
|
435
|
+
MatButtonModule,
|
|
436
|
+
MatChipsModule,
|
|
437
|
+
MatIconModule,
|
|
438
|
+
MatMenuModule,
|
|
439
|
+
MatProgressBarModule,
|
|
440
|
+
MatProgressSpinnerModule,
|
|
441
|
+
MatSortModule,
|
|
442
|
+
MatTableModule,
|
|
443
|
+
MatTooltipModule,
|
|
444
|
+
FormatDataPipe,
|
|
445
|
+
TDynamicDataViewComponent,
|
|
446
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, template: "@defer (on viewport) {\n\n @if (getColConfig.displayedColumnsInOrder.length === 0) {\n <div class=\"mit-state mit-state--inline\">No columns</div>\n }\n\n <div class=\"table-container\">\n\n <table mat-table [dataSource]=\"(dataSource() || [])\" class=\"mit-table\" matSort matSortActive=\"created\"\n matSortDisableClear matSortDirection=\"desc\">\n @for (col of (displayedColumnsInOrder || []); track col) {\n <ng-container [matColumnDef]=\"col\">\n <th mat-header-cell *matHeaderCellDef>\n <span class=\"mit-th-label\">\n {{ getColConfig.columnsConfig?.[col]?.[\"label\"] }}\n </span>\n @if ($last) {\n <button matTooltip=\"Show other values\" [matMenuTriggerFor]=\"colOptions\" [matMenuTriggerData]=\"{}\"\n class=\"mit-th-action\" mat-icon-button>\n <mat-icon>label</mat-icon>\n </button>\n }\n </th>\n <td [class.functionClass]=\"row['SYSTEM_KEY_PROPERTY_FOR_MULTIPLE_INPUTS_CALCULATION_FUNCTION']\"\n [style.background]=\"returnBackground(row, getColConfig.columnsConfig?.[col])\"\n mat-cell *matCellDef=\"let row\">\n @if (getColConfig.columnsConfig?.[col]?.['type'] === 'removal') {\n <div class=\"cellClass\">\n\n @if (!!row['SYSTEM_KEY_PROPERTY_FOR_MULTIPLE_INPUTS_CALCULATION_FUNCTION'] && !row['id'] && !inputConfig()?.multipleInputInEditId ||\n !!row['SYSTEM_KEY_PROPERTY_FOR_MULTIPLE_INPUTS_CALCULATION_FUNCTION'] && inputConfig()?.multipleInputInEditId &&\n inputConfig()?.multipleInputInEditId !== row['id']) {\n <div class=\"mit-fn-label\">\n <strong>{{ getCalculationFunction(row) }}</strong>\n </div>\n }\n @if (\n userCanApplyOptionsTo() &&\n !row['SYSTEM_KEY_PROPERTY_FOR_MULTIPLE_INPUTS_CALCULATION_FUNCTION'] &&\n row[''] !== 'true' && !inputConfig()?.readonly\n ) {\n <button mat-icon-button [color]=\"t.menuOpen ? 'primary' : 'basic'\" [matMenuTriggerFor]=\"rowOptions\" [matMenuTriggerData]=\"{row:row}\" #t=\"matMenuTrigger\"\n (click)=\"applyOptionsToFn(row)\"\n class=\"mit-row-trigger\">\n @if (rowIsInEdit(row)) {\n <mat-icon color=\"primary\">edit</mat-icon>\n } @else {\n <mat-icon>{{ t.menuOpen ? 'close' : 'more_horiz' }}</mat-icon>\n }\n </button>\n }\n\n @if (row['SYSTEM_KEY_IN_EDIT']) {\n <mat-chip>In {{ inputConfig()?.readonly ? 'View' : 'Edit' }}</mat-chip>\n }\n\n </div>\n }\n @if (getColConfig.columnsConfig && getColConfig.columnsConfig?.[col]?.type !== 'removal') {\n <div class=\"cellClass\">\n <span>\n @if (getColConfig.columnsConfig?.[col].dataType === 'array' || getColConfig.columnsConfig?.[col].dataType === 'object') {\n <button mat-icon-button class=\"mit-data-button\"\n matTooltip=\"View data\"\n (click)=\"openDataOverlay($event, row[col])\">\n <mat-icon class=\"mit-data-icon\">data_object</mat-icon>\n </button>\n } @else {\n {{ row[col] | formatData: getColConfig.columnsConfig?.[col].dataType }}\n }\n </span>\n </div>\n }\n </td>\n </ng-container>\n }\n\n\n <tr mat-header-row *matHeaderRowDef=\"getColConfig.displayedColumnsInOrder\"></tr>\n <tr [class.mit-group-start]=\"hasTopBorder(row)\" mat-row\n *matRowDef=\"let row; columns: getColConfig.displayedColumnsInOrder\"></tr>\n </table>\n\n @if (!(dataSource().data) || (dataSource().data).length === 0) {\n <div class=\"mit-empty\">\n <mat-icon class=\"mit-empty-icon\">list</mat-icon>\n <strong class=\"mit-empty-title\">No items yet</strong>\n <p class=\"mit-empty-text\">\n <strong>Click the add button</strong> to create a new row. You'll fill in details using a form, and each\n saved entry appears as a row here.\n </p>\n </div>\n }\n </div>\n} @placeholder {\n <div class=\"mit-placeholder\">\n <mat-spinner diameter=\"32\" />\n </div>\n}\n\n@if (overlayOpen) {\n <div class=\"data-overlay-backdrop\" (click)=\"closeDataOverlay()\"></div>\n <div class=\"data-overlay-panel\"\n [style.top.px]=\"overlayPosition.top\"\n [style.left.px]=\"overlayPosition.left\"\n (click)=\"$event.stopPropagation()\">\n <div class=\"data-overlay-header\">\n <span class=\"data-overlay-title\">\n <mat-icon class=\"data-overlay-title-icon\">data_object</mat-icon>\n Data\n </span>\n <button mat-icon-button class=\"mit-data-button\" (click)=\"closeDataOverlay()\">\n <mat-icon class=\"mit-data-icon\">close</mat-icon>\n </button>\n </div>\n <div class=\"data-overlay-body\">\n <lib-t-dynamic-data-view [data]=\"overlayData\" />\n </div>\n </div>\n}\n\n<mat-menu #colOptions=\"matMenu\">\n <ng-template matMenuContent>\n @for (label of allPossibleLabels(); track label.label) {\n <button mat-menu-item (click)=\"toggleTepLabel($event, label.formControlName);\">\n <mat-icon>{{ label.selected ? 'check_circle' : 'radio_button_unchecked' }}</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 (!inputConfig()?.readonly) {\n @if (userCanEdit()) {\n <button mat-menu-item (click)=\"editItem(row)\">\n <mat-icon>edit</mat-icon>\n <div class=\"option-text\">\n <div class=\"option-main-text\">Edit</div>\n <div class=\"option-sub-text\">\n {{ inputConfig()?.readonly ? 'View item properties' : 'Modify item properties' }}\n </div>\n </div>\n </button>\n }\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 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\">Will delete after 3 seconds (click to cancel)</div>\n </div>\n </button>\n }\n }\n }\n </ng-template>\n</mat-menu>\n", styles: [".table-container{max-width:100%!important;overflow:auto!important;border-radius:8px}.mit-table{width:100%;background:transparent}.mit-table .mat-mdc-header-cell,.mit-table .mat-mdc-cell{padding:0 .625rem;font-size:.8125rem}.mit-table .mat-mdc-header-row{min-height:2.25rem}.mit-table .mat-mdc-row{min-height:2.5rem;transition:background .2s cubic-bezier(.16,1,.3,1)}.mit-table .mat-mdc-row:hover{background:color-mix(in srgb,var(--mat-sys-primary, #6750a4) 5%,transparent)}.mit-th-label{text-align:start;line-height:normal;font-size:.6875rem;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--mat-sys-on-surface-variant, #49454f)}.mit-th-action{width:1.75rem;height:1.75rem;line-height:1.75rem;opacity:.55;transition:opacity .2s cubic-bezier(.16,1,.3,1)}.mit-th-action:hover{opacity:1}.cellClass{display:flex;align-items:center;min-height:2.5rem}.mit-group-start .mat-mdc-cell{border-top:2px solid var(--mat-sys-outline-variant, #cac4d0)}.functionClass{background:var(--mat-sys-surface-container, #f3edf7);font-weight:500}.mit-fn-label{width:100%;text-align:right;color:var(--mat-sys-on-surface-variant, #49454f);font-size:.6875rem;letter-spacing:.06em;text-transform:uppercase}.mit-row-trigger{margin-left:auto;margin-right:0;display:block}.mit-data-button{width:1.75rem;height:1.75rem;line-height:1.75rem}.mit-data-icon{font-size:1.125rem;width:1.125rem;height:1.125rem;line-height:1.125rem}.mit-state{display:flex;justify-content:center;padding:1rem;font-size:.8125rem;color:var(--mat-sys-on-surface-variant, #49454f);opacity:.7}.mit-empty{display:flex;flex-direction:column;align-items:center;text-align:center;gap:.375rem;padding:1.5rem 1.25rem;color:var(--mat-sys-on-surface-variant, #49454f)}.mit-empty-icon{font-size:1.75rem;width:1.75rem;height:1.75rem;line-height:1.75rem;opacity:.5}.mit-empty-title{font-size:.875rem;color:var(--mat-sys-on-surface, #1c1b1f)}.mit-empty-text{margin:0;max-width:22rem;font-size:.75rem;line-height:1.45;opacity:.85}.mit-placeholder{display:flex;justify-content:center;align-items:center;padding:2rem}.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(--mat-sys-primary, #6750a4)}.option-sub-text{font-size:.75rem;color:var(--mat-sys-on-surface-variant, #49454f);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(--mat-sys-error, #b3261e);font-weight:500;line-height:1.6;animation:pulse 1s infinite}button:has(+.deletion-progress-container){border-bottom:none!important;padding-bottom:4px!important}@keyframes pulse{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}@media(max-width:600px){.option-sub-text{max-width:180px;white-space:normal}}.data-overlay-backdrop{position:fixed;inset:0;z-index:999;background:transparent}.data-overlay-panel{position:fixed;z-index:1000;background:var(--mat-sys-surface, #fef7ff);border:1px solid color-mix(in srgb,var(--mat-sys-outline, #79747e) 15%,transparent);border-radius:12px;box-shadow:0 16px 56px color-mix(in srgb,var(--mat-sys-shadow, #000) 14%,transparent);min-width:280px;max-width:min(380px,calc(100vw - 16px));max-height:60vh;display:flex;flex-direction:column;overflow:hidden}.data-overlay-header{display:flex;align-items:center;justify-content:space-between;padding:.25rem .25rem .25rem .75rem;border-bottom:1px solid color-mix(in srgb,var(--mat-sys-outline, #79747e) 12%,transparent);flex-shrink:0}.data-overlay-title{font-size:.8125rem;font-weight:500;display:flex;align-items:center;color:var(--mat-sys-on-surface, #1c1b1f)}.data-overlay-title-icon{font-size:1rem;width:1rem;height:1rem;line-height:1rem;vertical-align:middle;margin-right:.25rem}.data-overlay-body{overflow:auto;padding:.25rem .5rem .5rem;flex:1}\n"] }]
|
|
447
|
+
}], ctorParameters: null, 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"] }] } }) });
|
|
448
|
+
|
|
449
|
+
class MultipleInputTableEditComponent {
|
|
450
|
+
constructor() {
|
|
451
|
+
this.InputComponent = TFormInputComponent;
|
|
452
|
+
this.inputConfig = input.required(...(ngDevMode ? [{ debugName: "inputConfig" }] : /* istanbul ignore next */ []));
|
|
453
|
+
this.editorMode = input(false, ...(ngDevMode ? [{ debugName: "editorMode" }] : /* istanbul ignore next */ []));
|
|
454
|
+
this.formGroup = input(null, ...(ngDevMode ? [{ debugName: "formGroup" }] : /* istanbul ignore next */ []));
|
|
455
|
+
this.formBuilderFunctions = input(undefined, ...(ngDevMode ? [{ debugName: "formBuilderFunctions" }] : /* istanbul ignore next */ []));
|
|
456
|
+
this.onSaveMultipleInputForm = output();
|
|
457
|
+
this.editMultipleInput = output();
|
|
458
|
+
this.deleteInput = output();
|
|
459
|
+
this.showItemAsLabel = output();
|
|
460
|
+
this.addFunction = output();
|
|
461
|
+
this.reorderItems = output();
|
|
462
|
+
this.calculationFunctions = Object.values(CalculationFunctions);
|
|
463
|
+
this.activeInput = '';
|
|
464
|
+
this.dragging = false;
|
|
465
|
+
this.overId = null;
|
|
466
|
+
this.areYouSure = false;
|
|
467
|
+
this.countdownSeconds = {};
|
|
468
|
+
this.innerInputs = computed(() => {
|
|
469
|
+
const cfg = this.inputConfig();
|
|
470
|
+
return (cfg?.formInputs?.map((input) => ({
|
|
471
|
+
...input,
|
|
472
|
+
originalId: input.id,
|
|
473
|
+
id: `${cfg?.id}.${input.id}`,
|
|
474
|
+
})) || []);
|
|
475
|
+
}, ...(ngDevMode ? [{ debugName: "innerInputs" }] : /* istanbul ignore next */ []));
|
|
476
|
+
this.rowInUpdate = computed(() => {
|
|
477
|
+
const cfg = this.inputConfig();
|
|
478
|
+
const fg = this.formGroup();
|
|
479
|
+
return !!cfg?.formIsOpen && !!fg?.controls[`${cfg?.id}.id`]?.value;
|
|
480
|
+
}, ...(ngDevMode ? [{ debugName: "rowInUpdate" }] : /* istanbul ignore next */ []));
|
|
481
|
+
this.formInvalid = computed(() => {
|
|
482
|
+
const cfg = this.inputConfig();
|
|
483
|
+
const fg = this.formGroup();
|
|
484
|
+
const allControls = [];
|
|
485
|
+
cfg?.formInputs?.forEach((input) => {
|
|
486
|
+
const control = fg?.controls[`${cfg?.id}.${input.id}`];
|
|
487
|
+
if (control) {
|
|
488
|
+
allControls.push(control);
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
return allControls.some((control) => control?.invalid || !control);
|
|
492
|
+
}, ...(ngDevMode ? [{ debugName: "formInvalid" }] : /* istanbul ignore next */ []));
|
|
493
|
+
this.#destroyRef = inject(DestroyRef);
|
|
494
|
+
}
|
|
495
|
+
#destroyRef;
|
|
496
|
+
ngOnDestroy() {
|
|
497
|
+
Object.values(this.countdownSeconds).forEach(({ stop$ }) => stop$.complete());
|
|
498
|
+
}
|
|
499
|
+
saveMultipleInputForm() {
|
|
500
|
+
this.onSaveMultipleInputForm.emit();
|
|
501
|
+
}
|
|
502
|
+
inputWillBeRemovedIn(id) {
|
|
503
|
+
return this.countdownSeconds[id]?.count;
|
|
504
|
+
}
|
|
505
|
+
removeInput(item) {
|
|
506
|
+
if (this.countdownSeconds[item.id]) {
|
|
507
|
+
this.stopDeletion(item.id);
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
this.countdownSeconds[item.id] = {
|
|
511
|
+
count: 5,
|
|
512
|
+
stop$: new Subject(),
|
|
513
|
+
};
|
|
514
|
+
const countdown$ = timer(0, 1000).pipe(tap((secondsElapsed) => {
|
|
515
|
+
const data = this.countdownSeconds[item.id];
|
|
516
|
+
if (!data) {
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
const remainingTime = 5 - secondsElapsed;
|
|
520
|
+
if (remainingTime <= 0) {
|
|
521
|
+
this.formDeleteInput(item);
|
|
522
|
+
this.stopDeletion(item.id);
|
|
523
|
+
}
|
|
524
|
+
else {
|
|
525
|
+
data.count = remainingTime;
|
|
526
|
+
}
|
|
527
|
+
}), takeUntil(this.countdownSeconds[item.id].stop$), takeUntilDestroyed(this.#destroyRef));
|
|
528
|
+
countdown$.subscribe({
|
|
529
|
+
complete: () => { },
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
stopDeletion(id) {
|
|
533
|
+
if (this.countdownSeconds[id]) {
|
|
534
|
+
this.countdownSeconds[id]?.stop$.next();
|
|
535
|
+
delete this.countdownSeconds[id];
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
formDeleteInput(item) {
|
|
539
|
+
this.deleteInput.emit(item);
|
|
540
|
+
}
|
|
541
|
+
dropItems(event) {
|
|
542
|
+
this.reorderItems.emit(event);
|
|
543
|
+
}
|
|
544
|
+
editInput(input) {
|
|
545
|
+
this.editMultipleInput.emit(input);
|
|
546
|
+
}
|
|
547
|
+
toggleLabel(item) {
|
|
548
|
+
this.showItemAsLabel.emit(item);
|
|
549
|
+
}
|
|
550
|
+
toggleFunction(func, _inputId) {
|
|
551
|
+
const addFunction = {
|
|
552
|
+
id: v4(),
|
|
553
|
+
inputId: this.activeInput,
|
|
554
|
+
func,
|
|
555
|
+
};
|
|
556
|
+
this.addFunction.emit(addFunction);
|
|
557
|
+
}
|
|
558
|
+
selectedFunction(func) {
|
|
559
|
+
return this.inputConfig()?.calculateListFunctions?.find((f) => f.inputId === this.activeInput && f.func === func);
|
|
560
|
+
}
|
|
561
|
+
closeMultipleInput() {
|
|
562
|
+
if (this.areYouSure) {
|
|
563
|
+
this.formBuilderFunctions()?.multipleInputToggleForm(this.inputConfig().id, false);
|
|
564
|
+
this.areYouSure = false;
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
this.areYouSure = true;
|
|
568
|
+
}
|
|
569
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: MultipleInputTableEditComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
570
|
+
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\">\n <mat-card-content>\n <div class=\"list row\" (cdkDropListDropped)=\"dropItems($event)\"\n [cdkDropListData]=\"innerInputs()\" cdkDropList #InputList=\"cdkDropList\">\n @for (innerInput of innerInputs(); track innerInput.id) {\n <ng-container>\n @if (editorMode()) {\n @if (!!formGroup()) {\n <mat-card (mouseover)=\"activeInput = innerInput.id\" cdkDrag\n (cdkDragStarted)=\"dragging = true\" (cdkDragReleased)=\"dragging = false\"\n [class.inputCardElevated]=\"activeInput === innerInput.id\"\n [class.inputCard]=\"activeInput !== innerInput.id\"\n [class]=\"'col-md-' + (dragging ? '12' : innerInput.colSize)\" class=\"box\">\n <ng-container *ngComponentOutlet=\"InputComponent;\n inputs: {\n inputConfig: innerInput,\n formGroup: formGroup(),\n formBuilderFunctions: formBuilderFunctions(),\n }\">\n </ng-container>\n @if (activeInput === innerInput.id) {\n <mat-card-actions class=\"input-actions\">\n <span class=\"spacer\"></span>\n <button [matTooltip]=\"'Edit Input: ' + innerInput.label\"\n (click)=\"editInput(innerInput)\" mat-icon-button>\n <mat-icon>edit</mat-icon>\n </button>\n @if (!!inputWillBeRemovedIn(innerInput.id)) {\n <button (mouseover)=\"overId = innerInput.id\" (mouseout)=\"overId = null\"\n (click)=\"removeInput(innerInput)\" color=\"warn\" mat-stroked-button>\n <div class=\"countdown-button\">\n <mat-progress-spinner class=\"cancelProgress\" color=\"primary\"\n [value]=\"((inputWillBeRemovedIn(innerInput.id) || 0) / 5) * 100\">\n </mat-progress-spinner>\n {{ overId === innerInput.id ? 'Click to cancel' : 'Deleting in' }}\n {{ inputWillBeRemovedIn(innerInput.id) }}\n </div>\n </button>\n } @else if (inputConfig().systemDefault !== true && innerInput.systemDefault !== true) {\n <button [matTooltip]=\"'Delete input ' + innerInput.label\"\n (click)=\"removeInput(innerInput)\" mat-icon-button>\n <mat-icon>delete</mat-icon>\n </button>\n }\n <span class=\"action-divider\"></span>\n @if (!!innerInput.showAsLabel && innerInput.dataType === 'number' || !!innerInput.showAsLabel && innerInput.type === 'number') {\n <button\n [matMenuTriggerFor]=\"calculationMenu\"\n [matMenuTriggerData]=\"{inputId:innerInput.originalId || innerInput.id}\"\n [matTooltip]=\"'calculate sum,avg,min,max'\"\n mat-icon-button>\n <mat-icon>calculate</mat-icon>\n </button>\n }\n <button [color]=\"innerInput.showAsLabel ? 'primary' : ''\"\n (click)=\"toggleLabel(innerInput)\"\n [matTooltip]=\"innerInput.showAsLabel ? 'Hide as label' : 'Show as label'\"\n mat-icon-button>\n <mat-icon>label</mat-icon>\n </button>\n <span class=\"spacer\"></span>\n </mat-card-actions>\n }\n </mat-card>\n }\n } @else {\n <div [class]=\"'col-md-' + (dragging ? '12' : innerInput.colSize)\" class=\"box\">\n <ng-container *ngComponentOutlet=\"InputComponent;\n inputs: {\n inputConfig: innerInput,\n formGroup: formGroup(),\n formBuilderFunctions: formBuilderFunctions(),\n }\">\n </ng-container>\n </div>\n }\n </ng-container>\n }\n @if (!!editorMode() && innerInputs().length === 0) {\n <div class=\"tree-instructions\">\n <mat-icon class=\"info-icon\" color=\"primary\">info</mat-icon>\n <span>\n <strong>Add Form Input</strong>\n <br>\n Manage your list by adding, editing, or removing items. Each item is customizable through a form.\n </span>\n </div>\n }\n </div>\n </mat-card-content>\n @if (innerInputs().length !== 0) {\n <mat-divider></mat-divider>\n <mat-card-actions align=\"end\" class=\"edit-card-actions\">\n <button [color]=\"areYouSure ? 'warn' : ''\"\n [class.confirm-leave]=\"areYouSure\" mat-button\n (click)=\"closeMultipleInput()\">\n {{ areYouSure ? \"leave without saving\" : \"cancel\" }}\n </button>\n @if (!inputConfig().readonly) {\n <button [disabled]=\"!!formInvalid()\" class=\"save-button\" color=\"primary\"\n (click)=\"saveMultipleInputForm()\" mat-raised-button>\n {{ rowInUpdate() ? \"Update\" : \"Save\" }}\n </button>\n }\n </mat-card-actions>\n }\n</mat-card>\n\n\n<mat-menu #calculationMenu=\"matMenu\">\n <ng-template matMenuContent let-inputId=\"sectionId\">\n @for (func of calculationFunctions; track func) {\n <button (click)=\"toggleFunction(func, inputId)\" mat-menu-item>\n {{ func }}\n @if (selectedFunction(func)) {\n <mat-icon color=\"primary\">check_circle</mat-icon>\n }\n </button>\n }\n </ng-template>\n</mat-menu>\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$3.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$3.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: i1.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i1.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: i4.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: i3$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 }); }
|
|
571
|
+
}
|
|
572
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: MultipleInputTableEditComponent, decorators: [{
|
|
573
|
+
type: Component,
|
|
574
|
+
args: [{ selector: 'lib-multiple-input-table-edit', imports: [
|
|
575
|
+
CommonModule,
|
|
576
|
+
DragDropModule,
|
|
577
|
+
MatButtonModule,
|
|
578
|
+
MatCardModule,
|
|
579
|
+
MatDividerModule,
|
|
580
|
+
MatIconModule,
|
|
581
|
+
MatMenuModule,
|
|
582
|
+
MatProgressSpinnerModule,
|
|
583
|
+
MatTooltipModule,
|
|
584
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, template: "<mat-card appearance=\"outlined\" class=\"edit-card mat-elevation-z4\">\n <mat-card-content>\n <div class=\"list row\" (cdkDropListDropped)=\"dropItems($event)\"\n [cdkDropListData]=\"innerInputs()\" cdkDropList #InputList=\"cdkDropList\">\n @for (innerInput of innerInputs(); track innerInput.id) {\n <ng-container>\n @if (editorMode()) {\n @if (!!formGroup()) {\n <mat-card (mouseover)=\"activeInput = innerInput.id\" cdkDrag\n (cdkDragStarted)=\"dragging = true\" (cdkDragReleased)=\"dragging = false\"\n [class.inputCardElevated]=\"activeInput === innerInput.id\"\n [class.inputCard]=\"activeInput !== innerInput.id\"\n [class]=\"'col-md-' + (dragging ? '12' : innerInput.colSize)\" class=\"box\">\n <ng-container *ngComponentOutlet=\"InputComponent;\n inputs: {\n inputConfig: innerInput,\n formGroup: formGroup(),\n formBuilderFunctions: formBuilderFunctions(),\n }\">\n </ng-container>\n @if (activeInput === innerInput.id) {\n <mat-card-actions class=\"input-actions\">\n <span class=\"spacer\"></span>\n <button [matTooltip]=\"'Edit Input: ' + innerInput.label\"\n (click)=\"editInput(innerInput)\" mat-icon-button>\n <mat-icon>edit</mat-icon>\n </button>\n @if (!!inputWillBeRemovedIn(innerInput.id)) {\n <button (mouseover)=\"overId = innerInput.id\" (mouseout)=\"overId = null\"\n (click)=\"removeInput(innerInput)\" color=\"warn\" mat-stroked-button>\n <div class=\"countdown-button\">\n <mat-progress-spinner class=\"cancelProgress\" color=\"primary\"\n [value]=\"((inputWillBeRemovedIn(innerInput.id) || 0) / 5) * 100\">\n </mat-progress-spinner>\n {{ overId === innerInput.id ? 'Click to cancel' : 'Deleting in' }}\n {{ inputWillBeRemovedIn(innerInput.id) }}\n </div>\n </button>\n } @else if (inputConfig().systemDefault !== true && innerInput.systemDefault !== true) {\n <button [matTooltip]=\"'Delete input ' + innerInput.label\"\n (click)=\"removeInput(innerInput)\" mat-icon-button>\n <mat-icon>delete</mat-icon>\n </button>\n }\n <span class=\"action-divider\"></span>\n @if (!!innerInput.showAsLabel && innerInput.dataType === 'number' || !!innerInput.showAsLabel && innerInput.type === 'number') {\n <button\n [matMenuTriggerFor]=\"calculationMenu\"\n [matMenuTriggerData]=\"{inputId:innerInput.originalId || innerInput.id}\"\n [matTooltip]=\"'calculate sum,avg,min,max'\"\n mat-icon-button>\n <mat-icon>calculate</mat-icon>\n </button>\n }\n <button [color]=\"innerInput.showAsLabel ? 'primary' : ''\"\n (click)=\"toggleLabel(innerInput)\"\n [matTooltip]=\"innerInput.showAsLabel ? 'Hide as label' : 'Show as label'\"\n mat-icon-button>\n <mat-icon>label</mat-icon>\n </button>\n <span class=\"spacer\"></span>\n </mat-card-actions>\n }\n </mat-card>\n }\n } @else {\n <div [class]=\"'col-md-' + (dragging ? '12' : innerInput.colSize)\" class=\"box\">\n <ng-container *ngComponentOutlet=\"InputComponent;\n inputs: {\n inputConfig: innerInput,\n formGroup: formGroup(),\n formBuilderFunctions: formBuilderFunctions(),\n }\">\n </ng-container>\n </div>\n }\n </ng-container>\n }\n @if (!!editorMode() && innerInputs().length === 0) {\n <div class=\"tree-instructions\">\n <mat-icon class=\"info-icon\" color=\"primary\">info</mat-icon>\n <span>\n <strong>Add Form Input</strong>\n <br>\n Manage your list by adding, editing, or removing items. Each item is customizable through a form.\n </span>\n </div>\n }\n </div>\n </mat-card-content>\n @if (innerInputs().length !== 0) {\n <mat-divider></mat-divider>\n <mat-card-actions align=\"end\" class=\"edit-card-actions\">\n <button [color]=\"areYouSure ? 'warn' : ''\"\n [class.confirm-leave]=\"areYouSure\" mat-button\n (click)=\"closeMultipleInput()\">\n {{ areYouSure ? \"leave without saving\" : \"cancel\" }}\n </button>\n @if (!inputConfig().readonly) {\n <button [disabled]=\"!!formInvalid()\" class=\"save-button\" color=\"primary\"\n (click)=\"saveMultipleInputForm()\" mat-raised-button>\n {{ rowInUpdate() ? \"Update\" : \"Save\" }}\n </button>\n }\n </mat-card-actions>\n }\n</mat-card>\n\n\n<mat-menu #calculationMenu=\"matMenu\">\n <ng-template matMenuContent let-inputId=\"sectionId\">\n @for (func of calculationFunctions; track func) {\n <button (click)=\"toggleFunction(func, inputId)\" mat-menu-item>\n {{ func }}\n @if (selectedFunction(func)) {\n <mat-icon color=\"primary\">check_circle</mat-icon>\n }\n </button>\n }\n </ng-template>\n</mat-menu>\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"] }]
|
|
585
|
+
}], 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"] }] } });
|
|
586
|
+
|
|
587
|
+
function getCaluculatedTableData(inputConfig, data) {
|
|
588
|
+
try {
|
|
589
|
+
if (!Array.isArray(data) || !inputConfig)
|
|
590
|
+
return data;
|
|
591
|
+
const input = inputConfig;
|
|
592
|
+
const funcs = (input?.calculateListFunctions || []);
|
|
593
|
+
const allUniqueFunctionNames = [
|
|
594
|
+
...new Set(funcs.map((f) => f.func)),
|
|
595
|
+
];
|
|
596
|
+
const calculatedData = allUniqueFunctionNames.map((func) => {
|
|
597
|
+
const newCalculatedData = {
|
|
598
|
+
SYSTEM_KEY_PROPERTY_FOR_MULTIPLE_INPUTS_CALCULATION_FUNCTION: func,
|
|
599
|
+
};
|
|
600
|
+
funcs.filter((f) => f.func === func).forEach((f) => {
|
|
601
|
+
const arrayValues = data.map((d) => Number(d[f.inputId]));
|
|
602
|
+
newCalculatedData[f.inputId] = calculateListOveralFunctions(func, arrayValues);
|
|
603
|
+
});
|
|
604
|
+
return newCalculatedData;
|
|
605
|
+
});
|
|
606
|
+
return [...data, ...calculatedData];
|
|
607
|
+
}
|
|
608
|
+
catch (error) {
|
|
609
|
+
return data;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
const customInputConfig = {
|
|
614
|
+
controlType: 'app-multiple-input-table',
|
|
615
|
+
nextId: 0,
|
|
616
|
+
};
|
|
617
|
+
class MultipleInputTableComponent extends BaseCustomInput {
|
|
618
|
+
#destroyRef;
|
|
619
|
+
constructor() {
|
|
620
|
+
super(inject(NgControl, { self: true, optional: true }), inject(ElementRef), customInputConfig);
|
|
621
|
+
this.editorMode = input(false, ...(ngDevMode ? [{ debugName: "editorMode" }] : /* istanbul ignore next */ []));
|
|
622
|
+
this.formGroup = input.required(...(ngDevMode ? [{ debugName: "formGroup" }] : /* istanbul ignore next */ []));
|
|
623
|
+
this.inputConfig = input.required(...(ngDevMode ? [{ debugName: "inputConfig" }] : /* istanbul ignore next */ []));
|
|
624
|
+
this.formBuilderFunctions = input(undefined, ...(ngDevMode ? [{ debugName: "formBuilderFunctions" }] : /* istanbul ignore next */ []));
|
|
625
|
+
this.#destroyRef = inject(DestroyRef);
|
|
626
|
+
this.rowInViewOnly = undefined;
|
|
627
|
+
this.listenToValueChanges();
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Manages custom validation errors on the form control.
|
|
631
|
+
* Intended to be called from the ngDoCheck lifecycle hook.
|
|
632
|
+
* This function handles both the 'required' error and the new
|
|
633
|
+
* 'multipleInputListMissingSomeFields' custom error.
|
|
634
|
+
*/
|
|
635
|
+
checkValidationsAnErrors() {
|
|
636
|
+
const control = this.ngControl?.control;
|
|
637
|
+
// 1. Early exit if there's no form control to work with.
|
|
638
|
+
if (!control) {
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
// --- DEFINE THE DESIRED ERROR STATE ---
|
|
642
|
+
// 2. Determine if the custom "multiple fields" error should exist.
|
|
643
|
+
let shouldHaveCustomError = false;
|
|
644
|
+
const formInputs = this.inputConfig()?.formInputs;
|
|
645
|
+
if (Array.isArray(formInputs) && Array.isArray(this.value)) {
|
|
646
|
+
const requiredFieldIds = formInputs
|
|
647
|
+
.filter(i => i.required)
|
|
648
|
+
.map(i => i.id);
|
|
649
|
+
if (requiredFieldIds.length > 0) {
|
|
650
|
+
const configId = this.inputConfig().id;
|
|
651
|
+
shouldHaveCustomError = this.value.some(item => requiredFieldIds.some(id => this._isNilOrEmpty(item?.[`${configId}.${id}`])));
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
// 3. Determine if the standard 'required' error should exist.
|
|
655
|
+
const shouldHaveRequiredError = this.required && this._isNilOrEmpty(this.value);
|
|
656
|
+
// --- APPLY THE ERROR STATE TO THE CONTROL ---
|
|
657
|
+
// 4. Preserve other errors that might be on the control (e.g., minlength, pattern).
|
|
658
|
+
const newErrors = { ...control.errors };
|
|
659
|
+
delete newErrors['required'];
|
|
660
|
+
delete newErrors['multipleInputListMissingSomeFields'];
|
|
661
|
+
// 5. Add our managed errors back if their conditions are met.
|
|
662
|
+
if (shouldHaveRequiredError) {
|
|
663
|
+
newErrors['required'] = true;
|
|
664
|
+
}
|
|
665
|
+
if (shouldHaveCustomError) {
|
|
666
|
+
newErrors['multipleInputListMissingSomeFields'] = { value: true }; // Or simply 'true'
|
|
667
|
+
}
|
|
668
|
+
// 6. Finalize the error object. If no errors, it must be null.
|
|
669
|
+
const finalErrors = Object.keys(newErrors).length > 0 ? newErrors : null;
|
|
670
|
+
// 7. IMPORTANT: Only update the control if the errors have actually changed.
|
|
671
|
+
// This prevents infinite loops within ngDoCheck. A simple stringify is a
|
|
672
|
+
// dependency-free way to compare the error objects.
|
|
673
|
+
if (JSON.stringify(control.errors) !== JSON.stringify(finalErrors)) {
|
|
674
|
+
control.setErrors(finalErrors);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
get empty() {
|
|
678
|
+
return !this.value;
|
|
679
|
+
}
|
|
680
|
+
get shouldLabelFloat() {
|
|
681
|
+
return this.focused || !this.empty;
|
|
682
|
+
}
|
|
683
|
+
get errorState() {
|
|
684
|
+
// 1. Check for standard validation errors from Angular's Forms API.
|
|
685
|
+
const hasStandardError = !!this.ngControl?.errors;
|
|
686
|
+
// 2. Check for custom validation errors specific to 'IMultiple' type.
|
|
687
|
+
let hasCustomError = false;
|
|
688
|
+
const formInputs = this.inputConfig()?.formInputs;
|
|
689
|
+
// This custom logic only runs if the config and value are the expected array types.
|
|
690
|
+
if (Array.isArray(formInputs) && Array.isArray(this.value)) {
|
|
691
|
+
const requiredFieldIds = formInputs
|
|
692
|
+
.filter(input => input.required)
|
|
693
|
+
.map(input => input.id);
|
|
694
|
+
// The custom error is true if any item in our value array is missing
|
|
695
|
+
// a value for any of its required sub-fields.
|
|
696
|
+
if (requiredFieldIds.length > 0) {
|
|
697
|
+
hasCustomError = this.value.some(item => requiredFieldIds.some(id => this._isNilOrEmpty(item?.[`${this.inputConfig().id}.${id}`])));
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
// 3. The final error state is true if *any* validation fails,
|
|
701
|
+
// AND the control has been "touched" by the user.
|
|
702
|
+
return (hasStandardError || hasCustomError) && this.touched;
|
|
703
|
+
}
|
|
704
|
+
_isNilOrEmpty(value) {
|
|
705
|
+
return value === null || value === undefined || value === '';
|
|
706
|
+
}
|
|
707
|
+
listenToValueChanges() {
|
|
708
|
+
this.stateChanges
|
|
709
|
+
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
710
|
+
.subscribe(() => {
|
|
711
|
+
this.checkItemList();
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
checkItemList() {
|
|
715
|
+
try {
|
|
716
|
+
if (this.value) {
|
|
717
|
+
const config = this.inputConfig();
|
|
718
|
+
const TableData = (config.groupBy?.length ?? 0) > 0
|
|
719
|
+
? addGroups(this.value, config.groupBy)
|
|
720
|
+
: this.value;
|
|
721
|
+
const data = getCaluculatedTableData(config, TableData);
|
|
722
|
+
if (!this.dataSource) {
|
|
723
|
+
this.dataSource = new MatTableDataSource(data);
|
|
724
|
+
this.dataSource;
|
|
725
|
+
}
|
|
726
|
+
else {
|
|
727
|
+
this.dataSource.data = data;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
return true;
|
|
731
|
+
}
|
|
732
|
+
catch {
|
|
733
|
+
return false;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
multipleInputRemoveItem(item) {
|
|
737
|
+
if (!item)
|
|
738
|
+
return;
|
|
739
|
+
if (!this.value)
|
|
740
|
+
return;
|
|
741
|
+
this.value = this.value.filter((i) => !_isEqual(i, item));
|
|
742
|
+
this.applyOptionsTo = undefined;
|
|
743
|
+
this.onChange(this.value);
|
|
744
|
+
this.stateChanges.next();
|
|
745
|
+
}
|
|
746
|
+
generateMultipleInputForm() {
|
|
747
|
+
const id = this.inputConfig()?.id;
|
|
748
|
+
if (!id)
|
|
749
|
+
return;
|
|
750
|
+
this.formBuilderFunctions()?.multipleInputToggleForm(id, true);
|
|
751
|
+
}
|
|
752
|
+
editRow(rowId) {
|
|
753
|
+
if (!rowId) {
|
|
754
|
+
throw new Error('Row id not provided');
|
|
755
|
+
}
|
|
756
|
+
const config = this.inputConfig();
|
|
757
|
+
const fbf = this.formBuilderFunctions();
|
|
758
|
+
if (!fbf || !config)
|
|
759
|
+
return;
|
|
760
|
+
fbf.multipleInputEditRow(config.id, rowId);
|
|
761
|
+
// if( !this.inputConfig?.multipleInputController){
|
|
762
|
+
// return
|
|
763
|
+
// }
|
|
764
|
+
// this.inputConfig.multipleInputInEditId = this.applyOptionsTo.id;
|
|
765
|
+
// this.inputConfig.applyMultipleInputValuesToForm(
|
|
766
|
+
// this.applyOptionsTo
|
|
767
|
+
// );
|
|
768
|
+
}
|
|
769
|
+
copy(rowId) {
|
|
770
|
+
const config = this.inputConfig();
|
|
771
|
+
const fbf = this.formBuilderFunctions();
|
|
772
|
+
if (!fbf || !config)
|
|
773
|
+
return;
|
|
774
|
+
fbf.multipleInputDuplicateRow(config.id, rowId);
|
|
775
|
+
// this.generateMultipleInputForm();
|
|
776
|
+
// this.inputConfig?.applyMultipleInputValuesToForm(
|
|
777
|
+
// this.applyOptionsTo
|
|
778
|
+
// );
|
|
779
|
+
// this.applyOptionsTo = undefined;
|
|
780
|
+
}
|
|
781
|
+
get handleLabel() {
|
|
782
|
+
return this.inputConfig()?.handleLabel;
|
|
783
|
+
}
|
|
784
|
+
handleIcon() {
|
|
785
|
+
// NOTE(phase-4): `handleIcon` is declared on `IBasicFormInput` but not on `IMultiple` directly;
|
|
786
|
+
// narrow through `ITowerStepColumn` (which extends FormColumnInputs) and provide a string fallback.
|
|
787
|
+
const cfg = this.inputConfig();
|
|
788
|
+
return cfg?.handleIcon || 'add';
|
|
789
|
+
}
|
|
790
|
+
saveMultipleInputForm() {
|
|
791
|
+
this.formBuilderFunctions()?.multipleInputSaveForm(this.inputConfig().id);
|
|
792
|
+
// const value: any = this.inputConfig?.multipleInputFormValue();
|
|
793
|
+
// value['id'] = uuidv4();
|
|
794
|
+
// if (!this.inputConfig) {
|
|
795
|
+
// return
|
|
796
|
+
// }
|
|
797
|
+
// const previousValue = this.value
|
|
798
|
+
// if (!previousValue) {
|
|
799
|
+
// this.value = [value];
|
|
800
|
+
// this.inputConfig.multipleInputController = undefined;
|
|
801
|
+
// } else {
|
|
802
|
+
// if (this.inputConfig?.multipleInputInEditId) {
|
|
803
|
+
// let inEdit = previousValue.find(
|
|
804
|
+
// (i: { id: any }) =>
|
|
805
|
+
// i.id === this.inputConfig?.multipleInputInEditId
|
|
806
|
+
// );
|
|
807
|
+
// Object.keys(inEdit).every((s) => {
|
|
808
|
+
// s;
|
|
809
|
+
// inEdit[s] = value[s];
|
|
810
|
+
// return !!inEdit[s];
|
|
811
|
+
// });
|
|
812
|
+
// this.value = [...previousValue],
|
|
813
|
+
// this.inputConfig.multipleInputController = undefined;
|
|
814
|
+
// } else {
|
|
815
|
+
// this.value = [...previousValue, value];
|
|
816
|
+
// this.inputConfig.multipleInputController = undefined;
|
|
817
|
+
// }
|
|
818
|
+
// }
|
|
819
|
+
// this.onChange(this.value);
|
|
820
|
+
// this.stateChanges.next();
|
|
821
|
+
// this.checkItemList(this.value || []);
|
|
822
|
+
// return
|
|
823
|
+
}
|
|
824
|
+
editInput(input) {
|
|
825
|
+
const fbf = this.formBuilderFunctions();
|
|
826
|
+
if (typeof fbf?.editInput !== 'function') {
|
|
827
|
+
throw new Error('editInput function not defined in formBuilderFunctions');
|
|
828
|
+
}
|
|
829
|
+
fbf.editInput(input);
|
|
830
|
+
}
|
|
831
|
+
deleteItemInput(input) {
|
|
832
|
+
this.formBuilderFunctions()?.deleteInput(input);
|
|
833
|
+
}
|
|
834
|
+
showItemAsLabel(input) {
|
|
835
|
+
this.formBuilderFunctions()?.multipleInputToggleLabel(input);
|
|
836
|
+
}
|
|
837
|
+
addFunction(func) {
|
|
838
|
+
this.formBuilderFunctions()?.addFunction(func, this.inputConfig()?.id);
|
|
839
|
+
}
|
|
840
|
+
// `FormBuilderFunctions.reorderItems` is now generic over the row shape; the
|
|
841
|
+
// container/data slots stay `unknown` (opaque drag payload).
|
|
842
|
+
reorderItems(event) {
|
|
843
|
+
const config = this.inputConfig();
|
|
844
|
+
const fbf = this.formBuilderFunctions();
|
|
845
|
+
if (!fbf || !config)
|
|
846
|
+
return;
|
|
847
|
+
// 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.
|
|
848
|
+
fbf.reorderItems(event, config.id);
|
|
849
|
+
}
|
|
850
|
+
get parentFormGroup() {
|
|
851
|
+
return this.ngControl?.control?.parent;
|
|
852
|
+
}
|
|
853
|
+
get canAddRecords() {
|
|
854
|
+
const config = this.inputConfig();
|
|
855
|
+
if (!config)
|
|
856
|
+
return false;
|
|
857
|
+
//NOTE: Temporary backward compatibility for older versions of the config that might not have the new property
|
|
858
|
+
if (!config.multipleInputAvailableOperations)
|
|
859
|
+
return true;
|
|
860
|
+
return config.multipleInputAvailableOperations?.includes(MultipleInputAvailableOperations.Add);
|
|
861
|
+
}
|
|
862
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: MultipleInputTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
863
|
+
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().formIsOpen && canAddRecords) {\n <section class=\"add-row-bar\">\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 </section>\n}\n", styles: [".table-container{position:relative;max-height:400px;overflow:auto}table{width:100%}.add-row-bar{margin-top:.5rem}.add-row-button{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-icon{font-size:1.125rem;width:1.125rem;height:1.125rem;line-height:1.125rem}.add-row-label{line-height:1}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { 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 }); }
|
|
864
|
+
}
|
|
865
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: MultipleInputTableComponent, decorators: [{
|
|
866
|
+
type: Component,
|
|
867
|
+
args: [{ selector: 'lib-multiple-input-table', imports: [
|
|
868
|
+
MatButtonModule,
|
|
869
|
+
MatIconModule,
|
|
870
|
+
MultipleInputTableEditComponent,
|
|
871
|
+
MultipleInputTableViewComponent,
|
|
872
|
+
], 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().formIsOpen && canAddRecords) {\n <section class=\"add-row-bar\">\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 </section>\n}\n", styles: [".table-container{position:relative;max-height:400px;overflow:auto}table{width:100%}.add-row-bar{margin-top:.5rem}.add-row-button{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-icon{font-size:1.125rem;width:1.125rem;height:1.125rem;line-height:1.125rem}.add-row-label{line-height:1}\n"] }]
|
|
873
|
+
}], 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 }] }] } });
|
|
874
|
+
function addGroups(tableValue, groupBy) {
|
|
875
|
+
throw new Error('Function not implemented.');
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
/** Wraps a multi-row input table inside a `mat-form-field`. */
|
|
879
|
+
class MultipleInputInputElementComponent {
|
|
880
|
+
constructor() {
|
|
881
|
+
this.inputConfig = input.required(...(ngDevMode ? [{ debugName: "inputConfig" }] : /* istanbul ignore next */ []));
|
|
882
|
+
this.formGroup = input.required(...(ngDevMode ? [{ debugName: "formGroup" }] : /* istanbul ignore next */ []));
|
|
883
|
+
this.editorMode = input(false, ...(ngDevMode ? [{ debugName: "editorMode" }] : /* istanbul ignore next */ []));
|
|
884
|
+
this.formBuilderFunctions = input(undefined, ...(ngDevMode ? [{ debugName: "formBuilderFunctions" }] : /* istanbul ignore next */ []));
|
|
885
|
+
this.reload = output();
|
|
886
|
+
this.errorMessage = computed(() => getInputErrorMessage(this.inputConfig(), this.formGroup()), ...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
|
|
887
|
+
}
|
|
888
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: MultipleInputInputElementComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
889
|
+
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()\">\n @if (inputConfig(); as inputConfig) {\n <mat-form-field\n class=\"multiple-input-field\"\n [appearance]=\"inputConfig.appearance || 'fill'\"\n subscriptSizing=\"dynamic\"\n floatLabel=\"always\"\n >\n <mat-label>\n {{ inputConfig.label }}\n <lib-t-form-input-status [inputConfig]=\"inputConfig\"></lib-t-form-input-status>\n </mat-label>\n\n @if (inputConfig.id) {\n <lib-multiple-input-table\n [editorMode]=\"editorMode()\"\n [required]=\"inputConfig.required\"\n [formGroup]=\"formGroup()\"\n [formBuilderFunctions]=\"formBuilderFunctions()\"\n [formControlName]=\"inputConfig.id\"\n [inputConfig]=\"inputConfig\"\n ></lib-multiple-input-table>\n }\n\n @if (inputConfig.hintLabel || inputConfig.temporaryHint) {\n <mat-hint class=\"inputHint\">\n {{ inputConfig.temporaryHint || inputConfig.hintLabel }}\n </mat-hint>\n }\n\n @if (!!errorMessage()) {\n <mat-error class=\"oneLineTextEllipsis\" matTooltipClass=\"errorToolTip\">{{ errorMessage() }}</mat-error>\n }\n\n @if (inputConfig.canReload?.canReload) {\n <button\n mat-icon-button\n matTooltip=\"Click to refresh this field.\"\n class=\"input-sync-button\"\n (click)=\"inputConfig.canReload.emit()\"\n matSuffix\n >\n <mat-icon>sync</mat-icon>\n </button>\n }\n\n @if (inputConfig.prefixIcon) {\n <mat-icon matPrefix>{{ inputConfig.prefixIcon }}</mat-icon>\n }\n\n @if (inputConfig.suffixIcon && inputConfig.id !== 'password') {\n <mat-icon matSuffix>{{ inputConfig.suffixIcon }}</mat-icon>\n }\n\n @if (inputConfig.prefixText) {\n <span class=\"affix-text\" matPrefix>{{ inputConfig.prefixText }}</span>\n }\n @if (inputConfig.suffixText) {\n <span class=\"affix-text affix-text--suffix\" matSuffix>{{ inputConfig.suffixText }}</span>\n }\n\n @if (inputConfig.maxLength && formGroup()) {\n <mat-hint align=\"end\">\n {{ (formGroup().controls[inputConfig.id]?.value?.length || 0) + '/' + inputConfig.maxLength }}\n </mat-hint>\n }\n </mat-form-field>\n }\n</form>\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}.input-sync-button{margin-right:.25rem;opacity:0;transform:scale(.85);pointer-events:none;transition:opacity .3s cubic-bezier(.16,1,.3,1),transform .3s cubic-bezier(.16,1,.3,1)}.input-sync-button mat-icon{color:var(--mat-sys-primary, #6750a4)}.multiple-input-field:hover .input-sync-button,.multiple-input-field:focus-within .input-sync-button{opacity:1;transform:scale(1);pointer-events:auto}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$4.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$4.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1$4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$4.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i2.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: "component", type: i1.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i5$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { 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 }); }
|
|
890
|
+
}
|
|
891
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: MultipleInputInputElementComponent, decorators: [{
|
|
892
|
+
type: Component,
|
|
893
|
+
args: [{ selector: 'lib-multiple-input-input-element', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
894
|
+
ReactiveFormsModule,
|
|
895
|
+
MatFormFieldModule,
|
|
896
|
+
MatIconModule,
|
|
897
|
+
MatButtonModule,
|
|
898
|
+
MatTooltipModule,
|
|
899
|
+
TFormInputStatusComponent,
|
|
900
|
+
MultipleInputTableComponent,
|
|
901
|
+
], template: "<form [formGroup]=\"formGroup()\">\n @if (inputConfig(); as inputConfig) {\n <mat-form-field\n class=\"multiple-input-field\"\n [appearance]=\"inputConfig.appearance || 'fill'\"\n subscriptSizing=\"dynamic\"\n floatLabel=\"always\"\n >\n <mat-label>\n {{ inputConfig.label }}\n <lib-t-form-input-status [inputConfig]=\"inputConfig\"></lib-t-form-input-status>\n </mat-label>\n\n @if (inputConfig.id) {\n <lib-multiple-input-table\n [editorMode]=\"editorMode()\"\n [required]=\"inputConfig.required\"\n [formGroup]=\"formGroup()\"\n [formBuilderFunctions]=\"formBuilderFunctions()\"\n [formControlName]=\"inputConfig.id\"\n [inputConfig]=\"inputConfig\"\n ></lib-multiple-input-table>\n }\n\n @if (inputConfig.hintLabel || inputConfig.temporaryHint) {\n <mat-hint class=\"inputHint\">\n {{ inputConfig.temporaryHint || inputConfig.hintLabel }}\n </mat-hint>\n }\n\n @if (!!errorMessage()) {\n <mat-error class=\"oneLineTextEllipsis\" matTooltipClass=\"errorToolTip\">{{ errorMessage() }}</mat-error>\n }\n\n @if (inputConfig.canReload?.canReload) {\n <button\n mat-icon-button\n matTooltip=\"Click to refresh this field.\"\n class=\"input-sync-button\"\n (click)=\"inputConfig.canReload.emit()\"\n matSuffix\n >\n <mat-icon>sync</mat-icon>\n </button>\n }\n\n @if (inputConfig.prefixIcon) {\n <mat-icon matPrefix>{{ inputConfig.prefixIcon }}</mat-icon>\n }\n\n @if (inputConfig.suffixIcon && inputConfig.id !== 'password') {\n <mat-icon matSuffix>{{ inputConfig.suffixIcon }}</mat-icon>\n }\n\n @if (inputConfig.prefixText) {\n <span class=\"affix-text\" matPrefix>{{ inputConfig.prefixText }}</span>\n }\n @if (inputConfig.suffixText) {\n <span class=\"affix-text affix-text--suffix\" matSuffix>{{ inputConfig.suffixText }}</span>\n }\n\n @if (inputConfig.maxLength && formGroup()) {\n <mat-hint align=\"end\">\n {{ (formGroup().controls[inputConfig.id]?.value?.length || 0) + '/' + inputConfig.maxLength }}\n </mat-hint>\n }\n </mat-form-field>\n }\n</form>\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}.input-sync-button{margin-right:.25rem;opacity:0;transform:scale(.85);pointer-events:none;transition:opacity .3s cubic-bezier(.16,1,.3,1),transform .3s cubic-bezier(.16,1,.3,1)}.input-sync-button mat-icon{color:var(--mat-sys-primary, #6750a4)}.multiple-input-field:hover .input-sync-button,.multiple-input-field:focus-within .input-sync-button{opacity:1;transform:scale(1);pointer-events:auto}\n"] }]
|
|
902
|
+
}], 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"] }] } });
|
|
903
|
+
|
|
904
|
+
export { MultipleInputInputElementComponent };
|
|
905
|
+
//# sourceMappingURL=ngx-t-forms-multiple-input-input-element.component-C7y1OGPx.mjs.map
|