@kms-ngx-ui/presentational 16.3.0 → 16.3.2

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 (223) hide show
  1. package/jest.config.js +27 -0
  2. package/ng-package.json +13 -0
  3. package/package.json +3 -17
  4. package/src/lib/directives/directives.module.ts +28 -0
  5. package/src/lib/directives/mousewheel.directive.ts +43 -0
  6. package/src/lib/directives/sum-of-height.directive.ts +73 -0
  7. package/src/lib/directives/swipe.directive.ts +193 -0
  8. package/{lib/directives/swipe.model.d.ts → src/lib/directives/swipe.model.ts} +6 -0
  9. package/src/lib/directives/tooltip.directive.spec.ts.BAK +8 -0
  10. package/src/lib/directives/tooltip.directive.ts +121 -0
  11. package/src/lib/kms-ngx-ui-presentational.component.spec.ts +25 -0
  12. package/src/lib/kms-ngx-ui-presentational.component.ts +20 -0
  13. package/src/lib/kms-ngx-ui-presentational.module.ts +124 -0
  14. package/src/lib/kms-ngx-ui-presentational.service.spec.ts +16 -0
  15. package/src/lib/kms-ngx-ui-presentational.service.ts +9 -0
  16. package/src/lib/models/address.model.ts +16 -0
  17. package/src/lib/models/iconSize.enum.ts +17 -0
  18. package/src/lib/models/image-snippet.model.ts +17 -0
  19. package/src/lib/models/is-value.function.ts +20 -0
  20. package/src/lib/models/salutation.enum.ts +6 -0
  21. package/{lib/models/types/attached-file-dto.model.d.ts → src/lib/models/types/attached-file-dto.model.ts} +1 -1
  22. package/{lib/models/types/nullable.type.d.ts → src/lib/models/types/nullable.type.ts} +1 -0
  23. package/src/lib/parent-components/actions.component.ts +43 -0
  24. package/src/lib/parent-components/form-control.component.ts +77 -0
  25. package/src/lib/parent-components/form.component.ts +79 -0
  26. package/src/lib/pipes/custom-pipes.module.ts +48 -0
  27. package/src/lib/pipes/decode-uri.pipe.ts +15 -0
  28. package/src/lib/pipes/encode-uri.pipe.ts +14 -0
  29. package/src/lib/pipes/integer-currency.pipe.ts +22 -0
  30. package/src/lib/pipes/prettyjson.pipe.ts +104 -0
  31. package/src/lib/pipes/safe-html.pipe.ts +17 -0
  32. package/src/lib/pipes/safe-resource-url.pipe.ts +17 -0
  33. package/src/lib/pipes/safe-style.pipe.ts +17 -0
  34. package/src/lib/pipes/safe-url.pipe.ts +17 -0
  35. package/src/lib/pipes/to-number.pipe.ts +19 -0
  36. package/src/lib/pipes/trim.pipe.ts +16 -0
  37. package/src/lib/pipes/typeof.pipe.ts +10 -0
  38. package/src/lib/services/viewport.service.ts +241 -0
  39. package/src/lib/ui/back-to-top/back-to-top.component.html +7 -0
  40. package/src/lib/ui/back-to-top/back-to-top.component.ts +43 -0
  41. package/src/lib/ui/back-to-top/back-to-top.stories.ts +19 -0
  42. package/src/lib/ui/button-with-confirm-dialog/button-response-types.enum.ts +4 -0
  43. package/src/lib/ui/button-with-confirm-dialog/button-with-confirm-dialog.component.html +8 -0
  44. package/src/lib/ui/button-with-confirm-dialog/button-with-confirm-dialog.component.spec.ts.BAK +25 -0
  45. package/src/lib/ui/button-with-confirm-dialog/button-with-confirm-dialog.component.ts +55 -0
  46. package/src/lib/ui/button-with-confirm-dialog/button-with-confirm-dialog.stories.ts +21 -0
  47. package/{lib/ui/button-with-confirm-dialog/dialog-data.model.d.ts → src/lib/ui/button-with-confirm-dialog/dialog-data.model.ts} +4 -3
  48. package/src/lib/ui/checkbox/checkbox.component.html +15 -0
  49. package/src/lib/ui/checkbox/checkbox.component.stories.ts +19 -0
  50. package/src/lib/ui/checkbox/checkbox.component.ts +75 -0
  51. package/src/lib/ui/color-input/color-input.component.html +11 -0
  52. package/src/lib/ui/color-input/color-input.component.spec.ts +44 -0
  53. package/src/lib/ui/color-input/color-input.component.ts +67 -0
  54. package/src/lib/ui/dropdown-from-data/dropdown-from-data.component.html +23 -0
  55. package/src/lib/ui/dropdown-from-data/dropdown-from-data.component.ts +174 -0
  56. package/src/lib/ui/enum-radiogroup/enum-radiogroup.component.html +6 -0
  57. package/src/lib/ui/enum-radiogroup/enum-radiogroup.component.spec.ts.BAK +25 -0
  58. package/src/lib/ui/enum-radiogroup/enum-radiogroup.component.ts +43 -0
  59. package/src/lib/ui/file-input/file-input.component.html +45 -0
  60. package/src/lib/ui/file-input/file-input.component.spec.ts.BAK +25 -0
  61. package/src/lib/ui/file-input/file-input.component.ts +236 -0
  62. package/src/lib/ui/flyout/flyout.component.html +35 -0
  63. package/src/lib/ui/flyout/flyout.component.spec.ts.BAK +30 -0
  64. package/src/lib/ui/flyout/flyout.component.ts +95 -0
  65. package/src/lib/ui/generic-dialog/generic-dialog.component.html +24 -0
  66. package/src/lib/ui/generic-dialog/generic-dialog.component.spec.ts.BAK +43 -0
  67. package/src/lib/ui/generic-dialog/generic-dialog.component.ts +54 -0
  68. package/src/lib/ui/icon/icon.component.html +22 -0
  69. package/src/lib/ui/icon/icon.component.spec.ts.BAK +31 -0
  70. package/src/lib/ui/icon/icon.component.ts +67 -0
  71. package/src/lib/ui/icon/iconSize.enum.ts +17 -0
  72. package/src/lib/ui/image-slider/image-slider.component.html +54 -0
  73. package/src/lib/ui/image-slider/image-slider.component.ts +205 -0
  74. package/src/lib/ui/kms-accordion-item/kms-accordion-item.component.html +22 -0
  75. package/src/lib/ui/kms-accordion-item/kms-accordion-item.component.spec.ts +61 -0
  76. package/src/lib/ui/kms-accordion-item/kms-accordion-item.component.ts +32 -0
  77. package/src/lib/ui/loader/loader.component.html +3 -0
  78. package/src/lib/ui/loader/loader.component.spec.ts.BAK +26 -0
  79. package/src/lib/ui/loader/loader.component.ts +16 -0
  80. package/src/lib/ui/map/map.component.html +18 -0
  81. package/src/lib/ui/map/map.component.spec.ts.BAK +31 -0
  82. package/src/lib/ui/map/map.component.ts +138 -0
  83. package/src/lib/ui/radiobutton/radiobutton.component.html +42 -0
  84. package/src/lib/ui/radiobutton/radiobutton.component.ts +71 -0
  85. package/src/lib/ui/salutation-dropdown/salutation-dropdown.component.html +9 -0
  86. package/src/lib/ui/salutation-dropdown/salutation-dropdown.component.spec.ts.BAK +26 -0
  87. package/src/lib/ui/salutation-dropdown/salutation-dropdown.component.ts +48 -0
  88. package/src/lib/ui/salutation-radiogroup/salutation-radiogroup.component.html +13 -0
  89. package/src/lib/ui/salutation-radiogroup/salutation-radiogroup.component.spec.ts.BAK +25 -0
  90. package/src/lib/ui/salutation-radiogroup/salutation-radiogroup.component.ts +41 -0
  91. package/src/lib/ui/time-input/time-input.component.html +5 -0
  92. package/src/lib/ui/time-input/time-input.component.spec.ts +28 -0
  93. package/src/lib/ui/time-input/time-input.component.ts +88 -0
  94. package/src/lib/ui/tooltip/tooltip.component.html +1 -0
  95. package/src/lib/ui/tooltip/tooltip.component.spec.ts.BAK +26 -0
  96. package/src/lib/ui/tooltip/tooltip.component.ts +10 -0
  97. package/src/lib/ui/tooltip-icon/tooltip-icon.component.html +11 -0
  98. package/src/lib/ui/tooltip-icon/tooltip-icon.component.spec.ts.BAK +28 -0
  99. package/src/lib/ui/tooltip-icon/tooltip-icon.component.ts +19 -0
  100. package/src/lib/ui/yes-no-radiogroup/yes-no-radiogroup.component.html +7 -0
  101. package/src/lib/ui/yes-no-radiogroup/yes-no-radiogroup.component.scss +17 -0
  102. package/src/lib/ui/yes-no-radiogroup/yes-no-radiogroup.component.spec.ts.BAK +25 -0
  103. package/src/lib/ui/yes-no-radiogroup/yes-no-radiogroup.component.ts +79 -0
  104. package/{public-api.d.ts → src/public-api.ts} +8 -0
  105. package/src/styles/styles.scss +3 -1
  106. package/src/test-setup.ts +2 -0
  107. package/tsconfig.lib.json +26 -0
  108. package/tsconfig.lib.prod.json +10 -0
  109. package/tsconfig.spec.json +17 -0
  110. package/tslint.json +17 -0
  111. package/esm2022/kms-ngx-ui-presentational.mjs +0 -5
  112. package/esm2022/lib/directives/directives.module.mjs +0 -40
  113. package/esm2022/lib/directives/mousewheel.directive.mjs +0 -56
  114. package/esm2022/lib/directives/sum-of-height.directive.mjs +0 -74
  115. package/esm2022/lib/directives/swipe.directive.mjs +0 -183
  116. package/esm2022/lib/directives/swipe.model.mjs +0 -5
  117. package/esm2022/lib/directives/tooltip.directive.mjs +0 -144
  118. package/esm2022/lib/kms-ngx-ui-presentational.component.mjs +0 -22
  119. package/esm2022/lib/kms-ngx-ui-presentational.module.mjs +0 -211
  120. package/esm2022/lib/kms-ngx-ui-presentational.service.mjs +0 -14
  121. package/esm2022/lib/models/address.model.mjs +0 -6
  122. package/esm2022/lib/models/iconSize.enum.mjs +0 -17
  123. package/esm2022/lib/models/image-snippet.model.mjs +0 -18
  124. package/esm2022/lib/models/index.mjs +0 -5
  125. package/esm2022/lib/models/is-value.function.mjs +0 -17
  126. package/esm2022/lib/models/salutation.enum.mjs +0 -8
  127. package/esm2022/lib/models/types/attached-file-dto.model.mjs +0 -6
  128. package/esm2022/lib/models/types/nullable.type.mjs +0 -5
  129. package/esm2022/lib/parent-components/actions.component.mjs +0 -56
  130. package/esm2022/lib/parent-components/form-control.component.mjs +0 -75
  131. package/esm2022/lib/parent-components/form.component.mjs +0 -78
  132. package/esm2022/lib/pipes/custom-pipes.module.mjs +0 -71
  133. package/esm2022/lib/pipes/decode-uri.pipe.mjs +0 -19
  134. package/esm2022/lib/pipes/encode-uri.pipe.mjs +0 -19
  135. package/esm2022/lib/pipes/integer-currency.pipe.mjs +0 -27
  136. package/esm2022/lib/pipes/safe-html.pipe.mjs +0 -23
  137. package/esm2022/lib/pipes/safe-resource-url.pipe.mjs +0 -23
  138. package/esm2022/lib/pipes/safe-style.pipe.mjs +0 -23
  139. package/esm2022/lib/pipes/safe-url.pipe.mjs +0 -23
  140. package/esm2022/lib/pipes/to-number.pipe.mjs +0 -23
  141. package/esm2022/lib/pipes/trim.pipe.mjs +0 -20
  142. package/esm2022/lib/pipes/typeof.pipe.mjs +0 -16
  143. package/esm2022/lib/services/viewport.service.mjs +0 -216
  144. package/esm2022/lib/ui/back-to-top/back-to-top.component.mjs +0 -49
  145. package/esm2022/lib/ui/button-with-confirm-dialog/button-response-types.enum.mjs +0 -6
  146. package/esm2022/lib/ui/button-with-confirm-dialog/button-with-confirm-dialog.component.mjs +0 -58
  147. package/esm2022/lib/ui/button-with-confirm-dialog/dialog-data.model.mjs +0 -2
  148. package/esm2022/lib/ui/checkbox/checkbox.component.mjs +0 -71
  149. package/esm2022/lib/ui/color-input/color-input.component.mjs +0 -76
  150. package/esm2022/lib/ui/dropdown-from-data/dropdown-from-data.component.mjs +0 -157
  151. package/esm2022/lib/ui/enum-radiogroup/enum-radiogroup.component.mjs +0 -53
  152. package/esm2022/lib/ui/file-input/file-input.component.mjs +0 -232
  153. package/esm2022/lib/ui/flyout/flyout.component.mjs +0 -119
  154. package/esm2022/lib/ui/generic-dialog/generic-dialog.component.mjs +0 -55
  155. package/esm2022/lib/ui/icon/icon.component.mjs +0 -48
  156. package/esm2022/lib/ui/icon/iconSize.enum.mjs +0 -17
  157. package/esm2022/lib/ui/image-slider/image-slider.component.mjs +0 -189
  158. package/esm2022/lib/ui/kms-accordion-item/kms-accordion-item.component.mjs +0 -40
  159. package/esm2022/lib/ui/loader/loader.component.mjs +0 -21
  160. package/esm2022/lib/ui/map/map.component.mjs +0 -116
  161. package/esm2022/lib/ui/radiobutton/radiobutton.component.mjs +0 -73
  162. package/esm2022/lib/ui/salutation-dropdown/salutation-dropdown.component.mjs +0 -55
  163. package/esm2022/lib/ui/salutation-radiogroup/salutation-radiogroup.component.mjs +0 -49
  164. package/esm2022/lib/ui/time-input/time-input.component.mjs +0 -83
  165. package/esm2022/lib/ui/tooltip/tooltip.component.mjs +0 -16
  166. package/esm2022/lib/ui/tooltip-icon/tooltip-icon.component.mjs +0 -35
  167. package/esm2022/lib/ui/yes-no-radiogroup/yes-no-radiogroup.component.mjs +0 -82
  168. package/esm2022/public-api.mjs +0 -49
  169. package/fesm2022/kms-ngx-ui-presentational.mjs +0 -3003
  170. package/fesm2022/kms-ngx-ui-presentational.mjs.map +0 -1
  171. package/index.d.ts +0 -5
  172. package/lib/directives/directives.module.d.ts +0 -11
  173. package/lib/directives/mousewheel.directive.d.ts +0 -15
  174. package/lib/directives/sum-of-height.directive.d.ts +0 -31
  175. package/lib/directives/swipe.directive.d.ts +0 -45
  176. package/lib/directives/tooltip.directive.d.ts +0 -29
  177. package/lib/kms-ngx-ui-presentational.component.d.ts +0 -8
  178. package/lib/kms-ngx-ui-presentational.module.d.ts +0 -47
  179. package/lib/kms-ngx-ui-presentational.service.d.ts +0 -6
  180. package/lib/models/address.model.d.ts +0 -14
  181. package/lib/models/iconSize.enum.d.ts +0 -15
  182. package/lib/models/image-snippet.model.d.ts +0 -15
  183. package/lib/models/is-value.function.d.ts +0 -9
  184. package/lib/models/salutation.enum.d.ts +0 -5
  185. package/lib/parent-components/actions.component.d.ts +0 -31
  186. package/lib/parent-components/form-control.component.d.ts +0 -27
  187. package/lib/parent-components/form.component.d.ts +0 -34
  188. package/lib/pipes/custom-pipes.module.d.ts +0 -17
  189. package/lib/pipes/decode-uri.pipe.d.ts +0 -10
  190. package/lib/pipes/encode-uri.pipe.d.ts +0 -10
  191. package/lib/pipes/integer-currency.pipe.d.ts +0 -13
  192. package/lib/pipes/safe-html.pipe.d.ts +0 -13
  193. package/lib/pipes/safe-resource-url.pipe.d.ts +0 -13
  194. package/lib/pipes/safe-style.pipe.d.ts +0 -13
  195. package/lib/pipes/safe-url.pipe.d.ts +0 -13
  196. package/lib/pipes/to-number.pipe.d.ts +0 -10
  197. package/lib/pipes/trim.pipe.d.ts +0 -10
  198. package/lib/pipes/typeof.pipe.d.ts +0 -7
  199. package/lib/services/viewport.service.d.ts +0 -74
  200. package/lib/ui/back-to-top/back-to-top.component.d.ts +0 -10
  201. package/lib/ui/button-with-confirm-dialog/button-response-types.enum.d.ts +0 -4
  202. package/lib/ui/button-with-confirm-dialog/button-with-confirm-dialog.component.d.ts +0 -19
  203. package/lib/ui/checkbox/checkbox.component.d.ts +0 -31
  204. package/lib/ui/color-input/color-input.component.d.ts +0 -19
  205. package/lib/ui/dropdown-from-data/dropdown-from-data.component.d.ts +0 -55
  206. package/lib/ui/enum-radiogroup/enum-radiogroup.component.d.ts +0 -17
  207. package/lib/ui/file-input/file-input.component.d.ts +0 -89
  208. package/lib/ui/flyout/flyout.component.d.ts +0 -32
  209. package/lib/ui/generic-dialog/generic-dialog.component.d.ts +0 -26
  210. package/lib/ui/icon/icon.component.d.ts +0 -42
  211. package/lib/ui/icon/iconSize.enum.d.ts +0 -15
  212. package/lib/ui/image-slider/image-slider.component.d.ts +0 -62
  213. package/lib/ui/kms-accordion-item/kms-accordion-item.component.d.ts +0 -22
  214. package/lib/ui/loader/loader.component.d.ts +0 -9
  215. package/lib/ui/map/map.component.d.ts +0 -71
  216. package/lib/ui/radiobutton/radiobutton.component.d.ts +0 -26
  217. package/lib/ui/salutation-dropdown/salutation-dropdown.component.d.ts +0 -17
  218. package/lib/ui/salutation-radiogroup/salutation-radiogroup.component.d.ts +0 -15
  219. package/lib/ui/time-input/time-input.component.d.ts +0 -22
  220. package/lib/ui/tooltip/tooltip.component.d.ts +0 -6
  221. package/lib/ui/tooltip-icon/tooltip-icon.component.d.ts +0 -13
  222. package/lib/ui/yes-no-radiogroup/yes-no-radiogroup.component.d.ts +0 -27
  223. /package/{lib/models/index.d.ts → src/lib/models/index.ts} +0 -0
