@kms-ngx-ui/presentational 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.
Files changed (122) hide show
  1. package/README.md +24 -0
  2. package/bundles/kms-ngx-ui-presentational.umd.js +2441 -0
  3. package/bundles/kms-ngx-ui-presentational.umd.js.map +1 -0
  4. package/bundles/kms-ngx-ui-presentational.umd.min.js +38 -0
  5. package/bundles/kms-ngx-ui-presentational.umd.min.js.map +1 -0
  6. package/esm2015/kms-ngx-ui-presentational.js +37 -0
  7. package/esm2015/lib/kms-ngx-ui-presentational.component.js +18 -0
  8. package/esm2015/lib/kms-ngx-ui-presentational.module.js +98 -0
  9. package/esm2015/lib/kms-ngx-ui-presentational.service.js +13 -0
  10. package/esm2015/lib/models/address.model.js +6 -0
  11. package/esm2015/lib/models/iconSize.enum.js +17 -0
  12. package/esm2015/lib/models/index.js +5 -0
  13. package/esm2015/lib/models/is-value.function.js +17 -0
  14. package/esm2015/lib/models/salutation.enum.js +8 -0
  15. package/esm2015/lib/models/types/attached-file-dto.model.js +6 -0
  16. package/esm2015/lib/models/types/nullable.type.js +5 -0
  17. package/esm2015/lib/parent-components/actions.component.js +48 -0
  18. package/esm2015/lib/parent-components/form-control.component.js +73 -0
  19. package/esm2015/lib/parent-components/form.component.js +77 -0
  20. package/esm2015/lib/pipes/custom-pipes.module.js +45 -0
  21. package/esm2015/lib/pipes/decode-uri.pipe.js +15 -0
  22. package/esm2015/lib/pipes/encode-uri.pipe.js +15 -0
  23. package/esm2015/lib/pipes/integer-currency.pipe.js +29 -0
  24. package/esm2015/lib/pipes/safe-html.pipe.js +22 -0
  25. package/esm2015/lib/pipes/safe-style.pipe.js +22 -0
  26. package/esm2015/lib/pipes/safe-url.pipe.js +22 -0
  27. package/esm2015/lib/pipes/to-number.pipe.js +19 -0
  28. package/esm2015/lib/pipes/trim.pipe.js +16 -0
  29. package/esm2015/lib/pipes/typeof.pipe.js +12 -0
  30. package/esm2015/lib/services/viewport.service.js +213 -0
  31. package/esm2015/lib/ui/back-to-top/back-to-top.component.js +46 -0
  32. package/esm2015/lib/ui/button-with-confirm-dialog/button-response-types.enum.js +6 -0
  33. package/esm2015/lib/ui/button-with-confirm-dialog/button-with-confirm-dialog.component.js +56 -0
  34. package/esm2015/lib/ui/button-with-confirm-dialog/dialog-data.model.js +2 -0
  35. package/esm2015/lib/ui/checkbox/checkbox.component.js +63 -0
  36. package/esm2015/lib/ui/color-input/color-input.component.js +63 -0
  37. package/esm2015/lib/ui/enum-radiogroup/enum-radiogroup.component.js +46 -0
  38. package/esm2015/lib/ui/file-input/file-input.component.js +215 -0
  39. package/esm2015/lib/ui/flyout/flyout.component.js +84 -0
  40. package/esm2015/lib/ui/generic-dialog/generic-dialog.component.js +54 -0
  41. package/esm2015/lib/ui/icon/icon.component.js +47 -0
  42. package/esm2015/lib/ui/icon/iconSize.enum.js +17 -0
  43. package/esm2015/lib/ui/kms-accordion-item/kms-accordion-item.component.js +36 -0
  44. package/esm2015/lib/ui/loader/loader.component.js +21 -0
  45. package/esm2015/lib/ui/map/map.component.js +137 -0
  46. package/esm2015/lib/ui/radiobutton/radiobutton.component.js +66 -0
  47. package/esm2015/lib/ui/salutation-dropdown/salutation-dropdown.component.js +49 -0
  48. package/esm2015/lib/ui/salutation-radiogroup/salutation-radiogroup.component.js +44 -0
  49. package/esm2015/lib/ui/time-input/time-input.component.js +80 -0
  50. package/esm2015/lib/ui/tooltip/tooltip.component.js +17 -0
  51. package/esm2015/lib/ui/tooltip-icon/tooltip-icon.component.js +29 -0
  52. package/esm2015/lib/ui/yes-no-radiogroup/yes-no-radiogroup.component.js +74 -0
  53. package/esm2015/public-api.js +12 -0
  54. package/fesm2015/kms-ngx-ui-presentational.js +1962 -0
  55. package/fesm2015/kms-ngx-ui-presentational.js.map +1 -0
  56. package/kms-ngx-ui-presentational.d.ts +37 -0
  57. package/kms-ngx-ui-presentational.metadata.json +1 -0
  58. package/lib/kms-ngx-ui-presentational.component.d.ts +5 -0
  59. package/lib/kms-ngx-ui-presentational.module.d.ts +2 -0
  60. package/lib/kms-ngx-ui-presentational.service.d.ts +3 -0
  61. package/lib/models/address.model.d.ts +14 -0
  62. package/lib/models/iconSize.enum.d.ts +15 -0
  63. package/lib/models/index.d.ts +4 -0
  64. package/lib/models/is-value.function.d.ts +9 -0
  65. package/lib/models/salutation.enum.d.ts +5 -0
  66. package/lib/models/types/attached-file-dto.model.d.ts +11 -0
  67. package/lib/models/types/nullable.type.d.ts +4 -0
  68. package/lib/parent-components/actions.component.d.ts +28 -0
  69. package/lib/parent-components/form-control.component.d.ts +24 -0
  70. package/lib/parent-components/form.component.d.ts +31 -0
  71. package/lib/pipes/custom-pipes.module.d.ts +5 -0
  72. package/lib/pipes/decode-uri.pipe.d.ts +7 -0
  73. package/lib/pipes/encode-uri.pipe.d.ts +7 -0
  74. package/lib/pipes/integer-currency.pipe.d.ts +10 -0
  75. package/lib/pipes/safe-html.pipe.d.ts +10 -0
  76. package/lib/pipes/safe-style.pipe.d.ts +10 -0
  77. package/lib/pipes/safe-url.pipe.d.ts +10 -0
  78. package/lib/pipes/to-number.pipe.d.ts +7 -0
  79. package/lib/pipes/trim.pipe.d.ts +7 -0
  80. package/lib/pipes/typeof.pipe.d.ts +4 -0
  81. package/lib/services/viewport.service.d.ts +74 -0
  82. package/lib/ui/back-to-top/back-to-top.component.d.ts +10 -0
  83. package/lib/ui/button-with-confirm-dialog/button-response-types.enum.d.ts +4 -0
  84. package/lib/ui/button-with-confirm-dialog/button-with-confirm-dialog.component.d.ts +16 -0
  85. package/lib/ui/button-with-confirm-dialog/dialog-data.model.d.ts +9 -0
  86. package/lib/ui/checkbox/checkbox.component.d.ts +28 -0
  87. package/lib/ui/color-input/color-input.component.d.ts +15 -0
  88. package/lib/ui/enum-radiogroup/enum-radiogroup.component.d.ts +14 -0
  89. package/lib/ui/file-input/file-input.component.d.ts +86 -0
  90. package/lib/ui/flyout/flyout.component.d.ts +32 -0
  91. package/lib/ui/generic-dialog/generic-dialog.component.d.ts +23 -0
  92. package/lib/ui/icon/icon.component.d.ts +39 -0
  93. package/lib/ui/icon/iconSize.enum.d.ts +15 -0
  94. package/lib/ui/kms-accordion-item/kms-accordion-item.component.d.ts +18 -0
  95. package/lib/ui/loader/loader.component.d.ts +6 -0
  96. package/lib/ui/map/map.component.d.ts +70 -0
  97. package/lib/ui/radiobutton/radiobutton.component.d.ts +23 -0
  98. package/lib/ui/salutation-dropdown/salutation-dropdown.component.d.ts +14 -0
  99. package/lib/ui/salutation-radiogroup/salutation-radiogroup.component.d.ts +12 -0
  100. package/lib/ui/time-input/time-input.component.d.ts +19 -0
  101. package/lib/ui/tooltip/tooltip.component.d.ts +3 -0
  102. package/lib/ui/tooltip-icon/tooltip-icon.component.d.ts +10 -0
  103. package/lib/ui/yes-no-radiogroup/yes-no-radiogroup.component.d.ts +24 -0
  104. package/package.json +25 -0
  105. package/public-api.d.ts +6 -0
  106. package/src/lib/ui/back-to-top/back-to-top.component.scss +47 -0
  107. package/src/lib/ui/button-with-confirm-dialog/button-with-confirm-dialog.component.scss +0 -0
  108. package/src/lib/ui/checkbox/checkbox.component.scss +57 -0
  109. package/src/lib/ui/color-input/color-input.component.scss +38 -0
  110. package/src/lib/ui/file-input/file-input.component.scss +0 -0
  111. package/src/lib/ui/flyout/flyout.component.scss +34 -0
  112. package/src/lib/ui/generic-dialog/generic-dialog.component.scss +59 -0
  113. package/src/lib/ui/icon/icon.component.scss +149 -0
  114. package/src/lib/ui/kms-accordion-item/kms-accordion-item.component.scss +95 -0
  115. package/src/lib/ui/loader/loader.component.scss +0 -0
  116. package/src/lib/ui/map/map.component.scss +0 -0
  117. package/src/lib/ui/radiobutton/radiobutton.component.scss +30 -0
  118. package/src/lib/ui/time-input/time-input.component.scss +10 -0
  119. package/src/lib/ui/tooltip/tooltip.component.scss +27 -0
  120. package/src/lib/ui/tooltip-icon/tooltip-icon.component.scss +2 -0
  121. package/src/styles/mixins.scss +9 -0
  122. package/src/styles/styles.scss +30 -0
