ngx-t-forms 2.0.30 → 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-SM5XM9uy.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 +1747 -746
- package/fesm2022/ngx-t-forms-calculated-field-rules.component-Ct6_c_Lj.mjs +0 -313
- package/fesm2022/ngx-t-forms-calculated-field-rules.component-Ct6_c_Lj.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-chip-options-creator-editor.component-yuM1KHho.mjs +0 -191
- package/fesm2022/ngx-t-forms-chip-options-creator-editor.component-yuM1KHho.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-config-mscoa-additional-inputs.component-BptpYSe-.mjs +0 -207
- package/fesm2022/ngx-t-forms-config-mscoa-additional-inputs.component-BptpYSe-.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-data-source-picker.component-Badna1Rl.mjs +0 -204
- package/fesm2022/ngx-t-forms-data-source-picker.component-Badna1Rl.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-document-list-label-config-editor.component-2_8XzUgD.mjs +0 -289
- package/fesm2022/ngx-t-forms-document-list-label-config-editor.component-2_8XzUgD.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-form-input-selector.component-DV4Sts9F.mjs +0 -134
- package/fesm2022/ngx-t-forms-form-input-selector.component-DV4Sts9F.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-form-json-view.component-B8seYzMQ.mjs +0 -22
- package/fesm2022/ngx-t-forms-form-json-view.component-B8seYzMQ.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-form-section-stepper.component-x_83iAWA.mjs +0 -281
- package/fesm2022/ngx-t-forms-form-section-stepper.component-x_83iAWA.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-forms-builder-menu.component-UWo_dyVt.mjs +0 -345
- package/fesm2022/ngx-t-forms-forms-builder-menu.component-UWo_dyVt.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-input-editor.component-B_kkOoEO.mjs +0 -147
- package/fesm2022/ngx-t-forms-input-editor.component-B_kkOoEO.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-map-mat-options-keys-SM5XM9uy.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mat-chip-list-editor.component-C41AL9Et.mjs +0 -105
- package/fesm2022/ngx-t-forms-mat-chip-list-editor.component-C41AL9Et.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mat-slider-editor.component-BWe8U-sI.mjs +0 -109
- package/fesm2022/ngx-t-forms-mat-slider-editor.component-BWe8U-sI.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mat-slider-toggle-editor.component-B_XlkHuK.mjs +0 -155
- package/fesm2022/ngx-t-forms-mat-slider-toggle-editor.component-B_XlkHuK.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-missing-form-configs.component-DPNNyKkt.mjs +0 -28
- package/fesm2022/ngx-t-forms-missing-form-configs.component-DPNNyKkt.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mscoa-chart-toolbar.component-DY1QnG08.mjs +0 -43
- package/fesm2022/ngx-t-forms-mscoa-chart-toolbar.component-DY1QnG08.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mscoa-error-display.component-CRc_4l3l.mjs +0 -116
- package/fesm2022/ngx-t-forms-mscoa-error-display.component-CRc_4l3l.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mscoa-segment-config.component-Ckr_nuZF.mjs +0 -296
- package/fesm2022/ngx-t-forms-mscoa-segment-config.component-Ckr_nuZF.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mscoa-temporary-hint.component-GYxT-56Y.mjs +0 -83
- package/fesm2022/ngx-t-forms-mscoa-temporary-hint.component-GYxT-56Y.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-ngx-t-forms-DP2koSL5.mjs +0 -17401
- package/fesm2022/ngx-t-forms-ngx-t-forms-DP2koSL5.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-pipeline-generator.component-BxHetD_Q.mjs +0 -613
- package/fesm2022/ngx-t-forms-pipeline-generator.component-BxHetD_Q.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-record-list-manager.component-BQuMkoXo.mjs +0 -269
- package/fesm2022/ngx-t-forms-record-list-manager.component-BQuMkoXo.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-required-inputs.component-CLyq9dIR.mjs +0 -190
- package/fesm2022/ngx-t-forms-required-inputs.component-CLyq9dIR.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-rest-api-call-setup.component-CWeIUKLz.mjs +0 -291
- package/fesm2022/ngx-t-forms-rest-api-call-setup.component-CWeIUKLz.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-section-report.component-BtaF39WD.mjs +0 -156
- package/fesm2022/ngx-t-forms-section-report.component-BtaF39WD.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-selection-options-editor.component-B4cEGWrK.mjs +0 -186
- package/fesm2022/ngx-t-forms-selection-options-editor.component-B4cEGWrK.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-t-workflow-picker.component-BkVN4Wdk.mjs +0 -187
- package/fesm2022/ngx-t-forms-t-workflow-picker.component-BkVN4Wdk.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-validators-config.component-Cq07Er-G.mjs +0 -215
- package/fesm2022/ngx-t-forms-validators-config.component-Cq07Er-G.mjs.map +0 -1
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import * as i2 from '@angular/common';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import * as i0 from '@angular/core';
|
|
4
|
-
import { EventEmitter, Output, Input, HostBinding, Optional, Self, Component } from '@angular/core';
|
|
5
|
-
import * as i1 from '@angular/forms';
|
|
6
|
-
import { FormsModule } from '@angular/forms';
|
|
7
|
-
import { f as getInputIllustration, M as MatModulesModule } from './ngx-t-forms-ngx-t-forms-DP2koSL5.mjs';
|
|
8
|
-
import { MinInputTypes } from 'ngx-t-forms-types';
|
|
9
|
-
import { MatFormFieldControl } from '@angular/material/form-field';
|
|
10
|
-
import { Subject } from 'rxjs';
|
|
11
|
-
import * as i2$1 from '@angular/material/autocomplete';
|
|
12
|
-
import * as i2$2 from '@angular/material/button';
|
|
13
|
-
import * as i3 from '@angular/material/card';
|
|
14
|
-
import * as i4 from '@angular/material/chips';
|
|
15
|
-
import * as i4$1 from '@angular/material/divider';
|
|
16
|
-
import * as i3$1 from '@angular/material/icon';
|
|
17
|
-
import * as i7 from '@angular/material/list';
|
|
18
|
-
import * as i3$2 from '@angular/material/select';
|
|
19
|
-
import * as i13 from '@angular/material/input';
|
|
20
|
-
|
|
21
|
-
class RequiredInputsComponent {
|
|
22
|
-
static { this.nextId = 0; }
|
|
23
|
-
constructor(ngControl, _elementRef) {
|
|
24
|
-
this.ngControl = ngControl;
|
|
25
|
-
this._elementRef = _elementRef;
|
|
26
|
-
this.stateChanges = new Subject();
|
|
27
|
-
this.id = `app-required-inputs-${RequiredInputsComponent.nextId++}`;
|
|
28
|
-
this.placeholder = '';
|
|
29
|
-
this.focused = false;
|
|
30
|
-
this.required = false;
|
|
31
|
-
this.disabled = false;
|
|
32
|
-
this.errors = [];
|
|
33
|
-
this.touched = false;
|
|
34
|
-
this.onTouched = () => { };
|
|
35
|
-
this._value = [];
|
|
36
|
-
this.formInputs = [];
|
|
37
|
-
this.valueChanged = new EventEmitter();
|
|
38
|
-
this.activeInput = '';
|
|
39
|
-
this.minInputTypes = MinInputTypes;
|
|
40
|
-
}
|
|
41
|
-
get empty() {
|
|
42
|
-
return !this.value;
|
|
43
|
-
}
|
|
44
|
-
get shouldLabelFloat() {
|
|
45
|
-
return this.focused || !this.empty;
|
|
46
|
-
}
|
|
47
|
-
get errorState() {
|
|
48
|
-
const hasError = !!this.ngControl?.control?.errors || (this.errors || []).length > 0 && this.touched;
|
|
49
|
-
return !this.value && !!this.required || hasError;
|
|
50
|
-
}
|
|
51
|
-
setDescribedByIds(ids) {
|
|
52
|
-
// Ensure the component view is initialized
|
|
53
|
-
if (this._elementRef && this._elementRef.nativeElement) {
|
|
54
|
-
const controlElement = this._elementRef.nativeElement.querySelector('.app-required-inputs');
|
|
55
|
-
// Check if the controlElement exists before attempting to set its attribute
|
|
56
|
-
if (controlElement) {
|
|
57
|
-
controlElement.setAttribute('aria-describedby', ids.join(' '));
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
onContainerClick(event) {
|
|
62
|
-
this.markAsTouched();
|
|
63
|
-
this.stateChanges.next();
|
|
64
|
-
}
|
|
65
|
-
markAsTouched() {
|
|
66
|
-
if (!this.touched) {
|
|
67
|
-
this.onTouched();
|
|
68
|
-
this.touched = true;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
set value(v) {
|
|
72
|
-
const changed = JSON.stringify(this._value) !== JSON.stringify(v);
|
|
73
|
-
if (changed) {
|
|
74
|
-
this._value = v;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
get value() {
|
|
78
|
-
return this._value;
|
|
79
|
-
}
|
|
80
|
-
minInputValueType(type) {
|
|
81
|
-
if (type === "mapDocFilter" && !!this.minInputInEdit) {
|
|
82
|
-
this.minInputInEdit.mapTo = [];
|
|
83
|
-
}
|
|
84
|
-
if (this.minInputInEdit?.type === type) {
|
|
85
|
-
this.minInputInEdit.type = undefined;
|
|
86
|
-
}
|
|
87
|
-
else if (this.minInputInEdit) {
|
|
88
|
-
this.minInputInEdit.type = type;
|
|
89
|
-
}
|
|
90
|
-
this.valueChanged.emit(this.value);
|
|
91
|
-
}
|
|
92
|
-
get minInputInEdit() {
|
|
93
|
-
return this.value?.find((v) => v.name === this.activeInput) || {};
|
|
94
|
-
}
|
|
95
|
-
set minInputInEdit(v) {
|
|
96
|
-
this.value = this.value.map((val) => {
|
|
97
|
-
if (val.name === this.activeInput) {
|
|
98
|
-
return v;
|
|
99
|
-
}
|
|
100
|
-
return val;
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
save() {
|
|
104
|
-
this.valueChanged.emit(this.value);
|
|
105
|
-
this.activeInput = '';
|
|
106
|
-
}
|
|
107
|
-
inputIsDisabled(input) {
|
|
108
|
-
return input['element'] === 'sectionTitle';
|
|
109
|
-
}
|
|
110
|
-
mapTo(input) {
|
|
111
|
-
const inp = this.minInputInEdit;
|
|
112
|
-
const mapToThis = {
|
|
113
|
-
formControlName: input.formControlName,
|
|
114
|
-
dataType: input.dataType,
|
|
115
|
-
element: input.element,
|
|
116
|
-
inputId: input.id
|
|
117
|
-
};
|
|
118
|
-
if (!!inp && this.minInputInEdit?.type === MinInputTypes.MapTo) {
|
|
119
|
-
inp.mapTo?.formControlName === mapToThis.formControlName
|
|
120
|
-
? (inp.mapTo = undefined)
|
|
121
|
-
: (inp.mapTo = mapToThis);
|
|
122
|
-
}
|
|
123
|
-
if (!!inp && this.minInputInEdit?.type === 'mapDocFilter') {
|
|
124
|
-
if (this.inputMappedTo(mapToThis.formControlName)) {
|
|
125
|
-
inp.mapTo.splice(inp.mapTo.indexOf(mapToThis), 1);
|
|
126
|
-
}
|
|
127
|
-
else if (typeof inp.mapTo === "string" || !inp.mapTo || !!inp.mapTo.find(inp => typeof inp === "string")) {
|
|
128
|
-
inp.mapTo = [mapToThis];
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
inp.mapTo.push(mapToThis);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
this.valueChanged.emit(this.value);
|
|
135
|
-
}
|
|
136
|
-
isLinked(input) {
|
|
137
|
-
return ((input.type === 'mapDocFilter' && !!input.mapTo) ||
|
|
138
|
-
(input.type === 'default' && !!input.defaultValue) ||
|
|
139
|
-
(input.type === 'mapto' && !!input.mapTo));
|
|
140
|
-
}
|
|
141
|
-
inputMappedTo(formControlName) {
|
|
142
|
-
if (this.minInputInEdit?.type === 'mapto') {
|
|
143
|
-
return this.minInputInEdit?.mapTo?.formControlName === formControlName;
|
|
144
|
-
}
|
|
145
|
-
if (this.minInputInEdit?.type === 'mapDocFilter') {
|
|
146
|
-
return !!this.minInputInEdit?.mapTo?.find(m => m.formControlName === formControlName);
|
|
147
|
-
}
|
|
148
|
-
return false;
|
|
149
|
-
}
|
|
150
|
-
getInputIllustration(input) {
|
|
151
|
-
return getInputIllustration(input.element);
|
|
152
|
-
}
|
|
153
|
-
get formInputsToMapTo() {
|
|
154
|
-
return this.formInputs.filter((input) => !this.inputIsDisabled(input)).map((input) => {
|
|
155
|
-
return {
|
|
156
|
-
...input,
|
|
157
|
-
illustration: this.getInputIllustration(input),
|
|
158
|
-
activated: this.inputMappedTo(input.formControlName)
|
|
159
|
-
};
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
get activatedInputs() {
|
|
163
|
-
return this.formInputsToMapTo.find((input) => input.activated);
|
|
164
|
-
}
|
|
165
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: RequiredInputsComponent, deps: [{ token: i1.NgControl, optional: true, self: true }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
166
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.5", type: RequiredInputsComponent, isStandalone: true, selector: "app-required-inputs", inputs: { disabled: "disabled", errors: "errors", value: "value", formInputs: "formInputs" }, outputs: { valueChanged: "valueChanged" }, host: { properties: { "id": "this.id" } }, providers: [{ provide: MatFormFieldControl, useExisting: RequiredInputsComponent }], ngImport: i0, template: "<mat-card class=\"required-inputs-card\">\r\n <div class=\"card-header\">\r\n <div class=\"header-icon\" aria-hidden=\"true\">\r\n <mat-icon>link</mat-icon>\r\n </div>\r\n <div class=\"header-text\">\r\n <h2 class=\"header-title\">Required Inputs</h2>\r\n <p class=\"header-subtitle\">Link or set default values for all required inputs.</p>\r\n </div>\r\n </div>\r\n\r\n <mat-card-content class=\"card-body\">\r\n <div class=\"info-block\">\r\n <mat-icon class=\"info-icon\" color=\"primary\">info</mat-icon>\r\n <span>Ensure all required inputs are linked or have a default value.</span>\r\n </div>\r\n\r\n <mat-chip-listbox aria-label=\"Required inputs - select one to configure\" class=\"chip-listbox\">\r\n <mat-chip-option\r\n *ngFor=\"let input of value\"\r\n [disabled]=\"disabled\"\r\n [selected]=\"activeInput === input['name']\"\r\n [class.chip-linked]=\"isLinked(input) && activeInput !== input['name']\"\r\n (click)=\"activeInput === input['name'] ? activeInput = '' : activeInput = input['name']\">\r\n {{ input['name'] }}\r\n <mat-icon (click)=\"activeInput === input['name'] ? activeInput = '' : activeInput = input['name']\" matChipRemove>\r\n {{ isLinked(input) ? 'link' : 'link_off' }}\r\n </mat-icon>\r\n </mat-chip-option>\r\n </mat-chip-listbox>\r\n\r\n @if (!!activeInput && activeInput !== '') {\r\n <div class=\"edit-panel\">\r\n <ng-container *ngTemplateOutlet=\"MinInputEdit\"></ng-container>\r\n </div>\r\n }\r\n </mat-card-content>\r\n</mat-card>\r\n\r\n<ng-template #MinInputEdit>\r\n <div class=\"edit-form\">\r\n <mat-form-field class=\"form-field\" appearance=\"outline\" subscriptSizing=\"dynamic\">\r\n <mat-label>Input handling method</mat-label>\r\n <mat-select (selectionChange)=\"minInputValueType($event.value)\" [value]=\"minInputInEdit.type\">\r\n <mat-option [value]=\"minInputTypes.Default\">Default value</mat-option>\r\n <mat-option [value]=\"minInputTypes.MapTo\">Map to a form input</mat-option>\r\n <mat-option [value]=\"minInputTypes.MapDocFilter\">Filter by an input value</mat-option>\r\n </mat-select>\r\n <mat-hint>Select how this required input should be processed</mat-hint>\r\n </mat-form-field>\r\n\r\n <mat-form-field\r\n *ngIf=\"minInputInEdit?.type === 'default'\"\r\n class=\"form-field\"\r\n appearance=\"outline\"\r\n subscriptSizing=\"dynamic\">\r\n <mat-label>Enter default value</mat-label>\r\n <input matInput [(ngModel)]=\"minInputInEdit.defaultValue\" placeholder=\"enter default\">\r\n <mat-hint>Enter a default value for this input</mat-hint>\r\n </mat-form-field>\r\n\r\n <mat-nav-list\r\n *ngIf=\"minInputInEdit?.type === 'mapto' || minInputInEdit?.type === 'mapDocFilter'\"\r\n [disabled]=\"disabled\"\r\n class=\"link-list\">\r\n <h5 mat-subheader class=\"list-subheader\">\r\n Select a form input to link the required input \u2014 {{ activeInput }} to\r\n </h5>\r\n\r\n @if (!!activatedInputs) {\r\n <mat-list-item\r\n [activated]=\"activatedInputs.activated\"\r\n [disabled]=\"inputIsDisabled(activatedInputs)\"\r\n (click)=\"mapTo(activatedInputs); $event.stopPropagation()\">\r\n <img\r\n matListItemAvatar\r\n class=\"list-avatar\"\r\n [src]=\"getInputIllustration(activatedInputs)\"\r\n [alt]=\"activatedInputs.label\">\r\n <div matListItemTitle>{{ activatedInputs[\"label\"] }}</div>\r\n <span matListItemMeta>\r\n <mat-icon color=\"primary\">check_circle</mat-icon>\r\n </span>\r\n </mat-list-item>\r\n } @else {\r\n @for (input of formInputsToMapTo; track input.id) {\r\n <mat-list-item\r\n [disabled]=\"inputIsDisabled(input)\"\r\n (click)=\"mapTo(input); $event.stopPropagation()\">\r\n <img\r\n matListItemAvatar\r\n class=\"list-avatar\"\r\n [src]=\"getInputIllustration(input)\"\r\n [alt]=\"input.label\">\r\n <div matListItemTitle>{{ input[\"label\"] }}</div>\r\n <div matListItemLine class=\"list-line\">{{ input[\"formControlName\"] }}</div>\r\n <span matListItemMeta>\r\n <mat-icon>radio_button_unchecked</mat-icon>\r\n </span>\r\n </mat-list-item>\r\n @if (!$last) {\r\n <mat-divider></mat-divider>\r\n }\r\n }\r\n }\r\n\r\n @if (formInputs.length === 0) {\r\n <div class=\"empty-state\">\r\n <mat-icon class=\"empty-state-icon\">add_link</mat-icon>\r\n <span>Add inputs to get started</span>\r\n </div>\r\n }\r\n </mat-nav-list>\r\n\r\n <div class=\"edit-actions\">\r\n <button mat-button (click)=\"activeInput = ''\">Cancel</button>\r\n @if (minInputInEdit.type === 'default') {\r\n <button mat-flat-button color=\"primary\" (click)=\"save()\">Save</button>\r\n }\r\n </div>\r\n </div>\r\n</ng-template>\r\n", styles: ["@charset \"UTF-8\";.required-inputs-card{background:var(--mat-sys-surface-container, var(--mat-sys-surface));border-radius:12px;box-shadow:0 2px 8px #00000014;border:1px solid color-mix(in srgb,var(--mat-sys-outline, #79747e) 15%,transparent);overflow:hidden}.card-header{display:flex;align-items:flex-start;gap:1rem;padding:1rem 1.25rem;background:color-mix(in srgb,var(--mat-sys-primary, #6750a4) 4%,transparent);border-bottom:1px solid color-mix(in srgb,var(--mat-sys-outline, #79747e) 10%,transparent)}.header-icon{width:2.75rem;height:2.75rem;border-radius:8px;background:color-mix(in srgb,var(--mat-sys-primary, #6750a4) 12%,transparent);display:flex;align-items:center;justify-content:center;flex-shrink:0}.header-icon mat-icon{font-size:1.5rem;width:1.5rem;height:1.5rem;color:var(--mat-sys-primary, #6750a4)}.header-text{flex:1;min-width:0}.header-title{font-size:1.25rem;font-weight:600;letter-spacing:-.01em;color:var(--mat-sys-on-surface, #1c1b1f);margin:0;line-height:1.3}.header-subtitle{font-size:.875rem;color:var(--mat-sys-on-surface-variant, #49454f);line-height:1.4;margin-top:.25rem;margin-bottom:0}.card-body{padding:1.25rem;display:flex;flex-direction:column;gap:1rem}.info-block{display:inline-flex;align-items:center;gap:.5rem;padding:.5rem .75rem;background:var(--mat-sys-surface-container-highest, #e8e0ec);border-radius:8px;font-size:.8125rem;color:var(--mat-sys-on-surface-variant, #49454f)}.info-block .info-icon{font-size:1rem;width:1rem;height:1rem;opacity:.8}.chip-listbox{display:flex;flex-wrap:wrap;gap:.5rem}.chip-linked{background:color-mix(in srgb,var(--mat-sys-primary, #6750a4) 14%,transparent)!important}.edit-panel{margin-top:.5rem;transition:opacity .15s ease}.edit-form{display:flex;flex-direction:column;gap:1rem}.form-field{width:100%;margin-bottom:0}.link-list{margin-top:.5rem}.list-subheader{font-size:.75rem;font-weight:500;text-transform:uppercase;letter-spacing:.04em;color:var(--mat-sys-on-surface-variant, #49454f);margin:0 0 1rem;padding-left:.25rem}.list-avatar{margin-left:.5rem;background:var(--mat-sys-surface-container-high, var(--mat-sys-surface-container))}.list-line{font-size:.8125em;opacity:.6}.empty-state{display:flex;align-items:center;gap:.5rem;padding:.75rem;background:var(--mat-sys-surface-container-highest, #e8e0ec);border-radius:8px;font-size:.875rem;color:var(--mat-sys-on-surface-variant, #49454f);margin:0}.empty-state-icon{font-size:1.25rem;width:1.25rem;height:1.25rem;opacity:.8}.edit-actions{display:flex;justify-content:flex-end;gap:.75rem;padding-top:1rem;margin-top:.5rem}@media(prefers-color-scheme:dark){.required-inputs-card{box-shadow:0 1px 3px #0000004d}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: MatModulesModule }, { kind: "component", type: i2$1.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i2$2.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: i3.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i3.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: i4.MatChipListbox, selector: "mat-chip-listbox", inputs: ["multiple", "aria-orientation", "selectable", "compareWith", "required", "hideSingleSelectionIndicator", "value"], outputs: ["change"] }, { kind: "component", type: i4.MatChipOption, selector: "mat-basic-chip-option, [mat-basic-chip-option], mat-chip-option, [mat-chip-option]", inputs: ["selectable", "selected"], outputs: ["selectionChange"] }, { kind: "directive", type: i4.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i4$1.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "component", type: i3$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i7.MatNavList, selector: "mat-nav-list", exportAs: ["matNavList"] }, { kind: "component", type: i7.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["activated"], exportAs: ["matListItem"] }, { kind: "directive", type: i7.MatListItemAvatar, selector: "[matListItemAvatar]" }, { kind: "directive", type: i7.MatListSubheaderCssMatStyler, selector: "[mat-subheader], [matSubheader]" }, { kind: "directive", type: i7.MatListItemLine, selector: "[matListItemLine]" }, { kind: "directive", type: i7.MatListItemTitle, selector: "[matListItemTitle]" }, { kind: "directive", type: i7.MatListItemMeta, selector: "[matListItemMeta]" }, { kind: "component", type: i3$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3$2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "component", type: i3$2.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "directive", type: i13.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
|
167
|
-
}
|
|
168
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: RequiredInputsComponent, decorators: [{
|
|
169
|
-
type: Component,
|
|
170
|
-
args: [{ selector: 'app-required-inputs', standalone: true, imports: [CommonModule, MatModulesModule, FormsModule], providers: [{ provide: MatFormFieldControl, useExisting: RequiredInputsComponent }], template: "<mat-card class=\"required-inputs-card\">\r\n <div class=\"card-header\">\r\n <div class=\"header-icon\" aria-hidden=\"true\">\r\n <mat-icon>link</mat-icon>\r\n </div>\r\n <div class=\"header-text\">\r\n <h2 class=\"header-title\">Required Inputs</h2>\r\n <p class=\"header-subtitle\">Link or set default values for all required inputs.</p>\r\n </div>\r\n </div>\r\n\r\n <mat-card-content class=\"card-body\">\r\n <div class=\"info-block\">\r\n <mat-icon class=\"info-icon\" color=\"primary\">info</mat-icon>\r\n <span>Ensure all required inputs are linked or have a default value.</span>\r\n </div>\r\n\r\n <mat-chip-listbox aria-label=\"Required inputs - select one to configure\" class=\"chip-listbox\">\r\n <mat-chip-option\r\n *ngFor=\"let input of value\"\r\n [disabled]=\"disabled\"\r\n [selected]=\"activeInput === input['name']\"\r\n [class.chip-linked]=\"isLinked(input) && activeInput !== input['name']\"\r\n (click)=\"activeInput === input['name'] ? activeInput = '' : activeInput = input['name']\">\r\n {{ input['name'] }}\r\n <mat-icon (click)=\"activeInput === input['name'] ? activeInput = '' : activeInput = input['name']\" matChipRemove>\r\n {{ isLinked(input) ? 'link' : 'link_off' }}\r\n </mat-icon>\r\n </mat-chip-option>\r\n </mat-chip-listbox>\r\n\r\n @if (!!activeInput && activeInput !== '') {\r\n <div class=\"edit-panel\">\r\n <ng-container *ngTemplateOutlet=\"MinInputEdit\"></ng-container>\r\n </div>\r\n }\r\n </mat-card-content>\r\n</mat-card>\r\n\r\n<ng-template #MinInputEdit>\r\n <div class=\"edit-form\">\r\n <mat-form-field class=\"form-field\" appearance=\"outline\" subscriptSizing=\"dynamic\">\r\n <mat-label>Input handling method</mat-label>\r\n <mat-select (selectionChange)=\"minInputValueType($event.value)\" [value]=\"minInputInEdit.type\">\r\n <mat-option [value]=\"minInputTypes.Default\">Default value</mat-option>\r\n <mat-option [value]=\"minInputTypes.MapTo\">Map to a form input</mat-option>\r\n <mat-option [value]=\"minInputTypes.MapDocFilter\">Filter by an input value</mat-option>\r\n </mat-select>\r\n <mat-hint>Select how this required input should be processed</mat-hint>\r\n </mat-form-field>\r\n\r\n <mat-form-field\r\n *ngIf=\"minInputInEdit?.type === 'default'\"\r\n class=\"form-field\"\r\n appearance=\"outline\"\r\n subscriptSizing=\"dynamic\">\r\n <mat-label>Enter default value</mat-label>\r\n <input matInput [(ngModel)]=\"minInputInEdit.defaultValue\" placeholder=\"enter default\">\r\n <mat-hint>Enter a default value for this input</mat-hint>\r\n </mat-form-field>\r\n\r\n <mat-nav-list\r\n *ngIf=\"minInputInEdit?.type === 'mapto' || minInputInEdit?.type === 'mapDocFilter'\"\r\n [disabled]=\"disabled\"\r\n class=\"link-list\">\r\n <h5 mat-subheader class=\"list-subheader\">\r\n Select a form input to link the required input \u2014 {{ activeInput }} to\r\n </h5>\r\n\r\n @if (!!activatedInputs) {\r\n <mat-list-item\r\n [activated]=\"activatedInputs.activated\"\r\n [disabled]=\"inputIsDisabled(activatedInputs)\"\r\n (click)=\"mapTo(activatedInputs); $event.stopPropagation()\">\r\n <img\r\n matListItemAvatar\r\n class=\"list-avatar\"\r\n [src]=\"getInputIllustration(activatedInputs)\"\r\n [alt]=\"activatedInputs.label\">\r\n <div matListItemTitle>{{ activatedInputs[\"label\"] }}</div>\r\n <span matListItemMeta>\r\n <mat-icon color=\"primary\">check_circle</mat-icon>\r\n </span>\r\n </mat-list-item>\r\n } @else {\r\n @for (input of formInputsToMapTo; track input.id) {\r\n <mat-list-item\r\n [disabled]=\"inputIsDisabled(input)\"\r\n (click)=\"mapTo(input); $event.stopPropagation()\">\r\n <img\r\n matListItemAvatar\r\n class=\"list-avatar\"\r\n [src]=\"getInputIllustration(input)\"\r\n [alt]=\"input.label\">\r\n <div matListItemTitle>{{ input[\"label\"] }}</div>\r\n <div matListItemLine class=\"list-line\">{{ input[\"formControlName\"] }}</div>\r\n <span matListItemMeta>\r\n <mat-icon>radio_button_unchecked</mat-icon>\r\n </span>\r\n </mat-list-item>\r\n @if (!$last) {\r\n <mat-divider></mat-divider>\r\n }\r\n }\r\n }\r\n\r\n @if (formInputs.length === 0) {\r\n <div class=\"empty-state\">\r\n <mat-icon class=\"empty-state-icon\">add_link</mat-icon>\r\n <span>Add inputs to get started</span>\r\n </div>\r\n }\r\n </mat-nav-list>\r\n\r\n <div class=\"edit-actions\">\r\n <button mat-button (click)=\"activeInput = ''\">Cancel</button>\r\n @if (minInputInEdit.type === 'default') {\r\n <button mat-flat-button color=\"primary\" (click)=\"save()\">Save</button>\r\n }\r\n </div>\r\n </div>\r\n</ng-template>\r\n", styles: ["@charset \"UTF-8\";.required-inputs-card{background:var(--mat-sys-surface-container, var(--mat-sys-surface));border-radius:12px;box-shadow:0 2px 8px #00000014;border:1px solid color-mix(in srgb,var(--mat-sys-outline, #79747e) 15%,transparent);overflow:hidden}.card-header{display:flex;align-items:flex-start;gap:1rem;padding:1rem 1.25rem;background:color-mix(in srgb,var(--mat-sys-primary, #6750a4) 4%,transparent);border-bottom:1px solid color-mix(in srgb,var(--mat-sys-outline, #79747e) 10%,transparent)}.header-icon{width:2.75rem;height:2.75rem;border-radius:8px;background:color-mix(in srgb,var(--mat-sys-primary, #6750a4) 12%,transparent);display:flex;align-items:center;justify-content:center;flex-shrink:0}.header-icon mat-icon{font-size:1.5rem;width:1.5rem;height:1.5rem;color:var(--mat-sys-primary, #6750a4)}.header-text{flex:1;min-width:0}.header-title{font-size:1.25rem;font-weight:600;letter-spacing:-.01em;color:var(--mat-sys-on-surface, #1c1b1f);margin:0;line-height:1.3}.header-subtitle{font-size:.875rem;color:var(--mat-sys-on-surface-variant, #49454f);line-height:1.4;margin-top:.25rem;margin-bottom:0}.card-body{padding:1.25rem;display:flex;flex-direction:column;gap:1rem}.info-block{display:inline-flex;align-items:center;gap:.5rem;padding:.5rem .75rem;background:var(--mat-sys-surface-container-highest, #e8e0ec);border-radius:8px;font-size:.8125rem;color:var(--mat-sys-on-surface-variant, #49454f)}.info-block .info-icon{font-size:1rem;width:1rem;height:1rem;opacity:.8}.chip-listbox{display:flex;flex-wrap:wrap;gap:.5rem}.chip-linked{background:color-mix(in srgb,var(--mat-sys-primary, #6750a4) 14%,transparent)!important}.edit-panel{margin-top:.5rem;transition:opacity .15s ease}.edit-form{display:flex;flex-direction:column;gap:1rem}.form-field{width:100%;margin-bottom:0}.link-list{margin-top:.5rem}.list-subheader{font-size:.75rem;font-weight:500;text-transform:uppercase;letter-spacing:.04em;color:var(--mat-sys-on-surface-variant, #49454f);margin:0 0 1rem;padding-left:.25rem}.list-avatar{margin-left:.5rem;background:var(--mat-sys-surface-container-high, var(--mat-sys-surface-container))}.list-line{font-size:.8125em;opacity:.6}.empty-state{display:flex;align-items:center;gap:.5rem;padding:.75rem;background:var(--mat-sys-surface-container-highest, #e8e0ec);border-radius:8px;font-size:.875rem;color:var(--mat-sys-on-surface-variant, #49454f);margin:0}.empty-state-icon{font-size:1.25rem;width:1.25rem;height:1.25rem;opacity:.8}.edit-actions{display:flex;justify-content:flex-end;gap:.75rem;padding-top:1rem;margin-top:.5rem}@media(prefers-color-scheme:dark){.required-inputs-card{box-shadow:0 1px 3px #0000004d}}\n"] }]
|
|
171
|
-
}], ctorParameters: () => [{ type: i1.NgControl, decorators: [{
|
|
172
|
-
type: Optional
|
|
173
|
-
}, {
|
|
174
|
-
type: Self
|
|
175
|
-
}] }, { type: i0.ElementRef }], propDecorators: { id: [{
|
|
176
|
-
type: HostBinding
|
|
177
|
-
}], disabled: [{
|
|
178
|
-
type: Input
|
|
179
|
-
}], errors: [{
|
|
180
|
-
type: Input
|
|
181
|
-
}], value: [{
|
|
182
|
-
type: Input
|
|
183
|
-
}], formInputs: [{
|
|
184
|
-
type: Input
|
|
185
|
-
}], valueChanged: [{
|
|
186
|
-
type: Output
|
|
187
|
-
}] } });
|
|
188
|
-
|
|
189
|
-
export { RequiredInputsComponent };
|
|
190
|
-
//# sourceMappingURL=ngx-t-forms-required-inputs.component-CLyq9dIR.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-t-forms-required-inputs.component-CLyq9dIR.mjs","sources":["../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/required-inputs/required-inputs.component.ts","../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/required-inputs/required-inputs.component.html"],"sourcesContent":["import { CommonModule } from '@angular/common';\r\nimport { Component, ElementRef, EventEmitter, HostBinding, Input, Optional, Output, Self } from '@angular/core';\r\n\r\n\r\nimport { FormsModule, NgControl } from '@angular/forms';\r\n\r\nimport { MatModulesModule } from '../../../../shared/modules/mat-modules.module';\r\nimport { MinimumInputRequiredInterface, MinInputMapInput, MinInputTypes } from 'ngx-t-forms-types';\r\nimport { FormColumnInputs } from 'ngx-t-forms-types';\r\nimport { getInputIllustration } from '../../../../shared/functions/getInputIllustration';\r\nimport { MatFormFieldControl } from '@angular/material/form-field';\r\nimport { Subject } from 'rxjs';\r\nimport { IConfigElementError } from '../../t-dynamic-data-edit.component';\r\ninterface MapToInputs extends FormColumnInputs {\r\n illustration: string\r\n activated: boolean\r\n}\r\n@Component({\r\n selector: 'app-required-inputs',\r\n standalone: true,\r\n imports: [CommonModule, MatModulesModule, FormsModule],\r\n templateUrl: './required-inputs.component.html',\r\n styleUrl: './required-inputs.component.scss',\r\n providers: [{ provide: MatFormFieldControl, useExisting:RequiredInputsComponent }],\r\n})\r\nexport class RequiredInputsComponent implements MatFormFieldControl<MinimumInputRequiredInterface[]> {\r\n\r\n\r\n\r\n static nextId = 0;\r\n stateChanges = new Subject<void>();\r\n\r\n @HostBinding() id = `app-required-inputs-${RequiredInputsComponent .nextId++}`;\r\n \r\n placeholder: string = ''\r\n constructor(@Optional() @Self() public ngControl: NgControl, private _elementRef: ElementRef<HTMLElement>,) { }\r\n focused: boolean = false;\r\n get empty() {\r\n return !this.value\r\n }\r\n get shouldLabelFloat() {\r\n return this.focused || !this.empty;\r\n }\r\n required: boolean = false;\r\n @Input() disabled: boolean = false;\r\n @Input() errors:IConfigElementError[] |undefined = [];\r\nget errorState(): boolean {\r\n const hasError = !!this.ngControl?.control?.errors || (this.errors||[]).length > 0 && this.touched\r\n return !this.value && !!this.required || hasError\r\n }\r\n\r\n controlType?: string | undefined;\r\n autofilled?: boolean | undefined;\r\n userAriaDescribedBy?: string | undefined;\r\n disableAutomaticLabeling?: boolean | undefined;\r\n setDescribedByIds(ids: string[]) {\r\n // Ensure the component view is initialized\r\n if (this._elementRef && this._elementRef.nativeElement) {\r\n const controlElement = this._elementRef.nativeElement.querySelector('.app-required-inputs');\r\n // Check if the controlElement exists before attempting to set its attribute\r\n if (controlElement) {\r\n controlElement.setAttribute('aria-describedby', ids.join(' '));\r\n }\r\n }\r\n }\r\n onContainerClick(event: MouseEvent): void {\r\n this.markAsTouched();\r\n this.stateChanges.next();\r\n }\r\n\r\n touched: boolean = false;\r\n onTouched = () => {};\r\n markAsTouched() {\r\n if (!this.touched) {\r\n this.onTouched();\r\n this.touched = true;\r\n }\r\n } \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n private _value: Array<MinimumInputRequiredInterface> = []\r\n @Input() set value(v: Array<MinimumInputRequiredInterface>) {\r\n const changed = JSON.stringify(this._value) !== JSON.stringify(v)\r\n if (changed) {\r\n this._value = v\r\n }\r\n\r\n }\r\n get value() {\r\n return this._value\r\n }\r\n @Input() formInputs: FormColumnInputs[] = []\r\n @Output() valueChanged = new EventEmitter<any>();\r\n public activeInput: string = '';\r\n\r\n\r\n minInputTypes = MinInputTypes\r\n\r\n minInputValueType(type: MinInputTypes) {\r\n\r\n if (type === \"mapDocFilter\" && !!this.minInputInEdit) {\r\n ((this.minInputInEdit as any).mapTo as MinInputMapInput[]) = []\r\n\r\n }\r\n if (this.minInputInEdit?.type === type) {\r\n this.minInputInEdit.type = undefined;\r\n } else if (this.minInputInEdit) {\r\n this.minInputInEdit.type = type\r\n }\r\n\r\n this.valueChanged.emit(this.value)\r\n\r\n }\r\n get minInputInEdit(): MinimumInputRequiredInterface {\r\n return this.value?.find((v) => v.name === this.activeInput) || {} as MinimumInputRequiredInterface;\r\n }\r\n set minInputInEdit(v: MinimumInputRequiredInterface) {\r\n this.value = this.value.map((val) => {\r\n if (val.name === this.activeInput) {\r\n return v\r\n }\r\n return val\r\n })\r\n }\r\n save() {\r\n this.valueChanged.emit(this.value);\r\n this.activeInput = '';\r\n }\r\n inputIsDisabled(input: FormColumnInputs): boolean {\r\n return input['element'] === 'sectionTitle'\r\n\r\n\r\n\r\n }\r\n mapTo(input: FormColumnInputs) {\r\n\r\n const inp = this.minInputInEdit;\r\n const mapToThis: MinInputMapInput = {\r\n formControlName: input.formControlName,\r\n dataType: input.dataType,\r\n element: input.element,\r\n inputId: input.id\r\n }\r\n\r\n if (!!inp && this.minInputInEdit?.type === MinInputTypes.MapTo) {\r\n (inp.mapTo as MinInputMapInput)?.formControlName === mapToThis.formControlName\r\n ? (inp.mapTo = undefined)\r\n : (inp.mapTo = mapToThis);\r\n }\r\n\r\n if (!!inp && this.minInputInEdit?.type === 'mapDocFilter') {\r\n if (this.inputMappedTo(mapToThis.formControlName)) {\r\n (inp.mapTo as MinInputMapInput[]).splice((inp.mapTo as MinInputMapInput[]).indexOf(mapToThis), 1)\r\n } else if (typeof inp.mapTo === \"string\" || !inp.mapTo || !!(inp.mapTo as MinInputMapInput[]).find(inp => typeof inp === \"string\")) {\r\n inp.mapTo = [mapToThis]\r\n } else {\r\n (inp.mapTo as MinInputMapInput[]).push(mapToThis)\r\n }\r\n }\r\n this.valueChanged.emit(this.value);\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n }\r\n isLinked(input: MinimumInputRequiredInterface): boolean {\r\n return (\r\n (input.type === 'mapDocFilter' && !!input.mapTo) ||\r\n (input.type === 'default' && !!input.defaultValue) ||\r\n (input.type === 'mapto' && !!input.mapTo)\r\n );\r\n }\r\n\r\n inputMappedTo(formControlName: string): boolean {\r\n if (this.minInputInEdit?.type === 'mapto') {\r\n return (this.minInputInEdit?.mapTo as MinInputMapInput)?.formControlName === formControlName\r\n }\r\n if (this.minInputInEdit?.type === 'mapDocFilter') {\r\n return !!(this.minInputInEdit?.mapTo as MinInputMapInput[])?.find(m => m.formControlName === formControlName)\r\n }\r\n return false\r\n }\r\n\r\n getInputIllustration(input: FormColumnInputs) {\r\n return getInputIllustration(input.element)\r\n }\r\n get formInputsToMapTo(): MapToInputs[] {\r\n return this.formInputs.filter((input) => !this.inputIsDisabled(input)).map((input) => {\r\n return {\r\n ...input,\r\n illustration: this.getInputIllustration(input),\r\n activated: this.inputMappedTo(input.formControlName)\r\n }\r\n })\r\n\r\n }\r\n get activatedInputs() {\r\n return this.formInputsToMapTo.find((input) => input.activated)\r\n }\r\n\r\n}\r\n","<mat-card class=\"required-inputs-card\">\r\n <div class=\"card-header\">\r\n <div class=\"header-icon\" aria-hidden=\"true\">\r\n <mat-icon>link</mat-icon>\r\n </div>\r\n <div class=\"header-text\">\r\n <h2 class=\"header-title\">Required Inputs</h2>\r\n <p class=\"header-subtitle\">Link or set default values for all required inputs.</p>\r\n </div>\r\n </div>\r\n\r\n <mat-card-content class=\"card-body\">\r\n <div class=\"info-block\">\r\n <mat-icon class=\"info-icon\" color=\"primary\">info</mat-icon>\r\n <span>Ensure all required inputs are linked or have a default value.</span>\r\n </div>\r\n\r\n <mat-chip-listbox aria-label=\"Required inputs - select one to configure\" class=\"chip-listbox\">\r\n <mat-chip-option\r\n *ngFor=\"let input of value\"\r\n [disabled]=\"disabled\"\r\n [selected]=\"activeInput === input['name']\"\r\n [class.chip-linked]=\"isLinked(input) && activeInput !== input['name']\"\r\n (click)=\"activeInput === input['name'] ? activeInput = '' : activeInput = input['name']\">\r\n {{ input['name'] }}\r\n <mat-icon (click)=\"activeInput === input['name'] ? activeInput = '' : activeInput = input['name']\" matChipRemove>\r\n {{ isLinked(input) ? 'link' : 'link_off' }}\r\n </mat-icon>\r\n </mat-chip-option>\r\n </mat-chip-listbox>\r\n\r\n @if (!!activeInput && activeInput !== '') {\r\n <div class=\"edit-panel\">\r\n <ng-container *ngTemplateOutlet=\"MinInputEdit\"></ng-container>\r\n </div>\r\n }\r\n </mat-card-content>\r\n</mat-card>\r\n\r\n<ng-template #MinInputEdit>\r\n <div class=\"edit-form\">\r\n <mat-form-field class=\"form-field\" appearance=\"outline\" subscriptSizing=\"dynamic\">\r\n <mat-label>Input handling method</mat-label>\r\n <mat-select (selectionChange)=\"minInputValueType($event.value)\" [value]=\"minInputInEdit.type\">\r\n <mat-option [value]=\"minInputTypes.Default\">Default value</mat-option>\r\n <mat-option [value]=\"minInputTypes.MapTo\">Map to a form input</mat-option>\r\n <mat-option [value]=\"minInputTypes.MapDocFilter\">Filter by an input value</mat-option>\r\n </mat-select>\r\n <mat-hint>Select how this required input should be processed</mat-hint>\r\n </mat-form-field>\r\n\r\n <mat-form-field\r\n *ngIf=\"minInputInEdit?.type === 'default'\"\r\n class=\"form-field\"\r\n appearance=\"outline\"\r\n subscriptSizing=\"dynamic\">\r\n <mat-label>Enter default value</mat-label>\r\n <input matInput [(ngModel)]=\"minInputInEdit.defaultValue\" placeholder=\"enter default\">\r\n <mat-hint>Enter a default value for this input</mat-hint>\r\n </mat-form-field>\r\n\r\n <mat-nav-list\r\n *ngIf=\"minInputInEdit?.type === 'mapto' || minInputInEdit?.type === 'mapDocFilter'\"\r\n [disabled]=\"disabled\"\r\n class=\"link-list\">\r\n <h5 mat-subheader class=\"list-subheader\">\r\n Select a form input to link the required input — {{ activeInput }} to\r\n </h5>\r\n\r\n @if (!!activatedInputs) {\r\n <mat-list-item\r\n [activated]=\"activatedInputs.activated\"\r\n [disabled]=\"inputIsDisabled(activatedInputs)\"\r\n (click)=\"mapTo(activatedInputs); $event.stopPropagation()\">\r\n <img\r\n matListItemAvatar\r\n class=\"list-avatar\"\r\n [src]=\"getInputIllustration(activatedInputs)\"\r\n [alt]=\"activatedInputs.label\">\r\n <div matListItemTitle>{{ activatedInputs[\"label\"] }}</div>\r\n <span matListItemMeta>\r\n <mat-icon color=\"primary\">check_circle</mat-icon>\r\n </span>\r\n </mat-list-item>\r\n } @else {\r\n @for (input of formInputsToMapTo; track input.id) {\r\n <mat-list-item\r\n [disabled]=\"inputIsDisabled(input)\"\r\n (click)=\"mapTo(input); $event.stopPropagation()\">\r\n <img\r\n matListItemAvatar\r\n class=\"list-avatar\"\r\n [src]=\"getInputIllustration(input)\"\r\n [alt]=\"input.label\">\r\n <div matListItemTitle>{{ input[\"label\"] }}</div>\r\n <div matListItemLine class=\"list-line\">{{ input[\"formControlName\"] }}</div>\r\n <span matListItemMeta>\r\n <mat-icon>radio_button_unchecked</mat-icon>\r\n </span>\r\n </mat-list-item>\r\n @if (!$last) {\r\n <mat-divider></mat-divider>\r\n }\r\n }\r\n }\r\n\r\n @if (formInputs.length === 0) {\r\n <div class=\"empty-state\">\r\n <mat-icon class=\"empty-state-icon\">add_link</mat-icon>\r\n <span>Add inputs to get started</span>\r\n </div>\r\n }\r\n </mat-nav-list>\r\n\r\n <div class=\"edit-actions\">\r\n <button mat-button (click)=\"activeInput = ''\">Cancel</button>\r\n @if (minInputInEdit.type === 'default') {\r\n <button mat-flat-button color=\"primary\" (click)=\"save()\">Save</button>\r\n }\r\n </div>\r\n </div>\r\n</ng-template>\r\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;MAyBa,uBAAuB,CAAA;aAI3B,IAAA,CAAA,MAAM,GAAG,CAAH,CAAK;IAMlB,WAAA,CAAuC,SAAoB,EAAU,WAAoC,EAAA;QAAlE,IAAA,CAAA,SAAS,GAAT,SAAS;QAAqB,IAAA,CAAA,WAAW,GAAX,WAAW;AALhF,QAAA,IAAA,CAAA,YAAY,GAAG,IAA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,EAAE,WAAW,CAAC,aAG1C,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAA,uBAAwB,EAAE,CAAC,EAAA,QAAA,EAAA,olKAAA,EAAA,MAAA,EAAA,CAAA,wlFAAA,CAAA,EAAA;;0BAYtE;;0BAAY;;sBAHxB;;sBAYA;;sBACI;;sBA+CJ;;sBAUA;;sBACA;;;;;"}
|
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { EventEmitter, Input, Output, Component, HostBinding, Optional, Self } from '@angular/core';
|
|
3
|
-
import * as i2 from '@angular/common';
|
|
4
|
-
import { CommonModule } from '@angular/common';
|
|
5
|
-
import * as i1$1 from '@angular/forms';
|
|
6
|
-
import { FormsModule } from '@angular/forms';
|
|
7
|
-
import { h as TreeComponent, i as convertPostmanFolderItemsToTree, M as MatModulesModule } from './ngx-t-forms-ngx-t-forms-DP2koSL5.mjs';
|
|
8
|
-
import * as i1 from '@angular/common/http';
|
|
9
|
-
import { HttpErrorResponse } from '@angular/common/http';
|
|
10
|
-
import { BehaviorSubject, take, tap, catchError, throwError, Subject } from 'rxjs';
|
|
11
|
-
import * as i2$1 from '@angular/material/button';
|
|
12
|
-
import * as i4 from '@angular/material/divider';
|
|
13
|
-
import * as i3 from '@angular/material/icon';
|
|
14
|
-
import * as i7 from '@angular/material/progress-spinner';
|
|
15
|
-
import * as i5 from '@angular/material/toolbar';
|
|
16
|
-
import * as i4$1 from '@angular/material/tooltip';
|
|
17
|
-
import * as i12 from '@angular/material/tree';
|
|
18
|
-
import { DataSources } from 'ngx-t-forms-types';
|
|
19
|
-
import { MatFormFieldControl } from '@angular/material/form-field';
|
|
20
|
-
import * as i10 from '@angular/cdk/overlay';
|
|
21
|
-
import { OverlayModule } from '@angular/cdk/overlay';
|
|
22
|
-
|
|
23
|
-
// Update the filter function signature
|
|
24
|
-
function filterCollectionItems(collections, searchKey) {
|
|
25
|
-
const items = collections.collection.item;
|
|
26
|
-
const searchText = searchKey.trim().toLowerCase();
|
|
27
|
-
if (!searchText) {
|
|
28
|
-
return items;
|
|
29
|
-
}
|
|
30
|
-
return items.filter(collection => {
|
|
31
|
-
return searchInItems(collection.item, searchText);
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
function searchInItems(items, searchText) {
|
|
35
|
-
if (!items)
|
|
36
|
-
return false;
|
|
37
|
-
for (const item of items) {
|
|
38
|
-
// Check if current item matches search
|
|
39
|
-
if (item.name?.toLowerCase().includes(searchText) ||
|
|
40
|
-
item.description?.toLowerCase().includes(searchText)) {
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
// Recursively search in nested items
|
|
44
|
-
if (item.item && searchInItems(item.item, searchText)) {
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function methodColor(method) {
|
|
52
|
-
switch (method) {
|
|
53
|
-
case 'GET':
|
|
54
|
-
return 'green';
|
|
55
|
-
case 'POST':
|
|
56
|
-
return 'chocolate';
|
|
57
|
-
case 'PUT':
|
|
58
|
-
return 'yellow';
|
|
59
|
-
case 'DELETE':
|
|
60
|
-
return 'red';
|
|
61
|
-
default:
|
|
62
|
-
return 'currentColor';
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
class PostmanCollectionsComponent {
|
|
67
|
-
get collection$() {
|
|
68
|
-
return this._collection$.asObservable();
|
|
69
|
-
}
|
|
70
|
-
constructor(httpClient) {
|
|
71
|
-
this.httpClient = httpClient;
|
|
72
|
-
this._collection$ = new BehaviorSubject(undefined);
|
|
73
|
-
this.treeComponent = new TreeComponent();
|
|
74
|
-
this.nodeSelectionChanged = new EventEmitter();
|
|
75
|
-
this._searchKey = '';
|
|
76
|
-
this.loadingEndPoints = [];
|
|
77
|
-
this.loading = false;
|
|
78
|
-
}
|
|
79
|
-
ngOnInit() {
|
|
80
|
-
this.initializePostmanService();
|
|
81
|
-
}
|
|
82
|
-
selectNode(node) {
|
|
83
|
-
this.nodeSelectionChanged.emit(node);
|
|
84
|
-
}
|
|
85
|
-
isValidConfig(config) {
|
|
86
|
-
return Boolean(config?.collectionUrl && config?.collectionKey);
|
|
87
|
-
}
|
|
88
|
-
initializePostmanService() {
|
|
89
|
-
const isValidConfig = this.isValidConfig(this.postmanCollectionConfig);
|
|
90
|
-
if (!isValidConfig) {
|
|
91
|
-
this.error = new HttpErrorResponse({
|
|
92
|
-
error: 'Invalid Postman Collection Config',
|
|
93
|
-
});
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
const { collectionUrl, collectionKey } = this.postmanCollectionConfig;
|
|
97
|
-
const requestOptions = {
|
|
98
|
-
params: {
|
|
99
|
-
apikey: collectionKey,
|
|
100
|
-
clearSystemHeaders: true
|
|
101
|
-
},
|
|
102
|
-
headers: {
|
|
103
|
-
'Content-Type': 'application/json',
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
this.loading = true;
|
|
107
|
-
this.httpClient.get(collectionUrl, requestOptions).pipe(take(1), tap((data) => {
|
|
108
|
-
this._collection$.next(data);
|
|
109
|
-
// To ensure the data can be shown as a tree
|
|
110
|
-
const treeData = convertPostmanFolderItemsToTree(data.collection.item);
|
|
111
|
-
this.treeComponent.assignDataSourceData(treeData);
|
|
112
|
-
this.error = undefined;
|
|
113
|
-
this.loading = false;
|
|
114
|
-
}), catchError((err) => {
|
|
115
|
-
this.loading = false;
|
|
116
|
-
this.error = err;
|
|
117
|
-
return throwError(err);
|
|
118
|
-
})).subscribe();
|
|
119
|
-
}
|
|
120
|
-
methodColor(method) {
|
|
121
|
-
return methodColor(method);
|
|
122
|
-
}
|
|
123
|
-
searchTree(event) {
|
|
124
|
-
const search = event.target.value;
|
|
125
|
-
this.collection$.pipe(take(1), tap((collection) => {
|
|
126
|
-
if (!collection) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
const items = filterCollectionItems(collection, search);
|
|
130
|
-
const treeData = convertPostmanFolderItemsToTree(items);
|
|
131
|
-
this.treeComponent.assignDataSourceData(treeData);
|
|
132
|
-
})).subscribe();
|
|
133
|
-
}
|
|
134
|
-
getNodeLines(level) {
|
|
135
|
-
return Array(level).fill(0).map((_, i) => i + 1);
|
|
136
|
-
}
|
|
137
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: PostmanCollectionsComponent, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
138
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.5", type: PostmanCollectionsComponent, isStandalone: true, selector: "app-postman-collections", inputs: { postmanCollectionConfig: "postmanCollectionConfig", loadingEndPoints: "loadingEndPoints" }, outputs: { nodeSelectionChanged: "nodeSelectionChanged" }, ngImport: i0, template: "\n@if (!!loading ) {\n<div class=\"loadingContainer\">\n <mat-spinner></mat-spinner>\n</div>\n\n}\n@if(!loading){\n <mat-toolbar class=\"search-container\">\n <mat-icon>\n search\n </mat-icon>\n <input type=\"search\" \n placeholder=\"Search api\" \n class=\"search-field\"\n (input)=\"searchTree($event)\"> \n </mat-toolbar>\n <mat-divider ></mat-divider>\n <ng-container *ngIf=\"treeComponent as tree\">\n <mat-tree [dataSource]=\"tree.dataSource\" [treeControl]=\" tree.treeControl\">\n <mat-tree-node *matTreeNodeDef=\"let node\" matTreeNodePadding>\n @if (loadingEndPoints.includes(node.value.id)) {\n <mat-spinner diameter=\"22\" class=\"loading-spinner\" >\n \n </mat-spinner>\n }\n <div class=\"line\" *ngFor=\"let line of getNodeLines(node.level)\" [style.left]=\"line* 40 +8 + 'px'\"></div>\n <button [disabled]=\"!node.value?.request?.body?.raw && node.value.request.method ==='POST' || !node.value?.request?.url?.raw \"\n (click)=\"selectNode(node.value)\" [matTooltip]=\"node.value?.request?.url?.raw || 'Invalid Postman config,missing Endpoint URL'\" class=\"item\" mat-button\n *ngIf=\"node.value?.request\">\n \n <span class=\"node-key method\" [style.color]=\" methodColor(node.value.request.method)\">\n <!-- -->\n\n {{node.value.request.method}}</span>\n <span>\n \n {{ node.key }} \n \n </span>\n </button>\n \n </mat-tree-node>\n \n <mat-tree-node *matTreeNodeDef=\"let node; when: tree.hasChild\" matTreeNodePadding>\n <button style=\"padding: 0px; \n \" mat-icon-button matTreeNodeToggle [attr.aria-label]=\"'Toggle ' + node.key\">\n <mat-icon>\n \n {{tree.treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right' }}\n </mat-icon>\n \n </button>\n \n <mat-icon style=\"color: var(--ion-color-medium)\">\n {{tree.treeControl.isExpanded(node) ? 'folder_open' : 'folder'}}\n\n </mat-icon>\n <span style=\"margin-left: 8px;font-weight:500\">\n \n {{ node.key }}\n </span>\n \n </mat-tree-node>\n </mat-tree>\n \n </ng-container>\n <ng-container *ngIf=\"error\">\n <mat-toolbar>\n <span style=\"color: red ;font-size:14px; line-height: normal;\n text-wrap: auto;\">\n {{error.message}}\n </span>\n </mat-toolbar>\n </ng-container>\n}\n", styles: ["mat-tree-node{min-height:28px!important;height:32px!important}.breadcrumb-container{display:flex;align-items:center;flex-wrap:wrap;padding:8px 0}.breadcrumb-item{display:inline-flex;align-items:center;margin:0;transition:background-color .3s ease}.breadcrumb-separator{margin:0}.breadcrumb-separator .mat-icon{font-size:1em;width:16px;height:16px}.suggestion-container{display:flex;width:100%;gap:14px}.suggestion-column{flex:1;min-width:0}.button-container{display:flex;flex-wrap:wrap}.suggestion-button{--padding-start: 8px;--padding-end: 8px;--padding-top: 2px;--padding-bottom: 4px;height:auto;font-size:.8em;text-transform:capitalize}.suggestion-button ::ng-deep ion-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}h5{margin-bottom:8px;font-size:1em}mat-tree{background:none}.item{text-align:left;display:flex;width:100%;justify-content:left;font-size:small;white-space:nowrap;font-weight:400;overflow:hidden}.method{display:inline-block;width:38px;text-align:right}.line{position:absolute;height:32px;left:48px;background:var(--mat-divider-color, var(--mat-app-outline));width:1px}.loadingContainer{display:flex;justify-content:center;align-items:center;padding:24px;height:100%}.search-field{width:100%;padding:8px;border:1px solid var(--mat-divider-color, var(--mat-app-outline));border-radius:4px;margin-left:14px}.search-container{background:inherit;padding-left:12px;padding-right:12px;height:48px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatModulesModule }, { kind: "component", type: i2$1.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i2$1.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i4.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i7.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: i5.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "directive", type: i4$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i12.MatTreeNodeDef, selector: "[matTreeNodeDef]", inputs: ["matTreeNodeDefWhen", "matTreeNode"] }, { kind: "directive", type: i12.MatTreeNodePadding, selector: "[matTreeNodePadding]", inputs: ["matTreeNodePadding", "matTreeNodePaddingIndent"] }, { kind: "directive", type: i12.MatTreeNodeToggle, selector: "[matTreeNodeToggle]", inputs: ["matTreeNodeToggleRecursive"] }, { kind: "component", type: i12.MatTree, selector: "mat-tree", exportAs: ["matTree"] }, { kind: "directive", type: i12.MatTreeNode, selector: "mat-tree-node", inputs: ["tabIndex", "disabled"], outputs: ["activation", "expandedChange"], exportAs: ["matTreeNode"] }, { kind: "ngmodule", type: FormsModule }] }); }
|
|
139
|
-
}
|
|
140
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: PostmanCollectionsComponent, decorators: [{
|
|
141
|
-
type: Component,
|
|
142
|
-
args: [{ selector: 'app-postman-collections', standalone: true, imports: [CommonModule, MatModulesModule, FormsModule], template: "\n@if (!!loading ) {\n<div class=\"loadingContainer\">\n <mat-spinner></mat-spinner>\n</div>\n\n}\n@if(!loading){\n <mat-toolbar class=\"search-container\">\n <mat-icon>\n search\n </mat-icon>\n <input type=\"search\" \n placeholder=\"Search api\" \n class=\"search-field\"\n (input)=\"searchTree($event)\"> \n </mat-toolbar>\n <mat-divider ></mat-divider>\n <ng-container *ngIf=\"treeComponent as tree\">\n <mat-tree [dataSource]=\"tree.dataSource\" [treeControl]=\" tree.treeControl\">\n <mat-tree-node *matTreeNodeDef=\"let node\" matTreeNodePadding>\n @if (loadingEndPoints.includes(node.value.id)) {\n <mat-spinner diameter=\"22\" class=\"loading-spinner\" >\n \n </mat-spinner>\n }\n <div class=\"line\" *ngFor=\"let line of getNodeLines(node.level)\" [style.left]=\"line* 40 +8 + 'px'\"></div>\n <button [disabled]=\"!node.value?.request?.body?.raw && node.value.request.method ==='POST' || !node.value?.request?.url?.raw \"\n (click)=\"selectNode(node.value)\" [matTooltip]=\"node.value?.request?.url?.raw || 'Invalid Postman config,missing Endpoint URL'\" class=\"item\" mat-button\n *ngIf=\"node.value?.request\">\n \n <span class=\"node-key method\" [style.color]=\" methodColor(node.value.request.method)\">\n <!-- -->\n\n {{node.value.request.method}}</span>\n <span>\n \n {{ node.key }} \n \n </span>\n </button>\n \n </mat-tree-node>\n \n <mat-tree-node *matTreeNodeDef=\"let node; when: tree.hasChild\" matTreeNodePadding>\n <button style=\"padding: 0px; \n \" mat-icon-button matTreeNodeToggle [attr.aria-label]=\"'Toggle ' + node.key\">\n <mat-icon>\n \n {{tree.treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right' }}\n </mat-icon>\n \n </button>\n \n <mat-icon style=\"color: var(--ion-color-medium)\">\n {{tree.treeControl.isExpanded(node) ? 'folder_open' : 'folder'}}\n\n </mat-icon>\n <span style=\"margin-left: 8px;font-weight:500\">\n \n {{ node.key }}\n </span>\n \n </mat-tree-node>\n </mat-tree>\n \n </ng-container>\n <ng-container *ngIf=\"error\">\n <mat-toolbar>\n <span style=\"color: red ;font-size:14px; line-height: normal;\n text-wrap: auto;\">\n {{error.message}}\n </span>\n </mat-toolbar>\n </ng-container>\n}\n", styles: ["mat-tree-node{min-height:28px!important;height:32px!important}.breadcrumb-container{display:flex;align-items:center;flex-wrap:wrap;padding:8px 0}.breadcrumb-item{display:inline-flex;align-items:center;margin:0;transition:background-color .3s ease}.breadcrumb-separator{margin:0}.breadcrumb-separator .mat-icon{font-size:1em;width:16px;height:16px}.suggestion-container{display:flex;width:100%;gap:14px}.suggestion-column{flex:1;min-width:0}.button-container{display:flex;flex-wrap:wrap}.suggestion-button{--padding-start: 8px;--padding-end: 8px;--padding-top: 2px;--padding-bottom: 4px;height:auto;font-size:.8em;text-transform:capitalize}.suggestion-button ::ng-deep ion-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}h5{margin-bottom:8px;font-size:1em}mat-tree{background:none}.item{text-align:left;display:flex;width:100%;justify-content:left;font-size:small;white-space:nowrap;font-weight:400;overflow:hidden}.method{display:inline-block;width:38px;text-align:right}.line{position:absolute;height:32px;left:48px;background:var(--mat-divider-color, var(--mat-app-outline));width:1px}.loadingContainer{display:flex;justify-content:center;align-items:center;padding:24px;height:100%}.search-field{width:100%;padding:8px;border:1px solid var(--mat-divider-color, var(--mat-app-outline));border-radius:4px;margin-left:14px}.search-container{background:inherit;padding-left:12px;padding-right:12px;height:48px}\n"] }]
|
|
143
|
-
}], ctorParameters: () => [{ type: i1.HttpClient }], propDecorators: { nodeSelectionChanged: [{
|
|
144
|
-
type: Output
|
|
145
|
-
}], postmanCollectionConfig: [{
|
|
146
|
-
type: Input
|
|
147
|
-
}], loadingEndPoints: [{
|
|
148
|
-
type: Input
|
|
149
|
-
}] } });
|
|
150
|
-
|
|
151
|
-
class RestApiCallSetupComponent {
|
|
152
|
-
static { this.nextId = 0; }
|
|
153
|
-
constructor(ngControl, _elementRef) {
|
|
154
|
-
this.ngControl = ngControl;
|
|
155
|
-
this._elementRef = _elementRef;
|
|
156
|
-
this.stateChanges = new Subject();
|
|
157
|
-
this.id = `lib-rest-api-call-setup-${RestApiCallSetupComponent.nextId++}`;
|
|
158
|
-
this.placeholder = '';
|
|
159
|
-
this.focused = false;
|
|
160
|
-
this.required = false;
|
|
161
|
-
this.disabled = false;
|
|
162
|
-
this.touched = false;
|
|
163
|
-
this.onTouched = () => { };
|
|
164
|
-
this.httpGetDataFunction = undefined;
|
|
165
|
-
this.errors = [];
|
|
166
|
-
this.valueChanged = new EventEmitter();
|
|
167
|
-
this.loadingEndPoints = [];
|
|
168
|
-
}
|
|
169
|
-
get empty() {
|
|
170
|
-
return !this.value;
|
|
171
|
-
}
|
|
172
|
-
get shouldLabelFloat() {
|
|
173
|
-
return this.focused || !this.empty;
|
|
174
|
-
}
|
|
175
|
-
get errorState() {
|
|
176
|
-
const hasError = !!this.ngControl?.control?.errors || (this.errors || []).length > 0 && this.touched;
|
|
177
|
-
return !this.value && !!this.required || hasError;
|
|
178
|
-
}
|
|
179
|
-
setDescribedByIds(ids) {
|
|
180
|
-
// Ensure the component view is initialized
|
|
181
|
-
if (this._elementRef && this._elementRef.nativeElement) {
|
|
182
|
-
const controlElement = this._elementRef.nativeElement.querySelector('.lib-rest-api-call-setup');
|
|
183
|
-
// Check if the controlElement exists before attempting to set its attribute
|
|
184
|
-
if (controlElement) {
|
|
185
|
-
controlElement.setAttribute('aria-describedby', ids.join(' '));
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
onContainerClick(event) {
|
|
190
|
-
this.markAsTouched();
|
|
191
|
-
this.stateChanges.next();
|
|
192
|
-
}
|
|
193
|
-
markAsTouched() {
|
|
194
|
-
if (!this.touched) {
|
|
195
|
-
this.onTouched();
|
|
196
|
-
this.touched = true;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
set value(val) {
|
|
200
|
-
if (JSON.stringify(val) !== JSON.stringify(this._value)) {
|
|
201
|
-
this._value = val;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
get value() {
|
|
205
|
-
return this._value;
|
|
206
|
-
}
|
|
207
|
-
async nodeSelectionChanged(node) {
|
|
208
|
-
const { id, name, request, response } = node;
|
|
209
|
-
if (!request || !response)
|
|
210
|
-
return;
|
|
211
|
-
let requestBody;
|
|
212
|
-
try {
|
|
213
|
-
requestBody = JSON.parse(request?.body?.raw || '{}');
|
|
214
|
-
}
|
|
215
|
-
catch {
|
|
216
|
-
requestBody = {};
|
|
217
|
-
}
|
|
218
|
-
const keyExtraction = (key, value, primaryKey) => {
|
|
219
|
-
return ({
|
|
220
|
-
name: key,
|
|
221
|
-
type: typeof value,
|
|
222
|
-
primaryKey
|
|
223
|
-
});
|
|
224
|
-
};
|
|
225
|
-
// if(request.method === 'GET'){
|
|
226
|
-
// this.loadingEndPoints.push(id)
|
|
227
|
-
// try {
|
|
228
|
-
// responseBody = await this.httpGetDataFunction?.(request.url.raw)
|
|
229
|
-
// } catch (error) {
|
|
230
|
-
// console.error(error)
|
|
231
|
-
// this.loadingEndPoints = this.loadingEndPoints.filter((item) => item !== id)
|
|
232
|
-
// }
|
|
233
|
-
// }
|
|
234
|
-
const secondaryKeys = Object.entries(requestBody['data'] || {}).map(([key, value]) => keyExtraction(key, value, false));
|
|
235
|
-
delete requestBody['data'];
|
|
236
|
-
const primaryKeys = Object.entries(requestBody).map(([key, value]) => keyExtraction(key, value, true));
|
|
237
|
-
const minimumInputRequired = request?.method === 'POST' ? [...primaryKeys, ...secondaryKeys] : [];
|
|
238
|
-
const transformedNode = {
|
|
239
|
-
_id: id,
|
|
240
|
-
name: name,
|
|
241
|
-
httpEndPoint: request.url.raw,
|
|
242
|
-
httpMethod: request.method,
|
|
243
|
-
source: DataSources.Api,
|
|
244
|
-
postFormData: request.method === 'POST',
|
|
245
|
-
backEndConfig: {
|
|
246
|
-
minimumInputRequired,
|
|
247
|
-
},
|
|
248
|
-
};
|
|
249
|
-
const fetch = transformedNode;
|
|
250
|
-
this.valueChanged.emit(fetch);
|
|
251
|
-
}
|
|
252
|
-
clearValue() {
|
|
253
|
-
const source = this.value?.source;
|
|
254
|
-
this._value = undefined;
|
|
255
|
-
this.valueChanged.emit(undefined);
|
|
256
|
-
this.valueChanged.emit({ source: source });
|
|
257
|
-
}
|
|
258
|
-
methodColor(method) {
|
|
259
|
-
return methodColor(method || 'POST');
|
|
260
|
-
}
|
|
261
|
-
get hasValidValue() {
|
|
262
|
-
return Boolean(this.value) && Boolean(this.value?.httpEndPoint) && Boolean(this.value?.httpMethod);
|
|
263
|
-
}
|
|
264
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: RestApiCallSetupComponent, deps: [{ token: i1$1.NgControl, optional: true, self: true }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
265
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.5", type: RestApiCallSetupComponent, isStandalone: true, selector: "lib-rest-api-call-setup", inputs: { disabled: "disabled", postmanCollectionConfig: "postmanCollectionConfig", httpGetDataFunction: "httpGetDataFunction", value: "value", errors: "errors" }, outputs: { valueChanged: "valueChanged" }, host: { properties: { "id": "this.id" } }, providers: [{ provide: MatFormFieldControl, useExisting: RestApiCallSetupComponent }], ngImport: i0, template: "\r\n@if(postmanCollectionConfig && !hasValidValue ){\r\n <app-postman-collections \r\n (nodeSelectionChanged)=\"nodeSelectionChanged($event)\"\r\n [loadingEndPoints]=\"loadingEndPoints\"\r\n [postmanCollectionConfig]=\"postmanCollectionConfig\" >\r\n \r\n </app-postman-collections>\r\n}\r\n\r\n@if(!!hasValidValue && !!postmanCollectionConfig){\r\n<mat-toolbar>\r\n \r\n <button \r\n (click)=\"clearValue()\" [matTooltip]=\"value?.httpEndPoint\" class=\"item\" mat-button\r\n >\r\n\r\n <span class=\"node-key method\" [style.color]=\" methodColor(value?.httpMethod)\">\r\n {{value?.httpMethod}}</span>\r\n <span>\r\n {{ value?.name }} \r\n\r\n </span>\r\n </button> \r\n</mat-toolbar>\r\n\r\n}\r\n\r\n@if(!postmanCollectionConfig) {\r\n <mat-toolbar color=\"warn\">\r\n <p style=\"font-size: 0.875em; white-space: normal;\r\n line-height: normal;\">\r\n No postman collection configured. \r\n Add Postman collection Id and Api key\r\n </p>\r\n \r\n </mat-toolbar>\r\n \r\n}\r\n<ng-template\r\n cdkConnectedOverlay\r\n [cdkConnectedOverlayOpen]=\"disabled\"\r\n>\r\n<div style=\"position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5);\">\r\n\r\n\r\n</div>\r\n</ng-template>\r\n", styles: [".item{text-align:left;display:flex;width:100%;justify-content:left;font-size:small;white-space:nowrap;font-weight:400;overflow:hidden}.center{display:flex!important;align-items:center}\n"], dependencies: [{ kind: "component", type: PostmanCollectionsComponent, selector: "app-postman-collections", inputs: ["postmanCollectionConfig", "loadingEndPoints"], outputs: ["nodeSelectionChanged"] }, { kind: "ngmodule", type: MatModulesModule }, { kind: "component", type: i2$1.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: i5.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "directive", type: i4$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i10.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation", "cdkConnectedOverlayUsePopover", "cdkConnectedOverlayMatchWidth", "cdkConnectedOverlay"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: OverlayModule }] }); }
|
|
266
|
-
}
|
|
267
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: RestApiCallSetupComponent, decorators: [{
|
|
268
|
-
type: Component,
|
|
269
|
-
args: [{ selector: 'lib-rest-api-call-setup', standalone: true, imports: [PostmanCollectionsComponent, MatModulesModule, CommonModule, OverlayModule], providers: [{ provide: MatFormFieldControl, useExisting: RestApiCallSetupComponent }], template: "\r\n@if(postmanCollectionConfig && !hasValidValue ){\r\n <app-postman-collections \r\n (nodeSelectionChanged)=\"nodeSelectionChanged($event)\"\r\n [loadingEndPoints]=\"loadingEndPoints\"\r\n [postmanCollectionConfig]=\"postmanCollectionConfig\" >\r\n \r\n </app-postman-collections>\r\n}\r\n\r\n@if(!!hasValidValue && !!postmanCollectionConfig){\r\n<mat-toolbar>\r\n \r\n <button \r\n (click)=\"clearValue()\" [matTooltip]=\"value?.httpEndPoint\" class=\"item\" mat-button\r\n >\r\n\r\n <span class=\"node-key method\" [style.color]=\" methodColor(value?.httpMethod)\">\r\n {{value?.httpMethod}}</span>\r\n <span>\r\n {{ value?.name }} \r\n\r\n </span>\r\n </button> \r\n</mat-toolbar>\r\n\r\n}\r\n\r\n@if(!postmanCollectionConfig) {\r\n <mat-toolbar color=\"warn\">\r\n <p style=\"font-size: 0.875em; white-space: normal;\r\n line-height: normal;\">\r\n No postman collection configured. \r\n Add Postman collection Id and Api key\r\n </p>\r\n \r\n </mat-toolbar>\r\n \r\n}\r\n<ng-template\r\n cdkConnectedOverlay\r\n [cdkConnectedOverlayOpen]=\"disabled\"\r\n>\r\n<div style=\"position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5);\">\r\n\r\n\r\n</div>\r\n</ng-template>\r\n", styles: [".item{text-align:left;display:flex;width:100%;justify-content:left;font-size:small;white-space:nowrap;font-weight:400;overflow:hidden}.center{display:flex!important;align-items:center}\n"] }]
|
|
270
|
-
}], ctorParameters: () => [{ type: i1$1.NgControl, decorators: [{
|
|
271
|
-
type: Optional
|
|
272
|
-
}, {
|
|
273
|
-
type: Self
|
|
274
|
-
}] }, { type: i0.ElementRef }], propDecorators: { id: [{
|
|
275
|
-
type: HostBinding
|
|
276
|
-
}], disabled: [{
|
|
277
|
-
type: Input
|
|
278
|
-
}], postmanCollectionConfig: [{
|
|
279
|
-
type: Input
|
|
280
|
-
}], httpGetDataFunction: [{
|
|
281
|
-
type: Input
|
|
282
|
-
}], value: [{
|
|
283
|
-
type: Input
|
|
284
|
-
}], errors: [{
|
|
285
|
-
type: Input
|
|
286
|
-
}], valueChanged: [{
|
|
287
|
-
type: Output
|
|
288
|
-
}] } });
|
|
289
|
-
|
|
290
|
-
export { RestApiCallSetupComponent };
|
|
291
|
-
//# sourceMappingURL=ngx-t-forms-rest-api-call-setup.component-CWeIUKLz.mjs.map
|