@mtna/web-form-angular 0.0.1
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/_index.scss +25 -0
- package/bundles/mtna-web-form-angular.umd.js +4982 -0
- package/bundles/mtna-web-form-angular.umd.js.map +1 -0
- package/esm2015/lib/core/animations.js +8 -0
- package/esm2015/lib/core/api-config.js +3 -0
- package/esm2015/lib/core/index.js +7 -0
- package/esm2015/lib/core/pipes/coerce-date-item.pipe.js +23 -0
- package/esm2015/lib/core/pipes/coerce-form-group.pipe.js +35 -0
- package/esm2015/lib/core/pipes/date-quarter.pipe.js +43 -0
- package/esm2015/lib/core/pipes/get-auto-complete.pipe.js +42 -0
- package/esm2015/lib/core/pipes/get-available-quarters.pipe.js +29 -0
- package/esm2015/lib/core/pipes/get-form-control-error.pipe.js +20 -0
- package/esm2015/lib/core/pipes/get-list-icon.pipe.js +53 -0
- package/esm2015/lib/core/pipes/get-object-type.pipe.js +17 -0
- package/esm2015/lib/core/pipes/get-selected-option.pipe.js +20 -0
- package/esm2015/lib/core/pipes/index.js +71 -0
- package/esm2015/lib/core/pipes/items-with-value.pipe.js +30 -0
- package/esm2015/lib/core/pipes/sanitize-html.pipe.js +23 -0
- package/esm2015/lib/core/services/api.service.js +67 -0
- package/esm2015/lib/core/services/form-manager.service.js +465 -0
- package/esm2015/lib/core/services/index.js +5 -0
- package/esm2015/lib/core/services/ng-form.service.js +150 -0
- package/esm2015/lib/core/services/ui.service.js +333 -0
- package/esm2015/lib/core/utilities/find-form-control.js +29 -0
- package/esm2015/lib/core/utilities/find-form-item.js +25 -0
- package/esm2015/lib/core/utilities/flatten-steps.js +10 -0
- package/esm2015/lib/core/utilities/generate-form-steps.js +25 -0
- package/esm2015/lib/core/utilities/index.js +9 -0
- package/esm2015/lib/core/utilities/is-form-group.js +6 -0
- package/esm2015/lib/core/utilities/serializer-util.js +358 -0
- package/esm2015/lib/core/utilities/update-step-status.js +38 -0
- package/esm2015/lib/core/validators/index.js +3 -0
- package/esm2015/lib/core/validators/instant-validation-result-error-state-matcher.js +23 -0
- package/esm2015/lib/core/validators/validation-result-validator.js +19 -0
- package/esm2015/lib/file-upload/file-upload.component.js +66 -0
- package/esm2015/lib/file-upload/index.js +2 -0
- package/esm2015/lib/form/base-form-item.model.js +2 -0
- package/esm2015/lib/form/form-disabler.component.js +38 -0
- package/esm2015/lib/form/form-item.directive.js +22 -0
- package/esm2015/lib/form/form.component.js +250 -0
- package/esm2015/lib/form/form.module.js +214 -0
- package/esm2015/lib/form/index.js +5 -0
- package/esm2015/lib/form/white-list.model.js +11 -0
- package/esm2015/lib/form-item-controls/base-form-item-control.directive.js +58 -0
- package/esm2015/lib/form-item-controls/base-parent-item-control.directive.js +42 -0
- package/esm2015/lib/form-item-controls/base-single-selection-parent.directive.js +53 -0
- package/esm2015/lib/form-item-controls/date-range.component.js +84 -0
- package/esm2015/lib/form-item-controls/date.component.js +134 -0
- package/esm2015/lib/form-item-controls/dropdown.component.js +109 -0
- package/esm2015/lib/form-item-controls/index.js +8 -0
- package/esm2015/lib/form-item-controls/input.component.js +149 -0
- package/esm2015/lib/form-item-controls/year-quarter-range.component.js +75 -0
- package/esm2015/lib/form-item-controls/year-quarter.component.js +228 -0
- package/esm2015/lib/form-stepper/form-step-group.component.js +95 -0
- package/esm2015/lib/form-stepper/form-step-group.pipe.js +20 -0
- package/esm2015/lib/form-stepper/form-step.component.js +110 -0
- package/esm2015/lib/form-stepper/form-step.util.js +28 -0
- package/esm2015/lib/form-stepper/form-stepper.component.js +115 -0
- package/esm2015/lib/form-stepper/form-stepper.module.js +53 -0
- package/esm2015/lib/form-stepper/index.js +8 -0
- package/esm2015/lib/form-stepper/models/base-form-step.model.js +6 -0
- package/esm2015/lib/form-stepper/models/form-step-group.model.js +13 -0
- package/esm2015/lib/form-stepper/models/form-step.model.js +12 -0
- package/esm2015/lib/form-stepper/models/index.js +4 -0
- package/esm2015/lib/groups/form-item-dialog-data.model.js +14 -0
- package/esm2015/lib/groups/group-components.js +646 -0
- package/esm2015/lib/groups/index.js +3 -0
- package/esm2015/lib/groups/repeatable-item.component.js +23 -0
- package/esm2015/lib/item-header/index.js +2 -0
- package/esm2015/lib/item-header/item-header.component.js +108 -0
- package/esm2015/lib/static-form-items/index.js +3 -0
- package/esm2015/lib/static-form-items/ordered-list-item.js +50 -0
- package/esm2015/lib/static-form-items/unordered-list-item.js +52 -0
- package/esm2015/lib/step-card/index.js +2 -0
- package/esm2015/lib/step-card/step-card.component.js +53 -0
- package/esm2015/mtna-web-form-angular.js +5 -0
- package/esm2015/public-api.js +10 -0
- package/fesm2015/mtna-web-form-angular.js +4614 -0
- package/fesm2015/mtna-web-form-angular.js.map +1 -0
- package/lib/_index.scss +25 -0
- package/lib/core/_all-color.scss +25 -0
- package/lib/core/_all-theme.scss +28 -0
- package/lib/core/_all-typography.scss +25 -0
- package/lib/core/_core-theme.scss +43 -0
- package/lib/core/animations.d.ts +2 -0
- package/lib/core/api-config.d.ts +5 -0
- package/lib/core/index.d.ts +6 -0
- package/lib/core/pipes/coerce-date-item.pipe.d.ts +11 -0
- package/lib/core/pipes/coerce-form-group.pipe.d.ts +23 -0
- package/lib/core/pipes/date-quarter.pipe.d.ts +7 -0
- package/lib/core/pipes/get-auto-complete.pipe.d.ts +7 -0
- package/lib/core/pipes/get-available-quarters.pipe.d.ts +8 -0
- package/lib/core/pipes/get-form-control-error.pipe.d.ts +14 -0
- package/lib/core/pipes/get-list-icon.pipe.d.ts +7 -0
- package/lib/core/pipes/get-object-type.pipe.d.ts +7 -0
- package/lib/core/pipes/get-selected-option.pipe.d.ts +8 -0
- package/lib/core/pipes/index.d.ts +28 -0
- package/lib/core/pipes/items-with-value.pipe.d.ts +13 -0
- package/lib/core/pipes/sanitize-html.pipe.d.ts +10 -0
- package/lib/core/services/api.service.d.ts +41 -0
- package/lib/core/services/form-manager.service.d.ts +184 -0
- package/lib/core/services/index.d.ts +4 -0
- package/lib/core/services/ng-form.service.d.ts +76 -0
- package/lib/core/services/ui.service.d.ts +123 -0
- package/lib/core/utilities/find-form-control.d.ts +11 -0
- package/lib/core/utilities/find-form-item.d.ts +10 -0
- package/lib/core/utilities/flatten-steps.d.ts +7 -0
- package/lib/core/utilities/generate-form-steps.d.ts +3 -0
- package/lib/core/utilities/index.d.ts +8 -0
- package/lib/core/utilities/is-form-group.d.ts +3 -0
- package/lib/core/utilities/serializer-util.d.ts +81 -0
- package/lib/core/utilities/update-step-status.d.ts +14 -0
- package/lib/core/validators/index.d.ts +2 -0
- package/lib/core/validators/instant-validation-result-error-state-matcher.d.ts +13 -0
- package/lib/core/validators/validation-result-validator.d.ts +12 -0
- package/lib/file-upload/file-upload.component.d.ts +23 -0
- package/lib/file-upload/index.d.ts +1 -0
- package/lib/form/base-form-item.model.d.ts +15 -0
- package/lib/form/form-disabler.component.d.ts +6 -0
- package/lib/form/form-item.directive.d.ts +13 -0
- package/lib/form/form.component.d.ts +89 -0
- package/lib/form/form.module.d.ts +52 -0
- package/lib/form/index.d.ts +4 -0
- package/lib/form/white-list.model.d.ts +6 -0
- package/lib/form-item-controls/_date-item-theme.scss +29 -0
- package/lib/form-item-controls/_form-control-theme.scss +28 -0
- package/lib/form-item-controls/_year-quarter-item-theme.scss +28 -0
- package/lib/form-item-controls/base-form-item-control.directive.d.ts +26 -0
- package/lib/form-item-controls/base-parent-item-control.directive.d.ts +19 -0
- package/lib/form-item-controls/base-single-selection-parent.directive.d.ts +26 -0
- package/lib/form-item-controls/date-range.component.d.ts +12 -0
- package/lib/form-item-controls/date.component.d.ts +24 -0
- package/lib/form-item-controls/dropdown.component.d.ts +9 -0
- package/lib/form-item-controls/index.d.ts +7 -0
- package/lib/form-item-controls/input.component.d.ts +14 -0
- package/lib/form-item-controls/year-quarter-range.component.d.ts +9 -0
- package/lib/form-item-controls/year-quarter.component.d.ts +33 -0
- package/lib/form-stepper/_form-step-group-theme.scss +43 -0
- package/lib/form-stepper/_form-stepper-theme.scss +72 -0
- package/lib/form-stepper/form-step-group.component.d.ts +23 -0
- package/lib/form-stepper/form-step-group.pipe.d.ts +11 -0
- package/lib/form-stepper/form-step.component.d.ts +27 -0
- package/lib/form-stepper/form-step.util.d.ts +27 -0
- package/lib/form-stepper/form-stepper.component.d.ts +35 -0
- package/lib/form-stepper/form-stepper.module.d.ts +18 -0
- package/lib/form-stepper/index.d.ts +7 -0
- package/lib/form-stepper/models/base-form-step.model.d.ts +4 -0
- package/lib/form-stepper/models/form-step-group.model.d.ts +8 -0
- package/lib/form-stepper/models/form-step.model.d.ts +11 -0
- package/lib/form-stepper/models/index.d.ts +3 -0
- package/lib/groups/_checkbox-theme.scss +62 -0
- package/lib/groups/_form-group-theme.scss +32 -0
- package/lib/groups/_multiple-choice-theme.scss +65 -0
- package/lib/groups/_repeatable-item-theme.scss +28 -0
- package/lib/groups/form-item-dialog-data.model.d.ts +13 -0
- package/lib/groups/group-components.d.ts +221 -0
- package/lib/groups/index.d.ts +2 -0
- package/lib/groups/repeatable-item.component.d.ts +5 -0
- package/lib/item-header/_item-header-theme.scss +28 -0
- package/lib/item-header/index.d.ts +1 -0
- package/lib/item-header/item-header.component.d.ts +35 -0
- package/lib/static-form-items/index.d.ts +2 -0
- package/lib/static-form-items/ordered-list-item.d.ts +11 -0
- package/lib/static-form-items/unordered-list-item.d.ts +11 -0
- package/lib/step-card/_step-card-theme.scss +42 -0
- package/lib/step-card/index.d.ts +1 -0
- package/lib/step-card/step-card.component.d.ts +21 -0
- package/mtna-web-form-angular.d.ts +5 -0
- package/package.json +43 -0
- package/public-api.d.ts +9 -0
|
@@ -0,0 +1,4614 @@
|
|
|
1
|
+
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { InjectionToken, Pipe, Injectable, Optional, Inject, NgModule, EventEmitter, Component, Input, Output, Directive, HostBinding, ChangeDetectionStrategy, ViewEncapsulation, ViewChild } from '@angular/core';
|
|
4
|
+
import * as i6 from '@angular/forms';
|
|
5
|
+
import { FormGroup, Validators, FormArray, FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
6
|
+
import { isPresent, isType, isObject, isKey, isNullOrUndefined, toLetters } from '@mtna/core-ts';
|
|
7
|
+
import { isConditionalItem, isOptionItemImpl, isOptionGroupItemImpl, isValueItem, isForm, SHORT_ANSWER_ITEM_ID, PARAGRAPH_ANSWER_ITEM_ID, WHOLE_NUMBER_ANSWER_ITEM_ID, isWholeNumberItem, DECIMAL_ANSWER_ITEM_ID, CHECKBOX_ITEM_ID, isRepeatableItem, isSection, isFormItemGroupImpl, isTableItem, isOffsetDateRangeItem, isYearQuarterRangeItem, isDataCubeItem, MtnaWfFormItemChange, TITLE_ITEM_ID, TEXT_ITEM_ID, SECTION_ID, FORM_ITEM_GROUP_IMPL_ID, DROPDOWN_ITEM_ID } from '@mtna/web-form-ts';
|
|
8
|
+
import { BehaviorSubject, Subject, merge, Subscription } from 'rxjs';
|
|
9
|
+
import * as i1 from '@angular/material/dialog';
|
|
10
|
+
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
11
|
+
import * as i1$1 from '@angular/platform-browser';
|
|
12
|
+
import * as i1$2 from '@angular/common/http';
|
|
13
|
+
import { skipWhile, take, takeUntil, distinctUntilChanged } from 'rxjs/operators';
|
|
14
|
+
import * as i4$2 from '@angular/material/core';
|
|
15
|
+
import { ErrorStateMatcher, mixinColor, MatRippleModule, MatOptionModule } from '@angular/material/core';
|
|
16
|
+
import * as i1$3 from '@mtna/file-manager-angular';
|
|
17
|
+
import { MtnaFileDownloadModule, MtnaFileUploadModule } from '@mtna/file-manager-angular';
|
|
18
|
+
import * as i2 from '@angular/material/button';
|
|
19
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
20
|
+
import * as i18 from '@angular/material/icon';
|
|
21
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
22
|
+
import * as i4 from '@angular/material/progress-spinner';
|
|
23
|
+
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
24
|
+
import * as i3 from '@angular/common';
|
|
25
|
+
import { CommonModule } from '@angular/common';
|
|
26
|
+
import * as i7 from '@mtna/core-angular';
|
|
27
|
+
import { mixinDestroyNotifier, MtnaStatusCircleModule, MtnaHighlightModule, MtnaTrackByPropertyPipeModule } from '@mtna/core-angular';
|
|
28
|
+
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
29
|
+
import * as i32 from '@angular/material/radio';
|
|
30
|
+
import { MatRadioChange, MatRadioModule } from '@angular/material/radio';
|
|
31
|
+
import * as i2$2 from '@angular/material/select';
|
|
32
|
+
import { MatSelectChange, MatSelectModule } from '@angular/material/select';
|
|
33
|
+
import * as i6$1 from '@mtna/pojo-social-angular';
|
|
34
|
+
import { MtnaAnnotationsIndicatorModule } from '@mtna/pojo-social-angular';
|
|
35
|
+
import * as i1$4 from '@angular/material/card';
|
|
36
|
+
import { MatCardModule } from '@angular/material/card';
|
|
37
|
+
import * as i3$1 from '@angular/material/divider';
|
|
38
|
+
import { MatDividerModule } from '@angular/material/divider';
|
|
39
|
+
import * as i4$1 from '@angular/cdk/a11y';
|
|
40
|
+
import { A11yModule } from '@angular/cdk/a11y';
|
|
41
|
+
import * as i5$1 from '@angular/material/list';
|
|
42
|
+
import { MatListModule } from '@angular/material/list';
|
|
43
|
+
import * as i14 from '@angular/flex-layout/extended';
|
|
44
|
+
import * as i19 from '@angular/material/tooltip';
|
|
45
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
46
|
+
import * as i20 from '@angular/material/table';
|
|
47
|
+
import { MatTableModule } from '@angular/material/table';
|
|
48
|
+
import * as i3$2 from '@angular/material/datepicker';
|
|
49
|
+
import { MatDatepicker, MatDatepickerModule } from '@angular/material/datepicker';
|
|
50
|
+
import * as i2$1 from '@angular/material/form-field';
|
|
51
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
52
|
+
import * as i5 from '@angular/material/input';
|
|
53
|
+
import { MatInputModule } from '@angular/material/input';
|
|
54
|
+
import * as i3$3 from '@angular/flex-layout/flex';
|
|
55
|
+
import * as i35 from '@angular/material/slide-toggle';
|
|
56
|
+
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
57
|
+
import * as i36 from '@angular/material/checkbox';
|
|
58
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
59
|
+
import { FlexLayoutModule } from '@angular/flex-layout';
|
|
60
|
+
import { MatMomentDateModule } from '@angular/material-moment-adapter';
|
|
61
|
+
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
62
|
+
import { MatChipsModule } from '@angular/material/chips';
|
|
63
|
+
|
|
64
|
+
const COMPLEX_STANDARD = '300ms cubic-bezier(0.4, 0.0, 0.2, 1)';
|
|
65
|
+
const MTNA_WF_EXPAND_COLLAPSE = trigger('mtnaWfExpandCollapse', [
|
|
66
|
+
state('1', style({ height: '*', marginTop: '*', marginBottom: '*', opacity: 1 })),
|
|
67
|
+
state('0', style({ height: 0, marginTop: 0, marginBottom: 0, opacity: 0, overflow: 'hidden', visibility: 'hidden' })),
|
|
68
|
+
transition('1 <=> 0', [animate(COMPLEX_STANDARD)]),
|
|
69
|
+
]);
|
|
70
|
+
|
|
71
|
+
const MTNA_WF_API_TOKEN = new InjectionToken('mtnaWfApiConfig');
|
|
72
|
+
|
|
73
|
+
class GetObjectTypePipe {
|
|
74
|
+
transform(id) {
|
|
75
|
+
const newId = id.toLowerCase().split('.');
|
|
76
|
+
return newId[newId.length - 1];
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
GetObjectTypePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetObjectTypePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
80
|
+
GetObjectTypePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetObjectTypePipe, name: "getObjectType" });
|
|
81
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetObjectTypePipe, decorators: [{
|
|
82
|
+
type: Pipe,
|
|
83
|
+
args: [{
|
|
84
|
+
name: 'getObjectType',
|
|
85
|
+
}]
|
|
86
|
+
}] });
|
|
87
|
+
|
|
88
|
+
class CoerceDateItemPipe {
|
|
89
|
+
constructor(objectTypePipe) {
|
|
90
|
+
this.objectTypePipe = objectTypePipe;
|
|
91
|
+
}
|
|
92
|
+
transform(item) {
|
|
93
|
+
if (!!item && this.objectTypePipe.transform(item.itemId) === 'dateitem') {
|
|
94
|
+
return item;
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
CoerceDateItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CoerceDateItemPipe, deps: [{ token: GetObjectTypePipe }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
100
|
+
CoerceDateItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CoerceDateItemPipe, name: "coerceDateItem" });
|
|
101
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CoerceDateItemPipe, decorators: [{
|
|
102
|
+
type: Pipe,
|
|
103
|
+
args: [{
|
|
104
|
+
name: 'coerceDateItem',
|
|
105
|
+
}]
|
|
106
|
+
}], ctorParameters: function () { return [{ type: GetObjectTypePipe }]; } });
|
|
107
|
+
|
|
108
|
+
class DateQuarterPipe {
|
|
109
|
+
transform(quarter, format = 'short') {
|
|
110
|
+
const short = {
|
|
111
|
+
0: 'Q1',
|
|
112
|
+
1: 'Q2',
|
|
113
|
+
2: 'Q3',
|
|
114
|
+
3: 'Q4',
|
|
115
|
+
};
|
|
116
|
+
const medium = {
|
|
117
|
+
0: '1st Quarter',
|
|
118
|
+
1: '2nd Quarter',
|
|
119
|
+
2: '3rd Quarter',
|
|
120
|
+
3: '4th Quarter',
|
|
121
|
+
};
|
|
122
|
+
const long = {
|
|
123
|
+
0: 'First Quarter',
|
|
124
|
+
1: 'Second Quarter',
|
|
125
|
+
2: 'Third Quarter',
|
|
126
|
+
3: 'Fourth Quarter',
|
|
127
|
+
};
|
|
128
|
+
switch (format) {
|
|
129
|
+
case 'short':
|
|
130
|
+
return short[quarter];
|
|
131
|
+
case 'medium':
|
|
132
|
+
return medium[quarter];
|
|
133
|
+
case 'long':
|
|
134
|
+
return long[quarter];
|
|
135
|
+
default:
|
|
136
|
+
return '';
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
DateQuarterPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DateQuarterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
141
|
+
DateQuarterPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DateQuarterPipe, name: "mtnaWfDateQuarter" });
|
|
142
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DateQuarterPipe, decorators: [{
|
|
143
|
+
type: Pipe,
|
|
144
|
+
args: [{
|
|
145
|
+
name: 'mtnaWfDateQuarter',
|
|
146
|
+
}]
|
|
147
|
+
}] });
|
|
148
|
+
|
|
149
|
+
class GetAutoCompletePipe {
|
|
150
|
+
transform(label) {
|
|
151
|
+
if (label) {
|
|
152
|
+
switch (label.toLowerCase()) {
|
|
153
|
+
case 'first name':
|
|
154
|
+
return 'given-name';
|
|
155
|
+
case 'last name':
|
|
156
|
+
return 'family-name';
|
|
157
|
+
case 'email':
|
|
158
|
+
return 'email';
|
|
159
|
+
case 'organization':
|
|
160
|
+
return 'organization';
|
|
161
|
+
case 'phone':
|
|
162
|
+
return 'tel';
|
|
163
|
+
case 'street address line 1':
|
|
164
|
+
return 'address-line1';
|
|
165
|
+
case 'street address line 2':
|
|
166
|
+
return 'address-line2';
|
|
167
|
+
case 'city':
|
|
168
|
+
return 'address-level2';
|
|
169
|
+
case 'state':
|
|
170
|
+
return 'address-level1';
|
|
171
|
+
case 'zip code':
|
|
172
|
+
return 'postal-code';
|
|
173
|
+
default:
|
|
174
|
+
return 'off';
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return 'off';
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
GetAutoCompletePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetAutoCompletePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
181
|
+
GetAutoCompletePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetAutoCompletePipe, name: "getAutoComplete" });
|
|
182
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetAutoCompletePipe, decorators: [{
|
|
183
|
+
type: Pipe,
|
|
184
|
+
args: [{
|
|
185
|
+
name: 'getAutoComplete',
|
|
186
|
+
}]
|
|
187
|
+
}] });
|
|
188
|
+
|
|
189
|
+
class MtnaWfGetAvailableQuartersPipe {
|
|
190
|
+
transform(year, limits) {
|
|
191
|
+
const quarters = [0, 1, 2, 3];
|
|
192
|
+
if (!!year && !!limits) {
|
|
193
|
+
// If the selected year matches the start year limit
|
|
194
|
+
if (!!limits.start && !!limits.start.year && year === limits.start.year) {
|
|
195
|
+
// If a start quarter limiit exists, return the limited options
|
|
196
|
+
return limits.start.quarter !== null && limits.start.quarter !== undefined ? quarters.slice(limits.start.quarter) : quarters;
|
|
197
|
+
}
|
|
198
|
+
// If the selected year matches the end year limit
|
|
199
|
+
if (!!limits.end && !!limits.end.year && year === limits.end.year) {
|
|
200
|
+
// If an end quarter limit exists, return the limited options
|
|
201
|
+
return limits.end.quarter !== null && limits.end.quarter !== undefined ? quarters.slice(0, limits.end.quarter + 1) : quarters;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return quarters;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
MtnaWfGetAvailableQuartersPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfGetAvailableQuartersPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
208
|
+
MtnaWfGetAvailableQuartersPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfGetAvailableQuartersPipe, name: "mtnaWfGetQuarters" });
|
|
209
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfGetAvailableQuartersPipe, decorators: [{
|
|
210
|
+
type: Pipe,
|
|
211
|
+
args: [{
|
|
212
|
+
name: 'mtnaWfGetQuarters',
|
|
213
|
+
}]
|
|
214
|
+
}] });
|
|
215
|
+
|
|
216
|
+
/** List of default error messages to display */
|
|
217
|
+
const DEFAULT_ERROR_MESSAGES = {
|
|
218
|
+
email: 'This field must include a valid email format.',
|
|
219
|
+
max: (item) => !isPresent(item) || !isPresent(item === null || item === void 0 ? void 0 : item.maxValue)
|
|
220
|
+
? `This field's value must be less.`
|
|
221
|
+
: `${isPresent(item === null || item === void 0 ? void 0 : item.minValue) ? `Min value: ${item === null || item === void 0 ? void 0 : item.minValue} - ` : ''}Max value: ${item === null || item === void 0 ? void 0 : item.minValue}`,
|
|
222
|
+
maxlength: 'This field has exceeded the allowed maximum.',
|
|
223
|
+
maxSelected: null,
|
|
224
|
+
min: (item) => !isPresent(item) || !isPresent(item === null || item === void 0 ? void 0 : item.minValue)
|
|
225
|
+
? `This field's value must be greater.`
|
|
226
|
+
: `Min value: ${item === null || item === void 0 ? void 0 : item.minValue}${!isPresent(item === null || item === void 0 ? void 0 : item.maxValue) ? '' : ` - Max value: ${item === null || item === void 0 ? void 0 : item.maxValue}`}`,
|
|
227
|
+
minlength: 'This field has not met the required minimum.',
|
|
228
|
+
minSelected: null,
|
|
229
|
+
nonDigit: `This field's value must be numeric.`,
|
|
230
|
+
pattern: `This field's input does not meet the accepted pattern.`,
|
|
231
|
+
positive: `This field's value cannot be negative.`,
|
|
232
|
+
required: 'This field is required.',
|
|
233
|
+
requiredTrue: `This field's value must be 'true'.`,
|
|
234
|
+
wholeNumber: `This field cannot contain a decimal.`,
|
|
235
|
+
matDatepickerParse: `This field's value is not an accepted format.`,
|
|
236
|
+
};
|
|
237
|
+
const WEB_FORM_CUSTOM_ERRORS = new InjectionToken('mtnaWebFormCustomFormErrors');
|
|
238
|
+
class MtnaWfUIService {
|
|
239
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
240
|
+
constructor(dialog, errors) {
|
|
241
|
+
this.dialog = dialog;
|
|
242
|
+
/** Map of annotation counts for each annotatable item */
|
|
243
|
+
this.annotations = {};
|
|
244
|
+
/** Map of components in the MtnaForm */
|
|
245
|
+
this.components = {};
|
|
246
|
+
/** Map of item.disabled values that have changed */
|
|
247
|
+
this.disabledState = {};
|
|
248
|
+
/** Map of toggler ID's for components that have multiple togglers */
|
|
249
|
+
this.multipleEnablers = {};
|
|
250
|
+
// Workaround for: Metadata collected contains an error that will be reported at runtime: Could not resolve type CustomErrors.
|
|
251
|
+
// see https://stackoverflow.com/questions/49513359/could-not-resolve-type-document-in-angular5/53715642#53715642
|
|
252
|
+
this.errors = errors;
|
|
253
|
+
}
|
|
254
|
+
getDisabledStates() {
|
|
255
|
+
return Object.assign({}, this.disabledState);
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Returns an error message matching the error id
|
|
259
|
+
* @param errorId Id of the error, to find the associated error message
|
|
260
|
+
* @param item FormItem to pass to ValidationErrors that are functions. For instance,
|
|
261
|
+
* this is useful for 'min' & 'max' value limits to display more helpful messages
|
|
262
|
+
*/
|
|
263
|
+
getError(errorId, item) {
|
|
264
|
+
// default when no custom message exists
|
|
265
|
+
let error = DEFAULT_ERROR_MESSAGES[errorId];
|
|
266
|
+
if (!!this.errors && !!item) {
|
|
267
|
+
// check for instance specific, via instanceId
|
|
268
|
+
if (isPresent(this.errors[item.instanceId]) && isPresent(this.errors[item.instanceId][errorId])) {
|
|
269
|
+
error = this.errors[item.instanceId][errorId];
|
|
270
|
+
// check for item specific, via itemId
|
|
271
|
+
}
|
|
272
|
+
else if (isPresent(this.errors[item.itemId]) && isPresent(this.errors[item.itemId][errorId])) {
|
|
273
|
+
error = this.errors[item.itemId][errorId];
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return typeof error === 'function' ? error(item) : error;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Get a registered component by intance id.
|
|
280
|
+
* @param id the instanceId
|
|
281
|
+
* @returns the {@link FormItemComponent} that represents that ID or undefined if not registered.
|
|
282
|
+
*/
|
|
283
|
+
getItem(id) {
|
|
284
|
+
return this.components[id];
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Sets the initial map of annotation counts, and/or pushes the new count onto the component observable stream
|
|
288
|
+
* @param map AnnotatableNumberMap of counts mapped to their annotatableIds
|
|
289
|
+
*/
|
|
290
|
+
registerAnnotations(map) {
|
|
291
|
+
for (const id in map) {
|
|
292
|
+
if (Object.prototype.hasOwnProperty.call(map, id)) {
|
|
293
|
+
if (!this.annotations[id]) {
|
|
294
|
+
this.annotations[id] = new BehaviorSubject(map[id]);
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
this.annotations[id].next(map[id]);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Maps a component to its items instanceId.
|
|
304
|
+
* @param component component calling this method, i.e. 'this'
|
|
305
|
+
*/
|
|
306
|
+
registerSelf(component) {
|
|
307
|
+
this.components[component.item.instanceId] = component;
|
|
308
|
+
if (!!component.item.annotatableId && component.item.annotationEnabled) {
|
|
309
|
+
if (!this.annotations[component.item.annotatableId]) {
|
|
310
|
+
this.annotations[component.item.annotatableId] = new BehaviorSubject(null);
|
|
311
|
+
}
|
|
312
|
+
component.annotations$ = this.annotations[component.item.annotatableId].asObservable();
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Toggles a FormItem's visiblity and enable/disable state
|
|
317
|
+
*
|
|
318
|
+
* @param enabledItemIds array of component IDs for enabled items.
|
|
319
|
+
* @param disabledItemIds array of component IDs for disabled items.
|
|
320
|
+
* @param enabled Whether the enabledItemIds are enabled.
|
|
321
|
+
* @param callerId instanceId of the item invoking this function
|
|
322
|
+
* @param reset Whether to reset the multiple enabler map of the toggled item
|
|
323
|
+
*/
|
|
324
|
+
toggleFormItems(enabledItemIds, disabledItemIds, enabled, callerId, reset = false) {
|
|
325
|
+
if ((!enabledItemIds || !enabledItemIds.length) && (!disabledItemIds || !disabledItemIds.length)) {
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
const allIds = [enabledItemIds, disabledItemIds];
|
|
329
|
+
for (let i = 0; i < allIds.length; i++) {
|
|
330
|
+
const itemIds = allIds[i];
|
|
331
|
+
const isEnabled = i === 0 ? enabled : !enabled;
|
|
332
|
+
for (const id of itemIds) {
|
|
333
|
+
const component = this.components[id];
|
|
334
|
+
// If component is registered, toggle it
|
|
335
|
+
if (component) {
|
|
336
|
+
const item = component.item;
|
|
337
|
+
const hasMultipleEnablers = isConditionalItem(item) && item.condition ? item.condition.itemIds.length > 1 : false;
|
|
338
|
+
// If item has more than 1 enabler, handle multiple enablers
|
|
339
|
+
if (hasMultipleEnablers) {
|
|
340
|
+
if (reset) {
|
|
341
|
+
this.multipleEnablers[item.instanceId] = null;
|
|
342
|
+
}
|
|
343
|
+
// If a map has not been registered, then build up a map to register
|
|
344
|
+
// Should only happen the first time an item is toggled.
|
|
345
|
+
if (!this.multipleEnablers[item.instanceId] && isConditionalItem(item)) {
|
|
346
|
+
this.multipleEnablers[item.instanceId] = this._registerCurrentEnablers(item);
|
|
347
|
+
}
|
|
348
|
+
// handle Multiple Enablers
|
|
349
|
+
this._handleMultipleEnablers(component, isEnabled, callerId);
|
|
350
|
+
}
|
|
351
|
+
else {
|
|
352
|
+
// Not multiple enablers
|
|
353
|
+
this._toggleDisabledStateAndControl(component, isEnabled);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
console.error('[toggleFormItems] component has not been registerd', id, enabled, callerId);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Generates map of all IDs currently influencing an item.
|
|
364
|
+
* @param toggledItem item being toggled
|
|
365
|
+
*/
|
|
366
|
+
_registerCurrentEnablers(toggledItem) {
|
|
367
|
+
var _a;
|
|
368
|
+
const enablers = {};
|
|
369
|
+
const allIds = ((_a = toggledItem.condition) === null || _a === void 0 ? void 0 : _a.itemIds) || [];
|
|
370
|
+
for (const id of allIds) {
|
|
371
|
+
const component = this.components[id];
|
|
372
|
+
if (component) {
|
|
373
|
+
if (this._isCurrentlyToggling(component, toggledItem.instanceId)) {
|
|
374
|
+
enablers[component.item.instanceId] = component.item.instanceId;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
console.error('[registerCurrentEnablers] component has not been registered.', id);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
return enablers;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Resets the map of components. This should be called by the form when
|
|
385
|
+
* it is destroyed.
|
|
386
|
+
*/
|
|
387
|
+
resetComponentMap() {
|
|
388
|
+
this.annotations = {};
|
|
389
|
+
this.components = {};
|
|
390
|
+
this.disabledState = {};
|
|
391
|
+
this.multipleEnablers = {};
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Determines if an influencer is currently toggling the specified toggledItemId.
|
|
395
|
+
* @param influencer Item to check whether it's currently influencing the toggledItemId
|
|
396
|
+
* @param toggledId InstanceId of the item being toggled
|
|
397
|
+
* @returns Whether the influencer is currently toggling the toggled item
|
|
398
|
+
*/
|
|
399
|
+
_isCurrentlyToggling(influencer, toggledId) {
|
|
400
|
+
var _a, _b, _c;
|
|
401
|
+
const item = influencer.item;
|
|
402
|
+
// Item has single option property, so check if selected, or item.value is 'true'
|
|
403
|
+
if (isOptionItemImpl(item)) {
|
|
404
|
+
return item.option.selected || !!item.value || !!((_a = influencer.control) === null || _a === void 0 ? void 0 : _a.value);
|
|
405
|
+
}
|
|
406
|
+
else if (isOptionGroupItemImpl(item)) {
|
|
407
|
+
const value = (_c = (_b = influencer.control) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : item.value;
|
|
408
|
+
if (Array.isArray(value)) {
|
|
409
|
+
// find the index of options that contain the 'toggledId' in their enabledItems
|
|
410
|
+
// & check if at least 1 is selected, or its 'true' in the value
|
|
411
|
+
const optionIndexes = item.options.map((o, i) => (o.enabledItems.some((id) => id === toggledId) ? i : null)).filter(isPresent);
|
|
412
|
+
return optionIndexes.some((i) => !!value[i]);
|
|
413
|
+
}
|
|
414
|
+
else if (typeof value === 'string' && value.length) {
|
|
415
|
+
// if the value is a single value, get the enabling option ids and check for the value in them
|
|
416
|
+
return item.options.some((o) => o.option.id === value && o.enabledItems.some((id) => id === toggledId));
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Handles component visibility for a FormItem with multiple enablers in its condition
|
|
423
|
+
* @param component FormItemComponent being toggled
|
|
424
|
+
* @param enabled Whether the component is being enabled
|
|
425
|
+
* @param callerId ID of the caller toggling this component
|
|
426
|
+
*/
|
|
427
|
+
_handleMultipleEnablers(component, enabled, callerId) {
|
|
428
|
+
var _a;
|
|
429
|
+
const item = component.item;
|
|
430
|
+
const enablers = Object.assign({}, this.multipleEnablers[item.instanceId]);
|
|
431
|
+
let isEnabled;
|
|
432
|
+
if (enabled) {
|
|
433
|
+
enablers[callerId] = callerId;
|
|
434
|
+
isEnabled =
|
|
435
|
+
isConditionalItem(item) &&
|
|
436
|
+
!!item.condition &&
|
|
437
|
+
(!item.condition.allRequired || item.condition.itemIds.every((id) => !!enablers[id]));
|
|
438
|
+
}
|
|
439
|
+
else {
|
|
440
|
+
delete enablers[callerId];
|
|
441
|
+
isEnabled = !((isConditionalItem(item) && ((_a = item.condition) === null || _a === void 0 ? void 0 : _a.allRequired)) || !Object.keys(enablers).length);
|
|
442
|
+
}
|
|
443
|
+
// If enabled === disabled, then the state has changed
|
|
444
|
+
if (this._isDisabled(item) === isEnabled) {
|
|
445
|
+
this._toggleDisabledStateAndControl(component, isEnabled);
|
|
446
|
+
}
|
|
447
|
+
// set the new enabler map
|
|
448
|
+
this.multipleEnablers[item.instanceId] = enablers;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Enables or disables the control on a FormItemComponent
|
|
452
|
+
* @param component FormItemComponent to enable or disable its control
|
|
453
|
+
* @param enabled whether to enable the control
|
|
454
|
+
*/
|
|
455
|
+
_toggleControlState(component, enabled) {
|
|
456
|
+
var _a, _b, _c;
|
|
457
|
+
if (enabled && !((_a = component.control) === null || _a === void 0 ? void 0 : _a.enabled)) {
|
|
458
|
+
// Enable the control if it isn't already
|
|
459
|
+
if (component.control instanceof FormGroup) {
|
|
460
|
+
this._enableIndividualControls(component);
|
|
461
|
+
}
|
|
462
|
+
else {
|
|
463
|
+
(_b = component.control) === null || _b === void 0 ? void 0 : _b.enable();
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
else if (!enabled && ((_c = component.control) === null || _c === void 0 ? void 0 : _c.enabled)) {
|
|
467
|
+
// Disable the control if it isn't already
|
|
468
|
+
component.control.disable();
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Toggles both the component visiblity and the control's enable/disable status
|
|
473
|
+
* @param component FormItemComponent to show or hide and enable or disable
|
|
474
|
+
* @param enabled whether to show the component and whether to enable the component
|
|
475
|
+
*/
|
|
476
|
+
_toggleDisabledStateAndControl(component, enabled) {
|
|
477
|
+
this.disabledState[component.item.instanceId] = !enabled;
|
|
478
|
+
this._toggleControlState(component, enabled);
|
|
479
|
+
if (isConditionalItem(component.item) && component.item.hideOnDisable) {
|
|
480
|
+
component.visible = enabled;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Enables controls individually using recursion.
|
|
485
|
+
* FormGroups should only exist for items with 'items' arrays, or
|
|
486
|
+
* if the component is a BaseParentItemControl
|
|
487
|
+
* @param comp FormItemComponent
|
|
488
|
+
*/
|
|
489
|
+
_enableIndividualControls(comp) {
|
|
490
|
+
const group = comp.control;
|
|
491
|
+
if (isOptionItemImpl(comp.item) || isOptionGroupItemImpl(comp.item)) {
|
|
492
|
+
const map = comp.item.optionItemMap;
|
|
493
|
+
const self = group.get(comp.item.instanceId);
|
|
494
|
+
self === null || self === void 0 ? void 0 : self.enable();
|
|
495
|
+
for (const optionId in map) {
|
|
496
|
+
if (Object.prototype.hasOwnProperty.call(map, optionId)) {
|
|
497
|
+
const childComp = this.components[map[optionId].instanceId];
|
|
498
|
+
if (!this._isDisabled(childComp.item)) {
|
|
499
|
+
this._toggleControlState(childComp, true);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
else if (isType(comp.item, 'items') && comp.item.items.length) {
|
|
505
|
+
// Item must have 'items' array
|
|
506
|
+
for (const item of comp.item.items) {
|
|
507
|
+
const childComp = this.components[item.instanceId];
|
|
508
|
+
if (!this._isDisabled(item)) {
|
|
509
|
+
this._toggleControlState(childComp, true);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
group.updateValueAndValidity();
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Determines if a component is disabled. Prioritizes the disabledState value,
|
|
517
|
+
* if it exists, otherwise returns the item's previous disabled value
|
|
518
|
+
* @param item item to check for its disabled state
|
|
519
|
+
*/
|
|
520
|
+
_isDisabled(item) {
|
|
521
|
+
const existsInDisabledStatMap = isPresent(this.disabledState[item.instanceId]);
|
|
522
|
+
if (!existsInDisabledStatMap) {
|
|
523
|
+
return isConditionalItem(item) ? item.disabled : false;
|
|
524
|
+
}
|
|
525
|
+
else {
|
|
526
|
+
return this.disabledState[item.instanceId];
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
MtnaWfUIService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfUIService, deps: [{ token: i1.MatDialog }, { token: WEB_FORM_CUSTOM_ERRORS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
531
|
+
MtnaWfUIService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfUIService, providedIn: 'root' });
|
|
532
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfUIService, decorators: [{
|
|
533
|
+
type: Injectable,
|
|
534
|
+
args: [{ providedIn: 'root' }]
|
|
535
|
+
}], ctorParameters: function () { return [{ type: i1.MatDialog }, { type: undefined, decorators: [{
|
|
536
|
+
type: Optional
|
|
537
|
+
}, {
|
|
538
|
+
type: Inject,
|
|
539
|
+
args: [WEB_FORM_CUSTOM_ERRORS]
|
|
540
|
+
}] }]; } });
|
|
541
|
+
|
|
542
|
+
class MtnaGetFormControlErrorPipe {
|
|
543
|
+
constructor(uiService) {
|
|
544
|
+
this.uiService = uiService;
|
|
545
|
+
}
|
|
546
|
+
transform(error, item) {
|
|
547
|
+
return this.uiService.getError(error.key, item) || error.value;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
MtnaGetFormControlErrorPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaGetFormControlErrorPipe, deps: [{ token: MtnaWfUIService }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
551
|
+
MtnaGetFormControlErrorPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaGetFormControlErrorPipe, name: "mtnaWfGetControlError" });
|
|
552
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaGetFormControlErrorPipe, decorators: [{
|
|
553
|
+
type: Pipe,
|
|
554
|
+
args: [{
|
|
555
|
+
name: 'mtnaWfGetControlError',
|
|
556
|
+
}]
|
|
557
|
+
}], ctorParameters: function () { return [{ type: MtnaWfUIService }]; } });
|
|
558
|
+
|
|
559
|
+
class GetListIconPipe {
|
|
560
|
+
transform(header) {
|
|
561
|
+
if (!header) {
|
|
562
|
+
return null;
|
|
563
|
+
}
|
|
564
|
+
header = header.toUpperCase();
|
|
565
|
+
if (header.includes('PROJECT') ||
|
|
566
|
+
header.includes('REQUEST') ||
|
|
567
|
+
header.includes('ANALYTICAL APPROACH') ||
|
|
568
|
+
header.includes('JUSTIFICATION FOR USE')) {
|
|
569
|
+
return 'assignment';
|
|
570
|
+
}
|
|
571
|
+
if (header.includes('DESCRIPTION')) {
|
|
572
|
+
return 'subject';
|
|
573
|
+
}
|
|
574
|
+
if (header.includes('EMAIL')) {
|
|
575
|
+
return 'alternate_email';
|
|
576
|
+
}
|
|
577
|
+
if (header.includes('ZIP CODE')) {
|
|
578
|
+
return 'mail';
|
|
579
|
+
}
|
|
580
|
+
if (header.includes('ORGANIZATION')) {
|
|
581
|
+
return 'business';
|
|
582
|
+
}
|
|
583
|
+
if (header.includes('PHONE')) {
|
|
584
|
+
return 'local_phone';
|
|
585
|
+
}
|
|
586
|
+
if (header.includes('ADDRESS')) {
|
|
587
|
+
return 'place';
|
|
588
|
+
}
|
|
589
|
+
if (header.includes('NAME') || header.includes('TITLE')) {
|
|
590
|
+
return 'person';
|
|
591
|
+
}
|
|
592
|
+
if (header.includes('CITY')) {
|
|
593
|
+
return 'location_city';
|
|
594
|
+
}
|
|
595
|
+
if (header.includes('STATE')) {
|
|
596
|
+
return 'map';
|
|
597
|
+
}
|
|
598
|
+
return null;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
GetListIconPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetListIconPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
602
|
+
GetListIconPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetListIconPipe, name: "getListIcon" });
|
|
603
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetListIconPipe, decorators: [{
|
|
604
|
+
type: Pipe,
|
|
605
|
+
args: [{
|
|
606
|
+
name: 'getListIcon',
|
|
607
|
+
}]
|
|
608
|
+
}] });
|
|
609
|
+
|
|
610
|
+
class MtnaWfGetSelectedOptionNamePipe {
|
|
611
|
+
transform(id, options) {
|
|
612
|
+
if (!options || !id) {
|
|
613
|
+
return 'N/A';
|
|
614
|
+
}
|
|
615
|
+
const foundOption = options.find((o) => o.option.id === id);
|
|
616
|
+
return foundOption ? foundOption.option.name : 'N/A';
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
MtnaWfGetSelectedOptionNamePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfGetSelectedOptionNamePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
620
|
+
MtnaWfGetSelectedOptionNamePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfGetSelectedOptionNamePipe, name: "mtnaWfGetSelectedOptionName" });
|
|
621
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfGetSelectedOptionNamePipe, decorators: [{
|
|
622
|
+
type: Pipe,
|
|
623
|
+
args: [{
|
|
624
|
+
name: 'mtnaWfGetSelectedOptionName',
|
|
625
|
+
}]
|
|
626
|
+
}] });
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* Returns an array of FormItems that contain a value.
|
|
630
|
+
* Use only for readonly forms
|
|
631
|
+
*/
|
|
632
|
+
class MtnaWfItemsWithValuePipe {
|
|
633
|
+
constructor() {
|
|
634
|
+
this.itemsCache = [];
|
|
635
|
+
}
|
|
636
|
+
transform(items) {
|
|
637
|
+
var _a;
|
|
638
|
+
if ((_a = this.itemsCache) === null || _a === void 0 ? void 0 : _a.length) {
|
|
639
|
+
return this.itemsCache;
|
|
640
|
+
}
|
|
641
|
+
this.itemsCache = !items ? [] : items.filter(isValueItem);
|
|
642
|
+
return this.itemsCache;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
MtnaWfItemsWithValuePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfItemsWithValuePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
646
|
+
MtnaWfItemsWithValuePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfItemsWithValuePipe, name: "mtnaWfItemsWithValue", pure: false });
|
|
647
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfItemsWithValuePipe, decorators: [{
|
|
648
|
+
type: Pipe,
|
|
649
|
+
args: [{
|
|
650
|
+
name: 'mtnaWfItemsWithValue',
|
|
651
|
+
pure: false,
|
|
652
|
+
}]
|
|
653
|
+
}] });
|
|
654
|
+
|
|
655
|
+
class MtnaWfSanitizeHtmlPipe {
|
|
656
|
+
constructor(_sanitizer) {
|
|
657
|
+
this._sanitizer = _sanitizer;
|
|
658
|
+
}
|
|
659
|
+
transform(v) {
|
|
660
|
+
if (!v) {
|
|
661
|
+
return '';
|
|
662
|
+
}
|
|
663
|
+
return this._sanitizer.bypassSecurityTrustHtml(v);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
MtnaWfSanitizeHtmlPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfSanitizeHtmlPipe, deps: [{ token: i1$1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
667
|
+
MtnaWfSanitizeHtmlPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfSanitizeHtmlPipe, name: "mtnaWfSanitizeHtml" });
|
|
668
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfSanitizeHtmlPipe, decorators: [{
|
|
669
|
+
type: Pipe,
|
|
670
|
+
args: [{
|
|
671
|
+
name: 'mtnaWfSanitizeHtml',
|
|
672
|
+
}]
|
|
673
|
+
}], ctorParameters: function () { return [{ type: i1$1.DomSanitizer }]; } });
|
|
674
|
+
|
|
675
|
+
/** Typeguard for {@link FormGroup}. Determines if something is a FormGroup. */
|
|
676
|
+
function isFormGroup(something) {
|
|
677
|
+
return isObject(something) && isType(something, 'controls') && isObject(something.controls);
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* Asserts whether the given control is the narrower FormGroup type. If so, coerces the FormGroup type.
|
|
682
|
+
* Otherwise, returns null.
|
|
683
|
+
*
|
|
684
|
+
* @example
|
|
685
|
+
* <form [formGroup]="group | mtnaWfCoerceFormGroup"></form>
|
|
686
|
+
*
|
|
687
|
+
* <form *ngIf="controlContainer.control | mtnaWfCoerceFormGroup as group" [formGroup]="group"></form>
|
|
688
|
+
*
|
|
689
|
+
* @author Chase Moore <chase.moore@mtna.us>
|
|
690
|
+
*/
|
|
691
|
+
class MtnaWfCoerceFormGroupPipe {
|
|
692
|
+
/**
|
|
693
|
+
* @param control control to be coerced into a FormGroup
|
|
694
|
+
* @returns the control typed as FormGroup if possible; else null
|
|
695
|
+
*/
|
|
696
|
+
transform(control) {
|
|
697
|
+
if (isFormGroup(control)) {
|
|
698
|
+
return control;
|
|
699
|
+
}
|
|
700
|
+
return null;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
MtnaWfCoerceFormGroupPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfCoerceFormGroupPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
704
|
+
MtnaWfCoerceFormGroupPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfCoerceFormGroupPipe, name: "mtnaWfCoerceFormGroup" });
|
|
705
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfCoerceFormGroupPipe, decorators: [{
|
|
706
|
+
type: Pipe,
|
|
707
|
+
args: [{
|
|
708
|
+
name: 'mtnaWfCoerceFormGroup',
|
|
709
|
+
}]
|
|
710
|
+
}] });
|
|
711
|
+
|
|
712
|
+
const EXPORTED_DECLARATIONS = [
|
|
713
|
+
CoerceDateItemPipe,
|
|
714
|
+
DateQuarterPipe,
|
|
715
|
+
GetAutoCompletePipe,
|
|
716
|
+
GetListIconPipe,
|
|
717
|
+
GetObjectTypePipe,
|
|
718
|
+
MtnaGetFormControlErrorPipe,
|
|
719
|
+
MtnaWfCoerceFormGroupPipe,
|
|
720
|
+
MtnaWfGetAvailableQuartersPipe,
|
|
721
|
+
MtnaWfGetSelectedOptionNamePipe,
|
|
722
|
+
MtnaWfItemsWithValuePipe,
|
|
723
|
+
MtnaWfSanitizeHtmlPipe,
|
|
724
|
+
];
|
|
725
|
+
class PipesModule {
|
|
726
|
+
}
|
|
727
|
+
PipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: PipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
728
|
+
PipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: PipesModule, declarations: [CoerceDateItemPipe,
|
|
729
|
+
DateQuarterPipe,
|
|
730
|
+
GetAutoCompletePipe,
|
|
731
|
+
GetListIconPipe,
|
|
732
|
+
GetObjectTypePipe,
|
|
733
|
+
MtnaGetFormControlErrorPipe,
|
|
734
|
+
MtnaWfCoerceFormGroupPipe,
|
|
735
|
+
MtnaWfGetAvailableQuartersPipe,
|
|
736
|
+
MtnaWfGetSelectedOptionNamePipe,
|
|
737
|
+
MtnaWfItemsWithValuePipe,
|
|
738
|
+
MtnaWfSanitizeHtmlPipe], exports: [CoerceDateItemPipe,
|
|
739
|
+
DateQuarterPipe,
|
|
740
|
+
GetAutoCompletePipe,
|
|
741
|
+
GetListIconPipe,
|
|
742
|
+
GetObjectTypePipe,
|
|
743
|
+
MtnaGetFormControlErrorPipe,
|
|
744
|
+
MtnaWfCoerceFormGroupPipe,
|
|
745
|
+
MtnaWfGetAvailableQuartersPipe,
|
|
746
|
+
MtnaWfGetSelectedOptionNamePipe,
|
|
747
|
+
MtnaWfItemsWithValuePipe,
|
|
748
|
+
MtnaWfSanitizeHtmlPipe] });
|
|
749
|
+
PipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: PipesModule, providers: [GetObjectTypePipe] });
|
|
750
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: PipesModule, decorators: [{
|
|
751
|
+
type: NgModule,
|
|
752
|
+
args: [{
|
|
753
|
+
declarations: EXPORTED_DECLARATIONS,
|
|
754
|
+
providers: [GetObjectTypePipe],
|
|
755
|
+
exports: EXPORTED_DECLARATIONS,
|
|
756
|
+
}]
|
|
757
|
+
}] });
|
|
758
|
+
|
|
759
|
+
class MtnaWfApiService {
|
|
760
|
+
constructor(apiConfig, http) {
|
|
761
|
+
this.apiConfig = apiConfig;
|
|
762
|
+
this.http = http;
|
|
763
|
+
this.API_URL = `${this.apiConfig.baseUrl}/api`;
|
|
764
|
+
this.FORM_URL = `${this.API_URL}/form`;
|
|
765
|
+
this.TEMPLATE_URL = `${this.API_URL}/template`;
|
|
766
|
+
this.NEW_TEMPLATE_URL = `${this.TEMPLATE_URL}/new`;
|
|
767
|
+
this.NEW_SECTION_URL = `${this.TEMPLATE_URL}/section`;
|
|
768
|
+
this.ITEMS_URL = `${this.TEMPLATE_URL}/items`;
|
|
769
|
+
this.ITEM_INSTANCE_URL = `${this.TEMPLATE_URL}/item`;
|
|
770
|
+
this.TEMPLATE_SAVE_URL = `${this.TEMPLATE_URL}/save`;
|
|
771
|
+
this.TEMPLATE_DELETE_URL = `${this.TEMPLATE_URL}/delete`;
|
|
772
|
+
this.ALL_TEMPLATES_URL = `${this.API_URL}/templates`;
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* Download a web form
|
|
776
|
+
* @param form the web form pojo to download
|
|
777
|
+
* @returns Full HttlReponse with the Blob as the body
|
|
778
|
+
*/
|
|
779
|
+
downloadForm(form) {
|
|
780
|
+
return this.http.post(`${this.FORM_URL}/download`, form, { observe: 'response', responseType: 'blob' });
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* Returns a new repeatable FormItem
|
|
784
|
+
* @param formInstanceId template ID of the mtna form
|
|
785
|
+
* @param itemId repeatableTemplateId of the requesting RepeatableItem
|
|
786
|
+
*/
|
|
787
|
+
getRepeatableItem(formInstanceId, itemId) {
|
|
788
|
+
return this.http.get(`${this.FORM_URL}/${formInstanceId}/new/item/${itemId}`);
|
|
789
|
+
}
|
|
790
|
+
getNewTemplate() {
|
|
791
|
+
return this.http.get(this.NEW_TEMPLATE_URL);
|
|
792
|
+
}
|
|
793
|
+
getAllTemplate() {
|
|
794
|
+
return this.http.get(this.ALL_TEMPLATES_URL);
|
|
795
|
+
}
|
|
796
|
+
getNewSection() {
|
|
797
|
+
return this.http.get(this.NEW_SECTION_URL);
|
|
798
|
+
}
|
|
799
|
+
getItems() {
|
|
800
|
+
return this.http.get(this.ITEMS_URL);
|
|
801
|
+
}
|
|
802
|
+
getTemplateItem(id) {
|
|
803
|
+
return this.http.get(`${this.ITEM_INSTANCE_URL}?id=${id}`);
|
|
804
|
+
}
|
|
805
|
+
saveTemplate() {
|
|
806
|
+
return this.http.get(this.TEMPLATE_SAVE_URL);
|
|
807
|
+
}
|
|
808
|
+
getDeleteTemplate() {
|
|
809
|
+
return this.http.get(this.TEMPLATE_DELETE_URL);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
MtnaWfApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfApiService, deps: [{ token: MTNA_WF_API_TOKEN }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
813
|
+
MtnaWfApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfApiService, providedIn: 'root' });
|
|
814
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfApiService, decorators: [{
|
|
815
|
+
type: Injectable,
|
|
816
|
+
args: [{ providedIn: 'root' }]
|
|
817
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
818
|
+
type: Inject,
|
|
819
|
+
args: [MTNA_WF_API_TOKEN]
|
|
820
|
+
}] }, { type: i1$2.HttpClient }]; } });
|
|
821
|
+
|
|
822
|
+
const MTNA_WF_FORM_ITEM_VALIDATION_RESULT_ERROR_NAME = 'formItemValidationResult';
|
|
823
|
+
/**
|
|
824
|
+
* Valitator function that will check the root level {@link FormValidationResult} on
|
|
825
|
+
* the MTNA {@link Form} and see if there are any errors for a particular control.
|
|
826
|
+
*
|
|
827
|
+
* @param instanceId The instanceId of the form item for a particular control
|
|
828
|
+
* @param managerService The manager service that holds a reference to the MTNA {@link Form} and it's {@link FormValidationResult}
|
|
829
|
+
* @returns A validator function that will throw an error if there is a matching {@link FormItemValidationResult} for the specified item.
|
|
830
|
+
*/
|
|
831
|
+
function validationResultValidator(instanceId, managerService) {
|
|
832
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
833
|
+
return (control) => {
|
|
834
|
+
const formItemValidationResult = managerService.getFormItemValidationResults()[instanceId];
|
|
835
|
+
return formItemValidationResult
|
|
836
|
+
? { [MTNA_WF_FORM_ITEM_VALIDATION_RESULT_ERROR_NAME]: formItemValidationResult.validationMessage }
|
|
837
|
+
: null;
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* Custom {@link ErrorStateMatcher} that will immediately show {@link FormValidationResult} errors.
|
|
843
|
+
* Theses errors are calcualted on the server and need to always show.
|
|
844
|
+
* Regular form validation will use the default error matcher strategy.
|
|
845
|
+
*/
|
|
846
|
+
class MtnaWfInstantValidationResultErrorStateMatcher extends ErrorStateMatcher {
|
|
847
|
+
isErrorState(control, form) {
|
|
848
|
+
const hasValidationResultError = isKey(control === null || control === void 0 ? void 0 : control.errors, MTNA_WF_FORM_ITEM_VALIDATION_RESULT_ERROR_NAME);
|
|
849
|
+
return hasValidationResultError || super.isErrorState(control, form);
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
MtnaWfInstantValidationResultErrorStateMatcher.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfInstantValidationResultErrorStateMatcher, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
853
|
+
MtnaWfInstantValidationResultErrorStateMatcher.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfInstantValidationResultErrorStateMatcher, providedIn: 'root' });
|
|
854
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfInstantValidationResultErrorStateMatcher, decorators: [{
|
|
855
|
+
type: Injectable,
|
|
856
|
+
args: [{ providedIn: 'root' }]
|
|
857
|
+
}] });
|
|
858
|
+
|
|
859
|
+
/** RegEx to validate number items contain only negative, digits, or decimals */
|
|
860
|
+
const numOnlyWithoutComma = /^-?\d+(\.\d*)?$/;
|
|
861
|
+
/** RegEx to validate number items contain only negative, digits, or decimals in comma format */
|
|
862
|
+
const numOnlyWithComma = /^-?\d{1,3}(,\d{3})*(\.\d*)?$/;
|
|
863
|
+
/** RegEx to validate 'positive only' item conains non-negative characters */
|
|
864
|
+
const posOnly = /^[^-]*$/;
|
|
865
|
+
/** RegEx to validate 'whole number' item contains only negative, digits, or comma format */
|
|
866
|
+
const wholeNumber = /^-?\d+(,\d{3})*$/;
|
|
867
|
+
//#region FormControl Generation
|
|
868
|
+
/**
|
|
869
|
+
* Generates a new FormGroup with FormControls & possible nested FormGroups
|
|
870
|
+
* @param formItem WebForm, Section, Group, or RepeatableItem used to create a FormGroup
|
|
871
|
+
* @param customFormItemConditional boolean function for any custom FormItems
|
|
872
|
+
* @param customControlGenerator FormControl generator function for any custom FormItems
|
|
873
|
+
*/
|
|
874
|
+
function serializeFormItems(formItem, managerService, customFormItemConditional = () => false, customControlGenerator) {
|
|
875
|
+
const form = {};
|
|
876
|
+
for (const item of formItem.items) {
|
|
877
|
+
const control = determineSerializeFunctionToUse(item, managerService, customFormItemConditional, customControlGenerator);
|
|
878
|
+
if (control) {
|
|
879
|
+
form[item.instanceId] = control;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
const required = isForm(formItem) ? true : formItem.required;
|
|
883
|
+
const group = required ? new FormGroup(form, Validators.required) : new FormGroup(form);
|
|
884
|
+
if ('disabled' in formItem && formItem.disabled) {
|
|
885
|
+
group.disable({ onlySelf: true, emitEvent: false });
|
|
886
|
+
}
|
|
887
|
+
return group;
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* Returns a tailored FormControl with validators for a FormItem
|
|
891
|
+
* @param formItem The FormItem requesting a tailored FormControl
|
|
892
|
+
* @internal Creating the form control and then calling setValidators force a validation pass,
|
|
893
|
+
* see https://github.com/angular/angular/issues/19622#issuecomment-341547884
|
|
894
|
+
* Better to gather the validators and put them in the constructor of the form control.
|
|
895
|
+
*/
|
|
896
|
+
function serializeFormItem(formItem, managerService) {
|
|
897
|
+
const validators = new Array(validationResultValidator(formItem.instanceId, managerService));
|
|
898
|
+
if (formItem.required) {
|
|
899
|
+
validators.push(Validators.required);
|
|
900
|
+
}
|
|
901
|
+
switch (formItem.itemId) {
|
|
902
|
+
case CHECKBOX_ITEM_ID: {
|
|
903
|
+
const checkboxItem = formItem;
|
|
904
|
+
const value = checkboxItem.value || [];
|
|
905
|
+
validators.push(numCheckboxesValidator('MIN', checkboxItem.minSelections), numCheckboxesValidator('MAX', checkboxItem.maxSelections));
|
|
906
|
+
const arr = new FormArray(checkboxItem.options.map((o) => new FormControl({ value: o.selected || value.some((v) => v === o.option.id), disabled: checkboxItem.disabled })), Validators.compose(validators));
|
|
907
|
+
return arr;
|
|
908
|
+
}
|
|
909
|
+
case DECIMAL_ANSWER_ITEM_ID:
|
|
910
|
+
case WHOLE_NUMBER_ANSWER_ITEM_ID: {
|
|
911
|
+
const item = formItem;
|
|
912
|
+
validators.push(numericalValueCheck());
|
|
913
|
+
if (isWholeNumberItem(item)) {
|
|
914
|
+
validators.push(wholeNumberPattern());
|
|
915
|
+
}
|
|
916
|
+
if (item.positiveOnly) {
|
|
917
|
+
validators.push(positiveNumberPattern());
|
|
918
|
+
}
|
|
919
|
+
if (!isNullOrUndefined(item.minValue)) {
|
|
920
|
+
validators.push(numValueLimit('min', item.minValue));
|
|
921
|
+
}
|
|
922
|
+
if (!isNullOrUndefined(item.maxValue)) {
|
|
923
|
+
validators.push(numValueLimit('max', item.maxValue));
|
|
924
|
+
}
|
|
925
|
+
break;
|
|
926
|
+
}
|
|
927
|
+
case PARAGRAPH_ANSWER_ITEM_ID:
|
|
928
|
+
case SHORT_ANSWER_ITEM_ID: {
|
|
929
|
+
const shortAnswerItem = formItem;
|
|
930
|
+
validators.push(...getNumericValidator('minLength', shortAnswerItem.minCharCount));
|
|
931
|
+
validators.push(...getNumericValidator('maxLength', shortAnswerItem.maxCharCount));
|
|
932
|
+
break;
|
|
933
|
+
}
|
|
934
|
+
default:
|
|
935
|
+
break;
|
|
936
|
+
}
|
|
937
|
+
return new FormControl({ value: formItem.value, disabled: !!formItem.disabled }, Validators.compose(validators));
|
|
938
|
+
}
|
|
939
|
+
/**
|
|
940
|
+
* Builds controls for any form items nested inside a parent items options
|
|
941
|
+
* @param formItem The FormItem with an 'options' property
|
|
942
|
+
* @param customFormItemConditional conditional function from parent 'serializeFormItems' function
|
|
943
|
+
* @param customControlGenerator FormControl generator from parent 'serializeFormItems' function
|
|
944
|
+
*/
|
|
945
|
+
function serializeNestedOptionFormItems(formItem, managerService, customFormItemConditional = () => false, customControlGenerator) {
|
|
946
|
+
const controls = {};
|
|
947
|
+
for (const id in formItem.optionItemMap) {
|
|
948
|
+
if (Object.prototype.hasOwnProperty.call(formItem.optionItemMap, id)) {
|
|
949
|
+
const subItem = formItem.optionItemMap[id];
|
|
950
|
+
const control = determineSerializeFunctionToUse(subItem, managerService, customFormItemConditional, customControlGenerator);
|
|
951
|
+
if (control) {
|
|
952
|
+
controls[subItem.instanceId] = control;
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
controls[formItem.instanceId] = serializeFormItem(formItem, managerService);
|
|
957
|
+
const group = formItem.required ? new FormGroup(controls, Validators.required) : new FormGroup(controls);
|
|
958
|
+
if (formItem.disabled) {
|
|
959
|
+
group.disable({ onlySelf: true, emitEvent: false });
|
|
960
|
+
}
|
|
961
|
+
return group;
|
|
962
|
+
}
|
|
963
|
+
/**
|
|
964
|
+
* Build FormControls for a TableItem
|
|
965
|
+
* @param item TableItem requiring FormControls
|
|
966
|
+
* @param customFormItemConditional Conditional function for custom any FormItems
|
|
967
|
+
* @param customControlGenerator FormControl generator for custom any FormItems
|
|
968
|
+
*/
|
|
969
|
+
function serializeTableItem(item, managerService, customFormItemConditional = () => false, customControlGenerator) {
|
|
970
|
+
const tableControl = {};
|
|
971
|
+
for (const row of item.tableRows) {
|
|
972
|
+
for (const rowItem of row.items.filter((i) => !!i)) {
|
|
973
|
+
const control = determineSerializeFunctionToUse(rowItem, managerService, customFormItemConditional, customControlGenerator);
|
|
974
|
+
if (control) {
|
|
975
|
+
tableControl[rowItem.instanceId] = control;
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
const group = item.required ? new FormGroup(tableControl, Validators.required) : new FormGroup(tableControl);
|
|
980
|
+
if (item.disabled) {
|
|
981
|
+
group.disable({ onlySelf: true, emitEvent: false });
|
|
982
|
+
}
|
|
983
|
+
return group;
|
|
984
|
+
}
|
|
985
|
+
/**
|
|
986
|
+
* Returns the appropriate function for the caller to use.
|
|
987
|
+
*
|
|
988
|
+
* @param formItem FormItem requiring serialization
|
|
989
|
+
* @param customFormItemConditional Conditional for a custom FormItem
|
|
990
|
+
* @param customControlGenerator Serializer for a custom FormItem
|
|
991
|
+
*/
|
|
992
|
+
function determineSerializeFunctionToUse(formItem, managerService, customFormItemConditional = () => false, customControlGenerator) {
|
|
993
|
+
if (isForm(formItem) || isRepeatableItem(formItem) || isSection(formItem) || isFormItemGroupImpl(formItem)) {
|
|
994
|
+
return serializeFormItems(formItem, managerService, customFormItemConditional, customControlGenerator);
|
|
995
|
+
}
|
|
996
|
+
else if (isTableItem(formItem)) {
|
|
997
|
+
return serializeTableItem(formItem, managerService, customFormItemConditional, customControlGenerator);
|
|
998
|
+
}
|
|
999
|
+
else if (customFormItemConditional(formItem) && !!customControlGenerator) {
|
|
1000
|
+
return customControlGenerator(formItem);
|
|
1001
|
+
}
|
|
1002
|
+
else if (hasNestedFormItems(formItem)) {
|
|
1003
|
+
return serializeNestedOptionFormItems(formItem, managerService);
|
|
1004
|
+
}
|
|
1005
|
+
else if (isOffsetDateRangeItem(formItem) || isYearQuarterRangeItem(formItem)) {
|
|
1006
|
+
return serializeRangeItem(formItem);
|
|
1007
|
+
}
|
|
1008
|
+
else {
|
|
1009
|
+
return serializeFormItem(formItem, managerService);
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
/**
|
|
1013
|
+
* Builds a FormGroup for a range item
|
|
1014
|
+
* @param formItem FormItem for a DateRange of Date | YearQuarter
|
|
1015
|
+
*/
|
|
1016
|
+
function serializeRangeItem(formItem) {
|
|
1017
|
+
const validators = new Array();
|
|
1018
|
+
if (formItem.required) {
|
|
1019
|
+
validators.push(Validators.required);
|
|
1020
|
+
}
|
|
1021
|
+
const group = new FormGroup({
|
|
1022
|
+
start: new FormControl(formItem.value ? formItem.value.start : null),
|
|
1023
|
+
end: new FormControl(formItem.value ? formItem.value.end : null),
|
|
1024
|
+
}, Validators.compose(validators));
|
|
1025
|
+
if (formItem.disabled) {
|
|
1026
|
+
group.disable({ onlySelf: true, emitEvent: false });
|
|
1027
|
+
}
|
|
1028
|
+
return group;
|
|
1029
|
+
}
|
|
1030
|
+
/**
|
|
1031
|
+
* Returns a Validator with a numeric value for a FormItem;
|
|
1032
|
+
* Returns as an array of length 1 or 0
|
|
1033
|
+
* @param param0 `type` - type of validator, e.g. 'minLength';
|
|
1034
|
+
* `value` - parameter for the validator, e.g. 'minLength(value)'
|
|
1035
|
+
*/
|
|
1036
|
+
function getNumericValidator(type, value) {
|
|
1037
|
+
return !isNullOrUndefined(value) ? [Validators[type](value)] : [];
|
|
1038
|
+
}
|
|
1039
|
+
//#endregion
|
|
1040
|
+
//#region MtnaForm value insertion
|
|
1041
|
+
/**
|
|
1042
|
+
* Returns an array of Formitems with new values inserted.
|
|
1043
|
+
*
|
|
1044
|
+
* @param section The old Form or Form Section
|
|
1045
|
+
* @param ngFormValue ngForm JSON values
|
|
1046
|
+
* @param customFormItemConditional boolean function for any custom FormItems
|
|
1047
|
+
* @param customFormItemBuilder function to handle custom FormItems
|
|
1048
|
+
* @returns new FormItem array
|
|
1049
|
+
*/
|
|
1050
|
+
function insertFormItemValues(section, ngFormValue, disabledState, customFormItemConditional = () => false, customFormItemBuilder) {
|
|
1051
|
+
return section.items
|
|
1052
|
+
.map((item) => determineInsertFunctionToUse(item, ngFormValue[item.instanceId], disabledState, customFormItemConditional, customFormItemBuilder, section))
|
|
1053
|
+
.filter(isPresent);
|
|
1054
|
+
}
|
|
1055
|
+
/**
|
|
1056
|
+
* Returns a copied TableItem, with each row FormItem having new inserted values.
|
|
1057
|
+
* @param item TableItem to insert values
|
|
1058
|
+
* @param ngFormValue ngForm value of the TableItem
|
|
1059
|
+
* @param customFormItemConditional boolean function for any custom FormItem
|
|
1060
|
+
* @param customFormItemBuilder function to handle custom FormItem value insertion
|
|
1061
|
+
*/
|
|
1062
|
+
function insertTableItemValues(item, ngFormValue, disabledState, customFormItemConditional = () => false, customFormItemBuilder) {
|
|
1063
|
+
const tableRows = item.tableRows.map((row) => (Object.assign(Object.assign({}, row), { items: row.items
|
|
1064
|
+
.filter(isPresent)
|
|
1065
|
+
.map((formItem) => {
|
|
1066
|
+
return determineInsertFunctionToUse(formItem, ngFormValue[formItem.instanceId], disabledState, customFormItemConditional, customFormItemBuilder);
|
|
1067
|
+
})
|
|
1068
|
+
.filter(isPresent) })));
|
|
1069
|
+
return Object.assign(Object.assign({}, item), { tableRows, disabled: _isDisabled(item, disabledState) });
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Returns a new FormItem after determining the appropriate function to use.
|
|
1073
|
+
* @param formItem FormItem requiring value insertion
|
|
1074
|
+
* @param ngFormValue ngForm value
|
|
1075
|
+
* @param customFormItemConditional Conditional for a custom FormItem
|
|
1076
|
+
* @param customFormItemBuilder Value insertion function for a custom FormItem
|
|
1077
|
+
* @param disabledState Map of items' disabled state
|
|
1078
|
+
* @param parent Parent of the FormItem, used to pass to the customFormItemBuilder
|
|
1079
|
+
*/
|
|
1080
|
+
function determineInsertFunctionToUse(formItem, ngFormValue, disabledState, customFormItemConditional = () => false, customFormItemBuilder, parent) {
|
|
1081
|
+
if (isSection(formItem) || isFormItemGroupImpl(formItem) || isRepeatableItem(formItem)) {
|
|
1082
|
+
const items = insertFormItemValues(formItem, ngFormValue, disabledState, customFormItemConditional, customFormItemBuilder);
|
|
1083
|
+
return Object.assign(Object.assign({}, formItem), { items, disabled: _isDisabled(formItem, disabledState) });
|
|
1084
|
+
}
|
|
1085
|
+
else if (isTableItem(formItem)) {
|
|
1086
|
+
return insertTableItemValues(formItem, ngFormValue, disabledState, customFormItemConditional, customFormItemBuilder);
|
|
1087
|
+
}
|
|
1088
|
+
else if (customFormItemConditional(formItem) && !!customFormItemBuilder) {
|
|
1089
|
+
return customFormItemBuilder(parent, formItem, ngFormValue, disabledState);
|
|
1090
|
+
}
|
|
1091
|
+
else if (hasNestedFormItems(formItem)) {
|
|
1092
|
+
return insertNestedFormItemValues(formItem, ngFormValue, disabledState, customFormItemConditional, customFormItemBuilder);
|
|
1093
|
+
}
|
|
1094
|
+
else if (isOffsetDateRangeItem(formItem) || isYearQuarterRangeItem(formItem)) {
|
|
1095
|
+
const start = isType(ngFormValue, 'start') ? ngFormValue.start : undefined;
|
|
1096
|
+
const end = isType(ngFormValue, 'end') ? ngFormValue.end : undefined;
|
|
1097
|
+
return Object.assign(Object.assign({}, formItem), { value: { start, end }, disabled: _isDisabled(formItem, disabledState) });
|
|
1098
|
+
}
|
|
1099
|
+
else {
|
|
1100
|
+
return Object.assign(Object.assign({}, formItem), { value: findItemValue(formItem, ngFormValue), disabled: _isDisabled(formItem, disabledState) });
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Returns ngForm value for a FormItem.
|
|
1105
|
+
*
|
|
1106
|
+
* @param formItem FormItem requiring a value
|
|
1107
|
+
* @param ngFormValue ngForm value
|
|
1108
|
+
*/
|
|
1109
|
+
function findItemValue(formItem, ngFormValue) {
|
|
1110
|
+
const itemId = formItem.itemId.split('.').pop();
|
|
1111
|
+
switch (itemId === null || itemId === void 0 ? void 0 : itemId.toUpperCase()) {
|
|
1112
|
+
// FIXME: can we put these IDs in constants and refer to them instead?
|
|
1113
|
+
case 'DATEITEM':
|
|
1114
|
+
return !!ngFormValue && typeof ngFormValue !== 'string' ? ngFormValue.toISOString() : ngFormValue;
|
|
1115
|
+
case 'CHECKBOXITEM': {
|
|
1116
|
+
if (!isNullOrUndefined(ngFormValue) && Array.isArray(ngFormValue)) {
|
|
1117
|
+
const arr = ngFormValue;
|
|
1118
|
+
return formItem.options.filter((o, index) => !!arr[index]).map((o) => o.option.id);
|
|
1119
|
+
}
|
|
1120
|
+
return [];
|
|
1121
|
+
}
|
|
1122
|
+
default:
|
|
1123
|
+
return ngFormValue;
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
function insertNestedFormItemValues(formItem, ngFormValue, disabledState, customFormItemConditional = () => false, customFormItemBuilder) {
|
|
1127
|
+
const optionItemMap = {};
|
|
1128
|
+
for (const id in formItem.optionItemMap) {
|
|
1129
|
+
if (Object.prototype.hasOwnProperty.call(formItem.optionItemMap, id)) {
|
|
1130
|
+
const subItem = formItem.optionItemMap[id];
|
|
1131
|
+
optionItemMap[id] = determineInsertFunctionToUse(subItem, ngFormValue[subItem.instanceId], disabledState, customFormItemConditional, customFormItemBuilder);
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
return Object.assign(Object.assign({}, formItem), { optionItemMap, value: findItemValue(formItem, ngFormValue[formItem.instanceId]), disabled: _isDisabled(formItem, disabledState) });
|
|
1135
|
+
}
|
|
1136
|
+
//#endregion
|
|
1137
|
+
/**
|
|
1138
|
+
* Determines if a FormItem has an OptionItemMap with at least 1 item, which require their own FormControl(s)
|
|
1139
|
+
* @param formItem FormItem to check
|
|
1140
|
+
*/
|
|
1141
|
+
function hasNestedFormItems(formItem) {
|
|
1142
|
+
return isType(formItem, 'optionItemMap') && Object.keys(formItem.optionItemMap).length > 0;
|
|
1143
|
+
}
|
|
1144
|
+
/**
|
|
1145
|
+
* Function for validating min/max selections limits
|
|
1146
|
+
* @param typeCheck Which limit to validate. 'MIN' | 'MAX'
|
|
1147
|
+
* @param limit upper or lower limit to check against
|
|
1148
|
+
*/
|
|
1149
|
+
function numCheckboxesValidator(typeCheck, limit = 1) {
|
|
1150
|
+
return (control) => {
|
|
1151
|
+
let totalSelected = 0;
|
|
1152
|
+
if (isFormArray(control)) {
|
|
1153
|
+
totalSelected = control.controls.map((c) => c.value).reduce((total, next) => (next ? total + next : total), 0);
|
|
1154
|
+
}
|
|
1155
|
+
switch (typeCheck) {
|
|
1156
|
+
case 'MIN':
|
|
1157
|
+
return totalSelected >= limit ? null : { minSelected: `Select at least ${limit}` };
|
|
1158
|
+
case 'MAX':
|
|
1159
|
+
return totalSelected <= limit ? null : { maxSelected: `Select no more than ${limit}` };
|
|
1160
|
+
}
|
|
1161
|
+
};
|
|
1162
|
+
}
|
|
1163
|
+
function isFormArray(control) {
|
|
1164
|
+
return isType(control, 'controls');
|
|
1165
|
+
}
|
|
1166
|
+
function _isDisabled(item, disabledState) {
|
|
1167
|
+
const disabled = disabledState[item.instanceId];
|
|
1168
|
+
return isNullOrUndefined(disabled) ? item.disabled : disabled;
|
|
1169
|
+
}
|
|
1170
|
+
function wholeNumberPattern() {
|
|
1171
|
+
return (control) => {
|
|
1172
|
+
if (isNullOrUndefined(control.value) || isEmptyString(control.value)) {
|
|
1173
|
+
return null;
|
|
1174
|
+
}
|
|
1175
|
+
return wholeNumber.test(control.value) ? null : { wholeNumber: true };
|
|
1176
|
+
};
|
|
1177
|
+
}
|
|
1178
|
+
function numericalValueCheck() {
|
|
1179
|
+
return (control) => {
|
|
1180
|
+
if (isNullOrUndefined(control.value) || isEmptyString(control.value)) {
|
|
1181
|
+
return null;
|
|
1182
|
+
}
|
|
1183
|
+
return numOnlyWithoutComma.test(control.value) || numOnlyWithComma.test(control.value) ? null : { nonDigit: true };
|
|
1184
|
+
};
|
|
1185
|
+
}
|
|
1186
|
+
function positiveNumberPattern() {
|
|
1187
|
+
return (control) => {
|
|
1188
|
+
if (isNullOrUndefined(control.value) || isEmptyString(control.value)) {
|
|
1189
|
+
return null;
|
|
1190
|
+
}
|
|
1191
|
+
return posOnly.test(control.value) ? null : { positive: true };
|
|
1192
|
+
};
|
|
1193
|
+
}
|
|
1194
|
+
/**
|
|
1195
|
+
* This works as a combination of the angular 'min'/'max' Validators. Using the built-in validators
|
|
1196
|
+
* appears to take precedence over custom validators, regardless of order in the array. Using this function
|
|
1197
|
+
* ensures validators set before this one maintain priority. For instance, the input value failing numerical validation
|
|
1198
|
+
* is more important than the value being within min-max range.
|
|
1199
|
+
*/
|
|
1200
|
+
function numValueLimit(type, limit) {
|
|
1201
|
+
return (control) => {
|
|
1202
|
+
if (isNullOrUndefined(control.value) || isEmptyString(control.value)) {
|
|
1203
|
+
return null;
|
|
1204
|
+
}
|
|
1205
|
+
const value = parseFloat(control.value);
|
|
1206
|
+
return !isNaN(value) && (type === 'min' ? value < limit : value > limit) ? { [type]: { [type]: limit, actual: control.value } } : null;
|
|
1207
|
+
};
|
|
1208
|
+
}
|
|
1209
|
+
function isEmptyString(value) {
|
|
1210
|
+
return typeof value === 'string' && !value.length;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
var serializerUtil = /*#__PURE__*/Object.freeze({
|
|
1214
|
+
__proto__: null,
|
|
1215
|
+
serializeFormItems: serializeFormItems,
|
|
1216
|
+
serializeFormItem: serializeFormItem,
|
|
1217
|
+
serializeNestedOptionFormItems: serializeNestedOptionFormItems,
|
|
1218
|
+
serializeTableItem: serializeTableItem,
|
|
1219
|
+
determineSerializeFunctionToUse: determineSerializeFunctionToUse,
|
|
1220
|
+
serializeRangeItem: serializeRangeItem,
|
|
1221
|
+
insertFormItemValues: insertFormItemValues,
|
|
1222
|
+
insertTableItemValues: insertTableItemValues,
|
|
1223
|
+
hasNestedFormItems: hasNestedFormItems
|
|
1224
|
+
});
|
|
1225
|
+
|
|
1226
|
+
/**
|
|
1227
|
+
* Recursively find a form control by name in a form group.
|
|
1228
|
+
* Depth first search down the tree of form groups to find a control.
|
|
1229
|
+
*
|
|
1230
|
+
* @note This will only work if the entire form has unique form control names.
|
|
1231
|
+
* @param name The unique name of the form cotrol to find.
|
|
1232
|
+
* @param group The {@link FormGroup} to search through.
|
|
1233
|
+
* @returns the found control or null
|
|
1234
|
+
*/
|
|
1235
|
+
function findFormControl(name, group) {
|
|
1236
|
+
for (const key in group.controls) {
|
|
1237
|
+
if (Object.prototype.hasOwnProperty.call(group.controls, key)) {
|
|
1238
|
+
const control = group.controls[key];
|
|
1239
|
+
if (key === name) {
|
|
1240
|
+
return control;
|
|
1241
|
+
}
|
|
1242
|
+
// Recurse down if it's a FormGroup
|
|
1243
|
+
if (isFormGroup(control)) {
|
|
1244
|
+
const found = findFormControl(name, control);
|
|
1245
|
+
if (found) {
|
|
1246
|
+
return found;
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
return null;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
/**
|
|
1255
|
+
* Recursively find a {@link FormItem} by instanceId in a {@link Form}.
|
|
1256
|
+
* Depth first search down the tree of {@link FormItemGroup} to find an item.
|
|
1257
|
+
*
|
|
1258
|
+
* @param instanceId The unique ID of the {@link FormItem} to find.
|
|
1259
|
+
* @param group The {@link Form} or {@link FormItemGroup} to search through.
|
|
1260
|
+
* @returns the found {@link FormItem} or `null`
|
|
1261
|
+
*/
|
|
1262
|
+
function findFormItem(instanceId, group) {
|
|
1263
|
+
for (const item of group.items) {
|
|
1264
|
+
if (item.instanceId === instanceId) {
|
|
1265
|
+
return item;
|
|
1266
|
+
}
|
|
1267
|
+
// If it's a FormGroup, search through it's children
|
|
1268
|
+
if (isType(item, 'items')) {
|
|
1269
|
+
const found = findFormItem(instanceId, item);
|
|
1270
|
+
if (found) {
|
|
1271
|
+
return found;
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
return null;
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
class BaseFormStep {
|
|
1279
|
+
constructor(instanceId) {
|
|
1280
|
+
this.instanceId = instanceId;
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
class FormStepGroup extends BaseFormStep {
|
|
1285
|
+
constructor(steps, instanceId, collapsed = false) {
|
|
1286
|
+
super(instanceId);
|
|
1287
|
+
this.steps = steps;
|
|
1288
|
+
this.collapsed = collapsed;
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
function isFormStepGroup(something) {
|
|
1292
|
+
return isType(something, 'steps') && Array.isArray(something.steps);
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
class FormStep extends BaseFormStep {
|
|
1296
|
+
constructor(num, label, instanceId, optional = false) {
|
|
1297
|
+
super(instanceId);
|
|
1298
|
+
this.num = num;
|
|
1299
|
+
this.label = label;
|
|
1300
|
+
this.optional = optional;
|
|
1301
|
+
this.active = false;
|
|
1302
|
+
this.status = 'INVALID';
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
/**
|
|
1307
|
+
* Flattens formStepGroup.steps and combines all steps into single array
|
|
1308
|
+
* @param steps Array<FormStep | FormStepGroup>
|
|
1309
|
+
* @returns FormStep[] array of the steps and children of step groups
|
|
1310
|
+
*/
|
|
1311
|
+
function flattenSteps(steps) {
|
|
1312
|
+
return steps.reduce((a, b) => a.concat(isFormStepGroup(b) ? b.steps : b), new Array());
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
function generateFormSteps(items) {
|
|
1316
|
+
// Build up an array of steps based on the form items
|
|
1317
|
+
return items.reduce((newArray, item) => {
|
|
1318
|
+
// The number of non-group steps, used to number the top level steps
|
|
1319
|
+
const count = newArray.filter((step) => !isFormStepGroup(step)).length;
|
|
1320
|
+
if (isSection(item)) {
|
|
1321
|
+
// If the item is a Section, add a step
|
|
1322
|
+
newArray.push(new FormStep(count + 1, item.title.value || 'No Title', item.instanceId, !item.required));
|
|
1323
|
+
}
|
|
1324
|
+
else if (isDataCubeItem(item)) {
|
|
1325
|
+
// If the item is a DataCubeItem, add a step
|
|
1326
|
+
// and add a group step for the sub-sections
|
|
1327
|
+
newArray.push(new FormStep(count + 1, item.title.value || '', item.instanceId, !item.required));
|
|
1328
|
+
const subSectionSteps = item.items
|
|
1329
|
+
.filter(isSection)
|
|
1330
|
+
.map((item, index) => new FormStep(`${count + 1}${toLetters(index + 1)}`, item.title.value || '', item.instanceId, !item.required));
|
|
1331
|
+
newArray.push(new FormStepGroup(subSectionSteps, item.instanceId, false));
|
|
1332
|
+
}
|
|
1333
|
+
return newArray;
|
|
1334
|
+
}, []);
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
/**
|
|
1338
|
+
* Update a {@link FormStep}'s `status`.
|
|
1339
|
+
* The server side form validation errors will trump the provided `status`.
|
|
1340
|
+
*
|
|
1341
|
+
* @param instanceId the instanceId of the step to update, otherwise return the original step
|
|
1342
|
+
* @param step the step to check
|
|
1343
|
+
* @param status the new status to apply to the step
|
|
1344
|
+
* @param form the containing form
|
|
1345
|
+
* @returns an updated step with the correct status
|
|
1346
|
+
*/
|
|
1347
|
+
function updateStepStatus(instanceId, step, status, form) {
|
|
1348
|
+
var _a;
|
|
1349
|
+
if (instanceId !== step.instanceId) {
|
|
1350
|
+
// These aren't the droids you're looking for.
|
|
1351
|
+
// Return unmodified step.
|
|
1352
|
+
return step;
|
|
1353
|
+
}
|
|
1354
|
+
// A server validation error will trump the provided status
|
|
1355
|
+
if ((_a = form === null || form === void 0 ? void 0 : form.validationResult) === null || _a === void 0 ? void 0 : _a.formItemValidationResults.length) {
|
|
1356
|
+
// Get the FormGroup that represents the step
|
|
1357
|
+
const group = findFormItem(step.instanceId, form);
|
|
1358
|
+
if (isType(group, 'items')) {
|
|
1359
|
+
for (const error of form.validationResult.formItemValidationResults) {
|
|
1360
|
+
const itemWithError = findFormItem(error.id, group);
|
|
1361
|
+
// If the invalid item is within the step group,
|
|
1362
|
+
// show an error state
|
|
1363
|
+
if (itemWithError) {
|
|
1364
|
+
return Object.assign(Object.assign({}, step), { status: 'ERROR' });
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
// There were no server side validation errors, just update the status
|
|
1370
|
+
return Object.assign(Object.assign({}, step), { status });
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
class MtnaWfNgFormService {
|
|
1374
|
+
constructor() {
|
|
1375
|
+
this.unsavedChanges$ = new BehaviorSubject(false);
|
|
1376
|
+
}
|
|
1377
|
+
/**
|
|
1378
|
+
* Informs a caller when the MtnaForm is dirty and has unsaved changes.
|
|
1379
|
+
*/
|
|
1380
|
+
get unsavedChanges() {
|
|
1381
|
+
return this.unsavedChanges$.asObservable();
|
|
1382
|
+
}
|
|
1383
|
+
/**
|
|
1384
|
+
* Add a control from the ngForm
|
|
1385
|
+
* @param controlId id of the control being added
|
|
1386
|
+
* @param parentIds array of ids representing the path to the parent control
|
|
1387
|
+
* @param newControl the new form control to be added
|
|
1388
|
+
*/
|
|
1389
|
+
addControl(controlId, parentIds, newControl) {
|
|
1390
|
+
if (!this.ngForm) {
|
|
1391
|
+
return;
|
|
1392
|
+
}
|
|
1393
|
+
const parentControl = this.ngForm.get(parentIds);
|
|
1394
|
+
parentControl.addControl(controlId, newControl);
|
|
1395
|
+
parentControl.markAsTouched();
|
|
1396
|
+
parentControl.markAsDirty();
|
|
1397
|
+
this.forceUnsavedChange();
|
|
1398
|
+
}
|
|
1399
|
+
/**
|
|
1400
|
+
* Remove a control from the ngForm.
|
|
1401
|
+
*
|
|
1402
|
+
* @param controlId is of the control to remove
|
|
1403
|
+
* @param parentIds rray of ids representing the path to the parent control
|
|
1404
|
+
*/
|
|
1405
|
+
removeControl(controlId, parentIds) {
|
|
1406
|
+
if (!this.ngForm) {
|
|
1407
|
+
return;
|
|
1408
|
+
}
|
|
1409
|
+
const parentControl = this.ngForm.get(parentIds);
|
|
1410
|
+
parentControl.removeControl(controlId);
|
|
1411
|
+
parentControl.markAsTouched();
|
|
1412
|
+
parentControl.markAsDirty();
|
|
1413
|
+
this.forceUnsavedChange();
|
|
1414
|
+
}
|
|
1415
|
+
/**
|
|
1416
|
+
* Get the form if it exists
|
|
1417
|
+
* @returns the angular form or null
|
|
1418
|
+
*/
|
|
1419
|
+
getForm() {
|
|
1420
|
+
return this.ngForm;
|
|
1421
|
+
}
|
|
1422
|
+
/**
|
|
1423
|
+
* Returns a JSON representation of form values
|
|
1424
|
+
*/
|
|
1425
|
+
getFormValue() {
|
|
1426
|
+
var _a;
|
|
1427
|
+
// This includes values for disabled controls.
|
|
1428
|
+
// We loop through MtnaForm to insert values,
|
|
1429
|
+
// so we need the disabled controls to ensure no info loss.
|
|
1430
|
+
return (_a = this.ngForm) === null || _a === void 0 ? void 0 : _a.getRawValue();
|
|
1431
|
+
}
|
|
1432
|
+
/**
|
|
1433
|
+
* @returns Whether a form has been set on this service
|
|
1434
|
+
*/
|
|
1435
|
+
hasForm() {
|
|
1436
|
+
return !!this.ngForm;
|
|
1437
|
+
}
|
|
1438
|
+
/**
|
|
1439
|
+
* @returns Whether the form is dirty.
|
|
1440
|
+
*/
|
|
1441
|
+
isFormDirty() {
|
|
1442
|
+
return !!this.ngForm && this.ngForm.dirty;
|
|
1443
|
+
}
|
|
1444
|
+
/**
|
|
1445
|
+
* Unsubscribes from value changes & sets the ngForm to null.
|
|
1446
|
+
* Should be called when any component using an MtnaForm is destroyed.
|
|
1447
|
+
*/
|
|
1448
|
+
disposeForm() {
|
|
1449
|
+
this.unsubscribeValueChanges();
|
|
1450
|
+
this.ngForm = undefined;
|
|
1451
|
+
}
|
|
1452
|
+
/**
|
|
1453
|
+
* Forces the unsavedChanges observable to emit true.
|
|
1454
|
+
* Use with care, one example is when repeatable items are added/removed from the form.
|
|
1455
|
+
*/
|
|
1456
|
+
forceUnsavedChange() {
|
|
1457
|
+
this.unsubscribeValueChanges();
|
|
1458
|
+
this.unsavedChanges$.next(true);
|
|
1459
|
+
}
|
|
1460
|
+
/**
|
|
1461
|
+
* Marks ngForm as pristine & untouched.
|
|
1462
|
+
*/
|
|
1463
|
+
markAsPristineAndUntouched() {
|
|
1464
|
+
if (this.ngForm) {
|
|
1465
|
+
this.ngForm.markAsPristine();
|
|
1466
|
+
this.ngForm.markAsUntouched();
|
|
1467
|
+
this.unsavedChanges$.next(this.ngForm.dirty);
|
|
1468
|
+
this.observeNgFormChanges();
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
/**
|
|
1472
|
+
* Resets the ngForm.
|
|
1473
|
+
*/
|
|
1474
|
+
resetForm() {
|
|
1475
|
+
if (this.ngForm) {
|
|
1476
|
+
this.ngForm.reset();
|
|
1477
|
+
this.unsavedChanges$.next(this.ngForm.dirty);
|
|
1478
|
+
this.observeNgFormChanges();
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
/**
|
|
1482
|
+
* Sets a FormGroup on the service so an external source may observe changes.
|
|
1483
|
+
* @param ngForm FormGroup to be registered.
|
|
1484
|
+
*/
|
|
1485
|
+
setForm(ngForm) {
|
|
1486
|
+
this.ngForm = ngForm;
|
|
1487
|
+
this.unsavedChanges$.next(this.ngForm.dirty);
|
|
1488
|
+
if (this.ngForm.pristine) {
|
|
1489
|
+
this.observeNgFormChanges();
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
/**
|
|
1493
|
+
* Subscribes to ngForm status changes & updates the unsavedChanges observable
|
|
1494
|
+
*/
|
|
1495
|
+
observeNgFormChanges() {
|
|
1496
|
+
this.unsubscribeValueChanges();
|
|
1497
|
+
if (this.ngForm) {
|
|
1498
|
+
this.valueChangeSubscription = this.ngForm.valueChanges
|
|
1499
|
+
.pipe(skipWhile(() => (this.ngForm ? this.ngForm.pristine : true)), take(1))
|
|
1500
|
+
.subscribe(() => { var _a; return this.unsavedChanges$.next((_a = this.ngForm) === null || _a === void 0 ? void 0 : _a.dirty); });
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
/**
|
|
1504
|
+
* Removes the ngForm status change subscription.
|
|
1505
|
+
*/
|
|
1506
|
+
unsubscribeValueChanges() {
|
|
1507
|
+
if (!!this.valueChangeSubscription && !this.valueChangeSubscription.closed) {
|
|
1508
|
+
this.valueChangeSubscription.unsubscribe();
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
MtnaWfNgFormService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfNgFormService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1513
|
+
MtnaWfNgFormService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfNgFormService, providedIn: 'root' });
|
|
1514
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfNgFormService, decorators: [{
|
|
1515
|
+
type: Injectable,
|
|
1516
|
+
args: [{ providedIn: 'root' }]
|
|
1517
|
+
}] });
|
|
1518
|
+
|
|
1519
|
+
/**
|
|
1520
|
+
* Allows a caller to (de)serializae an MtnaForm. It contains the determining logic for returning specific form controls
|
|
1521
|
+
* and deserializing new MtnaForms from the reactive values, as well as registering custom Form Items & functions.
|
|
1522
|
+
*
|
|
1523
|
+
* @export
|
|
1524
|
+
*/
|
|
1525
|
+
class MtnaWfManagerService {
|
|
1526
|
+
constructor(apiService, ngFormManager, uiService) {
|
|
1527
|
+
this.apiService = apiService;
|
|
1528
|
+
this.ngFormManager = ngFormManager;
|
|
1529
|
+
this.uiService = uiService;
|
|
1530
|
+
this.components = new Map();
|
|
1531
|
+
this.formChange$ = new Subject();
|
|
1532
|
+
/** A map of all {@link FormItemValidationResult} keyed on id */
|
|
1533
|
+
this._formItemValidationResults = {};
|
|
1534
|
+
/**
|
|
1535
|
+
* Any FormService extension class should override this method in order to call the
|
|
1536
|
+
* dynamicWebFormItemBuilder/dynamicReactiveFormControlBuilder methods. During web form generation, this method is checked &
|
|
1537
|
+
* the current FormItem is passed in, which can be used by the overriding method.
|
|
1538
|
+
*
|
|
1539
|
+
* @example dynamicFormConditional = (item: FormItem) => item.itemId.includes({some itemId})
|
|
1540
|
+
*
|
|
1541
|
+
*/
|
|
1542
|
+
this.dynamicFormConditional = () => false;
|
|
1543
|
+
}
|
|
1544
|
+
/**
|
|
1545
|
+
* Observable stream of MtnaForm changes. Used to inform a subscriber that an MtnaForm has been changed.
|
|
1546
|
+
*
|
|
1547
|
+
* @returns Observable<MtnaForm> to which a caller can subscribe
|
|
1548
|
+
*/
|
|
1549
|
+
get formChanges() {
|
|
1550
|
+
return this.formChange$.asObservable();
|
|
1551
|
+
}
|
|
1552
|
+
/**
|
|
1553
|
+
* Adds or removes a FormItem from the form & modifies other affected FormItems
|
|
1554
|
+
* @param change MtnaWfFormItemChange
|
|
1555
|
+
*/
|
|
1556
|
+
changeMtnaFormItem(change) {
|
|
1557
|
+
if (!this._mtnaForm) {
|
|
1558
|
+
return;
|
|
1559
|
+
}
|
|
1560
|
+
if (change.actionType === 'REMOVE') {
|
|
1561
|
+
// remove the repeatable item from the mtnaform
|
|
1562
|
+
let newForm = this._modifyFormItem(this._mtnaForm, change);
|
|
1563
|
+
// modify the conditions of all effected form items
|
|
1564
|
+
newForm = this._modifyFormItemConditions(newForm, change);
|
|
1565
|
+
this.ngFormManager.removeControl(change.id, change.parentIds);
|
|
1566
|
+
this.formChange$.next(newForm);
|
|
1567
|
+
}
|
|
1568
|
+
else {
|
|
1569
|
+
this.apiService
|
|
1570
|
+
.getRepeatableItem(this._mtnaForm.instanceId, change.id)
|
|
1571
|
+
.pipe(take(1))
|
|
1572
|
+
.subscribe((newItem) => {
|
|
1573
|
+
const newFormControl = this.serializeMtnaFormItem(newItem);
|
|
1574
|
+
if (newFormControl && this._mtnaForm) {
|
|
1575
|
+
this.ngFormManager.addControl(newItem.instanceId, change.parentIds, newFormControl);
|
|
1576
|
+
// Add the new repeatable item into the mtnaform
|
|
1577
|
+
let newForm = this._modifyFormItem(this._mtnaForm, Object.assign(Object.assign({}, change), { id: newItem.instanceId }), newItem);
|
|
1578
|
+
// Generate a list of all formitem conditions needing change & modify those items in the form
|
|
1579
|
+
const conditionChanges = this.generateConditionChangeArray(newItem, 'ADD');
|
|
1580
|
+
newForm = this._modifyFormItemConditions(newForm, Object.assign(Object.assign({}, change), { conditionChanges }));
|
|
1581
|
+
this.itemToggleQue = conditionChanges;
|
|
1582
|
+
// emit the new mtnaform
|
|
1583
|
+
this.formChange$.next(newForm);
|
|
1584
|
+
}
|
|
1585
|
+
});
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
/**
|
|
1589
|
+
* Returns a ConditionChange array for items existing in the <item> which enable/disable FormItems outside the <item>'s scope.
|
|
1590
|
+
* @param item FormItem that effects the condition of other FormItems
|
|
1591
|
+
* @param action Whether this item was added (ADD), or removed (REMOVE)
|
|
1592
|
+
* @returns Array<ConditionChange>
|
|
1593
|
+
*/
|
|
1594
|
+
generateConditionChangeArray(item, action) {
|
|
1595
|
+
const internalMap = {};
|
|
1596
|
+
this._buildInternalIdsMap(item, internalMap);
|
|
1597
|
+
const conditionChanges = new Array();
|
|
1598
|
+
this._buildConditionChangeArray(item, conditionChanges, internalMap, action);
|
|
1599
|
+
return conditionChanges;
|
|
1600
|
+
}
|
|
1601
|
+
/** @returns The top level validation results (usually the errors), keyed on ID. */
|
|
1602
|
+
getFormItemValidationResults() {
|
|
1603
|
+
return this._formItemValidationResults;
|
|
1604
|
+
}
|
|
1605
|
+
/**
|
|
1606
|
+
* Returns a new MtnaForm using the previous MtnaForm & reactive form values.
|
|
1607
|
+
*
|
|
1608
|
+
* @param mtnaForm MtnaForm requiring value insertion
|
|
1609
|
+
* @param ngFormValues JSON object of ngForm values
|
|
1610
|
+
* @returns new MtnaForm
|
|
1611
|
+
*/
|
|
1612
|
+
insertNewValues(mtnaForm, ngFormValues) {
|
|
1613
|
+
return Object.assign(Object.assign({}, mtnaForm), { items: insertFormItemValues(mtnaForm, ngFormValues, this.uiService.getDisabledStates(), this.dynamicFormConditional, this.dynamicWebFormItemBuilder) });
|
|
1614
|
+
}
|
|
1615
|
+
/**
|
|
1616
|
+
* Serializes a Form | FormItem into FormControl(s)
|
|
1617
|
+
*
|
|
1618
|
+
* @param item Form | FormItem requiring serialization
|
|
1619
|
+
* @returns FormGroup | FormControl
|
|
1620
|
+
*/
|
|
1621
|
+
serializeMtnaFormItem(item) {
|
|
1622
|
+
return determineSerializeFunctionToUse(item, this, this.dynamicFormConditional, this.dynamicReactiveFormControlBuilder);
|
|
1623
|
+
}
|
|
1624
|
+
//#region Custom Component/Function Registration
|
|
1625
|
+
getDynamicComponent(id) {
|
|
1626
|
+
return this.components.get(id);
|
|
1627
|
+
}
|
|
1628
|
+
/**
|
|
1629
|
+
* Registers a map of components to be dynamically rendered inside an MtnaForm.
|
|
1630
|
+
*
|
|
1631
|
+
* @param components the map of components that a ValueItem will use for rendering
|
|
1632
|
+
* @prop string - the type(itemId suffix) of component, used for retrieval
|
|
1633
|
+
* @prop Type - the component to be rendered, an extension of BaseFormItem
|
|
1634
|
+
*/
|
|
1635
|
+
registerDynamicComponents(components) {
|
|
1636
|
+
this.components = components;
|
|
1637
|
+
}
|
|
1638
|
+
/**
|
|
1639
|
+
* Sets an MtnaForm on the service
|
|
1640
|
+
* @param form MtnaForm to be used for internal modification
|
|
1641
|
+
*/
|
|
1642
|
+
setMtnaForm(form) {
|
|
1643
|
+
this._mtnaForm = Object.assign({}, form);
|
|
1644
|
+
if (!!this.itemToggleQue && !!this.itemToggleQue.length) {
|
|
1645
|
+
// The form needs time to rerender, so we push this loop to the end of the stack
|
|
1646
|
+
setTimeout(() => {
|
|
1647
|
+
if (this.itemToggleQue) {
|
|
1648
|
+
for (const change of this.itemToggleQue) {
|
|
1649
|
+
this.uiService.toggleFormItems(change.enabledItems, change.disabledItems, !!change.enable, change.enablerId, true);
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
this.itemToggleQue = null;
|
|
1653
|
+
}, 0);
|
|
1654
|
+
}
|
|
1655
|
+
// Keep track of any errors coming from the server and revalidate those controls
|
|
1656
|
+
this._updateServerSideErrors();
|
|
1657
|
+
}
|
|
1658
|
+
/**
|
|
1659
|
+
* Function to be overridden by extended service in order to handle form generation for any application-specific dynamic form components.
|
|
1660
|
+
* Should return a new ValueItem<any>.
|
|
1661
|
+
* Step 3
|
|
1662
|
+
*
|
|
1663
|
+
* @example dynamicWebFormItemBuilder(section: Section | Form, item: FormItem, ngFormValue: any): ValueItem {
|
|
1664
|
+
* const newValue = this.generateNewValue(item, rfValue, section);
|
|
1665
|
+
* return { ...item, ...newValue }
|
|
1666
|
+
* }
|
|
1667
|
+
* @param section the current FormSection
|
|
1668
|
+
* @param item the current FormItem
|
|
1669
|
+
* @param ngFormValue the ngForm JSON value
|
|
1670
|
+
* @returns a new ValueItem
|
|
1671
|
+
*/
|
|
1672
|
+
dynamicWebFormItemBuilder(
|
|
1673
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
1674
|
+
section, item, ngFormValue, disabledState
|
|
1675
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
1676
|
+
) {
|
|
1677
|
+
return null;
|
|
1678
|
+
}
|
|
1679
|
+
/**
|
|
1680
|
+
* Function to be overridden by extended service in order to handle reactive form generation
|
|
1681
|
+
* for any application-specific dynamic form components.
|
|
1682
|
+
* Should return FormControl | FormGroup.
|
|
1683
|
+
*
|
|
1684
|
+
* @example dynamicReactiveFormControlBuilder(item: FormItem) {
|
|
1685
|
+
* return this.buildFormControlForDynamicComponent(item: FormItem);
|
|
1686
|
+
* }
|
|
1687
|
+
* @param item FormItem used to generate form controls
|
|
1688
|
+
* @returns FormControl | FormGroup
|
|
1689
|
+
*/
|
|
1690
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1691
|
+
dynamicReactiveFormControlBuilder(item) {
|
|
1692
|
+
return null;
|
|
1693
|
+
}
|
|
1694
|
+
//#endregion
|
|
1695
|
+
//#region INTERNAL METHODS
|
|
1696
|
+
/**
|
|
1697
|
+
* Recursively traverses a Form to insert or remove a designated FormItem.
|
|
1698
|
+
* @param item MtnaForm to search through
|
|
1699
|
+
* @param change: MtnaWfFormItemChange for adding or removing a FormItem
|
|
1700
|
+
* @param newItem FormItem to add to its parent
|
|
1701
|
+
*/
|
|
1702
|
+
_modifyFormItem(item, change, newItem) {
|
|
1703
|
+
if (!change.parentIds.length) {
|
|
1704
|
+
// At this point, we reach the Parent FormItem
|
|
1705
|
+
if (change.actionType === 'REPLACE') {
|
|
1706
|
+
if ('items' in item) {
|
|
1707
|
+
const index = item.items.findIndex((i) => i.instanceId === (newItem === null || newItem === void 0 ? void 0 : newItem.instanceId));
|
|
1708
|
+
const newItems = [...item.items];
|
|
1709
|
+
if (newItem) {
|
|
1710
|
+
newItems.splice(index, 1, newItem);
|
|
1711
|
+
}
|
|
1712
|
+
return Object.assign(Object.assign({}, item), { items: newItems });
|
|
1713
|
+
}
|
|
1714
|
+
return item;
|
|
1715
|
+
}
|
|
1716
|
+
else if (isRepeatableItem(item)) {
|
|
1717
|
+
return Object.assign(Object.assign({}, item), { items: change.actionType === 'ADD' ? item.items.concat(newItem || []) : item.items.filter((i) => i.instanceId !== change.id) });
|
|
1718
|
+
}
|
|
1719
|
+
else {
|
|
1720
|
+
return item;
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
if (isForm(item) || isSection(item) || isFormItemGroupImpl(item) || isRepeatableItem(item)) {
|
|
1724
|
+
const items = [...item.items];
|
|
1725
|
+
const indexToModify = item.items.findIndex((i) => i.instanceId === change.parentIds[0]);
|
|
1726
|
+
const itemToModify = item.items[indexToModify];
|
|
1727
|
+
items.splice(indexToModify, 1, this._modifyFormItem(itemToModify, Object.assign(Object.assign({}, change), { parentIds: change.parentIds.slice(1) }), newItem));
|
|
1728
|
+
return Object.assign(Object.assign({}, item), { items });
|
|
1729
|
+
}
|
|
1730
|
+
else if (isTableItem(item)) {
|
|
1731
|
+
return this._modifyTableItem(item, change, newItem);
|
|
1732
|
+
}
|
|
1733
|
+
else if (isOptionItemImpl(item) || isOptionGroupItemImpl(item)) {
|
|
1734
|
+
return this._modifyOptionItem(item, change, newItem)[0];
|
|
1735
|
+
}
|
|
1736
|
+
return item;
|
|
1737
|
+
}
|
|
1738
|
+
/**
|
|
1739
|
+
* Traverses an OptionItemMap of a FormItem to insert or remove a designated FormItem
|
|
1740
|
+
* @param optionItem FormItem with an optionItemMap, e.g. OptionItemImpl | OptionGroupItemImpl
|
|
1741
|
+
* @param change MtnaWfFormItemChange for adding or removing a FormItem
|
|
1742
|
+
* @param newItem FormItem to be added to its parent
|
|
1743
|
+
* @returns FormItem with an optionItemMap containing FormItems
|
|
1744
|
+
*/
|
|
1745
|
+
_modifyOptionItem(optionItem, change, newItem) {
|
|
1746
|
+
let found = false;
|
|
1747
|
+
const optionItemMap = {};
|
|
1748
|
+
// Loop through the map and set the items to a new map
|
|
1749
|
+
// Check if any FormItem in the map matches the next parent ID
|
|
1750
|
+
for (const id in optionItem.optionItemMap) {
|
|
1751
|
+
if (Object.prototype.hasOwnProperty.call(optionItem.optionItemMap, id)) {
|
|
1752
|
+
// If one matches, modify & set it on the new map
|
|
1753
|
+
if (optionItem.optionItemMap[id].instanceId === change.parentIds[0]) {
|
|
1754
|
+
found = true;
|
|
1755
|
+
optionItemMap[id] = this._modifyFormItem(optionItem.optionItemMap[id], Object.assign(Object.assign({}, change), { parentIds: change.parentIds.slice(1) }), newItem);
|
|
1756
|
+
}
|
|
1757
|
+
else {
|
|
1758
|
+
optionItemMap[id] = optionItem.optionItemMap[id];
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
// return the item with its new optionItemMap, & whether we found the matching item
|
|
1763
|
+
return [Object.assign(Object.assign({}, optionItem), { optionItemMap }), found];
|
|
1764
|
+
}
|
|
1765
|
+
/**
|
|
1766
|
+
* Traverses table rows to insert or remove a FormItem
|
|
1767
|
+
* @param tableItem TableItem to traverse
|
|
1768
|
+
* @param change MtnaWfFormItemChange for adding or removing a FormItem
|
|
1769
|
+
* @param newItem FormItem to be added to its parent
|
|
1770
|
+
* @returns TableItem with a FormItem added or removed
|
|
1771
|
+
*/
|
|
1772
|
+
_modifyTableItem(tableItem, change, newItem) {
|
|
1773
|
+
let found = false;
|
|
1774
|
+
// Map the table rows to find the FormItem with matching instanceId
|
|
1775
|
+
const tableRows = tableItem.tableRows.map((row) => {
|
|
1776
|
+
// If the item was found, skip mapping further rows
|
|
1777
|
+
if (!found) {
|
|
1778
|
+
return Object.assign(Object.assign({}, row), { items: row.items.map((rowItem) => {
|
|
1779
|
+
// If we found the next matching FormItem, toggle 'found', and return the modified FormItem
|
|
1780
|
+
if (!!rowItem && rowItem.instanceId === change.parentIds[0]) {
|
|
1781
|
+
found = true;
|
|
1782
|
+
return this._modifyFormItem(rowItem, Object.assign(Object.assign({}, change), { parentIds: change.parentIds.slice(1) }), newItem);
|
|
1783
|
+
}
|
|
1784
|
+
// If the FormItem instanceId doesn't match, but it has FormItems in its 'optionItemMap',
|
|
1785
|
+
// We need to check if a matching FormItem exists in its map
|
|
1786
|
+
if ('optionItemMap' in rowItem) {
|
|
1787
|
+
const returned = this._modifyOptionItem(rowItem, change, newItem);
|
|
1788
|
+
found = returned[1];
|
|
1789
|
+
return returned[0];
|
|
1790
|
+
}
|
|
1791
|
+
return rowItem;
|
|
1792
|
+
}) });
|
|
1793
|
+
}
|
|
1794
|
+
return row;
|
|
1795
|
+
});
|
|
1796
|
+
return Object.assign(Object.assign({}, tableItem), { tableRows });
|
|
1797
|
+
}
|
|
1798
|
+
/**
|
|
1799
|
+
* Adds or removes instanceIds from the 'itemIds' in a FormItem's condition
|
|
1800
|
+
* @param form MtnaForm to search through & replace formitems with the new condition
|
|
1801
|
+
* @param change The change that recently occurred in the mtnaForm
|
|
1802
|
+
*/
|
|
1803
|
+
_modifyFormItemConditions(form, change) {
|
|
1804
|
+
let newForm = form;
|
|
1805
|
+
if (change.conditionChanges) {
|
|
1806
|
+
const formItems = {};
|
|
1807
|
+
for (const cc of change.conditionChanges) {
|
|
1808
|
+
for (const toggledId of [...cc.enabledItems, ...cc.disabledItems]) {
|
|
1809
|
+
let formItem = formItems[toggledId];
|
|
1810
|
+
const formItemComponent = this.uiService.getItem(toggledId);
|
|
1811
|
+
if (!formItem && (formItemComponent === null || formItemComponent === void 0 ? void 0 : formItemComponent.item)) {
|
|
1812
|
+
formItem = formItemComponent === null || formItemComponent === void 0 ? void 0 : formItemComponent.item;
|
|
1813
|
+
}
|
|
1814
|
+
if (isConditionalItem(formItem) && formItem.condition) {
|
|
1815
|
+
const itemConditionItemIds = formItem.condition.itemIds || [];
|
|
1816
|
+
const itemIds = change.actionType === 'ADD'
|
|
1817
|
+
? [...itemConditionItemIds, cc.enablerId]
|
|
1818
|
+
: itemConditionItemIds.filter((i) => i !== cc.enablerId);
|
|
1819
|
+
const newItem = Object.assign(Object.assign({}, formItem), { condition: Object.assign(Object.assign({}, formItem.condition), { itemIds }) });
|
|
1820
|
+
const newChange = new MtnaWfFormItemChange(newItem.instanceId, (formItemComponent === null || formItemComponent === void 0 ? void 0 : formItemComponent.parentIds) || [], 'REPLACE');
|
|
1821
|
+
newForm = this._modifyFormItem(newForm, newChange, newItem);
|
|
1822
|
+
formItems[toggledId] = newItem;
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
if (change.actionType === 'REMOVE') {
|
|
1826
|
+
this.uiService.toggleFormItems(cc.enabledItems, cc.disabledItems, !!cc.enable, cc.enablerId);
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
return newForm;
|
|
1831
|
+
}
|
|
1832
|
+
/**
|
|
1833
|
+
* Builds a map of all instanceIds inside an item. Checks 'items' & 'optionItemMap'
|
|
1834
|
+
* @param item Item to recurse
|
|
1835
|
+
* @param idMap map of the item's internal instanceIds
|
|
1836
|
+
*/
|
|
1837
|
+
_buildInternalIdsMap(item, idMap) {
|
|
1838
|
+
idMap[item.instanceId] = true;
|
|
1839
|
+
if (isType(item, 'items')) {
|
|
1840
|
+
const items = item.items;
|
|
1841
|
+
for (const subItem of items) {
|
|
1842
|
+
this._buildInternalIdsMap(subItem, idMap);
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
else if (isType(item, 'optionItemMap')) {
|
|
1846
|
+
const map = item.optionItemMap;
|
|
1847
|
+
for (const id in map) {
|
|
1848
|
+
if (Object.prototype.hasOwnProperty.call(map, id)) {
|
|
1849
|
+
this._buildInternalIdsMap(map[id], idMap);
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
/**
|
|
1855
|
+
* Builds an array of ConditionChanges to be implemented in an MtnaForm.
|
|
1856
|
+
* @param item FormItem that was added/removed, which affects conditions of other FormItems
|
|
1857
|
+
* @param changes Array to build up
|
|
1858
|
+
* @param internalIdMap Map of all instanceIds located in the item; in order to exclude them from the condition changes
|
|
1859
|
+
* @param action Whether the item was added or removed
|
|
1860
|
+
*/
|
|
1861
|
+
_buildConditionChangeArray(item, changes, internalIdMap, action) {
|
|
1862
|
+
if (isOptionItemImpl(item)) {
|
|
1863
|
+
const enable = !!action && action === 'ADD' ? item.option.selected || item.value === item.option.option.id : false;
|
|
1864
|
+
this._pushConditionToArray(item.instanceId, item.option.enabledItems, item.option.disabledItems, changes, internalIdMap, enable);
|
|
1865
|
+
this._buildArrayFromOptionItemMap(item, changes, internalIdMap);
|
|
1866
|
+
}
|
|
1867
|
+
else if (isOptionGroupItemImpl(item)) {
|
|
1868
|
+
for (const option of item.options) {
|
|
1869
|
+
const enable = !!action && action === 'ADD' ? option.selected || (!!item.value && item.value.some((v) => v === option.option.id)) : false;
|
|
1870
|
+
this._pushConditionToArray(item.instanceId, option.enabledItems, option.disabledItems, changes, internalIdMap, enable);
|
|
1871
|
+
}
|
|
1872
|
+
this._buildArrayFromOptionItemMap(item, changes, internalIdMap, action);
|
|
1873
|
+
}
|
|
1874
|
+
else if (isType(item, 'items')) {
|
|
1875
|
+
const items = item.items;
|
|
1876
|
+
for (const subItem of items) {
|
|
1877
|
+
this._buildConditionChangeArray(subItem, changes, internalIdMap, action);
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
/**
|
|
1882
|
+
* Builds an array of ConditionChanges from an item's optionItemMap
|
|
1883
|
+
* @param item FormItem with an optionItemMap
|
|
1884
|
+
* @param conditions Array of ConditionChanges to push on new changes
|
|
1885
|
+
* @param itemMap map of instanceIds exisiting in an item; in order to exclude them from the changes
|
|
1886
|
+
* @param action Whether an item was added or removed
|
|
1887
|
+
*/
|
|
1888
|
+
_buildArrayFromOptionItemMap(item, conditions, itemMap, action) {
|
|
1889
|
+
if (item.optionItemMap) {
|
|
1890
|
+
for (const id in item.optionItemMap) {
|
|
1891
|
+
if (Object.prototype.hasOwnProperty.call(item.optionItemMap, id)) {
|
|
1892
|
+
const subItem = item.optionItemMap[id];
|
|
1893
|
+
this._buildConditionChangeArray(subItem, conditions, itemMap, action);
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
/**
|
|
1899
|
+
* Pushes a new ConditionChange onto the conditions array. If a ConditionChange with matching id exists,
|
|
1900
|
+
* it merges the new values into it
|
|
1901
|
+
* @param enablerId instanceId of the item that enables other FormItems
|
|
1902
|
+
* @param enabled the item's 'enabledItems' array
|
|
1903
|
+
* @param disabled the item's 'disabledItems' array
|
|
1904
|
+
* @param conditions Array of ConditionChanges to build up
|
|
1905
|
+
* @param itemMap map of instanceIds inside an item; to ensure no internal ids are included in a change
|
|
1906
|
+
* @param enable Whether the 'enabledItems' should toggled enabled
|
|
1907
|
+
*/
|
|
1908
|
+
_pushConditionToArray(enablerId, enabled, disabled, conditions, itemMap, enable) {
|
|
1909
|
+
const enabledItems = enabled.filter((e) => !itemMap[e]);
|
|
1910
|
+
const disabledItems = disabled.filter((d) => !itemMap[d]);
|
|
1911
|
+
if (!!enabledItems.length || !!disabledItems.length) {
|
|
1912
|
+
const index = conditions.findIndex((c) => c.enablerId === enablerId);
|
|
1913
|
+
if (index < 0) {
|
|
1914
|
+
conditions.push({ enablerId: enablerId, enabledItems, disabledItems, enable });
|
|
1915
|
+
}
|
|
1916
|
+
else {
|
|
1917
|
+
const prev = conditions[index];
|
|
1918
|
+
const newId = {
|
|
1919
|
+
enablerId,
|
|
1920
|
+
enabledItems: [...prev.enabledItems, ...enabledItems],
|
|
1921
|
+
disabledItems: [...prev.disabledItems, ...disabledItems],
|
|
1922
|
+
enable,
|
|
1923
|
+
};
|
|
1924
|
+
conditions.splice(index, 1, newId);
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
/**
|
|
1929
|
+
* Store all validation errors on the service.
|
|
1930
|
+
* Revalidate form controls that previously had errors or have new errors now.
|
|
1931
|
+
*/
|
|
1932
|
+
_updateServerSideErrors() {
|
|
1933
|
+
var _a;
|
|
1934
|
+
// Keep track of IDs for each control that needs to be revalidated
|
|
1935
|
+
const controlIdsToRevalidate = new Set();
|
|
1936
|
+
// Collect controls previously in error to revalidate
|
|
1937
|
+
if (this._formItemValidationResults) {
|
|
1938
|
+
for (const id in this._formItemValidationResults) {
|
|
1939
|
+
if (Object.prototype.hasOwnProperty.call(this._formItemValidationResults, id)) {
|
|
1940
|
+
controlIdsToRevalidate.add(id);
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
// Clear out all previous stored errors
|
|
1945
|
+
this._formItemValidationResults = {};
|
|
1946
|
+
if ((_a = this._mtnaForm) === null || _a === void 0 ? void 0 : _a.validationResult) {
|
|
1947
|
+
for (const result of this._mtnaForm.validationResult.formItemValidationResults) {
|
|
1948
|
+
if (result.validationStatus === 'ERRORS') {
|
|
1949
|
+
// Store errors so that the validationResultValidator can validate each control
|
|
1950
|
+
this._formItemValidationResults[result.id] = result;
|
|
1951
|
+
// We need to revalidate these controls that have errors
|
|
1952
|
+
controlIdsToRevalidate.add(result.id);
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
// Only revalidate controls actually changes
|
|
1957
|
+
const form = this.ngFormManager.getForm();
|
|
1958
|
+
if (form) {
|
|
1959
|
+
for (const id of controlIdsToRevalidate) {
|
|
1960
|
+
const control = findFormControl(id, form);
|
|
1961
|
+
if (control) {
|
|
1962
|
+
control.updateValueAndValidity();
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
MtnaWfManagerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfManagerService, deps: [{ token: MtnaWfApiService }, { token: MtnaWfNgFormService }, { token: MtnaWfUIService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1969
|
+
MtnaWfManagerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfManagerService });
|
|
1970
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfManagerService, decorators: [{
|
|
1971
|
+
type: Injectable
|
|
1972
|
+
}], ctorParameters: function () { return [{ type: MtnaWfApiService }, { type: MtnaWfNgFormService }, { type: MtnaWfUIService }]; } });
|
|
1973
|
+
|
|
1974
|
+
class MtnaWfFileUploadComponent {
|
|
1975
|
+
constructor(fileService) {
|
|
1976
|
+
this.fileService = fileService;
|
|
1977
|
+
this.header = null;
|
|
1978
|
+
this.indicatorStatus = 'INACTIVE';
|
|
1979
|
+
this.readonly = false;
|
|
1980
|
+
this.file = new EventEmitter();
|
|
1981
|
+
this.loading = false;
|
|
1982
|
+
}
|
|
1983
|
+
fileToUpload(file) {
|
|
1984
|
+
this.loading = true;
|
|
1985
|
+
this.fileService.uploadFile(file).subscribe((fileInfo) => {
|
|
1986
|
+
this.loading = false;
|
|
1987
|
+
this.fileInfo = fileInfo;
|
|
1988
|
+
this.file.emit(fileInfo);
|
|
1989
|
+
});
|
|
1990
|
+
}
|
|
1991
|
+
handleDownload(template) {
|
|
1992
|
+
this.fileService.downloadFileGET(template.key, template.fileName, template.contentType);
|
|
1993
|
+
}
|
|
1994
|
+
ngOnInit() {
|
|
1995
|
+
var _a;
|
|
1996
|
+
if ((_a = this.item) === null || _a === void 0 ? void 0 : _a.value) {
|
|
1997
|
+
this.fileInfo = this.item.value;
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
removeFile() {
|
|
2001
|
+
if (this.fileInfo) {
|
|
2002
|
+
this.loading = true;
|
|
2003
|
+
this.fileService.deleteFile(this.fileInfo).subscribe(() => {
|
|
2004
|
+
this.loading = false;
|
|
2005
|
+
this.fileInfo = undefined;
|
|
2006
|
+
this.file.emit(undefined);
|
|
2007
|
+
});
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
MtnaWfFileUploadComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFileUploadComponent, deps: [{ token: i1$3.FileService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2012
|
+
MtnaWfFileUploadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfFileUploadComponent, selector: "mtna-wf-file-upload-item", inputs: { header: "header", indicatorStatus: "indicatorStatus", item: "item", readonly: "readonly" }, outputs: { file: "file" }, ngImport: i0, template: "<ng-container *ngTemplateOutlet=\"header\"></ng-container>\n\n<div class=\"content\" [mtnaHighlight]=\"indicatorStatus === 'ACTIVE' && !item?.questionText && !item?.descriptiveText\">\n <ng-container *ngIf=\"!readonly; else readOnly\">\n <ng-container *ngIf=\"!loading; else loader\">\n <mtna-file-download\n *ngIf=\"!!fileInfo; else fileUpload\"\n [fileInfo]=\"fileInfo\"\n [canRemove]=\"true\"\n color=\"primary\"\n [canDownload]=\"true\"\n (download)=\"handleDownload($event)\"\n (remove)=\"removeFile()\"\n ></mtna-file-download>\n\n <ng-template #fileUpload>\n <mtna-file-upload\n [automaticUpload]=\"false\"\n color=\"primary\"\n [buttonText]=\"'CHOOSE A FILE'\"\n (fileToUpload)=\"fileToUpload($event)\"\n ></mtna-file-upload>\n </ng-template>\n </ng-container>\n </ng-container>\n\n <!-- READONLY -->\n <ng-template #readOnly>\n <!-- anchor being used, due to <fieldset disabled> blocking a <button>'s click event -->\n <a\n *ngIf=\"!!item && !!item.value\"\n class=\"single-icon-button\"\n color=\"primary\"\n mat-stroked-button\n role=\"button\"\n (click)=\"handleDownload(item.value)\"\n >\n <mat-icon color=\"primary\">file_download</mat-icon>\n {{ (item!.value!.fileName ? item!.value!.fileName : '') | uppercase }}\n </a>\n </ng-template>\n</div>\n\n<!-- PROGRESS SPINNER -->\n<ng-template #loader>\n <mat-spinner diameter=\"125\" strokeWidth=\"10\" mode=\"indeterminate\"></mat-spinner>\n</ng-template>\n", styles: [":host{display:block;margin:1rem 0}mtna-file-download{margin:37px 0}mat-spinner{margin:0 87.5px}\n"], components: [{ type: i1$3.MtnaFileDownloadComponent, selector: "mtna-file-download", inputs: ["color", "canDownload", "canRemove", "fileInfo", "loading"], outputs: ["download", "remove"] }, { type: i1$3.MtnaFileUploadComponent, selector: "mtna-file-upload", inputs: ["automaticUpload", "buttonText", "buttonColor", "disabled", "fileUploadUrl", "isProd", "maxUploadSize", "uploading"], outputs: ["uploaded", "fileToUpload", "uploadStatus"] }, { type: i2.MatAnchor, selector: "a[mat-button], a[mat-raised-button], a[mat-icon-button], a[mat-fab], a[mat-mini-fab], a[mat-stroked-button], a[mat-flat-button]", inputs: ["disabled", "disableRipple", "color", "tabIndex"], exportAs: ["matButton", "matAnchor"] }, { type: i18.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i4.MatSpinner, selector: "mat-spinner", inputs: ["color"] }], directives: [{ type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i7.MtnaHighlightDirective, selector: "[mtnaHighlight]", inputs: ["mtnaHighlight", "mtnaHighlightColor"], exportAs: ["mtnaHighlight"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "uppercase": i3.UpperCasePipe } });
|
|
2013
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFileUploadComponent, decorators: [{
|
|
2014
|
+
type: Component,
|
|
2015
|
+
args: [{
|
|
2016
|
+
selector: 'mtna-wf-file-upload-item',
|
|
2017
|
+
templateUrl: './file-upload.component.html',
|
|
2018
|
+
styleUrls: ['./file-upload.component.scss'],
|
|
2019
|
+
}]
|
|
2020
|
+
}], ctorParameters: function () { return [{ type: i1$3.FileService }]; }, propDecorators: { header: [{
|
|
2021
|
+
type: Input
|
|
2022
|
+
}], indicatorStatus: [{
|
|
2023
|
+
type: Input
|
|
2024
|
+
}], item: [{
|
|
2025
|
+
type: Input
|
|
2026
|
+
}], readonly: [{
|
|
2027
|
+
type: Input
|
|
2028
|
+
}], file: [{
|
|
2029
|
+
type: Output
|
|
2030
|
+
}] } });
|
|
2031
|
+
|
|
2032
|
+
/* eslint-disable @angular-eslint/component-selector */
|
|
2033
|
+
class MtnaWfFormDisablerComponent {
|
|
2034
|
+
constructor() {
|
|
2035
|
+
this.formDisabled = false;
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
MtnaWfFormDisablerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormDisablerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2039
|
+
MtnaWfFormDisablerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfFormDisablerComponent, selector: "[formDisabled]", inputs: { formDisabled: "formDisabled" }, ngImport: i0, template: `
|
|
2040
|
+
<fieldset [disabled]="formDisabled">
|
|
2041
|
+
<ng-content></ng-content>
|
|
2042
|
+
</fieldset>
|
|
2043
|
+
`, isInline: true, styles: ["\n fieldset {\n display: block;\n margin: unset;\n padding: unset;\n border: unset;\n }\n "] });
|
|
2044
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormDisablerComponent, decorators: [{
|
|
2045
|
+
type: Component,
|
|
2046
|
+
args: [{
|
|
2047
|
+
selector: '[formDisabled]',
|
|
2048
|
+
template: `
|
|
2049
|
+
<fieldset [disabled]="formDisabled">
|
|
2050
|
+
<ng-content></ng-content>
|
|
2051
|
+
</fieldset>
|
|
2052
|
+
`,
|
|
2053
|
+
styles: [
|
|
2054
|
+
`
|
|
2055
|
+
fieldset {
|
|
2056
|
+
display: block;
|
|
2057
|
+
margin: unset;
|
|
2058
|
+
padding: unset;
|
|
2059
|
+
border: unset;
|
|
2060
|
+
}
|
|
2061
|
+
`,
|
|
2062
|
+
],
|
|
2063
|
+
}]
|
|
2064
|
+
}], propDecorators: { formDisabled: [{
|
|
2065
|
+
type: Input
|
|
2066
|
+
}] } });
|
|
2067
|
+
|
|
2068
|
+
/**
|
|
2069
|
+
* Base control class for a ValueItem.
|
|
2070
|
+
* If a FormItem can have value, its component class should extend this class.
|
|
2071
|
+
*/
|
|
2072
|
+
class BaseFormItemControl {
|
|
2073
|
+
constructor() {
|
|
2074
|
+
this.formControlClass = true;
|
|
2075
|
+
this.header = null;
|
|
2076
|
+
this.inList = false;
|
|
2077
|
+
this.indicatorStatus = 'INACTIVE';
|
|
2078
|
+
this.readonly = false;
|
|
2079
|
+
}
|
|
2080
|
+
get control() {
|
|
2081
|
+
return this._control;
|
|
2082
|
+
}
|
|
2083
|
+
set control(control) {
|
|
2084
|
+
this._control = control;
|
|
2085
|
+
}
|
|
2086
|
+
get item() {
|
|
2087
|
+
return this._item;
|
|
2088
|
+
}
|
|
2089
|
+
set item(item) {
|
|
2090
|
+
this._item = item;
|
|
2091
|
+
}
|
|
2092
|
+
// Whether the item has a header component above the content
|
|
2093
|
+
get hasItemHeader() {
|
|
2094
|
+
return !!this.item && (!!this.item.questionText || !!this.item.descriptiveText);
|
|
2095
|
+
}
|
|
2096
|
+
_trackByOptionId(index, option) {
|
|
2097
|
+
return option.option.id;
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2100
|
+
BaseFormItemControl.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: BaseFormItemControl, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2101
|
+
BaseFormItemControl.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: BaseFormItemControl, inputs: { control: "control", header: "header", inList: "inList", indicatorStatus: "indicatorStatus", item: "item", readonly: "readonly" }, host: { properties: { "class.mtna-wf-control-item": "this.formControlClass", "class.read-only": "this.readonly" } }, ngImport: i0 });
|
|
2102
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: BaseFormItemControl, decorators: [{
|
|
2103
|
+
type: Directive
|
|
2104
|
+
}], propDecorators: { formControlClass: [{
|
|
2105
|
+
type: HostBinding,
|
|
2106
|
+
args: ['class.mtna-wf-control-item']
|
|
2107
|
+
}], control: [{
|
|
2108
|
+
type: Input
|
|
2109
|
+
}], header: [{
|
|
2110
|
+
type: Input
|
|
2111
|
+
}], inList: [{
|
|
2112
|
+
type: Input
|
|
2113
|
+
}], indicatorStatus: [{
|
|
2114
|
+
type: Input
|
|
2115
|
+
}], item: [{
|
|
2116
|
+
type: Input
|
|
2117
|
+
}], readonly: [{
|
|
2118
|
+
type: HostBinding,
|
|
2119
|
+
args: ['class.read-only']
|
|
2120
|
+
}, {
|
|
2121
|
+
type: Input
|
|
2122
|
+
}] } });
|
|
2123
|
+
|
|
2124
|
+
/**
|
|
2125
|
+
* Base control class for a FormItem with nested FormItems.
|
|
2126
|
+
* If a FormItem contains an 'optionItemMap', its component class should extend this class.
|
|
2127
|
+
*/
|
|
2128
|
+
class BaseParentItemControl extends BaseFormItemControl {
|
|
2129
|
+
constructor() {
|
|
2130
|
+
super(...arguments);
|
|
2131
|
+
this.parentIds = new Array();
|
|
2132
|
+
}
|
|
2133
|
+
/** FormControl representing this item's value.
|
|
2134
|
+
* If this item has items in its 'optionItemMap', this control is nested inside a FormGroup wrapper */
|
|
2135
|
+
get control() {
|
|
2136
|
+
return this._control;
|
|
2137
|
+
}
|
|
2138
|
+
set control(control) {
|
|
2139
|
+
if (control instanceof FormGroup) {
|
|
2140
|
+
this._control = control.get(this.item.instanceId);
|
|
2141
|
+
this.controlWrapper = control;
|
|
2142
|
+
}
|
|
2143
|
+
else {
|
|
2144
|
+
super.control = control;
|
|
2145
|
+
}
|
|
2146
|
+
// FIXME sometimes this gets set with undefined which was a problem
|
|
2147
|
+
// Why is it undefined sometimes? something to do with readonly?
|
|
2148
|
+
// Do we need to split the read-only components and edit-components
|
|
2149
|
+
// I think the read-only components are carrying a bunch of extra unecessary weight
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
BaseParentItemControl.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: BaseParentItemControl, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2153
|
+
BaseParentItemControl.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: BaseParentItemControl, inputs: { control: "control", parentIds: "parentIds" }, usesInheritance: true, ngImport: i0 });
|
|
2154
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: BaseParentItemControl, decorators: [{
|
|
2155
|
+
type: Directive
|
|
2156
|
+
}], propDecorators: { control: [{
|
|
2157
|
+
type: Input
|
|
2158
|
+
}], parentIds: [{
|
|
2159
|
+
type: Input
|
|
2160
|
+
}] } });
|
|
2161
|
+
|
|
2162
|
+
class BaseSingleSelectionParent extends BaseParentItemControl {
|
|
2163
|
+
constructor(uiService) {
|
|
2164
|
+
super();
|
|
2165
|
+
this.uiService = uiService;
|
|
2166
|
+
}
|
|
2167
|
+
ngOnInit() {
|
|
2168
|
+
var _a;
|
|
2169
|
+
if (isPresent((_a = this.control) === null || _a === void 0 ? void 0 : _a.value)) {
|
|
2170
|
+
this.selectedOption = this.item.options.find((o) => { var _a; return ((_a = this.control) === null || _a === void 0 ? void 0 : _a.value) === o.option.id; });
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
/**
|
|
2174
|
+
* Toggles the 'selected' value of the previous & newly selected options,
|
|
2175
|
+
* then calls toggleFormItems to change their enabled/disabled items
|
|
2176
|
+
* @param change MatRadioChange from the radio group
|
|
2177
|
+
*/
|
|
2178
|
+
selectionChange(change) {
|
|
2179
|
+
// event fires when an option's nested item, e.g. FileUploadItem, changes value.
|
|
2180
|
+
// This event is not a MatRadioChange, so we need to ignore it.
|
|
2181
|
+
if (change instanceof MatRadioChange || change instanceof MatSelectChange) {
|
|
2182
|
+
// Newly selected option
|
|
2183
|
+
const option = this.item.options.find((o) => o.option.id === change.value);
|
|
2184
|
+
if (!!this.selectedOption && this.selectedOption.option.id !== change.value) {
|
|
2185
|
+
// New option does not match the previous option
|
|
2186
|
+
// Previous option's enabled/disabled items need toggling
|
|
2187
|
+
// toggle visibility and enable/disable, should be rendered already
|
|
2188
|
+
this.uiService.toggleFormItems(this.selectedOption.enabledItems, this.selectedOption.disabledItems, false, this.item.instanceId);
|
|
2189
|
+
}
|
|
2190
|
+
// toggle visibility and enable/disable, should be rendered already
|
|
2191
|
+
if (option) {
|
|
2192
|
+
this.uiService.toggleFormItems(option.enabledItems, option.disabledItems, true, this.item.instanceId);
|
|
2193
|
+
}
|
|
2194
|
+
// Set the selected option as the previous
|
|
2195
|
+
this.selectedOption = option;
|
|
2196
|
+
}
|
|
2197
|
+
else {
|
|
2198
|
+
console.warn('[BaseSingleSelectionParent] selectionChange - not a MatRadioChange | MatSelectChange', change);
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
BaseSingleSelectionParent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: BaseSingleSelectionParent, deps: [{ token: MtnaWfUIService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2203
|
+
BaseSingleSelectionParent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: BaseSingleSelectionParent, usesInheritance: true, ngImport: i0 });
|
|
2204
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: BaseSingleSelectionParent, decorators: [{
|
|
2205
|
+
type: Directive
|
|
2206
|
+
}], ctorParameters: function () { return [{ type: MtnaWfUIService }]; } });
|
|
2207
|
+
|
|
2208
|
+
/* eslint-disable @angular-eslint/directive-selector */
|
|
2209
|
+
/**
|
|
2210
|
+
* Used to retrieve the host container for a dynamically rendered component.
|
|
2211
|
+
*
|
|
2212
|
+
* @export
|
|
2213
|
+
*/
|
|
2214
|
+
class MtnaWfFormItemDirective {
|
|
2215
|
+
constructor(viewContainerRef) {
|
|
2216
|
+
this.viewContainerRef = viewContainerRef;
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
MtnaWfFormItemDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormItemDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2220
|
+
MtnaWfFormItemDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfFormItemDirective, selector: "[formItemHost]", ngImport: i0 });
|
|
2221
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormItemDirective, decorators: [{
|
|
2222
|
+
type: Directive,
|
|
2223
|
+
args: [{
|
|
2224
|
+
selector: '[formItemHost]',
|
|
2225
|
+
}]
|
|
2226
|
+
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; } });
|
|
2227
|
+
|
|
2228
|
+
const MTNA_WF_ITEM_WHITELIST = new InjectionToken('mtna-wf-item-whitelist', {
|
|
2229
|
+
providedIn: 'root',
|
|
2230
|
+
factory: MTNA_WF_ITEM_WHITELIST_FACTORY,
|
|
2231
|
+
});
|
|
2232
|
+
function MTNA_WF_ITEM_WHITELIST_FACTORY() {
|
|
2233
|
+
return {
|
|
2234
|
+
itemTypes: [],
|
|
2235
|
+
};
|
|
2236
|
+
}
|
|
2237
|
+
|
|
2238
|
+
/**
|
|
2239
|
+
* Dialog data for a {@link MtnaWfFormItemDialogComponent}
|
|
2240
|
+
*/
|
|
2241
|
+
class MtnaWfFormItemDialogData {
|
|
2242
|
+
/**
|
|
2243
|
+
* @param formItems The form items to render in the dialog
|
|
2244
|
+
* @param title optional dialog title
|
|
2245
|
+
*/
|
|
2246
|
+
constructor(formItems, title) {
|
|
2247
|
+
this.formItems = formItems;
|
|
2248
|
+
this.title = title;
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2252
|
+
/* eslint-disable @angular-eslint/no-inputs-metadata-property */
|
|
2253
|
+
const _StepCardMixinBase = mixinColor(class {
|
|
2254
|
+
constructor(_elementRef) {
|
|
2255
|
+
this._elementRef = _elementRef;
|
|
2256
|
+
}
|
|
2257
|
+
}, 'accent');
|
|
2258
|
+
class MtnaWfStepCardComponent extends _StepCardMixinBase {
|
|
2259
|
+
constructor(elementRef) {
|
|
2260
|
+
super(elementRef);
|
|
2261
|
+
this.focused = new EventEmitter();
|
|
2262
|
+
}
|
|
2263
|
+
get active() {
|
|
2264
|
+
var _a;
|
|
2265
|
+
return !!((_a = this.step) === null || _a === void 0 ? void 0 : _a.active);
|
|
2266
|
+
}
|
|
2267
|
+
handleFocusChange(event) {
|
|
2268
|
+
if (!!this.step && !!event && !this.step.active) {
|
|
2269
|
+
this.focused.emit(this.step);
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
MtnaWfStepCardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfStepCardComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
2274
|
+
MtnaWfStepCardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfStepCardComponent, selector: "mtna-wf-step-card", inputs: { color: "color", step: "step", subtitle: "subtitle" }, outputs: { focused: "focused" }, host: { properties: { "class.active": "this.active" } }, usesInheritance: true, ngImport: i0, template: "<mat-card cdkMonitorSubtreeFocus (cdkFocusChange)=\"handleFocusChange($event)\">\n <mat-card-header>\n <mtna-status-circle mat-card-avatar [circleNumber]=\"step?.num\" [optional]=\"step?.optional\" [status]=\"step?.status\"></mtna-status-circle>\n <mat-card-title>{{ step?.label }}</mat-card-title>\n <mat-card-subtitle [innerHTML]=\"subtitle | mtnaWfSanitizeHtml\"></mat-card-subtitle>\n <p *ngIf=\"step?.optional\" class=\"optional mat-caption\">Optional</p>\n </mat-card-header>\n\n <mat-divider [inset]=\"true\"></mat-divider>\n\n <mat-card-content>\n <ng-content select=\"[cardContent]\"></ng-content>\n </mat-card-content>\n\n <mat-card-actions>\n <ng-content select=\"[cardActions]\"></ng-content>\n </mat-card-actions>\n</mat-card>\n", styles: ["mtna-wf-step-card{display:block;position:relative}mtna-wf-step-card.active:before{transform-origin:top;transform:scaleY(1)}mtna-wf-step-card:before{content:\"\";display:block;position:absolute;top:0;left:0;bottom:0;width:5px;transition:transform .4s cubic-bezier(.25,.8,.25,1);transform-origin:bottom;transform:scaleY(0);z-index:1;border-top-left-radius:2px;border-bottom-left-radius:2px}mtna-wf-step-card mat-card-header{position:relative}mtna-wf-step-card mat-card-header mat-card-title{line-height:24px;margin-right:100px}mtna-wf-step-card mat-card-header mtna-status-circle[mat-card-avatar]{width:24px;height:24px}mtna-wf-step-card mat-card-header>.optional:not(.mtna-status-circle){position:absolute;right:16px;top:0;margin:0;line-height:24px}mtna-wf-step-card mat-card-actions{padding:0;margin:0}mtna-wf-step-card mat-card-content{margin-top:16px}mtna-wf-step-card mat-card-content [cardcontent]>:first-child{margin-top:0}\n"], components: [{ type: i1$4.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { type: i1$4.MatCardHeader, selector: "mat-card-header" }, { type: i7.MtnaStatusCircleComponent, selector: "mtna-status-circle", inputs: ["color", "circleNumber", "incompleteIcon", "status", "validIcon", "optional"] }, { type: i3$1.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }], directives: [{ type: i4$1.CdkMonitorFocus, selector: "[cdkMonitorElementFocus], [cdkMonitorSubtreeFocus]", outputs: ["cdkFocusChange"] }, { type: i1$4.MatCardAvatar, selector: "[mat-card-avatar], [matCardAvatar]" }, { type: i1$4.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { type: i1$4.MatCardSubtitle, selector: "mat-card-subtitle, [mat-card-subtitle], [matCardSubtitle]" }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$4.MatCardContent, selector: "mat-card-content, [mat-card-content], [matCardContent]" }, { type: i1$4.MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }], pipes: { "mtnaWfSanitizeHtml": MtnaWfSanitizeHtmlPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2275
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfStepCardComponent, decorators: [{
|
|
2276
|
+
type: Component,
|
|
2277
|
+
args: [{
|
|
2278
|
+
selector: 'mtna-wf-step-card',
|
|
2279
|
+
templateUrl: './step-card.component.html',
|
|
2280
|
+
styleUrls: ['./step-card.component.scss'],
|
|
2281
|
+
inputs: ['color'],
|
|
2282
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2283
|
+
encapsulation: ViewEncapsulation.None,
|
|
2284
|
+
}]
|
|
2285
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { active: [{
|
|
2286
|
+
type: HostBinding,
|
|
2287
|
+
args: ['class.active']
|
|
2288
|
+
}], step: [{
|
|
2289
|
+
type: Input
|
|
2290
|
+
}], subtitle: [{
|
|
2291
|
+
type: Input
|
|
2292
|
+
}], focused: [{
|
|
2293
|
+
type: Output
|
|
2294
|
+
}] } });
|
|
2295
|
+
|
|
2296
|
+
/**
|
|
2297
|
+
* Common header html for a form item.
|
|
2298
|
+
*
|
|
2299
|
+
* @author Will Davis <will.davis@mtna.us>
|
|
2300
|
+
*/
|
|
2301
|
+
class ItemHeaderComponent {
|
|
2302
|
+
constructor() {
|
|
2303
|
+
this.itemHeaderClass = true;
|
|
2304
|
+
this._disabled = false;
|
|
2305
|
+
this._hideRequiredMarker = false;
|
|
2306
|
+
this._invalid = false;
|
|
2307
|
+
/** Whether the form item is required */
|
|
2308
|
+
this.required = false;
|
|
2309
|
+
/** HTML to insert for required items */
|
|
2310
|
+
this._requiredHtml = `<span aria-hidden="true"> *</span>`;
|
|
2311
|
+
}
|
|
2312
|
+
/** Whether the form item is disabled */
|
|
2313
|
+
get disabled() {
|
|
2314
|
+
return this._disabled;
|
|
2315
|
+
}
|
|
2316
|
+
set disabled(disabled) {
|
|
2317
|
+
this._disabled = coerceBooleanProperty(disabled);
|
|
2318
|
+
}
|
|
2319
|
+
/** Whether the required marker (asterix) is hidden. Defaults to false. */
|
|
2320
|
+
get hideRequiredMarker() {
|
|
2321
|
+
return this._hideRequiredMarker;
|
|
2322
|
+
}
|
|
2323
|
+
set hideRequiredMarker(hideRequiredMarker) {
|
|
2324
|
+
this._hideRequiredMarker = coerceBooleanProperty(hideRequiredMarker);
|
|
2325
|
+
}
|
|
2326
|
+
/** Whether the form item is invalid */
|
|
2327
|
+
get invalid() {
|
|
2328
|
+
return this._invalid;
|
|
2329
|
+
}
|
|
2330
|
+
set invalid(invalid) {
|
|
2331
|
+
this._invalid = coerceBooleanProperty(invalid);
|
|
2332
|
+
}
|
|
2333
|
+
}
|
|
2334
|
+
ItemHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ItemHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2335
|
+
ItemHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ItemHeaderComponent, selector: "mtna-wf-item-header", inputs: { descriptiveText: "descriptiveText", disabled: "disabled", hideRequiredMarker: "hideRequiredMarker", invalid: "invalid", questionText: "questionText", required: "required" }, host: { properties: { "class.mtna-wf-item-header": "this.itemHeaderClass" } }, ngImport: i0, template: `
|
|
2336
|
+
<h3
|
|
2337
|
+
*ngIf="!!questionText"
|
|
2338
|
+
class="mtna-wf-item-question"
|
|
2339
|
+
[class.invalid]="invalid"
|
|
2340
|
+
[innerHTML]="questionText + (required && !disabled && !hideRequiredMarker ? _requiredHtml : '') | mtnaWfSanitizeHtml"
|
|
2341
|
+
></h3>
|
|
2342
|
+
<p *ngIf="!!descriptiveText" class="mtna-wf-item-description" [innerHTML]="descriptiveText | mtnaWfSanitizeHtml"></p>
|
|
2343
|
+
`, isInline: true, styles: ["\n .mtna-wf-item-header {\n display: block;\n margin-bottom: 0.5rem;\n }\n .mtna-wf-item-header .mtna-wf-item-question,\n .mtna-wf-item-description {\n margin: 0;\n font-size: 0.9rem;\n line-height: 1.6;\n }\n .mtna-wf-item-header .mtna-wf-item-description {\n opacity: 0.56;\n }\n\n mtna-annotations-indicator + mtna-wf-repeatable-item-container > mtna-wf-item-header,\n mtna-annotations-indicator + mtna-wf-value-item > mtna-wf-input-item > mtna-wf-item-header {\n padding-right: 24px; // provide space for annotation indicator\n }\n "], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "mtnaWfSanitizeHtml": MtnaWfSanitizeHtmlPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2344
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ItemHeaderComponent, decorators: [{
|
|
2345
|
+
type: Component,
|
|
2346
|
+
args: [{
|
|
2347
|
+
selector: 'mtna-wf-item-header',
|
|
2348
|
+
template: `
|
|
2349
|
+
<h3
|
|
2350
|
+
*ngIf="!!questionText"
|
|
2351
|
+
class="mtna-wf-item-question"
|
|
2352
|
+
[class.invalid]="invalid"
|
|
2353
|
+
[innerHTML]="questionText + (required && !disabled && !hideRequiredMarker ? _requiredHtml : '') | mtnaWfSanitizeHtml"
|
|
2354
|
+
></h3>
|
|
2355
|
+
<p *ngIf="!!descriptiveText" class="mtna-wf-item-description" [innerHTML]="descriptiveText | mtnaWfSanitizeHtml"></p>
|
|
2356
|
+
`,
|
|
2357
|
+
styles: [
|
|
2358
|
+
`
|
|
2359
|
+
.mtna-wf-item-header {
|
|
2360
|
+
display: block;
|
|
2361
|
+
margin-bottom: 0.5rem;
|
|
2362
|
+
}
|
|
2363
|
+
.mtna-wf-item-header .mtna-wf-item-question,
|
|
2364
|
+
.mtna-wf-item-description {
|
|
2365
|
+
margin: 0;
|
|
2366
|
+
font-size: 0.9rem;
|
|
2367
|
+
line-height: 1.6;
|
|
2368
|
+
}
|
|
2369
|
+
.mtna-wf-item-header .mtna-wf-item-description {
|
|
2370
|
+
opacity: 0.56;
|
|
2371
|
+
}
|
|
2372
|
+
|
|
2373
|
+
mtna-annotations-indicator + mtna-wf-repeatable-item-container > mtna-wf-item-header,
|
|
2374
|
+
mtna-annotations-indicator + mtna-wf-value-item > mtna-wf-input-item > mtna-wf-item-header {
|
|
2375
|
+
padding-right: 24px; // provide space for annotation indicator
|
|
2376
|
+
}
|
|
2377
|
+
`,
|
|
2378
|
+
],
|
|
2379
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2380
|
+
encapsulation: ViewEncapsulation.None,
|
|
2381
|
+
}]
|
|
2382
|
+
}], propDecorators: { itemHeaderClass: [{
|
|
2383
|
+
type: HostBinding,
|
|
2384
|
+
args: ['class.mtna-wf-item-header']
|
|
2385
|
+
}], descriptiveText: [{
|
|
2386
|
+
type: Input
|
|
2387
|
+
}], disabled: [{
|
|
2388
|
+
type: Input
|
|
2389
|
+
}], hideRequiredMarker: [{
|
|
2390
|
+
type: Input
|
|
2391
|
+
}], invalid: [{
|
|
2392
|
+
type: Input
|
|
2393
|
+
}], questionText: [{
|
|
2394
|
+
type: Input
|
|
2395
|
+
}], required: [{
|
|
2396
|
+
type: Input
|
|
2397
|
+
}] } });
|
|
2398
|
+
|
|
2399
|
+
class RepeatableItemComponent {
|
|
2400
|
+
}
|
|
2401
|
+
RepeatableItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RepeatableItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2402
|
+
RepeatableItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: RepeatableItemComponent, selector: "mtna-wf-repeatable-item", ngImport: i0, template: ` <ng-content></ng-content> `, isInline: true, styles: ["\n mtna-wf-repeatable-item {\n display: block;\n }\n "], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2403
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RepeatableItemComponent, decorators: [{
|
|
2404
|
+
type: Component,
|
|
2405
|
+
args: [{
|
|
2406
|
+
selector: 'mtna-wf-repeatable-item',
|
|
2407
|
+
template: ` <ng-content></ng-content> `,
|
|
2408
|
+
styles: [
|
|
2409
|
+
`
|
|
2410
|
+
mtna-wf-repeatable-item {
|
|
2411
|
+
display: block;
|
|
2412
|
+
}
|
|
2413
|
+
`,
|
|
2414
|
+
],
|
|
2415
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2416
|
+
encapsulation: ViewEncapsulation.None,
|
|
2417
|
+
}]
|
|
2418
|
+
}] });
|
|
2419
|
+
|
|
2420
|
+
class MtnaWfDateComponent extends BaseFormItemControl {
|
|
2421
|
+
constructor(logger) {
|
|
2422
|
+
super();
|
|
2423
|
+
this.dateItemClass = true;
|
|
2424
|
+
this._format = 'YYYY-MM-DD';
|
|
2425
|
+
this.rangeLimits = { end: null, start: null };
|
|
2426
|
+
// We need to check to ensure 'moment' & 'moment-jdateformatparser' scripts have been added to angular.json so that
|
|
2427
|
+
// the DateFormItemComponent doesn't break when attempting to format SimpleDateFormat string to Moment format string
|
|
2428
|
+
MtnaWfDateComponent.dateFormItemComponentInstances++;
|
|
2429
|
+
if (MtnaWfDateComponent.dateFormItemComponentInstances === 1) {
|
|
2430
|
+
try {
|
|
2431
|
+
if (!!moment && typeof moment().toMomentFormatString !== 'function') {
|
|
2432
|
+
logger.error(`[DateFormItemComponent] constructor
|
|
2433
|
+
- Cannot find moment-jdateformatparser, make sure to install the dependency and add the script in angular.json, i.e.
|
|
2434
|
+
"scripts": ["node_modules/moment-jdateformatparser/moment-jdateformatparser.min.js"]`);
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
catch (e) {
|
|
2438
|
+
logger.error(`[DateFormItemComponent] constructor
|
|
2439
|
+
- Cannot find moment.js, make sure to install the dependency and add the script in angular.json, i.e.
|
|
2440
|
+
"scripts": ["node_modules/moment/min/moment.min.js"]`);
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
}
|
|
2444
|
+
get format() {
|
|
2445
|
+
return this._format;
|
|
2446
|
+
}
|
|
2447
|
+
set format(f) {
|
|
2448
|
+
if (f) {
|
|
2449
|
+
this._format = f;
|
|
2450
|
+
// Update configuration anytime the formatter changes
|
|
2451
|
+
this.configureDatePickerFormatter();
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
ngAfterViewInit() {
|
|
2455
|
+
this.configureDatePickerFormatter();
|
|
2456
|
+
}
|
|
2457
|
+
/**
|
|
2458
|
+
* Manually change the parse and display formats of the date picker.
|
|
2459
|
+
* @see https://github.com/angular/components/issues/8355#issuecomment-376783293
|
|
2460
|
+
*/
|
|
2461
|
+
configureDatePickerFormatter() {
|
|
2462
|
+
if (this.picker) {
|
|
2463
|
+
const datepickerInput = this.picker.datepickerInput;
|
|
2464
|
+
// @ts-ignore: access the private date formats on the date picker
|
|
2465
|
+
const d = JSON.parse(JSON.stringify(datepickerInput._dateFormats));
|
|
2466
|
+
// Convert the Java SimpleDateFormat to the moment equivalents using moment-jdateformatparser
|
|
2467
|
+
const momentFormatString = moment().toMomentFormatString(this.format);
|
|
2468
|
+
// Use the converted format for the date picker display
|
|
2469
|
+
d.display.dateInput = momentFormatString;
|
|
2470
|
+
// Use the converted format for the date picker parser (user input)
|
|
2471
|
+
d.parse.dateInput = momentFormatString;
|
|
2472
|
+
// @ts-ignore: set the updated date formats
|
|
2473
|
+
datepickerInput._dateFormats = d;
|
|
2474
|
+
// @ts-ignore: manually format the current value in the date picker
|
|
2475
|
+
datepickerInput._formatValue(datepickerInput.value);
|
|
2476
|
+
}
|
|
2477
|
+
}
|
|
2478
|
+
}
|
|
2479
|
+
MtnaWfDateComponent.dateFormItemComponentInstances = 0;
|
|
2480
|
+
MtnaWfDateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfDateComponent, deps: [{ token: i7.MtnaLogger }], target: i0.ɵɵFactoryTarget.Component });
|
|
2481
|
+
MtnaWfDateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfDateComponent, selector: "mtna-wf-date-item", inputs: { format: "format", rangeLimits: "rangeLimits" }, host: { properties: { "class.mtna-wf-date-item": "this.dateItemClass" } }, viewQueries: [{ propertyName: "picker", first: true, predicate: MatDatepicker, descendants: true }], usesInheritance: true, ngImport: i0, template: `
|
|
2482
|
+
<ng-container *ngTemplateOutlet="header"></ng-container>
|
|
2483
|
+
<mat-form-field *ngIf="control" appearance="outline" [mtnaHighlight]="indicatorStatus === 'ACTIVE' && !hasItemHeader">
|
|
2484
|
+
<mat-label>{{ item.label || 'Date' }}</mat-label>
|
|
2485
|
+
<input
|
|
2486
|
+
matInput
|
|
2487
|
+
[matDatepicker]="picker"
|
|
2488
|
+
[formControl]="$any(control)"
|
|
2489
|
+
[max]="rangeLimits?.end"
|
|
2490
|
+
[min]="rangeLimits?.start"
|
|
2491
|
+
placeholder="Choose a date"
|
|
2492
|
+
[required]="item.required"
|
|
2493
|
+
/>
|
|
2494
|
+
<mat-datepicker-toggle matSuffix [for]="picker" [disabled]="readonly || control.disabled"></mat-datepicker-toggle>
|
|
2495
|
+
<mat-datepicker #picker></mat-datepicker>
|
|
2496
|
+
<mat-error *ngFor="let error of control.errors | keyvalue">
|
|
2497
|
+
{{ error | mtnaWfGetControlError : item }}
|
|
2498
|
+
</mat-error>
|
|
2499
|
+
<mat-hint>{{ item?.format || format }}</mat-hint>
|
|
2500
|
+
</mat-form-field>
|
|
2501
|
+
`, isInline: true, styles: [".mtna-wf-control-item .mat-form-field{width:100%}.mtna-wf-control-item .mtna-wf-error-container{font-size:75%;line-height:1;min-height:1em;margin-top:-.75rem}.mtna-wf-control-item .control-item-content{padding:.35em .75em .625em}.mtna-wf-control-item .mtna-wf-item-header~:not(.mtna-wf-error-container):not(.mat-list){padding-left:.75em}.mtna-wf-control-item .mtna-wf-item-header~:not(.mtna-wf-error-container):not(.mat-list).mat-form-field{width:calc(100% - .75em)}\n"], components: [{ type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i3$2.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["tabIndex", "disabled", "for", "aria-label", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { type: i3$2.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }], directives: [{ type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.MtnaHighlightDirective, selector: "[mtnaHighlight]", inputs: ["mtnaHighlight", "mtnaHighlightColor"], exportAs: ["mtnaHighlight"] }, { type: i2$1.MatLabel, selector: "mat-label" }, { type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i3$2.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { type: i6.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i6.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i6.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i2$1.MatSuffix, selector: "[matSuffix]" }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$1.MatError, selector: "mat-error", inputs: ["id"] }, { type: i2$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }], pipes: { "keyvalue": i3.KeyValuePipe, "mtnaWfGetControlError": MtnaGetFormControlErrorPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2502
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfDateComponent, decorators: [{
|
|
2503
|
+
type: Component,
|
|
2504
|
+
args: [{
|
|
2505
|
+
selector: 'mtna-wf-date-item',
|
|
2506
|
+
template: `
|
|
2507
|
+
<ng-container *ngTemplateOutlet="header"></ng-container>
|
|
2508
|
+
<mat-form-field *ngIf="control" appearance="outline" [mtnaHighlight]="indicatorStatus === 'ACTIVE' && !hasItemHeader">
|
|
2509
|
+
<mat-label>{{ item.label || 'Date' }}</mat-label>
|
|
2510
|
+
<input
|
|
2511
|
+
matInput
|
|
2512
|
+
[matDatepicker]="picker"
|
|
2513
|
+
[formControl]="$any(control)"
|
|
2514
|
+
[max]="rangeLimits?.end"
|
|
2515
|
+
[min]="rangeLimits?.start"
|
|
2516
|
+
placeholder="Choose a date"
|
|
2517
|
+
[required]="item.required"
|
|
2518
|
+
/>
|
|
2519
|
+
<mat-datepicker-toggle matSuffix [for]="picker" [disabled]="readonly || control.disabled"></mat-datepicker-toggle>
|
|
2520
|
+
<mat-datepicker #picker></mat-datepicker>
|
|
2521
|
+
<mat-error *ngFor="let error of control.errors | keyvalue">
|
|
2522
|
+
{{ error | mtnaWfGetControlError : item }}
|
|
2523
|
+
</mat-error>
|
|
2524
|
+
<mat-hint>{{ item?.format || format }}</mat-hint>
|
|
2525
|
+
</mat-form-field>
|
|
2526
|
+
`,
|
|
2527
|
+
styleUrls: [`form-control.scss`],
|
|
2528
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2529
|
+
encapsulation: ViewEncapsulation.None,
|
|
2530
|
+
}]
|
|
2531
|
+
}], ctorParameters: function () { return [{ type: i7.MtnaLogger }]; }, propDecorators: { dateItemClass: [{
|
|
2532
|
+
type: HostBinding,
|
|
2533
|
+
args: ['class.mtna-wf-date-item']
|
|
2534
|
+
}], format: [{
|
|
2535
|
+
type: Input
|
|
2536
|
+
}], rangeLimits: [{
|
|
2537
|
+
type: Input
|
|
2538
|
+
}], picker: [{
|
|
2539
|
+
type: ViewChild,
|
|
2540
|
+
args: [MatDatepicker, { static: false }]
|
|
2541
|
+
}] } });
|
|
2542
|
+
|
|
2543
|
+
class MtnaWfDateRangeComponent extends BaseFormItemControl {
|
|
2544
|
+
get item() {
|
|
2545
|
+
return this._item;
|
|
2546
|
+
}
|
|
2547
|
+
set item(item) {
|
|
2548
|
+
this._item = item;
|
|
2549
|
+
// Create fake items for the underlying date-item component
|
|
2550
|
+
this._startItem = Object.assign(Object.assign({}, item), { label: 'Start', value: undefined });
|
|
2551
|
+
this._endItem = Object.assign(Object.assign({}, item), { label: 'End', value: undefined });
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
MtnaWfDateRangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfDateRangeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2555
|
+
MtnaWfDateRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfDateRangeComponent, selector: "mtna-wf-date-range", usesInheritance: true, ngImport: i0, template: `
|
|
2556
|
+
<ng-container *ngTemplateOutlet="header"></ng-container>
|
|
2557
|
+
|
|
2558
|
+
<div
|
|
2559
|
+
*ngIf="control"
|
|
2560
|
+
class="range-item-container"
|
|
2561
|
+
fxLayout="row"
|
|
2562
|
+
fxLayoutAlign="start center"
|
|
2563
|
+
fxLayoutGap="8px"
|
|
2564
|
+
[mtnaHighlight]="indicatorStatus === 'ACTIVE' && !hasItemHeader"
|
|
2565
|
+
>
|
|
2566
|
+
<mtna-wf-date-item
|
|
2567
|
+
[control]="control.controls['start']"
|
|
2568
|
+
[format]="item.format"
|
|
2569
|
+
[item]="_startItem"
|
|
2570
|
+
[rangeLimits]="item.rangeLimits"
|
|
2571
|
+
[readonly]="readonly"
|
|
2572
|
+
></mtna-wf-date-item>
|
|
2573
|
+
<span fxFlex="14px"> to </span>
|
|
2574
|
+
<mtna-wf-date-item
|
|
2575
|
+
[control]="control.controls['end']"
|
|
2576
|
+
[format]="item.format"
|
|
2577
|
+
[item]="_endItem"
|
|
2578
|
+
[rangeLimits]="item.rangeLimits"
|
|
2579
|
+
[readonly]="readonly"
|
|
2580
|
+
></mtna-wf-date-item>
|
|
2581
|
+
</div>
|
|
2582
|
+
`, isInline: true, components: [{ type: MtnaWfDateComponent, selector: "mtna-wf-date-item", inputs: ["format", "rangeLimits"] }], directives: [{ type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$3.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { type: i3$3.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { type: i3$3.DefaultLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }, { type: i7.MtnaHighlightDirective, selector: "[mtnaHighlight]", inputs: ["mtnaHighlight", "mtnaHighlightColor"], exportAs: ["mtnaHighlight"] }, { type: i3$3.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2583
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfDateRangeComponent, decorators: [{
|
|
2584
|
+
type: Component,
|
|
2585
|
+
args: [{
|
|
2586
|
+
selector: 'mtna-wf-date-range',
|
|
2587
|
+
template: `
|
|
2588
|
+
<ng-container *ngTemplateOutlet="header"></ng-container>
|
|
2589
|
+
|
|
2590
|
+
<div
|
|
2591
|
+
*ngIf="control"
|
|
2592
|
+
class="range-item-container"
|
|
2593
|
+
fxLayout="row"
|
|
2594
|
+
fxLayoutAlign="start center"
|
|
2595
|
+
fxLayoutGap="8px"
|
|
2596
|
+
[mtnaHighlight]="indicatorStatus === 'ACTIVE' && !hasItemHeader"
|
|
2597
|
+
>
|
|
2598
|
+
<mtna-wf-date-item
|
|
2599
|
+
[control]="control.controls['start']"
|
|
2600
|
+
[format]="item.format"
|
|
2601
|
+
[item]="_startItem"
|
|
2602
|
+
[rangeLimits]="item.rangeLimits"
|
|
2603
|
+
[readonly]="readonly"
|
|
2604
|
+
></mtna-wf-date-item>
|
|
2605
|
+
<span fxFlex="14px"> to </span>
|
|
2606
|
+
<mtna-wf-date-item
|
|
2607
|
+
[control]="control.controls['end']"
|
|
2608
|
+
[format]="item.format"
|
|
2609
|
+
[item]="_endItem"
|
|
2610
|
+
[rangeLimits]="item.rangeLimits"
|
|
2611
|
+
[readonly]="readonly"
|
|
2612
|
+
></mtna-wf-date-item>
|
|
2613
|
+
</div>
|
|
2614
|
+
`,
|
|
2615
|
+
encapsulation: ViewEncapsulation.None,
|
|
2616
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2617
|
+
}]
|
|
2618
|
+
}] });
|
|
2619
|
+
|
|
2620
|
+
const MTNA_WF_DEFAULT_YEAR_RANGE = new InjectionToken('mtna.wf.default.year.range');
|
|
2621
|
+
class MtnaWfYearQuarterComponent extends BaseFormItemControl {
|
|
2622
|
+
constructor(defaultYearRange) {
|
|
2623
|
+
super();
|
|
2624
|
+
this.yearQuarterItemClass = true;
|
|
2625
|
+
this._quarterControl = new FormControl();
|
|
2626
|
+
this._yearControl = new FormControl();
|
|
2627
|
+
this._yearSelection = new Array();
|
|
2628
|
+
this.destroyObs = new Subject();
|
|
2629
|
+
/**
|
|
2630
|
+
* Sets the quarter value to `null` if the year & quarter is out of bounds of the range limits.
|
|
2631
|
+
* Otherwise, returns original value
|
|
2632
|
+
*
|
|
2633
|
+
* @param value `[number, number]` The selected [year, quarter] value
|
|
2634
|
+
* @returns `[number, number]` The original [year, quarter] value OR [year, null]
|
|
2635
|
+
*/
|
|
2636
|
+
this.withinRangeLimits = ([year, quarter]) => {
|
|
2637
|
+
var _a, _b;
|
|
2638
|
+
const beyondUpperLimit =
|
|
2639
|
+
// year matches end year range limit
|
|
2640
|
+
year === ((_a = this.rangeLimits) === null || _a === void 0 ? void 0 : _a.end.year) &&
|
|
2641
|
+
// quarter limit was provided
|
|
2642
|
+
isPresent(this.rangeLimits.end.quarter) &&
|
|
2643
|
+
// selected quarter is beyond quarter limit
|
|
2644
|
+
quarter > this.rangeLimits.end.quarter;
|
|
2645
|
+
const beyondLowerLimit =
|
|
2646
|
+
// year matches start year range limit
|
|
2647
|
+
year === ((_b = this.rangeLimits) === null || _b === void 0 ? void 0 : _b.start.year) &&
|
|
2648
|
+
// quarter limit was provided
|
|
2649
|
+
isPresent(this.rangeLimits.start.quarter) &&
|
|
2650
|
+
// selected quarter is beyond quarter limit
|
|
2651
|
+
quarter < this.rangeLimits.start.quarter;
|
|
2652
|
+
if (beyondLowerLimit || beyondUpperLimit) {
|
|
2653
|
+
this._quarterControl.setValue(null, { emitEvent: false });
|
|
2654
|
+
return [year, null];
|
|
2655
|
+
}
|
|
2656
|
+
return [year, quarter];
|
|
2657
|
+
};
|
|
2658
|
+
this.defaultYearRange = defaultYearRange || { numFutureYears: 25, numPastYears: 25 };
|
|
2659
|
+
}
|
|
2660
|
+
ngAfterViewInit() {
|
|
2661
|
+
if (!this.readonly) {
|
|
2662
|
+
// Observe Year & Quarter value changes && set them on the item's control
|
|
2663
|
+
merge(this._yearControl.valueChanges, this._quarterControl.valueChanges)
|
|
2664
|
+
.pipe(takeUntil(this.destroyObs))
|
|
2665
|
+
.subscribe(() => {
|
|
2666
|
+
var _a, _b, _c, _d;
|
|
2667
|
+
if (!((_a = this.control) === null || _a === void 0 ? void 0 : _a.dirty) && (this._yearControl.dirty || this._quarterControl.dirty)) {
|
|
2668
|
+
(_b = this.control) === null || _b === void 0 ? void 0 : _b.markAsDirty();
|
|
2669
|
+
(_c = this.control) === null || _c === void 0 ? void 0 : _c.markAsTouched();
|
|
2670
|
+
}
|
|
2671
|
+
if (isPresent(this._yearControl.value)) {
|
|
2672
|
+
const [year, quarter] = this.withinRangeLimits([this._yearControl.value, this._quarterControl.value]);
|
|
2673
|
+
(_d = this.control) === null || _d === void 0 ? void 0 : _d.setValue({ year, quarter });
|
|
2674
|
+
}
|
|
2675
|
+
});
|
|
2676
|
+
// FIXME not sure we need this until we starting making this control
|
|
2677
|
+
// required/unrequired at the right time. Even then, this is super inneficient
|
|
2678
|
+
/*
|
|
2679
|
+
// Listen to this control for disabling local controls
|
|
2680
|
+
this.control.statusChanges
|
|
2681
|
+
.pipe(
|
|
2682
|
+
startWith(this.control.status),
|
|
2683
|
+
takeUntil(this.destroyObs)
|
|
2684
|
+
)
|
|
2685
|
+
.subscribe(status => {
|
|
2686
|
+
console.warn('statusChanges', status, this.control);
|
|
2687
|
+
// if this control is enabled, enable local controls if disabled
|
|
2688
|
+
if (this.control.enabled) {
|
|
2689
|
+
if (this._quarterControl.disabled || this._yearControl.disabled) {
|
|
2690
|
+
console.warn('[YearQuarterItem] enable the things');
|
|
2691
|
+
// this._quarterControl.enable();
|
|
2692
|
+
// this._yearControl.enable();
|
|
2693
|
+
}
|
|
2694
|
+
// else this control is disabled, so disable local controls if enabled
|
|
2695
|
+
} else if (this._quarterControl.enabled || this._yearControl.enabled) {
|
|
2696
|
+
console.warn('[YearQuarterItem] disable the things');
|
|
2697
|
+
// this._yearControl.disable();
|
|
2698
|
+
// this._quarterControl.disable();
|
|
2699
|
+
}
|
|
2700
|
+
});
|
|
2701
|
+
*/
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
2704
|
+
ngOnDestroy() {
|
|
2705
|
+
this.destroyObs.next();
|
|
2706
|
+
this.destroyObs.complete();
|
|
2707
|
+
}
|
|
2708
|
+
ngOnInit() {
|
|
2709
|
+
var _a, _b, _c;
|
|
2710
|
+
// Set any initial value onto the Year & Quarter controls
|
|
2711
|
+
this._yearControl.setValue(((_a = this.control) === null || _a === void 0 ? void 0 : _a.value) ? this.control.value.year : null);
|
|
2712
|
+
this._quarterControl.setValue(((_b = this.control) === null || _b === void 0 ? void 0 : _b.value) ? this.control.value.quarter : null);
|
|
2713
|
+
// Create range limits if none exist
|
|
2714
|
+
if (!this.rangeLimits) {
|
|
2715
|
+
const thisYear = new Date().getFullYear();
|
|
2716
|
+
this.rangeLimits = {
|
|
2717
|
+
start: {
|
|
2718
|
+
year: thisYear - this.defaultYearRange.numPastYears,
|
|
2719
|
+
quarter: null,
|
|
2720
|
+
},
|
|
2721
|
+
end: {
|
|
2722
|
+
year: thisYear + this.defaultYearRange.numFutureYears,
|
|
2723
|
+
quarter: null,
|
|
2724
|
+
},
|
|
2725
|
+
};
|
|
2726
|
+
}
|
|
2727
|
+
// Populate the year selection
|
|
2728
|
+
for (let i = this.rangeLimits.start.year || 0; i <= (this.rangeLimits.end.year || 0); i++) {
|
|
2729
|
+
this._yearSelection.push(i);
|
|
2730
|
+
}
|
|
2731
|
+
if (this.readonly) {
|
|
2732
|
+
(_c = this.control) === null || _c === void 0 ? void 0 : _c.disable();
|
|
2733
|
+
this._quarterControl.disable();
|
|
2734
|
+
this._yearControl.disable();
|
|
2735
|
+
}
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
MtnaWfYearQuarterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfYearQuarterComponent, deps: [{ token: MTNA_WF_DEFAULT_YEAR_RANGE, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
2739
|
+
MtnaWfYearQuarterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfYearQuarterComponent, selector: "mtna-wf-year-quarter-item", inputs: { rangeLimits: "rangeLimits" }, host: { properties: { "class.mtna-wf-year-quarter-item": "this.yearQuarterItemClass" } }, usesInheritance: true, ngImport: i0, template: `
|
|
2740
|
+
<ng-container *ngTemplateOutlet="header"></ng-container>
|
|
2741
|
+
<div
|
|
2742
|
+
*ngIf="control"
|
|
2743
|
+
class="year-quarter-container"
|
|
2744
|
+
fxLayout="row"
|
|
2745
|
+
fxLayoutGap="8px"
|
|
2746
|
+
[mtnaHighlight]="indicatorStatus === 'ACTIVE' && !hasItemHeader"
|
|
2747
|
+
>
|
|
2748
|
+
<mat-form-field>
|
|
2749
|
+
<mat-select [formControl]="_yearControl" aria-label="year selection">
|
|
2750
|
+
<mat-option *ngFor="let year of _yearSelection" [value]="year">{{ year }}</mat-option>
|
|
2751
|
+
</mat-select>
|
|
2752
|
+
<mat-error *ngFor="let error of control.errors | keyvalue">
|
|
2753
|
+
{{ error | mtnaWfGetControlError : item }}
|
|
2754
|
+
</mat-error>
|
|
2755
|
+
</mat-form-field>
|
|
2756
|
+
|
|
2757
|
+
<mat-form-field>
|
|
2758
|
+
<mat-select [formControl]="_quarterControl" aria-label="quarter selection">
|
|
2759
|
+
<mat-option>None</mat-option>
|
|
2760
|
+
<mat-option *ngFor="let quarter of _yearControl.value | mtnaWfGetQuarters : rangeLimits" [value]="quarter">{{
|
|
2761
|
+
$any(quarter) | mtnaWfDateQuarter : 'short'
|
|
2762
|
+
}}</mat-option>
|
|
2763
|
+
</mat-select>
|
|
2764
|
+
<mat-error *ngFor="let error of control.errors | keyvalue">
|
|
2765
|
+
{{ error | mtnaWfGetControlError : item }}
|
|
2766
|
+
</mat-error>
|
|
2767
|
+
</mat-form-field>
|
|
2768
|
+
</div>
|
|
2769
|
+
`, isInline: true, styles: [".mtna-wf-control-item .mat-form-field{width:100%}.mtna-wf-control-item .mtna-wf-error-container{font-size:75%;line-height:1;min-height:1em;margin-top:-.75rem}.mtna-wf-control-item .control-item-content{padding:.35em .75em .625em}.mtna-wf-control-item .mtna-wf-item-header~:not(.mtna-wf-error-container):not(.mat-list){padding-left:.75em}.mtna-wf-control-item .mtna-wf-item-header~:not(.mtna-wf-error-container):not(.mat-list).mat-form-field{width:calc(100% - .75em)}\n", "\n .mtna-wf-year-quarter-item .year-quarter-container > .mat-form-field {\n max-width: 75px;\n }\n .mtna-wf-year-quarter-item .year-quarter-container > .mat-form-field:first-of-type {\n margin-right: 8px;\n }\n "], components: [{ type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i2$2.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i4$2.MatOption, selector: "mat-option", exportAs: ["matOption"] }], directives: [{ type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$3.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { type: i3$3.DefaultLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }, { type: i7.MtnaHighlightDirective, selector: "[mtnaHighlight]", inputs: ["mtnaHighlight", "mtnaHighlightColor"], exportAs: ["mtnaHighlight"] }, { type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i6.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$1.MatError, selector: "mat-error", inputs: ["id"] }], pipes: { "keyvalue": i3.KeyValuePipe, "mtnaWfGetControlError": MtnaGetFormControlErrorPipe, "mtnaWfGetQuarters": MtnaWfGetAvailableQuartersPipe, "mtnaWfDateQuarter": DateQuarterPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2770
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfYearQuarterComponent, decorators: [{
|
|
2771
|
+
type: Component,
|
|
2772
|
+
args: [{
|
|
2773
|
+
selector: 'mtna-wf-year-quarter-item',
|
|
2774
|
+
template: `
|
|
2775
|
+
<ng-container *ngTemplateOutlet="header"></ng-container>
|
|
2776
|
+
<div
|
|
2777
|
+
*ngIf="control"
|
|
2778
|
+
class="year-quarter-container"
|
|
2779
|
+
fxLayout="row"
|
|
2780
|
+
fxLayoutGap="8px"
|
|
2781
|
+
[mtnaHighlight]="indicatorStatus === 'ACTIVE' && !hasItemHeader"
|
|
2782
|
+
>
|
|
2783
|
+
<mat-form-field>
|
|
2784
|
+
<mat-select [formControl]="_yearControl" aria-label="year selection">
|
|
2785
|
+
<mat-option *ngFor="let year of _yearSelection" [value]="year">{{ year }}</mat-option>
|
|
2786
|
+
</mat-select>
|
|
2787
|
+
<mat-error *ngFor="let error of control.errors | keyvalue">
|
|
2788
|
+
{{ error | mtnaWfGetControlError : item }}
|
|
2789
|
+
</mat-error>
|
|
2790
|
+
</mat-form-field>
|
|
2791
|
+
|
|
2792
|
+
<mat-form-field>
|
|
2793
|
+
<mat-select [formControl]="_quarterControl" aria-label="quarter selection">
|
|
2794
|
+
<mat-option>None</mat-option>
|
|
2795
|
+
<mat-option *ngFor="let quarter of _yearControl.value | mtnaWfGetQuarters : rangeLimits" [value]="quarter">{{
|
|
2796
|
+
$any(quarter) | mtnaWfDateQuarter : 'short'
|
|
2797
|
+
}}</mat-option>
|
|
2798
|
+
</mat-select>
|
|
2799
|
+
<mat-error *ngFor="let error of control.errors | keyvalue">
|
|
2800
|
+
{{ error | mtnaWfGetControlError : item }}
|
|
2801
|
+
</mat-error>
|
|
2802
|
+
</mat-form-field>
|
|
2803
|
+
</div>
|
|
2804
|
+
`,
|
|
2805
|
+
styleUrls: [`form-control.scss`],
|
|
2806
|
+
styles: [
|
|
2807
|
+
`
|
|
2808
|
+
.mtna-wf-year-quarter-item .year-quarter-container > .mat-form-field {
|
|
2809
|
+
max-width: 75px;
|
|
2810
|
+
}
|
|
2811
|
+
.mtna-wf-year-quarter-item .year-quarter-container > .mat-form-field:first-of-type {
|
|
2812
|
+
margin-right: 8px;
|
|
2813
|
+
}
|
|
2814
|
+
`,
|
|
2815
|
+
],
|
|
2816
|
+
encapsulation: ViewEncapsulation.None,
|
|
2817
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2818
|
+
}]
|
|
2819
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
2820
|
+
type: Optional
|
|
2821
|
+
}, {
|
|
2822
|
+
type: Inject,
|
|
2823
|
+
args: [MTNA_WF_DEFAULT_YEAR_RANGE]
|
|
2824
|
+
}] }]; }, propDecorators: { yearQuarterItemClass: [{
|
|
2825
|
+
type: HostBinding,
|
|
2826
|
+
args: ['class.mtna-wf-year-quarter-item']
|
|
2827
|
+
}], rangeLimits: [{
|
|
2828
|
+
type: Input
|
|
2829
|
+
}] } });
|
|
2830
|
+
|
|
2831
|
+
class MtnaWfYearQuarterRangeComponent extends BaseFormItemControl {
|
|
2832
|
+
constructor() {
|
|
2833
|
+
super(...arguments);
|
|
2834
|
+
this.yearQuarterRangeClass = true;
|
|
2835
|
+
}
|
|
2836
|
+
}
|
|
2837
|
+
MtnaWfYearQuarterRangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfYearQuarterRangeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2838
|
+
MtnaWfYearQuarterRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfYearQuarterRangeComponent, selector: "mtna-wf-year-quarter-range-item", host: { properties: { "class.mtna-wf-year-quarter-range-item": "this.yearQuarterRangeClass" } }, usesInheritance: true, ngImport: i0, template: `
|
|
2839
|
+
<ng-container *ngTemplateOutlet="header"></ng-container>
|
|
2840
|
+
|
|
2841
|
+
<div
|
|
2842
|
+
*ngIf="control"
|
|
2843
|
+
class="range-item-container"
|
|
2844
|
+
fxLayout="row"
|
|
2845
|
+
fxLayoutAlign="start center"
|
|
2846
|
+
fxLayoutGap="8px"
|
|
2847
|
+
[mtnaHighlight]="indicatorStatus === 'ACTIVE' && !hasItemHeader"
|
|
2848
|
+
>
|
|
2849
|
+
<mtna-wf-year-quarter-item
|
|
2850
|
+
[control]="control.controls['start']"
|
|
2851
|
+
[readonly]="readonly"
|
|
2852
|
+
[rangeLimits]="item.rangeLimits"
|
|
2853
|
+
></mtna-wf-year-quarter-item>
|
|
2854
|
+
<span fxFlex="14px">to</span>
|
|
2855
|
+
<mtna-wf-year-quarter-item
|
|
2856
|
+
[control]="control.controls['end']"
|
|
2857
|
+
[readonly]="readonly"
|
|
2858
|
+
[rangeLimits]="item.rangeLimits"
|
|
2859
|
+
></mtna-wf-year-quarter-item>
|
|
2860
|
+
</div>
|
|
2861
|
+
`, isInline: true, styles: [".mtna-wf-control-item .mat-form-field{width:100%}.mtna-wf-control-item .mtna-wf-error-container{font-size:75%;line-height:1;min-height:1em;margin-top:-.75rem}.mtna-wf-control-item .control-item-content{padding:.35em .75em .625em}.mtna-wf-control-item .mtna-wf-item-header~:not(.mtna-wf-error-container):not(.mat-list){padding-left:.75em}.mtna-wf-control-item .mtna-wf-item-header~:not(.mtna-wf-error-container):not(.mat-list).mat-form-field{width:calc(100% - .75em)}\n"], components: [{ type: MtnaWfYearQuarterComponent, selector: "mtna-wf-year-quarter-item", inputs: ["rangeLimits"] }], directives: [{ type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$3.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { type: i3$3.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { type: i3$3.DefaultLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }, { type: i7.MtnaHighlightDirective, selector: "[mtnaHighlight]", inputs: ["mtnaHighlight", "mtnaHighlightColor"], exportAs: ["mtnaHighlight"] }, { type: i3$3.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2862
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfYearQuarterRangeComponent, decorators: [{
|
|
2863
|
+
type: Component,
|
|
2864
|
+
args: [{
|
|
2865
|
+
selector: 'mtna-wf-year-quarter-range-item',
|
|
2866
|
+
template: `
|
|
2867
|
+
<ng-container *ngTemplateOutlet="header"></ng-container>
|
|
2868
|
+
|
|
2869
|
+
<div
|
|
2870
|
+
*ngIf="control"
|
|
2871
|
+
class="range-item-container"
|
|
2872
|
+
fxLayout="row"
|
|
2873
|
+
fxLayoutAlign="start center"
|
|
2874
|
+
fxLayoutGap="8px"
|
|
2875
|
+
[mtnaHighlight]="indicatorStatus === 'ACTIVE' && !hasItemHeader"
|
|
2876
|
+
>
|
|
2877
|
+
<mtna-wf-year-quarter-item
|
|
2878
|
+
[control]="control.controls['start']"
|
|
2879
|
+
[readonly]="readonly"
|
|
2880
|
+
[rangeLimits]="item.rangeLimits"
|
|
2881
|
+
></mtna-wf-year-quarter-item>
|
|
2882
|
+
<span fxFlex="14px">to</span>
|
|
2883
|
+
<mtna-wf-year-quarter-item
|
|
2884
|
+
[control]="control.controls['end']"
|
|
2885
|
+
[readonly]="readonly"
|
|
2886
|
+
[rangeLimits]="item.rangeLimits"
|
|
2887
|
+
></mtna-wf-year-quarter-item>
|
|
2888
|
+
</div>
|
|
2889
|
+
`,
|
|
2890
|
+
styleUrls: [`form-control.scss`],
|
|
2891
|
+
encapsulation: ViewEncapsulation.None,
|
|
2892
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2893
|
+
}]
|
|
2894
|
+
}], propDecorators: { yearQuarterRangeClass: [{
|
|
2895
|
+
type: HostBinding,
|
|
2896
|
+
args: ['class.mtna-wf-year-quarter-range-item']
|
|
2897
|
+
}] } });
|
|
2898
|
+
|
|
2899
|
+
class MtnaWfDropdownComponent extends BaseSingleSelectionParent {
|
|
2900
|
+
constructor(uiService) {
|
|
2901
|
+
super(uiService);
|
|
2902
|
+
}
|
|
2903
|
+
}
|
|
2904
|
+
MtnaWfDropdownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfDropdownComponent, deps: [{ token: MtnaWfUIService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2905
|
+
MtnaWfDropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfDropdownComponent, selector: "mtna-wf-dropdown-item", usesInheritance: true, ngImport: i0, template: `
|
|
2906
|
+
<ng-container *ngTemplateOutlet="header; context: { $implicit: true }"></ng-container>
|
|
2907
|
+
<mat-form-field
|
|
2908
|
+
*ngIf="!readonly && !!control; else readOnly"
|
|
2909
|
+
appearance="outline"
|
|
2910
|
+
[mtnaHighlight]="indicatorStatus === 'ACTIVE' && !hasItemHeader"
|
|
2911
|
+
>
|
|
2912
|
+
<mat-label>{{ item.label }}</mat-label>
|
|
2913
|
+
<mat-select [formControl]="control" (selectionChange)="selectionChange($event)" [required]="item.required">
|
|
2914
|
+
<mat-option *ngIf="!item.required">-- None --</mat-option>
|
|
2915
|
+
<mat-option *ngFor="let opt of item.options" [value]="opt.option.id" [disabled]="control.value === opt.option.id">{{
|
|
2916
|
+
opt.option.name
|
|
2917
|
+
}}</mat-option>
|
|
2918
|
+
</mat-select>
|
|
2919
|
+
<mat-error *ngFor="let error of control.errors | keyvalue">
|
|
2920
|
+
{{ error | mtnaWfGetControlError : item }}
|
|
2921
|
+
</mat-error>
|
|
2922
|
+
</mat-form-field>
|
|
2923
|
+
|
|
2924
|
+
<ng-template #readOnly>
|
|
2925
|
+
<ng-container *ngIf="inList; else fullList">
|
|
2926
|
+
<mat-list-item *ngIf="item.required || !!item.value">
|
|
2927
|
+
<mat-icon *ngIf="item.label | getListIcon as icon" matListIcon>{{ icon }}</mat-icon>
|
|
2928
|
+
<h4 matLine>{{ item.label }}</h4>
|
|
2929
|
+
<p matLine>{{ item.value || control?.value | mtnaWfGetSelectedOptionName : item.options }}</p>
|
|
2930
|
+
</mat-list-item>
|
|
2931
|
+
</ng-container>
|
|
2932
|
+
|
|
2933
|
+
<ng-template #fullList>
|
|
2934
|
+
<mat-list>
|
|
2935
|
+
<mat-list-item *ngIf="item.required || !!item.value">
|
|
2936
|
+
<mat-icon *ngIf="item.label | getListIcon as icon" matListIcon>{{ icon }}</mat-icon>
|
|
2937
|
+
<h4 matLine>{{ item.label }}</h4>
|
|
2938
|
+
<p matLine>{{ item.value || control?.value | mtnaWfGetSelectedOptionName : item.options }}</p>
|
|
2939
|
+
</mat-list-item>
|
|
2940
|
+
</mat-list>
|
|
2941
|
+
</ng-template>
|
|
2942
|
+
</ng-template>
|
|
2943
|
+
`, isInline: true, styles: [".mtna-wf-control-item .mat-form-field{width:100%}.mtna-wf-control-item .mtna-wf-error-container{font-size:75%;line-height:1;min-height:1em;margin-top:-.75rem}.mtna-wf-control-item .control-item-content{padding:.35em .75em .625em}.mtna-wf-control-item .mtna-wf-item-header~:not(.mtna-wf-error-container):not(.mat-list){padding-left:.75em}.mtna-wf-control-item .mtna-wf-item-header~:not(.mtna-wf-error-container):not(.mat-list).mat-form-field{width:calc(100% - .75em)}\n"], components: [{ type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i2$2.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i4$2.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: i5$1.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["disableRipple", "disabled"], exportAs: ["matListItem"] }, { type: i18.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i5$1.MatList, selector: "mat-list, mat-action-list", inputs: ["disableRipple", "disabled"], exportAs: ["matList"] }], directives: [{ type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.MtnaHighlightDirective, selector: "[mtnaHighlight]", inputs: ["mtnaHighlight", "mtnaHighlightColor"], exportAs: ["mtnaHighlight"] }, { type: i2$1.MatLabel, selector: "mat-label" }, { type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i6.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i6.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$1.MatError, selector: "mat-error", inputs: ["id"] }, { type: i5$1.MatListIconCssMatStyler, selector: "[mat-list-icon], [matListIcon]" }, { type: i4$2.MatLine, selector: "[mat-line], [matLine]" }], pipes: { "keyvalue": i3.KeyValuePipe, "mtnaWfGetControlError": MtnaGetFormControlErrorPipe, "getListIcon": GetListIconPipe, "mtnaWfGetSelectedOptionName": MtnaWfGetSelectedOptionNamePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2944
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfDropdownComponent, decorators: [{
|
|
2945
|
+
type: Component,
|
|
2946
|
+
args: [{
|
|
2947
|
+
selector: 'mtna-wf-dropdown-item',
|
|
2948
|
+
template: `
|
|
2949
|
+
<ng-container *ngTemplateOutlet="header; context: { $implicit: true }"></ng-container>
|
|
2950
|
+
<mat-form-field
|
|
2951
|
+
*ngIf="!readonly && !!control; else readOnly"
|
|
2952
|
+
appearance="outline"
|
|
2953
|
+
[mtnaHighlight]="indicatorStatus === 'ACTIVE' && !hasItemHeader"
|
|
2954
|
+
>
|
|
2955
|
+
<mat-label>{{ item.label }}</mat-label>
|
|
2956
|
+
<mat-select [formControl]="control" (selectionChange)="selectionChange($event)" [required]="item.required">
|
|
2957
|
+
<mat-option *ngIf="!item.required">-- None --</mat-option>
|
|
2958
|
+
<mat-option *ngFor="let opt of item.options" [value]="opt.option.id" [disabled]="control.value === opt.option.id">{{
|
|
2959
|
+
opt.option.name
|
|
2960
|
+
}}</mat-option>
|
|
2961
|
+
</mat-select>
|
|
2962
|
+
<mat-error *ngFor="let error of control.errors | keyvalue">
|
|
2963
|
+
{{ error | mtnaWfGetControlError : item }}
|
|
2964
|
+
</mat-error>
|
|
2965
|
+
</mat-form-field>
|
|
2966
|
+
|
|
2967
|
+
<ng-template #readOnly>
|
|
2968
|
+
<ng-container *ngIf="inList; else fullList">
|
|
2969
|
+
<mat-list-item *ngIf="item.required || !!item.value">
|
|
2970
|
+
<mat-icon *ngIf="item.label | getListIcon as icon" matListIcon>{{ icon }}</mat-icon>
|
|
2971
|
+
<h4 matLine>{{ item.label }}</h4>
|
|
2972
|
+
<p matLine>{{ item.value || control?.value | mtnaWfGetSelectedOptionName : item.options }}</p>
|
|
2973
|
+
</mat-list-item>
|
|
2974
|
+
</ng-container>
|
|
2975
|
+
|
|
2976
|
+
<ng-template #fullList>
|
|
2977
|
+
<mat-list>
|
|
2978
|
+
<mat-list-item *ngIf="item.required || !!item.value">
|
|
2979
|
+
<mat-icon *ngIf="item.label | getListIcon as icon" matListIcon>{{ icon }}</mat-icon>
|
|
2980
|
+
<h4 matLine>{{ item.label }}</h4>
|
|
2981
|
+
<p matLine>{{ item.value || control?.value | mtnaWfGetSelectedOptionName : item.options }}</p>
|
|
2982
|
+
</mat-list-item>
|
|
2983
|
+
</mat-list>
|
|
2984
|
+
</ng-template>
|
|
2985
|
+
</ng-template>
|
|
2986
|
+
`,
|
|
2987
|
+
styleUrls: [`form-control.scss`],
|
|
2988
|
+
encapsulation: ViewEncapsulation.None,
|
|
2989
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2990
|
+
}]
|
|
2991
|
+
}], ctorParameters: function () { return [{ type: MtnaWfUIService }]; } });
|
|
2992
|
+
|
|
2993
|
+
class MtnaWfUnorderedListItemComponent {
|
|
2994
|
+
constructor() {
|
|
2995
|
+
this.header = null;
|
|
2996
|
+
this.indicatorStatus = 'INACTIVE';
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
MtnaWfUnorderedListItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfUnorderedListItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3000
|
+
MtnaWfUnorderedListItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfUnorderedListItemComponent, selector: "mtna-wf-unordered-list-item", inputs: { header: "header", indicatorStatus: "indicatorStatus", item: "item" }, ngImport: i0, template: `
|
|
3001
|
+
<ng-container *ngTemplateOutlet="header"></ng-container>
|
|
3002
|
+
<ul [mtnaHighlight]="indicatorStatus === 'ACTIVE' && !item.questionText && !item.descriptiveText">
|
|
3003
|
+
<li *ngFor="let item of item.value" [innerHTML]="item | mtnaWfSanitizeHtml"></li>
|
|
3004
|
+
</ul>
|
|
3005
|
+
`, isInline: true, styles: ["\n mtna-wf-unordered-list-item > ul {\n list-style: disc outside;\n padding-left: 1rem;\n }\n\n mtna-annotations-indicator + mtna-wf-value-item mtna-wf-unordered-list-item > ul {\n padding-right: 24px;\n / / provide space for annotation indicator\n }\n "], directives: [{ type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i7.MtnaHighlightDirective, selector: "[mtnaHighlight]", inputs: ["mtnaHighlight", "mtnaHighlightColor"], exportAs: ["mtnaHighlight"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "mtnaWfSanitizeHtml": MtnaWfSanitizeHtmlPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3006
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfUnorderedListItemComponent, decorators: [{
|
|
3007
|
+
type: Component,
|
|
3008
|
+
args: [{
|
|
3009
|
+
selector: 'mtna-wf-unordered-list-item',
|
|
3010
|
+
template: `
|
|
3011
|
+
<ng-container *ngTemplateOutlet="header"></ng-container>
|
|
3012
|
+
<ul [mtnaHighlight]="indicatorStatus === 'ACTIVE' && !item.questionText && !item.descriptiveText">
|
|
3013
|
+
<li *ngFor="let item of item.value" [innerHTML]="item | mtnaWfSanitizeHtml"></li>
|
|
3014
|
+
</ul>
|
|
3015
|
+
`,
|
|
3016
|
+
styles: [
|
|
3017
|
+
`
|
|
3018
|
+
mtna-wf-unordered-list-item > ul {
|
|
3019
|
+
list-style: disc outside;
|
|
3020
|
+
padding-left: 1rem;
|
|
3021
|
+
}
|
|
3022
|
+
|
|
3023
|
+
mtna-annotations-indicator + mtna-wf-value-item mtna-wf-unordered-list-item > ul {
|
|
3024
|
+
padding-right: 24px;
|
|
3025
|
+
/ / provide space for annotation indicator
|
|
3026
|
+
}
|
|
3027
|
+
`,
|
|
3028
|
+
],
|
|
3029
|
+
encapsulation: ViewEncapsulation.None,
|
|
3030
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3031
|
+
}]
|
|
3032
|
+
}], propDecorators: { header: [{
|
|
3033
|
+
type: Input
|
|
3034
|
+
}], indicatorStatus: [{
|
|
3035
|
+
type: Input
|
|
3036
|
+
}], item: [{
|
|
3037
|
+
type: Input
|
|
3038
|
+
}] } });
|
|
3039
|
+
|
|
3040
|
+
class MtnaWfOrderedListItemComponent {
|
|
3041
|
+
constructor() {
|
|
3042
|
+
this.header = null;
|
|
3043
|
+
this.indicatorStatus = 'INACTIVE';
|
|
3044
|
+
}
|
|
3045
|
+
}
|
|
3046
|
+
MtnaWfOrderedListItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfOrderedListItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3047
|
+
MtnaWfOrderedListItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfOrderedListItemComponent, selector: "mtna-wf-ordered-list-item", inputs: { header: "header", indicatorStatus: "indicatorStatus", item: "item" }, ngImport: i0, template: `
|
|
3048
|
+
<ng-container *ngTemplateOutlet="header"></ng-container>
|
|
3049
|
+
<ol [mtnaHighlight]="indicatorStatus === 'ACTIVE' && !item.questionText && !item.descriptiveText">
|
|
3050
|
+
<li *ngFor="let item of item.value" [innerHTML]="item | mtnaWfSanitizeHtml"></li>
|
|
3051
|
+
</ol>
|
|
3052
|
+
`, isInline: true, styles: ["\n mtna-wf-ordered-list-item > ol {\n list-style: decimal outside;\n padding-left: 1rem;\n }\n mtna-annotations-indicator + mtna-wf-value-item mtna-wf-ordered-list-item > ol {\n padding-right: 24px; // provide space for annotation indicator\n }\n "], directives: [{ type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i7.MtnaHighlightDirective, selector: "[mtnaHighlight]", inputs: ["mtnaHighlight", "mtnaHighlightColor"], exportAs: ["mtnaHighlight"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "mtnaWfSanitizeHtml": MtnaWfSanitizeHtmlPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3053
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfOrderedListItemComponent, decorators: [{
|
|
3054
|
+
type: Component,
|
|
3055
|
+
args: [{
|
|
3056
|
+
selector: 'mtna-wf-ordered-list-item',
|
|
3057
|
+
template: `
|
|
3058
|
+
<ng-container *ngTemplateOutlet="header"></ng-container>
|
|
3059
|
+
<ol [mtnaHighlight]="indicatorStatus === 'ACTIVE' && !item.questionText && !item.descriptiveText">
|
|
3060
|
+
<li *ngFor="let item of item.value" [innerHTML]="item | mtnaWfSanitizeHtml"></li>
|
|
3061
|
+
</ol>
|
|
3062
|
+
`,
|
|
3063
|
+
styles: [
|
|
3064
|
+
`
|
|
3065
|
+
mtna-wf-ordered-list-item > ol {
|
|
3066
|
+
list-style: decimal outside;
|
|
3067
|
+
padding-left: 1rem;
|
|
3068
|
+
}
|
|
3069
|
+
mtna-annotations-indicator + mtna-wf-value-item mtna-wf-ordered-list-item > ol {
|
|
3070
|
+
padding-right: 24px; // provide space for annotation indicator
|
|
3071
|
+
}
|
|
3072
|
+
`,
|
|
3073
|
+
],
|
|
3074
|
+
encapsulation: ViewEncapsulation.None,
|
|
3075
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3076
|
+
}]
|
|
3077
|
+
}], propDecorators: { header: [{
|
|
3078
|
+
type: Input
|
|
3079
|
+
}], indicatorStatus: [{
|
|
3080
|
+
type: Input
|
|
3081
|
+
}], item: [{
|
|
3082
|
+
type: Input
|
|
3083
|
+
}] } });
|
|
3084
|
+
|
|
3085
|
+
class MtnaWfInputComponent extends BaseFormItemControl {
|
|
3086
|
+
constructor(elementRef) {
|
|
3087
|
+
super();
|
|
3088
|
+
this.elementRef = elementRef;
|
|
3089
|
+
this.isParagraph = this._hasHostAttributes('mtnaWfParagraphItem');
|
|
3090
|
+
this.isNumberInput = this._hasHostAttributes('mtnaWfDecimalItem', 'mtnaWfWholeNumberItem');
|
|
3091
|
+
}
|
|
3092
|
+
_hasHostAttributes(...attributes) {
|
|
3093
|
+
return attributes.some((attr) => this.elementRef.nativeElement.hasAttribute(attr));
|
|
3094
|
+
}
|
|
3095
|
+
}
|
|
3096
|
+
MtnaWfInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfInputComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3097
|
+
MtnaWfInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfInputComponent, selector: "mtna-wf-input-item[mtnaWfDecimalItem],\n mtna-wf-input-item[mtnaWfParagraphItem],\n mtna-wf-input-item[mtnaWfShortAnswerItem],\n mtna-wf-input-item[mtnaWfWholeNumberItem],", usesInheritance: true, ngImport: i0, template: `
|
|
3098
|
+
<ng-container *ngTemplateOutlet="header; context: { $implicit: true }"></ng-container>
|
|
3099
|
+
<mat-form-field
|
|
3100
|
+
*ngIf="!readonly && !!control; else readOnly"
|
|
3101
|
+
appearance="outline"
|
|
3102
|
+
[mtnaHighlight]="indicatorStatus === 'ACTIVE' && !hasItemHeader"
|
|
3103
|
+
>
|
|
3104
|
+
<mat-label>{{ item.label }}</mat-label>
|
|
3105
|
+
<textarea
|
|
3106
|
+
*ngIf="isParagraph; else shortInput"
|
|
3107
|
+
matInput
|
|
3108
|
+
[formControl]="control"
|
|
3109
|
+
[required]="item.required"
|
|
3110
|
+
[attr.autocomplete]="item.label || item.name | getAutoComplete"
|
|
3111
|
+
cdkTextareaAutoSize
|
|
3112
|
+
cdkAutosizeMinRows="3"
|
|
3113
|
+
cdkAutosizeMaxRows="5"
|
|
3114
|
+
></textarea>
|
|
3115
|
+
|
|
3116
|
+
<ng-template #shortInput>
|
|
3117
|
+
<input matInput [formControl]="control!" [autocomplete]="item.label || item.name | getAutoComplete" [required]="item.required" />
|
|
3118
|
+
</ng-template>
|
|
3119
|
+
|
|
3120
|
+
<mat-error *ngFor="let error of control.errors | keyvalue | slice : 0 : 1">
|
|
3121
|
+
{{ error | mtnaWfGetControlError : item }}
|
|
3122
|
+
</mat-error>
|
|
3123
|
+
</mat-form-field>
|
|
3124
|
+
|
|
3125
|
+
<!-- READONLY -->
|
|
3126
|
+
<ng-template #readOnly>
|
|
3127
|
+
<ng-container *ngTemplateOutlet="inList ? listItem : fullList"></ng-container>
|
|
3128
|
+
</ng-template>
|
|
3129
|
+
|
|
3130
|
+
<ng-template #fullList>
|
|
3131
|
+
<mat-list>
|
|
3132
|
+
<ng-container *ngTemplateOutlet="listItem"></ng-container>
|
|
3133
|
+
</mat-list>
|
|
3134
|
+
</ng-template>
|
|
3135
|
+
|
|
3136
|
+
<ng-template #listItem>
|
|
3137
|
+
<mat-list-item class="wrappable-list-item">
|
|
3138
|
+
<!-- <mat-icon *ngIf="item.label || item.header as label" matListIcon>{{ label | getListIcon }}</mat-icon> -->
|
|
3139
|
+
<h4 *ngIf="!item.questionText && (item.label || item.name) as label" mat-line>{{ label }}</h4>
|
|
3140
|
+
<p mat-line class="wrap-line">{{ item.value || 'No Information Provided' }}</p>
|
|
3141
|
+
</mat-list-item>
|
|
3142
|
+
</ng-template>
|
|
3143
|
+
`, isInline: true, styles: [".mtna-wf-control-item .mat-form-field{width:100%}.mtna-wf-control-item .mtna-wf-error-container{font-size:75%;line-height:1;min-height:1em;margin-top:-.75rem}.mtna-wf-control-item .control-item-content{padding:.35em .75em .625em}.mtna-wf-control-item .mtna-wf-item-header~:not(.mtna-wf-error-container):not(.mat-list){padding-left:.75em}.mtna-wf-control-item .mtna-wf-item-header~:not(.mtna-wf-error-container):not(.mat-list).mat-form-field{width:calc(100% - .75em)}\n", "\n mtna-wf-input-item .mat-list-base .mat-list-item,\n mtna-wf-input-item .mat-list-base .mat-list-item.mat-list-item-with-avatar {\n height: auto;\n padding: 12px 0;\n }\n mtna-wf-input-item .mat-list-base .mat-list-item.mat-2-line,\n mtna-wf-input-item .mat-list-base .mat-list-item.mat-2-line.mat-list-item-with-avatar {\n padding: 18.5px 0;\n }\n mtna-wf-input-item .mat-list-base .mat-list-item .mat-line {\n white-space: normal;\n overflow: unset;\n text-overflow: unset;\n }\n "], components: [{ type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i5$1.MatList, selector: "mat-list, mat-action-list", inputs: ["disableRipple", "disabled"], exportAs: ["matList"] }, { type: i5$1.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["disableRipple", "disabled"], exportAs: ["matListItem"] }], directives: [{ type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.MtnaHighlightDirective, selector: "[mtnaHighlight]", inputs: ["mtnaHighlight", "mtnaHighlightColor"], exportAs: ["mtnaHighlight"] }, { type: i2$1.MatLabel, selector: "mat-label" }, { type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i6.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i6.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i6.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$1.MatError, selector: "mat-error", inputs: ["id"] }, { type: i4$2.MatLine, selector: "[mat-line], [matLine]" }], pipes: { "getAutoComplete": GetAutoCompletePipe, "slice": i3.SlicePipe, "keyvalue": i3.KeyValuePipe, "mtnaWfGetControlError": MtnaGetFormControlErrorPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3144
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfInputComponent, decorators: [{
|
|
3145
|
+
type: Component,
|
|
3146
|
+
args: [{
|
|
3147
|
+
selector: `mtna-wf-input-item[mtnaWfDecimalItem],
|
|
3148
|
+
mtna-wf-input-item[mtnaWfParagraphItem],
|
|
3149
|
+
mtna-wf-input-item[mtnaWfShortAnswerItem],
|
|
3150
|
+
mtna-wf-input-item[mtnaWfWholeNumberItem],`,
|
|
3151
|
+
template: `
|
|
3152
|
+
<ng-container *ngTemplateOutlet="header; context: { $implicit: true }"></ng-container>
|
|
3153
|
+
<mat-form-field
|
|
3154
|
+
*ngIf="!readonly && !!control; else readOnly"
|
|
3155
|
+
appearance="outline"
|
|
3156
|
+
[mtnaHighlight]="indicatorStatus === 'ACTIVE' && !hasItemHeader"
|
|
3157
|
+
>
|
|
3158
|
+
<mat-label>{{ item.label }}</mat-label>
|
|
3159
|
+
<textarea
|
|
3160
|
+
*ngIf="isParagraph; else shortInput"
|
|
3161
|
+
matInput
|
|
3162
|
+
[formControl]="control"
|
|
3163
|
+
[required]="item.required"
|
|
3164
|
+
[attr.autocomplete]="item.label || item.name | getAutoComplete"
|
|
3165
|
+
cdkTextareaAutoSize
|
|
3166
|
+
cdkAutosizeMinRows="3"
|
|
3167
|
+
cdkAutosizeMaxRows="5"
|
|
3168
|
+
></textarea>
|
|
3169
|
+
|
|
3170
|
+
<ng-template #shortInput>
|
|
3171
|
+
<input matInput [formControl]="control!" [autocomplete]="item.label || item.name | getAutoComplete" [required]="item.required" />
|
|
3172
|
+
</ng-template>
|
|
3173
|
+
|
|
3174
|
+
<mat-error *ngFor="let error of control.errors | keyvalue | slice : 0 : 1">
|
|
3175
|
+
{{ error | mtnaWfGetControlError : item }}
|
|
3176
|
+
</mat-error>
|
|
3177
|
+
</mat-form-field>
|
|
3178
|
+
|
|
3179
|
+
<!-- READONLY -->
|
|
3180
|
+
<ng-template #readOnly>
|
|
3181
|
+
<ng-container *ngTemplateOutlet="inList ? listItem : fullList"></ng-container>
|
|
3182
|
+
</ng-template>
|
|
3183
|
+
|
|
3184
|
+
<ng-template #fullList>
|
|
3185
|
+
<mat-list>
|
|
3186
|
+
<ng-container *ngTemplateOutlet="listItem"></ng-container>
|
|
3187
|
+
</mat-list>
|
|
3188
|
+
</ng-template>
|
|
3189
|
+
|
|
3190
|
+
<ng-template #listItem>
|
|
3191
|
+
<mat-list-item class="wrappable-list-item">
|
|
3192
|
+
<!-- <mat-icon *ngIf="item.label || item.header as label" matListIcon>{{ label | getListIcon }}</mat-icon> -->
|
|
3193
|
+
<h4 *ngIf="!item.questionText && (item.label || item.name) as label" mat-line>{{ label }}</h4>
|
|
3194
|
+
<p mat-line class="wrap-line">{{ item.value || 'No Information Provided' }}</p>
|
|
3195
|
+
</mat-list-item>
|
|
3196
|
+
</ng-template>
|
|
3197
|
+
`,
|
|
3198
|
+
styleUrls: [`form-control.scss`],
|
|
3199
|
+
styles: [
|
|
3200
|
+
`
|
|
3201
|
+
mtna-wf-input-item .mat-list-base .mat-list-item,
|
|
3202
|
+
mtna-wf-input-item .mat-list-base .mat-list-item.mat-list-item-with-avatar {
|
|
3203
|
+
height: auto;
|
|
3204
|
+
padding: 12px 0;
|
|
3205
|
+
}
|
|
3206
|
+
mtna-wf-input-item .mat-list-base .mat-list-item.mat-2-line,
|
|
3207
|
+
mtna-wf-input-item .mat-list-base .mat-list-item.mat-2-line.mat-list-item-with-avatar {
|
|
3208
|
+
padding: 18.5px 0;
|
|
3209
|
+
}
|
|
3210
|
+
mtna-wf-input-item .mat-list-base .mat-list-item .mat-line {
|
|
3211
|
+
white-space: normal;
|
|
3212
|
+
overflow: unset;
|
|
3213
|
+
text-overflow: unset;
|
|
3214
|
+
}
|
|
3215
|
+
`,
|
|
3216
|
+
],
|
|
3217
|
+
encapsulation: ViewEncapsulation.None,
|
|
3218
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3219
|
+
}]
|
|
3220
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
|
|
3221
|
+
|
|
3222
|
+
class MtnaWfDialogService {
|
|
3223
|
+
constructor(dialog) {
|
|
3224
|
+
this.dialog = dialog;
|
|
3225
|
+
}
|
|
3226
|
+
/**
|
|
3227
|
+
* Display the acknowledgement the user agreed to for a given option.
|
|
3228
|
+
* @param acknowledgementItem The {@link Section} that represents the acknowledgement text to display to the user.
|
|
3229
|
+
*/
|
|
3230
|
+
showAcknowledgement(acknowledgementItem) {
|
|
3231
|
+
this.dialog.open(MtnaWfFormItemDialogComponent, {
|
|
3232
|
+
closeOnNavigation: true,
|
|
3233
|
+
data: new MtnaWfFormItemDialogData(acknowledgementItem.items, acknowledgementItem.title.value || 'Acknowledgement'),
|
|
3234
|
+
disableClose: false,
|
|
3235
|
+
hasBackdrop: true,
|
|
3236
|
+
maxWidth: '500px',
|
|
3237
|
+
});
|
|
3238
|
+
}
|
|
3239
|
+
/**
|
|
3240
|
+
* Show some text in a dialog that the user needs to "acknowledge" before they can make a certain selection.
|
|
3241
|
+
* @param acknowledgementItem The {@link Section} that represents the text displayed to the user for acknowledgement.
|
|
3242
|
+
* @returns Whether the user acknowledges (agrees).
|
|
3243
|
+
*/
|
|
3244
|
+
verifyAcknowledgement(acknowledgementItem) {
|
|
3245
|
+
return this.dialog
|
|
3246
|
+
.open(MtnaWfAcknowledgeDialogComponent, {
|
|
3247
|
+
closeOnNavigation: true,
|
|
3248
|
+
data: new MtnaWfFormItemDialogData(acknowledgementItem.items, acknowledgementItem.title.value || 'Acknowledgement'),
|
|
3249
|
+
disableClose: true,
|
|
3250
|
+
hasBackdrop: true,
|
|
3251
|
+
maxWidth: '500px',
|
|
3252
|
+
})
|
|
3253
|
+
.afterClosed();
|
|
3254
|
+
}
|
|
3255
|
+
}
|
|
3256
|
+
MtnaWfDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfDialogService, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3257
|
+
MtnaWfDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfDialogService, providedIn: 'root' });
|
|
3258
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfDialogService, decorators: [{
|
|
3259
|
+
type: Injectable,
|
|
3260
|
+
args: [{ providedIn: 'root' }]
|
|
3261
|
+
}], ctorParameters: function () { return [{ type: i1.MatDialog }]; } });
|
|
3262
|
+
/*
|
|
3263
|
+
* Due to the recursive nature of these form components, we had to combine all the TS into a single file.
|
|
3264
|
+
* Perhaps when we refactor this in the future to use dynamic components, this can be avoided.
|
|
3265
|
+
* Read more about the errors if they are not in the same file here: https://angular.io/errors/NG3003
|
|
3266
|
+
*/
|
|
3267
|
+
// TODO: refactor, reduce code in here. mixins
|
|
3268
|
+
/**
|
|
3269
|
+
* A dialog that renders a form item that represents something the user needs to acknowledge.
|
|
3270
|
+
*/
|
|
3271
|
+
class MtnaWfAcknowledgeDialogComponent {
|
|
3272
|
+
constructor(data, dialogRef) {
|
|
3273
|
+
this.data = data;
|
|
3274
|
+
this.dialogRef = dialogRef;
|
|
3275
|
+
}
|
|
3276
|
+
}
|
|
3277
|
+
MtnaWfAcknowledgeDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfAcknowledgeDialogComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3278
|
+
MtnaWfAcknowledgeDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfAcknowledgeDialogComponent, selector: "mtna-wf-acknowledge-dialog", ngImport: i0, template: "<h2 *ngIf=\"data.title as title\" mat-dialog-title>{{ title }}</h2>\n<mat-dialog-content>\n <mtna-wf-item *ngFor=\"let item of data.formItems\" [item]=\"item\" [readonly]=\"true\"></mtna-wf-item>\n</mat-dialog-content>\n<mat-dialog-actions align=\"end\">\n <button [mat-dialog-close]=\"false\" mat-button>CANCEL</button>\n <button [mat-dialog-close]=\"true\" color=\"accent\" mat-raised-button>ACKNOWLEDGE</button>\n</mat-dialog-actions>\n", components: [{ type: i0.forwardRef(function () { return MtnaWfFormItemComponent; }), selector: "mtna-wf-item", inputs: ["item", "readonly", "control", "parentIds", "step"], outputs: ["focusedSection"] }, { type: i0.forwardRef(function () { return i2.MatButton; }), selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i0.forwardRef(function () { return i3.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i0.forwardRef(function () { return i1.MatDialogTitle; }), selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i0.forwardRef(function () { return i1.MatDialogContent; }), selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i0.forwardRef(function () { return i3.NgForOf; }), selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i0.forwardRef(function () { return i1.MatDialogActions; }), selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }, { type: i0.forwardRef(function () { return i1.MatDialogClose; }), selector: "[mat-dialog-close], [matDialogClose]", inputs: ["type", "mat-dialog-close", "aria-label", "matDialogClose"], exportAs: ["matDialogClose"] }] });
|
|
3279
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfAcknowledgeDialogComponent, decorators: [{
|
|
3280
|
+
type: Component,
|
|
3281
|
+
args: [{
|
|
3282
|
+
selector: 'mtna-wf-acknowledge-dialog',
|
|
3283
|
+
templateUrl: 'acknowledge-dialog.component.html',
|
|
3284
|
+
}]
|
|
3285
|
+
}], ctorParameters: function () { return [{ type: MtnaWfFormItemDialogData, decorators: [{
|
|
3286
|
+
type: Inject,
|
|
3287
|
+
args: [MAT_DIALOG_DATA]
|
|
3288
|
+
}] }, { type: i1.MatDialogRef }]; } });
|
|
3289
|
+
/**
|
|
3290
|
+
* Component that wraps an MtnaForm item.
|
|
3291
|
+
*
|
|
3292
|
+
* ChangeDetectionStrategy.OnPush was not working as of 9/19/2018.
|
|
3293
|
+
* Dynamic components in the ValueItemComponent were not being initialized (ngOnInit was never called).
|
|
3294
|
+
*
|
|
3295
|
+
* @export
|
|
3296
|
+
*/
|
|
3297
|
+
class MtnaWfFormItemComponent {
|
|
3298
|
+
constructor(_elementRef, uiService) {
|
|
3299
|
+
this._elementRef = _elementRef;
|
|
3300
|
+
this.uiService = uiService;
|
|
3301
|
+
this.visible = true;
|
|
3302
|
+
this.readonly = false;
|
|
3303
|
+
this.parentIds = new Array();
|
|
3304
|
+
this.focusedSection = new EventEmitter();
|
|
3305
|
+
this.indicatorStatus = 'INACTIVE';
|
|
3306
|
+
}
|
|
3307
|
+
get elementId() {
|
|
3308
|
+
return this.item ? this.item.instanceId : '';
|
|
3309
|
+
}
|
|
3310
|
+
ngOnInit() {
|
|
3311
|
+
if (isConditionalItem(this.item)) {
|
|
3312
|
+
this.visible = !this.item.hideOnDisable || !this.item.disabled;
|
|
3313
|
+
}
|
|
3314
|
+
this.uiService.registerSelf(this);
|
|
3315
|
+
this._elementRef.nativeElement.classList.add(`mtna-wf-${getItemClassSuffix(this.item.itemId)}`);
|
|
3316
|
+
}
|
|
3317
|
+
}
|
|
3318
|
+
MtnaWfFormItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormItemComponent, deps: [{ token: i0.ElementRef }, { token: MtnaWfUIService }], target: i0.ɵɵFactoryTarget.Component });
|
|
3319
|
+
MtnaWfFormItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfFormItemComponent, selector: "mtna-wf-item", inputs: { item: "item", readonly: "readonly", control: "control", parentIds: "parentIds", step: "step" }, outputs: { focusedSection: "focusedSection" }, host: { properties: { "@mtnaWfExpandCollapse": "this.visible", "attr.id": "this.elementId" } }, ngImport: i0, template: "<mtna-annotations-indicator\n *ngIf=\"item.annotationEnabled\"\n [annotatableId]=\"item.annotatableId\"\n color=\"primary\"\n [count]=\"annotations$ | async\"\n (status)=\"indicatorStatus = $event\"\n></mtna-annotations-indicator>\n\n<ng-container [ngSwitch]=\"item.itemId | getObjectType\">\n <mtna-wf-section\n *ngSwitchCase=\"'sectionimpl'\"\n [control]=\"$any(control)\"\n [item]=\"$any(item)\"\n [mtnaHighlight]=\"indicatorStatus === 'ACTIVE'\"\n [parentIds]=\"parentIds.concat(item.instanceId)\"\n [readonly]=\"readonly\"\n [step]=\"step\"\n (focused)=\"focusedSection.emit($event)\"\n ></mtna-wf-section>\n\n <mtna-wf-group\n *ngSwitchCase=\"'formitemgroupimpl'\"\n [indicatorStatus]=\"indicatorStatus\"\n [item]=\"$any(item)\"\n [control]=\"$any(control)\"\n [mtnaHighlight]=\"indicatorStatus === 'ACTIVE' && (!!item.descriptiveText || !!item.questionText)\"\n [parentIds]=\"parentIds.concat(item.instanceId)\"\n [readonly]=\"readonly\"\n ></mtna-wf-group>\n\n <mtna-wf-repeatable-item-container\n *ngSwitchCase=\"'repeatableitem'\"\n [indicatorStatus]=\"indicatorStatus\"\n [item]=\"$any(item)\"\n [control]=\"$any(control)\"\n [mtnaHighlight]=\"indicatorStatus === 'ACTIVE' && (!!item.descriptiveText || !!item.questionText)\"\n [parentIds]=\"parentIds.concat(item.instanceId)\"\n [readonly]=\"readonly\"\n ></mtna-wf-repeatable-item-container>\n\n <mtna-wf-value-item\n *ngSwitchDefault\n [indicatorStatus]=\"indicatorStatus\"\n [item]=\"$any(item)\"\n [control]=\"control\"\n [mtnaHighlight]=\"indicatorStatus === 'ACTIVE' && (!!item.descriptiveText || !!item.questionText)\"\n [parentIds]=\"parentIds.concat(item.instanceId)\"\n [readonly]=\"readonly\"\n ></mtna-wf-value-item>\n</ng-container>\n", styles: ["mtna-wf-item{display:block;position:relative}mtna-wf-item mtna-annotations-indicator{position:absolute;top:0;right:0;z-index:2}\n"], components: [{ type: i0.forwardRef(function () { return i6$1.MtnaAnnotationsIndicatorComponent; }), selector: "mtna-annotations-indicator", inputs: ["color", "annotatableId", "annotatableItemName", "count"], outputs: ["status"] }, { type: i0.forwardRef(function () { return MtnaWfFormSectionComponent; }), selector: "mtna-wf-section", inputs: ["indicatorStatus", "item", "readonly", "step", "control", "parentIds"], outputs: ["focused"] }, { type: i0.forwardRef(function () { return MtnaWfFormGroupComponent; }), selector: "mtna-wf-group", inputs: ["control", "indicatorStatus", "item", "parentIds", "readonly"] }, { type: i0.forwardRef(function () { return RepeatableItemContainerComponent; }), selector: "mtna-wf-repeatable-item-container", inputs: ["indicatorStatus", "item", "control", "parentIds", "readonly"] }, { type: i0.forwardRef(function () { return ValueItemComponent; }), selector: "mtna-wf-value-item", inputs: ["control", "inList", "indicatorStatus", "item", "parentIds", "readonly"] }], directives: [{ type: i0.forwardRef(function () { return i3.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i0.forwardRef(function () { return i3.NgSwitch; }), selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i0.forwardRef(function () { return i3.NgSwitchCase; }), selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i0.forwardRef(function () { return i7.MtnaHighlightDirective; }), selector: "[mtnaHighlight]", inputs: ["mtnaHighlight", "mtnaHighlightColor"], exportAs: ["mtnaHighlight"] }, { type: i0.forwardRef(function () { return i3.NgSwitchDefault; }), selector: "[ngSwitchDefault]" }], pipes: { "async": i0.forwardRef(function () { return i3.AsyncPipe; }), "getObjectType": i0.forwardRef(function () { return GetObjectTypePipe; }) }, animations: [MTNA_WF_EXPAND_COLLAPSE], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3320
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormItemComponent, decorators: [{
|
|
3321
|
+
type: Component,
|
|
3322
|
+
args: [{
|
|
3323
|
+
selector: 'mtna-wf-item',
|
|
3324
|
+
templateUrl: './form-item.component.html',
|
|
3325
|
+
styleUrls: ['./form-item.component.scss'],
|
|
3326
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3327
|
+
encapsulation: ViewEncapsulation.None,
|
|
3328
|
+
animations: [MTNA_WF_EXPAND_COLLAPSE],
|
|
3329
|
+
}]
|
|
3330
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MtnaWfUIService }]; }, propDecorators: { visible: [{
|
|
3331
|
+
type: HostBinding,
|
|
3332
|
+
args: ['@mtnaWfExpandCollapse']
|
|
3333
|
+
}], elementId: [{
|
|
3334
|
+
type: HostBinding,
|
|
3335
|
+
args: ['attr.id']
|
|
3336
|
+
}], item: [{
|
|
3337
|
+
type: Input
|
|
3338
|
+
}], readonly: [{
|
|
3339
|
+
type: Input
|
|
3340
|
+
}], control: [{
|
|
3341
|
+
type: Input
|
|
3342
|
+
}], parentIds: [{
|
|
3343
|
+
type: Input
|
|
3344
|
+
}], step: [{
|
|
3345
|
+
type: Input
|
|
3346
|
+
}], focusedSection: [{
|
|
3347
|
+
type: Output
|
|
3348
|
+
}] } });
|
|
3349
|
+
function getItemClassSuffix(itemId) {
|
|
3350
|
+
// FIXME: surely there is a stronger/better way
|
|
3351
|
+
switch (itemId) {
|
|
3352
|
+
case FORM_ITEM_GROUP_IMPL_ID:
|
|
3353
|
+
return 'group';
|
|
3354
|
+
case SECTION_ID:
|
|
3355
|
+
return 'section';
|
|
3356
|
+
case TEXT_ITEM_ID:
|
|
3357
|
+
return 'text';
|
|
3358
|
+
case TITLE_ITEM_ID:
|
|
3359
|
+
return 'title';
|
|
3360
|
+
default:
|
|
3361
|
+
return 'item';
|
|
3362
|
+
}
|
|
3363
|
+
}
|
|
3364
|
+
/**
|
|
3365
|
+
* A dialog that renders a form item.
|
|
3366
|
+
*/
|
|
3367
|
+
class MtnaWfFormItemDialogComponent {
|
|
3368
|
+
constructor(data, dialogRef) {
|
|
3369
|
+
this.data = data;
|
|
3370
|
+
this.dialogRef = dialogRef;
|
|
3371
|
+
}
|
|
3372
|
+
}
|
|
3373
|
+
MtnaWfFormItemDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormItemDialogComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3374
|
+
MtnaWfFormItemDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfFormItemDialogComponent, selector: "mtna-wf-form-item-dialog", ngImport: i0, template: "<h2 *ngIf=\"data.title as title\" mat-dialog-title>{{ title }}</h2>\n<mat-dialog-content>\n <mtna-wf-item *ngFor=\"let item of data.formItems\" [item]=\"item\" [readonly]=\"true\"></mtna-wf-item>\n</mat-dialog-content>\n<mat-dialog-actions align=\"end\">\n <button mat-button mat-dialog-close>Close</button>\n</mat-dialog-actions>\n", components: [{ type: MtnaWfFormItemComponent, selector: "mtna-wf-item", inputs: ["item", "readonly", "control", "parentIds", "step"], outputs: ["focusedSection"] }, { type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }, { type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["type", "mat-dialog-close", "aria-label", "matDialogClose"], exportAs: ["matDialogClose"] }] });
|
|
3375
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormItemDialogComponent, decorators: [{
|
|
3376
|
+
type: Component,
|
|
3377
|
+
args: [{
|
|
3378
|
+
selector: 'mtna-wf-form-item-dialog',
|
|
3379
|
+
templateUrl: 'form-item-dialog.component.html',
|
|
3380
|
+
}]
|
|
3381
|
+
}], ctorParameters: function () { return [{ type: MtnaWfFormItemDialogData, decorators: [{
|
|
3382
|
+
type: Inject,
|
|
3383
|
+
args: [MAT_DIALOG_DATA]
|
|
3384
|
+
}] }, { type: i1.MatDialogRef }]; } });
|
|
3385
|
+
class MtnaWfFormSectionComponent {
|
|
3386
|
+
constructor() {
|
|
3387
|
+
this.indicatorStatus = 'INACTIVE';
|
|
3388
|
+
this.readonly = false;
|
|
3389
|
+
this.parentIds = new Array();
|
|
3390
|
+
this.focused = new EventEmitter();
|
|
3391
|
+
}
|
|
3392
|
+
_trackByInstanceId(index, item) {
|
|
3393
|
+
return item.instanceId;
|
|
3394
|
+
}
|
|
3395
|
+
}
|
|
3396
|
+
MtnaWfFormSectionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormSectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3397
|
+
MtnaWfFormSectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfFormSectionComponent, selector: "mtna-wf-section", inputs: { indicatorStatus: "indicatorStatus", item: "item", readonly: "readonly", step: "step", control: "control", parentIds: "parentIds" }, outputs: { focused: "focused" }, ngImport: i0, template: "<mtna-wf-step-card [step]=\"step\" [subtitle]=\"item.descriptiveText\" (focused)=\"focused.emit($event)\">\n <div cardContent>\n <ng-container *ngFor=\"let subItem of item.items; trackBy: _trackByInstanceId\">\n <mat-divider\n *ngIf=\"(subItem.itemId | getObjectType) === 'formitemgroupimpl' && item.items.indexOf(subItem) !== 0\"\n class=\"section-item-divider\"\n [inset]=\"true\"\n ></mat-divider>\n\n <mtna-wf-item\n [item]=\"subItem\"\n [readonly]=\"readonly\"\n [parentIds]=\"parentIds\"\n [control]=\"!!control && !!control.controls ? control.controls[subItem.instanceId] : undefined\"\n (focusedSection)=\"focused.emit($event)\"\n ></mtna-wf-item>\n </ng-container>\n </div>\n</mtna-wf-step-card>\n", styles: [":host{display:block}mat-divider.mat-divider-horizontal.mat-divider-inset.section-item-divider{margin-top:8px;margin-bottom:8px}\n"], components: [{ type: MtnaWfStepCardComponent, selector: "mtna-wf-step-card", inputs: ["color", "step", "subtitle"], outputs: ["focused"] }, { type: i3$1.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { type: MtnaWfFormItemComponent, selector: "mtna-wf-item", inputs: ["item", "readonly", "control", "parentIds", "step"], outputs: ["focusedSection"] }], directives: [{ type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "getObjectType": GetObjectTypePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3398
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormSectionComponent, decorators: [{
|
|
3399
|
+
type: Component,
|
|
3400
|
+
args: [{
|
|
3401
|
+
selector: 'mtna-wf-section',
|
|
3402
|
+
templateUrl: './form-section.component.html',
|
|
3403
|
+
styleUrls: ['./form-section.component.scss'],
|
|
3404
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3405
|
+
}]
|
|
3406
|
+
}], propDecorators: { indicatorStatus: [{
|
|
3407
|
+
type: Input
|
|
3408
|
+
}], item: [{
|
|
3409
|
+
type: Input
|
|
3410
|
+
}], readonly: [{
|
|
3411
|
+
type: Input
|
|
3412
|
+
}], step: [{
|
|
3413
|
+
type: Input
|
|
3414
|
+
}], control: [{
|
|
3415
|
+
type: Input
|
|
3416
|
+
}], parentIds: [{
|
|
3417
|
+
type: Input
|
|
3418
|
+
}], focused: [{
|
|
3419
|
+
type: Output
|
|
3420
|
+
}] } });
|
|
3421
|
+
class MtnaWfFormGroupComponent {
|
|
3422
|
+
constructor() {
|
|
3423
|
+
this.indicatorStatus = 'INACTIVE';
|
|
3424
|
+
this.parentIds = [];
|
|
3425
|
+
this.readonly = false;
|
|
3426
|
+
this.fullWidth = {
|
|
3427
|
+
[PARAGRAPH_ANSWER_ITEM_ID]: true,
|
|
3428
|
+
[FORM_ITEM_GROUP_IMPL_ID]: true,
|
|
3429
|
+
[TEXT_ITEM_ID]: true,
|
|
3430
|
+
[TITLE_ITEM_ID]: true,
|
|
3431
|
+
};
|
|
3432
|
+
/**
|
|
3433
|
+
* If form is readonly & all child items are one of the specified types below,
|
|
3434
|
+
* we want to display this group's child items in a mat-list
|
|
3435
|
+
*/
|
|
3436
|
+
this.inList = false;
|
|
3437
|
+
}
|
|
3438
|
+
get item() {
|
|
3439
|
+
return this._item;
|
|
3440
|
+
}
|
|
3441
|
+
set item(item) {
|
|
3442
|
+
this._item = item;
|
|
3443
|
+
if (this.item) {
|
|
3444
|
+
// A list item can only display a heading line & a small text line
|
|
3445
|
+
// Compatible items should be items with short labels/headers & values
|
|
3446
|
+
// Items with multiple options, or potential nested items should not be included
|
|
3447
|
+
this.inList = this.item.items.every((i) => i.itemId === SHORT_ANSWER_ITEM_ID || i.itemId === DROPDOWN_ITEM_ID);
|
|
3448
|
+
}
|
|
3449
|
+
}
|
|
3450
|
+
_trackByInstanceId(index, section) {
|
|
3451
|
+
return section.instanceId;
|
|
3452
|
+
}
|
|
3453
|
+
}
|
|
3454
|
+
MtnaWfFormGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3455
|
+
MtnaWfFormGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfFormGroupComponent, selector: "mtna-wf-group", inputs: { control: "control", indicatorStatus: "indicatorStatus", item: "item", parentIds: "parentIds", readonly: "readonly" }, ngImport: i0, template: "<ng-container *ngIf=\"item && control\">\n <mtna-wf-item-header\n *ngIf=\"!!item.questionText || !!item.descriptiveText\"\n [descriptiveText]=\"item.descriptiveText\"\n [disabled]=\"control.disabled\"\n [questionText]=\"item.questionText\"\n [required]=\"item.required\"\n ></mtna-wf-item-header>\n <ng-template #fullLayout>\n <div\n class=\"item-group-container\"\n [mtnaHighlight]=\"indicatorStatus === 'ACTIVE' && !item.questionText && !item.descriptiveText\"\n [formGroup]=\"control\"\n [ngClass]=\"item.layout\"\n >\n <mtna-wf-item\n *ngFor=\"let subItem of item.items; trackBy: _trackByInstanceId\"\n [class.row-item]=\"item.layout === 'ROW' && !fullWidth[subItem.itemId]\"\n [ngClass.lt-md]=\"'width-100'\"\n [item]=\"subItem\"\n [control]=\"control.controls[subItem.instanceId]\"\n [parentIds]=\"parentIds\"\n [readonly]=\"readonly\"\n ></mtna-wf-item>\n </div>\n </ng-template>\n\n <!-- When readonly, && all child items should be displayed in a mat-list-->\n <mat-list *ngIf=\"readonly && inList; else fullLayout\" [ngClass]=\"item.layout\">\n <mtna-wf-value-item\n *ngFor=\"let subItem of item.items | mtnaWfItemsWithValue; trackBy: _trackByInstanceId\"\n [class.row-item]=\"item.layout === 'ROW'\"\n [ngClass.lt-md]=\"'width-100'\"\n [item]=\"subItem\"\n [inList]=\"true\"\n [parentIds]=\"parentIds\"\n [readonly]=\"true\"\n ></mtna-wf-value-item>\n </mat-list>\n</ng-container>\n", styles: ["mtna-annotations-indicator+mtna-wf-group .item-group-container{padding-top:24px}mtna-wf-group .mtna-wf-group-header{margin-top:1rem}mtna-wf-group .mtna-wf-group-description{margin-bottom:1rem}mtna-wf-group mat-list mat-list-item [mat-line]{letter-spacing:.5px}mtna-wf-group mtna-wf-multiple-choice-item{display:block}mtna-wf-group .item-group-container>.mtna-wf-group{margin-top:1rem}mtna-wf-group .item-group-container>mtna-wf-item.mtna-wf-title~mtna-wf-item:not(.mtna-wf-title):not(.row-item){padding-left:16px}mtna-wf-group .item-group-container>mtna-wf-item.mtna-wf-title~mtna-wf-item:not(.mtna-wf-title):not(.row-item).width-100{width:calc(100% - 16px)}mtna-wf-group .item-group-container>mtna-wf-item:first-of-type{margin-top:0}mtna-wf-group .item-group-container.ROW>mtna-wf-item{margin-top:0}mtna-wf-group .item-group-container.ROW>*{display:block}mtna-wf-group .item-group-container .row-item{width:calc(50% - 16px);display:inline-block;margin:0 8px}mtna-wf-group .item-group-container .width-100{width:100%}mtna-wf-group .item-group-container .width-100.row-item{width:calc(100% - 16px)}mtna-wf-group mtna-wf-item-header+.item-group-container{padding:.35em .75em .625em}mtna-wf-group mtna-wf-item-header+.item-group-container>mtna-wf-item{margin-top:0}\n"], components: [{ type: i0.forwardRef(function () { return ItemHeaderComponent; }), selector: "mtna-wf-item-header", inputs: ["descriptiveText", "disabled", "hideRequiredMarker", "invalid", "questionText", "required"] }, { type: i0.forwardRef(function () { return MtnaWfFormItemComponent; }), selector: "mtna-wf-item", inputs: ["item", "readonly", "control", "parentIds", "step"], outputs: ["focusedSection"] }, { type: i0.forwardRef(function () { return i5$1.MatList; }), selector: "mat-list, mat-action-list", inputs: ["disableRipple", "disabled"], exportAs: ["matList"] }, { type: i0.forwardRef(function () { return ValueItemComponent; }), selector: "mtna-wf-value-item", inputs: ["control", "inList", "indicatorStatus", "item", "parentIds", "readonly"] }], directives: [{ type: i0.forwardRef(function () { return i3.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i0.forwardRef(function () { return i7.MtnaHighlightDirective; }), selector: "[mtnaHighlight]", inputs: ["mtnaHighlight", "mtnaHighlightColor"], exportAs: ["mtnaHighlight"] }, { type: i0.forwardRef(function () { return i6.NgControlStatusGroup; }), selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i0.forwardRef(function () { return i6.FormGroupDirective; }), selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i0.forwardRef(function () { return i3.NgClass; }), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i0.forwardRef(function () { return i14.DefaultClassDirective; }), selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { type: i0.forwardRef(function () { return i3.NgForOf; }), selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "mtnaWfItemsWithValue": i0.forwardRef(function () { return MtnaWfItemsWithValuePipe; }) }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3456
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormGroupComponent, decorators: [{
|
|
3457
|
+
type: Component,
|
|
3458
|
+
args: [{
|
|
3459
|
+
selector: 'mtna-wf-group',
|
|
3460
|
+
templateUrl: './form-group.component.html',
|
|
3461
|
+
styleUrls: ['./form-group.component.scss'],
|
|
3462
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3463
|
+
encapsulation: ViewEncapsulation.None,
|
|
3464
|
+
}]
|
|
3465
|
+
}], propDecorators: { control: [{
|
|
3466
|
+
type: Input
|
|
3467
|
+
}], indicatorStatus: [{
|
|
3468
|
+
type: Input
|
|
3469
|
+
}], item: [{
|
|
3470
|
+
type: Input
|
|
3471
|
+
}], parentIds: [{
|
|
3472
|
+
type: Input
|
|
3473
|
+
}], readonly: [{
|
|
3474
|
+
type: Input
|
|
3475
|
+
}] } });
|
|
3476
|
+
class RepeatableItemContainerComponent {
|
|
3477
|
+
constructor(manager) {
|
|
3478
|
+
this.manager = manager;
|
|
3479
|
+
this.indicatorStatus = 'INACTIVE';
|
|
3480
|
+
this.parentIds = new Array();
|
|
3481
|
+
this.readonly = false;
|
|
3482
|
+
}
|
|
3483
|
+
addItem() {
|
|
3484
|
+
this.manager.changeMtnaFormItem(new MtnaWfFormItemChange(this.item.repeatableTemplateId, this.parentIds, 'ADD'));
|
|
3485
|
+
}
|
|
3486
|
+
removeItem(item) {
|
|
3487
|
+
const conditionChanges = this.manager.generateConditionChangeArray(item, 'REMOVE');
|
|
3488
|
+
this.manager.changeMtnaFormItem(new MtnaWfFormItemChange(item.instanceId, this.parentIds, 'REMOVE', conditionChanges));
|
|
3489
|
+
}
|
|
3490
|
+
}
|
|
3491
|
+
RepeatableItemContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RepeatableItemContainerComponent, deps: [{ token: MtnaWfManagerService }], target: i0.ɵɵFactoryTarget.Component });
|
|
3492
|
+
RepeatableItemContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: RepeatableItemContainerComponent, selector: "mtna-wf-repeatable-item-container", inputs: { indicatorStatus: "indicatorStatus", item: "item", control: "control", parentIds: "parentIds", readonly: "readonly" }, ngImport: i0, template: "<mtna-wf-item-header\n *ngIf=\"!!item.questionText || !!item.descriptiveText\"\n [descriptiveText]=\"item.descriptiveText\"\n [disabled]=\"control?.disabled || false\"\n [questionText]=\"item.questionText\"\n [required]=\"item.required\"\n></mtna-wf-item-header>\n<section [mtnaHighlight]=\"indicatorStatus === 'ACTIVE' && !item.questionText && !item.descriptiveText\">\n <mtna-wf-repeatable-item\n @repeatItemExpandCollapse\n *ngFor=\"let subitem of item.items; let first = first; trackBy: 'instanceId' | mtnaTrackByProperty\"\n >\n <button\n *ngIf=\"!readonly && item.items.length > item.minOccurrences\"\n mat-icon-button\n class=\"item-remove-button\"\n color=\"warn\"\n (click)=\"removeItem(subitem)\"\n matTooltip=\"Remove Item\"\n >\n <mat-icon>remove_circle</mat-icon>\n </button>\n <mtna-wf-item\n [item]=\"subitem\"\n [control]=\"!!control && !!control.controls ? control.controls[subitem.instanceId] : undefined\"\n [readonly]=\"readonly\"\n [parentIds]=\"parentIds\"\n ></mtna-wf-item>\n </mtna-wf-repeatable-item>\n</section>\n<button *ngIf=\"!readonly\" mat-raised-button (click)=\"addItem()\" class=\"new-item-button\" color=\"primary\">\n {{ item.additionalText || 'ADD' | uppercase }}\n</button>\n", styles: ["mtna-wf-repeatable-item-container{display:block}mtna-wf-repeatable-item-container>section>mtna-wf-repeatable-item{position:relative;padding:16px;border-style:dashed;border-width:4px;border-radius:4px;display:inline-block;margin:8px;max-width:100%}mtna-wf-repeatable-item-container>section>mtna-wf-repeatable-item .item-remove-button{position:absolute;top:-22px;left:-22px}mtna-wf-repeatable-item-container>section>mtna-wf-repeatable-item>mtna-wf-item:first-child{margin-top:0}mtna-wf-repeatable-item-container .new-item-button{margin-left:.75em}mtna-wf-repeatable-item-container>section{padding-left:.75em}mtna-wf-repeatable-item-container>section,mtna-wf-repeatable-item-container .new-item-button{margin-top:16px}\n"], components: [{ type: ItemHeaderComponent, selector: "mtna-wf-item-header", inputs: ["descriptiveText", "disabled", "hideRequiredMarker", "invalid", "questionText", "required"] }, { type: RepeatableItemComponent, selector: "mtna-wf-repeatable-item" }, { type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i18.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: MtnaWfFormItemComponent, selector: "mtna-wf-item", inputs: ["item", "readonly", "control", "parentIds", "step"], outputs: ["focusedSection"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.MtnaHighlightDirective, selector: "[mtnaHighlight]", inputs: ["mtnaHighlight", "mtnaHighlightColor"], exportAs: ["mtnaHighlight"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i19.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }], pipes: { "mtnaTrackByProperty": i7.MtnaTrackByPropertyPipe, "uppercase": i3.UpperCasePipe }, animations: [
|
|
3493
|
+
trigger('repeatItemExpandCollapse', [
|
|
3494
|
+
state('in', style({ height: '*', margin: '*', opacity: 1 })),
|
|
3495
|
+
state('void', style({ height: 0, margin: 0, opacity: 0, visibility: 'hidden' })),
|
|
3496
|
+
transition(':enter', [animate(COMPLEX_STANDARD, style({ height: '*', margin: '*', opacity: 1 }))]),
|
|
3497
|
+
transition(':leave', animate(COMPLEX_STANDARD)),
|
|
3498
|
+
]),
|
|
3499
|
+
], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3500
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RepeatableItemContainerComponent, decorators: [{
|
|
3501
|
+
type: Component,
|
|
3502
|
+
args: [{
|
|
3503
|
+
selector: 'mtna-wf-repeatable-item-container',
|
|
3504
|
+
templateUrl: 'repeatable-item-container.component.html',
|
|
3505
|
+
styleUrls: [`repeatable-item-container.component.scss`],
|
|
3506
|
+
animations: [
|
|
3507
|
+
trigger('repeatItemExpandCollapse', [
|
|
3508
|
+
state('in', style({ height: '*', margin: '*', opacity: 1 })),
|
|
3509
|
+
state('void', style({ height: 0, margin: 0, opacity: 0, visibility: 'hidden' })),
|
|
3510
|
+
transition(':enter', [animate(COMPLEX_STANDARD, style({ height: '*', margin: '*', opacity: 1 }))]),
|
|
3511
|
+
transition(':leave', animate(COMPLEX_STANDARD)),
|
|
3512
|
+
]),
|
|
3513
|
+
],
|
|
3514
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3515
|
+
encapsulation: ViewEncapsulation.None,
|
|
3516
|
+
}]
|
|
3517
|
+
}], ctorParameters: function () { return [{ type: MtnaWfManagerService }]; }, propDecorators: { indicatorStatus: [{
|
|
3518
|
+
type: Input
|
|
3519
|
+
}], item: [{
|
|
3520
|
+
type: Input
|
|
3521
|
+
}], control: [{
|
|
3522
|
+
type: Input
|
|
3523
|
+
}], parentIds: [{
|
|
3524
|
+
type: Input
|
|
3525
|
+
}], readonly: [{
|
|
3526
|
+
type: Input
|
|
3527
|
+
}] } });
|
|
3528
|
+
class MtnaWfTableFormItemComponent {
|
|
3529
|
+
constructor() {
|
|
3530
|
+
this.indicatorStatus = 'INACTIVE';
|
|
3531
|
+
this.readonly = false;
|
|
3532
|
+
this.parentIds = new Array();
|
|
3533
|
+
}
|
|
3534
|
+
_trackByTableRow(index, row) {
|
|
3535
|
+
return row.items
|
|
3536
|
+
.filter((i) => !!i)
|
|
3537
|
+
.map((item) => item.instanceId)
|
|
3538
|
+
.join('');
|
|
3539
|
+
}
|
|
3540
|
+
}
|
|
3541
|
+
MtnaWfTableFormItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfTableFormItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3542
|
+
MtnaWfTableFormItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfTableFormItemComponent, selector: "mtna-wf-table-item", inputs: { indicatorStatus: "indicatorStatus", item: "item", control: "control", readonly: "readonly", parentIds: "parentIds" }, ngImport: i0, template: "<table mat-table [dataSource]=\"item.tableRows\" [trackBy]=\"_trackByTableRow\">\n <ng-container *ngFor=\"let header of item.headers; let index = index\" [matColumnDef]=\"header\">\n <th mat-header-cell *matHeaderCellDef>{{ header }}</th>\n\n <td mat-cell *matCellDef=\"let rowItem\">\n <mtna-wf-item\n *ngIf=\"!!rowItem.items[index]\"\n [control]=\"!!control && !!control.controls ? control.controls[rowItem.items[index].instanceId] : undefined\"\n [item]=\"rowItem.items[index]\"\n [readonly]=\"readonly\"\n [parentIds]=\"parentIds\"\n ></mtna-wf-item>\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"item.headers\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: item.headers\"></tr>\n</table>\n", styles: ["mtna-wf-table-item .mat-table{width:100%}mtna-wf-table-item .mat-table tbody tr td.mat-cell{padding:8px;vertical-align:top}mtna-wf-table-item .mat-table tbody tr td mtna-wf-group>.group{flex-direction:column;place-content:start start;align-items:start;justify-content:start}mtna-wf-table-item .mat-table tbody tr td mtna-wf-group>.group *{margin-top:0;margin-bottom:0}mtna-wf-table-item .mat-table tbody tr td mtna-wf-boolean-item>.mat-slide-toggle{margin-bottom:8px;margin-top:8px}mtna-wf-table-item .mat-table tbody tr td mtna-wf-repeatable-item-container .repeat-item-container:not(:first-of-type){margin-top:8px}mtna-wf-table-item .mat-table tbody tr td mtna-wf-repeatable-item-container .new-item-button{margin:8px 0}\n"], components: [{ type: i20.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { type: MtnaWfFormItemComponent, selector: "mtna-wf-item", inputs: ["item", "readonly", "control", "parentIds", "step"], outputs: ["focusedSection"] }, { type: i20.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { type: i20.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }], directives: [{ type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i20.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { type: i20.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { type: i20.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { type: i20.MatCellDef, selector: "[matCellDef]" }, { type: i20.MatCell, selector: "mat-cell, td[mat-cell]" }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i20.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { type: i20.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3543
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfTableFormItemComponent, decorators: [{
|
|
3544
|
+
type: Component,
|
|
3545
|
+
args: [{
|
|
3546
|
+
selector: 'mtna-wf-table-item',
|
|
3547
|
+
templateUrl: 'table-item.component.html',
|
|
3548
|
+
styleUrls: ['table-item.component.scss'],
|
|
3549
|
+
encapsulation: ViewEncapsulation.None,
|
|
3550
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3551
|
+
}]
|
|
3552
|
+
}], propDecorators: { indicatorStatus: [{
|
|
3553
|
+
type: Input
|
|
3554
|
+
}], item: [{
|
|
3555
|
+
type: Input
|
|
3556
|
+
}], control: [{
|
|
3557
|
+
type: Input
|
|
3558
|
+
}], readonly: [{
|
|
3559
|
+
type: Input
|
|
3560
|
+
}], parentIds: [{
|
|
3561
|
+
type: Input
|
|
3562
|
+
}] } });
|
|
3563
|
+
class ValueItemComponent {
|
|
3564
|
+
constructor(cdf, cfResolver, formManager, logger, whiteList) {
|
|
3565
|
+
this.cdf = cdf;
|
|
3566
|
+
this.cfResolver = cfResolver;
|
|
3567
|
+
this.formManager = formManager;
|
|
3568
|
+
this.logger = logger;
|
|
3569
|
+
this.whiteList = whiteList;
|
|
3570
|
+
this.inList = false;
|
|
3571
|
+
this.indicatorStatus = 'INACTIVE';
|
|
3572
|
+
this.parentIds = new Array();
|
|
3573
|
+
this.readonly = false;
|
|
3574
|
+
/** The list of pre-existing(non-dynamic) item types
|
|
3575
|
+
* If this item's itemId does not match one of the following, then
|
|
3576
|
+
* this item is a dynamic component registered by the client application
|
|
3577
|
+
* & requires the ComponentFactory to create the component.
|
|
3578
|
+
*/
|
|
3579
|
+
this.fixedItemTypes = [
|
|
3580
|
+
'booleanitem',
|
|
3581
|
+
'bulletedlistitem',
|
|
3582
|
+
'checkboxitem',
|
|
3583
|
+
'dateitem',
|
|
3584
|
+
'daterangeitem',
|
|
3585
|
+
'decimalansweritem',
|
|
3586
|
+
'documentationitem',
|
|
3587
|
+
'dropdownitem',
|
|
3588
|
+
'fileuploaditem',
|
|
3589
|
+
'multiplechoiceitem',
|
|
3590
|
+
'numberedlistitem',
|
|
3591
|
+
'offsetdaterangeitem',
|
|
3592
|
+
'paragraphansweritem',
|
|
3593
|
+
'shortansweritem',
|
|
3594
|
+
'tableitem',
|
|
3595
|
+
'textitem',
|
|
3596
|
+
'titleitem',
|
|
3597
|
+
'wholenumberansweritem',
|
|
3598
|
+
'yearquarterrangeitem',
|
|
3599
|
+
];
|
|
3600
|
+
}
|
|
3601
|
+
/**
|
|
3602
|
+
* Sets a value on the control for any components that only emit a value &
|
|
3603
|
+
* do not directly manipulate their control themselves, i.e. a FileUploadItem
|
|
3604
|
+
*
|
|
3605
|
+
* @param item the value to be set on the control
|
|
3606
|
+
*/
|
|
3607
|
+
setValue(item) {
|
|
3608
|
+
var _a, _b;
|
|
3609
|
+
(_a = this.control) === null || _a === void 0 ? void 0 : _a.markAsDirty();
|
|
3610
|
+
(_b = this.control) === null || _b === void 0 ? void 0 : _b.setValue(item);
|
|
3611
|
+
}
|
|
3612
|
+
/**
|
|
3613
|
+
* Renders a dynamic component from a relevant type in the FormService (registered)components;
|
|
3614
|
+
* ONLY if the item type(using itemId) does not match one of the existing fixedItemTypes
|
|
3615
|
+
*
|
|
3616
|
+
*/
|
|
3617
|
+
ngAfterViewInit() {
|
|
3618
|
+
var _a, _b;
|
|
3619
|
+
// Trim the itemId down to the relevant type
|
|
3620
|
+
const newId = this.item.itemId.toLowerCase().split('.');
|
|
3621
|
+
const type = newId[newId.length - 1];
|
|
3622
|
+
// Check if type is not one of the fixedItemTypes
|
|
3623
|
+
if (!this.fixedItemTypes.some((i) => i === type)) {
|
|
3624
|
+
// Retrieve a relevant component type
|
|
3625
|
+
const component = this.formManager.getDynamicComponent(type);
|
|
3626
|
+
// if a type is returned, instantiate the component and set the input values, then mark
|
|
3627
|
+
// the value item for changeDetection check
|
|
3628
|
+
if (component) {
|
|
3629
|
+
const componentFactory = this.cfResolver.resolveComponentFactory(component);
|
|
3630
|
+
this.componentRef = (_a = this.itemHost) === null || _a === void 0 ? void 0 : _a.viewContainerRef.createComponent(componentFactory);
|
|
3631
|
+
const instance = (_b = this.componentRef) === null || _b === void 0 ? void 0 : _b.instance;
|
|
3632
|
+
if (instance) {
|
|
3633
|
+
for (const input of componentFactory.inputs) {
|
|
3634
|
+
const propName = input.propName;
|
|
3635
|
+
// Forcefully assign every input from this to instance
|
|
3636
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3637
|
+
instance[propName] = this[propName];
|
|
3638
|
+
}
|
|
3639
|
+
}
|
|
3640
|
+
// Dynamic Component won't fire ngOnInit unless we detectChanges
|
|
3641
|
+
this.cdf.detectChanges();
|
|
3642
|
+
}
|
|
3643
|
+
else if (!this.whiteList || !this.whiteList.itemTypes || !this.whiteList.itemTypes.some((t) => t === type)) {
|
|
3644
|
+
this.logger.error(`No Component Found for ${type} - Ensure any dynamic components were registered in the service, or use the MtnaWfItemWhiteList to ignore this item.`);
|
|
3645
|
+
}
|
|
3646
|
+
}
|
|
3647
|
+
}
|
|
3648
|
+
ngOnChanges(changes) {
|
|
3649
|
+
if (this.componentRef) {
|
|
3650
|
+
for (const prop in changes) {
|
|
3651
|
+
if (Object.prototype.hasOwnProperty.call(changes, prop)) {
|
|
3652
|
+
const change = changes[prop];
|
|
3653
|
+
if (!change.firstChange && isKey(this.componentRef.instance, prop)) {
|
|
3654
|
+
this.componentRef.instance[prop] = change.currentValue;
|
|
3655
|
+
}
|
|
3656
|
+
}
|
|
3657
|
+
}
|
|
3658
|
+
}
|
|
3659
|
+
}
|
|
3660
|
+
/**
|
|
3661
|
+
* Used to destroy the componentRef to a dynamic component, if it was rendered.
|
|
3662
|
+
*
|
|
3663
|
+
*/
|
|
3664
|
+
ngOnDestroy() {
|
|
3665
|
+
if (this.componentRef) {
|
|
3666
|
+
this.componentRef.destroy();
|
|
3667
|
+
}
|
|
3668
|
+
}
|
|
3669
|
+
}
|
|
3670
|
+
ValueItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ValueItemComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ComponentFactoryResolver }, { token: MtnaWfManagerService }, { token: i7.MtnaLogger }, { token: MTNA_WF_ITEM_WHITELIST, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
3671
|
+
ValueItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ValueItemComponent, selector: "mtna-wf-value-item", inputs: { control: "control", inList: "inList", indicatorStatus: "indicatorStatus", item: "item", parentIds: "parentIds", readonly: "readonly" }, viewQueries: [{ propertyName: "itemHost", first: true, predicate: MtnaWfFormItemDirective, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<ng-container [ngSwitch]=\"item.itemId | getObjectType\">\n <h3 *ngSwitchCase=\"'titleitem'\" class=\"mtna-wf-title-item\" [mtnaHighlight]=\"indicatorStatus === 'ACTIVE'\">{{ item.value }}</h3>\n <p\n *ngSwitchCase=\"'textitem'\"\n [innerHTML]=\"$any(item.value) | mtnaWfSanitizeHtml\"\n class=\"mtna-wf-text-item\"\n [mtnaHighlight]=\"indicatorStatus === 'ACTIVE'\"\n ></p>\n\n <mtna-wf-boolean-item\n *ngSwitchCase=\"'booleanitem'\"\n [header]=\"itemHeader\"\n [indicatorStatus]=\"indicatorStatus\"\n [item]=\"$any(item)\"\n [control]=\"$any(control)\"\n [mtnaHighlight]=\"indicatorStatus === 'ACTIVE'\"\n [parentIds]=\"parentIds\"\n [readonly]=\"readonly\"\n ></mtna-wf-boolean-item>\n\n <mtna-wf-checkbox-item\n *ngSwitchCase=\"'checkboxitem'\"\n [header]=\"itemHeader\"\n [indicatorStatus]=\"indicatorStatus\"\n [item]=\"$any(item)\"\n [control]=\"$any(control)\"\n [parentIds]=\"parentIds\"\n [readonly]=\"readonly\"\n ></mtna-wf-checkbox-item>\n\n <ng-container *ngSwitchCase=\"'dateitem'\">\n <mtna-wf-date-item\n *ngIf=\"item | coerceDateItem as dateItem\"\n [header]=\"itemHeader\"\n [indicatorStatus]=\"indicatorStatus\"\n [format]=\"dateItem.format\"\n [item]=\"dateItem\"\n [control]=\"$any(control)\"\n [readonly]=\"readonly\"\n ></mtna-wf-date-item>\n </ng-container>\n\n <mtna-wf-date-range\n *ngSwitchCase=\"'offsetdaterangeitem'\"\n [header]=\"itemHeader\"\n [indicatorStatus]=\"indicatorStatus\"\n [item]=\"$any(item)\"\n [control]=\"$any(control)\"\n [readonly]=\"readonly\"\n ></mtna-wf-date-range>\n\n <mtna-wf-year-quarter-range-item\n *ngSwitchCase=\"'yearquarterrangeitem'\"\n [header]=\"itemHeader\"\n [indicatorStatus]=\"indicatorStatus\"\n [item]=\"$any(item)\"\n [control]=\"$any(control)\"\n [readonly]=\"readonly\"\n ></mtna-wf-year-quarter-range-item>\n\n <mtna-wf-dropdown-item\n *ngSwitchCase=\"'dropdownitem'\"\n [header]=\"itemHeader\"\n [indicatorStatus]=\"indicatorStatus\"\n [item]=\"$any(item)\"\n [inList]=\"inList\"\n [control]=\"$any(control)\"\n [readonly]=\"readonly\"\n ></mtna-wf-dropdown-item>\n\n <mtna-wf-file-upload-item\n *ngSwitchCase=\"'fileuploaditem'\"\n [header]=\"itemHeader\"\n [indicatorStatus]=\"indicatorStatus\"\n [item]=\"$any(item)\"\n [readonly]=\"readonly\"\n (file)=\"setValue($event)\"\n ></mtna-wf-file-upload-item>\n\n <mtna-wf-unordered-list-item\n *ngSwitchCase=\"'bulletedlistitem'\"\n [header]=\"itemHeader\"\n [indicatorStatus]=\"indicatorStatus\"\n [item]=\"$any(item)\"\n ></mtna-wf-unordered-list-item>\n\n <mtna-wf-ordered-list-item\n *ngSwitchCase=\"'numberedlistitem'\"\n [header]=\"itemHeader\"\n [indicatorStatus]=\"indicatorStatus\"\n [item]=\"$any(item)\"\n ></mtna-wf-ordered-list-item>\n\n <mtna-wf-multiple-choice-item\n *ngSwitchCase=\"'multiplechoiceitem'\"\n [header]=\"itemHeader\"\n [indicatorStatus]=\"indicatorStatus\"\n [item]=\"$any(item)\"\n [control]=\"$any(control)\"\n [parentIds]=\"parentIds\"\n [readonly]=\"readonly\"\n ></mtna-wf-multiple-choice-item>\n\n <mtna-wf-input-item\n *ngSwitchCase=\"'shortansweritem'\"\n mtnaWfShortAnswerItem\n [control]=\"$any(control)\"\n [header]=\"itemHeader\"\n [indicatorStatus]=\"indicatorStatus\"\n [inList]=\"inList\"\n [item]=\"$any(item)\"\n [readonly]=\"readonly\"\n ></mtna-wf-input-item>\n\n <mtna-wf-input-item\n *ngSwitchCase=\"'paragraphansweritem'\"\n mtnaWfParagraphItem\n [control]=\"$any(control)\"\n [header]=\"itemHeader\"\n [indicatorStatus]=\"indicatorStatus\"\n [inList]=\"inList\"\n [item]=\"$any(item)\"\n [readonly]=\"readonly\"\n ></mtna-wf-input-item>\n\n <mtna-wf-table-item\n *ngSwitchCase=\"'tableitem'\"\n [control]=\"$any(control)\"\n [indicatorStatus]=\"indicatorStatus\"\n [item]=\"$any(item)\"\n [readonly]=\"readonly\"\n [parentIds]=\"parentIds\"\n ></mtna-wf-table-item>\n\n <mtna-wf-input-item\n *ngSwitchCase=\"'decimalansweritem'\"\n mtnaWfDecimalItem\n [control]=\"$any(control)\"\n [header]=\"itemHeader\"\n [indicatorStatus]=\"indicatorStatus\"\n [inList]=\"inList\"\n [item]=\"$any(item)\"\n [readonly]=\"readonly\"\n ></mtna-wf-input-item>\n\n <mtna-wf-input-item\n *ngSwitchCase=\"'wholenumberansweritem'\"\n mtnaWfWholeNumberItem\n [control]=\"$any(control)\"\n [header]=\"itemHeader\"\n [indicatorStatus]=\"indicatorStatus\"\n [inList]=\"inList\"\n [item]=\"$any(item)\"\n [readonly]=\"readonly\"\n ></mtna-wf-input-item>\n\n <!-- DYNAMIC COMPONENT CONTAINER -->\n <ng-template *ngSwitchDefault formItemHost></ng-template>\n</ng-container>\n\n<ng-template #itemHeader let-hideRequiredMarker>\n <mtna-wf-item-header\n *ngIf=\"!!item.questionText || !!item.descriptiveText\"\n [descriptiveText]=\"item.descriptiveText\"\n [disabled]=\"control?.disabled\"\n [hideRequiredMarker]=\"hideRequiredMarker\"\n [invalid]=\"control?.invalid && (control?.dirty || control?.touched)\"\n [questionText]=\"item.questionText\"\n [required]=\"item.required\"\n ></mtna-wf-item-header>\n</ng-template>\n", components: [{ type: i0.forwardRef(function () { return MtnaWfBooleanComponent; }), selector: "mtna-wf-boolean-item" }, { type: i0.forwardRef(function () { return MtnaWfCheckboxComponent; }), selector: "mtna-wf-checkbox-item", inputs: ["color"] }, { type: i0.forwardRef(function () { return MtnaWfDateComponent; }), selector: "mtna-wf-date-item", inputs: ["format", "rangeLimits"] }, { type: i0.forwardRef(function () { return MtnaWfDateRangeComponent; }), selector: "mtna-wf-date-range" }, { type: i0.forwardRef(function () { return MtnaWfYearQuarterRangeComponent; }), selector: "mtna-wf-year-quarter-range-item" }, { type: i0.forwardRef(function () { return MtnaWfDropdownComponent; }), selector: "mtna-wf-dropdown-item" }, { type: i0.forwardRef(function () { return MtnaWfFileUploadComponent; }), selector: "mtna-wf-file-upload-item", inputs: ["header", "indicatorStatus", "item", "readonly"], outputs: ["file"] }, { type: i0.forwardRef(function () { return MtnaWfUnorderedListItemComponent; }), selector: "mtna-wf-unordered-list-item", inputs: ["header", "indicatorStatus", "item"] }, { type: i0.forwardRef(function () { return MtnaWfOrderedListItemComponent; }), selector: "mtna-wf-ordered-list-item", inputs: ["header", "indicatorStatus", "item"] }, { type: i0.forwardRef(function () { return MtnaWfMultipleChoiceComponent; }), selector: "mtna-wf-multiple-choice-item" }, { type: i0.forwardRef(function () { return MtnaWfInputComponent; }), selector: "mtna-wf-input-item[mtnaWfDecimalItem],\n mtna-wf-input-item[mtnaWfParagraphItem],\n mtna-wf-input-item[mtnaWfShortAnswerItem],\n mtna-wf-input-item[mtnaWfWholeNumberItem]," }, { type: i0.forwardRef(function () { return MtnaWfTableFormItemComponent; }), selector: "mtna-wf-table-item", inputs: ["indicatorStatus", "item", "control", "readonly", "parentIds"] }, { type: i0.forwardRef(function () { return ItemHeaderComponent; }), selector: "mtna-wf-item-header", inputs: ["descriptiveText", "disabled", "hideRequiredMarker", "invalid", "questionText", "required"] }], directives: [{ type: i0.forwardRef(function () { return i3.NgSwitch; }), selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i0.forwardRef(function () { return i3.NgSwitchCase; }), selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i0.forwardRef(function () { return i7.MtnaHighlightDirective; }), selector: "[mtnaHighlight]", inputs: ["mtnaHighlight", "mtnaHighlightColor"], exportAs: ["mtnaHighlight"] }, { type: i0.forwardRef(function () { return i3.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i0.forwardRef(function () { return i3.NgSwitchDefault; }), selector: "[ngSwitchDefault]" }, { type: i0.forwardRef(function () { return MtnaWfFormItemDirective; }), selector: "[formItemHost]" }], pipes: { "getObjectType": i0.forwardRef(function () { return GetObjectTypePipe; }), "mtnaWfSanitizeHtml": i0.forwardRef(function () { return MtnaWfSanitizeHtmlPipe; }), "coerceDateItem": i0.forwardRef(function () { return CoerceDateItemPipe; }) }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3672
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ValueItemComponent, decorators: [{
|
|
3673
|
+
type: Component,
|
|
3674
|
+
args: [{
|
|
3675
|
+
selector: 'mtna-wf-value-item',
|
|
3676
|
+
templateUrl: './value-item.component.html',
|
|
3677
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3678
|
+
}]
|
|
3679
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ComponentFactoryResolver }, { type: MtnaWfManagerService }, { type: i7.MtnaLogger }, { type: undefined, decorators: [{
|
|
3680
|
+
type: Optional
|
|
3681
|
+
}, {
|
|
3682
|
+
type: Inject,
|
|
3683
|
+
args: [MTNA_WF_ITEM_WHITELIST]
|
|
3684
|
+
}] }]; }, propDecorators: { itemHost: [{
|
|
3685
|
+
type: ViewChild,
|
|
3686
|
+
args: [MtnaWfFormItemDirective]
|
|
3687
|
+
}], control: [{
|
|
3688
|
+
type: Input
|
|
3689
|
+
}], inList: [{
|
|
3690
|
+
type: Input
|
|
3691
|
+
}], indicatorStatus: [{
|
|
3692
|
+
type: Input
|
|
3693
|
+
}], item: [{
|
|
3694
|
+
type: Input
|
|
3695
|
+
}], parentIds: [{
|
|
3696
|
+
type: Input
|
|
3697
|
+
}], readonly: [{
|
|
3698
|
+
type: Input
|
|
3699
|
+
}] } });
|
|
3700
|
+
class MtnaWfMultipleChoiceComponent extends BaseSingleSelectionParent {
|
|
3701
|
+
constructor(uiService) {
|
|
3702
|
+
super(uiService);
|
|
3703
|
+
}
|
|
3704
|
+
}
|
|
3705
|
+
MtnaWfMultipleChoiceComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfMultipleChoiceComponent, deps: [{ token: MtnaWfUIService }], target: i0.ɵɵFactoryTarget.Component });
|
|
3706
|
+
MtnaWfMultipleChoiceComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfMultipleChoiceComponent, selector: "mtna-wf-multiple-choice-item", usesInheritance: true, ngImport: i0, template: "<ng-container *ngTemplateOutlet=\"header\"></ng-container>\n<ng-container *ngIf=\"control\">\n <div class=\"mtna-wf-error-container\">\n <ng-container *ngIf=\"control.invalid && (control.dirty || control.touched)\">\n <mat-error *ngFor=\"let error of control.errors | keyvalue\">\n {{ error | mtnaWfGetControlError : item }}\n </mat-error>\n </ng-container>\n </div>\n <mat-radio-group class=\"control-item-content\" [formControl]=\"control\" (change)=\"selectionChange($event)\">\n <ng-container *ngFor=\"let opt of item.options; trackBy: _trackByOptionId\">\n <mat-radio-button [disableRipple]=\"readonly\" [value]=\"opt.option.id\">{{ opt.option.name }}</mat-radio-button>\n <mtna-wf-item\n *ngIf=\"item.optionItemMap[opt.option.id] as subItem\"\n [item]=\"subItem\"\n [control]=\"!!controlWrapper && !!controlWrapper.controls ? controlWrapper.controls[subItem.instanceId] : undefined\"\n [parentIds]=\"parentIds.concat(opt.option.id)\"\n [readonly]=\"readonly\"\n ></mtna-wf-item>\n </ng-container>\n </mat-radio-group>\n</ng-container>\n", styles: [".mtna-wf-control-item .mat-form-field{width:100%}.mtna-wf-control-item .mtna-wf-error-container{font-size:75%;line-height:1;min-height:1em;margin-top:-.75rem}.mtna-wf-control-item .control-item-content{padding:.35em .75em .625em}.mtna-wf-control-item .mtna-wf-item-header~:not(.mtna-wf-error-container):not(.mat-list){padding-left:.75em}.mtna-wf-control-item .mtna-wf-item-header~:not(.mtna-wf-error-container):not(.mat-list).mat-form-field{width:calc(100% - .75em)}\n", "mtna-wf-multiple-choice-item .mat-radio-group{display:inline-block;max-width:100%;width:100%}mtna-wf-multiple-choice-item .mat-radio-button{display:block;max-width:100%}mtna-wf-multiple-choice-item .mat-radio-button:not(:last-of-type){margin-bottom:4px}mtna-wf-multiple-choice-item .mat-radio-button .mat-radio-label{white-space:normal}mtna-wf-multiple-choice-item .mat-radio-button+mtna-wf-item{padding-left:28px;margin-top:0}mtna-wf-multiple-choice-item.read-only .mat-radio-button .mat-radio-label{cursor:default}\n"], components: [{ type: i32.MatRadioButton, selector: "mat-radio-button", inputs: ["disableRipple", "tabIndex"], exportAs: ["matRadioButton"] }, { type: MtnaWfFormItemComponent, selector: "mtna-wf-item", inputs: ["item", "readonly", "control", "parentIds", "step"], outputs: ["focusedSection"] }], directives: [{ type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$1.MatError, selector: "mat-error", inputs: ["id"] }, { type: i32.MatRadioGroup, selector: "mat-radio-group", exportAs: ["matRadioGroup"] }, { type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i6.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], pipes: { "keyvalue": i3.KeyValuePipe, "mtnaWfGetControlError": MtnaGetFormControlErrorPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3707
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfMultipleChoiceComponent, decorators: [{
|
|
3708
|
+
type: Component,
|
|
3709
|
+
args: [{
|
|
3710
|
+
selector: 'mtna-wf-multiple-choice-item',
|
|
3711
|
+
templateUrl: 'multiple-choice.component.html',
|
|
3712
|
+
styleUrls: [
|
|
3713
|
+
`../form-item-controls/form-control.scss`,
|
|
3714
|
+
'multiple-choice.component.scss',
|
|
3715
|
+
],
|
|
3716
|
+
encapsulation: ViewEncapsulation.None,
|
|
3717
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3718
|
+
}]
|
|
3719
|
+
}], ctorParameters: function () { return [{ type: MtnaWfUIService }]; } });
|
|
3720
|
+
class MtnaWfBooleanComponent extends BaseParentItemControl {
|
|
3721
|
+
constructor(uiService) {
|
|
3722
|
+
super();
|
|
3723
|
+
this.uiService = uiService;
|
|
3724
|
+
}
|
|
3725
|
+
toggleChange(change) {
|
|
3726
|
+
this.uiService.toggleFormItems(this.item.option.enabledItems, this.item.option.disabledItems, change.checked, this.item.instanceId);
|
|
3727
|
+
}
|
|
3728
|
+
_trackByInstanceId(index, item) {
|
|
3729
|
+
return item.value.instanceId;
|
|
3730
|
+
}
|
|
3731
|
+
}
|
|
3732
|
+
MtnaWfBooleanComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfBooleanComponent, deps: [{ token: MtnaWfUIService }], target: i0.ɵɵFactoryTarget.Component });
|
|
3733
|
+
MtnaWfBooleanComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfBooleanComponent, selector: "mtna-wf-boolean-item", usesInheritance: true, ngImport: i0, template: "<ng-container *ngTemplateOutlet=\"header\"></ng-container>\n<mat-slide-toggle *ngIf=\"control\" [formControl]=\"control\" (change)=\"toggleChange($event)\">{{ item.option.option.name }}</mat-slide-toggle>\n<ng-container *ngIf=\"!!item.optionItemMap\">\n <mtna-wf-item\n *ngFor=\"let f of item.optionItemMap | keyvalue; trackBy: _trackByInstanceId\"\n [item]=\"f.value\"\n [control]=\"!!controlWrapper && controlWrapper.controls ? controlWrapper.controls[f.value.instanceId] : undefined\"\n [parentIds]=\"parentIds\"\n [readonly]=\"readonly\"\n ></mtna-wf-item>\n <ng-container> </ng-container\n></ng-container>\n", styles: [".mtna-wf-control-item .mat-form-field{width:100%}.mtna-wf-control-item .mtna-wf-error-container{font-size:75%;line-height:1;min-height:1em;margin-top:-.75rem}.mtna-wf-control-item .control-item-content{padding:.35em .75em .625em}.mtna-wf-control-item .mtna-wf-item-header~:not(.mtna-wf-error-container):not(.mat-list){padding-left:.75em}.mtna-wf-control-item .mtna-wf-item-header~:not(.mtna-wf-error-container):not(.mat-list).mat-form-field{width:calc(100% - .75em)}\n", "mtna-annotations-indicator+mtna-wf-value-item>mtna-wf-boolean-item{padding-right:24px}mtna-wf-boolean-item{display:block}mtna-wf-boolean-item .mat-slide-toggle{margin:4px 0}mtna-wf-boolean-item .mat-slide-toggle+mtna-wf-item{margin-top:0}mtna-wf-boolean-item .mat-slide-toggle~mtna-wf-item{padding-left:18px}mtna-wf-boolean-item.read-only .mat-slide-toggle.mat-disabled{opacity:.8}mtna-wf-boolean-item.read-only .mat-slide-toggle .mat-slide-toggle-label,mtna-wf-boolean-item.read-only .mat-slide-toggle .mat-slide-toggle-label .mat-slide-toggle-bar .mat-slide-toggle-thumb-container{cursor:default}mtna-wf-boolean-item .mat-slide-toggle{height:auto;min-height:24px}mtna-wf-boolean-item .mat-slide-toggle>.mat-slide-toggle-label>.mat-slide-toggle-content{white-space:normal}\n"], components: [{ type: i35.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["disabled", "disableRipple", "color", "tabIndex", "name", "id", "labelPosition", "aria-label", "aria-labelledby", "required", "checked", "aria-describedby"], outputs: ["change", "toggleChange"], exportAs: ["matSlideToggle"] }, { type: MtnaWfFormItemComponent, selector: "mtna-wf-item", inputs: ["item", "readonly", "control", "parentIds", "step"], outputs: ["focusedSection"] }], directives: [{ type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i6.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "keyvalue": i3.KeyValuePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3734
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfBooleanComponent, decorators: [{
|
|
3735
|
+
type: Component,
|
|
3736
|
+
args: [{
|
|
3737
|
+
selector: 'mtna-wf-boolean-item',
|
|
3738
|
+
templateUrl: 'boolean.component.html',
|
|
3739
|
+
styleUrls: [
|
|
3740
|
+
`../form-item-controls/form-control.scss`,
|
|
3741
|
+
'boolean.component.scss',
|
|
3742
|
+
],
|
|
3743
|
+
encapsulation: ViewEncapsulation.None,
|
|
3744
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3745
|
+
}]
|
|
3746
|
+
}], ctorParameters: function () { return [{ type: MtnaWfUIService }]; } });
|
|
3747
|
+
class MtnaWfCheckboxComponent extends BaseParentItemControl {
|
|
3748
|
+
constructor(dialogService, uiService) {
|
|
3749
|
+
super();
|
|
3750
|
+
this.dialogService = dialogService;
|
|
3751
|
+
this.uiService = uiService;
|
|
3752
|
+
this.destroyed$ = new Subject();
|
|
3753
|
+
}
|
|
3754
|
+
handleChange(change, index) {
|
|
3755
|
+
var _a;
|
|
3756
|
+
const option = this.item.options[index];
|
|
3757
|
+
const formControl = (_a = this.control) === null || _a === void 0 ? void 0 : _a.controls[index];
|
|
3758
|
+
// If the user is trying to make a selection with something that has an acknowledgement,
|
|
3759
|
+
// show the acknowledge dialog first to get their consent.
|
|
3760
|
+
// Note: we don't need to show the acknowledgement if the user is unchecking the box.
|
|
3761
|
+
if (option.acknowledgement && (formControl === null || formControl === void 0 ? void 0 : formControl.value)) {
|
|
3762
|
+
// Revert the checkbox to an unchecked state until they agree to the acknowledgement
|
|
3763
|
+
formControl === null || formControl === void 0 ? void 0 : formControl.setValue(false);
|
|
3764
|
+
this.dialogService
|
|
3765
|
+
.verifyAcknowledgement(option.acknowledgement)
|
|
3766
|
+
.pipe(takeUntil(this.destroyed$))
|
|
3767
|
+
.subscribe((acknowledged) => {
|
|
3768
|
+
if (acknowledged) {
|
|
3769
|
+
formControl === null || formControl === void 0 ? void 0 : formControl.setValue(true);
|
|
3770
|
+
this.uiService.toggleFormItems(option.enabledItems, option.disabledItems, change.checked, this.item.instanceId);
|
|
3771
|
+
}
|
|
3772
|
+
});
|
|
3773
|
+
}
|
|
3774
|
+
else {
|
|
3775
|
+
this.uiService.toggleFormItems(option.enabledItems, option.disabledItems, change.checked, this.item.instanceId);
|
|
3776
|
+
}
|
|
3777
|
+
}
|
|
3778
|
+
ngOnDestroy() {
|
|
3779
|
+
this.destroyed$.next();
|
|
3780
|
+
this.destroyed$.complete();
|
|
3781
|
+
}
|
|
3782
|
+
/**
|
|
3783
|
+
* Display what the user already acknowledged for a given option.
|
|
3784
|
+
* @param event the browser event when the button was invoked
|
|
3785
|
+
* @param acknowledgementItem The form item that represents the acknowledgement text to display to the user.
|
|
3786
|
+
* */
|
|
3787
|
+
showAcknowledgement(event, acknowledgementItem) {
|
|
3788
|
+
event.stopPropagation();
|
|
3789
|
+
event.preventDefault();
|
|
3790
|
+
this.dialogService.showAcknowledgement(acknowledgementItem);
|
|
3791
|
+
}
|
|
3792
|
+
/**
|
|
3793
|
+
* Stop a browser event from propagating
|
|
3794
|
+
* @param event the event to stop
|
|
3795
|
+
*/
|
|
3796
|
+
stopEventPropagation(event) {
|
|
3797
|
+
event.stopPropagation();
|
|
3798
|
+
}
|
|
3799
|
+
}
|
|
3800
|
+
MtnaWfCheckboxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfCheckboxComponent, deps: [{ token: MtnaWfDialogService }, { token: MtnaWfUIService }], target: i0.ɵɵFactoryTarget.Component });
|
|
3801
|
+
MtnaWfCheckboxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfCheckboxComponent, selector: "mtna-wf-checkbox-item", inputs: { color: "color" }, usesInheritance: true, ngImport: i0, template: "<ng-container *ngTemplateOutlet=\"header\"></ng-container>\n<div *ngIf=\"hasItemHeader\" class=\"mtna-wf-error-container\">\n <ng-container *ngIf=\"control?.invalid && (control?.dirty || control?.touched)\">\n <mat-error *ngFor=\"let error of control?.errors | keyvalue\">\n {{ error | mtnaWfGetControlError : item }}\n </mat-error>\n </ng-container>\n</div>\n<fieldset\n class=\"control-item-content\"\n [class.single-option]=\"item.options?.length === 1\"\n [mtnaHighlight]=\"indicatorStatus === 'ACTIVE' && !hasItemHeader\"\n>\n <ng-container *ngFor=\"let opt of item.options; let i = index; trackBy: _trackByOptionId\">\n <mat-checkbox\n *ngIf=\"!!control && !!control.controls && !!control.controls[i]\"\n [disableRipple]=\"readonly\"\n [formControl]=\"$any(control.controls[i])\"\n [color]=\"color\"\n (change)=\"handleChange($event, i)\"\n >{{ opt.option.name }}\n <button\n *ngIf=\"opt.acknowledgement && control.controls[i].value\"\n aria-label=\"Acknowledged. Click to view the agreement.\"\n class=\"acknowledge-verification-button\"\n mat-icon-button\n matTooltip=\"Acknowledged. Click to view the agreement.\"\n matTooltipShowDelay=\"800\"\n (click)=\"showAcknowledgement($event, opt.acknowledgement)\"\n (mousedown)=\"stopEventPropagation($event)\"\n (touchstart)=\"stopEventPropagation($event)\"\n >\n <mat-icon>verified</mat-icon>\n </button>\n </mat-checkbox>\n <ng-container *ngIf=\"item.optionItemMap[opt.option.id]\">\n <mtna-wf-item\n *ngIf=\"item.optionItemMap[opt.option.id] as subItem\"\n [item]=\"subItem\"\n [control]=\"!!controlWrapper && controlWrapper.controls ? controlWrapper.controls[subItem.instanceId] : undefined\"\n [readonly]=\"readonly\"\n [parentIds]=\"parentIds.concat(opt.option.id)\"\n ></mtna-wf-item>\n </ng-container>\n </ng-container>\n</fieldset>\n", styles: [".mtna-wf-control-item .mat-form-field{width:100%}.mtna-wf-control-item .mtna-wf-error-container{font-size:75%;line-height:1;min-height:1em;margin-top:-.75rem}.mtna-wf-control-item .control-item-content{padding:.35em .75em .625em}.mtna-wf-control-item .mtna-wf-item-header~:not(.mtna-wf-error-container):not(.mat-list){padding-left:.75em}.mtna-wf-control-item .mtna-wf-item-header~:not(.mtna-wf-error-container):not(.mat-list).mat-form-field{width:calc(100% - .75em)}\n", "mtna-wf-checkbox-item{display:flex;flex-direction:column;position:relative}mtna-wf-checkbox-item .mat-checkbox{display:block}mtna-wf-checkbox-item .mat-checkbox>.mat-checkbox-layout{display:block}mtna-wf-checkbox-item .mat-checkbox>.mat-checkbox-layout>.mat-checkbox-label{white-space:normal}mtna-wf-checkbox-item .mat-checkbox .acknowledge-verification-button{vertical-align:top;width:18px;height:18px;line-height:18px;margin-left:4px}mtna-wf-checkbox-item .mat-checkbox .acknowledge-verification-button .mat-icon{width:18px;height:18px;line-height:18px;font-size:18px}mtna-wf-checkbox-item fieldset{border:none;margin:0}mtna-wf-checkbox-item fieldset.control-item-content.single-option{padding:0}mtna-wf-checkbox-item .mat-checkbox+mtna-wf-item{margin-top:0;padding-left:24px}mtna-wf-checkbox-item.read-only .mat-checkbox{cursor:default}\n"], components: [{ type: i36.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "id", "labelPosition", "name", "required", "checked", "disabled", "indeterminate", "aria-describedby", "value"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i18.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: MtnaWfFormItemComponent, selector: "mtna-wf-item", inputs: ["item", "readonly", "control", "parentIds", "step"], outputs: ["focusedSection"] }], directives: [{ type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$1.MatError, selector: "mat-error", inputs: ["id"] }, { type: i7.MtnaHighlightDirective, selector: "[mtnaHighlight]", inputs: ["mtnaHighlight", "mtnaHighlightColor"], exportAs: ["mtnaHighlight"] }, { type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i6.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i19.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }], pipes: { "keyvalue": i3.KeyValuePipe, "mtnaWfGetControlError": MtnaGetFormControlErrorPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3802
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfCheckboxComponent, decorators: [{
|
|
3803
|
+
type: Component,
|
|
3804
|
+
args: [{
|
|
3805
|
+
selector: 'mtna-wf-checkbox-item',
|
|
3806
|
+
templateUrl: 'checkbox.component.html',
|
|
3807
|
+
styleUrls: [
|
|
3808
|
+
`../form-item-controls/form-control.scss`,
|
|
3809
|
+
'checkbox.component.scss',
|
|
3810
|
+
],
|
|
3811
|
+
encapsulation: ViewEncapsulation.None,
|
|
3812
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3813
|
+
}]
|
|
3814
|
+
}], ctorParameters: function () { return [{ type: MtnaWfDialogService }, { type: MtnaWfUIService }]; }, propDecorators: { color: [{
|
|
3815
|
+
type: Input
|
|
3816
|
+
}] } });
|
|
3817
|
+
|
|
3818
|
+
class MtnaWfFormComponent extends mixinDestroyNotifier(class {
|
|
3819
|
+
}) {
|
|
3820
|
+
constructor(mtnaFormManager, ngFormService, uiService) {
|
|
3821
|
+
super();
|
|
3822
|
+
this.mtnaFormManager = mtnaFormManager;
|
|
3823
|
+
this.ngFormService = ngFormService;
|
|
3824
|
+
this.uiService = uiService;
|
|
3825
|
+
this._emitStatusOnMtnaFormChange = false;
|
|
3826
|
+
this.readonly$ = new BehaviorSubject(true);
|
|
3827
|
+
/**
|
|
3828
|
+
* Emitted every time a form control's validation status changes.
|
|
3829
|
+
* The `id` is the form control's name and the `status` is the new validation status for the control.
|
|
3830
|
+
*/
|
|
3831
|
+
this.status = new EventEmitter();
|
|
3832
|
+
this.focusedSection = new EventEmitter();
|
|
3833
|
+
this.mtnaFormChange = new EventEmitter();
|
|
3834
|
+
this.componentIds = [];
|
|
3835
|
+
this._hasPreviousForm = false;
|
|
3836
|
+
this._initialStatusEmitted = false;
|
|
3837
|
+
this._constructionDate = new Date();
|
|
3838
|
+
// Initialize the subscription to observe input changes
|
|
3839
|
+
this._subscribeAndEmitMtnaFormChanges();
|
|
3840
|
+
}
|
|
3841
|
+
set annotations(map) {
|
|
3842
|
+
this.uiService.registerAnnotations(map);
|
|
3843
|
+
}
|
|
3844
|
+
/** Whether to emit the status of each step each time the {@link mtnaForm} is set to a new value. Defaults to false.*/
|
|
3845
|
+
get emitStatusOnMtnaFormChange() {
|
|
3846
|
+
return this._emitStatusOnMtnaFormChange;
|
|
3847
|
+
}
|
|
3848
|
+
set emitStatusOnMtnaFormChange(emitStatusOnMtnaFormChange) {
|
|
3849
|
+
this._emitStatusOnMtnaFormChange = coerceBooleanProperty(emitStatusOnMtnaFormChange);
|
|
3850
|
+
}
|
|
3851
|
+
get mtnaForm() {
|
|
3852
|
+
return this._mtnaForm;
|
|
3853
|
+
}
|
|
3854
|
+
set mtnaForm(form) {
|
|
3855
|
+
if (!!form && !this.ngForm) {
|
|
3856
|
+
// serialize the form when input is set the first time
|
|
3857
|
+
this._handleFormSerialization(form);
|
|
3858
|
+
this._checkAndSubscribeToFormStatus();
|
|
3859
|
+
}
|
|
3860
|
+
this._mtnaForm = form;
|
|
3861
|
+
if (form) {
|
|
3862
|
+
this.mtnaFormManager.setMtnaForm(form);
|
|
3863
|
+
// If indicated, re-emit the status of each step when there is a new form
|
|
3864
|
+
if (this.emitStatusOnMtnaFormChange && this.ngForm) {
|
|
3865
|
+
for (const key in this._steps) {
|
|
3866
|
+
if (Object.prototype.hasOwnProperty.call(this._steps, key)) {
|
|
3867
|
+
this._emitFormControlStatus(key);
|
|
3868
|
+
}
|
|
3869
|
+
}
|
|
3870
|
+
}
|
|
3871
|
+
}
|
|
3872
|
+
}
|
|
3873
|
+
/**
|
|
3874
|
+
* The form can contain sections not included in the steps.
|
|
3875
|
+
* To avoid misalignment of steps-to-sections, we map each step to
|
|
3876
|
+
* its instanceId
|
|
3877
|
+
*/
|
|
3878
|
+
set steps(newSteps) {
|
|
3879
|
+
if (!!newSteps && !!newSteps.length) {
|
|
3880
|
+
if (!this._steps) {
|
|
3881
|
+
this._steps = {};
|
|
3882
|
+
}
|
|
3883
|
+
for (const step of newSteps) {
|
|
3884
|
+
this._steps[step.instanceId] = step;
|
|
3885
|
+
}
|
|
3886
|
+
this._checkAndSubscribeToFormStatus();
|
|
3887
|
+
}
|
|
3888
|
+
}
|
|
3889
|
+
get readonly() {
|
|
3890
|
+
return this.readonly$.value;
|
|
3891
|
+
}
|
|
3892
|
+
set readonly(r) {
|
|
3893
|
+
const newValue = coerceBooleanProperty(r);
|
|
3894
|
+
if (newValue !== this.readonly$.value) {
|
|
3895
|
+
this.readonly$.next(r);
|
|
3896
|
+
}
|
|
3897
|
+
}
|
|
3898
|
+
ngAfterViewInit() {
|
|
3899
|
+
const afterViewInitDate = new Date();
|
|
3900
|
+
const secondsToRender = (afterViewInitDate.getTime() - this._constructionDate.getTime()) / 1000;
|
|
3901
|
+
console.warn('[MtnaFormComponent] afterViewInit - took ', secondsToRender, ' to render');
|
|
3902
|
+
}
|
|
3903
|
+
ngOnDestroy() {
|
|
3904
|
+
super.ngOnDestroy();
|
|
3905
|
+
this.uiService.resetComponentMap();
|
|
3906
|
+
}
|
|
3907
|
+
_trackByInstanceId(index, formItem) {
|
|
3908
|
+
return formItem.instanceId;
|
|
3909
|
+
}
|
|
3910
|
+
/** Subscribe and emit form status changes for the steps. */
|
|
3911
|
+
_checkAndSubscribeToFormStatus() {
|
|
3912
|
+
// Only subscribe once both the steps and the angular have been initialized
|
|
3913
|
+
if (this.ngForm && this._steps) {
|
|
3914
|
+
// Update form status subscriptions anytime the readonly input changes
|
|
3915
|
+
this.readonly$.pipe(takeUntil(this.destroyed$), distinctUntilChanged()).subscribe((readonly) => {
|
|
3916
|
+
if (readonly) {
|
|
3917
|
+
// Don't emit statuses while form is in readonly
|
|
3918
|
+
this._unsubscribeFromNgFormChanges();
|
|
3919
|
+
}
|
|
3920
|
+
else if (!this._ngFormStatusChangeSub || this._ngFormStatusChangeSub.closed) {
|
|
3921
|
+
// For performance, subscribe should only trigger again if the subscription didn't previously exist
|
|
3922
|
+
this._emitInitialStepsStatusAndSubscribeToChanges(!this._initialStatusEmitted);
|
|
3923
|
+
this._initialStatusEmitted = true;
|
|
3924
|
+
}
|
|
3925
|
+
});
|
|
3926
|
+
}
|
|
3927
|
+
}
|
|
3928
|
+
/**
|
|
3929
|
+
* Find a form control with the given name, then emit it's status.
|
|
3930
|
+
*
|
|
3931
|
+
* @param name — The unique name of the form cotrol to find and emit the status for.
|
|
3932
|
+
*/
|
|
3933
|
+
_emitFormControlStatus(name) {
|
|
3934
|
+
if (this.ngForm) {
|
|
3935
|
+
const control = findFormControl(name, this.ngForm);
|
|
3936
|
+
if (control) {
|
|
3937
|
+
this.status.emit({
|
|
3938
|
+
id: name,
|
|
3939
|
+
status: control.status,
|
|
3940
|
+
});
|
|
3941
|
+
}
|
|
3942
|
+
}
|
|
3943
|
+
}
|
|
3944
|
+
/**
|
|
3945
|
+
* @param emitInitialValues Whether to emit initial step values or just listen for future changes
|
|
3946
|
+
*/
|
|
3947
|
+
_emitInitialStepsStatusAndSubscribeToChanges(emitInitialValues) {
|
|
3948
|
+
if (this._steps && this.ngForm) {
|
|
3949
|
+
this._unsubscribeFromNgFormChanges();
|
|
3950
|
+
this._ngFormStatusChangeSub = new Subscription();
|
|
3951
|
+
// Find the form control for each step and only subscribe to those.
|
|
3952
|
+
for (const key in this._steps) {
|
|
3953
|
+
if (Object.prototype.hasOwnProperty.call(this._steps, key)) {
|
|
3954
|
+
const control = findFormControl(key, this.ngForm);
|
|
3955
|
+
if (control) {
|
|
3956
|
+
if (emitInitialValues) {
|
|
3957
|
+
this.status.emit({
|
|
3958
|
+
id: key,
|
|
3959
|
+
// Angular introduced this status in v13, once we update, this type cast can be removed.
|
|
3960
|
+
status: control.status,
|
|
3961
|
+
});
|
|
3962
|
+
}
|
|
3963
|
+
// Subscribe to status changes of each step & emit on change
|
|
3964
|
+
this._ngFormStatusChangeSub.add(control.statusChanges
|
|
3965
|
+
.pipe(takeUntil(this.destroyed$), distinctUntilChanged())
|
|
3966
|
+
.subscribe((status) => this.status.emit({ id: key, status })));
|
|
3967
|
+
}
|
|
3968
|
+
}
|
|
3969
|
+
}
|
|
3970
|
+
}
|
|
3971
|
+
}
|
|
3972
|
+
/**
|
|
3973
|
+
* Observes input changes for readOnly, in order to handle internal change subscriptions.
|
|
3974
|
+
* When the form is not readonly, we subscribe to form status & form item changes, so we can emit them.
|
|
3975
|
+
* When the form is readonly, we do not want to emit any changes, so we unsubscribe.
|
|
3976
|
+
*/
|
|
3977
|
+
_subscribeAndEmitMtnaFormChanges() {
|
|
3978
|
+
this.readonly$
|
|
3979
|
+
.pipe(takeUntil(this.destroyed$),
|
|
3980
|
+
// we don't want to create subscriptions until we have a form to subscribe to
|
|
3981
|
+
skipWhile(() => !this.mtnaForm), distinctUntilChanged())
|
|
3982
|
+
.subscribe((readonly) => {
|
|
3983
|
+
if (readonly) {
|
|
3984
|
+
this._unsubscribeFromMtnaFormChanges();
|
|
3985
|
+
}
|
|
3986
|
+
else if (!this._mtnaFormItemChangeSub || this._mtnaFormItemChangeSub.closed) {
|
|
3987
|
+
// For performance, subscribe should only trigger again if one of the subscriptions didn't previously exist
|
|
3988
|
+
this._subscribeToMtnaFormItemChanges();
|
|
3989
|
+
}
|
|
3990
|
+
});
|
|
3991
|
+
}
|
|
3992
|
+
_handleFormSerialization(form) {
|
|
3993
|
+
// Get the registered form from the service if it exists
|
|
3994
|
+
this._hasPreviousForm = this.ngFormService.hasForm();
|
|
3995
|
+
if (this._hasPreviousForm) {
|
|
3996
|
+
this.ngForm = this.ngFormService.getForm();
|
|
3997
|
+
// FIXME this is necessary because the initial visiblity is based on the mtnaForm item's disable property
|
|
3998
|
+
// If the user changes a value, goes to another tab (destroying form) and comes back, the initial values are incorrect
|
|
3999
|
+
this.mtnaForm = this.mtnaFormManager.insertNewValues(form, this.ngFormService.getFormValue());
|
|
4000
|
+
}
|
|
4001
|
+
else {
|
|
4002
|
+
this.ngForm = this.mtnaFormManager.serializeMtnaFormItem(form);
|
|
4003
|
+
this.ngFormService.setForm(this.ngForm);
|
|
4004
|
+
}
|
|
4005
|
+
}
|
|
4006
|
+
/**
|
|
4007
|
+
* Adds or removes a FormItem whenever a new MtnaWfFormItemChange occurs,
|
|
4008
|
+
* and emits a new MtnaForm.
|
|
4009
|
+
*/
|
|
4010
|
+
_subscribeToMtnaFormItemChanges() {
|
|
4011
|
+
this._unsubscribeFromMtnaFormChanges();
|
|
4012
|
+
this._mtnaFormItemChangeSub = this.mtnaFormManager.formChanges
|
|
4013
|
+
.pipe(takeUntil(this.destroyed$), skipWhile((change) => !change))
|
|
4014
|
+
.subscribe((newForm) => this.mtnaFormChange.emit(newForm));
|
|
4015
|
+
}
|
|
4016
|
+
_unsubscribeFromNgFormChanges() {
|
|
4017
|
+
if (!!this._ngFormStatusChangeSub && !this._ngFormStatusChangeSub.closed) {
|
|
4018
|
+
this._ngFormStatusChangeSub.unsubscribe();
|
|
4019
|
+
}
|
|
4020
|
+
}
|
|
4021
|
+
_unsubscribeFromMtnaFormChanges() {
|
|
4022
|
+
if (!!this._mtnaFormItemChangeSub && !this._mtnaFormItemChangeSub.closed) {
|
|
4023
|
+
this._mtnaFormItemChangeSub.unsubscribe();
|
|
4024
|
+
}
|
|
4025
|
+
}
|
|
4026
|
+
}
|
|
4027
|
+
MtnaWfFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormComponent, deps: [{ token: MtnaWfManagerService }, { token: MtnaWfNgFormService }, { token: MtnaWfUIService }], target: i0.ɵɵFactoryTarget.Component });
|
|
4028
|
+
MtnaWfFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfFormComponent, selector: "mtna-form", inputs: { annotations: "annotations", emitStatusOnMtnaFormChange: "emitStatusOnMtnaFormChange", mtnaForm: "mtnaForm", steps: "steps", readonly: "readonly" }, outputs: { status: "status", focusedSection: "focusedSection", mtnaFormChange: "mtnaFormChange" }, usesInheritance: true, ngImport: i0, template: "<form *ngIf=\"ngForm\" [formGroup]=\"ngForm\" [formDisabled]=\"readonly\">\n <mtna-wf-item\n *ngFor=\"let item of mtnaForm?.items; let index = index; trackBy: _trackByInstanceId\"\n [item]=\"item\"\n [control]=\"ngForm.controls[item.instanceId]\"\n [readonly]=\"readonly\"\n [parentIds]=\"componentIds\"\n [step]=\"_steps?.[item.instanceId]\"\n (focusedSection)=\"focusedSection.emit($event)\"\n ></mtna-wf-item>\n</form>\n", styles: ["mtna-form form{display:block}mtna-form form .mtna-wf-section{display:block;margin:32px 0}mtna-form form fieldset[disabled] .mtna-wf-item .mtna-wf-date-item .mat-form-field.mat-form-field-appearance-outline .mat-form-field-flex:hover .mat-form-field-outline{opacity:0}mtna-form form fieldset[disabled] .mtna-wf-item .mtna-wf-date-item .mat-form-field.mat-form-field-appearance-outline .mat-form-field-flex:hover .mat-form-field-outline-thick{opacity:1}mtna-form form fieldset[disabled] .mtna-wf-item .mtna-wf-date-item .mat-form-field.mat-form-field-appearance-outline .mat-form-field-flex:hover .mat-form-field-outline-thick .mat-form-field-outline-end,mtna-form form fieldset[disabled] .mtna-wf-item .mtna-wf-date-item .mat-form-field.mat-form-field-appearance-outline .mat-form-field-flex:hover .mat-form-field-outline-thick .mat-form-field-outline-gap,mtna-form form fieldset[disabled] .mtna-wf-item .mtna-wf-date-item .mat-form-field.mat-form-field-appearance-outline .mat-form-field-flex:hover .mat-form-field-outline-thick .mat-form-field-outline-start{border-width:1px}mtna-form form fieldset[disabled] .mtna-wf-item .mtna-wf-date-item .mat-form-field.mat-form-field-appearance-outline .mat-form-field-suffix .mat-datepicker-toggle .mat-icon-button{cursor:default}mtna-form .mtna-wf-item,mtna-form .mtna-wf-title{margin-top:1rem}mtna-form .mtna-wf-text{margin:.5rem 0;font-size:.9rem}mtna-form .mtna-wf-title-item,mtna-form .mtna-wf-text-item{margin:0}mtna-form mtna-annotations-indicator+mtna-wf-value-item .mtna-wf-title-item,mtna-form mtna-annotations-indicator+mtna-wf-value-item .mtna-wf-text-item{padding-right:24px}\n"], components: [{ type: MtnaWfFormDisablerComponent, selector: "[formDisabled]", inputs: ["formDisabled"] }, { type: MtnaWfFormItemComponent, selector: "mtna-wf-item", inputs: ["item", "readonly", "control", "parentIds", "step"], outputs: ["focusedSection"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i6.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i6.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4029
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormComponent, decorators: [{
|
|
4030
|
+
type: Component,
|
|
4031
|
+
args: [{
|
|
4032
|
+
selector: 'mtna-form',
|
|
4033
|
+
templateUrl: './form.component.html',
|
|
4034
|
+
styleUrls: ['./form.component.scss'],
|
|
4035
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
4036
|
+
encapsulation: ViewEncapsulation.None,
|
|
4037
|
+
}]
|
|
4038
|
+
}], ctorParameters: function () { return [{ type: MtnaWfManagerService }, { type: MtnaWfNgFormService }, { type: MtnaWfUIService }]; }, propDecorators: { annotations: [{
|
|
4039
|
+
type: Input
|
|
4040
|
+
}], emitStatusOnMtnaFormChange: [{
|
|
4041
|
+
type: Input
|
|
4042
|
+
}], mtnaForm: [{
|
|
4043
|
+
type: Input
|
|
4044
|
+
}], steps: [{
|
|
4045
|
+
type: Input
|
|
4046
|
+
}], readonly: [{
|
|
4047
|
+
type: Input
|
|
4048
|
+
}], status: [{
|
|
4049
|
+
type: Output
|
|
4050
|
+
}], focusedSection: [{
|
|
4051
|
+
type: Output
|
|
4052
|
+
}], mtnaFormChange: [{
|
|
4053
|
+
type: Output
|
|
4054
|
+
}] } });
|
|
4055
|
+
|
|
4056
|
+
/* eslint-disable @angular-eslint/no-inputs-metadata-property */
|
|
4057
|
+
const _FormStepMixinBase$1 = mixinColor(class {
|
|
4058
|
+
constructor(_elementRef) {
|
|
4059
|
+
this._elementRef = _elementRef;
|
|
4060
|
+
}
|
|
4061
|
+
}, 'primary');
|
|
4062
|
+
class MtnaWfFormStepComponent extends _FormStepMixinBase$1 {
|
|
4063
|
+
constructor(elementRef) {
|
|
4064
|
+
super(elementRef);
|
|
4065
|
+
this.disabled = false;
|
|
4066
|
+
this._clickable = true;
|
|
4067
|
+
}
|
|
4068
|
+
get step() {
|
|
4069
|
+
return this._step;
|
|
4070
|
+
}
|
|
4071
|
+
set step(step) {
|
|
4072
|
+
this._step = step;
|
|
4073
|
+
this.disabled = step.status === 'DISABLED';
|
|
4074
|
+
}
|
|
4075
|
+
get clickable() {
|
|
4076
|
+
return !this.disabled && this._clickable;
|
|
4077
|
+
}
|
|
4078
|
+
set clickable(clickable) {
|
|
4079
|
+
this._clickable = clickable;
|
|
4080
|
+
}
|
|
4081
|
+
/**
|
|
4082
|
+
* Prevents click event if this step is not clickable
|
|
4083
|
+
*/
|
|
4084
|
+
_haltClickEvent(event) {
|
|
4085
|
+
if (!this.clickable) {
|
|
4086
|
+
event.preventDefault();
|
|
4087
|
+
event.stopImmediatePropagation();
|
|
4088
|
+
}
|
|
4089
|
+
}
|
|
4090
|
+
}
|
|
4091
|
+
MtnaWfFormStepComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormStepComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
4092
|
+
MtnaWfFormStepComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfFormStepComponent, selector: "mtna-wf-step", inputs: { color: "color", step: "step", clickable: "clickable", incompleteIcon: "incompleteIcon" }, host: { properties: { "class.disabled": "this.disabled", "class.clickable": "this.clickable" } }, usesInheritance: true, ngImport: i0, template: `
|
|
4093
|
+
<li
|
|
4094
|
+
fxLayout="row"
|
|
4095
|
+
fxLayoutAlign="start center"
|
|
4096
|
+
matRipple
|
|
4097
|
+
[matRippleDisabled]="!clickable"
|
|
4098
|
+
[class.active-step]="step.active"
|
|
4099
|
+
(click)="_haltClickEvent($event)"
|
|
4100
|
+
>
|
|
4101
|
+
<mtna-status-circle
|
|
4102
|
+
[color]="color"
|
|
4103
|
+
[circleNumber]="step.num"
|
|
4104
|
+
[incompleteIcon]="incompleteIcon"
|
|
4105
|
+
[optional]="step.optional"
|
|
4106
|
+
[status]="step.status"
|
|
4107
|
+
></mtna-status-circle>
|
|
4108
|
+
<div fxLayout="column" fxFlex="100">
|
|
4109
|
+
<p class="step-title">{{ step.label }}</p>
|
|
4110
|
+
<p *ngIf="step.optional || disabled" class="step-status">{{ disabled ? step.disabledText || 'Not Applicable' : 'Optional' }}</p>
|
|
4111
|
+
</div>
|
|
4112
|
+
</li>
|
|
4113
|
+
`, isInline: true, styles: ["mtna-wf-step li{padding:8px 16px;position:relative;-webkit-user-select:none;-o-user-select:none;user-select:none;line-height:24px;font-size:14px;transition:background-color .15s cubic-bezier(0,0,.2,1)}mtna-wf-step li:after{content:\"\";display:block;position:absolute;top:0;right:0;bottom:0;width:5px;transition:transform .4s cubic-bezier(.25,.8,.25,1);transform-origin:bottom;transform:scaleY(0);z-index:1}mtna-wf-step li .step-title,mtna-wf-step li .step-status{margin:0}mtna-wf-step.disabled{font-style:italic}\n"], components: [{ type: i7.MtnaStatusCircleComponent, selector: "mtna-status-circle", inputs: ["color", "circleNumber", "incompleteIcon", "status", "validIcon", "optional"] }], directives: [{ type: i3$3.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { type: i3$3.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { type: i4$2.MatRipple, selector: "[mat-ripple], [matRipple]", inputs: ["matRippleRadius", "matRippleDisabled", "matRippleTrigger", "matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleAnimation"], exportAs: ["matRipple"] }, { type: i3$3.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4114
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormStepComponent, decorators: [{
|
|
4115
|
+
type: Component,
|
|
4116
|
+
args: [{
|
|
4117
|
+
selector: 'mtna-wf-step',
|
|
4118
|
+
template: `
|
|
4119
|
+
<li
|
|
4120
|
+
fxLayout="row"
|
|
4121
|
+
fxLayoutAlign="start center"
|
|
4122
|
+
matRipple
|
|
4123
|
+
[matRippleDisabled]="!clickable"
|
|
4124
|
+
[class.active-step]="step.active"
|
|
4125
|
+
(click)="_haltClickEvent($event)"
|
|
4126
|
+
>
|
|
4127
|
+
<mtna-status-circle
|
|
4128
|
+
[color]="color"
|
|
4129
|
+
[circleNumber]="step.num"
|
|
4130
|
+
[incompleteIcon]="incompleteIcon"
|
|
4131
|
+
[optional]="step.optional"
|
|
4132
|
+
[status]="step.status"
|
|
4133
|
+
></mtna-status-circle>
|
|
4134
|
+
<div fxLayout="column" fxFlex="100">
|
|
4135
|
+
<p class="step-title">{{ step.label }}</p>
|
|
4136
|
+
<p *ngIf="step.optional || disabled" class="step-status">{{ disabled ? step.disabledText || 'Not Applicable' : 'Optional' }}</p>
|
|
4137
|
+
</div>
|
|
4138
|
+
</li>
|
|
4139
|
+
`,
|
|
4140
|
+
styleUrls: ['form-step.component.scss'],
|
|
4141
|
+
inputs: ['color'],
|
|
4142
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
4143
|
+
encapsulation: ViewEncapsulation.None,
|
|
4144
|
+
}]
|
|
4145
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { disabled: [{
|
|
4146
|
+
type: HostBinding,
|
|
4147
|
+
args: ['class.disabled']
|
|
4148
|
+
}], step: [{
|
|
4149
|
+
type: Input
|
|
4150
|
+
}], clickable: [{
|
|
4151
|
+
type: HostBinding,
|
|
4152
|
+
args: ['class.clickable']
|
|
4153
|
+
}, {
|
|
4154
|
+
type: Input
|
|
4155
|
+
}], incompleteIcon: [{
|
|
4156
|
+
type: Input
|
|
4157
|
+
}] } });
|
|
4158
|
+
|
|
4159
|
+
/* eslint-disable @angular-eslint/no-inputs-metadata-property */
|
|
4160
|
+
const _FormStepMixinBase = mixinColor(class {
|
|
4161
|
+
constructor(_elementRef) {
|
|
4162
|
+
this._elementRef = _elementRef;
|
|
4163
|
+
}
|
|
4164
|
+
}, 'primary');
|
|
4165
|
+
class MtnaWfFormStepGroupComponent extends _FormStepMixinBase {
|
|
4166
|
+
constructor(elementRef) {
|
|
4167
|
+
super(elementRef);
|
|
4168
|
+
/** Whether all but the first step is hidden*/
|
|
4169
|
+
this.collapsed = false;
|
|
4170
|
+
this._steps = [];
|
|
4171
|
+
this.selected = new EventEmitter();
|
|
4172
|
+
}
|
|
4173
|
+
/** Steps to be displayed */
|
|
4174
|
+
get steps() {
|
|
4175
|
+
return this._steps;
|
|
4176
|
+
}
|
|
4177
|
+
set steps(steps) {
|
|
4178
|
+
this._steps = steps;
|
|
4179
|
+
}
|
|
4180
|
+
}
|
|
4181
|
+
MtnaWfFormStepGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormStepGroupComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
4182
|
+
MtnaWfFormStepGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfFormStepGroupComponent, selector: "mtna-wf-step-group", inputs: { color: "color", collapsed: "collapsed", incompleteIcon: "incompleteIcon", steps: "steps" }, outputs: { selected: "selected" }, usesInheritance: true, ngImport: i0, template: `
|
|
4183
|
+
<ng-container *ngFor="let step of steps | slice : 0 : (collapsed ? 1 : steps.length); let last = last">
|
|
4184
|
+
<mtna-wf-step
|
|
4185
|
+
[clickable]="step.status !== 'DISABLED'"
|
|
4186
|
+
[color]="color"
|
|
4187
|
+
[incompleteIcon]="incompleteIcon"
|
|
4188
|
+
[step]="step"
|
|
4189
|
+
(click)="selected.emit(step)"
|
|
4190
|
+
></mtna-wf-step>
|
|
4191
|
+
<mat-divider *ngIf="!last" [vertical]="true"></mat-divider>
|
|
4192
|
+
<p *ngIf="collapsed" class="show-more mat-caption">and {{ steps.length - 1 }} more...</p>
|
|
4193
|
+
</ng-container>
|
|
4194
|
+
<button
|
|
4195
|
+
mat-icon-button
|
|
4196
|
+
class="collapse-button"
|
|
4197
|
+
[color]="color"
|
|
4198
|
+
(click)="collapsed = !collapsed"
|
|
4199
|
+
[matTooltip]="collapsed ? 'View All' : 'Hide'"
|
|
4200
|
+
>
|
|
4201
|
+
<mat-icon>{{ collapsed ? 'expand_more' : 'expand_less' }}</mat-icon>
|
|
4202
|
+
</button>
|
|
4203
|
+
`, isInline: true, styles: ["mtna-wf-step-group{border-style:solid;border-radius:4px;border-width:1px;display:block;margin:4px 4px 16px 8px;padding-bottom:16px;position:relative}mtna-wf-step-group .collapse-button{bottom:-19px;left:calc(50% - 20px);position:absolute;z-index:10}mtna-wf-step-group .collapse-button:after{bottom:8px;content:\"\";height:12px;left:calc(50% - 16px);position:absolute;width:32px;z-index:-1}mtna-wf-step-group mtna-wf-step li{padding-left:8px}mtna-wf-step-group mat-divider.mat-divider{margin-left:20px}mtna-wf-step-group .show-more{margin:0;text-align:center}\n"], components: [{ type: MtnaWfFormStepComponent, selector: "mtna-wf-step", inputs: ["color", "step", "clickable", "incompleteIcon"] }, { type: i3$1.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i18.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i19.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }], pipes: { "slice": i3.SlicePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4204
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormStepGroupComponent, decorators: [{
|
|
4205
|
+
type: Component,
|
|
4206
|
+
args: [{
|
|
4207
|
+
selector: 'mtna-wf-step-group',
|
|
4208
|
+
template: `
|
|
4209
|
+
<ng-container *ngFor="let step of steps | slice : 0 : (collapsed ? 1 : steps.length); let last = last">
|
|
4210
|
+
<mtna-wf-step
|
|
4211
|
+
[clickable]="step.status !== 'DISABLED'"
|
|
4212
|
+
[color]="color"
|
|
4213
|
+
[incompleteIcon]="incompleteIcon"
|
|
4214
|
+
[step]="step"
|
|
4215
|
+
(click)="selected.emit(step)"
|
|
4216
|
+
></mtna-wf-step>
|
|
4217
|
+
<mat-divider *ngIf="!last" [vertical]="true"></mat-divider>
|
|
4218
|
+
<p *ngIf="collapsed" class="show-more mat-caption">and {{ steps.length - 1 }} more...</p>
|
|
4219
|
+
</ng-container>
|
|
4220
|
+
<button
|
|
4221
|
+
mat-icon-button
|
|
4222
|
+
class="collapse-button"
|
|
4223
|
+
[color]="color"
|
|
4224
|
+
(click)="collapsed = !collapsed"
|
|
4225
|
+
[matTooltip]="collapsed ? 'View All' : 'Hide'"
|
|
4226
|
+
>
|
|
4227
|
+
<mat-icon>{{ collapsed ? 'expand_more' : 'expand_less' }}</mat-icon>
|
|
4228
|
+
</button>
|
|
4229
|
+
`,
|
|
4230
|
+
styleUrls: ['form-step-group.component.scss'],
|
|
4231
|
+
inputs: ['color'],
|
|
4232
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
4233
|
+
encapsulation: ViewEncapsulation.None,
|
|
4234
|
+
}]
|
|
4235
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { collapsed: [{
|
|
4236
|
+
type: Input
|
|
4237
|
+
}], incompleteIcon: [{
|
|
4238
|
+
type: Input
|
|
4239
|
+
}], steps: [{
|
|
4240
|
+
type: Input
|
|
4241
|
+
}], selected: [{
|
|
4242
|
+
type: Output
|
|
4243
|
+
}] } });
|
|
4244
|
+
|
|
4245
|
+
/**
|
|
4246
|
+
* Pipe to determine if a FormStep is a FormStepGroup or a single step.
|
|
4247
|
+
*/
|
|
4248
|
+
class MtnaWfFormStepGroupPipe {
|
|
4249
|
+
transform(step) {
|
|
4250
|
+
return isFormStepGroup(step);
|
|
4251
|
+
}
|
|
4252
|
+
}
|
|
4253
|
+
MtnaWfFormStepGroupPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormStepGroupPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
4254
|
+
MtnaWfFormStepGroupPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormStepGroupPipe, name: "mtnaWfStepGroupPipe" });
|
|
4255
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormStepGroupPipe, decorators: [{
|
|
4256
|
+
type: Pipe,
|
|
4257
|
+
args: [{
|
|
4258
|
+
name: 'mtnaWfStepGroupPipe',
|
|
4259
|
+
}]
|
|
4260
|
+
}] });
|
|
4261
|
+
|
|
4262
|
+
function everyStepStatus(statusToCheck, steps, a, b, c) {
|
|
4263
|
+
if (!steps || !steps.length) {
|
|
4264
|
+
return false;
|
|
4265
|
+
}
|
|
4266
|
+
let exclusionIds = c || [];
|
|
4267
|
+
let includeDisabled = false;
|
|
4268
|
+
let includeOptional = false;
|
|
4269
|
+
// If 'a' is not null, determine if it's the 'includeDisabled' boolean, or the exclusionIds array
|
|
4270
|
+
if (a !== null && a !== undefined) {
|
|
4271
|
+
if (Array.isArray(a)) {
|
|
4272
|
+
exclusionIds = a;
|
|
4273
|
+
}
|
|
4274
|
+
else {
|
|
4275
|
+
includeDisabled = a;
|
|
4276
|
+
includeOptional = b || false;
|
|
4277
|
+
}
|
|
4278
|
+
}
|
|
4279
|
+
return steps
|
|
4280
|
+
.filter((s) =>
|
|
4281
|
+
// Step ID is not excluded
|
|
4282
|
+
!exclusionIds.some((id) => id === s.instanceId) &&
|
|
4283
|
+
// Step status is not disabled, unless checking for disabled status
|
|
4284
|
+
(includeDisabled ? true : s.status !== 'DISABLED') &&
|
|
4285
|
+
// Step is required, unless optional steps should be checked
|
|
4286
|
+
(includeOptional ? true : !s.optional))
|
|
4287
|
+
.every((s) => s.status === statusToCheck);
|
|
4288
|
+
}
|
|
4289
|
+
|
|
4290
|
+
/* eslint-disable @angular-eslint/no-inputs-metadata-property */
|
|
4291
|
+
const _FormStepperMixinBase = mixinColor(class {
|
|
4292
|
+
constructor(_elementRef) {
|
|
4293
|
+
this._elementRef = _elementRef;
|
|
4294
|
+
}
|
|
4295
|
+
}, 'primary');
|
|
4296
|
+
/**
|
|
4297
|
+
* Vertical stepper component, ability to show step statuses and allows clicking each step.
|
|
4298
|
+
*
|
|
4299
|
+
* @export
|
|
4300
|
+
* @author Will Davis <will.davis@mtna.us>
|
|
4301
|
+
*/
|
|
4302
|
+
class MtnaWfFormStepperComponent extends _FormStepperMixinBase {
|
|
4303
|
+
constructor(elementRef) {
|
|
4304
|
+
super(elementRef);
|
|
4305
|
+
/** Form steps */
|
|
4306
|
+
this.steps = [];
|
|
4307
|
+
/** When a step is selected */
|
|
4308
|
+
this.selected = new EventEmitter();
|
|
4309
|
+
}
|
|
4310
|
+
/**
|
|
4311
|
+
* Improves effeciency of the *ngFor loop that creates the steps.
|
|
4312
|
+
*
|
|
4313
|
+
* @param index index of loop
|
|
4314
|
+
* @param step current step in loop
|
|
4315
|
+
* @returns unique string to key each item in the loop
|
|
4316
|
+
*/
|
|
4317
|
+
_trackStep(index, step) {
|
|
4318
|
+
return step.instanceId || index;
|
|
4319
|
+
}
|
|
4320
|
+
}
|
|
4321
|
+
MtnaWfFormStepperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormStepperComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
4322
|
+
MtnaWfFormStepperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MtnaWfFormStepperComponent, selector: "mtna-wf-stepper", inputs: { color: "color", incompleteIcon: "incompleteIcon", steps: "steps" }, outputs: { selected: "selected" }, usesInheritance: true, ngImport: i0, template: `
|
|
4323
|
+
<ol>
|
|
4324
|
+
<ng-container *ngFor="let step of steps; let last = last; trackBy: _trackStep">
|
|
4325
|
+
<ng-container
|
|
4326
|
+
[ngTemplateOutlet]="(step | mtnaWfStepGroupPipe) ? groupStep : singleStep"
|
|
4327
|
+
[ngTemplateOutletContext]="{ $implicit: step }"
|
|
4328
|
+
></ng-container>
|
|
4329
|
+
<mat-divider *ngIf="!last" [vertical]="true"></mat-divider>
|
|
4330
|
+
</ng-container>
|
|
4331
|
+
<ng-template #singleStep let-step>
|
|
4332
|
+
<mtna-wf-step
|
|
4333
|
+
[clickable]="step.status !== 'DISABLED'"
|
|
4334
|
+
[color]="color"
|
|
4335
|
+
[step]="step"
|
|
4336
|
+
[incompleteIcon]="incompleteIcon"
|
|
4337
|
+
(click)="selected.emit(step)"
|
|
4338
|
+
></mtna-wf-step>
|
|
4339
|
+
</ng-template>
|
|
4340
|
+
<ng-template #groupStep let-step>
|
|
4341
|
+
<mtna-wf-step-group
|
|
4342
|
+
[collapsed]="step.collapsed"
|
|
4343
|
+
[color]="color"
|
|
4344
|
+
[incompleteIcon]="incompleteIcon"
|
|
4345
|
+
[steps]="step.steps"
|
|
4346
|
+
(selected)="selected.emit($event)"
|
|
4347
|
+
></mtna-wf-step-group>
|
|
4348
|
+
</ng-template>
|
|
4349
|
+
</ol>
|
|
4350
|
+
`, isInline: true, styles: ["mtna-wf-stepper{border-right-width:1px;border-right-style:solid;overflow-y:auto}mtna-wf-stepper mtna-wf-step li.active-step:after{transform-origin:top;transform:scaleY(1)}mtna-wf-stepper mtna-wf-step.clickable{cursor:pointer}mtna-wf-stepper mat-divider.mat-divider{height:24px;width:1px;margin-left:28px}mtna-wf-stepper ol{padding:0}\n"], components: [{ type: i3$1.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { type: MtnaWfFormStepComponent, selector: "mtna-wf-step", inputs: ["color", "step", "clickable", "incompleteIcon"] }, { type: MtnaWfFormStepGroupComponent, selector: "mtna-wf-step-group", inputs: ["color", "collapsed", "incompleteIcon", "steps"], outputs: ["selected"] }], directives: [{ type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "mtnaWfStepGroupPipe": MtnaWfFormStepGroupPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4351
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormStepperComponent, decorators: [{
|
|
4352
|
+
type: Component,
|
|
4353
|
+
args: [{
|
|
4354
|
+
selector: 'mtna-wf-stepper',
|
|
4355
|
+
template: `
|
|
4356
|
+
<ol>
|
|
4357
|
+
<ng-container *ngFor="let step of steps; let last = last; trackBy: _trackStep">
|
|
4358
|
+
<ng-container
|
|
4359
|
+
[ngTemplateOutlet]="(step | mtnaWfStepGroupPipe) ? groupStep : singleStep"
|
|
4360
|
+
[ngTemplateOutletContext]="{ $implicit: step }"
|
|
4361
|
+
></ng-container>
|
|
4362
|
+
<mat-divider *ngIf="!last" [vertical]="true"></mat-divider>
|
|
4363
|
+
</ng-container>
|
|
4364
|
+
<ng-template #singleStep let-step>
|
|
4365
|
+
<mtna-wf-step
|
|
4366
|
+
[clickable]="step.status !== 'DISABLED'"
|
|
4367
|
+
[color]="color"
|
|
4368
|
+
[step]="step"
|
|
4369
|
+
[incompleteIcon]="incompleteIcon"
|
|
4370
|
+
(click)="selected.emit(step)"
|
|
4371
|
+
></mtna-wf-step>
|
|
4372
|
+
</ng-template>
|
|
4373
|
+
<ng-template #groupStep let-step>
|
|
4374
|
+
<mtna-wf-step-group
|
|
4375
|
+
[collapsed]="step.collapsed"
|
|
4376
|
+
[color]="color"
|
|
4377
|
+
[incompleteIcon]="incompleteIcon"
|
|
4378
|
+
[steps]="step.steps"
|
|
4379
|
+
(selected)="selected.emit($event)"
|
|
4380
|
+
></mtna-wf-step-group>
|
|
4381
|
+
</ng-template>
|
|
4382
|
+
</ol>
|
|
4383
|
+
`,
|
|
4384
|
+
styleUrls: ['form-stepper.component.scss'],
|
|
4385
|
+
inputs: ['color'],
|
|
4386
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
4387
|
+
encapsulation: ViewEncapsulation.None,
|
|
4388
|
+
}]
|
|
4389
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { incompleteIcon: [{
|
|
4390
|
+
type: Input
|
|
4391
|
+
}], steps: [{
|
|
4392
|
+
type: Input
|
|
4393
|
+
}], selected: [{
|
|
4394
|
+
type: Output
|
|
4395
|
+
}] } });
|
|
4396
|
+
|
|
4397
|
+
class MtnaWfFormStepperModule {
|
|
4398
|
+
}
|
|
4399
|
+
MtnaWfFormStepperModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormStepperModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
4400
|
+
MtnaWfFormStepperModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormStepperModule, declarations: [MtnaWfFormStepComponent, MtnaWfFormStepGroupComponent, MtnaWfFormStepGroupPipe, MtnaWfFormStepperComponent], imports: [CommonModule,
|
|
4401
|
+
FlexLayoutModule,
|
|
4402
|
+
MatDividerModule,
|
|
4403
|
+
MtnaStatusCircleModule,
|
|
4404
|
+
MatRippleModule,
|
|
4405
|
+
MatButtonModule,
|
|
4406
|
+
MatTooltipModule,
|
|
4407
|
+
MatIconModule], exports: [MtnaWfFormStepComponent, MtnaWfFormStepGroupComponent, MtnaWfFormStepGroupPipe, MtnaWfFormStepperComponent] });
|
|
4408
|
+
MtnaWfFormStepperModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormStepperModule, imports: [[
|
|
4409
|
+
CommonModule,
|
|
4410
|
+
FlexLayoutModule,
|
|
4411
|
+
MatDividerModule,
|
|
4412
|
+
MtnaStatusCircleModule,
|
|
4413
|
+
MatRippleModule,
|
|
4414
|
+
MatButtonModule,
|
|
4415
|
+
MatTooltipModule,
|
|
4416
|
+
MatIconModule,
|
|
4417
|
+
]] });
|
|
4418
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaWfFormStepperModule, decorators: [{
|
|
4419
|
+
type: NgModule,
|
|
4420
|
+
args: [{
|
|
4421
|
+
imports: [
|
|
4422
|
+
CommonModule,
|
|
4423
|
+
FlexLayoutModule,
|
|
4424
|
+
MatDividerModule,
|
|
4425
|
+
MtnaStatusCircleModule,
|
|
4426
|
+
MatRippleModule,
|
|
4427
|
+
MatButtonModule,
|
|
4428
|
+
MatTooltipModule,
|
|
4429
|
+
MatIconModule,
|
|
4430
|
+
],
|
|
4431
|
+
exports: [MtnaWfFormStepComponent, MtnaWfFormStepGroupComponent, MtnaWfFormStepGroupPipe, MtnaWfFormStepperComponent],
|
|
4432
|
+
declarations: [MtnaWfFormStepComponent, MtnaWfFormStepGroupComponent, MtnaWfFormStepGroupPipe, MtnaWfFormStepperComponent],
|
|
4433
|
+
}]
|
|
4434
|
+
}] });
|
|
4435
|
+
|
|
4436
|
+
class MtnaFormModule {
|
|
4437
|
+
}
|
|
4438
|
+
MtnaFormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
4439
|
+
MtnaFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaFormModule, declarations: [ItemHeaderComponent,
|
|
4440
|
+
MtnaWfAcknowledgeDialogComponent,
|
|
4441
|
+
MtnaWfBooleanComponent,
|
|
4442
|
+
MtnaWfCheckboxComponent,
|
|
4443
|
+
MtnaWfDateComponent,
|
|
4444
|
+
MtnaWfDateRangeComponent,
|
|
4445
|
+
MtnaWfDropdownComponent,
|
|
4446
|
+
MtnaWfFileUploadComponent,
|
|
4447
|
+
MtnaWfFormComponent,
|
|
4448
|
+
MtnaWfFormDisablerComponent,
|
|
4449
|
+
MtnaWfFormGroupComponent,
|
|
4450
|
+
MtnaWfFormItemComponent,
|
|
4451
|
+
MtnaWfFormItemDialogComponent,
|
|
4452
|
+
MtnaWfFormItemDirective,
|
|
4453
|
+
MtnaWfFormSectionComponent,
|
|
4454
|
+
MtnaWfInputComponent,
|
|
4455
|
+
MtnaWfMultipleChoiceComponent,
|
|
4456
|
+
MtnaWfOrderedListItemComponent,
|
|
4457
|
+
MtnaWfStepCardComponent,
|
|
4458
|
+
MtnaWfTableFormItemComponent,
|
|
4459
|
+
MtnaWfUnorderedListItemComponent,
|
|
4460
|
+
MtnaWfYearQuarterComponent,
|
|
4461
|
+
MtnaWfYearQuarterRangeComponent,
|
|
4462
|
+
RepeatableItemComponent,
|
|
4463
|
+
RepeatableItemContainerComponent,
|
|
4464
|
+
ValueItemComponent], imports: [A11yModule,
|
|
4465
|
+
CommonModule,
|
|
4466
|
+
FlexLayoutModule,
|
|
4467
|
+
FormsModule,
|
|
4468
|
+
MatAutocompleteModule,
|
|
4469
|
+
MatButtonModule,
|
|
4470
|
+
MatCardModule,
|
|
4471
|
+
MatCheckboxModule,
|
|
4472
|
+
MatChipsModule,
|
|
4473
|
+
MatDatepickerModule,
|
|
4474
|
+
MatDialogModule,
|
|
4475
|
+
MatDividerModule,
|
|
4476
|
+
MatFormFieldModule,
|
|
4477
|
+
MatIconModule,
|
|
4478
|
+
MatInputModule,
|
|
4479
|
+
MatListModule,
|
|
4480
|
+
MatMomentDateModule,
|
|
4481
|
+
MatOptionModule,
|
|
4482
|
+
MatProgressSpinnerModule,
|
|
4483
|
+
MatRadioModule,
|
|
4484
|
+
MatRippleModule,
|
|
4485
|
+
MatSelectModule,
|
|
4486
|
+
MatSlideToggleModule,
|
|
4487
|
+
MatTableModule,
|
|
4488
|
+
MatTooltipModule,
|
|
4489
|
+
MtnaAnnotationsIndicatorModule,
|
|
4490
|
+
MtnaFileDownloadModule,
|
|
4491
|
+
MtnaFileUploadModule,
|
|
4492
|
+
MtnaHighlightModule,
|
|
4493
|
+
MtnaStatusCircleModule,
|
|
4494
|
+
MtnaStatusCircleModule,
|
|
4495
|
+
MtnaTrackByPropertyPipeModule,
|
|
4496
|
+
MtnaWfFormStepperModule,
|
|
4497
|
+
PipesModule,
|
|
4498
|
+
ReactiveFormsModule], exports: [MtnaWfStepCardComponent, MtnaWfFormStepperComponent, MtnaWfFormComponent, PipesModule] });
|
|
4499
|
+
MtnaFormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaFormModule, providers: [{ provide: ErrorStateMatcher, useClass: MtnaWfInstantValidationResultErrorStateMatcher }], imports: [[
|
|
4500
|
+
A11yModule,
|
|
4501
|
+
CommonModule,
|
|
4502
|
+
FlexLayoutModule,
|
|
4503
|
+
FormsModule,
|
|
4504
|
+
MatAutocompleteModule,
|
|
4505
|
+
MatButtonModule,
|
|
4506
|
+
MatCardModule,
|
|
4507
|
+
MatCheckboxModule,
|
|
4508
|
+
MatChipsModule,
|
|
4509
|
+
MatDatepickerModule,
|
|
4510
|
+
MatDialogModule,
|
|
4511
|
+
MatDividerModule,
|
|
4512
|
+
MatFormFieldModule,
|
|
4513
|
+
MatIconModule,
|
|
4514
|
+
MatInputModule,
|
|
4515
|
+
MatListModule,
|
|
4516
|
+
MatMomentDateModule,
|
|
4517
|
+
MatOptionModule,
|
|
4518
|
+
MatProgressSpinnerModule,
|
|
4519
|
+
MatRadioModule,
|
|
4520
|
+
MatRippleModule,
|
|
4521
|
+
MatSelectModule,
|
|
4522
|
+
MatSlideToggleModule,
|
|
4523
|
+
MatTableModule,
|
|
4524
|
+
MatTooltipModule,
|
|
4525
|
+
MtnaAnnotationsIndicatorModule,
|
|
4526
|
+
MtnaFileDownloadModule,
|
|
4527
|
+
MtnaFileUploadModule,
|
|
4528
|
+
MtnaHighlightModule,
|
|
4529
|
+
MtnaStatusCircleModule,
|
|
4530
|
+
MtnaStatusCircleModule,
|
|
4531
|
+
MtnaTrackByPropertyPipeModule,
|
|
4532
|
+
MtnaWfFormStepperModule,
|
|
4533
|
+
PipesModule,
|
|
4534
|
+
ReactiveFormsModule,
|
|
4535
|
+
], PipesModule] });
|
|
4536
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MtnaFormModule, decorators: [{
|
|
4537
|
+
type: NgModule,
|
|
4538
|
+
args: [{
|
|
4539
|
+
imports: [
|
|
4540
|
+
A11yModule,
|
|
4541
|
+
CommonModule,
|
|
4542
|
+
FlexLayoutModule,
|
|
4543
|
+
FormsModule,
|
|
4544
|
+
MatAutocompleteModule,
|
|
4545
|
+
MatButtonModule,
|
|
4546
|
+
MatCardModule,
|
|
4547
|
+
MatCheckboxModule,
|
|
4548
|
+
MatChipsModule,
|
|
4549
|
+
MatDatepickerModule,
|
|
4550
|
+
MatDialogModule,
|
|
4551
|
+
MatDividerModule,
|
|
4552
|
+
MatFormFieldModule,
|
|
4553
|
+
MatIconModule,
|
|
4554
|
+
MatInputModule,
|
|
4555
|
+
MatListModule,
|
|
4556
|
+
MatMomentDateModule,
|
|
4557
|
+
MatOptionModule,
|
|
4558
|
+
MatProgressSpinnerModule,
|
|
4559
|
+
MatRadioModule,
|
|
4560
|
+
MatRippleModule,
|
|
4561
|
+
MatSelectModule,
|
|
4562
|
+
MatSlideToggleModule,
|
|
4563
|
+
MatTableModule,
|
|
4564
|
+
MatTooltipModule,
|
|
4565
|
+
MtnaAnnotationsIndicatorModule,
|
|
4566
|
+
MtnaFileDownloadModule,
|
|
4567
|
+
MtnaFileUploadModule,
|
|
4568
|
+
MtnaHighlightModule,
|
|
4569
|
+
MtnaStatusCircleModule,
|
|
4570
|
+
MtnaStatusCircleModule,
|
|
4571
|
+
MtnaTrackByPropertyPipeModule,
|
|
4572
|
+
MtnaWfFormStepperModule,
|
|
4573
|
+
PipesModule,
|
|
4574
|
+
ReactiveFormsModule,
|
|
4575
|
+
],
|
|
4576
|
+
declarations: [
|
|
4577
|
+
ItemHeaderComponent,
|
|
4578
|
+
MtnaWfAcknowledgeDialogComponent,
|
|
4579
|
+
MtnaWfBooleanComponent,
|
|
4580
|
+
MtnaWfCheckboxComponent,
|
|
4581
|
+
MtnaWfDateComponent,
|
|
4582
|
+
MtnaWfDateRangeComponent,
|
|
4583
|
+
MtnaWfDropdownComponent,
|
|
4584
|
+
MtnaWfFileUploadComponent,
|
|
4585
|
+
MtnaWfFormComponent,
|
|
4586
|
+
MtnaWfFormDisablerComponent,
|
|
4587
|
+
MtnaWfFormGroupComponent,
|
|
4588
|
+
MtnaWfFormItemComponent,
|
|
4589
|
+
MtnaWfFormItemDialogComponent,
|
|
4590
|
+
MtnaWfFormItemDirective,
|
|
4591
|
+
MtnaWfFormSectionComponent,
|
|
4592
|
+
MtnaWfInputComponent,
|
|
4593
|
+
MtnaWfMultipleChoiceComponent,
|
|
4594
|
+
MtnaWfOrderedListItemComponent,
|
|
4595
|
+
MtnaWfStepCardComponent,
|
|
4596
|
+
MtnaWfTableFormItemComponent,
|
|
4597
|
+
MtnaWfUnorderedListItemComponent,
|
|
4598
|
+
MtnaWfYearQuarterComponent,
|
|
4599
|
+
MtnaWfYearQuarterRangeComponent,
|
|
4600
|
+
RepeatableItemComponent,
|
|
4601
|
+
RepeatableItemContainerComponent,
|
|
4602
|
+
ValueItemComponent,
|
|
4603
|
+
],
|
|
4604
|
+
providers: [{ provide: ErrorStateMatcher, useClass: MtnaWfInstantValidationResultErrorStateMatcher }],
|
|
4605
|
+
exports: [MtnaWfStepCardComponent, MtnaWfFormStepperComponent, MtnaWfFormComponent, PipesModule],
|
|
4606
|
+
}]
|
|
4607
|
+
}] });
|
|
4608
|
+
|
|
4609
|
+
/**
|
|
4610
|
+
* Generated bundle index. Do not edit.
|
|
4611
|
+
*/
|
|
4612
|
+
|
|
4613
|
+
export { BaseFormItemControl, BaseFormStep, COMPLEX_STANDARD, CoerceDateItemPipe, DEFAULT_ERROR_MESSAGES, DateQuarterPipe, FormStep, FormStepGroup, GetAutoCompletePipe, GetListIconPipe, GetObjectTypePipe, ItemHeaderComponent, MTNA_WF_API_TOKEN, MTNA_WF_DEFAULT_YEAR_RANGE, MTNA_WF_EXPAND_COLLAPSE, MTNA_WF_FORM_ITEM_VALIDATION_RESULT_ERROR_NAME, MTNA_WF_ITEM_WHITELIST, MTNA_WF_ITEM_WHITELIST_FACTORY, MtnaFormModule, MtnaGetFormControlErrorPipe, MtnaWfAcknowledgeDialogComponent, MtnaWfApiService, MtnaWfBooleanComponent, MtnaWfCheckboxComponent, MtnaWfCoerceFormGroupPipe, MtnaWfDateComponent, MtnaWfDateRangeComponent, MtnaWfDialogService, MtnaWfDropdownComponent, MtnaWfFileUploadComponent, MtnaWfFormComponent, MtnaWfFormGroupComponent, MtnaWfFormItemComponent, MtnaWfFormItemDialogComponent, MtnaWfFormSectionComponent, MtnaWfFormStepComponent, MtnaWfFormStepGroupComponent, MtnaWfFormStepGroupPipe, MtnaWfFormStepperComponent, MtnaWfFormStepperModule, MtnaWfGetAvailableQuartersPipe, MtnaWfGetSelectedOptionNamePipe, MtnaWfInputComponent, MtnaWfInstantValidationResultErrorStateMatcher, MtnaWfItemsWithValuePipe, MtnaWfManagerService, MtnaWfMultipleChoiceComponent, MtnaWfNgFormService, MtnaWfOrderedListItemComponent, MtnaWfSanitizeHtmlPipe, serializerUtil as MtnaWfSerializer, MtnaWfStepCardComponent, MtnaWfTableFormItemComponent, MtnaWfUIService, MtnaWfUnorderedListItemComponent, MtnaWfYearQuarterComponent, MtnaWfYearQuarterRangeComponent, PipesModule, RepeatableItemComponent, RepeatableItemContainerComponent, ValueItemComponent, WEB_FORM_CUSTOM_ERRORS, everyStepStatus, findFormControl, findFormItem, flattenSteps, generateFormSteps, isFormGroup, isFormStepGroup, updateStepStatus, validationResultValidator };
|
|
4614
|
+
//# sourceMappingURL=mtna-web-form-angular.js.map
|