@@ -0,0 +1,35 @@
1
+ <div class="flyout"
2
+ [ngClass]="{'is-active': isDropdownOpened}"
3
+ >
4
+ <div class="flyout-header" (click)="toggleDropdownHeader()" [ngClass]="headerCssClass">
5
+ <span [innerHtml]="headerTitle | kmsSafeHtml"></span>
6
+ <span [innerHtml]="headerText | kmsSafeHtml"></span>
7
+
8
+ <ng-content select="[header]"></ng-content>
9
+
10
+ <div *ngIf="hasButtonForMore" (click)="toggleDropdown()" class="flyout-header-more">
11
+ <span *ngIf="!isDropdownOpened">
12
+ {{ moreText }}
13
+ </span>
14
+ <span *ngIf="isDropdownOpened">
15
+ {{ lessText }}
16
+ </span>
17
+ <kms-icon [icon]="'chevron-down'"
18
+ [iconClass]="{'size-16': true, 'is-rotating180': isDropdownOpened}" >
19
+ </kms-icon>
20
+ </div>
21
+ </div>
22
+ <div
23
+ class="flyout-body"
24
+ [ngClass]="bodyCssClass"
25
+ tabindex="0"
26
+ [@dropdownAnimation]="{value: isDropdownOpened, params: {targetHeight: targetHeight, animationTime: '500'}}"
27
+ getMaxHeight="inner"
28
+ (sumOfHeight)="setDropdownListHeight($event)"
29
+ #flyoutHeader>
30
+ <div class="inner" #content>
31
+ <ng-content ></ng-content>
32
+ </div>
33
+ </div>
34
+
35
+ </div>
@@ -0,0 +1,30 @@
1
+ /*!
2
+ * @copyright FLYACTS GmbH 2019
3
+ */
4
+
5
+ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
6
+
7
+ import { FlyoutComponent } from './flyout.component';
8
+
9
+ describe('FlyoutComponent', () => {
10
+ let component: FlyoutComponent;
11
+ let fixture: ComponentFixture<FlyoutComponent>;
12
+
13
+ beforeEach(async(() => {
14
+
15
+ TestBed.configureTestingModule({
16
+ declarations: [FlyoutComponent],
17
+ })
18
+ .compileComponents();
19
+ }));
20
+
21
+ beforeEach(() => {
22
+ fixture = TestBed.createComponent(FlyoutComponent);
23
+ component = fixture.componentInstance;
24
+ fixture.detectChanges();
25
+ });
26
+
27
+ it('should create', () => {
28
+ expect(component).toBeTruthy();
29
+ });
30
+ });
@@ -0,0 +1,95 @@
1
+ /*!
2
+ * @copyright FLYACTS GmbH 2019
3
+ */
4
+
5
+ import { state, style, trigger } from '@angular/animations';
6
+ import {
7
+ Component,
8
+ ElementRef,
9
+ Input,
10
+ ViewChild,
11
+ } from '@angular/core';
12
+
13
+ @Component({
14
+
15
+ selector: 'kms-flyout',
16
+ templateUrl: './flyout.component.html',
17
+ styleUrls: ['./flyout.component.scss'],
18
+ animations: [
19
+ trigger('dropdownAnimation', [
20
+ state(
21
+ 'true',
22
+ style({
23
+ height: '{{targetHeight}}',
24
+ transition: 'height {{animationTime}}ms ease-in-out',
25
+ }),
26
+ {
27
+ params: {
28
+ targetHeight: '300px',
29
+ animationTime: 3000,
30
+ },
31
+ },
32
+ ),
33
+ state(
34
+ 'false',
35
+ style({
36
+ height: 0,
37
+ transition: 'height {{animationTime}}ms ease-in-out',
38
+ }),
39
+ {
40
+ params: {
41
+ targetHeight: '300px',
42
+ opacity: 0,
43
+ animationTime: 3000,
44
+ },
45
+ },
46
+ ),
47
+ ]),
48
+ ],
49
+ })
50
+ export class FlyoutComponent {
51
+
52
+ @Input() icon = 'filter';
53
+
54
+ isDropdownOpened = false;
55
+ targetHeight = '0';
56
+ animationTime = 5000;
57
+
58
+ @Input() headerCssClass = '';
59
+ @Input() bodyCssClass = '';
60
+
61
+ @Input() headerTitle = '';
62
+ @Input() headerText = '';
63
+ @Input() hasButtonForMore = false;
64
+ @Input() moreText = '';
65
+ @Input() lessText = '';
66
+
67
+
68
+ @ViewChild('content') content: ElementRef | undefined;
69
+
70
+ @ViewChild('flyoutHeader') flyoutHeader: ElementRef | undefined;
71
+
72
+ /**
73
+ * Open/close dropdown if click on header.
74
+ * Except, if mode is set to hasButtonForMore. When there is a extra button to open/close
75
+ */
76
+ toggleDropdownHeader() {
77
+ if (!this.hasButtonForMore) {
78
+ this.toggleDropdown();
79
+ }
80
+ }
81
+
82
+ /**
83
+ * Open or close the dropdown
84
+ */
85
+ toggleDropdown() {
86
+ this.isDropdownOpened = !this.isDropdownOpened;
87
+ }
88
+
89
+ /**
90
+ * Set the height of the dropdown list items dynamic - needed for the animation
91
+ */
92
+ setDropdownListHeight(contentHeight: number) {
93
+ this.targetHeight = `${contentHeight}px`;
94
+ }
95
+ }
@@ -0,0 +1,24 @@
1
+ <div mat-dialog-title class="mat-dialog-title">
2
+ <h3>{{ data.title }}</h3>
3
+ </div>
4
+ <div mat-dialog-content class="mat-dialog-content">
5
+ {{ data.message }}
6
+ </div>
7
+ <div mat-dialog-actions class="custom-dialog-actions">
8
+ <button
9
+ mat-flat-button
10
+ class="test_secondary_button"
11
+ color="accent"
12
+ (click)="onClickAction(ButtonResponseType.secondary)"
13
+ >
14
+ {{ buttons.secondary }}
15
+ </button>
16
+ <button
17
+ mat-flat-button
18
+ class="test_primary_button"
19
+ color="primary"
20
+ (click)="onClickAction(ButtonResponseType.primary)"
21
+ >
22
+ {{ buttons.primary }}
23
+ </button>
24
+ </div>
@@ -0,0 +1,43 @@
1
+ /*!
2
+ * @copyright FLYACTS GmbH 2019
3
+ */
4
+
5
+ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
6
+ import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
7
+
8
+ import { GenericDialogComponent } from './generic-dialog.component';
9
+
10
+ describe('GenericDialogComponent', () => {
11
+ let component: GenericDialogComponent;
12
+ let fixture: ComponentFixture<GenericDialogComponent>;
13
+
14
+ beforeEach(async(async () => {
15
+ await TestBed.configureTestingModule({
16
+ declarations: [GenericDialogComponent],
17
+ imports: [
18
+ MatDialogModule,
19
+ ],
20
+ providers: [{
21
+ provide: MatDialogRef,
22
+ useValue: {},
23
+ },
24
+ { provide: MAT_DIALOG_DATA, useValue: {} },
25
+ ],
26
+ })
27
+ .compileComponents();
28
+ }));
29
+
30
+ beforeEach(() => {
31
+ fixture = TestBed.createComponent(GenericDialogComponent);
32
+ component = fixture.componentInstance;
33
+ fixture.detectChanges();
34
+ });
35
+
36
+ it('should create', () => {
37
+ expect(component).toBeTruthy();
38
+ });
39
+
40
+ it('should set buttons', () => {
41
+ expect(component.buttons).toStrictEqual({ primary: 'Yes', secondary: 'No' });
42
+ });
43
+ });
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @copyright KMS GmbH
3
+ */
4
+
5
+ import { Component, Inject, NgZone } from '@angular/core';
6
+ import { MAT_LEGACY_DIALOG_DATA as MAT_DIALOG_DATA, MatLegacyDialogRef as MatDialogRef } from '@angular/material/legacy-dialog';
7
+ import { isValue } from '../../models';
8
+ import { ButtonResponseType } from '../button-with-confirm-dialog/button-response-types.enum';
9
+ import { DialogData, DialogDataButtons } from '../button-with-confirm-dialog/dialog-data.model';
10
+
11
+ /**
12
+ * A generic dialog component
13
+ */
14
+ @Component({
15
+ selector: 'kms-generic-dialog',
16
+ templateUrl: './generic-dialog.component.html',
17
+ styleUrls: ['./generic-dialog.component.scss'],
18
+ })
19
+ export class GenericDialogComponent {
20
+
21
+ ButtonResponseType = ButtonResponseType;
22
+
23
+ public buttons: DialogDataButtons
24
+
25
+ public constructor(
26
+ public dialogRef: MatDialogRef<GenericDialogComponent>,
27
+ public zone: NgZone,
28
+ @Inject(MAT_DIALOG_DATA) public data: DialogData
29
+ ) {
30
+ if (isValue(data.buttons)) {
31
+ this.buttons = data.buttons;
32
+ } else {
33
+ this.buttons = { primary: 'Yes', secondary: 'No' } as DialogDataButtons;
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Action called when clicked
39
+ * @param clickedButton Whether the primary or secondary button was clicked
40
+ */
41
+ public onClickAction(clickedButton: ButtonResponseType): void {
42
+ this.zone.run(() => {
43
+ this.dialogRef.close(clickedButton);
44
+ this.dialogRef.afterClosed().subscribe(() => {
45
+ const buttonList = document.querySelectorAll('.mat-flat-button, .mat-button');
46
+ let i = 0;
47
+ for (i; i < buttonList.length; i++) {
48
+ buttonList[i].classList.remove('cdk-focused');
49
+ buttonList[i].classList.remove('cdk-program-focused');
50
+ }
51
+ });
52
+ });
53
+ }
54
+ }
@@ -0,0 +1,22 @@
1
+ <ng-container *ngIf="icon !== 'none' && dontUseSprite === false">
2
+ <span class="icon {{ iconSize }}" [ngClass]="iconClass" [ngStyle]="iconStyle">
3
+ <svg>
4
+ <use
5
+ [attr.xlink:href]="
6
+ 'assets/sprite.svg?Version=' + Version + '#' + iconToShow
7
+ "
8
+ ></use>
9
+ </svg>
10
+ </span>
11
+ </ng-container>
12
+ <ng-container *ngIf="icon !== 'none' && dontUseSprite === true">
13
+ <object
14
+ [data]="
15
+ sanitizer.bypassSecurityTrustResourceUrl('assets/icons/' + icon + '')
16
+ "
17
+ type="image/svg+xml"
18
+ class="icon {{ iconSize }}"
19
+ [ngClass]="iconClass"
20
+ [ngStyle]="iconStyle"
21
+ ></object>
22
+ </ng-container>
@@ -0,0 +1,31 @@
1
+ /*!
2
+ * @copyright FLYACTS GmbH 2019
3
+ */
4
+
5
+
6
+ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
7
+
8
+ import { IconComponent } from './icon.component';
9
+
10
+ describe('IconComponent', () => {
11
+ let component: IconComponent;
12
+ let fixture: ComponentFixture<IconComponent>;
13
+
14
+ beforeEach(async(() => {
15
+
16
+ TestBed.configureTestingModule({
17
+ declarations: [IconComponent],
18
+ })
19
+ .compileComponents();
20
+ }));
21
+
22
+ beforeEach(() => {
23
+ fixture = TestBed.createComponent(IconComponent);
24
+ component = fixture.componentInstance;
25
+ fixture.detectChanges();
26
+ });
27
+
28
+ it('should create', () => {
29
+ expect(component).toBeTruthy();
30
+ });
31
+ });
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @copyright KMS GmbH
3
+ */
4
+
5
+ import { Component, Input, OnInit, VERSION } from '@angular/core';
6
+ import { DomSanitizer } from '@angular/platform-browser';
7
+
8
+ import { IconSize } from './iconSize.enum';
9
+
10
+ @Component({
11
+
12
+ selector: 'kms-icon',
13
+ templateUrl: './icon.component.html',
14
+ styleUrls: ['./icon.component.scss'],
15
+ })
16
+ export class IconComponent implements OnInit {
17
+
18
+ /**
19
+ * Required: Name of the SVG icon inside your sprite sheet file with name 'icons.svg'.
20
+ * Pass 'none' if no icon should be rendered.
21
+ */
22
+ @Input() icon!: string | '';
23
+
24
+ /**
25
+ * Optional: Different appearance via CSS class defined in this component´s style sheet.
26
+ */
27
+ @Input() iconClass!: string | '';
28
+
29
+ /**
30
+ * Optional: Different appearance via CSS inline style.
31
+ */
32
+
33
+ @Input() iconStyle: any;
34
+
35
+ /**
36
+ * Optional: Different size via CSS inline style.
37
+ */
38
+ @Input() iconSize: IconSize = IconSize.FULLSIZE;
39
+
40
+ /**
41
+ * Dont use icon sprite
42
+ */
43
+
44
+ @Input() dontUseSprite = false;
45
+
46
+ IconSize = IconSize;
47
+ Version = VERSION.full;
48
+
49
+ public timestamp = 0;
50
+
51
+ /**
52
+ * Renders this icon from SVG sprite sheet
53
+ */
54
+ public iconToShow!: string | '';
55
+
56
+ constructor(public sanitizer: DomSanitizer) {
57
+ this.iconToShow = this.icon;
58
+ }
59
+
60
+ ngOnInit() {
61
+ this.iconToShow = this.icon;
62
+ const d = new Date();
63
+ const n = d.getTime();
64
+ this.timestamp = n;
65
+ }
66
+
67
+ }
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * @copyright FLYACTS GmbH 2019
3
+ */
4
+
5
+ export enum IconSize {
6
+ FULLSIZE = 'size-full',
7
+ TINY = 'size-16',
8
+ SMALLER = 'size-20',
9
+ SMALL = 'size-32',
10
+ MEDIUM = 'size-64',
11
+ LARGE = 'size-128',
12
+ XL = 'size-256',
13
+ XXL = 'size-512',
14
+ XXXL = 'size-1024',
15
+ NONE = 'NONE',
16
+ }
17
+
@@ -0,0 +1,54 @@
1
+ <div class="all-wrapper">
2
+ <!--(swiperight)="previousSlide()" (swipeleft)="nextSlide()"-->
3
+ <div
4
+ class="swiper-bigImage"
5
+ [style.backgroundImage]="selectedSlideImage"
6
+ [swipeDirective]="swipeConfig"
7
+ (moveEvent)="handleMoveEvent($event)"
8
+ (releaseEvent)="handleReleaseEvent($event)"
9
+ (mouseup)="lastClicked()"
10
+ (mouseout)="noLastClicked()" >
11
+ </div>
12
+
13
+ <ng-content select="[description]"></ng-content>
14
+
15
+ <div class="swiper-holder">
16
+ <!--
17
+ (mouseWheelUp)="scrollLeft($event)"
18
+ (mouseWheelDown)="scrollRight($event)"
19
+ -->
20
+
21
+ <swiper [config]="config" #usefulSwiper>
22
+ <div class="swiper-wrapper"
23
+ cdkDropList (cdkDropListDropped)="drop($event)"
24
+ cdkDropListOrientation="horizontal">
25
+ <div class="swiper-slide"
26
+ *ngFor="let slide of slides; let index = index"
27
+ cdkDrag [cdkDragDisabled]="!editMode">
28
+ <button mat-menu-item *ngIf="editMode" (click)="deleteImage(index)">
29
+ <kms-icon icon="trash"></kms-icon>
30
+ </button>
31
+ <div class="img" (click)="openSlide(index)"
32
+ [style.backgroundImage]="sanitizer.bypassSecurityTrustStyle('url(' + slide + ')')"
33
+ [ngClass]="{'active': index === selectedSlide}">
34
+ </div>
35
+
36
+ <div class="default-image">{{"common.defaultImage" | translate}} </div>
37
+ </div>
38
+ </div>
39
+ </swiper>
40
+
41
+ <div class="swiper-button-next" *ngIf="slides?.length > 3"></div>
42
+ <div class="swiper-button-prev" *ngIf="slides?.length > 3"></div>
43
+
44
+ <div class="swiper-button-next2" *ngIf="slides?.length > 1" (click)="nextSlide()">
45
+ <kms-icon icon="chevron-right" [iconClass]="{'color-disabled': selectedSlide == slides?.length - 1, 'color-primary': true}"></kms-icon>
46
+ </div>
47
+ <div class="swiper-button-prev2" *ngIf="slides?.length > 1" (click)="previousSlide()">
48
+ <kms-icon icon="chevron-left" [iconClass]="{'color-disabled': selectedSlide == 0, 'color-primary': true}"></kms-icon>
49
+ </div>
50
+
51
+ </div>
52
+
53
+ <ng-content></ng-content>
54
+ </div>
@@ -0,0 +1,205 @@
1
+ /*!
2
+ * @copyright FLYACTS GmbH 2019
3
+ */
4
+
5
+ import {
6
+ Component,
7
+ EventEmitter,
8
+ HostListener,
9
+ Input,
10
+ OnChanges,
11
+ OnInit,
12
+ Output,
13
+ SimpleChanges,
14
+ ViewChild,
15
+ } from '@angular/core';
16
+ import { DomSanitizer, SafeStyle } from '@angular/platform-browser';
17
+
18
+ import { SwiperComponent } from 'ngx-useful-swiper';
19
+ import { SwiperOptions } from 'swiper';
20
+ import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
21
+ import { ImageSnippet } from '../../models/image-snippet.model';
22
+ import { SwipeMoveEvent, SwipeOptions, SwipeReleaseEvent } from '../../directives/swipe.model';
23
+
24
+
25
+ @Component({
26
+ selector: 'kms-image-slider',
27
+ templateUrl: './image-slider.component.html',
28
+ styleUrls: ['./image-slider.component.scss'],
29
+ })
30
+ export class ImageSliderComponent implements OnInit, OnChanges {
31
+ @Input() slides: string[] | undefined;
32
+ @Input() editMode = false;
33
+ @Input() imagesTOSave: ImageSnippet[] | undefined;
34
+ @Output() orderChanged: EventEmitter<ImageSnippet[]> = new EventEmitter();
35
+ @Output() deleteImageEvent: EventEmitter<number> = new EventEmitter();
36
+
37
+ /**
38
+ * Optional: Define Swipe behaviour configuration.
39
+ * Default is 10% for the threshold definition until a swipe triggers next/previous slide.
40
+ */
41
+ @Input() swipeConfig: SwipeOptions = {
42
+ swipeThreshold: 5,
43
+ swipeThresholdType: '%',
44
+ swipeLocalPosition: true,
45
+ };
46
+
47
+ public selectedSlide = 0;
48
+ public checkedImageIndex?: number;
49
+
50
+ public selectedSlideImage: SafeStyle | undefined;
51
+ public isLastClickedInSliderImage = false;
52
+
53
+ @ViewChild('usefulSwiper') usefulSwiper: SwiperComponent | undefined;
54
+
55
+ config: SwiperOptions = {
56
+ initialSlide: 0,
57
+ slidesPerView: 3,
58
+ navigation: {
59
+ nextEl: '.swiper-button-next',
60
+ prevEl: '.swiper-button-prev',
61
+ },
62
+ watchOverflow: true,
63
+ autoHeight: true,
64
+ allowTouchMove: false,
65
+ spaceBetween: 30,
66
+ on: {
67
+ slideChange: () => {
68
+ // do something
69
+ },
70
+ slideChangeTransitionEnd: () => {
71
+ // do something
72
+ },
73
+ },
74
+ };
75
+
76
+ constructor(public sanitizer: DomSanitizer) {}
77
+
78
+ ngOnInit() {
79
+ if (this.slides) {
80
+ // TODO use Pipe safeStyle
81
+
82
+ this.selectedSlideImage = this.sanitizer.bypassSecurityTrustStyle('url(' + this.slides[0] + ')');
83
+ }
84
+ }
85
+
86
+ // !TODO
87
+ @HostListener('document:keydown', ['$event']) onKeydownHandler(event: KeyboardEvent) {
88
+ if (event.key === 'ArrowRight') {
89
+ this.nextSlide();
90
+ }
91
+ if (event.key === 'ArrowLeft') {
92
+ this.previousSlide();
93
+ }
94
+ }
95
+
96
+ /**
97
+ * Slide follows the finger or mouse according to it´s move delta.
98
+ * @param event SwipeMoveEvent
99
+ */
100
+ handleMoveEvent(event: SwipeMoveEvent) {
101
+ // certain move threshold needs to be reached
102
+ if (!event.thresholdWasReached) {
103
+ return;
104
+ }
105
+ this.config.direction = event.direction === 1 ? 'horizontal' : 'vertical';
106
+ }
107
+
108
+ /**
109
+ * Mouse up or slide container was left.
110
+ * @param event SwipeReleaseEvent
111
+ */
112
+ handleReleaseEvent(event: SwipeReleaseEvent) {
113
+ if (!event.thresholdWasReached) {
114
+ return;
115
+ }
116
+ // Just do if user clicked to slide on image and not on arrow or other element
117
+ if (!this.isLastClickedInSliderImage) {
118
+ return;
119
+ }
120
+ if (event.direction === 1) {
121
+ this.previousSlide();
122
+ } else {
123
+ this.nextSlide();
124
+ }
125
+ }
126
+
127
+ lastClicked() {
128
+ this.isLastClickedInSliderImage = true;
129
+ }
130
+
131
+ noLastClicked() {
132
+ this.isLastClickedInSliderImage = false;
133
+ }
134
+
135
+ scrollLeft() {
136
+ this.previousSlide();
137
+ }
138
+
139
+ scrollRight() {
140
+ this.nextSlide();
141
+ }
142
+
143
+ nextSlide() {
144
+ if (this.slides && this.selectedSlide < this.slides.length - 1) {
145
+ if (this.usefulSwiper) {
146
+ this.usefulSwiper.swiper.slideNext();
147
+ }
148
+ this.openSlide(this.selectedSlide + 1);
149
+ }
150
+ this.isLastClickedInSliderImage = false;
151
+ }
152
+
153
+ previousSlide() {
154
+ if (this.selectedSlide > 0) {
155
+ if (this.usefulSwiper) {
156
+ this.usefulSwiper.swiper.slidePrev();
157
+ }
158
+ this.openSlide(this.selectedSlide - 1);
159
+ }
160
+ this.isLastClickedInSliderImage = false;
161
+ }
162
+
163
+ slideTo(index: number) {
164
+ if (this.usefulSwiper) {
165
+ this.usefulSwiper.swiper.slideTo(index);
166
+ }
167
+ }
168
+
169
+ openSlide(number: number) {
170
+ if (this.slides && number < this.slides.length && number >= 0) {
171
+ this.selectedSlide = number;
172
+ // TODO use Pipe safeStyle
173
+
174
+ this.selectedSlideImage = this.sanitizer.bypassSecurityTrustStyle('url(' + this.slides[number] || ')');
175
+ }
176
+ }
177
+
178
+ ngOnChanges(_changes: SimpleChanges) {
179
+ if (_changes.slides) {
180
+ if (this.slides) {
181
+ // TODO use Pipe safeStyle
182
+
183
+ this.selectedSlideImage = this.sanitizer.bypassSecurityTrustStyle('url(' + this.slides[0] + ')');
184
+ }
185
+ }
186
+ }
187
+
188
+ /**
189
+ * Re-order slides and notify parent component
190
+ */
191
+ drop(event: CdkDragDrop<string[]>) {
192
+ if (this.slides && this.imagesTOSave) {
193
+ moveItemInArray(this.slides, event.previousIndex, event.currentIndex);
194
+ moveItemInArray(this.imagesTOSave, event.previousIndex, event.currentIndex);
195
+ this.orderChanged.emit(this.imagesTOSave);
196
+ }
197
+ }
198
+
199
+ /**
200
+ * Send image index to parent to perform delete
201
+ */
202
+ deleteImage(index: number) {
203
+ this.deleteImageEvent.emit(index);
204
+ }
205
+ }