@@ -0,0 +1,1962 @@
1
+ import { ɵɵdefineInjectable, Injectable, Component, EventEmitter, Input, Output, forwardRef, Renderer2, ViewChild, ApplicationRef, ChangeDetectorRef, Pipe, NgModule, VERSION, Inject, PLATFORM_ID, HostListener, NgZone } from '@angular/core';
2
+ import { CurrencyPipe, CommonModule, isPlatformBrowser } from '@angular/common';
3
+ import { NG_VALUE_ACCESSOR, FormBuilder, FormControl, NG_VALIDATORS, FormsModule, ReactiveFormsModule } from '@angular/forms';
4
+ import { MatCheckboxModule } from '@angular/material/checkbox';
5
+ import { MatRadioModule } from '@angular/material/radio';
6
+ import { trigger, state, style } from '@angular/animations';
7
+ import { DomSanitizer } from '@angular/platform-browser';
8
+ import { Subject } from 'rxjs';
9
+ import { MatDialogRef, MAT_DIALOG_DATA, MatDialog, MatDialogModule } from '@angular/material/dialog';
10
+ import { SubSink } from 'subsink';
11
+ import { GoogleMapsModule } from '@angular/google-maps';
12
+ import { MatButtonModule } from '@angular/material/button';
13
+ import { MatExpansionModule } from '@angular/material/expansion';
14
+
15
+ class KmsUiPresentationalService {
16
+ constructor() { }
17
+ }
18
+ KmsUiPresentationalService.ɵprov = ɵɵdefineInjectable({ factory: function KmsUiPresentationalService_Factory() { return new KmsUiPresentationalService(); }, token: KmsUiPresentationalService, providedIn: "root" });
19
+ KmsUiPresentationalService.decorators = [
20
+ { type: Injectable, args: [{
21
+ providedIn: 'root'
22
+ },] }
23
+ ];
24
+ KmsUiPresentationalService.ctorParameters = () => [];
25
+
26
+ class KmsUiPresentationalComponent {
27
+ constructor() { }
28
+ ngOnInit() {
29
+ }
30
+ }
31
+ KmsUiPresentationalComponent.decorators = [
32
+ { type: Component, args: [{
33
+ selector: 'lib-kms-ngx-ui-presentational',
34
+ template: `
35
+ <p>
36
+ kms-ngx-ui-presentational works!
37
+ </p>
38
+ `
39
+ },] }
40
+ ];
41
+ KmsUiPresentationalComponent.ctorParameters = () => [];
42
+
43
+ /*!
44
+ * @copyright FLYACTS GmbH 2019
45
+ */
46
+ class ActionsParentComponent {
47
+ constructor() {
48
+ /**
49
+ * Defines the disabled property
50
+ */
51
+ this.disabled = false;
52
+ /**
53
+ * Set button as selected. F.e. in multiselect component
54
+ */
55
+ this.checked = false;
56
+ /**
57
+ * Displayed label.
58
+ */
59
+ this.label = '';
60
+ /**
61
+ * Link
62
+ */
63
+ this.link = '';
64
+ /**
65
+ * Internal value that will be send if a form is submitted.
66
+ */
67
+ this.initialValue = '';
68
+ this.select = new EventEmitter();
69
+ }
70
+ selectAction(id) {
71
+ this.checked = !this.checked;
72
+ this.select.emit(id);
73
+ }
74
+ }
75
+ ActionsParentComponent.decorators = [
76
+ { type: Component, args: [{
77
+ selector: 'kms-actions',
78
+ template: ''
79
+ },] }
80
+ ];
81
+ ActionsParentComponent.propDecorators = {
82
+ disabled: [{ type: Input }],
83
+ checked: [{ type: Input }],
84
+ label: [{ type: Input }],
85
+ link: [{ type: Input }],
86
+ initialValue: [{ type: Input }],
87
+ select: [{ type: Output }]
88
+ };
89
+
90
+ /*!
91
+ * @copyright FLYACTS GmbH 2019
92
+ */
93
+ class CheckboxComponent extends ActionsParentComponent {
94
+ constructor() {
95
+ super();
96
+ /**
97
+ * Internal description name. All checkboxes with the same name belong to the same group.
98
+ * User can select none, one or all checkboxes with the same name.
99
+ */
100
+ this.name = '';
101
+ this.select = new EventEmitter();
102
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
103
+ this.onChange = () => { };
104
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
105
+ this.onTouch = () => { };
106
+ }
107
+ selectAction(id) {
108
+ this.select.emit(id);
109
+ this.checked = !this.checked;
110
+ }
111
+ get value() {
112
+ return this.checked;
113
+ }
114
+ set value(value) {
115
+ this.checked = value;
116
+ this.onChange(value);
117
+ this.onTouch(value);
118
+ }
119
+ writeValue(value) {
120
+ this.value = value;
121
+ }
122
+ registerOnChange(fn) {
123
+ this.onChange = fn;
124
+ }
125
+ registerOnTouched(fn) {
126
+ this.onTouch = fn;
127
+ }
128
+ }
129
+ CheckboxComponent.decorators = [
130
+ { type: Component, args: [{
131
+ selector: 'kms-checkbox',
132
+ template: "<!-- <label class=\"wrapper ui-copy-text\"\n [ngClass]=\"{'disabled' : disabled}\">{{label}}\n <input type=\"checkbox\" \n [checked]=\"checked\"\n [value]=\"value\"\n [name]=\"name\"\n [disabled]=\"disabled\"\n (change)=\"selectAction($event)\">\n\n</label> -->\n<mat-checkbox class=\"example-margin\" [disabled]=\"disabled\" [name]=\"name\" [(ngModel)]=\"checked\"></mat-checkbox>\n<span *ngIf=\"infoText && infoText.length > 0\" \n class=\"\"\n [ngClass]=\"{'disabled' : disabled}\">{{infoText}}\n</span>",
133
+ providers: [
134
+ {
135
+ provide: NG_VALUE_ACCESSOR,
136
+ useExisting: forwardRef(() => CheckboxComponent),
137
+ multi: true,
138
+ },
139
+ ],
140
+ styles: [".test{color:#0000cd}"]
141
+ },] }
142
+ ];
143
+ CheckboxComponent.ctorParameters = () => [];
144
+ CheckboxComponent.propDecorators = {
145
+ infoText: [{ type: Input }],
146
+ name: [{ type: Input }],
147
+ select: [{ type: Output }]
148
+ };
149
+
150
+ /*!
151
+ * @copyright FLYACTS GmbH 2019
152
+ */
153
+ class FormParentComponent {
154
+ constructor(formBuilder) {
155
+ this.formBuilder = formBuilder;
156
+ this.formInitialized = false;
157
+ this.allowedCharsOnlyNumbers = new Set('0123456789'.split('').map(c => c.charCodeAt(0)));
158
+ this.formDataChanged = new EventEmitter();
159
+ this.disabled = false;
160
+ }
161
+ // TODO make a service or make own compoennt etc.
162
+ /**
163
+ * Returns if a number was pressed
164
+ * @param e
165
+ * @returns
166
+ */
167
+ checkIfKeyWasNumber(e, allowDelete = true, allowArrows = true, allowCutCopyPaste = true) {
168
+ // returns if keycode of numbers-row or numberpad. Or if parameter set, allow delete/backspace key
169
+ const isNumberRow = e.keyCode >= 48 && e.keyCode <= 57;
170
+ const isNumberPad = e.keyCode >= 96 && e.keyCode <= 105;
171
+ const isArrows = e.keyCode >= 37 && e.keyCode <= 40;
172
+ const isDelete = e.keyCode == 8 || e.keyCode == 46;
173
+ const isCutCopyOrPaste = (e.ctrlKey || e.metaKey) && (e.keyCode == 86 || e.keyCode == 88 || e.keyCode == 67);
174
+ return (isNumberRow) || (isNumberPad) || (allowDelete && isDelete) || (allowArrows && isArrows) || (allowCutCopyPaste && isCutCopyOrPaste);
175
+ }
176
+ // TODO make a service or make own compoennt etc.
177
+ /**
178
+ * Prevents to input other chars than numbers in input
179
+ * @param event
180
+ */
181
+ removeNumbersOnType(event) {
182
+ // only allow keydown from numbers-row or numberpad of keybard and block other chars than numbers
183
+ if (!this.checkIfKeyWasNumber(event) && !this.allowedCharsOnlyNumbers.has(event.keyCode)) {
184
+ event.preventDefault();
185
+ }
186
+ }
187
+ // TODO make a service or make own compoennt etc.
188
+ /**
189
+ * Prevents input when pasting which is not number
190
+ * @param event
191
+ */
192
+ removeNumbersOnPaste(event) {
193
+ const clipboardData = event.clipboardData;
194
+ if (clipboardData) {
195
+ const pastedText = clipboardData.getData('text');
196
+ if (pastedText) {
197
+ const isnum = /^\d+$/.test(pastedText);
198
+ if (!isnum) {
199
+ event.preventDefault();
200
+ }
201
+ }
202
+ }
203
+ }
204
+ ngOnInit() {
205
+ this.formDataChanged.emit(this.form);
206
+ this.form.valueChanges.subscribe(() => {
207
+ this.formDataChanged.emit(this.form);
208
+ });
209
+ }
210
+ }
211
+ FormParentComponent.decorators = [
212
+ { type: Component, args: [{
213
+ selector: 'kms-form',
214
+ template: ''
215
+ },] }
216
+ ];
217
+ FormParentComponent.ctorParameters = () => [
218
+ { type: FormBuilder }
219
+ ];
220
+ FormParentComponent.propDecorators = {
221
+ formDataChanged: [{ type: Output }],
222
+ disabled: [{ type: Input }]
223
+ };
224
+
225
+ class FormControlParentComponent extends FormParentComponent {
226
+ constructor(formBuilder, renderer) {
227
+ super(formBuilder);
228
+ this.formBuilder = formBuilder;
229
+ this.renderer = renderer;
230
+ this.defaultDataOverride = ''; // when we have NO form around, get default via input to set it manually
231
+ this.onSelectItemEmitter = new EventEmitter();
232
+ this.internalValue = '';
233
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
234
+ this.onChange = () => { };
235
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
236
+ this.onTouch = () => { };
237
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
238
+ this.onTouched = () => { };
239
+ }
240
+ ngOnInit() {
241
+ super.ngOnInit();
242
+ }
243
+ change(value) {
244
+ this.onChange(value);
245
+ this.onTouched();
246
+ }
247
+ get value() {
248
+ return this.internalValue;
249
+ }
250
+ set value(value) {
251
+ this.internalValue = value;
252
+ if (value !== undefined && this.internalValue !== value) {
253
+ if (!this.internalValue && this.defaultDataOverride) {
254
+ this.internalValue = this.defaultDataOverride;
255
+ }
256
+ this.onChange(value);
257
+ this.onTouch(value);
258
+ }
259
+ }
260
+ writeValue(value) {
261
+ this.internalValue = value;
262
+ this.value = value;
263
+ }
264
+ registerOnChange(fn) {
265
+ this.onChange = fn;
266
+ }
267
+ registerOnTouched(fn) {
268
+ this.onTouch = fn;
269
+ }
270
+ setDisabledState(isDisabled) {
271
+ if (this.child) {
272
+ this.renderer.setProperty(this.child.nativeElement, 'disabled', isDisabled);
273
+ }
274
+ }
275
+ validate(_) {
276
+ return this.form.valid ? null : false;
277
+ }
278
+ }
279
+ FormControlParentComponent.decorators = [
280
+ { type: Component, args: [{
281
+ selector: 'kms-formControlParent',
282
+ template: ''
283
+ },] }
284
+ ];
285
+ FormControlParentComponent.ctorParameters = () => [
286
+ { type: FormBuilder },
287
+ { type: Renderer2 }
288
+ ];
289
+ FormControlParentComponent.propDecorators = {
290
+ defaultDataOverride: [{ type: Input }],
291
+ onSelectItemEmitter: [{ type: Output }],
292
+ child: [{ type: ViewChild, args: ['child',] }]
293
+ };
294
+
295
+ class ColorInputComponent extends FormControlParentComponent {
296
+ constructor(formBuilder, renderer) {
297
+ super(formBuilder, renderer);
298
+ this.formBuilder = formBuilder;
299
+ this.renderer = renderer;
300
+ this.label = '';
301
+ this.tooltipText = '';
302
+ this.placeholder = '';
303
+ }
304
+ ngOnInit() {
305
+ this.form = this.formBuilder.group({
306
+ color: '',
307
+ });
308
+ this.formInitialized = true;
309
+ this.form.valueChanges.subscribe((value) => {
310
+ this.internalValue = value.color;
311
+ this.onChange(value.color);
312
+ });
313
+ super.ngOnInit();
314
+ }
315
+ validate(_) {
316
+ // TODO fix to validate complete form
317
+ this.valid = this.matchesHex(this.form.value) ? null : false;
318
+ return this.valid && {
319
+ invalid: !this.valid
320
+ };
321
+ }
322
+ matchesHex(match) {
323
+ if (match) {
324
+ const ret = match.match(/^#[0-9a-f]{6}$/i);
325
+ this.valid = ret && ret.length > 0;
326
+ return ret;
327
+ }
328
+ return false;
329
+ }
330
+ }
331
+ ColorInputComponent.decorators = [
332
+ { type: Component, args: [{
333
+ selector: 'kms-color-input',
334
+ template: "\n<form [formGroup]=\"form\" *ngIf=\"formInitialized\">\n <div>\n <mat-form-field class=\"colorInput\">\n <kms-tooltip-icon [tooltipText]=\"tooltipText\" *ngIf=\"tooltipText\"></kms-tooltip-icon>\n <mat-label>{{ label }}</mat-label>\n <input type=\"text\" [value]=\"value\" matInput formControlName=\"color\" [placeholder]=\"placeholder\" [ngClass]=\"{'my-inValid': !matchesHex(value)}\" />\n <input type=\"color\" [value]=\"value && matchesHex(value) ? value : '#ffffff'\" formControlName=\"color\" [ngClass]=\"{'my-inValid': !matchesHex(value)}\" />\n </mat-form-field>\n </div>\n</form>",
335
+ providers: [
336
+ {
337
+ provide: NG_VALUE_ACCESSOR,
338
+ useExisting: forwardRef(() => ColorInputComponent),
339
+ multi: true,
340
+ },
341
+ ],
342
+ styles: [".colorInput{position:relative}.colorInput input[type=color]{display:block;position:absolute;width:20px;height:20px;left:0;bottom:10px;padding:0;margin:0;border:1px solid transparent}.colorInput input.my-inValid[type=color]{border:1px dotted red}.colorInput input[type=text]{padding-left:30px}.colorInput input.my-inValid[type=text]{color:red}.colorInput kms-tooltip-icon{position:absolute;right:0;top:-10px}.colorInput .mat-form-field-label{padding-left:30px}.colorInput .mat-form-field-can-float.mat-focused .mat-form-label{padding-left:0}"]
343
+ },] }
344
+ ];
345
+ ColorInputComponent.ctorParameters = () => [
346
+ { type: FormBuilder },
347
+ { type: Renderer2 }
348
+ ];
349
+ ColorInputComponent.propDecorators = {
350
+ label: [{ type: Input }],
351
+ tooltipText: [{ type: Input }],
352
+ placeholder: [{ type: Input }]
353
+ };
354
+
355
+ /*!
356
+ * @copyright FLYACTS GmbH 2019
357
+ */
358
+ class RadioButtonComponent extends ActionsParentComponent {
359
+ constructor() {
360
+ super();
361
+ /**
362
+ * Internal description name. All radio buttons with the same name belong to the same group.
363
+ * User can select exactly one of the radio buttons from the same group.
364
+ */
365
+ this.name = '';
366
+ /**
367
+ * Internal description id. Will be send in the output event when the radio button is selected.
368
+ */
369
+ this.id = '';
370
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
371
+ this.onChange = () => { };
372
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
373
+ this.onTouch = () => { };
374
+ }
375
+ selectAction(id) {
376
+ this.select.emit(id);
377
+ this.checked = !this.checked;
378
+ }
379
+ get value() {
380
+ return this.checked;
381
+ }
382
+ set value(value) {
383
+ this.checked = value;
384
+ this.onChange(value);
385
+ this.onTouch(value);
386
+ }
387
+ writeValue(value) {
388
+ this.value = value;
389
+ }
390
+ registerOnChange(fn) {
391
+ this.onChange = fn;
392
+ }
393
+ registerOnTouched(fn) {
394
+ this.onTouch = fn;
395
+ }
396
+ }
397
+ RadioButtonComponent.decorators = [
398
+ { type: Component, args: [{
399
+ selector: 'kms-radiobutton',
400
+ template: "<label class=\"wrapper ui-small-text\"\n [ngClass]=\"{'disabled' : disabled}\">\n <input type=\"radio\"\n [name]=\"name\"\n [value]=\"value\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n [id]=\"id\"\n (change)=\"selectAction($event)\">{{label}}\n\n <kms-icon\n class=\"checkmark\" \n aria-hidden=\"true\"\n *ngIf=\"checked\"\n [ngClass]=\"{\n 'disabled' : disabled\n }\"\n [iconClass]=\"{\n 'disabled' : disabled, \n 'color-primary': true,\n 'size-16': true\n }\"\n [icon]=\"'ic_radiobutton_active'\"\n >\n </kms-icon>\n <kms-icon\n class=\"checkmark\" \n aria-hidden=\"true\"\n *ngIf=\"!checked\"\n [ngClass]=\"{\n 'disabled' : disabled\n }\"\n [iconClass]=\"{\n 'disabled' : disabled, \n 'color-primary': true,\n 'size-16': true\n }\"\n [icon]=\"'ic_radiobutton_inactive'\"\n >\n </kms-icon>\n <ng-content></ng-content>\n</label>\n",
401
+ providers: [
402
+ {
403
+ provide: NG_VALUE_ACCESSOR,
404
+ useExisting: forwardRef(() => RadioButtonComponent),
405
+ multi: true,
406
+ },
407
+ ],
408
+ styles: [".wrapper{position:relative;display:inline-block;padding-left:35px;cursor:pointer}.wrapper input{position:absolute;opacity:0;cursor:pointer;height:0;width:0}.wrapper.disabled{cursor:default}"]
409
+ },] }
410
+ ];
411
+ RadioButtonComponent.ctorParameters = () => [];
412
+ RadioButtonComponent.propDecorators = {
413
+ name: [{ type: Input }],
414
+ id: [{ type: Input }],
415
+ formControl: [{ type: Input }]
416
+ };
417
+
418
+ class TimeInputComponent {
419
+ constructor(formBuilder) {
420
+ this.formBuilder = formBuilder;
421
+ this.h = '';
422
+ this.m = '';
423
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
424
+ this.onChange = () => { };
425
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
426
+ this.onTouch = () => { };
427
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
428
+ this.onTouched = () => { };
429
+ }
430
+ get value() {
431
+ return this.value;
432
+ }
433
+ set value(value) {
434
+ this.onChange(value);
435
+ this.onTouch(value);
436
+ }
437
+ writeValue(value) {
438
+ if (value && value.length === 8) {
439
+ this.h = value.substr(0, 2);
440
+ this.m = value.substr(3, 2);
441
+ }
442
+ else if (value && value.length === 5) {
443
+ this.h = value.substr(0, 2);
444
+ this.m = value.substr(-2);
445
+ }
446
+ //we need to also update the form value because angular has a problem reading it from first time when valuechanges subscription was fired.
447
+ this.form.controls['h'].setValue(this.h);
448
+ this.form.controls['m'].setValue(this.m);
449
+ this.form.valueChanges.subscribe(value => {
450
+ this.h = value.h;
451
+ this.m = value.m;
452
+ value = this.getNewOrDefault();
453
+ this.value = value;
454
+ this.onChange(value);
455
+ });
456
+ }
457
+ ngOnInit() {
458
+ this.form = this.formBuilder.group({
459
+ h: '',
460
+ m: '',
461
+ });
462
+ }
463
+ getNewOrDefault() {
464
+ //reset if user deletes everything
465
+ if (this.h === '' && this.m === '') {
466
+ return '';
467
+ }
468
+ const ret = this.h.padStart(2, '0') + ':' + this.m.padStart(2, '0');
469
+ return ret;
470
+ }
471
+ registerOnChange(fn) {
472
+ this.onChange = fn;
473
+ }
474
+ registerOnTouched(fn) {
475
+ this.onTouch = fn;
476
+ }
477
+ }
478
+ TimeInputComponent.decorators = [
479
+ { type: Component, args: [{
480
+ selector: 'kms-time-input',
481
+ template: "<form [formGroup]=\"form\" class=\"timeInput\">\n <input formControlName=\"h\" [value]=\"h\" maxlength=\"2\" />\n <span>:</span>\n <input formControlName=\"m\" [value]=\"m\" maxlength=\"2\" />\n</form>",
482
+ providers: [
483
+ {
484
+ provide: NG_VALUE_ACCESSOR,
485
+ useExisting: forwardRef(() => TimeInputComponent),
486
+ multi: true,
487
+ },
488
+ ],
489
+ styles: [".timeInput{display:inline}.timeInput input{width:2em;margin-right:4px;margin-left:4px;font-size:16px}"]
490
+ },] }
491
+ ];
492
+ TimeInputComponent.ctorParameters = () => [
493
+ { type: FormBuilder }
494
+ ];
495
+
496
+ class YesNoRadiogroupComponent {
497
+ constructor(formBuilder, renderer) {
498
+ this.formBuilder = formBuilder;
499
+ this.renderer = renderer;
500
+ this.disabled = false;
501
+ this.textYes = '';
502
+ this.textNo = '';
503
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
504
+ this.onChange = () => { };
505
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
506
+ this.onTouch = () => { };
507
+ }
508
+ get value() {
509
+ return this.internalValue;
510
+ }
511
+ set value(value) {
512
+ this.internalValue = value;
513
+ if (value !== undefined && this.internalValue !== value) {
514
+ this.onChange(value);
515
+ this.onTouch(value);
516
+ }
517
+ }
518
+ writeValue(value) {
519
+ this.internalValue = value;
520
+ this.value = value;
521
+ }
522
+ registerOnChange(fn) {
523
+ this.onChange = fn;
524
+ }
525
+ registerOnTouched(fn) {
526
+ this.onTouch = fn;
527
+ }
528
+ setDisabledState(isDisabled) {
529
+ if (this.child) {
530
+ this.renderer.setProperty(this.child.nativeElement, 'disabled', isDisabled);
531
+ }
532
+ }
533
+ ngOnInit() {
534
+ this.form = this.formBuilder.group({
535
+ yesno: [],
536
+ });
537
+ this.form.valueChanges.subscribe((value) => {
538
+ this.internalValue = value.yesno;
539
+ this.onChange(value.yesno);
540
+ });
541
+ }
542
+ }
543
+ YesNoRadiogroupComponent.decorators = [
544
+ { type: Component, args: [{
545
+ selector: 'kms-yesno-radiogroup',
546
+ template: "<form [formGroup]=\"form\">\n <div>{{ header }}</div>\n <mat-radio-group [formControl]=\"form.controls['yesno']\" [disabled]=\"disabled\" #child>\n <mat-radio-button [value]=\"true\" [checked]=\"internalValue === true\"> {{ textYes }}</mat-radio-button>\n <mat-radio-button [value]=\"false\" [checked]=\"internalValue === false\"> {{ textNo }}</mat-radio-button>\n </mat-radio-group>\n</form>\n",
547
+ providers: [
548
+ {
549
+ provide: NG_VALUE_ACCESSOR,
550
+ useExisting: forwardRef(() => YesNoRadiogroupComponent),
551
+ multi: true,
552
+ },
553
+ ]
554
+ },] }
555
+ ];
556
+ YesNoRadiogroupComponent.ctorParameters = () => [
557
+ { type: FormBuilder },
558
+ { type: Renderer2 }
559
+ ];
560
+ YesNoRadiogroupComponent.propDecorators = {
561
+ header: [{ type: Input }],
562
+ disabled: [{ type: Input }],
563
+ textYes: [{ type: Input }],
564
+ textNo: [{ type: Input }],
565
+ child: [{ type: ViewChild, args: ['child',] }]
566
+ };
567
+
568
+ /*!
569
+ * @copyright FLYACTS GmbH 2019
570
+ */
571
+ var IconSize;
572
+ (function (IconSize) {
573
+ IconSize["FULLSIZE"] = "size-full";
574
+ IconSize["TINY"] = "size-16";
575
+ IconSize["SMALLER"] = "size-20";
576
+ IconSize["SMALL"] = "size-32";
577
+ IconSize["MEDIUM"] = "size-64";
578
+ IconSize["LARGE"] = "size-128";
579
+ IconSize["XL"] = "size-256";
580
+ IconSize["XXL"] = "size-512";
581
+ IconSize["XXXL"] = "size-1024";
582
+ IconSize["NONE"] = "NONE";
583
+ })(IconSize || (IconSize = {}));
584
+
585
+ /**
586
+ * @copyright FLYACTS GmbH 2019
587
+ */
588
+ /**
589
+ * Check if null or undefined
590
+ * @param value value that is being checked
591
+ */
592
+ function isValue(value) {
593
+ if (value === null) {
594
+ return false;
595
+ }
596
+ if (typeof value === 'undefined') {
597
+ return false;
598
+ }
599
+ return true;
600
+ }
601
+
602
+ // Max size in bytes of uploaded image
603
+ const MAX_SIZE_BYTES = 2097152;
604
+ class FileInputComponent {
605
+ /**
606
+ * Constructor
607
+ * @param formBuilder
608
+ * @param appRef
609
+ * @param cd
610
+ * @param translateService
611
+ * @param renderer
612
+ */
613
+ constructor(formBuilder, appRef, cd,
614
+ //private translateService: TranslateService,
615
+ renderer) {
616
+ this.formBuilder = formBuilder;
617
+ this.appRef = appRef;
618
+ this.cd = cd;
619
+ this.renderer = renderer;
620
+ this.label = '';
621
+ this.previewImage = true;
622
+ this.allowRemove = true;
623
+ this.previewImageText = '';
624
+ this.maxSizeBytes = MAX_SIZE_BYTES;
625
+ this.resizePixels = 0;
626
+ this.acceptedFileMimetypes = 'image/jpeg, image/jpg, image/png';
627
+ this.form = this.formBuilder.group({
628
+ ImageIdent: new FormControl(''),
629
+ ImageLink: new FormControl(''),
630
+ Filename: new FormControl(''),
631
+ ImageAsDataURL: new FormControl(''),
632
+ Text: new FormControl(''),
633
+ });
634
+ this.subscriptions = [];
635
+ this.newImageLoading = false;
636
+ this.IconSize = IconSize;
637
+ this.formDataChanged = new EventEmitter();
638
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
639
+ this.onChange = () => { };
640
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
641
+ this.onTouch = () => { };
642
+ }
643
+ /**
644
+ * Click on button triggers file-input to open OS file dialog
645
+ */
646
+ selectImageOverlay() {
647
+ this.fileInput.nativeElement.click();
648
+ }
649
+ /**
650
+ * Function to manage the input image
651
+ * Returns an error if the file exceeds maximum wanted filesize (Mb).
652
+ * @param ev
653
+ * @returns
654
+ */
655
+ selectImage(ev) {
656
+ if (ev.target.files && ev.target.files[0]) {
657
+ const file = ev.target.files[0];
658
+ if (file.size > this.maxSizeBytes) {
659
+ this.clearInputValue(ev);
660
+ //alert(this.translateService.instant('errors.fileTooBig'));
661
+ return;
662
+ }
663
+ else {
664
+ this.newImageLoading = true;
665
+ if (this.resizePixels > 0) {
666
+ const logoUrl = URL.createObjectURL(file);
667
+ const imgEl = document.createElement('img');
668
+ imgEl.addEventListener('load', () => {
669
+ const resizedLogo = this.resizeImage(imgEl, this.resizePixels);
670
+ const newFile = this.generateModel(file.name, resizedLogo, this.value.ImageIdent, this.value.ImageLink, this.value.Text);
671
+ this.value = newFile;
672
+ this.newImageLoading = false;
673
+ this.cd.markForCheck();
674
+ });
675
+ imgEl.src = logoUrl;
676
+ }
677
+ else {
678
+ const reader = new FileReader();
679
+ reader.readAsDataURL(file);
680
+ reader.onload = (e) => {
681
+ const newFile = this.generateModel(file.name, e.target.result, this.value.ImageIdent, this.value.ImageLink, this.value.Text);
682
+ this.value = newFile;
683
+ this.newImageLoading = false;
684
+ this.cd.markForCheck();
685
+ };
686
+ }
687
+ }
688
+ }
689
+ else {
690
+ console.warn("No file selected");
691
+ }
692
+ }
693
+ /**
694
+ * Resize an image
695
+ * @param imgEl
696
+ * @param wantedWidth as number
697
+ * @returns string
698
+ */
699
+ resizeImage(imgEl, wantedWidth) {
700
+ const canvas = document.createElement('canvas');
701
+ const ctx = canvas.getContext('2d');
702
+ const aspect = imgEl.width / imgEl.height;
703
+ canvas.width = wantedWidth;
704
+ canvas.height = wantedWidth / aspect;
705
+ if (isValue(ctx))
706
+ ctx.drawImage(imgEl, 0, 0, canvas.width, canvas.height);
707
+ return canvas.toDataURL();
708
+ }
709
+ /**
710
+ * Generate default object
711
+ * @param name as string
712
+ * @param content as string
713
+ * @returns AttachedFileDTO
714
+ */
715
+ generateModel(name, content, ident, imageLink, text) {
716
+ return {
717
+ ImageIdent: ident ? ident : '',
718
+ Filename: name ? name : '',
719
+ ImageAsDataURL: content ? content : '',
720
+ ImageLink: imageLink ? imageLink : '',
721
+ Text: text ? text : ''
722
+ };
723
+ }
724
+ /**
725
+ * Remove image
726
+ */
727
+ removeFromList() {
728
+ this.value = this.generateModel('', '', '', '');
729
+ }
730
+ /**
731
+ * get value
732
+ */
733
+ get value() {
734
+ return this.form.value;
735
+ }
736
+ /**
737
+ * set value
738
+ */
739
+ set value(value) {
740
+ this.form.setValue(value);
741
+ this.onChange(value);
742
+ this.formDataChanged.emit(this.form);
743
+ }
744
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
745
+ ngOnInit() { }
746
+ ngOnDestroy() {
747
+ this.subscriptions.forEach(s => s.unsubscribe());
748
+ }
749
+ registerOnChange(fn) {
750
+ this.onChange = fn;
751
+ }
752
+ registerOnTouched(fn) {
753
+ this.onTouch = fn;
754
+ }
755
+ writeValue(value) {
756
+ if (value) {
757
+ this.value = value;
758
+ }
759
+ if (value === null) {
760
+ this.form.reset();
761
+ }
762
+ }
763
+ // eslint-disable-next-line @typescript-eslint/adjacent-overload-signatures
764
+ validate(_) {
765
+ return this.form.valid ? null : { styles: { valid: false } };
766
+ }
767
+ /**
768
+ * OnClick event listener of input#fileInput to clear his input value
769
+ */
770
+ clearInputValue(ev) {
771
+ const element = ev.target;
772
+ element.value = '';
773
+ }
774
+ }
775
+ FileInputComponent.decorators = [
776
+ { type: Component, args: [{
777
+ selector: 'kms-file-input',
778
+ template: "<form [formGroup]=\"form\" (change)=\"newImageLoading=true\" class=\"fileInput\"> \n\n <div *ngIf=\"form.value.Filename && previewImage\">\n <div *ngIf=\"newImageLoading\">\n {{ 'file-input.loading' | translate }}\n </div>\n <div *ngIf=\"!newImageLoading\">\n <div class=\"\">\n <div class=\"\">\n <img *ngIf=\"form.value.ImageLink && form.value.ImageLink !== '' && !(form.value.ImageAsDataURL && form.value.ImageAsDataURL !== '')\" [src]=\"form.value.ImageAsDataURL\" [src]=\"form.value.ImageLink\" style=\"height: 40px; width: fit-content;\" />\n <img *ngIf=\"form.value.ImageAsDataURL && form.value.ImageAsDataURL !== ''\" [src]=\"form.value.ImageAsDataURL\" style=\"height: 40px; width: fit-content;\" />\n </div>\n <div class=\"\">{{form.value.Filename}}</div>\n <div class=\"\">\n <div (click)=\"removeFromList()\" *ngIf=\"allowRemove\">\n <kms-icon icon=\"trash\" [iconSize]=\"IconSize.TINY\" iconClass=\"color-black\"></kms-icon> \n {{ 'file-input.remove' }}\n </div>\n </div>\n </div>\n </div>\n </div>\n <div *ngIf=\"!previewImage\">\n <div class=\"\">{{form.value.Filename}}</div>\n </div>\n\n <button (click)=\"selectImageOverlay()\" class=\"button-primary-font-color\" mat-stroked-button>\n <span>{{ label }}</span>\n </button>\n <input\n type=\"file\"\n [accept]=\"acceptedFileMimetypes\"\n style=\"display: none\"\n #fileInput\n (click)=\"clearInputValue($event)\"\n (change)=\"selectImage($event)\"\n />\n\n <input type=\"hidden\" [formControl]=\"form.controls['ImageIdent']\" />\n <input type=\"hidden\" [formControl]=\"form.controls['ImageLink']\" />\n <input type=\"hidden\" [formControl]=\"form.controls['Filename']\" />\n <input type=\"hidden\" [formControl]=\"form.controls['ImageAsDataURL']\" />\n <input type=\"hidden\" [formControl]=\"form.controls['Text']\" />\n\n</form>",
779
+ providers: [
780
+ {
781
+ provide: NG_VALUE_ACCESSOR,
782
+ useExisting: forwardRef(() => FileInputComponent),
783
+ multi: true,
784
+ },
785
+ {
786
+ provide: NG_VALIDATORS,
787
+ useExisting: forwardRef(() => FileInputComponent),
788
+ multi: true,
789
+ },
790
+ ],
791
+ styles: [""]
792
+ },] }
793
+ ];
794
+ FileInputComponent.ctorParameters = () => [
795
+ { type: FormBuilder },
796
+ { type: ApplicationRef },
797
+ { type: ChangeDetectorRef },
798
+ { type: Renderer2 }
799
+ ];
800
+ FileInputComponent.propDecorators = {
801
+ fileInput: [{ type: ViewChild, args: ['fileInput',] }],
802
+ label: [{ type: Input }],
803
+ previewImage: [{ type: Input }],
804
+ allowRemove: [{ type: Input }],
805
+ previewImageText: [{ type: Input }],
806
+ maxSizeBytes: [{ type: Input }],
807
+ resizePixels: [{ type: Input }],
808
+ acceptedFileMimetypes: [{ type: Input }],
809
+ formDataChanged: [{ type: Output }]
810
+ };
811
+
812
+ class LoaderComponent {
813
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
814
+ constructor() {
815
+ this.loading = false;
816
+ }
817
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
818
+ ngOnInit() { }
819
+ }
820
+ LoaderComponent.decorators = [
821
+ { type: Component, args: [{
822
+ selector: 'kms-loader',
823
+ template: "<div class=\"loading-spinner-shade\" *ngIf=\"loading\">\n <mat-spinner class=\"spinnerMargin\" color=\"accent\" diameter=\"44\"></mat-spinner>\n</div>\n",
824
+ styles: [""]
825
+ },] }
826
+ ];
827
+ LoaderComponent.ctorParameters = () => [];
828
+ LoaderComponent.propDecorators = {
829
+ loading: [{ type: Input }]
830
+ };
831
+
832
+ /*!
833
+ * @copyright FLYACTS GmbH 2019
834
+ */
835
+ class FlyoutComponent {
836
+ constructor() {
837
+ this.icon = 'filter';
838
+ this.isDropdownOpened = false;
839
+ this.targetHeight = '0';
840
+ this.animationTime = 5000;
841
+ this.headerCssClass = '';
842
+ this.bodyCssClass = '';
843
+ this.headerTitle = '';
844
+ this.headerText = '';
845
+ this.hasButtonForMore = false;
846
+ this.moreText = '';
847
+ this.lessText = '';
848
+ }
849
+ /**
850
+ * Open/close dropdown if click on header.
851
+ * Except, if mode is set to hasButtonForMore. When there is a extra button to open/close
852
+ */
853
+ toggleDropdownHeader() {
854
+ if (!this.hasButtonForMore) {
855
+ this.toggleDropdown();
856
+ }
857
+ }
858
+ /**
859
+ * Open or close the dropdown
860
+ */
861
+ toggleDropdown() {
862
+ this.isDropdownOpened = !this.isDropdownOpened;
863
+ }
864
+ /**
865
+ * Set the height of the dropdown list items dynamic - needed for the animation
866
+ */
867
+ setDropdownListHeight(contentHeight) {
868
+ this.targetHeight = `${contentHeight}px`;
869
+ }
870
+ }
871
+ FlyoutComponent.decorators = [
872
+ { type: Component, args: [{
873
+ selector: 'kms-flyout',
874
+ template: "<div class=\"flyout\"\n [ngClass]=\"{'is-active': isDropdownOpened}\"\n>\n <div class=\"flyout-header\" (click)=\"toggleDropdownHeader()\" [ngClass]=\"headerCssClass\">\n <span [innerHtml]=\"headerTitle | kmsSafeHtml\"></span>\n <span [innerHtml]=\"headerText | kmsSafeHtml\"></span>\n\n <ng-content select=\"[header]\"></ng-content>\n\n <div *ngIf=\"hasButtonForMore\" (click)=\"toggleDropdown()\" class=\"flyout-header-more\">\n <span *ngIf=\"!isDropdownOpened\">\n {{ moreText }}\n </span>\n <span *ngIf=\"isDropdownOpened\">\n {{ lessText }}\n </span>\n <kms-icon [icon]=\"'chevron-down'\"\n [iconClass]=\"{'size-16': true, 'is-rotating180': isDropdownOpened}\" >\n </kms-icon>\n </div>\n </div>\n <div \n class=\"flyout-body\"\n [ngClass]=\"bodyCssClass\"\n tabindex=\"0\"\n [@dropdownAnimation]=\"{value: isDropdownOpened, params: {targetHeight: targetHeight, animationTime: '500'}}\"\n getMaxHeight=\"inner\"\n (sumOfHeight)=\"setDropdownListHeight($event)\"\n #flyoutHeader>\n <div class=\"inner\" #content>\n <ng-content ></ng-content>\n </div>\n </div>\n\n</div>\n",
875
+ animations: [
876
+ trigger('dropdownAnimation', [
877
+ state('true', style({
878
+ height: '{{targetHeight}}',
879
+ transition: 'height {{animationTime}}ms ease-in-out',
880
+ }), {
881
+ params: {
882
+ targetHeight: '300px',
883
+ animationTime: 3000,
884
+ },
885
+ }),
886
+ state('false', style({
887
+ height: 0,
888
+ transition: 'height {{animationTime}}ms ease-in-out',
889
+ }), {
890
+ params: {
891
+ targetHeight: '300px',
892
+ opacity: 0,
893
+ animationTime: 3000,
894
+ },
895
+ }),
896
+ ]),
897
+ ],
898
+ styles: [".flyout{position:relative;display:block;padding:20px 45px}.flyout-header-more{font:normal normal normal 16px/25px var(--fontName-text03);letter-spacing:.26px;color:var(--primaryColor);cursor:pointer}.flyout-header-more kms-icon .icon,.flyout-header-more kms-icon .icon svg{width:16px!important;height:20px!important}.flyout-header-more kms-icon .icon svg use{fill:var(--primaryColor)}.flyout-body{padding:0;margin:0;overflow:hidden;outline:none}"]
899
+ },] }
900
+ ];
901
+ FlyoutComponent.propDecorators = {
902
+ icon: [{ type: Input }],
903
+ headerCssClass: [{ type: Input }],
904
+ bodyCssClass: [{ type: Input }],
905
+ headerTitle: [{ type: Input }],
906
+ headerText: [{ type: Input }],
907
+ hasButtonForMore: [{ type: Input }],
908
+ moreText: [{ type: Input }],
909
+ lessText: [{ type: Input }],
910
+ content: [{ type: ViewChild, args: ['content',] }],
911
+ flyoutHeader: [{ type: ViewChild, args: ['flyoutHeader',] }]
912
+ };
913
+
914
+ /**
915
+ * @copyright KMS GmbH
916
+ */
917
+ class IntegerCurrency {
918
+ constructor(cp) {
919
+ this.cp = cp;
920
+ }
921
+ transform(value, currencyCode, display, digitsInfo) {
922
+ const currencyPipeValue = this.cp.transform(value, currencyCode, display, digitsInfo);
923
+ if (currencyPipeValue) {
924
+ const convertedValue = currencyPipeValue.split(',')[0] + ' ' + currencyPipeValue.slice(-1);
925
+ return convertedValue;
926
+ }
927
+ else {
928
+ throw new Error("No value provided");
929
+ }
930
+ }
931
+ }
932
+ IntegerCurrency.decorators = [
933
+ { type: Pipe, args: [{
934
+ name: 'kmsIntegerCurrency',
935
+ },] }
936
+ ];
937
+ IntegerCurrency.ctorParameters = () => [
938
+ { type: CurrencyPipe }
939
+ ];
940
+
941
+ /*!
942
+ * @copyright FLYACTS GmbH 2019
943
+ */
944
+ class DecodeUriPipe {
945
+ transform(value, _args) {
946
+ return decodeURI(value);
947
+ }
948
+ }
949
+ DecodeUriPipe.decorators = [
950
+ { type: Pipe, args: [{
951
+ name: 'kmsDecodeUri',
952
+ },] }
953
+ ];
954
+
955
+ /*!
956
+ * @copyright FLYACTS GmbH 2019
957
+ */
958
+ class EncodeUriPipe {
959
+ transform(value, _args) {
960
+ return encodeURI(value);
961
+ }
962
+ }
963
+ EncodeUriPipe.decorators = [
964
+ { type: Pipe, args: [{
965
+ name: 'kmsEncodeUri',
966
+ },] }
967
+ ];
968
+
969
+ /*!
970
+ * @copyright FLYACTS GmbH 2019
971
+ */
972
+ class SafeHtmlPipe {
973
+ constructor(sanitizer) {
974
+ this.sanitizer = sanitizer;
975
+ }
976
+ transform(html) {
977
+ return this.sanitizer.bypassSecurityTrustHtml(html);
978
+ }
979
+ }
980
+ SafeHtmlPipe.decorators = [
981
+ { type: Pipe, args: [{
982
+ name: 'kmsSafeHtml',
983
+ },] }
984
+ ];
985
+ SafeHtmlPipe.ctorParameters = () => [
986
+ { type: DomSanitizer }
987
+ ];
988
+
989
+ /**
990
+ * @copyright KMS GmbH
991
+ */
992
+ class SafeStylePipe {
993
+ constructor(sanitizer) {
994
+ this.sanitizer = sanitizer;
995
+ }
996
+ transform(style) {
997
+ return this.sanitizer.bypassSecurityTrustStyle(style);
998
+ }
999
+ }
1000
+ SafeStylePipe.decorators = [
1001
+ { type: Pipe, args: [{
1002
+ name: 'kmsSafeStyle',
1003
+ },] }
1004
+ ];
1005
+ SafeStylePipe.ctorParameters = () => [
1006
+ { type: DomSanitizer }
1007
+ ];
1008
+
1009
+ /**
1010
+ * @copyright KMS GmbH
1011
+ */
1012
+ class SafeUrlPipe {
1013
+ constructor(sanitizer) {
1014
+ this.sanitizer = sanitizer;
1015
+ }
1016
+ transform(style) {
1017
+ return this.sanitizer.bypassSecurityTrustUrl(style);
1018
+ }
1019
+ }
1020
+ SafeUrlPipe.decorators = [
1021
+ { type: Pipe, args: [{
1022
+ name: 'kmsSafeSUrl',
1023
+ },] }
1024
+ ];
1025
+ SafeUrlPipe.ctorParameters = () => [
1026
+ { type: DomSanitizer }
1027
+ ];
1028
+
1029
+ class TypeofPipe {
1030
+ transform(value) {
1031
+ return typeof value;
1032
+ }
1033
+ }
1034
+ TypeofPipe.decorators = [
1035
+ { type: Pipe, args: [{
1036
+ name: 'kmsTypeOf',
1037
+ },] }
1038
+ ];
1039
+
1040
+ /**
1041
+ * @copyright KMS GmbH
1042
+ */
1043
+ class TrimPipe {
1044
+ transform(value) {
1045
+ if (!value) {
1046
+ return '';
1047
+ }
1048
+ return value.trim();
1049
+ }
1050
+ }
1051
+ TrimPipe.decorators = [
1052
+ { type: Pipe, args: [{ name: 'kmsTrim' },] }
1053
+ ];
1054
+
1055
+ /**
1056
+ * @copyright KMS GmbH
1057
+ */
1058
+ class ToNumberPipe {
1059
+ transform(items) {
1060
+ if (!items) {
1061
+ return 0;
1062
+ }
1063
+ return parseInt(items, 10);
1064
+ }
1065
+ }
1066
+ ToNumberPipe.decorators = [
1067
+ { type: Pipe, args: [{
1068
+ name: 'kmsToNumber',
1069
+ pure: false
1070
+ },] }
1071
+ ];
1072
+
1073
+ /**
1074
+ * @copyright KMS GmbH
1075
+ */
1076
+ class CustomPipesModule {
1077
+ }
1078
+ CustomPipesModule.decorators = [
1079
+ { type: NgModule, args: [{
1080
+ declarations: [
1081
+ IntegerCurrency,
1082
+ SafeHtmlPipe,
1083
+ SafeStylePipe,
1084
+ SafeUrlPipe,
1085
+ EncodeUriPipe,
1086
+ DecodeUriPipe,
1087
+ TypeofPipe,
1088
+ TrimPipe,
1089
+ ToNumberPipe,
1090
+ ],
1091
+ imports: [CommonModule],
1092
+ exports: [
1093
+ IntegerCurrency,
1094
+ SafeHtmlPipe,
1095
+ SafeStylePipe,
1096
+ SafeUrlPipe,
1097
+ EncodeUriPipe,
1098
+ DecodeUriPipe,
1099
+ TypeofPipe,
1100
+ TrimPipe,
1101
+ ToNumberPipe,
1102
+ ],
1103
+ providers: [CurrencyPipe],
1104
+ },] }
1105
+ ];
1106
+
1107
+ /*!
1108
+ * @copyright FLYACTS GmbH 2019
1109
+ */
1110
+ var IconSize$1;
1111
+ (function (IconSize) {
1112
+ IconSize["FULLSIZE"] = "size-full";
1113
+ IconSize["TINY"] = "size-16";
1114
+ IconSize["SMALLER"] = "size-20";
1115
+ IconSize["SMALL"] = "size-32";
1116
+ IconSize["MEDIUM"] = "size-64";
1117
+ IconSize["LARGE"] = "size-128";
1118
+ IconSize["XL"] = "size-256";
1119
+ IconSize["XXL"] = "size-512";
1120
+ IconSize["XXXL"] = "size-1024";
1121
+ IconSize["NONE"] = "NONE";
1122
+ })(IconSize$1 || (IconSize$1 = {}));
1123
+
1124
+ /**
1125
+ * @copyright KMS GmbH
1126
+ */
1127
+ class IconComponent {
1128
+ constructor(sanitizer) {
1129
+ this.sanitizer = sanitizer;
1130
+ /**
1131
+ * Optional: Different size via CSS inline style.
1132
+ */
1133
+ this.iconSize = IconSize$1.FULLSIZE;
1134
+ /**
1135
+ * Dont use icon sprite
1136
+ */
1137
+ this.dontUseSprite = false;
1138
+ this.IconSize = IconSize$1;
1139
+ this.Version = VERSION.full;
1140
+ this.timestamp = 0;
1141
+ this.iconToShow = this.icon;
1142
+ }
1143
+ ngOnInit() {
1144
+ this.iconToShow = this.icon;
1145
+ const d = new Date();
1146
+ const n = d.getTime();
1147
+ this.timestamp = n;
1148
+ }
1149
+ }
1150
+ IconComponent.decorators = [
1151
+ { type: Component, args: [{
1152
+ selector: 'kms-icon',
1153
+ template: "<ng-container *ngIf=\"icon !== 'none' && dontUseSprite === false\">\n <span class=\"icon {{ iconSize }}\" [ngClass]=\"iconClass\" [ngStyle]=\"iconStyle\">\n <svg>\n <use\n [attr.xlink:href]=\"\n 'assets/sprite.svg?Version=' + Version + '#' + iconToShow\n \"\n ></use>\n </svg>\n </span>\n</ng-container>\n<ng-container *ngIf=\"icon !== 'none' && dontUseSprite === true\">\n <object\n [data]=\"\n sanitizer.bypassSecurityTrustResourceUrl('assets/icons/' + icon + '')\n \"\n type=\"image/svg+xml\"\n class=\"icon {{ iconSize }}\"\n [ngClass]=\"iconClass\"\n [ngStyle]=\"iconStyle\"\n ></object>\n</ng-container>\n",
1154
+ styles: [""]
1155
+ },] }
1156
+ ];
1157
+ IconComponent.ctorParameters = () => [
1158
+ { type: DomSanitizer }
1159
+ ];
1160
+ IconComponent.propDecorators = {
1161
+ icon: [{ type: Input }],
1162
+ iconClass: [{ type: Input }],
1163
+ iconStyle: [{ type: Input }],
1164
+ iconSize: [{ type: Input }],
1165
+ dontUseSprite: [{ type: Input }]
1166
+ };
1167
+
1168
+ class EnumRadiogroupComponent extends FormControlParentComponent {
1169
+ constructor(formBuilder, renderer) {
1170
+ super(formBuilder, renderer);
1171
+ this.formBuilder = formBuilder;
1172
+ this.renderer = renderer;
1173
+ this.translationPrefix = '';
1174
+ }
1175
+ ngOnInit() {
1176
+ this.optionValues = Object.keys(this.optionsEnum).filter(x => !(parseInt(x) >= 0));
1177
+ this.form = this.formBuilder.group({
1178
+ enumData: [],
1179
+ });
1180
+ this.formInitialized = true;
1181
+ this.form.valueChanges.subscribe((value) => {
1182
+ this.internalValue = value.enumData;
1183
+ this.onChange(value.enumData);
1184
+ });
1185
+ super.ngOnInit();
1186
+ }
1187
+ }
1188
+ EnumRadiogroupComponent.decorators = [
1189
+ { type: Component, args: [{
1190
+ selector: 'kms-enum-radiogroup',
1191
+ template: "<form [formGroup]=\"form\">\n <div>{{ header }}</div>\n <mat-radio-group [formControl]=\"form.controls['enumData']\" [disabled]=\"disabled\" #child>\n <mat-radio-button [value]=\"choice\" [checked]=\"value === choice\" *ngFor=\"let choice of optionValues\">{{ translationPrefix + '.' + choice | translate }}</mat-radio-button>\n </mat-radio-group>\n</form>",
1192
+ providers: [
1193
+ {
1194
+ provide: NG_VALUE_ACCESSOR,
1195
+ useExisting: forwardRef(() => EnumRadiogroupComponent),
1196
+ multi: true,
1197
+ },
1198
+ ]
1199
+ },] }
1200
+ ];
1201
+ EnumRadiogroupComponent.ctorParameters = () => [
1202
+ { type: FormBuilder },
1203
+ { type: Renderer2 }
1204
+ ];
1205
+ EnumRadiogroupComponent.propDecorators = {
1206
+ header: [{ type: Input }],
1207
+ optionsEnum: [{ type: Input }],
1208
+ translationPrefix: [{ type: Input }]
1209
+ };
1210
+
1211
+ /*!
1212
+ * @copyright FLYACTS GmbH 2019
1213
+ */
1214
+ /**
1215
+ * A generic dialog component
1216
+ */
1217
+ class KMSAccordionItemComponent {
1218
+ constructor(sanitizer) {
1219
+ this.sanitizer = sanitizer;
1220
+ this.itemTitle = '';
1221
+ this.showAsCard = false;
1222
+ this.isSmall = false;
1223
+ this.panelOpenState = false;
1224
+ }
1225
+ ngOnInit() {
1226
+ this.itemTitleTrustHtml = this.sanitizer.bypassSecurityTrustHtml(this.itemTitle);
1227
+ }
1228
+ }
1229
+ KMSAccordionItemComponent.decorators = [
1230
+ { type: Component, args: [{
1231
+ selector: 'kms-accordion-item',
1232
+ template: "<mat-expansion-panel\n class=\"accordion-item\" \n [ngClass]=\"{showAsCard: showAsCard, showFlat: !showAsCard, isSmall: isSmall}\"\n (opened)=\"panelOpenState = true\" \n (closed)=\"panelOpenState = false\"\n hideToggle=\"true\">\n <mat-expansion-panel-header class=\"accordion-item-header\">\n <mat-panel-title class=\"mat-subheading-2 accordion-item-title\">\n <div [innerHtml]=\"itemTitleTrustHtml\"></div>\n <ng-content select=\"[itemTitleElement]\"></ng-content> \n </mat-panel-title>\n <div class=\"accordion-item-header-icon-wrapper\">\n <kms-icon *ngIf=\"!panelOpenState\" icon=\"ic_plus\" iconClass=\"color-red\" class=\"accordion-item-header-icon-wrapper-desktop\"></kms-icon>\n <kms-icon *ngIf=\"panelOpenState\" icon=\"ic_minus\" iconClass=\"color-red\" class=\"accordion-item-header-icon-wrapper-desktop\"></kms-icon>\n\n <kms-icon *ngIf=\"!panelOpenState\" icon=\"chevron-down\" iconClass=\"color-red\" class=\"accordion-item-header-icon-wrapper-mobile\"></kms-icon>\n <kms-icon *ngIf=\"panelOpenState\" icon=\"chevron-top\" iconClass=\"color-red\" class=\"accordion-item-header-icon-wrapper-mobile\"></kms-icon>\n </div>\n </mat-expansion-panel-header>\n <ng-content></ng-content>\n</mat-expansion-panel>",
1233
+ styles: [""]
1234
+ },] }
1235
+ ];
1236
+ KMSAccordionItemComponent.ctorParameters = () => [
1237
+ { type: DomSanitizer }
1238
+ ];
1239
+ KMSAccordionItemComponent.propDecorators = {
1240
+ itemTitle: [{ type: Input }],
1241
+ showAsCard: [{ type: Input }],
1242
+ isSmall: [{ type: Input }]
1243
+ };
1244
+
1245
+ /**
1246
+ * @copyright KMS GmbH
1247
+ */
1248
+ /**
1249
+ * Service to get viewport
1250
+ */
1251
+ class ViewportService {
1252
+ constructor(platformId) {
1253
+ this.platformId = platformId;
1254
+ this.viewports = [
1255
+ {
1256
+ name: 'xs',
1257
+ low: 420,
1258
+ high: 990,
1259
+ },
1260
+ {
1261
+ name: 's',
1262
+ low: 991,
1263
+ high: 1024,
1264
+ },
1265
+ {
1266
+ name: 'm',
1267
+ low: 1025,
1268
+ high: 1200,
1269
+ },
1270
+ {
1271
+ name: 'l',
1272
+ low: 12001,
1273
+ high: 1400,
1274
+ },
1275
+ {
1276
+ name: 'xl',
1277
+ low: 1401,
1278
+ high: 1600,
1279
+ },
1280
+ {
1281
+ name: 'xxl',
1282
+ low: 1601,
1283
+ high: 1920,
1284
+ },
1285
+ {
1286
+ name: 'xxxl',
1287
+ low: 1921,
1288
+ high: 99999,
1289
+ },
1290
+ ];
1291
+ this.viewportChangedSubscriber = new Subject();
1292
+ this.viewportResizedSubscriber = new Subject();
1293
+ if (isPlatformBrowser(this.platformId)) {
1294
+ window.addEventListener('resize', this.documentSizeChanged.bind(this), { passive: true });
1295
+ }
1296
+ }
1297
+ /**
1298
+ * Get window height
1299
+ */
1300
+ getDocumentHeight() {
1301
+ return isPlatformBrowser(this.platformId) ? document.body.clientHeight : 1200;
1302
+ }
1303
+ /**
1304
+ * Get window width
1305
+ */
1306
+ getDocumentWidth() {
1307
+ return isPlatformBrowser(this.platformId) ? document.body.clientWidth : 1200;
1308
+ }
1309
+ /**
1310
+ * Get window height
1311
+ */
1312
+ getWindowHeight() {
1313
+ return isPlatformBrowser(this.platformId) ? window.innerHeight : 1200;
1314
+ }
1315
+ /**
1316
+ * Get window width
1317
+ */
1318
+ getWindowWidth() {
1319
+ return isPlatformBrowser(this.platformId) ? window.innerWidth : 1200;
1320
+ }
1321
+ /**
1322
+ * Returns the current viewport MQ as string
1323
+ * @returns string
1324
+ */
1325
+ getCurrentViewPort() {
1326
+ if (!this.currentViewport) {
1327
+ const currentWidth = isPlatformBrowser(this.platformId) ? document.body.clientWidth : 1200;
1328
+ this.currentViewport = this.convertWidthToMediaQuery(currentWidth);
1329
+ }
1330
+ return this.currentViewport;
1331
+ }
1332
+ /**
1333
+ * Provides mq´s as string
1334
+ */
1335
+ getViewportChangedObserver() {
1336
+ return this.viewportChangedSubscriber.asObservable();
1337
+ }
1338
+ /**
1339
+ * Provides the current window width as number
1340
+ */
1341
+ getViewportResizedObserver() {
1342
+ return this.viewportResizedSubscriber.asObservable();
1343
+ }
1344
+ scrollToElementId(el, alignCenter = false) {
1345
+ if (isPlatformBrowser(this.platformId)) {
1346
+ this.scrollToElement(document.querySelector('#' + el), alignCenter);
1347
+ }
1348
+ }
1349
+ /**
1350
+ * Helper function that scrolls to the given markup element.
1351
+ * @param el - nativeElement from markup
1352
+ * @param alignCenter - defines if the element needs to be centered on window
1353
+ */
1354
+ scrollToElement(el, alignCenter = false) {
1355
+ if (isPlatformBrowser(this.platformId)) {
1356
+ let extraScrollTop = 0;
1357
+ if (alignCenter) {
1358
+ extraScrollTop = (window.innerHeight - el.clientHeight) / 2;
1359
+ }
1360
+ /*
1361
+ const elementPos: DOMRect = el.getBoundingClientRect();
1362
+ const scrollTopPosition = elementPos.x - extraScrollTop;
1363
+ */
1364
+ //let offsetLeft = 0;
1365
+ let offsetTop = 0;
1366
+ let elTemp = el;
1367
+ while (elTemp) {
1368
+ //offsetLeft += elTemp.offsetLeft;
1369
+ offsetTop += elTemp.offsetTop;
1370
+ elTemp = elTemp.parentElement ? elTemp.parentElement : null;
1371
+ }
1372
+ window.scrollTo({ left: 0, top: offsetTop - extraScrollTop, behavior: 'smooth' });
1373
+ }
1374
+ }
1375
+ /**
1376
+ * Scroll to the top position
1377
+ * @param top - top position value
1378
+ */
1379
+ scrollTop(top) {
1380
+ if (isPlatformBrowser(this.platformId)) {
1381
+ window.scrollTo({ left: 0, top: top, behavior: 'smooth' });
1382
+ }
1383
+ }
1384
+ ngOnDestroy() {
1385
+ if (isPlatformBrowser(this.platformId)) {
1386
+ window.removeEventListener('resize', this.documentSizeChanged);
1387
+ }
1388
+ }
1389
+ /**
1390
+ * If viewport changed
1391
+ * @event
1392
+ */
1393
+ documentSizeChanged(event) {
1394
+ const currentWindowWidth = event.target.innerWidth;
1395
+ // inform who´s interested
1396
+ this.viewportResizedSubscriber.next(currentWindowWidth);
1397
+ if (currentWindowWidth > 0) {
1398
+ for (const mqs of this.viewports) {
1399
+ if (currentWindowWidth > mqs.high) {
1400
+ continue;
1401
+ }
1402
+ else if ((currentWindowWidth >= mqs.low || currentWindowWidth <= mqs.high) &&
1403
+ this.currentViewport !== mqs.name) {
1404
+ this.currentViewport = mqs.name;
1405
+ // inform who´s interested
1406
+ this.viewportChangedSubscriber.next(mqs.name);
1407
+ break;
1408
+ }
1409
+ else if (this.currentViewport === mqs.name) {
1410
+ break;
1411
+ }
1412
+ else {
1413
+ console.error('ERROR');
1414
+ }
1415
+ }
1416
+ }
1417
+ }
1418
+ /**
1419
+ * Get the Media Query for the given width
1420
+ * @param width Width to get the according MQ for
1421
+ */
1422
+ convertWidthToMediaQuery(width) {
1423
+ let currentViewport = '';
1424
+ for (const mqs of this.viewports) {
1425
+ if (width <= mqs.high && width >= mqs.low) {
1426
+ currentViewport = mqs.name;
1427
+ break;
1428
+ }
1429
+ }
1430
+ return currentViewport;
1431
+ }
1432
+ isPortrait() {
1433
+ if (isPlatformBrowser(this.platformId))
1434
+ return window.innerHeight > window.innerWidth;
1435
+ else
1436
+ return;
1437
+ }
1438
+ isLandscape() {
1439
+ if (isPlatformBrowser(this.platformId)) {
1440
+ const isLandscape = window.orientation === 90 || window.orientation === -90;
1441
+ return isLandscape;
1442
+ }
1443
+ else {
1444
+ return;
1445
+ }
1446
+ }
1447
+ }
1448
+ ViewportService.decorators = [
1449
+ { type: Injectable }
1450
+ ];
1451
+ ViewportService.ctorParameters = () => [
1452
+ { type: Object, decorators: [{ type: Inject, args: [PLATFORM_ID,] }] }
1453
+ ];
1454
+
1455
+ /*!
1456
+ * @copyright FLYACTS GmbH 2019
1457
+ */
1458
+ /**
1459
+ * MarkerOptions class for Marker
1460
+ */
1461
+ class MarkerOptions {
1462
+ }
1463
+ /**
1464
+ * MarkerLabel class for Marker
1465
+ */
1466
+ class MarkerLabel {
1467
+ }
1468
+ /**
1469
+ * Marker class
1470
+ */
1471
+ class Marker {
1472
+ }
1473
+ /**
1474
+ * Component to show marker on google map for specific address
1475
+ */
1476
+ class MapComponent {
1477
+ //
1478
+ constructor(viewPortService) {
1479
+ this.viewPortService = viewPortService;
1480
+ this.markers = [];
1481
+ this.geoDataFoundForAddress = false;
1482
+ this.widthSet = false;
1483
+ this.width = '100%';
1484
+ this.zoom = 15;
1485
+ this.center = {
1486
+ lat: 52.097449,
1487
+ lng: 12.7436911,
1488
+ };
1489
+ this.options = {
1490
+ mapTypeId: 'roadmap',
1491
+ zoomControl: false,
1492
+ scrollwheel: false,
1493
+ disableDoubleClickZoom: true,
1494
+ maxZoom: 15,
1495
+ minZoom: 8,
1496
+ };
1497
+ }
1498
+ ngOnInit() {
1499
+ this.findLocation(this.data.Street + ' ' + this.data.Zip + ' ' + this.data.City);
1500
+ }
1501
+ /**
1502
+ * Asks google for geocoordinates of a given address string
1503
+ * @input address as string
1504
+ */
1505
+ findLocation(address) {
1506
+ if (!this.geocoder) {
1507
+ this.geocoder = new google.maps.Geocoder();
1508
+ }
1509
+ this.geocoder.geocode({
1510
+ 'address': address,
1511
+ }, (results, status) => {
1512
+ if (status === google.maps.GeocoderStatus.OK) {
1513
+ this.center.lat = results[0].geometry.location.lat();
1514
+ this.center.lng = results[0].geometry.location.lng();
1515
+ this.addMarker();
1516
+ this.geoDataFoundForAddress = true;
1517
+ // react to browser resize
1518
+ this.setMapWidth(this.viewPortService.getDocumentWidth());
1519
+ this.viewportSubscription = this.viewPortService.getViewportResizedObserver().subscribe((val) => {
1520
+ this.setMapWidth(val);
1521
+ }, (error) => {
1522
+ console.error('Get updated ViewPort failed', error);
1523
+ });
1524
+ }
1525
+ else {
1526
+ console.error('Sorry, this search of map address produced no results.');
1527
+ }
1528
+ });
1529
+ }
1530
+ /**
1531
+ * Adds a marker to the map
1532
+ */
1533
+ addMarker() {
1534
+ this.markers.push({
1535
+ position: {
1536
+ lat: this.center.lat,
1537
+ lng: this.center.lng,
1538
+ },
1539
+ label: {
1540
+ color: 'blue',
1541
+ text: this.data.Name1 || '',
1542
+ },
1543
+ title: this.data.Name1 + ' ' + this.data.Street + ' ' + this.data.Zip,
1544
+ options: { animation: google.maps.Animation.DROP },
1545
+ });
1546
+ }
1547
+ /**
1548
+ * sets the width of map accodring to viewport
1549
+ */
1550
+ setMapWidth(val) {
1551
+ if (val < 991) {
1552
+ this.width = (val - 84) + 'px';
1553
+ }
1554
+ else {
1555
+ this.width = '100%';
1556
+ }
1557
+ this.widthSet = true;
1558
+ }
1559
+ /**
1560
+ * Zooms in into map
1561
+ */
1562
+ zoomIn() {
1563
+ if (this.options.maxZoom && this.zoom < this.options.maxZoom) {
1564
+ this.zoom++;
1565
+ }
1566
+ }
1567
+ /**
1568
+ * Zooms out from map
1569
+ */
1570
+ zoomOut() {
1571
+ if (this.options.minZoom && this.zoom > this.options.minZoom) {
1572
+ this.zoom--;
1573
+ }
1574
+ }
1575
+ }
1576
+ MapComponent.decorators = [
1577
+ { type: Component, args: [{
1578
+ selector: 'kms-map',
1579
+ template: "<div *ngIf=\"geoDataFoundForAddress && widthSet\">\n <google-map\n height=\"415px\"\n [width]=\"width\"\n [zoom]=\"zoom\"\n [center]=\"center\"\n [options]=\"options\"\n >\n <map-marker\n *ngFor=\"let marker of markers\"\n [position]=\"marker.position\"\n [label]=\"marker.label\"\n [title]=\"marker.title\"\n [options]=\"marker.options\"\n >\n </map-marker>\n </google-map>\n</div>",
1580
+ styles: [""]
1581
+ },] }
1582
+ ];
1583
+ MapComponent.ctorParameters = () => [
1584
+ { type: ViewportService }
1585
+ ];
1586
+ MapComponent.propDecorators = {
1587
+ data: [{ type: Input }]
1588
+ };
1589
+
1590
+ // TODO change values after cleaned up database
1591
+ var SalutationEnum;
1592
+ (function (SalutationEnum) {
1593
+ SalutationEnum["NOT_SPECIFIED"] = "Keine Anrede";
1594
+ SalutationEnum["MALE"] = "Herr";
1595
+ SalutationEnum["FEMALE"] = "Frau";
1596
+ })(SalutationEnum || (SalutationEnum = {}));
1597
+
1598
+ class SalutationDropdownComponent extends FormControlParentComponent {
1599
+ constructor(formBuilder, renderer) {
1600
+ super(formBuilder, renderer);
1601
+ this.formBuilder = formBuilder;
1602
+ this.renderer = renderer;
1603
+ //For view
1604
+ this.SalutationEnum = SalutationEnum;
1605
+ this.Object = Object;
1606
+ }
1607
+ ngOnInit() {
1608
+ this.form = this.formBuilder.group({
1609
+ salut: [],
1610
+ });
1611
+ this.formInitialized = true;
1612
+ //somehow for dropowns we have to set value manually with timeout for default value
1613
+ setTimeout(() => {
1614
+ this.form.controls['salut'].setValue(this.value ? this.value : '');
1615
+ }, 1000);
1616
+ this.form.valueChanges.subscribe((value) => {
1617
+ this.onChange(value.salut);
1618
+ });
1619
+ super.ngOnInit();
1620
+ }
1621
+ }
1622
+ SalutationDropdownComponent.decorators = [
1623
+ { type: Component, args: [{
1624
+ selector: 'kms-salutation-dropdown',
1625
+ template: "<form [formGroup]=\"form\" class=\"row\">\n <mat-form-field class=\"col\">\n <mat-select disableOptionCentering [formControl]=\"form.controls['salut']\" [placeholder]=\"placeholder\" [value]=\"value\" #child>\n <mat-option [value]=\"SalutationEnum.NOT_SPECIFIED\">{{ 'general.salutation.' + Object.keys(SalutationEnum)[0]?.toLowerCase() | translate }}</mat-option>\n <mat-option [value]=\"SalutationEnum.MALE\">{{ 'general.salutation.' + Object.keys(SalutationEnum)[1]?.toLowerCase() | translate }}</mat-option>\n <mat-option [value]=\"SalutationEnum.FEMALE\">{{ 'general.salutation.' + Object.keys(SalutationEnum)[2]?.toLowerCase() | translate }}</mat-option>\n </mat-select>\n </mat-form-field>\n</form>",
1626
+ providers: [
1627
+ {
1628
+ provide: NG_VALUE_ACCESSOR,
1629
+ useExisting: forwardRef(() => SalutationDropdownComponent),
1630
+ multi: true,
1631
+ },
1632
+ ]
1633
+ },] }
1634
+ ];
1635
+ SalutationDropdownComponent.ctorParameters = () => [
1636
+ { type: FormBuilder },
1637
+ { type: Renderer2 }
1638
+ ];
1639
+ SalutationDropdownComponent.propDecorators = {
1640
+ placeholder: [{ type: Input }]
1641
+ };
1642
+
1643
+ class TooltipComponent {
1644
+ constructor() {
1645
+ this.tooltipTitle = "";
1646
+ }
1647
+ }
1648
+ TooltipComponent.decorators = [
1649
+ { type: Component, args: [{
1650
+ selector: 'kms-tooltip-element',
1651
+ template: "<ng-content></ng-content>",
1652
+ styles: ["[kmsTooltip]{position:relative}"]
1653
+ },] }
1654
+ ];
1655
+ TooltipComponent.propDecorators = {
1656
+ tooltipTitle: [{ type: Input }]
1657
+ };
1658
+
1659
+ /*!
1660
+ * @copyright FLYACTS GmbH 2019
1661
+ */
1662
+
1663
+ /**
1664
+ * Attached File DTO
1665
+ */
1666
+ class AttachedFileDTO {
1667
+ }
1668
+
1669
+ class TooltipIconComponent {
1670
+ constructor() {
1671
+ this.tooltipTitle = "";
1672
+ this.tooltipText = "";
1673
+ this.tooltipLinkText = "";
1674
+ this.tooltipLinkUrl = "";
1675
+ this.placement = "";
1676
+ this.delay = 1000;
1677
+ this.IconSize = IconSize;
1678
+ }
1679
+ }
1680
+ TooltipIconComponent.decorators = [
1681
+ { type: Component, args: [{
1682
+ selector: 'kms-tooltip-icon',
1683
+ template: "<span\n kmsTooltip\n [tooltipTitle]=\"tooltipTitle\"\n [tooltipText]=\"tooltipText\"\n [tooltipPlacement]=\"placement\"\n [tooltipDelay]=\"delay\"\n [tooltipLinkText]=\"tooltipLinkText\"\n [tooltipLinkUrl]=\"tooltipLinkUrl\"\n>\n <kms-icon icon=\"ic_info\" [iconSize]=\"IconSize.SMALLER\" [iconClass]=\"'color-primary'\"></kms-icon>\n</span>\n",
1684
+ styles: [""]
1685
+ },] }
1686
+ ];
1687
+ TooltipIconComponent.propDecorators = {
1688
+ tooltipTitle: [{ type: Input }],
1689
+ tooltipText: [{ type: Input }],
1690
+ tooltipLinkText: [{ type: Input }],
1691
+ tooltipLinkUrl: [{ type: Input }],
1692
+ placement: [{ type: Input }],
1693
+ delay: [{ type: Input }]
1694
+ };
1695
+
1696
+ class SalutationRadiogroupComponent extends FormControlParentComponent {
1697
+ constructor(formBuilder, renderer) {
1698
+ super(formBuilder, renderer);
1699
+ this.formBuilder = formBuilder;
1700
+ this.renderer = renderer;
1701
+ //For view
1702
+ this.SalutationEnum = SalutationEnum;
1703
+ this.Object = Object;
1704
+ }
1705
+ ngOnInit() {
1706
+ this.form = this.formBuilder.group({
1707
+ salut: [isValue(this.value) ? this.value : '', null],
1708
+ });
1709
+ this.formInitialized = true;
1710
+ this.form.valueChanges.subscribe((value) => {
1711
+ this.internalValue = value.salut;
1712
+ this.onChange(value.salut);
1713
+ });
1714
+ super.ngOnInit();
1715
+ }
1716
+ }
1717
+ SalutationRadiogroupComponent.decorators = [
1718
+ { type: Component, args: [{
1719
+ selector: 'kms-salutation-radiogroup',
1720
+ template: "<form [formGroup]=\"form\" >\n <mat-radio-group [formControl]=\"form.controls['salut']\" [disabled]=\"disabled\" #radioGroup>\n <mat-radio-button color=\"primary\" [value]=\"SalutationEnum.NOT_SPECIFIED\" [checked]=\"value === SalutationEnum.NOT_SPECIFIED\">\n {{ 'general.salutation.' + Object.keys(SalutationEnum)[0]?.toLowerCase() | translate }}\n </mat-radio-button>\n <mat-radio-button color=\"primary\" [value]=\"SalutationEnum.MALE\" [checked]=\"value === SalutationEnum.MALE\">\n {{ 'general.salutation.' + Object.keys(SalutationEnum)[1]?.toLowerCase() | translate }}\n </mat-radio-button>\n <mat-radio-button color=\"primary\" [value]=\"SalutationEnum.FEMALE\" [checked]=\"value === SalutationEnum.FEMALE\">\n {{ 'general.salutation.' + Object.keys(SalutationEnum)[2]?.toLowerCase() | translate }}\n </mat-radio-button>\n </mat-radio-group>\n</form>",
1721
+ providers: [
1722
+ {
1723
+ provide: NG_VALUE_ACCESSOR,
1724
+ useExisting: forwardRef(() => SalutationRadiogroupComponent),
1725
+ multi: true,
1726
+ },
1727
+ ]
1728
+ },] }
1729
+ ];
1730
+ SalutationRadiogroupComponent.ctorParameters = () => [
1731
+ { type: FormBuilder },
1732
+ { type: Renderer2 }
1733
+ ];
1734
+
1735
+ /**
1736
+ * @copyright KMS GmbH
1737
+ */
1738
+ class BackToTopComponent {
1739
+ constructor(platformId) {
1740
+ this.platformId = platformId;
1741
+ }
1742
+ onWindowScroll() {
1743
+ if (isPlatformBrowser(this.platformId)) {
1744
+ if (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop > 100) {
1745
+ this.windowScrolled = true;
1746
+ }
1747
+ else if ((this.windowScrolled && window.pageYOffset) ||
1748
+ document.documentElement.scrollTop ||
1749
+ document.body.scrollTop < 10) {
1750
+ this.windowScrolled = false;
1751
+ }
1752
+ }
1753
+ }
1754
+ scrollToTop() {
1755
+ if (isPlatformBrowser(this.platformId)) {
1756
+ (function smoothscroll() {
1757
+ const currentScroll = document.documentElement.scrollTop || document.body.scrollTop;
1758
+ if (currentScroll > 0) {
1759
+ window.requestAnimationFrame(smoothscroll);
1760
+ window.scrollTo(0, currentScroll - currentScroll / 8);
1761
+ }
1762
+ })();
1763
+ }
1764
+ }
1765
+ }
1766
+ BackToTopComponent.decorators = [
1767
+ { type: Component, args: [{
1768
+ selector: 'kms-back-to-top',
1769
+ template: "<div class=\"scrollToTop\"\n [ngClass]=\"{'show': windowScrolled}\"\n (click)=\"scrollToTop()\">\n <div class=\"scrollToTop-inner\">\n <kms-icon icon=\"floating_button_clear\" iconClass=\"color-white\"></kms-icon>\n </div>\n</div>"
1770
+ },] }
1771
+ ];
1772
+ BackToTopComponent.ctorParameters = () => [
1773
+ { type: Object, decorators: [{ type: Inject, args: [PLATFORM_ID,] }] }
1774
+ ];
1775
+ BackToTopComponent.propDecorators = {
1776
+ onWindowScroll: [{ type: HostListener, args: ['window:scroll', [],] }]
1777
+ };
1778
+
1779
+ var ButtonResponseType;
1780
+ (function (ButtonResponseType) {
1781
+ ButtonResponseType["primary"] = "primary";
1782
+ ButtonResponseType["secondary"] = "secondary";
1783
+ })(ButtonResponseType || (ButtonResponseType = {}));
1784
+
1785
+ /**
1786
+ * @copyright KMS GmbH
1787
+ */
1788
+ /**
1789
+ * A generic dialog component
1790
+ */
1791
+ class GenericDialogComponent {
1792
+ constructor(dialogRef, zone, data) {
1793
+ this.dialogRef = dialogRef;
1794
+ this.zone = zone;
1795
+ this.data = data;
1796
+ this.ButtonResponseType = ButtonResponseType;
1797
+ if (isValue(data.buttons)) {
1798
+ this.buttons = data.buttons;
1799
+ }
1800
+ else {
1801
+ this.buttons = { primary: 'Yes', secondary: 'No' };
1802
+ }
1803
+ }
1804
+ /**
1805
+ * Action called when clicked
1806
+ * @param clickedButton Whether the primary or secondary button was clicked
1807
+ */
1808
+ onClickAction(clickedButton) {
1809
+ this.zone.run(() => {
1810
+ this.dialogRef.close(clickedButton);
1811
+ this.dialogRef.afterClosed().subscribe(() => {
1812
+ const buttonList = document.querySelectorAll('.mat-flat-button, .mat-button');
1813
+ let i = 0;
1814
+ for (i; i < buttonList.length; i++) {
1815
+ buttonList[i].classList.remove('cdk-focused');
1816
+ buttonList[i].classList.remove('cdk-program-focused');
1817
+ }
1818
+ });
1819
+ });
1820
+ }
1821
+ }
1822
+ GenericDialogComponent.decorators = [
1823
+ { type: Component, args: [{
1824
+ selector: 'kms-generic-dialog',
1825
+ template: "<div mat-dialog-title class=\"mat-dialog-title\">\n <h3>{{ data.title }}</h3>\n</div>\n<div mat-dialog-content class=\"mat-dialog-content\">\n {{ data.message }}\n</div>\n<div mat-dialog-actions class=\"custom-dialog-actions\">\n <button\n mat-flat-button\n class=\"test_secondary_button\"\n color=\"accent\"\n (click)=\"onClickAction(ButtonResponseType.secondary)\"\n >\n {{ buttons.secondary }}\n </button>\n <button\n mat-flat-button\n class=\"test_primary_button\"\n color=\"primary\"\n (click)=\"onClickAction(ButtonResponseType.primary)\"\n >\n {{ buttons.primary }}\n </button>\n</div>\n",
1826
+ styles: [""]
1827
+ },] }
1828
+ ];
1829
+ GenericDialogComponent.ctorParameters = () => [
1830
+ { type: MatDialogRef },
1831
+ { type: NgZone },
1832
+ { type: undefined, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA,] }] }
1833
+ ];
1834
+
1835
+ class ButtonWithConfirmDialogComponent {
1836
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
1837
+ constructor(dialog) {
1838
+ this.dialog = dialog;
1839
+ // Outputs when dialogue was closed. Returns true, if yes was clicked, false otherwise
1840
+ this.onConfirmClosed = new EventEmitter();
1841
+ this.subs = new SubSink();
1842
+ }
1843
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
1844
+ ngOnInit() { }
1845
+ start() {
1846
+ const data = {
1847
+ title: this.confirmTitle,
1848
+ buttons: {
1849
+ primary: this.confirmTextYes,
1850
+ secondary: this.confirmTextNo,
1851
+ }
1852
+ };
1853
+ const dialogRef = this.dialog.open(GenericDialogComponent, {
1854
+ data: data,
1855
+ });
1856
+ this.subs.sink = dialogRef.afterClosed().subscribe(result => {
1857
+ if (result === ButtonResponseType.primary) {
1858
+ this.onConfirmClosed.emit(true);
1859
+ }
1860
+ else {
1861
+ this.onConfirmClosed.emit(false);
1862
+ }
1863
+ dialogRef.close();
1864
+ });
1865
+ }
1866
+ }
1867
+ ButtonWithConfirmDialogComponent.decorators = [
1868
+ { type: Component, args: [{
1869
+ selector: 'kms-button-with-confirm-dialog',
1870
+ template: "<button\n type=\"button\"\n (click)=\"start()\"\n mat-stroked-button\n [disabled]=\"disabled\"\n>\n {{ buttonText }}\n</button>\n",
1871
+ styles: [""]
1872
+ },] }
1873
+ ];
1874
+ ButtonWithConfirmDialogComponent.ctorParameters = () => [
1875
+ { type: MatDialog }
1876
+ ];
1877
+ ButtonWithConfirmDialogComponent.propDecorators = {
1878
+ disabled: [{ type: Input }],
1879
+ buttonText: [{ type: Input }],
1880
+ confirmTitle: [{ type: Input }],
1881
+ confirmTextYes: [{ type: Input }],
1882
+ confirmTextNo: [{ type: Input }],
1883
+ onConfirmClosed: [{ type: Output }]
1884
+ };
1885
+
1886
+ class KmsUiPresentationalModule {
1887
+ }
1888
+ KmsUiPresentationalModule.decorators = [
1889
+ { type: NgModule, args: [{
1890
+ declarations: [
1891
+ KmsUiPresentationalComponent,
1892
+ ActionsParentComponent,
1893
+ CheckboxComponent,
1894
+ ColorInputComponent,
1895
+ RadioButtonComponent,
1896
+ TimeInputComponent,
1897
+ YesNoRadiogroupComponent,
1898
+ FileInputComponent,
1899
+ LoaderComponent,
1900
+ FlyoutComponent,
1901
+ IconComponent,
1902
+ EnumRadiogroupComponent,
1903
+ KMSAccordionItemComponent,
1904
+ EnumRadiogroupComponent,
1905
+ MapComponent,
1906
+ SalutationDropdownComponent,
1907
+ SalutationRadiogroupComponent,
1908
+ TooltipComponent,
1909
+ TooltipIconComponent,
1910
+ BackToTopComponent,
1911
+ GenericDialogComponent,
1912
+ ButtonWithConfirmDialogComponent,
1913
+ ],
1914
+ imports: [
1915
+ CommonModule,
1916
+ MatCheckboxModule,
1917
+ MatButtonModule,
1918
+ MatRadioModule,
1919
+ MatDialogModule,
1920
+ FormsModule,
1921
+ ReactiveFormsModule,
1922
+ CustomPipesModule,
1923
+ GoogleMapsModule,
1924
+ MatExpansionModule,
1925
+ ],
1926
+ exports: [
1927
+ KmsUiPresentationalComponent,
1928
+ ActionsParentComponent,
1929
+ CheckboxComponent,
1930
+ ColorInputComponent,
1931
+ RadioButtonComponent,
1932
+ TimeInputComponent,
1933
+ YesNoRadiogroupComponent,
1934
+ FileInputComponent,
1935
+ LoaderComponent,
1936
+ FlyoutComponent,
1937
+ IconComponent,
1938
+ EnumRadiogroupComponent,
1939
+ KMSAccordionItemComponent,
1940
+ EnumRadiogroupComponent,
1941
+ MapComponent,
1942
+ SalutationDropdownComponent,
1943
+ SalutationRadiogroupComponent,
1944
+ TooltipComponent,
1945
+ TooltipIconComponent,
1946
+ BackToTopComponent,
1947
+ GenericDialogComponent,
1948
+ ButtonWithConfirmDialogComponent
1949
+ ]
1950
+ },] }
1951
+ ];
1952
+
1953
+ /*
1954
+ * Public API Surface of kms-ngx-ui-presentational
1955
+ */
1956
+
1957
+ /**
1958
+ * Generated bundle index. Do not edit.
1959
+ */
1960
+
1961
+ export { GenericDialogComponent, IconSize, KmsUiPresentationalComponent, KmsUiPresentationalModule, KmsUiPresentationalService, SalutationEnum, ActionsParentComponent as ɵa, CheckboxComponent as ɵb, SafeStylePipe as ɵba, SafeUrlPipe as ɵbb, EncodeUriPipe as ɵbc, DecodeUriPipe as ɵbd, TypeofPipe as ɵbe, TrimPipe as ɵbf, ToNumberPipe as ɵbg, ColorInputComponent as ɵc, FormControlParentComponent as ɵd, FormParentComponent as ɵe, RadioButtonComponent as ɵf, TimeInputComponent as ɵg, YesNoRadiogroupComponent as ɵh, FileInputComponent as ɵi, LoaderComponent as ɵj, FlyoutComponent as ɵk, IconComponent as ɵl, EnumRadiogroupComponent as ɵm, KMSAccordionItemComponent as ɵn, MapComponent as ɵo, ViewportService as ɵp, SalutationDropdownComponent as ɵq, SalutationRadiogroupComponent as ɵr, TooltipComponent as ɵs, TooltipIconComponent as ɵt, BackToTopComponent as ɵu, ButtonWithConfirmDialogComponent as ɵw, CustomPipesModule as ɵx, IntegerCurrency as ɵy, SafeHtmlPipe as ɵz };
1962
+ //# sourceMappingURL=kms-ngx-ui-presentational.js.map